diff --git a/.gitattributes b/.gitattributes index 610bf12a05dc..bbd8e76b00ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,9 +3,9 @@ **/generated/* linguist-generated=true text=auto eol=lf /crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs linguist-generated=true text=auto eol=lf /crates/biome_configuration/src/generated.rs linguist-generated=true text=auto eol=lf -/crates/biome_configuration/src/linter/rules.rs linguist-generated=true text=auto eol=lf -/crates/biome_configuration/src/assists/rules.rs linguist-generated=true text=auto eol=lf -/crates/biome_configuration/src/parse/json/rules.rs linguist-generated=true text=auto eol=lf +/crates/biome_configuration/src/analyzer/linter/rules.rs linguist-generated=true text=auto eol=lf +/crates/biome_configuration/src/analyzer/assists/actions.rs linguist-generated=true text=auto eol=lf +/crates/biome_configuration/src/analyzer/parse/rules.rs linguist-generated=true text=auto eol=lf # GraphQL /crates/biome_graphql_analyze/src/{lint,assists,syntax}.rs linguist-generated=true text=auto eol=lf /crates/biome_graphql_analyze/src/{lint,assists,syntax}/*.rs linguist-generated=true text=auto eol=lf diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a810866eb51..0b04f68dd6f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b #### Bug fixes +- Fix CSS parser case error, `@-moz-document url-prefix(https://example.com)` and `@-moz-document domain(example.com)` are now valid. Contributed by @eryue0220 - Fix [#4258](https://github.com/biomejs/biome/issues/4258), where fixed css parse error with @-moz-document url-prefix(). Contributed by @eryue0220 ### CLI @@ -89,7 +90,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b ) {} } ``` - + Contributed by @fireairforce - Fix [#3836](https://github.com/biomejs/biome/issues/3836), css parser allow multiple semicolons after a declaration, the following example will now parsed correctly: @@ -375,7 +376,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b - Fix [#3364](https://github.com/biomejs/biome/issues/3364) where the `useSelfClosingElements` rule forces the `script` tag to be self-closing. Previously, this rule applies to all elements and cannot be disabled for native HTML elements. Now, this rule accepts a `ignoreHtmlElements` option, which when set to `true`, ignores native HTML elements and allows them to be non-self-closing. - + Contributed by @abidjappie - Fix a case where raw values inside `url()` functions weren't properly trimmed. diff --git a/Cargo.lock b/Cargo.lock index 05b99955c80f..f98c9dea13e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -804,17 +804,22 @@ dependencies = [ name = "biome_js_parser" version = "0.5.7" dependencies = [ + "biome_configuration", "biome_console", + "biome_deserialize", "biome_diagnostics", + "biome_fs", "biome_js_factory", "biome_js_syntax", "biome_parser", "biome_rowan", + "biome_service", + "biome_test_utils", "biome_unicode_table", "drop_bomb", "enumflags2", - "expect-test", "indexmap 2.6.0", + "insta", "quickcheck", "quickcheck_macros", "rustc-hash 1.1.0", @@ -1735,12 +1740,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "dissimilar" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210ec60ae7d710bed8683e333e9d2855a8a56a3e9892b38bad3bb0d4d29b0d5e" - [[package]] name = "drop_bomb" version = "0.1.5" @@ -1838,16 +1837,6 @@ dependencies = [ "libc", ] -[[package]] -name = "expect-test" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e0be0a561335815e06dab7c62e50353134c796e7a6155402a64bcff66b6a5e0" -dependencies = [ - "dissimilar", - "once_cell", -] - [[package]] name = "fastbloom-rs" version = "0.5.9" diff --git a/crates/biome_configuration/src/javascript/mod.rs b/crates/biome_configuration/src/javascript/mod.rs index 9ac646202d41..7c1e131205aa 100644 --- a/crates/biome_configuration/src/javascript/mod.rs +++ b/crates/biome_configuration/src/javascript/mod.rs @@ -63,6 +63,11 @@ pub struct JavascriptParser { /// These decorators belong to an old proposal, and they are subject to change. #[partial(bpaf(hide))] pub unsafe_parameter_decorators_enabled: bool, + + /// Enables parsing of Grit metavariables. + /// Defaults to `false`. + #[partial(bpaf(hide))] + pub grit_metavariables: bool, } /// Indicates the type of runtime or transformation used for interpreting JSX. diff --git a/crates/biome_css_factory/src/generated/node_factory.rs b/crates/biome_css_factory/src/generated/node_factory.rs index c5c80247fcbe..7a186974d9b5 100644 --- a/crates/biome_css_factory/src/generated/node_factory.rs +++ b/crates/biome_css_factory/src/generated/node_factory.rs @@ -627,10 +627,10 @@ pub struct CssDocumentCustomMatcherBuilder { name_token: SyntaxToken, l_paren_token: SyntaxToken, r_paren_token: SyntaxToken, - value: Option, + value: Option, } impl CssDocumentCustomMatcherBuilder { - pub fn with_value(mut self, value: CssString) -> Self { + pub fn with_value(mut self, value: AnyCssUrlValue) -> Self { self.value = Some(value); self } diff --git a/crates/biome_css_factory/src/generated/syntax_factory.rs b/crates/biome_css_factory/src/generated/syntax_factory.rs index 8c27279ccea4..2f2fa8c3560a 100644 --- a/crates/biome_css_factory/src/generated/syntax_factory.rs +++ b/crates/biome_css_factory/src/generated/syntax_factory.rs @@ -1193,7 +1193,7 @@ impl SyntaxFactory for CssSyntaxFactory { } slots.next_slot(); if let Some(element) = ¤t_element { - if CssString::can_cast(element.kind()) { + if AnyCssUrlValue::can_cast(element.kind()) { slots.mark_present(); current_element = elements.next(); } diff --git a/crates/biome_css_parser/src/syntax/at_rule/document.rs b/crates/biome_css_parser/src/syntax/at_rule/document.rs index 4be29294084b..334e08576232 100644 --- a/crates/biome_css_parser/src/syntax/at_rule/document.rs +++ b/crates/biome_css_parser/src/syntax/at_rule/document.rs @@ -159,7 +159,11 @@ pub(crate) fn is_at_document_custom_matcher(p: &mut CssParser) -> bool { p.at_ts(DOCUMENT_CUSTOM_MATCHER_SET) && p.nth_at(1, T!['(']) } -const URL_PREFIX_SET: TokenSet = token_set!(T![url_prefix]); +// According to MDN, `url-prefix()`, `domain()` and `media-document()` functions +// can be optionally enclosed by single or double quotes. +// @see https://developer.mozilla.org/en-US/docs/Web/CSS/@document +const URL_PREFIX_SET: TokenSet = + token_set!(T![url_prefix], T![domain], T![media_document]); pub(crate) fn is_at_url_prefix(p: &mut CssParser) -> bool { p.at_ts(URL_PREFIX_SET) && p.nth_at(1, T!['(']) diff --git a/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css b/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css index 4ff2c264898e..1f2a3ce70fe0 100644 --- a/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css +++ b/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css @@ -38,3 +38,21 @@ background-color: green; } } + +@-moz-document url-prefix(https://example.com) { + body { + background-color: green; + } +} + +@-moz-document url(http://www.exmaple.org/), url-prefix(https://www.example.com/test), domain(example.com) { + body { + background-color: green; + } +} + +@-moz-document url(http://www.exmaple.org/), url-prefix(https: //www.example.com/test), domain(example.com), media-document(video) { + body { + background-color: green; + } +} diff --git a/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css.snap b/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css.snap index 3a6e06b547a2..308772725a82 100644 --- a/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css.snap +++ b/crates/biome_css_parser/tests/css_test_suite/ok/at_rule/at_rule_document.css.snap @@ -47,6 +47,24 @@ expression: snapshot } } +@-moz-document url-prefix(https://example.com) { + body { + background-color: green; + } +} + +@-moz-document url(http://www.exmaple.org/), url-prefix(https://www.example.com/test), domain(example.com) { + body { + background-color: green; + } +} + +@-moz-document url(http://www.exmaple.org/), url-prefix(https: //www.example.com/test), domain(example.com), media-document(video) { + body { + background-color: green; + } +} + ``` @@ -558,17 +576,241 @@ CssRoot { }, }, }, + CssAtRule { + at_token: AT@820..823 "@" [Newline("\n"), Newline("\n")] [], + rule: CssDocumentAtRule { + document_token: DOCUMENT_KW@823..837 "-moz-document" [] [Whitespace(" ")], + matchers: CssDocumentMatcherList [ + CssDocumentCustomMatcher { + name: URL_PREFIX_KW@837..847 "url-prefix" [] [], + l_paren_token: L_PAREN@847..848 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@848..867 "https://example.com" [] [], + }, + r_paren_token: R_PAREN@867..869 ")" [] [Whitespace(" ")], + }, + ], + block: CssRuleBlock { + l_curly_token: L_CURLY@869..870 "{" [] [], + rules: CssRuleList [ + CssQualifiedRule { + prelude: CssSelectorList [ + CssCompoundSelector { + nesting_selectors: CssNestedSelectorList [], + simple_selector: CssTypeSelector { + namespace: missing (optional), + ident: CssIdentifier { + value_token: IDENT@870..877 "body" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + }, + sub_selectors: CssSubSelectorList [], + }, + ], + block: CssDeclarationOrRuleBlock { + l_curly_token: L_CURLY@877..878 "{" [] [], + items: CssDeclarationOrRuleList [ + CssDeclarationWithSemicolon { + declaration: CssDeclaration { + property: CssGenericProperty { + name: CssIdentifier { + value_token: IDENT@878..897 "background-color" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@897..899 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + CssIdentifier { + value_token: IDENT@899..904 "green" [] [], + }, + ], + }, + important: missing (optional), + }, + semicolon_token: SEMICOLON@904..905 ";" [] [], + }, + ], + r_curly_token: R_CURLY@905..908 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@908..910 "}" [Newline("\n")] [], + }, + }, + }, + CssAtRule { + at_token: AT@910..913 "@" [Newline("\n"), Newline("\n")] [], + rule: CssDocumentAtRule { + document_token: DOCUMENT_KW@913..927 "-moz-document" [] [Whitespace(" ")], + matchers: CssDocumentMatcherList [ + CssUrlFunction { + name: URL_KW@927..930 "url" [] [], + l_paren_token: L_PAREN@930..931 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@931..954 "http://www.exmaple.org/" [] [], + }, + modifiers: CssUrlModifierList [], + r_paren_token: R_PAREN@954..955 ")" [] [], + }, + COMMA@955..957 "," [] [Whitespace(" ")], + CssDocumentCustomMatcher { + name: URL_PREFIX_KW@957..967 "url-prefix" [] [], + l_paren_token: L_PAREN@967..968 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@968..996 "https://www.example.com/test" [] [], + }, + r_paren_token: R_PAREN@996..997 ")" [] [], + }, + COMMA@997..999 "," [] [Whitespace(" ")], + CssDocumentCustomMatcher { + name: DOMAIN_KW@999..1005 "domain" [] [], + l_paren_token: L_PAREN@1005..1006 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@1006..1017 "example.com" [] [], + }, + r_paren_token: R_PAREN@1017..1019 ")" [] [Whitespace(" ")], + }, + ], + block: CssRuleBlock { + l_curly_token: L_CURLY@1019..1020 "{" [] [], + rules: CssRuleList [ + CssQualifiedRule { + prelude: CssSelectorList [ + CssCompoundSelector { + nesting_selectors: CssNestedSelectorList [], + simple_selector: CssTypeSelector { + namespace: missing (optional), + ident: CssIdentifier { + value_token: IDENT@1020..1027 "body" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + }, + sub_selectors: CssSubSelectorList [], + }, + ], + block: CssDeclarationOrRuleBlock { + l_curly_token: L_CURLY@1027..1028 "{" [] [], + items: CssDeclarationOrRuleList [ + CssDeclarationWithSemicolon { + declaration: CssDeclaration { + property: CssGenericProperty { + name: CssIdentifier { + value_token: IDENT@1028..1047 "background-color" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@1047..1049 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + CssIdentifier { + value_token: IDENT@1049..1054 "green" [] [], + }, + ], + }, + important: missing (optional), + }, + semicolon_token: SEMICOLON@1054..1055 ";" [] [], + }, + ], + r_curly_token: R_CURLY@1055..1058 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@1058..1060 "}" [Newline("\n")] [], + }, + }, + }, + CssAtRule { + at_token: AT@1060..1063 "@" [Newline("\n"), Newline("\n")] [], + rule: CssDocumentAtRule { + document_token: DOCUMENT_KW@1063..1077 "-moz-document" [] [Whitespace(" ")], + matchers: CssDocumentMatcherList [ + CssUrlFunction { + name: URL_KW@1077..1080 "url" [] [], + l_paren_token: L_PAREN@1080..1081 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@1081..1104 "http://www.exmaple.org/" [] [], + }, + modifiers: CssUrlModifierList [], + r_paren_token: R_PAREN@1104..1105 ")" [] [], + }, + COMMA@1105..1107 "," [] [Whitespace(" ")], + CssDocumentCustomMatcher { + name: URL_PREFIX_KW@1107..1117 "url-prefix" [] [], + l_paren_token: L_PAREN@1117..1118 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@1118..1147 "https: //www.example.com/test" [] [], + }, + r_paren_token: R_PAREN@1147..1148 ")" [] [], + }, + COMMA@1148..1150 "," [] [Whitespace(" ")], + CssDocumentCustomMatcher { + name: DOMAIN_KW@1150..1156 "domain" [] [], + l_paren_token: L_PAREN@1156..1157 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@1157..1168 "example.com" [] [], + }, + r_paren_token: R_PAREN@1168..1169 ")" [] [], + }, + COMMA@1169..1171 "," [] [Whitespace(" ")], + CssDocumentCustomMatcher { + name: MEDIA_DOCUMENT_KW@1171..1185 "media-document" [] [], + l_paren_token: L_PAREN@1185..1186 "(" [] [], + value: CssUrlValueRaw { + value_token: CSS_URL_VALUE_RAW_LITERAL@1186..1191 "video" [] [], + }, + r_paren_token: R_PAREN@1191..1193 ")" [] [Whitespace(" ")], + }, + ], + block: CssRuleBlock { + l_curly_token: L_CURLY@1193..1194 "{" [] [], + rules: CssRuleList [ + CssQualifiedRule { + prelude: CssSelectorList [ + CssCompoundSelector { + nesting_selectors: CssNestedSelectorList [], + simple_selector: CssTypeSelector { + namespace: missing (optional), + ident: CssIdentifier { + value_token: IDENT@1194..1201 "body" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + }, + sub_selectors: CssSubSelectorList [], + }, + ], + block: CssDeclarationOrRuleBlock { + l_curly_token: L_CURLY@1201..1202 "{" [] [], + items: CssDeclarationOrRuleList [ + CssDeclarationWithSemicolon { + declaration: CssDeclaration { + property: CssGenericProperty { + name: CssIdentifier { + value_token: IDENT@1202..1221 "background-color" [Newline("\n"), Whitespace("\t\t")] [], + }, + colon_token: COLON@1221..1223 ":" [] [Whitespace(" ")], + value: CssGenericComponentValueList [ + CssIdentifier { + value_token: IDENT@1223..1228 "green" [] [], + }, + ], + }, + important: missing (optional), + }, + semicolon_token: SEMICOLON@1228..1229 ";" [] [], + }, + ], + r_curly_token: R_CURLY@1229..1232 "}" [Newline("\n"), Whitespace("\t")] [], + }, + }, + ], + r_curly_token: R_CURLY@1232..1234 "}" [Newline("\n")] [], + }, + }, + }, ], - eof_token: EOF@820..821 "" [Newline("\n")] [], + eof_token: EOF@1234..1235 "" [Newline("\n")] [], } ``` ## CST ``` -0: CSS_ROOT@0..821 +0: CSS_ROOT@0..1235 0: (empty) - 1: CSS_RULE_LIST@0..820 + 1: CSS_RULE_LIST@0..1234 0: CSS_AT_RULE@0..70 0: AT@0..1 "@" [] [] 1: CSS_DOCUMENT_AT_RULE@1..70 @@ -914,6 +1156,160 @@ CssRoot { 1: SEMICOLON@814..815 ";" [] [] 2: R_CURLY@815..818 "}" [Newline("\n"), Whitespace("\t")] [] 2: R_CURLY@818..820 "}" [Newline("\n")] [] - 2: EOF@820..821 "" [Newline("\n")] [] + 10: CSS_AT_RULE@820..910 + 0: AT@820..823 "@" [Newline("\n"), Newline("\n")] [] + 1: CSS_DOCUMENT_AT_RULE@823..910 + 0: DOCUMENT_KW@823..837 "-moz-document" [] [Whitespace(" ")] + 1: CSS_DOCUMENT_MATCHER_LIST@837..869 + 0: CSS_DOCUMENT_CUSTOM_MATCHER@837..869 + 0: URL_PREFIX_KW@837..847 "url-prefix" [] [] + 1: L_PAREN@847..848 "(" [] [] + 2: CSS_URL_VALUE_RAW@848..867 + 0: CSS_URL_VALUE_RAW_LITERAL@848..867 "https://example.com" [] [] + 3: R_PAREN@867..869 ")" [] [Whitespace(" ")] + 2: CSS_RULE_BLOCK@869..910 + 0: L_CURLY@869..870 "{" [] [] + 1: CSS_RULE_LIST@870..908 + 0: CSS_QUALIFIED_RULE@870..908 + 0: CSS_SELECTOR_LIST@870..877 + 0: CSS_COMPOUND_SELECTOR@870..877 + 0: CSS_NESTED_SELECTOR_LIST@870..870 + 1: CSS_TYPE_SELECTOR@870..877 + 0: (empty) + 1: CSS_IDENTIFIER@870..877 + 0: IDENT@870..877 "body" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: CSS_SUB_SELECTOR_LIST@877..877 + 1: CSS_DECLARATION_OR_RULE_BLOCK@877..908 + 0: L_CURLY@877..878 "{" [] [] + 1: CSS_DECLARATION_OR_RULE_LIST@878..905 + 0: CSS_DECLARATION_WITH_SEMICOLON@878..905 + 0: CSS_DECLARATION@878..904 + 0: CSS_GENERIC_PROPERTY@878..904 + 0: CSS_IDENTIFIER@878..897 + 0: IDENT@878..897 "background-color" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@897..899 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@899..904 + 0: CSS_IDENTIFIER@899..904 + 0: IDENT@899..904 "green" [] [] + 1: (empty) + 1: SEMICOLON@904..905 ";" [] [] + 2: R_CURLY@905..908 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@908..910 "}" [Newline("\n")] [] + 11: CSS_AT_RULE@910..1060 + 0: AT@910..913 "@" [Newline("\n"), Newline("\n")] [] + 1: CSS_DOCUMENT_AT_RULE@913..1060 + 0: DOCUMENT_KW@913..927 "-moz-document" [] [Whitespace(" ")] + 1: CSS_DOCUMENT_MATCHER_LIST@927..1019 + 0: CSS_URL_FUNCTION@927..955 + 0: URL_KW@927..930 "url" [] [] + 1: L_PAREN@930..931 "(" [] [] + 2: CSS_URL_VALUE_RAW@931..954 + 0: CSS_URL_VALUE_RAW_LITERAL@931..954 "http://www.exmaple.org/" [] [] + 3: CSS_URL_MODIFIER_LIST@954..954 + 4: R_PAREN@954..955 ")" [] [] + 1: COMMA@955..957 "," [] [Whitespace(" ")] + 2: CSS_DOCUMENT_CUSTOM_MATCHER@957..997 + 0: URL_PREFIX_KW@957..967 "url-prefix" [] [] + 1: L_PAREN@967..968 "(" [] [] + 2: CSS_URL_VALUE_RAW@968..996 + 0: CSS_URL_VALUE_RAW_LITERAL@968..996 "https://www.example.com/test" [] [] + 3: R_PAREN@996..997 ")" [] [] + 3: COMMA@997..999 "," [] [Whitespace(" ")] + 4: CSS_DOCUMENT_CUSTOM_MATCHER@999..1019 + 0: DOMAIN_KW@999..1005 "domain" [] [] + 1: L_PAREN@1005..1006 "(" [] [] + 2: CSS_URL_VALUE_RAW@1006..1017 + 0: CSS_URL_VALUE_RAW_LITERAL@1006..1017 "example.com" [] [] + 3: R_PAREN@1017..1019 ")" [] [Whitespace(" ")] + 2: CSS_RULE_BLOCK@1019..1060 + 0: L_CURLY@1019..1020 "{" [] [] + 1: CSS_RULE_LIST@1020..1058 + 0: CSS_QUALIFIED_RULE@1020..1058 + 0: CSS_SELECTOR_LIST@1020..1027 + 0: CSS_COMPOUND_SELECTOR@1020..1027 + 0: CSS_NESTED_SELECTOR_LIST@1020..1020 + 1: CSS_TYPE_SELECTOR@1020..1027 + 0: (empty) + 1: CSS_IDENTIFIER@1020..1027 + 0: IDENT@1020..1027 "body" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: CSS_SUB_SELECTOR_LIST@1027..1027 + 1: CSS_DECLARATION_OR_RULE_BLOCK@1027..1058 + 0: L_CURLY@1027..1028 "{" [] [] + 1: CSS_DECLARATION_OR_RULE_LIST@1028..1055 + 0: CSS_DECLARATION_WITH_SEMICOLON@1028..1055 + 0: CSS_DECLARATION@1028..1054 + 0: CSS_GENERIC_PROPERTY@1028..1054 + 0: CSS_IDENTIFIER@1028..1047 + 0: IDENT@1028..1047 "background-color" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@1047..1049 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@1049..1054 + 0: CSS_IDENTIFIER@1049..1054 + 0: IDENT@1049..1054 "green" [] [] + 1: (empty) + 1: SEMICOLON@1054..1055 ";" [] [] + 2: R_CURLY@1055..1058 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@1058..1060 "}" [Newline("\n")] [] + 12: CSS_AT_RULE@1060..1234 + 0: AT@1060..1063 "@" [Newline("\n"), Newline("\n")] [] + 1: CSS_DOCUMENT_AT_RULE@1063..1234 + 0: DOCUMENT_KW@1063..1077 "-moz-document" [] [Whitespace(" ")] + 1: CSS_DOCUMENT_MATCHER_LIST@1077..1193 + 0: CSS_URL_FUNCTION@1077..1105 + 0: URL_KW@1077..1080 "url" [] [] + 1: L_PAREN@1080..1081 "(" [] [] + 2: CSS_URL_VALUE_RAW@1081..1104 + 0: CSS_URL_VALUE_RAW_LITERAL@1081..1104 "http://www.exmaple.org/" [] [] + 3: CSS_URL_MODIFIER_LIST@1104..1104 + 4: R_PAREN@1104..1105 ")" [] [] + 1: COMMA@1105..1107 "," [] [Whitespace(" ")] + 2: CSS_DOCUMENT_CUSTOM_MATCHER@1107..1148 + 0: URL_PREFIX_KW@1107..1117 "url-prefix" [] [] + 1: L_PAREN@1117..1118 "(" [] [] + 2: CSS_URL_VALUE_RAW@1118..1147 + 0: CSS_URL_VALUE_RAW_LITERAL@1118..1147 "https: //www.example.com/test" [] [] + 3: R_PAREN@1147..1148 ")" [] [] + 3: COMMA@1148..1150 "," [] [Whitespace(" ")] + 4: CSS_DOCUMENT_CUSTOM_MATCHER@1150..1169 + 0: DOMAIN_KW@1150..1156 "domain" [] [] + 1: L_PAREN@1156..1157 "(" [] [] + 2: CSS_URL_VALUE_RAW@1157..1168 + 0: CSS_URL_VALUE_RAW_LITERAL@1157..1168 "example.com" [] [] + 3: R_PAREN@1168..1169 ")" [] [] + 5: COMMA@1169..1171 "," [] [Whitespace(" ")] + 6: CSS_DOCUMENT_CUSTOM_MATCHER@1171..1193 + 0: MEDIA_DOCUMENT_KW@1171..1185 "media-document" [] [] + 1: L_PAREN@1185..1186 "(" [] [] + 2: CSS_URL_VALUE_RAW@1186..1191 + 0: CSS_URL_VALUE_RAW_LITERAL@1186..1191 "video" [] [] + 3: R_PAREN@1191..1193 ")" [] [Whitespace(" ")] + 2: CSS_RULE_BLOCK@1193..1234 + 0: L_CURLY@1193..1194 "{" [] [] + 1: CSS_RULE_LIST@1194..1232 + 0: CSS_QUALIFIED_RULE@1194..1232 + 0: CSS_SELECTOR_LIST@1194..1201 + 0: CSS_COMPOUND_SELECTOR@1194..1201 + 0: CSS_NESTED_SELECTOR_LIST@1194..1194 + 1: CSS_TYPE_SELECTOR@1194..1201 + 0: (empty) + 1: CSS_IDENTIFIER@1194..1201 + 0: IDENT@1194..1201 "body" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 2: CSS_SUB_SELECTOR_LIST@1201..1201 + 1: CSS_DECLARATION_OR_RULE_BLOCK@1201..1232 + 0: L_CURLY@1201..1202 "{" [] [] + 1: CSS_DECLARATION_OR_RULE_LIST@1202..1229 + 0: CSS_DECLARATION_WITH_SEMICOLON@1202..1229 + 0: CSS_DECLARATION@1202..1228 + 0: CSS_GENERIC_PROPERTY@1202..1228 + 0: CSS_IDENTIFIER@1202..1221 + 0: IDENT@1202..1221 "background-color" [Newline("\n"), Whitespace("\t\t")] [] + 1: COLON@1221..1223 ":" [] [Whitespace(" ")] + 2: CSS_GENERIC_COMPONENT_VALUE_LIST@1223..1228 + 0: CSS_IDENTIFIER@1223..1228 + 0: IDENT@1223..1228 "green" [] [] + 1: (empty) + 1: SEMICOLON@1228..1229 ";" [] [] + 2: R_CURLY@1229..1232 "}" [Newline("\n"), Whitespace("\t")] [] + 2: R_CURLY@1232..1234 "}" [Newline("\n")] [] + 2: EOF@1234..1235 "" [Newline("\n")] [] ``` diff --git a/crates/biome_css_syntax/src/generated/nodes.rs b/crates/biome_css_syntax/src/generated/nodes.rs index 49c75c980c8e..658980bcc50c 100644 --- a/crates/biome_css_syntax/src/generated/nodes.rs +++ b/crates/biome_css_syntax/src/generated/nodes.rs @@ -1643,7 +1643,7 @@ impl CssDocumentCustomMatcher { pub fn l_paren_token(&self) -> SyntaxResult { support::required_token(&self.syntax, 1usize) } - pub fn value(&self) -> Option { + pub fn value(&self) -> Option { support::node(&self.syntax, 2usize) } pub fn r_paren_token(&self) -> SyntaxResult { @@ -1662,7 +1662,7 @@ impl Serialize for CssDocumentCustomMatcher { pub struct CssDocumentCustomMatcherFields { pub name: SyntaxResult, pub l_paren_token: SyntaxResult, - pub value: Option, + pub value: Option, pub r_paren_token: SyntaxResult, } #[derive(Clone, PartialEq, Eq, Hash)] diff --git a/crates/biome_css_syntax/src/generated/nodes_mut.rs b/crates/biome_css_syntax/src/generated/nodes_mut.rs index f4f85c88b095..c65bc3cea5e3 100644 --- a/crates/biome_css_syntax/src/generated/nodes_mut.rs +++ b/crates/biome_css_syntax/src/generated/nodes_mut.rs @@ -672,7 +672,7 @@ impl CssDocumentCustomMatcher { .splice_slots(1usize..=1usize, once(Some(element.into()))), ) } - pub fn with_value(self, element: Option) -> Self { + pub fn with_value(self, element: Option) -> Self { Self::unwrap_cast(self.syntax.splice_slots( 2usize..=2usize, once(element.map(|element| element.into_syntax().into())), diff --git a/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs b/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs index 49cd4525bce1..05bb22563c42 100644 --- a/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs +++ b/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs @@ -65,13 +65,13 @@ declare_lint_rule! { /// /// The rule provides several options that are detailed in the following subsections. /// - /// ```json + /// ```json5 /// { /// "//": "...", /// "options": { /// "strictCase": false, /// "requireAscii": true, - /// "match": "%?(.+?)[.](.+)", + /// "match": "%?(.+?)[.](.+)", // Since v2.0.0 /// "filenameCases": ["camelCase", "export"] /// } /// } @@ -100,7 +100,7 @@ declare_lint_rule! { /// /// **This option will be turned on by default in Biome 2.0.** /// - /// ### match + /// ### match (Since v2.0.0) /// /// `match` defines a regular expression that the filename must match. /// If the regex has capturing groups, then the first capture is considered as the filename diff --git a/crates/biome_js_analyze/src/utils/restricted_glob.rs b/crates/biome_js_analyze/src/utils/restricted_glob.rs index 677aea541483..b194c57c9819 100644 --- a/crates/biome_js_analyze/src/utils/restricted_glob.rs +++ b/crates/biome_js_analyze/src/utils/restricted_glob.rs @@ -7,27 +7,68 @@ use biome_rowan::{TextRange, TextSize}; /// - Use `\*` to escape `*` /// - `?`, `[`, `]`, `{`, and `}` must be escaped using `\`. /// These characters are reserved for future use. -/// - `!` must be escaped if it is the first character of the pattern +/// - Use `!` as first character to negate the glob /// /// A path segment is delimited by path separator `/` or the start/end of the path. #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] #[serde(try_from = "String", into = "String")] -pub struct RestrictedGlob(globset::GlobMatcher); +pub struct RestrictedGlob { + is_negated: bool, + glob: globset::GlobMatcher, +} impl RestrictedGlob { - /// Tests whether the given path matches this pattern or not. + /// Returns `true` if this glob is negated. + /// + /// ``` + /// use biome_js_analyze::utils::restricted_glob::RestrictedGlob; + /// + /// let glob = "!*.js".parse::().unwrap(); + /// assert!(glob.is_negated()); + /// + /// let glob = "*.js".parse::().unwrap(); + /// assert!(!glob.is_negated()); + /// ``` + pub fn is_negated(&self) -> bool { + self.is_negated + } + + /// Tests whether the given path matches this pattern. pub fn is_match(&self, path: impl AsRef) -> bool { - self.0.is_match(path) + self.is_raw_match(path) != self.is_negated + } + + /// Tests whether the given path matches this pattern, ignoring the negation. + fn is_raw_match(&self, path: impl AsRef) -> bool { + self.glob.is_match(path) } - /// Tests whether the given path matches this pattern or not. + /// Tests whether the given path matches this pattern. pub fn is_match_candidate(&self, path: &CandidatePath<'_>) -> bool { - self.0.is_match_candidate(&path.0) + self.is_raw_match_candidate(path) != self.is_negated + } + + /// Tests whether the given path matches this pattern, ignoring the negation. + fn is_raw_match_candidate(&self, path: &CandidatePath<'_>) -> bool { + self.glob.is_match_candidate(&path.0) + } +} +impl PartialEq for RestrictedGlob { + fn eq(&self, other: &Self) -> bool { + self.is_negated == other.is_negated && self.glob.glob() == other.glob.glob() + } +} +impl Eq for RestrictedGlob {} +impl std::hash::Hash for RestrictedGlob { + fn hash(&self, state: &mut H) { + self.is_negated.hash(state); + self.glob.glob().hash(state); } } impl std::fmt::Display for RestrictedGlob { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let repr = self.0.glob().to_string(); - f.write_str(&repr) + let repr = self.glob.glob(); + let negation = if self.is_negated { "!" } else { "" }; + write!(f, "{negation}{repr}") } } impl From for String { @@ -38,6 +79,11 @@ impl From for String { impl std::str::FromStr for RestrictedGlob { type Err = RestrictedGlobError; fn from_str(value: &str) -> Result { + let (is_negated, value) = if let Some(stripped) = value.strip_prefix('!') { + (true, stripped) + } else { + (false, value) + }; validate_restricted_glob(value)?; let mut glob_builder = globset::GlobBuilder::new(value); // Allow escaping with `\` on all platforms. @@ -45,7 +91,10 @@ impl std::str::FromStr for RestrictedGlob { // Only `**` can match `/` glob_builder.literal_separator(true); match glob_builder.build() { - Ok(glob) => Ok(RestrictedGlob(glob.compile_matcher())), + Ok(glob) => Ok(RestrictedGlob { + is_negated, + glob: glob.compile_matcher(), + }), Err(error) => Err(RestrictedGlobError::Generic( error.kind().to_string().into_boxed_str(), )), @@ -98,12 +147,59 @@ impl schemars::JsonSchema for RestrictedGlob { /// Constructing candidates has a very small cost associated with it, so /// callers may find it beneficial to amortize that cost when matching a single /// path against multiple globs or sets of globs. +#[derive(Debug, Clone)] pub struct CandidatePath<'a>(globset::Candidate<'a>); impl<'a> CandidatePath<'a> { /// Create a new candidate for matching from the given path. pub fn new(path: &'a impl AsRef) -> Self { Self(globset::Candidate::new(path)) } + + /// Tests whether the current path matches `glob`. + pub fn matches(&self, glob: &RestrictedGlob) -> bool { + glob.is_match_candidate(self) + } + + /// Match against a list of globs where negated globs are handled as exceptions. + /// + /// Let's take an example: + /// + /// ``` + /// use biome_js_analyze::utils::restricted_glob::{CandidatePath, RestrictedGlob}; + /// + /// let globs: &[RestrictedGlob] = &[ + /// "*".parse().unwrap(), + /// "!a*".parse().unwrap(), + /// "a".parse().unwrap(), + /// ]; + /// + /// assert!(CandidatePath::new(&"b").matches_with_exceptions(globs)); + /// assert!(CandidatePath::new(&"a").matches_with_exceptions(globs)); + /// + /// assert!(!CandidatePath::new(&"abc").matches_with_exceptions(globs)); + /// ``` + /// + /// - `b` matches `*` and is not excluded by the exception `!a*`. + /// Thus, `b` matches the list of globs. + /// - `abc` matches the first glob `*`, however it is excluded by the exception `!a*`. + /// Thus `abc` doesn't match the list of globs. + /// - `a` matches the first glob `*` and is excluded by the exception `!a*`. + /// However, it is included again by the last glob `a`. + /// Thus `a` matches the list of globs. + /// + pub fn matches_with_exceptions<'b, I>(&self, globs: I) -> bool + where + I: IntoIterator, + I::IntoIter: DoubleEndedIterator, + { + // Iterate in reverse order to avoid unnecessary glob matching. + for glob in globs.into_iter().rev() { + if glob.is_raw_match_candidate(self) { + return !glob.is_negated(); + } + } + false + } } #[derive(Debug)] @@ -144,7 +240,6 @@ pub enum RestrictedGlobErrorKind { UnsupportedAlternates, UnsupportedCharacterClass, UnsupportedAnyCharacter, - UnsupportedNegation, } impl std::fmt::Display for RestrictedGlobErrorKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -162,9 +257,6 @@ impl std::fmt::Display for RestrictedGlobErrorKind { Self::UnsupportedAnyCharacter => { r"`?` matcher is not supported. Use `\?` to escape the character." } - Self::UnsupportedNegation => { - r"Negated globs `!` are not supported. Use `\!` to escape the character." - } }; write!(f, "{desc}") } @@ -175,12 +267,6 @@ fn validate_restricted_glob(pattern: &str) -> Result<(), RestrictedGlobError> { let mut it = pattern.bytes().enumerate(); while let Some((i, c)) = it.next() { match c { - b'!' if i == 0 => { - return Err(RestrictedGlobError::Regular { - kind: RestrictedGlobErrorKind::UnsupportedNegation, - index: i as u32, - }); - } b'\\' => { // Accept a restrictive set of escape sequence if let Some((j, c)) = it.next() { @@ -227,19 +313,21 @@ fn validate_restricted_glob(pattern: &str) -> Result<(), RestrictedGlobError> { #[cfg(test)] mod tests { + use std::str::FromStr; + use super::*; #[test] fn test_validate_restricted_glob() { - assert!(validate_restricted_glob("!*.js").is_err()); assert!(validate_restricted_glob("*.[jt]s").is_err()); assert!(validate_restricted_glob("*.{js,ts}").is_err()); assert!(validate_restricted_glob("?*.js").is_err()); assert!(validate_restricted_glob(r"\").is_err()); assert!(validate_restricted_glob(r"\n").is_err()); assert!(validate_restricted_glob(r"\😀").is_err()); - assert!(validate_restricted_glob("!").is_err()); + assert!(validate_restricted_glob("!*.js").is_ok()); + assert!(validate_restricted_glob("!").is_ok()); assert!(validate_restricted_glob("*.js").is_ok()); assert!(validate_restricted_glob("**/*.js").is_ok()); assert!(validate_restricted_glob(r"\*").is_ok()); @@ -258,4 +346,35 @@ mod tests { .unwrap() .is_match("file/path.js")); } + + #[test] + fn test_match_with_exceptions() { + let a = CandidatePath::new(&"a"); + + assert!(a.matches_with_exceptions(&[ + RestrictedGlob::from_str("*").unwrap(), + RestrictedGlob::from_str("!b").unwrap(), + ])); + assert!(!a.matches_with_exceptions(&[ + RestrictedGlob::from_str("*").unwrap(), + RestrictedGlob::from_str("!a*").unwrap(), + ])); + assert!(a.matches_with_exceptions(&[ + RestrictedGlob::from_str("*").unwrap(), + RestrictedGlob::from_str("!a*").unwrap(), + RestrictedGlob::from_str("a").unwrap(), + ])); + } + + #[test] + fn test_to_string() { + assert_eq!( + RestrictedGlob::from_str("**/*.js").unwrap().to_string(), + "**/*.js" + ); + assert_eq!( + RestrictedGlob::from_str("!**/*.js").unwrap().to_string(), + "!**/*.js" + ); + } } diff --git a/crates/biome_js_analyze/src/utils/tests.rs b/crates/biome_js_analyze/src/utils/tests.rs index 89ccdc61f459..444c13110e9d 100644 --- a/crates/biome_js_analyze/src/utils/tests.rs +++ b/crates/biome_js_analyze/src/utils/tests.rs @@ -42,7 +42,7 @@ pub fn assert_rename_binding_a_to_b_ok(before: &str, expected: &str) { let after = root.to_string(); assert_eq!(expected, after.as_str()); - assert!(!biome_js_parser::test_utils::has_bogus_nodes_or_empty_slots(&root)); + assert!(!biome_test_utils::has_bogus_nodes_or_empty_slots(&root)); } pub fn assert_rename_ts_binding_a_to_b_ok(before: &str, expected: &str) { @@ -71,7 +71,7 @@ pub fn assert_rename_ts_binding_a_to_b_ok(before: &str, expected: &str) { let after = root.to_string(); assert_eq!(expected, after.as_str()); - assert!(!biome_js_parser::test_utils::has_bogus_nodes_or_empty_slots(&root)); + assert!(!biome_test_utils::has_bogus_nodes_or_empty_slots(&root)); } /// Search and renames one binding named "a" to "b". diff --git a/crates/biome_js_parser/Cargo.toml b/crates/biome_js_parser/Cargo.toml index 00b5283e61ad..7f81d63b66cc 100644 --- a/crates/biome_js_parser/Cargo.toml +++ b/crates/biome_js_parser/Cargo.toml @@ -29,10 +29,16 @@ smallvec = { workspace = true } tracing = { workspace = true } [dev-dependencies] -expect-test = "1.5.0" -quickcheck = { workspace = true } -quickcheck_macros = { workspace = true } -tests_macros = { workspace = true } +biome_configuration = { workspace = true } +biome_deserialize = { workspace = true } +biome_fs = { workspace = true } +biome_service = { workspace = true } +biome_test_utils = { workspace = true } +insta = { workspace = true } +quickcheck = { workspace = true } +quickcheck_macros = { workspace = true } +tests_macros = { path = "../tests_macros" } + [features] schemars = ["dep:schemars"] diff --git a/crates/biome_js_parser/src/lib.rs b/crates/biome_js_parser/src/lib.rs index 8773b6022521..025728759e55 100644 --- a/crates/biome_js_parser/src/lib.rs +++ b/crates/biome_js_parser/src/lib.rs @@ -57,74 +57,16 @@ //! In conclusion, the use of both representations means we are not constrained to acting through //! typed nodes. Which makes traversal hard and you often have to resort to autogenerated visitor patterns. //! AST nodes are simply a way to easily access subproperties of a syntax node.event; -//! -//! ## Parser Tests -//! -//! Parser tests are comments that start with `test` or `test_err` followed by the test name, and then the code on its own line. -//! -//! ```rust,ignore -//! // test js feature_name -//! // let a = { new_feature : "" } -//! // let b = { new_feature : "" } -//! fn parse_new_feature(p: &mut Parser) -> ParsedSyntax {} -//! ``` -//! -//! * `test`: Test for a valid program. Should not produce any diagnostics nor missing nodes. -//! * `test_err`: Test for a program with syntax error. Must produce a diagnostic. -//! -//! By default, the test runs as a JavaScript Module. You can customize the source type by specifying the -//! file type after `test` or `test_err` -//! -//! ```rust,ignore -//! // test ts typescript_test -//! // console.log("a"); -//! if a { -//! // .. -//! } -//! ``` -//! -//! The supported source types are: -//! * `js` -//! * `jsx` -//! * `ts` -//! * `tsx` -//! * `d.ts` -//! -//! To enable script mode, add a `// script` comment to the code. -//! -//! To extract the test cases, run `cargo codegen test`. Running the codegen is necessary whenever you add, -//! change, or remove inline tests . -//! -//! To update the test output, run -//! -//! -//! **Linux/MacOs**: -//! -//! ```bash -//! env UPDATE_EXPECT=1 cargo test -//! ``` -//! -//! **Windows** -//! -//! ```powershell -//! set UPDATE_EXPECT=1 & cargo test -//! ``` mod parser; #[macro_use] mod lexer; +pub mod options; mod parse; +mod prelude; mod rewrite; mod span; mod state; - -#[cfg(any(test, feature = "tests"))] -pub mod test_utils; -#[cfg(test)] -mod tests; - -pub mod options; -mod prelude; pub mod syntax; mod token_source; diff --git a/crates/biome_js_parser/src/test_utils.rs b/crates/biome_js_parser/src/test_utils.rs deleted file mode 100644 index 4bd56556cb2b..000000000000 --- a/crates/biome_js_parser/src/test_utils.rs +++ /dev/null @@ -1,67 +0,0 @@ -use crate::Parse; -use biome_console::fmt::{Formatter, Termcolor}; -use biome_console::markup; -use biome_diagnostics::DiagnosticExt; -use biome_diagnostics::{termcolor::Buffer, PrintDiagnostic}; -use biome_js_syntax::{JsLanguage, JsSyntaxNode}; -use biome_rowan::{AstNode, SyntaxKind, SyntaxSlot}; -use std::{fmt::Debug, path::Path}; - -/// This check is used in the parser test to ensure it doesn't emit -/// bogus nodes without diagnostics, and in the analyzer tests to -/// check the syntax trees resulting from code actions are correct -pub fn has_bogus_nodes_or_empty_slots(node: &JsSyntaxNode) -> bool { - node.descendants().any(|descendant| { - let kind = descendant.kind(); - if kind.is_bogus() { - return true; - } - - if kind.is_list() { - return descendant - .slots() - .any(|slot| matches!(slot, SyntaxSlot::Empty { .. })); - } - - false - }) -} - -/// This function analyzes the parsing result of a file and panic with a -/// detailed message if it contains any error-level diagnostic, bogus nodes, -/// empty list slots or missing required children -pub fn assert_errors_are_absent(program: &Parse, path: &Path) -where - T: AstNode + Debug, -{ - let syntax = program.syntax(); - let debug_tree = format!("{:?}", program.tree()); - let has_missing_children = debug_tree.contains("missing (required)"); - - if has_bogus_nodes_or_empty_slots(&syntax) { - panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") - } - - if !program.has_errors() && !has_missing_children { - return; - } - - let mut buffer = Buffer::no_color(); - for diagnostic in program.diagnostics() { - let error = diagnostic - .clone() - .with_file_path(path.to_str().unwrap()) - .with_file_source_code(syntax.to_string()); - Formatter::new(&mut Termcolor(&mut buffer)) - .write_markup(markup! { - {PrintDiagnostic::verbose(&error)} - }) - .unwrap(); - } - - panic!("There should be no errors in the file {:?} but the following errors where present:\n{}\n\nParsed tree:\n{:#?}", - path.display(), - std::str::from_utf8(buffer.as_slice()).unwrap(), - &syntax - ); -} diff --git a/crates/biome_js_parser/src/tests.rs b/crates/biome_js_parser/src/tests.rs deleted file mode 100644 index 5df6860aef3b..000000000000 --- a/crates/biome_js_parser/src/tests.rs +++ /dev/null @@ -1,424 +0,0 @@ -use crate::test_utils::has_bogus_nodes_or_empty_slots; -use crate::{parse, parse_module, test_utils::assert_errors_are_absent, JsParserOptions, Parse}; -use biome_console::fmt::{Formatter, Termcolor}; -use biome_console::markup; -use biome_diagnostics::DiagnosticExt; -use biome_diagnostics::PrintDiagnostic; -use biome_js_syntax::{AnyJsRoot, JsFileSource, JsSyntaxKind}; -use biome_js_syntax::{JsCallArguments, JsLogicalExpression, JsSyntaxToken}; -use biome_rowan::{AstNode, Direction, TextSize}; -use expect_test::expect_file; -use std::fmt::Write; -use std::panic::catch_unwind; -use std::path::{Path, PathBuf}; - -#[test] -fn parser_smoke_test() { - let src = r#" -import "x" with { type: "json" } -"#; - - let module = parse(src, JsFileSource::tsx(), JsParserOptions::default()); - assert_errors_are_absent(&module, Path::new("parser_smoke_test")); -} - -#[test] -fn parser_missing_smoke_test() { - let src = r#" - console.log("Hello world"; - "#; - - let module = parse_module(src, JsParserOptions::default()); - - let arg_list = module - .syntax() - .descendants() - .find_map(JsCallArguments::cast) - .unwrap(); - - let opening = arg_list.syntax().element_in_slot(0); - let list = arg_list.syntax().element_in_slot(1); - let closing = arg_list.syntax().element_in_slot(2); - - assert_eq!(opening.map(|o| o.to_string()), Some(String::from("("))); - assert_eq!( - list.map(|l| l.kind()), - Some(JsSyntaxKind::JS_CALL_ARGUMENT_LIST) - ); - assert_eq!(closing, None); -} - -fn try_parse(path: &str, text: &str, options: JsParserOptions) -> Parse { - let res = catch_unwind(|| { - let path = Path::new(path); - // Files containing a // SCRIPT comment are parsed as script and not as module - // This is needed to test features that are restricted in strict mode. - let source_type = if text.contains("// SCRIPT") { - JsFileSource::js_script() - } else { - path.try_into().unwrap() - }; - - let parse = parse(text, source_type, options); - - assert_eq!( - parse.syntax().to_string(), - text, - "Original source and re-printed tree differ\nParsed Tree: {:#?}", - parse.syntax(), - ); - - parse - }); - assert!(res.is_ok(), "Trying to parse `{path}` panicked"); - res.unwrap() -} - -fn try_parse_with_printed_ast( - path: &str, - text: &str, - options: JsParserOptions, -) -> (Parse, String) { - catch_unwind(|| { - let parse = try_parse(path, text, options.clone()); - let formatted = format!("{:#?}", &parse.tree()); - (parse, formatted) - }) - .unwrap_or_else(|err| { - // Re-parsing the source here seems silly. But the problem is, that `SyntaxNode`s aren't - // unwind safe. That's why the same `ParseResult` can't be reused here. - // This should be fine because this code is only executed for local tests. No checked-in - // test should ever hit this line. - let re_parsed = try_parse(path, text, options); - panic!( - "Printing the AST for `{}` panicked. That means it is malformed. Err: {:?}\n{:#?}", - path, - err, - re_parsed.syntax() - ); - }) -} - -#[cfg(test)] -fn run_and_expect_no_errors(path: &str, _: &str, _: &str, _: &str) { - let path = PathBuf::from(path); - let text = std::fs::read_to_string(&path).unwrap(); - - let options_path = path.with_extension("options.json"); - let options: JsParserOptions = std::fs::read_to_string(options_path) - .ok() - .and_then(|options| serde_json::from_str(&options).ok()) - .unwrap_or_default(); - - let (parse, ast) = try_parse_with_printed_ast(path.to_str().unwrap(), &text, options); - assert_errors_are_absent(&parse, &path); - let actual = format!("{}\n\n{:#?}", ast, parse.syntax()); - - let path = path.with_extension("rast"); - expect_file![path].assert_eq(&actual) -} - -#[cfg(test)] -fn run_and_expect_errors(path: &str, _: &str, _: &str, _: &str) { - let path = PathBuf::from(path); - let text = std::fs::read_to_string(&path).unwrap(); - - let options_path = path.with_extension("options.json"); - let options: JsParserOptions = std::fs::read_to_string(options_path) - .ok() - .and_then(|options| serde_json::from_str(&options).ok()) - .unwrap_or_default(); - - let (parse, ast) = try_parse_with_printed_ast(path.to_str().unwrap(), &text, options); - assert_errors_are_present(&parse, &path); - let mut actual = format!("{}\n\n{:#?}", ast, parse.syntax()); - for diag in parse.diagnostics() { - let mut write = biome_diagnostics::termcolor::Buffer::no_color(); - let error = diag - .clone() - .with_file_path(path.file_name().unwrap().to_string_lossy().to_string()) - .with_file_source_code(text.to_string()); - Formatter::new(&mut Termcolor(&mut write)) - .write_markup(markup! { - {PrintDiagnostic::verbose(&error)} - }) - .expect("failed to emit diagnostic"); - write!( - actual, - "--\n{}", - std::str::from_utf8(write.as_slice()).expect("non utf8 in error buffer") - ) - .unwrap(); - } - write!(actual, "--\n{text}").unwrap(); - - let path = path.with_extension("rast"); - expect_file![path].assert_eq(&actual) -} - -mod parser { - mod ok { - tests_macros::gen_tests! {"test_data/inline/ok/**/*.{js,ts,jsx,tsx}", crate::tests::run_and_expect_no_errors, ""} - } - mod err { - tests_macros::gen_tests! {"test_data/inline/err/**/*.{js,ts,jsx,tsx}", crate::tests::run_and_expect_errors, ""} - } -} - -fn assert_errors_are_present(program: &Parse, path: &Path) { - assert!( - !program.diagnostics().is_empty(), - "There should be errors in the file {:?}\nSyntax Tree: {:#?}", - path.display(), - program.syntax() - ); -} - -#[test] -pub fn test_trivia_attached_to_tokens() { - let text = "/**/let a = 1; // nice variable \n /*hey*/ let \t b = 2; // another nice variable"; - let m = parse_module(text, JsParserOptions::default()); - let mut tokens = m.syntax().descendants_tokens(Direction::Next); - - let is_let = |x: &JsSyntaxToken| x.text_trimmed() == "let"; - let first_let = tokens.find(is_let).unwrap(); - - // first let leading trivia asserts - let pieces: Vec<_> = first_let.leading_trivia().pieces().collect(); - assert!(matches!(pieces.first().map(|x| x.text()), Some("/**/"))); - assert!(pieces.get(1).is_none()); - - // first let trailing trivia asserts - let pieces: Vec<_> = first_let.trailing_trivia().pieces().collect(); - assert!(matches!(pieces.first().map(|x| x.text()), Some(" "))); - assert!(pieces.get(1).is_none()); - - // second let leading trivia asserts - let second_let = tokens.find(is_let).unwrap(); - let pieces: Vec<_> = second_let.leading_trivia().pieces().collect(); - assert_eq!(4, pieces.len()); - assert!(matches!(pieces.first().map(|x| x.text()), Some("\n"))); - assert!(matches!(pieces.get(1).map(|x| x.text()), Some(" "))); - assert!(matches!(pieces.get(2).map(|x| x.text()), Some("/*hey*/"))); - assert!(matches!(pieces.get(3).map(|x| x.text()), Some(" "))); - - // second let trailing trivia asserts - let pieces: Vec<_> = second_let.trailing_trivia().pieces().collect(); - assert_eq!(1, pieces.len()); - assert!(matches!(pieces.first().map(|x| x.text()), Some(" \t "))); -} - -#[test] -pub fn jsroot_display_text_and_trimmed() { - let code = " let a = 1; \n "; - let root = parse_module(code, JsParserOptions::default()); - let syntax = root.syntax(); - - assert_eq!(format!("{syntax}"), code); - - let syntax_text = syntax.text(); - assert_eq!(format!("{syntax_text}"), code); - - let syntax_text = syntax.text_trimmed(); - assert_eq!(format!("{syntax_text}"), code.trim()); -} - -#[test] -pub fn jsroot_ranges() { - // 0123456789A - let code = " let a = 1;"; - let root = parse_module(code, JsParserOptions::default()); - let syntax = root.syntax(); - - let first_let = syntax.first_token().unwrap(); - let range = first_let.text_range(); - assert_eq!(0usize, usize::from(range.start())); - assert_eq!(5usize, usize::from(range.end())); - - let range = first_let.text_trimmed_range(); - assert_eq!(1usize, usize::from(range.start())); - assert_eq!(4usize, usize::from(range.end())); - - let eq = syntax - .descendants_tokens(Direction::Next) - .find(|x| x.text_trimmed() == "=") - .unwrap(); - let range = eq.text_range(); - assert_eq!(7usize, usize::from(range.start())); - assert_eq!(9usize, usize::from(range.end())); - - let range = eq.text_trimmed_range(); - assert_eq!(7usize, usize::from(range.start())); - assert_eq!(8usize, usize::from(range.end())); -} - -#[test] -pub fn node_range_must_be_correct() { - // 0123456789A123456789B123456789 - let text = " function foo() { let a = 1; }"; - let root = parse_module(text, JsParserOptions::default()); - - let var_decl = root - .syntax() - .descendants() - .find(|x| x.kind() == JsSyntaxKind::JS_VARIABLE_STATEMENT) - .unwrap(); - - let range = var_decl.text_range(); - assert_eq!(18usize, usize::from(range.start())); - assert_eq!(29usize, usize::from(range.end())); - - let range = var_decl.text_trimmed_range(); - assert_eq!(18usize, usize::from(range.start())); - assert_eq!(28usize, usize::from(range.end())); -} - -#[test] -pub fn last_trivia_must_be_appended_to_eof() { - // 0123456789A123456789B123456789CC - let text = " function foo() { let a = 1; }\n"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - - let range = syntax.text_range(); - let start = range.start(); - let end = range.end(); - - assert_eq!(TextSize::from(0), start); - assert_eq!(TextSize::from(31), end); -} - -#[test] -pub fn just_trivia_must_be_appended_to_eof() { - // 0123456789A123456789B123456789C123 - let text = "// just trivia... nothing else...."; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - - let range = syntax.text_range(); - let start = range.start(); - let end = range.end(); - - assert_eq!(TextSize::from(0), start); - assert_eq!(TextSize::from(34), end); -} - -#[test] -pub fn node_contains_comments() { - let text = "true && true // comment"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - - assert!(syntax.has_comments_descendants()); -} - -#[test] -fn parser_regexp_after_operator() { - fn assert_no_errors(src: &str) { - let module = parse(src, JsFileSource::js_script(), JsParserOptions::default()); - assert_errors_are_absent(&module, Path::new("parser_regexp_after_operator")); - } - assert_no_errors(r#"a=/a/"#); - assert_no_errors(r#"a==/a/"#); - assert_no_errors(r#"a===/a/"#); - assert_no_errors(r#"a!=/a/"#); - assert_no_errors(r#"a!==/a/"#); -} - -#[test] -pub fn node_contains_trailing_comments() { - let text = "true && (3 - 2 == 0) // comment"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - let node = syntax - .descendants() - .find(|n| n.kind() == JsSyntaxKind::JS_LOGICAL_EXPRESSION) - .unwrap(); - - let logical_expression = JsLogicalExpression::cast(node).unwrap(); - let right = logical_expression.right().unwrap(); - - assert!(right.syntax().has_trailing_comments()); - assert!(!right.syntax().has_leading_comments()); -} - -#[test] -pub fn node_contains_leading_comments() { - let text = r"true && -// comment -(3 - 2 == 0)"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - let node = syntax - .descendants() - .find(|n| n.kind() == JsSyntaxKind::JS_LOGICAL_EXPRESSION) - .unwrap(); - - let logical_expression = JsLogicalExpression::cast(node).unwrap(); - let right = logical_expression.right().unwrap(); - - assert!(right.syntax().has_leading_comments()); - assert!(!right.syntax().has_trailing_comments()); -} - -#[test] -pub fn node_has_comments() { - let text = r"true && -// comment -(3 - 2 == 0)"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - let node = syntax - .descendants() - .find(|n| n.kind() == JsSyntaxKind::JS_LOGICAL_EXPRESSION) - .unwrap(); - - let logical_expression = JsLogicalExpression::cast(node).unwrap(); - let right = logical_expression.right().unwrap(); - - assert!(right.syntax().has_comments_direct()); -} - -#[test] -fn diagnostics_print_correctly() { - let text = r"const a"; - - let root = parse_module(text, JsParserOptions::default()); - for diagnostic in root.diagnostics() { - let mut write = biome_diagnostics::termcolor::Buffer::no_color(); - let error = diagnostic - .clone() - .with_file_path("example.js") - .with_file_source_code(text.to_string()); - - Formatter::new(&mut Termcolor(&mut write)) - .write_markup(markup! { - {PrintDiagnostic::verbose(&error)} - }) - .expect("failed to emit diagnostic"); - - eprintln!( - "{}", - std::str::from_utf8(write.as_slice()).expect("non utf8 in error buffer") - ); - } -} - -#[ignore] -#[test] -pub fn quick_test() { - let code = r#" - type Equals = A extends (x: B extends C ? D : E) => 0 ? F : G; - "#; - let root = parse( - code, - JsFileSource::ts(), - JsParserOptions::default().with_parse_class_parameter_decorators(), - ); - let syntax = root.syntax(); - dbg!(&syntax, root.diagnostics(), root.has_errors()); - - if has_bogus_nodes_or_empty_slots(&syntax) { - panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.rast b/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.rast deleted file mode 100644 index 619d24c25332..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.rast +++ /dev/null @@ -1,50 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - CLASS_KW@9..15 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - L_CURLY@17..18 "{" [] [], - JsClassMemberList [], - R_CURLY@18..19 "}" [] [], - ], - }, - ], - eof_token: EOF@19..20 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..20 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..19 - 0: JS_BOGUS_STATEMENT@0..19 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: L_CURLY@17..18 "{" [] [] - 5: JS_CLASS_MEMBER_LIST@18..18 - 6: R_CURLY@18..19 "}" [] [] - 4: EOF@19..20 "" [Newline("\n")] [] --- -abstract_class_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × abstract classes are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - > 1 │ abstract class A {} - │ ^^^^^^^^^^^^^^^^^^^ - 2 │ - - i TypeScript only syntax - --- -abstract class A {} diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.rast b/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.rast deleted file mode 100644 index c5be0277b406..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.rast +++ /dev/null @@ -1,501 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@0..1 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@1..3 "a" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - missing separator, - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@3..4 "a" [] [], - }, - init: missing (optional), - }, - COMMA@4..6 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsBogusAssignment { - items: [ - PLUS2@6..8 "++" [] [], - JsIdentifierAssignment { - name_token: IDENT@8..9 "b" [] [], - }, - ], - }, - init: missing (optional), - }, - COMMA@9..11 "," [] [Whitespace(" ")], - ], - r_brack_token: R_BRACK@11..13 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@13..15 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..19 "test" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_BRACK@20..22 "[" [Newline("\n")] [], - JsBogus { - items: [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@22..23 "a" [] [], - }, - init: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@25..26 "c" [] [], - }, - init: missing (optional), - }, - COMMA@26..28 "," [] [Whitespace(" ")], - JsBogus { - items: [ - DOT3@28..31 "..." [] [], - JsIdentifierAssignment { - name_token: IDENT@31..35 "rest" [] [], - }, - ], - }, - COMMA@35..36 "," [] [], - ], - }, - R_BRACK@36..38 "]" [] [Whitespace(" ")], - ], - }, - EQ@38..40 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..44 "test" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@45..47 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@47..49 "a" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@49..51 "=" [] [Whitespace(" ")], - expression: missing (required), - }, - }, - COMMA@51..53 "," [] [Whitespace(" ")], - ], - r_brack_token: missing (required), - }, - operator_token: EQ@53..55 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@55..61 "\"test\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_BRACK@61..63 "]" [] [Whitespace(" ")], - EQ@63..65 "=" [] [Whitespace(" ")], - IDENT@65..69 "test" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@70..72 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsComputedMemberAssignment { - object: JsArrayExpression { - l_brack_token: L_BRACK@72..73 "[" [] [], - elements: JsArrayElementList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@73..75 "a" [] [Whitespace(" ")], - }, - }, - missing separator, - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@75..76 "b" [] [], - }, - }, - ], - r_brack_token: R_BRACK@76..78 "]" [] [Whitespace(" ")], - }, - l_brack_token: L_BRACK@78..79 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@79..80 "c" [] [], - }, - }, - r_brack_token: R_BRACK@80..81 "]" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@81..82 "]" [] [], - }, - operator_token: EQ@82..84 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..88 "test" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@88..89 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_BRACK@89..91 "[" [Newline("\n")] [], - JsBogus { - items: [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@91..92 "a" [] [], - }, - init: missing (optional), - }, - JsBogusAssignment { - items: [ - COLON@92..94 ":" [] [Whitespace(" ")], - IDENT@94..95 "b" [] [], - ], - }, - ], - }, - R_BRACK@95..97 "]" [] [Whitespace(" ")], - ], - }, - EQ@97..99 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@99..100 "c" [] [], - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@100..101 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..101 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..100 - 0: JS_EXPRESSION_STATEMENT@0..20 - 0: JS_ASSIGNMENT_EXPRESSION@0..19 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@0..13 - 0: L_BRACK@0..1 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@1..11 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@1..3 - 0: JS_IDENTIFIER_ASSIGNMENT@1..3 - 0: IDENT@1..3 "a" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@3..4 - 0: JS_IDENTIFIER_ASSIGNMENT@3..4 - 0: IDENT@3..4 "a" [] [] - 1: (empty) - 3: COMMA@4..6 "," [] [Whitespace(" ")] - 4: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@6..9 - 0: JS_BOGUS_ASSIGNMENT@6..9 - 0: PLUS2@6..8 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@8..9 - 0: IDENT@8..9 "b" [] [] - 1: (empty) - 5: COMMA@9..11 "," [] [Whitespace(" ")] - 2: R_BRACK@11..13 "]" [] [Whitespace(" ")] - 1: EQ@13..15 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@15..19 - 0: JS_REFERENCE_IDENTIFIER@15..19 - 0: IDENT@15..19 "test" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@20..45 - 0: JS_BOGUS_EXPRESSION@20..44 - 0: JS_BOGUS@20..38 - 0: L_BRACK@20..22 "[" [Newline("\n")] [] - 1: JS_BOGUS@22..36 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@22..23 - 0: JS_IDENTIFIER_ASSIGNMENT@22..23 - 0: IDENT@22..23 "a" [] [] - 1: (empty) - 1: COMMA@23..25 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@25..26 - 0: JS_IDENTIFIER_ASSIGNMENT@25..26 - 0: IDENT@25..26 "c" [] [] - 1: (empty) - 3: COMMA@26..28 "," [] [Whitespace(" ")] - 4: JS_BOGUS@28..35 - 0: DOT3@28..31 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@31..35 - 0: IDENT@31..35 "rest" [] [] - 5: COMMA@35..36 "," [] [] - 2: R_BRACK@36..38 "]" [] [Whitespace(" ")] - 1: EQ@38..40 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@40..44 - 0: JS_REFERENCE_IDENTIFIER@40..44 - 0: IDENT@40..44 "test" [] [] - 1: SEMICOLON@44..45 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@45..61 - 0: JS_ASSIGNMENT_EXPRESSION@45..61 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@45..53 - 0: L_BRACK@45..47 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@47..53 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@47..51 - 0: JS_IDENTIFIER_ASSIGNMENT@47..49 - 0: IDENT@47..49 "a" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@49..51 - 0: EQ@49..51 "=" [] [Whitespace(" ")] - 1: (empty) - 1: COMMA@51..53 "," [] [Whitespace(" ")] - 2: (empty) - 1: EQ@53..55 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@55..61 - 0: JS_STRING_LITERAL@55..61 "\"test\"" [] [] - 1: (empty) - 3: JS_BOGUS_STATEMENT@61..69 - 0: R_BRACK@61..63 "]" [] [Whitespace(" ")] - 1: EQ@63..65 "=" [] [Whitespace(" ")] - 2: IDENT@65..69 "test" [] [] - 4: JS_EMPTY_STATEMENT@69..70 - 0: SEMICOLON@69..70 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@70..89 - 0: JS_ASSIGNMENT_EXPRESSION@70..88 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@70..82 - 0: L_BRACK@70..72 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@72..81 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@72..81 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@72..81 - 0: JS_ARRAY_EXPRESSION@72..78 - 0: L_BRACK@72..73 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@73..76 - 0: JS_IDENTIFIER_EXPRESSION@73..75 - 0: JS_REFERENCE_IDENTIFIER@73..75 - 0: IDENT@73..75 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_EXPRESSION@75..76 - 0: JS_REFERENCE_IDENTIFIER@75..76 - 0: IDENT@75..76 "b" [] [] - 2: R_BRACK@76..78 "]" [] [Whitespace(" ")] - 1: L_BRACK@78..79 "[" [] [] - 2: JS_IDENTIFIER_EXPRESSION@79..80 - 0: JS_REFERENCE_IDENTIFIER@79..80 - 0: IDENT@79..80 "c" [] [] - 3: R_BRACK@80..81 "]" [] [] - 1: (empty) - 2: R_BRACK@81..82 "]" [] [] - 1: EQ@82..84 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@84..88 - 0: JS_REFERENCE_IDENTIFIER@84..88 - 0: IDENT@84..88 "test" [] [] - 1: SEMICOLON@88..89 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@89..100 - 0: JS_BOGUS_EXPRESSION@89..100 - 0: JS_BOGUS@89..97 - 0: L_BRACK@89..91 "[" [Newline("\n")] [] - 1: JS_BOGUS@91..95 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@91..92 - 0: JS_IDENTIFIER_ASSIGNMENT@91..92 - 0: IDENT@91..92 "a" [] [] - 1: (empty) - 1: JS_BOGUS_ASSIGNMENT@92..95 - 0: COLON@92..94 ":" [] [Whitespace(" ")] - 1: IDENT@94..95 "b" [] [] - 2: R_BRACK@95..97 "]" [] [Whitespace(" ")] - 1: EQ@97..99 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@99..100 - 0: JS_REFERENCE_IDENTIFIER@99..100 - 0: IDENT@99..100 "c" [] [] - 1: (empty) - 4: EOF@100..101 "" [Newline("\n")] [] --- -array_assignment_target_err.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `a` - - > 1 │ [a a, ++b, ] = test; - │ ^ - 2 │ [a, c, ...rest,] = test; - 3 │ [a = , = "test"] = test; - - i Remove a - --- -array_assignment_target_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `++b` - - > 1 │ [a a, ++b, ] = test; - │ ^^^ - 2 │ [a, c, ...rest,] = test; - 3 │ [a = , = "test"] = test; - - i This expression cannot be assigned to - --- -array_assignment_target_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element may not have a trailing comma - - 1 │ [a a, ++b, ] = test; - > 2 │ [a, c, ...rest,] = test; - │ ^ - 3 │ [a = , = "test"] = test; - 4 │ [[a b] [c]]= test; - - i Remove the trailing comma here - - 1 │ [a a, ++b, ] = test; - > 2 │ [a, c, ...rest,] = test; - │ ^ - 3 │ [a = , = "test"] = test; - 4 │ [[a b] [c]]= test; - - i Rest element - - 1 │ [a a, ++b, ] = test; - > 2 │ [a, c, ...rest,] = test; - │ ^^^^^^^ - 3 │ [a = , = "test"] = test; - 4 │ [[a b] [c]]= test; - --- -array_assignment_target_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ','. - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - - i Expected an expression, or an assignment here. - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - --- -array_assignment_target_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an assignment target, a rest element, or a comma but instead found '='. - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - - i Expected an assignment target, a rest element, or a comma here. - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - --- -array_assignment_target_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - - i An explicit or implicit semicolon is expected here... - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - - i ...Which is required to end this statement - - 1 │ [a a, ++b, ] = test; - 2 │ [a, c, ...rest,] = test; - > 3 │ [a = , = "test"] = test; - │ ^^^^^^^^^^^^^^^^ - 4 │ [[a b] [c]]= test; - 5 │ [a: b] = c - --- -array_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `b` - - 2 │ [a, c, ...rest,] = test; - 3 │ [a = , = "test"] = test; - > 4 │ [[a b] [c]]= test; - │ ^ - 5 │ [a: b] = c - 6 │ - - i Remove b - --- -array_assignment_target_err.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `:` - - 3 │ [a = , = "test"] = test; - 4 │ [[a b] [c]]= test; - > 5 │ [a: b] = c - │ ^ - 6 │ - - i Remove : - --- -[a a, ++b, ] = test; -[a, c, ...rest,] = test; -[a = , = "test"] = test; -[[a b] [c]]= test; -[a: b] = c diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast b/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast deleted file mode 100644 index f1245a107dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast +++ /dev/null @@ -1,240 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@1..3 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@3..7 "..." [] [Whitespace(" ")], - pattern: missing (required), - }, - ], - r_brack_token: R_BRACK@7..9 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@9..11 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..12 "a" [] [], - }, - }, - }, - r_paren_token: R_PAREN@12..13 ")" [] [], - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@14..16 "(" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_BRACK@16..18 "[" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@18..21 "..." [] [], - JsIdentifierAssignment { - name_token: IDENT@21..23 "c" [] [Whitespace(" ")], - }, - EQ@23..25 "=" [] [Whitespace(" ")], - JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")], - ], - }, - ], - }, - R_BRACK@35..37 "]" [] [Whitespace(" ")], - ], - }, - EQ@37..39 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@39..40 "a" [] [], - }, - }, - ], - }, - r_paren_token: R_PAREN@40..41 ")" [] [], - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_BRACK@44..46 "[" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@46..49 "..." [] [], - JsIdentifierAssignment { - name_token: IDENT@49..53 "rest" [] [], - }, - ], - }, - COMMA@53..55 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@55..72 "other_assignment" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - }, - R_BRACK@72..74 "]" [] [Whitespace(" ")], - ], - }, - EQ@74..76 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@76..77 "a" [] [], - }, - }, - ], - }, - r_paren_token: R_PAREN@77..78 ")" [] [], - }, - semicolon_token: SEMICOLON@78..79 ";" [] [], - }, - ], - eof_token: EOF@79..80 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..80 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..79 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_PARENTHESIZED_EXPRESSION@0..13 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..12 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@1..9 - 0: L_BRACK@1..3 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@3..7 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@3..7 - 0: DOT3@3..7 "..." [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@7..9 "]" [] [Whitespace(" ")] - 1: EQ@9..11 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@11..12 - 0: JS_REFERENCE_IDENTIFIER@11..12 - 0: IDENT@11..12 "a" [] [] - 2: R_PAREN@12..13 ")" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..42 - 0: JS_PARENTHESIZED_EXPRESSION@14..41 - 0: L_PAREN@14..16 "(" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@16..40 - 0: JS_BOGUS@16..37 - 0: L_BRACK@16..18 "[" [] [Whitespace(" ")] - 1: JS_BOGUS@18..35 - 0: JS_BOGUS@18..35 - 0: DOT3@18..21 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@21..23 - 0: IDENT@21..23 "c" [] [Whitespace(" ")] - 2: EQ@23..25 "=" [] [Whitespace(" ")] - 3: JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")] - 2: R_BRACK@35..37 "]" [] [Whitespace(" ")] - 1: EQ@37..39 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@39..40 - 0: JS_REFERENCE_IDENTIFIER@39..40 - 0: IDENT@39..40 "a" [] [] - 2: R_PAREN@40..41 ")" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@42..79 - 0: JS_PARENTHESIZED_EXPRESSION@42..78 - 0: L_PAREN@42..44 "(" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@44..77 - 0: JS_BOGUS@44..74 - 0: L_BRACK@44..46 "[" [] [Whitespace(" ")] - 1: JS_BOGUS@46..72 - 0: JS_BOGUS@46..53 - 0: DOT3@46..49 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@49..53 - 0: IDENT@49..53 "rest" [] [] - 1: COMMA@53..55 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@55..72 - 0: JS_IDENTIFIER_ASSIGNMENT@55..72 - 0: IDENT@55..72 "other_assignment" [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@72..74 "]" [] [Whitespace(" ")] - 1: EQ@74..76 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@76..77 - 0: JS_REFERENCE_IDENTIFIER@76..77 - 0: IDENT@76..77 "a" [] [] - 2: R_PAREN@77..78 ")" [] [] - 1: SEMICOLON@78..79 ";" [] [] - 4: EOF@79..80 "" [Newline("\n")] [] --- -array_assignment_target_rest_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or an assignment target but instead found ''. - - > 1 │ ([ ... ] = a); - │ - 2 │ ([ ...c = "default" ] = a); - 3 │ ([ ...rest, other_assignment ] = a); - - i Expected an identifier, or an assignment target here. - - > 1 │ ([ ... ] = a); - │ - 2 │ ([ ...c = "default" ] = a); - 3 │ ([ ...rest, other_assignment ] = a); - --- -array_assignment_target_rest_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element cannot have a default - - 1 │ ([ ... ] = a); - > 2 │ ([ ...c = "default" ] = a); - │ ^^^^^^^^^^^^ - 3 │ ([ ...rest, other_assignment ] = a); - 4 │ - - i Remove the default value here - - 1 │ ([ ... ] = a); - > 2 │ ([ ...c = "default" ] = a); - │ ^^^^^^^^^^^^ - 3 │ ([ ...rest, other_assignment ] = a); - 4 │ - - i Rest element - - 1 │ ([ ... ] = a); - > 2 │ ([ ...c = "default" ] = a); - │ ^^^^ - 3 │ ([ ...rest, other_assignment ] = a); - 4 │ - --- -array_assignment_target_rest_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element must be the last element - - 1 │ ([ ... ] = a); - 2 │ ([ ...c = "default" ] = a); - > 3 │ ([ ...rest, other_assignment ] = a); - │ ^^^^^^^ - 4 │ - - i Move the rest element to the end of the pattern, right before the closing ']' - --- -([ ... ] = a); -([ ...c = "default" ] = a); -([ ...rest, other_assignment ] = a); diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_err.rast b/crates/biome_js_parser/test_data/inline/err/array_binding_err.rast deleted file mode 100644 index 6e342ec9d924..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/array_binding_err.rast +++ /dev/null @@ -1,408 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@4..5 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@5..7 "a" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - missing separator, - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@7..8 "b" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@8..10 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@10..12 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@12..13 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..14 "1" [] [], - }, - COMMA@14..16 "," [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@16..17 "2" [] [], - }, - ], - r_brack_token: R_BRACK@17..18 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@24..25 "[" [] [], - elements: JsArrayBindingPatternElementList [], - r_brack_token: missing (required), - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@25..26 "=" [] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@26..35 "\"default\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_BRACK@35..37 "]" [] [Whitespace(" ")], - EQ@37..39 "=" [] [Whitespace(" ")], - L_BRACK@39..40 "[" [] [], - JS_NUMBER_LITERAL@40..41 "1" [] [], - COMMA@41..43 "," [] [Whitespace(" ")], - JS_NUMBER_LITERAL@43..44 "2" [] [], - R_BRACK@44..45 "]" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_BRACK@51..52 "[" [] [], - JsBogus { - items: [ - JsBogusBinding { - items: [ - JS_STRING_LITERAL@52..61 "\"default\"" [] [], - ], - }, - ], - }, - R_BRACK@61..63 "]" [] [Whitespace(" ")], - ], - }, - JsInitializerClause { - eq_token: EQ@63..65 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@65..66 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@66..67 "1" [] [], - }, - COMMA@67..69 "," [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@69..70 "2" [] [], - }, - ], - r_brack_token: R_BRACK@70..71 "]" [] [], - }, - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@71..72 ";" [] [], - ], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@72..77 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@77..78 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsArrayBindingPattern { - l_brack_token: L_BRACK@78..79 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@79..81 "c" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@81..83 "]" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@83..85 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@85..86 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@86..87 "]" [] [], - }, - }, - }, - ], - r_brack_token: missing (required), - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@87..88 ";" [] [], - }, - ], - eof_token: EOF@88..89 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..89 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..88 - 0: JS_VARIABLE_STATEMENT@0..19 - 0: JS_VARIABLE_DECLARATION@0..18 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..18 - 0: JS_VARIABLE_DECLARATOR@4..18 - 0: JS_ARRAY_BINDING_PATTERN@4..10 - 0: L_BRACK@4..5 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@5..8 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@5..7 - 0: JS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "a" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@7..8 - 0: JS_IDENTIFIER_BINDING@7..8 - 0: IDENT@7..8 "b" [] [] - 1: (empty) - 2: R_BRACK@8..10 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@10..18 - 0: EQ@10..12 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@12..18 - 0: L_BRACK@12..13 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@13..17 - 0: JS_NUMBER_LITERAL_EXPRESSION@13..14 - 0: JS_NUMBER_LITERAL@13..14 "1" [] [] - 1: COMMA@14..16 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@16..17 - 0: JS_NUMBER_LITERAL@16..17 "2" [] [] - 2: R_BRACK@17..18 "]" [] [] - 1: SEMICOLON@18..19 ";" [] [] - 1: JS_VARIABLE_STATEMENT@19..35 - 0: JS_VARIABLE_DECLARATION@19..35 - 0: (empty) - 1: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@24..35 - 0: JS_VARIABLE_DECLARATOR@24..35 - 0: JS_ARRAY_BINDING_PATTERN@24..25 - 0: L_BRACK@24..25 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@25..25 - 2: (empty) - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@25..35 - 0: EQ@25..26 "=" [] [] - 1: JS_STRING_LITERAL_EXPRESSION@26..35 - 0: JS_STRING_LITERAL@26..35 "\"default\"" [] [] - 1: (empty) - 2: JS_BOGUS_STATEMENT@35..45 - 0: R_BRACK@35..37 "]" [] [Whitespace(" ")] - 1: EQ@37..39 "=" [] [Whitespace(" ")] - 2: L_BRACK@39..40 "[" [] [] - 3: JS_NUMBER_LITERAL@40..41 "1" [] [] - 4: COMMA@41..43 "," [] [Whitespace(" ")] - 5: JS_NUMBER_LITERAL@43..44 "2" [] [] - 6: R_BRACK@44..45 "]" [] [] - 3: JS_EMPTY_STATEMENT@45..46 - 0: SEMICOLON@45..46 ";" [] [] - 4: JS_BOGUS_STATEMENT@46..72 - 0: JS_BOGUS@46..71 - 0: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@51..71 - 0: JS_BOGUS@51..71 - 0: JS_BOGUS@51..63 - 0: L_BRACK@51..52 "[" [] [] - 1: JS_BOGUS@52..61 - 0: JS_BOGUS_BINDING@52..61 - 0: JS_STRING_LITERAL@52..61 "\"default\"" [] [] - 2: R_BRACK@61..63 "]" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@63..71 - 0: EQ@63..65 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@65..71 - 0: L_BRACK@65..66 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@66..70 - 0: JS_NUMBER_LITERAL_EXPRESSION@66..67 - 0: JS_NUMBER_LITERAL@66..67 "1" [] [] - 1: COMMA@67..69 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@69..70 - 0: JS_NUMBER_LITERAL@69..70 "2" [] [] - 2: R_BRACK@70..71 "]" [] [] - 1: SEMICOLON@71..72 ";" [] [] - 5: JS_VARIABLE_STATEMENT@72..88 - 0: JS_VARIABLE_DECLARATION@72..87 - 0: (empty) - 1: LET_KW@72..77 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@77..87 - 0: JS_VARIABLE_DECLARATOR@77..87 - 0: JS_ARRAY_BINDING_PATTERN@77..87 - 0: L_BRACK@77..78 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@78..87 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@78..87 - 0: JS_ARRAY_BINDING_PATTERN@78..83 - 0: L_BRACK@78..79 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@79..81 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@79..81 - 0: JS_IDENTIFIER_BINDING@79..81 - 0: IDENT@79..81 "c" [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@81..83 "]" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@83..87 - 0: EQ@83..85 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@85..87 - 0: L_BRACK@85..86 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@86..86 - 2: R_BRACK@86..87 "]" [] [] - 2: (empty) - 1: (empty) - 2: (empty) - 1: SEMICOLON@87..88 ";" [] [] - 4: EOF@88..89 "" [Newline("\n")] [] --- -array_binding_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `b` - - > 1 │ let [a b] = [1, 2]; - │ ^ - 2 │ let [="default"] = [1, 2]; - 3 │ let ["default"] = [1, 2]; - - i Remove b - --- -array_binding_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an object pattern, an array pattern, or a rest pattern but instead found '='. - - 1 │ let [a b] = [1, 2]; - > 2 │ let [="default"] = [1, 2]; - │ ^ - 3 │ let ["default"] = [1, 2]; - 4 │ let [[c ] = []; - - i Expected an identifier, an object pattern, an array pattern, or a rest pattern here. - - 1 │ let [a b] = [1, 2]; - > 2 │ let [="default"] = [1, 2]; - │ ^ - 3 │ let ["default"] = [1, 2]; - 4 │ let [[c ] = []; - --- -array_binding_err.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ let [a b] = [1, 2]; - > 2 │ let [="default"] = [1, 2]; - │ ^ - 3 │ let ["default"] = [1, 2]; - 4 │ let [[c ] = []; - - i An explicit or implicit semicolon is expected here... - - 1 │ let [a b] = [1, 2]; - > 2 │ let [="default"] = [1, 2]; - │ ^ - 3 │ let ["default"] = [1, 2]; - 4 │ let [[c ] = []; - - i ...Which is required to end this statement - - 1 │ let [a b] = [1, 2]; - > 2 │ let [="default"] = [1, 2]; - │ ^^^^^^^^^^^^^^^ - 3 │ let ["default"] = [1, 2]; - 4 │ let [[c ] = []; - --- -array_binding_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an object pattern, an array pattern, or a rest pattern but instead found '"default"'. - - 1 │ let [a b] = [1, 2]; - 2 │ let [="default"] = [1, 2]; - > 3 │ let ["default"] = [1, 2]; - │ ^^^^^^^^^ - 4 │ let [[c ] = []; - 5 │ - - i Expected an identifier, an object pattern, an array pattern, or a rest pattern here. - - 1 │ let [a b] = [1, 2]; - 2 │ let [="default"] = [1, 2]; - > 3 │ let ["default"] = [1, 2]; - │ ^^^^^^^^^ - 4 │ let [[c ] = []; - 5 │ - --- -array_binding_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `;` - - 2 │ let [="default"] = [1, 2]; - 3 │ let ["default"] = [1, 2]; - > 4 │ let [[c ] = []; - │ ^ - 5 │ - - i Remove ; - --- -array_binding_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Object and Array patterns require initializers. - - 2 │ let [="default"] = [1, 2]; - 3 │ let ["default"] = [1, 2]; - > 4 │ let [[c ] = []; - │ ^^^^^^^^^^ - 5 │ - - i This pattern is declared, but it is not given an initialized value. - --- -let [a b] = [1, 2]; -let [="default"] = [1, 2]; -let ["default"] = [1, 2]; -let [[c ] = []; diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.rast b/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.rast deleted file mode 100644 index cd1b6de51a3e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.rast +++ /dev/null @@ -1,268 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@4..6 "[" [] [Whitespace(" ")], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@6..10 "..." [] [Whitespace(" ")], - pattern: missing (required), - }, - ], - r_brack_token: R_BRACK@10..12 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@12..14 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..15 "a" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_BRACK@21..23 "[" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@23..26 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@26..28 "c" [] [Whitespace(" ")], - }, - EQ@28..30 "=" [] [Whitespace(" ")], - JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")], - ], - }, - ], - }, - R_BRACK@40..42 "]" [] [Whitespace(" ")], - ], - }, - JsInitializerClause { - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "a" [] [], - }, - }, - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@45..46 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_BRACK@51..53 "[" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@53..56 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@56..60 "rest" [] [], - }, - ], - }, - COMMA@60..62 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@62..79 "other_assignment" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - }, - R_BRACK@79..81 "]" [] [Whitespace(" ")], - ], - }, - JsInitializerClause { - eq_token: EQ@81..83 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@83..84 "a" [] [], - }, - }, - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@84..85 ";" [] [], - ], - }, - ], - eof_token: EOF@85..86 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..86 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..85 - 0: JS_VARIABLE_STATEMENT@0..16 - 0: JS_VARIABLE_DECLARATION@0..15 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..15 - 0: JS_VARIABLE_DECLARATOR@4..15 - 0: JS_ARRAY_BINDING_PATTERN@4..12 - 0: L_BRACK@4..6 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@6..10 - 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@6..10 - 0: DOT3@6..10 "..." [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@10..12 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@12..15 - 0: EQ@12..14 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@14..15 - 0: JS_REFERENCE_IDENTIFIER@14..15 - 0: IDENT@14..15 "a" [] [] - 1: SEMICOLON@15..16 ";" [] [] - 1: JS_BOGUS_STATEMENT@16..46 - 0: JS_BOGUS@16..45 - 0: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@21..45 - 0: JS_BOGUS@21..45 - 0: JS_BOGUS@21..42 - 0: L_BRACK@21..23 "[" [] [Whitespace(" ")] - 1: JS_BOGUS@23..40 - 0: JS_BOGUS@23..40 - 0: DOT3@23..26 "..." [] [] - 1: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "c" [] [Whitespace(" ")] - 2: EQ@28..30 "=" [] [Whitespace(" ")] - 3: JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")] - 2: R_BRACK@40..42 "]" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@42..45 - 0: EQ@42..44 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "a" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 2: JS_BOGUS_STATEMENT@46..85 - 0: JS_BOGUS@46..84 - 0: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@51..84 - 0: JS_BOGUS@51..84 - 0: JS_BOGUS@51..81 - 0: L_BRACK@51..53 "[" [] [Whitespace(" ")] - 1: JS_BOGUS@53..79 - 0: JS_BOGUS@53..60 - 0: DOT3@53..56 "..." [] [] - 1: JS_IDENTIFIER_BINDING@56..60 - 0: IDENT@56..60 "rest" [] [] - 1: COMMA@60..62 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@62..79 - 0: JS_IDENTIFIER_BINDING@62..79 - 0: IDENT@62..79 "other_assignment" [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@79..81 "]" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@81..84 - 0: EQ@81..83 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@83..84 - 0: JS_REFERENCE_IDENTIFIER@83..84 - 0: IDENT@83..84 "a" [] [] - 1: SEMICOLON@84..85 ";" [] [] - 4: EOF@85..86 "" [Newline("\n")] [] --- -array_binding_rest_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found ''. - - > 1 │ let [ ... ] = a; - │ - 2 │ let [ ...c = "default" ] = a; - 3 │ let [ ...rest, other_assignment ] = a; - - i Expected an identifier, an array pattern, or an object pattern here. - - > 1 │ let [ ... ] = a; - │ - 2 │ let [ ...c = "default" ] = a; - 3 │ let [ ...rest, other_assignment ] = a; - --- -array_binding_rest_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element cannot have a default - - 1 │ let [ ... ] = a; - > 2 │ let [ ...c = "default" ] = a; - │ ^^^^^^^^^^^^ - 3 │ let [ ...rest, other_assignment ] = a; - 4 │ - - i Remove the default value here - - 1 │ let [ ... ] = a; - > 2 │ let [ ...c = "default" ] = a; - │ ^^^^^^^^^^^^ - 3 │ let [ ...rest, other_assignment ] = a; - 4 │ - - i Rest element - - 1 │ let [ ... ] = a; - > 2 │ let [ ...c = "default" ] = a; - │ ^^^^ - 3 │ let [ ...rest, other_assignment ] = a; - 4 │ - --- -array_binding_rest_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element must be the last element - - 1 │ let [ ... ] = a; - 2 │ let [ ...c = "default" ] = a; - > 3 │ let [ ...rest, other_assignment ] = a; - │ ^^^^^^^ - 4 │ - - i Move the rest element to the end of the pattern, right before the closing ']' - --- -let [ ... ] = a; -let [ ...c = "default" ] = a; -let [ ...rest, other_assignment ] = a; diff --git a/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.rast deleted file mode 100644 index b26eebaafc67..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.rast +++ /dev/null @@ -1,71 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@8..9 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: missing (required), - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_VARIABLE_STATEMENT@0..9 - 0: JS_VARIABLE_DECLARATION@0..9 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..9 - 0: JS_VARIABLE_DECLARATOR@4..9 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..9 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@8..9 - 0: L_BRACK@8..9 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@9..9 - 2: (empty) - 1: (empty) - 4: EOF@9..10 "" [Newline("\n")] [] --- -array_expr_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `]` but instead the file ends - - 1 │ let a = [ - > 2 │ - │ - - i the file ends here - - 1 │ let a = [ - > 2 │ - │ - --- -let a = [ diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.rast b/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.rast deleted file mode 100644 index e3d23df97ae1..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.rast +++ /dev/null @@ -1,60 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - ERROR_TOKEN@0..11 "\\u0061sync" [] [Whitespace(" ")], - JsParameters { - l_paren_token: L_PAREN@11..12 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@12..14 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@14..17 "=>" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@19..20 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..20 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..19 - 0: JS_EXPRESSION_STATEMENT@0..19 - 0: JS_BOGUS_EXPRESSION@0..19 - 0: ERROR_TOKEN@0..11 "\\u0061sync" [] [Whitespace(" ")] - 1: JS_PARAMETERS@11..14 - 0: L_PAREN@11..12 "(" [] [] - 1: JS_PARAMETER_LIST@12..12 - 2: R_PAREN@12..14 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@17..19 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..18 - 3: R_CURLY@18..19 "}" [] [] - 1: (empty) - 4: EOF@19..20 "" [Newline("\n")] [] --- -arrow_escaped_async.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'async' keyword cannot contain escape character. - - > 1 │ \u0061sync () => {} - │ ^^^^^^^^^^ - 2 │ - --- -\u0061sync () => {} diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast b/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast deleted file mode 100644 index bf1ad90f0d24..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast +++ /dev/null @@ -1,122 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@5..6 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - DOT3@6..9 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@9..11 "a" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@11..13 "=" [] [Whitespace(" ")], - expression: JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@13..17 "\"b\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@17..20 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@20..21 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@27..28 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - first_semi_token: SEMICOLON@29..30 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@30..31 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@33..34 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: JS_FOR_STATEMENT@0..35 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_ARROW_FUNCTION_EXPRESSION@5..29 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@5..24 - 0: L_PAREN@5..6 "(" [] [] - 1: JS_PARAMETER_LIST@6..22 - 0: JS_BOGUS_PARAMETER@6..22 - 0: JS_DECORATOR_LIST@6..6 - 1: DOT3@6..9 "..." [] [] - 2: JS_IDENTIFIER_BINDING@9..11 - 0: IDENT@9..11 "a" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@11..22 - 0: EQ@11..13 "=" [] [Whitespace(" ")] - 1: JS_IN_EXPRESSION@13..22 - 0: JS_STRING_LITERAL_EXPRESSION@13..17 - 0: JS_STRING_LITERAL@13..17 "\"b\"" [] [Whitespace(" ")] - 1: IN_KW@17..20 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@20..22 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@21..21 - 2: R_CURLY@21..22 "}" [] [] - 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@27..29 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..28 - 3: R_CURLY@28..29 "}" [] [] - 3: SEMICOLON@29..30 ";" [] [] - 4: (empty) - 5: SEMICOLON@30..31 ";" [] [] - 6: (empty) - 7: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@33..35 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_STATEMENT_LIST@34..34 - 2: R_CURLY@34..35 "}" [] [] - 4: EOF@35..36 "" [Newline("\n")] [] --- -arrow_rest_in_expr_in_initializer.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest elements may not have default initializers - - > 1 │ for ((...a = "b" in {}) => {};;) {} - │ ^^^^^^^^^^^ - 2 │ - --- -for ((...a = "b" in {}) => {};;) {} diff --git a/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast b/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast deleted file mode 100644 index 835ede934d37..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast +++ /dev/null @@ -1,344 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@0..5 "eval" [] [Whitespace(" ")], - ], - }, - operator_token: EQ@5..7 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@7..8 "0" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@8..14 "eval" [Newline("\n")] [Whitespace(" ")], - ], - }, - operator_token: QUESTION2EQ@14..18 "??=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@18..19 "2" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@19..25 "eval" [Newline("\n")] [Whitespace(" ")], - ], - }, - operator_token: STAREQ@25..28 "*=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@28..29 "4" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@29..40 "arguments" [Newline("\n")] [Whitespace(" ")], - ], - }, - operator_token: EQ@40..42 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@42..47 "\"foo\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@47..58 "arguments" [Newline("\n")] [Whitespace(" ")], - ], - }, - operator_token: PIPE2EQ@58..62 "||=" [] [Whitespace(" ")], - right: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - JsCallExpression { - callee: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@62..67 "\"baz\"" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@67..69 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsBogusExpression { - items: [ - JsBogus { - items: [ - L_CURLY@69..71 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogusAssignment { - items: [ - IDENT@71..76 "eval" [] [Whitespace(" ")], - ], - }, - ], - }, - ], - }, - R_CURLY@76..78 "}" [] [Whitespace(" ")], - ], - }, - EQ@78..80 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@80..81 "o" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@81..82 ")" [] [], - }, - }, - JsCallArguments { - l_paren_token: L_PAREN@82..84 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsObjectExpression { - l_curly_token: L_CURLY@84..86 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@86..89 "foo" [] [], - }, - colon_token: COLON@89..91 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@91..93 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@93..98 "eval" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@98..99 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@99..100 "}" [] [], - }, - ], - r_paren_token: R_PAREN@100..102 ")" [] [Whitespace(" ")], - }, - ], - }, - operator_token: EQ@102..104 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@104..105 "o" [] [], - }, - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@105..106 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..106 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..105 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_ASSIGNMENT_EXPRESSION@0..8 - 0: JS_BOGUS_ASSIGNMENT@0..5 - 0: IDENT@0..5 "eval" [] [Whitespace(" ")] - 1: EQ@5..7 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@7..8 - 0: JS_NUMBER_LITERAL@7..8 "0" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@8..19 - 0: JS_ASSIGNMENT_EXPRESSION@8..19 - 0: JS_BOGUS_ASSIGNMENT@8..14 - 0: IDENT@8..14 "eval" [Newline("\n")] [Whitespace(" ")] - 1: QUESTION2EQ@14..18 "??=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@18..19 - 0: JS_NUMBER_LITERAL@18..19 "2" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@19..29 - 0: JS_ASSIGNMENT_EXPRESSION@19..29 - 0: JS_BOGUS_ASSIGNMENT@19..25 - 0: IDENT@19..25 "eval" [Newline("\n")] [Whitespace(" ")] - 1: STAREQ@25..28 "*=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@28..29 - 0: JS_NUMBER_LITERAL@28..29 "4" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@29..47 - 0: JS_ASSIGNMENT_EXPRESSION@29..47 - 0: JS_BOGUS_ASSIGNMENT@29..40 - 0: IDENT@29..40 "arguments" [Newline("\n")] [Whitespace(" ")] - 1: EQ@40..42 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@42..47 - 0: JS_STRING_LITERAL@42..47 "\"foo\"" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@47..105 - 0: JS_ASSIGNMENT_EXPRESSION@47..105 - 0: JS_BOGUS_ASSIGNMENT@47..58 - 0: IDENT@47..58 "arguments" [Newline("\n")] [Whitespace(" ")] - 1: PIPE2EQ@58..62 "||=" [] [Whitespace(" ")] - 2: JS_ASSIGNMENT_EXPRESSION@62..105 - 0: JS_BOGUS_ASSIGNMENT@62..102 - 0: JS_CALL_EXPRESSION@62..82 - 0: JS_STRING_LITERAL_EXPRESSION@62..67 - 0: JS_STRING_LITERAL@62..67 "\"baz\"" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@67..82 - 0: L_PAREN@67..69 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@69..81 - 0: JS_BOGUS_EXPRESSION@69..81 - 0: JS_BOGUS@69..78 - 0: L_CURLY@69..71 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@71..76 - 0: JS_BOGUS@71..76 - 0: JS_BOGUS_ASSIGNMENT@71..76 - 0: IDENT@71..76 "eval" [] [Whitespace(" ")] - 2: R_CURLY@76..78 "}" [] [Whitespace(" ")] - 1: EQ@78..80 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@80..81 - 0: JS_REFERENCE_IDENTIFIER@80..81 - 0: IDENT@80..81 "o" [] [] - 2: R_PAREN@81..82 ")" [] [] - 1: JS_CALL_ARGUMENTS@82..102 - 0: L_PAREN@82..84 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@84..100 - 0: JS_OBJECT_EXPRESSION@84..100 - 0: L_CURLY@84..86 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@86..99 - 0: JS_PROPERTY_OBJECT_MEMBER@86..99 - 0: JS_LITERAL_MEMBER_NAME@86..89 - 0: IDENT@86..89 "foo" [] [] - 1: COLON@89..91 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@91..99 - 0: L_CURLY@91..93 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@93..98 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@93..98 - 0: JS_REFERENCE_IDENTIFIER@93..98 - 0: IDENT@93..98 "eval" [] [Whitespace(" ")] - 2: R_CURLY@98..99 "}" [] [] - 2: R_CURLY@99..100 "}" [] [] - 2: R_PAREN@100..102 ")" [] [Whitespace(" ")] - 1: EQ@102..104 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@104..105 - 0: JS_REFERENCE_IDENTIFIER@104..105 - 0: IDENT@104..105 "o" [] [] - 1: (empty) - 4: EOF@105..106 "" [Newline("\n")] [] --- -assign_eval_or_arguments.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - > 1 │ eval = 0 - │ ^^^^ - 2 │ eval ??= 2 - 3 │ eval *= 4 - --- -assign_eval_or_arguments.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - 1 │ eval = 0 - > 2 │ eval ??= 2 - │ ^^^^ - 3 │ eval *= 4 - 4 │ arguments = "foo" - --- -assign_eval_or_arguments.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - 1 │ eval = 0 - 2 │ eval ??= 2 - > 3 │ eval *= 4 - │ ^^^^ - 4 │ arguments = "foo" - 5 │ arguments ||= "baz" - --- -assign_eval_or_arguments.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `arguments` as an identifier in strict mode - - 2 │ eval ??= 2 - 3 │ eval *= 4 - > 4 │ arguments = "foo" - │ ^^^^^^^^^ - 5 │ arguments ||= "baz" - 6 │ ({ eval } = o) - --- -assign_eval_or_arguments.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `arguments` as an identifier in strict mode - - 3 │ eval *= 4 - 4 │ arguments = "foo" - > 5 │ arguments ||= "baz" - │ ^^^^^^^^^ - 6 │ ({ eval } = o) - 7 │ ({ foo: { eval }}) = o - --- -assign_eval_or_arguments.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - 4 │ arguments = "foo" - 5 │ arguments ||= "baz" - > 6 │ ({ eval } = o) - │ ^^^^ - 7 │ ({ foo: { eval }}) = o - 8 │ - --- -assign_eval_or_arguments.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `"baz" - ({ eval } = o) - ({ foo: { eval }})` - - 3 │ eval *= 4 - 4 │ arguments = "foo" - > 5 │ arguments ||= "baz" - │ ^^^^^ - > 6 │ ({ eval } = o) - > 7 │ ({ foo: { eval }}) = o - │ ^^^^^^^^^^^^^^^^^^ - 8 │ - - i This expression cannot be assigned to - --- -eval = 0 -eval ??= 2 -eval *= 4 -arguments = "foo" -arguments ||= "baz" -({ eval } = o) -({ foo: { eval }}) = o diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_left.rast b/crates/biome_js_parser/test_data/inline/err/assign_expr_left.rast deleted file mode 100644 index 64551effcd87..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/assign_expr_left.rast +++ /dev/null @@ -1,88 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@0..2 "(" [] [Whitespace(" ")], - assignment: missing (required), - r_paren_token: missing (required), - }, - operator_token: EQ@2..4 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..7 "foo" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_PAREN@7..8 ")" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JS_ASSIGNMENT_EXPRESSION@0..7 - 0: JS_PARENTHESIZED_ASSIGNMENT@0..2 - 0: L_PAREN@0..2 "(" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 1: EQ@2..4 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@4..7 - 0: JS_REFERENCE_IDENTIFIER@4..7 - 0: IDENT@4..7 "foo" [] [] - 1: (empty) - 1: JS_BOGUS_STATEMENT@7..8 - 0: R_PAREN@7..8 ")" [] [] - 2: JS_EMPTY_STATEMENT@8..9 - 0: SEMICOLON@8..9 ";" [] [] - 4: EOF@9..10 "" [Newline("\n")] [] --- -assign_expr_left.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `=` - - > 1 │ ( = foo); - │ ^ - 2 │ - - i Remove = - --- -assign_expr_left.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ ( = foo); - │ ^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ ( = foo); - │ ^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ ( = foo); - │ ^^^^^^^^ - 2 │ - --- -( = foo); diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_right.rast b/crates/biome_js_parser/test_data/inline/err/assign_expr_right.rast deleted file mode 100644 index 57700cc4ef04..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/assign_expr_right.rast +++ /dev/null @@ -1,56 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@1..5 "foo" [] [Whitespace(" ")], - }, - operator_token: EQ@5..7 "=" [] [Whitespace(" ")], - right: missing (required), - }, - r_paren_token: R_PAREN@7..8 ")" [] [], - }, - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_EXPRESSION_STATEMENT@0..9 - 0: JS_PARENTHESIZED_EXPRESSION@0..8 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..7 - 0: JS_IDENTIFIER_ASSIGNMENT@1..5 - 0: IDENT@1..5 "foo" [] [Whitespace(" ")] - 1: EQ@5..7 "=" [] [Whitespace(" ")] - 2: (empty) - 2: R_PAREN@7..8 ")" [] [] - 1: SEMICOLON@8..9 ";" [] [] - 4: EOF@9..10 "" [Newline("\n")] [] --- -assign_expr_right.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ')'. - - > 1 │ (foo = ); - │ ^ - 2 │ - - i Expected an expression, or an assignment here. - - > 1 │ (foo = ); - │ ^ - 2 │ - --- -(foo = ); diff --git a/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast b/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast deleted file mode 100644 index cd9e84552237..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast +++ /dev/null @@ -1,320 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@8..14 "async" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsBogusBinding { - items: [ - IDENT@14..20 "await" [] [Whitespace(" ")], - ], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@20..23 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@23..24 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@25..31 "async" [Newline("\n")] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@34..37 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@37..39 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@39..40 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@40..42 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@44..49 "await" [] [], - ], - }, - ], - }, - }, - }, - ], - r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@54..55 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@55..57 "}" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@59..65 "async" [Newline("\n")] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@65..66 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@68..71 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@73..74 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@74..76 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - AWAIT_KW@78..84 "await" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@84..86 "10" [] [], - }, - ], - }, - }, - }, - ], - r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@88..91 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@91..92 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@92..94 "}" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@94..95 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@95..96 ";" [] [], - }, - ], - eof_token: EOF@96..97 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..97 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..96 - 0: JS_VARIABLE_STATEMENT@0..25 - 0: JS_VARIABLE_DECLARATION@0..25 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..25 - 0: JS_VARIABLE_DECLARATOR@4..25 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..25 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@8..25 - 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BOGUS_BINDING@14..20 - 0: IDENT@14..20 "await" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@20..23 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@23..25 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_DIRECTIVE_LIST@24..24 - 2: JS_STATEMENT_LIST@24..24 - 3: R_CURLY@24..25 "}" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@25..59 - 0: JS_ARROW_FUNCTION_EXPRESSION@25..58 - 0: ASYNC_KW@25..31 "async" [Newline("\n")] [] - 1: (empty) - 2: JS_PARAMETERS@31..34 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_PARAMETER_LIST@32..32 - 2: R_PAREN@32..34 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@34..37 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@37..58 - 0: L_CURLY@37..39 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@39..39 - 2: JS_STATEMENT_LIST@39..57 - 0: JS_EXPRESSION_STATEMENT@39..57 - 0: JS_ARROW_FUNCTION_EXPRESSION@39..57 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@39..51 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_PARAMETER_LIST@40..49 - 0: JS_FORMAL_PARAMETER@40..49 - 0: JS_DECORATOR_LIST@40..40 - 1: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@42..49 - 0: EQ@42..44 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@44..49 - 0: JS_BOGUS@44..49 - 0: IDENT@44..49 "await" [] [] - 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@54..57 - 0: L_CURLY@54..55 "{" [] [] - 1: JS_DIRECTIVE_LIST@55..55 - 2: JS_STATEMENT_LIST@55..55 - 3: R_CURLY@55..57 "}" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@57..58 "}" [] [] - 1: SEMICOLON@58..59 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@59..96 - 0: JS_ARROW_FUNCTION_EXPRESSION@59..95 - 0: ASYNC_KW@59..65 "async" [Newline("\n")] [] - 1: (empty) - 2: JS_PARAMETERS@65..68 - 0: L_PAREN@65..66 "(" [] [] - 1: JS_PARAMETER_LIST@66..66 - 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@68..71 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@71..95 - 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@73..73 - 2: JS_STATEMENT_LIST@73..94 - 0: JS_EXPRESSION_STATEMENT@73..94 - 0: JS_ARROW_FUNCTION_EXPRESSION@73..94 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@73..88 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_PARAMETER_LIST@74..86 - 0: JS_FORMAL_PARAMETER@74..86 - 0: JS_DECORATOR_LIST@74..74 - 1: JS_IDENTIFIER_BINDING@74..76 - 0: IDENT@74..76 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@76..86 - 0: EQ@76..78 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@78..86 - 0: AWAIT_KW@78..84 "await" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@84..86 - 0: JS_NUMBER_LITERAL@84..86 "10" [] [] - 2: R_PAREN@86..88 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@88..91 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@91..94 - 0: L_CURLY@91..92 "{" [] [] - 1: JS_DIRECTIVE_LIST@92..92 - 2: JS_STATEMENT_LIST@92..92 - 3: R_CURLY@92..94 "}" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@94..95 "}" [] [] - 1: SEMICOLON@95..96 ";" [] [] - 4: EOF@96..97 "" [Newline("\n")] [] --- -async_arrow_expr_await_parameter.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - > 1 │ let a = async await => {} - │ ^^^^^ - 2 │ async() => { (a = await) => {} }; - 3 │ async() => { (a = await 10) => {} }; - --- -async_arrow_expr_await_parameter.js:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - 1 │ let a = async await => {} - > 2 │ async() => { (a = await) => {} }; - │ ^^^^^ - 3 │ async() => { (a = await 10) => {} }; - 4 │ - --- -async_arrow_expr_await_parameter.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await` is only allowed within async functions and at the top levels of modules. - - 1 │ let a = async await => {} - 2 │ async() => { (a = await) => {} }; - > 3 │ async() => { (a = await 10) => {} }; - │ ^^^^^ - 4 │ - --- -let a = async await => {} -async() => { (a = await) => {} }; -async() => { (a = await 10) => {} }; diff --git a/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast b/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast deleted file mode 100644 index ff89b061b838..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast +++ /dev/null @@ -1,138 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsBogusStatement { - items: [ - ASYNC_KW@10..16 "async" [] [Whitespace(" ")], - FUNCTION_KW@16..25 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@25..26 "t" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@26..27 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@29..30 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - ], - }, - else_clause: missing (optional), - }, - JsIfStatement { - if_token: IF_KW@31..35 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@35..36 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@36..40 "true" [] [], - }, - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - consequent: JsBogusStatement { - items: [ - FUNCTION_KW@42..50 "function" [] [], - STAR@50..52 "*" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@52..53 "t" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@53..54 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@56..57 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - ], - }, - else_clause: missing (optional), - }, - ], - eof_token: EOF@58..59 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..59 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..58 - 0: JS_IF_STATEMENT@0..31 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@10..31 - 0: ASYNC_KW@10..16 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "t" [] [] - 3: JS_PARAMETERS@26..29 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_PARAMETER_LIST@27..27 - 2: R_PAREN@27..29 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@29..31 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_DIRECTIVE_LIST@30..30 - 2: JS_STATEMENT_LIST@30..30 - 3: R_CURLY@30..31 "}" [] [] - 5: (empty) - 1: JS_IF_STATEMENT@31..58 - 0: IF_KW@31..35 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@35..36 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@36..40 - 0: TRUE_KW@36..40 "true" [] [] - 3: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@42..58 - 0: FUNCTION_KW@42..50 "function" [] [] - 1: STAR@50..52 "*" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@52..53 - 0: IDENT@52..53 "t" [] [] - 3: JS_PARAMETERS@53..56 - 0: L_PAREN@53..54 "(" [] [] - 1: JS_PARAMETER_LIST@54..54 - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@56..58 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..57 - 3: R_CURLY@57..58 "}" [] [] - 5: (empty) - 4: EOF@58..59 "" [Newline("\n")] [] --- -async_or_generator_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `async` and generator functions can only be declared at top level or inside a block - - > 1 │ if (true) async function t() {} - │ ^^^^^^^^^^^^^^^^^^^^^ - 2 │ if (true) function* t() {} - 3 │ - --- -async_or_generator_in_single_statement_context.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `async` and generator functions can only be declared at top level or inside a block - - 1 │ if (true) async function t() {} - > 2 │ if (true) function* t() {} - │ ^^^^^^^^^^^^^^^^ - 3 │ - --- -if (true) async function t() {} -if (true) function* t() {} diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_module.rast b/crates/biome_js_parser/test_data/inline/err/await_in_module.rast deleted file mode 100644 index 8dd0dab58fbe..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/await_in_module.rast +++ /dev/null @@ -1,129 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@4..10 "await" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@10..12 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@12..14 "10" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..23 "console" [Newline("\n")] [], - }, - }, - operator_token: DOT@23..24 "." [] [], - member: JsName { - value_token: IDENT@24..27 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@27..28 "(" [] [], - args: JsCallArgumentList [ - JsAwaitExpression { - await_token: AWAIT_KW@28..33 "await" [] [], - argument: missing (required), - }, - ], - r_paren_token: R_PAREN@33..34 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: JS_VARIABLE_STATEMENT@0..15 - 0: JS_VARIABLE_DECLARATION@0..14 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..14 - 0: JS_VARIABLE_DECLARATOR@4..14 - 0: JS_BOGUS_BINDING@4..10 - 0: IDENT@4..10 "await" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@10..14 - 0: EQ@10..12 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@12..14 - 0: JS_NUMBER_LITERAL@12..14 "10" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@15..35 - 0: JS_CALL_EXPRESSION@15..34 - 0: JS_STATIC_MEMBER_EXPRESSION@15..27 - 0: JS_IDENTIFIER_EXPRESSION@15..23 - 0: JS_REFERENCE_IDENTIFIER@15..23 - 0: IDENT@15..23 "console" [Newline("\n")] [] - 1: DOT@23..24 "." [] [] - 2: JS_NAME@24..27 - 0: IDENT@24..27 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@27..34 - 0: L_PAREN@27..28 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@28..33 - 0: JS_AWAIT_EXPRESSION@28..33 - 0: AWAIT_KW@28..33 "await" [] [] - 1: (empty) - 2: R_PAREN@33..34 ")" [] [] - 1: SEMICOLON@34..35 ";" [] [] - 4: EOF@35..36 "" [Newline("\n")] [] --- -await_in_module.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - > 1 │ let await = 10; - │ ^^^^^ - 2 │ console.log(await); - 3 │ - --- -await_in_module.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an unary expression but instead found ')'. - - 1 │ let await = 10; - > 2 │ console.log(await); - │ ^ - 3 │ - - i Expected an unary expression here. - - 1 │ let await = 10; - > 2 │ console.log(await); - │ ^ - 3 │ - --- -let await = 10; -console.log(await); diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.rast b/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.rast deleted file mode 100644 index b7e10f662f92..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.rast +++ /dev/null @@ -1,82 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..13 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - AWAIT_KW@18..24 "await" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@24..26 "10" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_FUNCTION_DECLARATION@0..29 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..13 - 0: IDENT@9..13 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@13..16 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..14 - 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@16..29 - 0: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..28 - 0: JS_EXPRESSION_STATEMENT@18..28 - 0: JS_BOGUS_EXPRESSION@18..26 - 0: AWAIT_KW@18..24 "await" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@24..26 - 0: JS_NUMBER_LITERAL@24..26 "10" [] [] - 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] - 3: R_CURLY@28..29 "}" [] [] - 4: EOF@29..30 "" [Newline("\n")] [] --- -await_in_non_async_function.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await` is only allowed within async functions and at the top levels of modules. - - > 1 │ function test() { await 10; } - │ ^^^^^ - 2 │ - --- -function test() { await 10; } diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast b/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast deleted file mode 100644 index 92d3efd25fab..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast +++ /dev/null @@ -1,216 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@15..19 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@19..20 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@20..22 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - AWAIT_KW@24..30 "await" [] [Whitespace(" ")], - JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..31 "b" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@31..32 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@32..33 ")" [] [], - }, - }, - ], - }, - }, - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@35..36 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@37..47 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@47..52 "test2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@52..53 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@53..55 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@55..57 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - AWAIT_KW@57..63 "await" [] [Whitespace(" ")], - JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@63..64 "b" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@64..65 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@65..66 ")" [] [], - }, - }, - ], - }, - }, - }, - ], - r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@68..69 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@69..70 "}" [] [], - }, - }, - ], - eof_token: EOF@70..71 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..71 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..70 - 0: JS_FUNCTION_DECLARATION@0..37 - 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@15..19 - 0: IDENT@15..19 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@19..35 - 0: L_PAREN@19..20 "(" [] [] - 1: JS_PARAMETER_LIST@20..33 - 0: JS_FORMAL_PARAMETER@20..33 - 0: JS_DECORATOR_LIST@20..20 - 1: JS_IDENTIFIER_BINDING@20..22 - 0: IDENT@20..22 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@22..33 - 0: EQ@22..24 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@24..33 - 0: AWAIT_KW@24..30 "await" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@30..33 - 0: JS_IDENTIFIER_EXPRESSION@30..31 - 0: JS_REFERENCE_IDENTIFIER@30..31 - 0: IDENT@30..31 "b" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@31..33 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@32..32 - 2: R_PAREN@32..33 ")" [] [] - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@35..37 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_DIRECTIVE_LIST@36..36 - 2: JS_STATEMENT_LIST@36..36 - 3: R_CURLY@36..37 "}" [] [] - 1: JS_FUNCTION_DECLARATION@37..70 - 0: (empty) - 1: FUNCTION_KW@37..47 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@47..52 - 0: IDENT@47..52 "test2" [] [] - 4: (empty) - 5: JS_PARAMETERS@52..68 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_PARAMETER_LIST@53..66 - 0: JS_FORMAL_PARAMETER@53..66 - 0: JS_DECORATOR_LIST@53..53 - 1: JS_IDENTIFIER_BINDING@53..55 - 0: IDENT@53..55 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@55..66 - 0: EQ@55..57 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@57..66 - 0: AWAIT_KW@57..63 "await" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@63..66 - 0: JS_IDENTIFIER_EXPRESSION@63..64 - 0: JS_REFERENCE_IDENTIFIER@63..64 - 0: IDENT@63..64 "b" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@64..66 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@65..65 - 2: R_PAREN@65..66 ")" [] [] - 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@68..70 - 0: L_CURLY@68..69 "{" [] [] - 1: JS_DIRECTIVE_LIST@69..69 - 2: JS_STATEMENT_LIST@69..69 - 3: R_CURLY@69..70 "}" [] [] - 4: EOF@70..71 "" [Newline("\n")] [] --- -await_in_parameter_initializer.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await` is only allowed within async functions and at the top levels of modules. - - > 1 │ async function test(a = await b()) {} - │ ^^^^^ - 2 │ function test2(a = await b()) {} - 3 │ - --- -await_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await` is only allowed within async functions and at the top levels of modules. - - 1 │ async function test(a = await b()) {} - > 2 │ function test2(a = await b()) {} - │ ^^^^^ - 3 │ - --- -async function test(a = await b()) {} -function test2(a = await b()) {} diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast b/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast deleted file mode 100644 index 3480e024cd27..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast +++ /dev/null @@ -1,153 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@16..18 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsStaticInitializationBlockClassMember { - static_token: STATIC_KW@20..27 "static" [] [Whitespace(" ")], - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@29..34 "await" [] [], - ], - }, - ], - }, - semicolon_token: SEMICOLON@34..36 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@46..48 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsStaticInitializationBlockClassMember { - static_token: STATIC_KW@50..57 "static" [] [Whitespace(" ")], - l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - AWAIT_KW@59..65 "await" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@65..67 "10" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@67..69 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@69..71 "}" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@71..72 "}" [] [], - }, - ], - eof_token: EOF@72..73 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..73 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..72 - 0: JS_CLASS_DECLARATION@0..39 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@16..18 - 0: IDENT@16..18 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@20..38 - 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@20..38 - 0: STATIC_KW@20..27 "static" [] [Whitespace(" ")] - 1: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 2: JS_STATEMENT_LIST@29..36 - 0: JS_EXPRESSION_STATEMENT@29..36 - 0: JS_BOGUS_EXPRESSION@29..34 - 0: JS_BOGUS@29..34 - 0: IDENT@29..34 "await" [] [] - 1: SEMICOLON@34..36 ";" [] [Whitespace(" ")] - 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] - 9: R_CURLY@38..39 "}" [] [] - 1: JS_CLASS_DECLARATION@39..72 - 0: JS_DECORATOR_LIST@39..39 - 1: (empty) - 2: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@46..48 - 0: IDENT@46..48 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@48..50 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@50..71 - 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@50..71 - 0: STATIC_KW@50..57 "static" [] [Whitespace(" ")] - 1: L_CURLY@57..59 "{" [] [Whitespace(" ")] - 2: JS_STATEMENT_LIST@59..69 - 0: JS_EXPRESSION_STATEMENT@59..69 - 0: JS_BOGUS_EXPRESSION@59..67 - 0: AWAIT_KW@59..65 "await" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@65..67 - 0: JS_NUMBER_LITERAL@65..67 "10" [] [] - 1: SEMICOLON@67..69 ";" [] [Whitespace(" ")] - 3: R_CURLY@69..71 "}" [] [Whitespace(" ")] - 9: R_CURLY@71..72 "}" [] [] - 4: EOF@72..73 "" [Newline("\n")] [] --- -await_in_static_initialization_block_member.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - 1 │ // SCRIPT - > 2 │ class A { static { await; } } - │ ^^^^^ - 3 │ class B { static { await 10; } } - 4 │ - --- -await_in_static_initialization_block_member.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await` is only allowed within async functions and at the top levels of modules. - - 1 │ // SCRIPT - 2 │ class A { static { await; } } - > 3 │ class B { static { await 10; } } - │ ^^^^^ - 4 │ - --- -// SCRIPT -class A { static { await; } } -class B { static { await 10; } } diff --git a/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast b/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast deleted file mode 100644 index 0c568352f0da..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast +++ /dev/null @@ -1,313 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsVariableDeclaration { - await_token: AWAIT_KW@17..23 "await" [] [Whitespace(" ")], - kind: USING_KW@23..29 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@29..31 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@31..33 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..35 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - }, - ], - }, - ], - r_curly_token: R_CURLY@35..36 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@37..42 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@42..44 "=" [] [Whitespace(" ")], - right: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@44..52 "function" [] [], - star_token: missing (optional), - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@52..53 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsVariableDeclaration { - await_token: AWAIT_KW@57..63 "await" [] [Whitespace(" ")], - kind: USING_KW@63..69 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@69..71 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@71..73 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@73..75 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - }, - ], - }, - ], - r_curly_token: R_CURLY@75..76 "}" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@76..77 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@77..82 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@82..84 "=" [] [Whitespace(" ")], - right: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@84..85 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@85..87 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@87..90 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@90..92 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsVariableDeclaration { - await_token: AWAIT_KW@92..98 "await" [] [Whitespace(" ")], - kind: USING_KW@98..104 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@104..106 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@106..108 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@108..110 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - }, - ], - }, - ], - r_curly_token: R_CURLY@110..111 "}" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - ], - eof_token: EOF@112..113 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..113 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..112 - 0: JS_FUNCTION_DECLARATION@0..36 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..36 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..35 - 0: JS_BOGUS_STATEMENT@17..35 - 0: JS_VARIABLE_DECLARATION@17..35 - 0: AWAIT_KW@17..23 "await" [] [Whitespace(" ")] - 1: USING_KW@23..29 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@29..35 - 0: JS_VARIABLE_DECLARATOR@29..35 - 0: JS_IDENTIFIER_BINDING@29..31 - 0: IDENT@29..31 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@31..35 - 0: EQ@31..33 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@33..35 - 0: JS_REFERENCE_IDENTIFIER@33..35 - 0: IDENT@33..35 "y" [] [Whitespace(" ")] - 3: R_CURLY@35..36 "}" [] [] - 1: JS_EMPTY_STATEMENT@36..37 - 0: SEMICOLON@36..37 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@37..77 - 0: JS_ASSIGNMENT_EXPRESSION@37..76 - 0: JS_IDENTIFIER_ASSIGNMENT@37..42 - 0: IDENT@37..42 "foo" [Newline("\n")] [Whitespace(" ")] - 1: EQ@42..44 "=" [] [Whitespace(" ")] - 2: JS_FUNCTION_EXPRESSION@44..76 - 0: (empty) - 1: FUNCTION_KW@44..52 "function" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@52..55 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_PARAMETER_LIST@53..53 - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@55..76 - 0: L_CURLY@55..57 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..75 - 0: JS_BOGUS_STATEMENT@57..75 - 0: JS_VARIABLE_DECLARATION@57..75 - 0: AWAIT_KW@57..63 "await" [] [Whitespace(" ")] - 1: USING_KW@63..69 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@69..75 - 0: JS_VARIABLE_DECLARATOR@69..75 - 0: JS_IDENTIFIER_BINDING@69..71 - 0: IDENT@69..71 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@71..75 - 0: EQ@71..73 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@73..75 - 0: JS_REFERENCE_IDENTIFIER@73..75 - 0: IDENT@73..75 "y" [] [Whitespace(" ")] - 3: R_CURLY@75..76 "}" [] [] - 1: SEMICOLON@76..77 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@77..112 - 0: JS_ASSIGNMENT_EXPRESSION@77..111 - 0: JS_IDENTIFIER_ASSIGNMENT@77..82 - 0: IDENT@77..82 "foo" [Newline("\n")] [Whitespace(" ")] - 1: EQ@82..84 "=" [] [Whitespace(" ")] - 2: JS_ARROW_FUNCTION_EXPRESSION@84..111 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@84..87 - 0: L_PAREN@84..85 "(" [] [] - 1: JS_PARAMETER_LIST@85..85 - 2: R_PAREN@85..87 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@87..90 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@90..111 - 0: L_CURLY@90..92 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@92..92 - 2: JS_STATEMENT_LIST@92..110 - 0: JS_BOGUS_STATEMENT@92..110 - 0: JS_VARIABLE_DECLARATION@92..110 - 0: AWAIT_KW@92..98 "await" [] [Whitespace(" ")] - 1: USING_KW@98..104 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@104..110 - 0: JS_VARIABLE_DECLARATOR@104..110 - 0: JS_IDENTIFIER_BINDING@104..106 - 0: IDENT@104..106 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@106..110 - 0: EQ@106..108 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@108..110 - 0: JS_REFERENCE_IDENTIFIER@108..110 - 0: IDENT@108..110 "y" [] [Whitespace(" ")] - 3: R_CURLY@110..111 "}" [] [] - 1: SEMICOLON@111..112 ";" [] [] - 4: EOF@112..113 "" [Newline("\n")] [] --- -await_using_declaration_only_allowed_inside_an_async_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await using` declarations are only allowed at top-level or inside an async function - - > 1 │ function foo() { await using x = y }; - │ ^^^^^^^^^^^^^^^^^ - 2 │ foo = function() { await using x = y }; - 3 │ foo = () => { await using x = y }; - - i Wrap this declaration in an async function - --- -await_using_declaration_only_allowed_inside_an_async_function.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await using` declarations are only allowed at top-level or inside an async function - - 1 │ function foo() { await using x = y }; - > 2 │ foo = function() { await using x = y }; - │ ^^^^^^^^^^^^^^^^^ - 3 │ foo = () => { await using x = y }; - 4 │ - - i Wrap this declaration in an async function - --- -await_using_declaration_only_allowed_inside_an_async_function.js:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await using` declarations are only allowed at top-level or inside an async function - - 1 │ function foo() { await using x = y }; - 2 │ foo = function() { await using x = y }; - > 3 │ foo = () => { await using x = y }; - │ ^^^^^^^^^^^^^^^^^ - 4 │ - - i Wrap this declaration in an async function - --- -function foo() { await using x = y }; -foo = function() { await using x = y }; -foo = () => { await using x = y }; diff --git a/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.rast b/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.rast deleted file mode 100644 index 0ce8a30d5c8a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.rast +++ /dev/null @@ -1,155 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@3..4 "(" [] [], - args: JsCallArgumentList [ - JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..8 "foo" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@8..9 "+" [] [], - right: missing (required), - }, - ], - r_paren_token: R_PAREN@9..10 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..16 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: PLUS@16..18 "+" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: missing (required), - operator_token: STAR@18..20 "*" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@20..21 "2" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsUnaryExpression { - operator_token: BANG@22..24 "!" [Newline("\n")] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..28 "foo" [] [Whitespace(" ")], - }, - }, - }, - operator_token: STAR@28..30 "*" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..33 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_EXPRESSION_STATEMENT@0..11 - 0: JS_CALL_EXPRESSION@0..10 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@3..10 - 0: L_PAREN@3..4 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@4..9 - 0: JS_BINARY_EXPRESSION@4..9 - 0: JS_IDENTIFIER_EXPRESSION@4..8 - 0: JS_REFERENCE_IDENTIFIER@4..8 - 0: IDENT@4..8 "foo" [] [Whitespace(" ")] - 1: PLUS@8..9 "+" [] [] - 2: (empty) - 2: R_PAREN@9..10 ")" [] [] - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@11..22 - 0: JS_BINARY_EXPRESSION@11..21 - 0: JS_IDENTIFIER_EXPRESSION@11..16 - 0: JS_REFERENCE_IDENTIFIER@11..16 - 0: IDENT@11..16 "foo" [Newline("\n")] [Whitespace(" ")] - 1: PLUS@16..18 "+" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@18..21 - 0: (empty) - 1: STAR@18..20 "*" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@20..21 - 0: JS_NUMBER_LITERAL@20..21 "2" [] [] - 1: SEMICOLON@21..22 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@22..34 - 0: JS_BINARY_EXPRESSION@22..33 - 0: JS_UNARY_EXPRESSION@22..28 - 0: BANG@22..24 "!" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@24..28 - 0: JS_REFERENCE_IDENTIFIER@24..28 - 0: IDENT@24..28 "foo" [] [Whitespace(" ")] - 1: STAR@28..30 "*" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@30..33 - 0: JS_REFERENCE_IDENTIFIER@30..33 - 0: IDENT@30..33 "bar" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] --- -binary_expressions_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ')'. - - > 1 │ foo(foo +); - │ ^ - 2 │ foo + * 2; - 3 │ !foo * bar; - - i Expected an expression here. - - > 1 │ foo(foo +); - │ ^ - 2 │ foo + * 2; - 3 │ !foo * bar; - --- -binary_expressions_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression for the left hand side of the `*` operator. - - 1 │ foo(foo +); - > 2 │ foo + * 2; - │ ^ - 3 │ !foo * bar; - 4 │ - - i This operator requires a left hand side value - --- -foo(foo +); -foo + * 2; -!foo * bar; diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.rast b/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.rast deleted file mode 100644 index 3c11ac1244da..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.rast +++ /dev/null @@ -1,413 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@6..7 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@7..9 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@9..12 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@12..14 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@14..18 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@18..24 "await" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@26..27 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@27..29 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@30..40 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@40..41 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@41..44 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@47..48 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@48..56 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@56..62 "yield" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@62..64 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@64..65 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@65..66 ";" [] [], - }, - ], - r_curly_token: R_CURLY@66..68 "}" [Newline("\n")] [], - }, - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@68..73 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@73..78 "eval" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@78..80 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@80..81 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@81..82 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@82..87 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@87..91 "let" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@91..93 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@93..94 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@94..95 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@95..102 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@102..106 "let" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@106..108 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@108..109 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@109..110 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@110..115 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@115..116 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@116..118 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@118..119 "a" [] [], - ], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@119..120 ";" [] [], - }, - ], - eof_token: EOF@120..121 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..121 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..120 - 0: JS_EXPRESSION_STATEMENT@0..30 - 0: JS_ARROW_FUNCTION_EXPRESSION@0..30 - 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@6..9 - 0: L_PAREN@6..7 "(" [] [] - 1: JS_PARAMETER_LIST@7..7 - 2: R_PAREN@7..9 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@9..12 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@12..30 - 0: L_CURLY@12..14 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..29 - 0: JS_VARIABLE_STATEMENT@14..29 - 0: JS_VARIABLE_DECLARATION@14..27 - 0: (empty) - 1: LET_KW@14..18 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@18..27 - 0: JS_VARIABLE_DECLARATOR@18..27 - 0: JS_BOGUS_BINDING@18..24 - 0: IDENT@18..24 "await" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@24..27 - 0: EQ@24..26 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@26..27 - 0: JS_NUMBER_LITERAL@26..27 "5" [] [] - 1: SEMICOLON@27..29 ";" [] [Whitespace(" ")] - 3: R_CURLY@29..30 "}" [] [] - 1: (empty) - 1: JS_FUNCTION_DECLARATION@30..68 - 0: (empty) - 1: FUNCTION_KW@30..40 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@40..41 "*" [] [] - 3: JS_IDENTIFIER_BINDING@41..44 - 0: IDENT@41..44 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..45 - 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@47..68 - 0: L_CURLY@47..48 "{" [] [] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..66 - 0: JS_VARIABLE_STATEMENT@48..66 - 0: JS_VARIABLE_DECLARATION@48..65 - 0: (empty) - 1: LET_KW@48..56 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@56..65 - 0: JS_VARIABLE_DECLARATOR@56..65 - 0: JS_BOGUS_BINDING@56..62 - 0: IDENT@56..62 "yield" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@62..65 - 0: EQ@62..64 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@64..65 - 0: JS_NUMBER_LITERAL@64..65 "5" [] [] - 1: SEMICOLON@65..66 ";" [] [] - 3: R_CURLY@66..68 "}" [Newline("\n")] [] - 2: JS_VARIABLE_STATEMENT@68..82 - 0: JS_VARIABLE_DECLARATION@68..81 - 0: (empty) - 1: LET_KW@68..73 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@73..81 - 0: JS_VARIABLE_DECLARATOR@73..81 - 0: JS_BOGUS_BINDING@73..78 - 0: IDENT@73..78 "eval" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@78..81 - 0: EQ@78..80 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@80..81 - 0: JS_NUMBER_LITERAL@80..81 "5" [] [] - 1: SEMICOLON@81..82 ";" [] [] - 3: JS_VARIABLE_STATEMENT@82..95 - 0: JS_VARIABLE_DECLARATION@82..94 - 0: (empty) - 1: LET_KW@82..87 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@87..94 - 0: JS_VARIABLE_DECLARATOR@87..94 - 0: JS_BOGUS_BINDING@87..91 - 0: IDENT@87..91 "let" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@91..94 - 0: EQ@91..93 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@93..94 - 0: JS_NUMBER_LITERAL@93..94 "5" [] [] - 1: SEMICOLON@94..95 ";" [] [] - 4: JS_VARIABLE_STATEMENT@95..110 - 0: JS_VARIABLE_DECLARATION@95..109 - 0: (empty) - 1: CONST_KW@95..102 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@102..109 - 0: JS_VARIABLE_DECLARATOR@102..109 - 0: JS_BOGUS_BINDING@102..106 - 0: IDENT@102..106 "let" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@106..109 - 0: EQ@106..108 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@108..109 - 0: JS_NUMBER_LITERAL@108..109 "5" [] [] - 1: SEMICOLON@109..110 ";" [] [] - 5: JS_VARIABLE_STATEMENT@110..120 - 0: JS_VARIABLE_DECLARATION@110..119 - 0: (empty) - 1: LET_KW@110..115 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@115..119 - 0: JS_VARIABLE_DECLARATOR@115..116 - 0: JS_IDENTIFIER_BINDING@115..116 - 0: IDENT@115..116 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@116..118 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@118..119 - 0: JS_BOGUS_BINDING@118..119 - 0: IDENT@118..119 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@119..120 ";" [] [] - 4: EOF@120..121 "" [Newline("\n")] [] --- -binding_identifier_invalid.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - > 1 │ async () => { let await = 5; } - │ ^^^^^ - 2 │ function *foo() { - 3 │ let yield = 5; - --- -binding_identifier_invalid.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `yield` as an identifier in generator function - - 1 │ async () => { let await = 5; } - 2 │ function *foo() { - > 3 │ let yield = 5; - │ ^^^^^ - 4 │ } - 5 │ let eval = 5; - --- -binding_identifier_invalid.js:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - 3 │ let yield = 5; - 4 │ } - > 5 │ let eval = 5; - │ ^^^^ - 6 │ let let = 5; - 7 │ const let = 5; - --- -binding_identifier_invalid.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `let` as an identifier in strict mode - - 4 │ } - 5 │ let eval = 5; - > 6 │ let let = 5; - │ ^^^ - 7 │ const let = 5; - 8 │ let a, a; - --- -binding_identifier_invalid.js:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `let` as an identifier in strict mode - - 5 │ let eval = 5; - 6 │ let let = 5; - > 7 │ const let = 5; - │ ^^^ - 8 │ let a, a; - 9 │ - --- -binding_identifier_invalid.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Declarations inside of a `let` declaration may not have duplicates - - 6 │ let let = 5; - 7 │ const let = 5; - > 8 │ let a, a; - │ ^ - 9 │ - - i a second declaration of `a` is not allowed - - 6 │ let let = 5; - 7 │ const let = 5; - > 8 │ let a, a; - │ ^ - 9 │ - - i `a` is first declared here - - 6 │ let let = 5; - 7 │ const let = 5; - > 8 │ let a, a; - │ ^ - 9 │ - --- -async () => { let await = 5; } -function *foo() { - let yield = 5; -} -let eval = 5; -let let = 5; -const let = 5; -let a, a; diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast b/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast deleted file mode 100644 index c275ed466148..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast +++ /dev/null @@ -1,119 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@14..18 "let" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@18..20 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@20..21 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@29..33 "let" [] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@33..35 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@35..36 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - ], - eof_token: EOF@37..38 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..38 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..37 - 0: JS_VARIABLE_STATEMENT@0..22 - 0: JS_VARIABLE_DECLARATION@0..21 - 0: (empty) - 1: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..21 - 0: JS_VARIABLE_DECLARATOR@14..21 - 0: JS_BOGUS_BINDING@14..18 - 0: IDENT@14..18 "let" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@18..21 - 0: EQ@18..20 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@20..21 - 0: JS_NUMBER_LITERAL@20..21 "5" [] [] - 1: SEMICOLON@21..22 ";" [] [] - 1: JS_VARIABLE_STATEMENT@22..37 - 0: JS_VARIABLE_DECLARATION@22..36 - 0: (empty) - 1: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@29..36 - 0: JS_VARIABLE_DECLARATOR@29..36 - 0: JS_BOGUS_BINDING@29..33 - 0: IDENT@29..33 "let" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@33..36 - 0: EQ@33..35 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@35..36 - 0: JS_NUMBER_LITERAL@35..36 "5" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 4: EOF@37..38 "" [Newline("\n")] [] --- -binding_identifier_invalid_script.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `let` cannot be declared as a variable name inside of a `let` declaration - - 1 │ // SCRIPT - > 2 │ let let = 5; - │ ^^^ - 3 │ const let = 5; - 4 │ - - i Rename the let identifier here - --- -binding_identifier_invalid_script.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `let` cannot be declared as a variable name inside of a `const` declaration - - 1 │ // SCRIPT - 2 │ let let = 5; - > 3 │ const let = 5; - │ ^^^ - 4 │ - - i Rename the let identifier here - --- -// SCRIPT -let let = 5; -const let = 5; diff --git a/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.rast b/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.rast deleted file mode 100644 index 62bdeed83327..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.rast +++ /dev/null @@ -1,88 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..7 "S" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@7..8 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - L_CURLY@8..9 "{" [] [], - ], - }, - ], - r_curly_token: R_CURLY@9..10 "}" [] [], - }, - JsBogusStatement { - items: [ - R_CURLY@10..11 "}" [] [], - ], - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_CLASS_DECLARATION@0..10 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..7 - 0: IDENT@6..7 "S" [] [] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@7..8 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@8..9 - 0: JS_BOGUS_MEMBER@8..9 - 0: L_CURLY@8..9 "{" [] [] - 9: R_CURLY@9..10 "}" [] [] - 1: JS_BOGUS_STATEMENT@10..11 - 0: R_CURLY@10..11 "}" [] [] - 4: EOF@11..12 "" [Newline("\n")] [] --- -block_stmt_in_class.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. - - > 1 │ class S{{}} - │ ^ - 2 │ - - i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. - - > 1 │ class S{{}} - │ ^ - 2 │ - --- -block_stmt_in_class.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - > 1 │ class S{{}} - │ ^ - 2 │ - - i Expected a statement here. - - > 1 │ class S{{}} - │ ^ - 2 │ - --- -class S{{}} diff --git a/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.rast b/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.rast deleted file mode 100644 index 5579ddad82d0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.rast +++ /dev/null @@ -1,144 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@3..4 "[" [] [], - member: missing (required), - r_brack_token: R_BRACK@4..5 "]" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@5..9 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: QUESTIONDOT@9..11 "?." [] [], - l_brack_token: L_BRACK@11..12 "[" [] [], - member: missing (required), - r_brack_token: R_BRACK@12..13 "]" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..17 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@17..18 "[" [] [], - member: missing (required), - r_brack_token: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@18..19 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..19 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..18 - 0: JS_EXPRESSION_STATEMENT@0..5 - 0: JS_COMPUTED_MEMBER_EXPRESSION@0..5 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: (empty) - 2: L_BRACK@3..4 "[" [] [] - 3: (empty) - 4: R_BRACK@4..5 "]" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@5..13 - 0: JS_COMPUTED_MEMBER_EXPRESSION@5..13 - 0: JS_IDENTIFIER_EXPRESSION@5..9 - 0: JS_REFERENCE_IDENTIFIER@5..9 - 0: IDENT@5..9 "foo" [Newline("\n")] [] - 1: QUESTIONDOT@9..11 "?." [] [] - 2: L_BRACK@11..12 "[" [] [] - 3: (empty) - 4: R_BRACK@12..13 "]" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@13..18 - 0: JS_COMPUTED_MEMBER_EXPRESSION@13..18 - 0: JS_IDENTIFIER_EXPRESSION@13..17 - 0: JS_REFERENCE_IDENTIFIER@13..17 - 0: IDENT@13..17 "foo" [Newline("\n")] [] - 1: (empty) - 2: L_BRACK@17..18 "[" [] [] - 3: (empty) - 4: (empty) - 1: (empty) - 4: EOF@18..19 "" [Newline("\n")] [] --- -bracket_expr_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ']'. - - > 1 │ foo[] - │ ^ - 2 │ foo?.[] - 3 │ foo[ - - i Expected an expression here. - - > 1 │ foo[] - │ ^ - 2 │ foo?.[] - 3 │ foo[ - --- -bracket_expr_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ']'. - - 1 │ foo[] - > 2 │ foo?.[] - │ ^ - 3 │ foo[ - 4 │ - - i Expected an expression here. - - 1 │ foo[] - > 2 │ foo?.[] - │ ^ - 3 │ foo[ - 4 │ - --- -bracket_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found the end of the file. - - 2 │ foo?.[] - 3 │ foo[ - > 4 │ - │ - - i Expected an expression here. - - 2 │ foo?.[] - 3 │ foo[ - > 4 │ - │ - --- -foo[] -foo?.[] -foo[ diff --git a/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.rast b/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.rast deleted file mode 100644 index e37439dd1d21..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.rast +++ /dev/null @@ -1,105 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsWhileStatement { - while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@6..7 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@7..11 "true" [] [], - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@13..14 "{" [] [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@14..26 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@26..32 "helper" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@32..33 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@35..36 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - BREAK_KW@36..46 "break" [Newline("\n"), Whitespace(" ")] [], - SEMICOLON@46..47 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@47..51 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@53..54 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..54 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..53 - 0: JS_WHILE_STATEMENT@0..53 - 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] - 1: L_PAREN@6..7 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11 - 0: TRUE_KW@7..11 "true" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@13..53 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_STATEMENT_LIST@14..51 - 0: JS_FUNCTION_DECLARATION@14..51 - 0: (empty) - 1: FUNCTION_KW@14..26 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@26..32 - 0: IDENT@26..32 "helper" [] [] - 4: (empty) - 5: JS_PARAMETERS@32..35 - 0: L_PAREN@32..33 "(" [] [] - 1: JS_PARAMETER_LIST@33..33 - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@35..51 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_DIRECTIVE_LIST@36..36 - 2: JS_STATEMENT_LIST@36..47 - 0: JS_BOGUS_STATEMENT@36..47 - 0: BREAK_KW@36..46 "break" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@46..47 ";" [] [] - 3: R_CURLY@47..51 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@51..53 "}" [Newline("\n")] [] - 4: EOF@53..54 "" [Newline("\n")] [] --- -break_in_nested_function.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `break` statement can only be used within an enclosing iteration or switch statement. - - 1 │ while (true) { - 2 │ function helper() { - > 3 │ break; - │ ^^^^^ - 4 │ } - 5 │ } - --- -while (true) { - function helper() { - break; - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/break_stmt.rast b/crates/biome_js_parser/test_data/inline/err/break_stmt.rast deleted file mode 100644 index 08f16c136c00..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/break_stmt.rast +++ /dev/null @@ -1,130 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - BREAK_KW@17..22 "break" [] [], - SEMICOLON@22..24 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@25..32 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@32..33 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@33..37 "true" [] [], - }, - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@39..40 "{" [] [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - BREAK_KW@40..49 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLabel { - value_token: IDENT@49..52 "foo" [] [], - }, - SEMICOLON@52..53 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@55..56 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..56 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..55 - 0: JS_FUNCTION_DECLARATION@0..25 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..25 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..24 - 0: JS_BOGUS_STATEMENT@17..24 - 0: BREAK_KW@17..22 "break" [] [] - 1: SEMICOLON@22..24 ";" [] [Whitespace(" ")] - 3: R_CURLY@24..25 "}" [] [] - 1: JS_WHILE_STATEMENT@25..55 - 0: WHILE_KW@25..32 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@32..33 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@33..37 - 0: TRUE_KW@33..37 "true" [] [] - 3: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@39..55 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_STATEMENT_LIST@40..53 - 0: JS_BOGUS_STATEMENT@40..53 - 0: BREAK_KW@40..49 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LABEL@49..52 - 0: IDENT@49..52 "foo" [] [] - 2: SEMICOLON@52..53 ";" [] [] - 2: R_CURLY@53..55 "}" [Newline("\n")] [] - 4: EOF@55..56 "" [Newline("\n")] [] --- -break_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `break` statement can only be used within an enclosing iteration or switch statement. - - > 1 │ function foo() { break; } - │ ^^^^^ - 2 │ while (true) { - 3 │ break foo; - --- -break_stmt.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Use of undefined statement label `foo` - - 1 │ function foo() { break; } - 2 │ while (true) { - > 3 │ break foo; - │ ^^^ - 4 │ } - 5 │ - - i This label is used, but it is never defined - --- -function foo() { break; } -while (true) { - break foo; -} diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.rast b/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.rast deleted file mode 100644 index 16f43765d6d4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..21 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - parameters: JsConstructorParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@22..32 "protected" [] [Whitespace(" ")], - }, - ], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@32..33 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@35..36 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_CLASS_DECLARATION@0..39 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..38 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..38 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..21 - 0: IDENT@10..21 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@21..35 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..33 - 0: JS_BOGUS_PARAMETER@22..33 - 0: JS_DECORATOR_LIST@22..22 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..32 - 0: TS_ACCESSIBILITY_MODIFIER@22..32 - 0: PROTECTED_KW@22..32 "protected" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@32..33 - 0: JS_DECORATOR_LIST@32..32 - 1: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@35..38 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_DIRECTIVE_LIST@36..36 - 2: JS_STATEMENT_LIST@36..36 - 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] - 9: R_CURLY@38..39 "}" [] [] - 4: EOF@39..40 "" [Newline("\n")] [] --- -class_constructor_parameter.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'protected' modifier can only be used in TypeScript files - - > 1 │ class B { constructor(protected b) {} } - │ ^^^^^^^^^ - 2 │ - --- -class B { constructor(protected b) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast b/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast deleted file mode 100644 index 201f098e3031..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..21 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - parameters: JsConstructorParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@22..31 "readonly" [] [Whitespace(" ")], - }, - ], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@31..32 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - ], - r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@34..35 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@35..37 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - ], - eof_token: EOF@38..39 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..39 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..38 - 0: JS_CLASS_DECLARATION@0..38 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..37 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..37 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..21 - 0: IDENT@10..21 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@21..34 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..32 - 0: JS_BOGUS_PARAMETER@22..32 - 0: JS_DECORATOR_LIST@22..22 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..31 - 0: TS_READONLY_MODIFIER@22..31 - 0: READONLY_KW@22..31 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@31..32 - 0: JS_DECORATOR_LIST@31..31 - 1: JS_IDENTIFIER_BINDING@31..32 - 0: IDENT@31..32 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@32..34 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@34..37 - 0: L_CURLY@34..35 "{" [] [] - 1: JS_DIRECTIVE_LIST@35..35 - 2: JS_STATEMENT_LIST@35..35 - 3: R_CURLY@35..37 "}" [] [Whitespace(" ")] - 9: R_CURLY@37..38 "}" [] [] - 4: EOF@38..39 "" [Newline("\n")] [] --- -class_constructor_parameter_readonly.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'readonly' modifier can only be used in TypeScript files - - > 1 │ class B { constructor(readonly b) {} } - │ ^^^^^^^^ - 2 │ - --- -class B { constructor(readonly b) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_err.rast b/crates/biome_js_parser/test_data/inline/err/class_decl_err.rast deleted file mode 100644 index 58df185afcee..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_decl_err.rast +++ /dev/null @@ -1,263 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@6..7 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@7..8 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@15..23 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..27 "bar" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@27..28 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@29..36 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@36..40 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@40..42 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@42..46 "set" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsBogusMember { - items: [ - L_CURLY@46..47 "{" [] [], - ], - }, - ], - r_curly_token: R_CURLY@47..49 "}" [] [Whitespace(" ")], - }, - JsBogusStatement { - items: [ - R_CURLY@49..50 "}" [] [], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@50..57 "class" [Newline("\n")] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@57..65 "extends" [] [Whitespace(" ")], - super_class: missing (required), - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@65..66 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@66..67 "}" [] [], - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: JS_CLASS_DECLARATION@0..8 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@6..7 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@7..7 - 9: R_CURLY@7..8 "}" [] [] - 1: JS_CLASS_DECLARATION@8..29 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: JS_EXTENDS_CLAUSE@15..27 - 0: EXTENDS_KW@15..23 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@23..27 - 0: JS_REFERENCE_IDENTIFIER@23..27 - 0: IDENT@23..27 "bar" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@27..28 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@28..28 - 9: R_CURLY@28..29 "}" [] [] - 2: JS_CLASS_DECLARATION@29..49 - 0: JS_DECORATOR_LIST@29..29 - 1: (empty) - 2: CLASS_KW@29..36 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@36..40 - 0: IDENT@36..40 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@40..42 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@42..47 - 0: JS_PROPERTY_CLASS_MEMBER@42..46 - 0: JS_PROPERTY_MODIFIER_LIST@42..42 - 1: JS_LITERAL_MEMBER_NAME@42..46 - 0: IDENT@42..46 "set" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 1: JS_BOGUS_MEMBER@46..47 - 0: L_CURLY@46..47 "{" [] [] - 9: R_CURLY@47..49 "}" [] [Whitespace(" ")] - 3: JS_BOGUS_STATEMENT@49..50 - 0: R_CURLY@49..50 "}" [] [] - 4: JS_CLASS_DECLARATION@50..67 - 0: JS_DECORATOR_LIST@50..50 - 1: (empty) - 2: CLASS_KW@50..57 "class" [Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: JS_EXTENDS_CLAUSE@57..65 - 0: EXTENDS_KW@57..65 "extends" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 6: (empty) - 7: L_CURLY@65..66 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@66..66 - 9: R_CURLY@66..67 "}" [] [] - 4: EOF@67..68 "" [Newline("\n")] [] --- -class_decl_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - > 1 │ class {} - │ ^^^^^^ - 2 │ class extends bar {} - 3 │ class foo { set {} } - --- -class_decl_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - 1 │ class {} - > 2 │ class extends bar {} - │ ^^^^^^ - 3 │ class foo { set {} } - 4 │ class extends {} - --- -class_decl_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the class property, but found none - - 1 │ class {} - 2 │ class extends bar {} - > 3 │ class foo { set {} } - │ ^^^ - 4 │ class extends {} - 5 │ - --- -class_decl_err.js:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. - - 1 │ class {} - 2 │ class extends bar {} - > 3 │ class foo { set {} } - │ ^ - 4 │ class extends {} - 5 │ - - i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. - - 1 │ class {} - 2 │ class extends bar {} - > 3 │ class foo { set {} } - │ ^ - 4 │ class extends {} - 5 │ - --- -class_decl_err.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - 1 │ class {} - 2 │ class extends bar {} - > 3 │ class foo { set {} } - │ ^ - 4 │ class extends {} - 5 │ - - i Expected a statement here. - - 1 │ class {} - 2 │ class extends bar {} - > 3 │ class foo { set {} } - │ ^ - 4 │ class extends {} - 5 │ - --- -class_decl_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - 2 │ class extends bar {} - 3 │ class foo { set {} } - > 4 │ class extends {} - │ ^^^^^^ - 5 │ - --- -class_decl_err.js:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'extends' list cannot be empty. - - 2 │ class extends bar {} - 3 │ class foo { set {} } - > 4 │ class extends {} - │ - 5 │ - --- -class {} -class extends bar {} -class foo { set {} } -class extends {} diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.rast b/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.rast deleted file mode 100644 index 0f4d233a307a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@6..7 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@7..8 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: TsImplementsClause { - implements_token: IMPLEMENTS_KW@15..26 "implements" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@26..28 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - l_curly_token: L_CURLY@28..29 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_CLASS_DECLARATION@0..8 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@6..7 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@7..7 - 9: R_CURLY@7..8 "}" [] [] - 1: JS_CLASS_DECLARATION@8..30 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: TS_IMPLEMENTS_CLAUSE@15..28 - 0: IMPLEMENTS_KW@15..26 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@26..28 - 0: TS_REFERENCE_TYPE@26..28 - 0: JS_REFERENCE_IDENTIFIER@26..28 - 0: IDENT@26..28 "B" [] [Whitespace(" ")] - 1: (empty) - 7: L_CURLY@28..29 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@29..29 - 9: R_CURLY@29..30 "}" [] [] - 4: EOF@30..31 "" [Newline("\n")] [] --- -class_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - > 1 │ class {} - │ ^^^^^^ - 2 │ class implements B {} - 3 │ - --- -class_decl_no_id.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - 1 │ class {} - > 2 │ class implements B {} - │ ^^^^^^ - 3 │ - --- -class {} -class implements B {} diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_member.rast b/crates/biome_js_parser/test_data/inline/err/class_declare_member.rast deleted file mode 100644 index 1a22e41b1124..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_declare_member.rast +++ /dev/null @@ -1,71 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@18..22 "foo" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_CLASS_DECLARATION@0..23 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..22 - 0: JS_BOGUS_MEMBER@10..22 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@10..18 - 0: TS_DECLARE_MODIFIER@10..18 - 0: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@18..22 - 0: IDENT@18..22 "foo" [] [Whitespace(" ")] - 9: R_CURLY@22..23 "}" [] [] - 4: EOF@23..24 "" [Newline("\n")] [] --- -class_declare_member.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier can only be used in TypeScript files - - > 1 │ class B { declare foo } - │ ^^^^^^^ - 2 │ - --- -class B { declare foo } diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_method.rast b/crates/biome_js_parser/test_data/inline/err/class_declare_method.rast deleted file mode 100644 index 63616c18b8d2..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_declare_method.rast +++ /dev/null @@ -1,93 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@18..20 "fn" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@23..24 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: JS_CLASS_DECLARATION@0..27 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..26 - 0: JS_BOGUS_MEMBER@10..26 - 0: JS_BOGUS@10..18 - 0: TS_DECLARE_MODIFIER@10..18 - 0: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@18..20 - 0: IDENT@18..20 "fn" [] [] - 2: JS_PARAMETERS@20..23 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..21 - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@23..26 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_DIRECTIVE_LIST@24..24 - 2: JS_STATEMENT_LIST@24..24 - 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] - 9: R_CURLY@26..27 "}" [] [] - 4: EOF@27..28 "" [Newline("\n")] [] --- -class_declare_method.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier can only be used in TypeScript files - - > 1 │ class B { declare fn() {} } - │ ^^^^^^^ - 2 │ - --- -class B { declare fn() {} } diff --git a/crates/biome_js_parser/test_data/inline/err/class_extends_err.rast b/crates/biome_js_parser/test_data/inline/err/class_extends_err.rast deleted file mode 100644 index d5c5bc7b1eaa..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_extends_err.rast +++ /dev/null @@ -1,198 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@0..6 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - JsExtendsClause { - extends_token: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..20 "bar" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - JsExtendsClause { - extends_token: EXTENDS_KW@20..28 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..32 "foo" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - L_CURLY@32..33 "{" [] [], - JsClassMemberList [], - R_CURLY@33..34 "}" [] [], - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@41..43 "B" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - EXTENDS_KW@43..51 "extends" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@51..54 "bar" [] [], - }, - }, - COMMA@54..56 "," [] [Whitespace(" ")], - JsBogus { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..60 "foo" [] [Whitespace(" ")], - }, - }, - ], - }, - ], - }, - L_CURLY@60..61 "{" [] [], - JsClassMemberList [], - R_CURLY@61..62 "}" [] [], - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@69..71 "C" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - IMPLEMENTS_KW@71..82 "implements" [] [Whitespace(" ")], - TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@82..84 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - ], - }, - L_CURLY@84..85 "{" [] [], - JsClassMemberList [], - R_CURLY@85..86 "}" [] [], - ], - }, - ], - eof_token: EOF@86..87 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..87 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..86 - 0: JS_BOGUS_STATEMENT@0..34 - 0: JS_DECORATOR_LIST@0..0 - 1: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 3: JS_EXTENDS_CLAUSE@8..20 - 0: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@16..20 - 0: JS_REFERENCE_IDENTIFIER@16..20 - 0: IDENT@16..20 "bar" [] [Whitespace(" ")] - 2: (empty) - 4: JS_EXTENDS_CLAUSE@20..32 - 0: EXTENDS_KW@20..28 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@28..32 - 0: JS_REFERENCE_IDENTIFIER@28..32 - 0: IDENT@28..32 "foo" [] [Whitespace(" ")] - 2: (empty) - 5: L_CURLY@32..33 "{" [] [] - 6: JS_CLASS_MEMBER_LIST@33..33 - 7: R_CURLY@33..34 "}" [] [] - 1: JS_BOGUS_STATEMENT@34..62 - 0: JS_DECORATOR_LIST@34..34 - 1: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@41..43 - 0: IDENT@41..43 "B" [] [Whitespace(" ")] - 3: JS_BOGUS@43..60 - 0: EXTENDS_KW@43..51 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@51..54 - 0: JS_REFERENCE_IDENTIFIER@51..54 - 0: IDENT@51..54 "bar" [] [] - 2: COMMA@54..56 "," [] [Whitespace(" ")] - 3: JS_BOGUS@56..60 - 0: JS_IDENTIFIER_EXPRESSION@56..60 - 0: JS_REFERENCE_IDENTIFIER@56..60 - 0: IDENT@56..60 "foo" [] [Whitespace(" ")] - 4: L_CURLY@60..61 "{" [] [] - 5: JS_CLASS_MEMBER_LIST@61..61 - 6: R_CURLY@61..62 "}" [] [] - 2: JS_BOGUS_STATEMENT@62..86 - 0: JS_DECORATOR_LIST@62..62 - 1: CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@69..71 - 0: IDENT@69..71 "C" [] [Whitespace(" ")] - 3: JS_BOGUS@71..84 - 0: IMPLEMENTS_KW@71..82 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@82..84 - 0: TS_REFERENCE_TYPE@82..84 - 0: JS_REFERENCE_IDENTIFIER@82..84 - 0: IDENT@82..84 "B" [] [Whitespace(" ")] - 1: (empty) - 4: L_CURLY@84..85 "{" [] [] - 5: JS_CLASS_MEMBER_LIST@85..85 - 6: R_CURLY@85..86 "}" [] [] - 4: EOF@86..87 "" [Newline("\n")] [] --- -class_extends_err.js:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'extends' clause already seen. - - > 1 │ class A extends bar extends foo {} - │ ^^^^^^^^^^^ - 2 │ class B extends bar, foo {} - 3 │ class C implements B {} - - i first 'extends' clause - - > 1 │ class A extends bar extends foo {} - │ ^^^^^^^^^^^ - 2 │ class B extends bar, foo {} - 3 │ class C implements B {} - --- -class_extends_err.js:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Classes can only extend a single class. - - 1 │ class A extends bar extends foo {} - > 2 │ class B extends bar, foo {} - │ ^^^ - 3 │ class C implements B {} - 4 │ - --- -class_extends_err.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × classes can only implement interfaces in TypeScript files - - 1 │ class A extends bar extends foo {} - 2 │ class B extends bar, foo {} - > 3 │ class C implements B {} - │ ^^^^^^^^^^^^ - 4 │ - --- -class A extends bar extends foo {} -class B extends bar, foo {} -class C implements B {} diff --git a/crates/biome_js_parser/test_data/inline/err/class_implements.rast b/crates/biome_js_parser/test_data/inline/err/class_implements.rast deleted file mode 100644 index 8ac9205ee7f1..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_implements.rast +++ /dev/null @@ -1,66 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@0..6 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - IMPLEMENTS_KW@8..19 "implements" [] [Whitespace(" ")], - TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@19..21 "C" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - ], - }, - L_CURLY@21..22 "{" [] [], - JsClassMemberList [], - R_CURLY@22..23 "}" [] [], - ], - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_BOGUS_STATEMENT@0..23 - 0: JS_DECORATOR_LIST@0..0 - 1: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 3: JS_BOGUS@8..21 - 0: IMPLEMENTS_KW@8..19 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@19..21 - 0: TS_REFERENCE_TYPE@19..21 - 0: JS_REFERENCE_IDENTIFIER@19..21 - 0: IDENT@19..21 "C" [] [Whitespace(" ")] - 1: (empty) - 4: L_CURLY@21..22 "{" [] [] - 5: JS_CLASS_MEMBER_LIST@22..22 - 6: R_CURLY@22..23 "}" [] [] - 4: EOF@23..24 "" [Newline("\n")] [] --- -class_implements.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × classes can only implement interfaces in TypeScript files - - > 1 │ class B implements C {} - │ ^^^^^^^^^^^^ - 2 │ - --- -class B implements C {} diff --git a/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.rast b/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.rast deleted file mode 100644 index 503a525cb577..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.rast +++ /dev/null @@ -1,64 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@10..16 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@16..18 "A" [] [Whitespace(" ")], - }, - L_CURLY@18..19 "{" [] [], - JsClassMemberList [], - R_CURLY@19..20 "}" [] [], - ], - }, - else_clause: missing (optional), - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_IF_STATEMENT@0..20 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@10..20 - 0: JS_DECORATOR_LIST@10..10 - 1: CLASS_KW@10..16 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@16..18 - 0: IDENT@16..18 "A" [] [Whitespace(" ")] - 3: L_CURLY@18..19 "{" [] [] - 4: JS_CLASS_MEMBER_LIST@19..19 - 5: R_CURLY@19..20 "}" [] [] - 5: (empty) - 4: EOF@20..21 "" [Newline("\n")] [] --- -class_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Classes can only be declared at top level or inside a block - - > 1 │ if (true) class A {} - │ ^^^^^^^^^^ - 2 │ - - i wrap the class in a block statement - --- -if (true) class A {} diff --git a/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.rast b/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.rast deleted file mode 100644 index d255749d14f0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.rast +++ /dev/null @@ -1,269 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@10..17 "public" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@17..20 "foo" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@23..24 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@34..36 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@36..38 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@38..45 "static" [] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@45..52 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@52..55 "foo" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@55..56 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@61..62 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@69..71 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@73..82 "accessor" [] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@82..85 "foo" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@85..86 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@88..89 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@89..91 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@91..92 "}" [] [], - }, - ], - eof_token: EOF@92..93 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..93 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..92 - 0: JS_CLASS_DECLARATION@0..27 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..26 - 0: JS_BOGUS_MEMBER@10..26 - 0: JS_METHOD_MODIFIER_LIST@10..17 - 0: TS_ACCESSIBILITY_MODIFIER@10..17 - 0: PUBLIC_KW@10..17 "public" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@17..20 - 0: IDENT@17..20 "foo" [] [] - 2: JS_PARAMETERS@20..23 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..21 - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@23..26 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_DIRECTIVE_LIST@24..24 - 2: JS_STATEMENT_LIST@24..24 - 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] - 9: R_CURLY@26..27 "}" [] [] - 1: JS_CLASS_DECLARATION@27..62 - 0: JS_DECORATOR_LIST@27..27 - 1: (empty) - 2: CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@36..38 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@38..61 - 0: JS_BOGUS_MEMBER@38..61 - 0: JS_METHOD_MODIFIER_LIST@38..52 - 0: JS_STATIC_MODIFIER@38..45 - 0: STATIC_KW@38..45 "static" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@45..52 - 0: STATIC_KW@45..52 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@52..55 - 0: IDENT@52..55 "foo" [] [] - 2: JS_PARAMETERS@55..58 - 0: L_PAREN@55..56 "(" [] [] - 1: JS_PARAMETER_LIST@56..56 - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@58..61 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] - 9: R_CURLY@61..62 "}" [] [] - 2: JS_CLASS_DECLARATION@62..92 - 0: JS_DECORATOR_LIST@62..62 - 1: (empty) - 2: CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@69..71 - 0: IDENT@69..71 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@71..73 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@73..91 - 0: JS_BOGUS_MEMBER@73..91 - 0: JS_BOGUS@73..82 - 0: JS_ACCESSOR_MODIFIER@73..82 - 0: ACCESSOR_KW@73..82 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@82..85 - 0: IDENT@82..85 "foo" [] [] - 2: JS_PARAMETERS@85..88 - 0: L_PAREN@85..86 "(" [] [] - 1: JS_PARAMETER_LIST@86..86 - 2: R_PAREN@86..88 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@88..91 - 0: L_CURLY@88..89 "{" [] [] - 1: JS_DIRECTIVE_LIST@89..89 - 2: JS_STATEMENT_LIST@89..89 - 3: R_CURLY@89..91 "}" [] [Whitespace(" ")] - 9: R_CURLY@91..92 "}" [] [] - 4: EOF@92..93 "" [Newline("\n")] [] --- -class_invalid_modifiers.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'public' modifier can only be used in TypeScript files - - > 1 │ class A { public foo() {} } - │ ^^^^^^ - 2 │ class B { static static foo() {} } - 3 │ class C { accessor foo() {} } - --- -class_invalid_modifiers.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' already seen - - 1 │ class A { public foo() {} } - > 2 │ class B { static static foo() {} } - │ ^^^^^^ - 3 │ class C { accessor foo() {} } - 4 │ - - i duplicate modifier - - 1 │ class A { public foo() {} } - > 2 │ class B { static static foo() {} } - │ ^^^^^^ - 3 │ class C { accessor foo() {} } - 4 │ - - i first seen here - - 1 │ class A { public foo() {} } - > 2 │ class B { static static foo() {} } - │ ^^^^^^ - 3 │ class C { accessor foo() {} } - 4 │ - --- -class_invalid_modifiers.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' modifier is only allowed on properties. - - 1 │ class A { public foo() {} } - 2 │ class B { static static foo() {} } - > 3 │ class C { accessor foo() {} } - │ ^^^^^^^^ - 4 │ - --- -class A { public foo() {} } -class B { static static foo() {} } -class C { accessor foo() {} } diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.rast b/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.rast deleted file mode 100644 index 62c4bd13cb1f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.rast +++ /dev/null @@ -1,160 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@10..13 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@14..16 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - missing separator, - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@16..17 "{" [] [], - properties: JsObjectBindingPatternPropertyList [], - r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - missing separator, - JsBogusParameter { - items: [ - R_CURLY@19..20 "}" [] [], - ], - }, - ], - r_paren_token: missing (required), - }, - return_type_annotation: missing (optional), - body: missing (required), - }, - ], - r_curly_token: missing (required), - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_CLASS_DECLARATION@0..20 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..20 - 0: JS_METHOD_CLASS_MEMBER@10..20 - 0: JS_METHOD_MODIFIER_LIST@10..10 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@10..13 - 0: IDENT@10..13 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@13..20 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..20 - 0: JS_FORMAL_PARAMETER@14..16 - 0: JS_DECORATOR_LIST@14..14 - 1: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 1: (empty) - 2: JS_FORMAL_PARAMETER@16..19 - 0: JS_DECORATOR_LIST@16..16 - 1: JS_OBJECT_BINDING_PATTERN@16..19 - 0: L_CURLY@16..17 "{" [] [] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@17..17 - 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 3: (empty) - 4: JS_BOGUS_PARAMETER@19..20 - 0: R_CURLY@19..20 "}" [] [] - 2: (empty) - 7: (empty) - 8: (empty) - 9: (empty) - 4: EOF@20..21 "" [Newline("\n")] [] --- -class_member_method_parameters.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `{` - - > 1 │ class B { foo(a {} } - │ ^ - 2 │ - - i Remove { - --- -class_member_method_parameters.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `}` - - > 1 │ class B { foo(a {} } - │ ^ - 2 │ - - i Remove } - --- -class_member_method_parameters.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead the file ends - - 1 │ class B { foo(a {} } - > 2 │ - │ - - i the file ends here - - 1 │ class B { foo(a {} } - > 2 │ - │ - --- -class B { foo(a {} } diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_modifier.rast b/crates/biome_js_parser/test_data/inline/err/class_member_modifier.rast deleted file mode 100644 index 74dac9672196..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_member_modifier.rast +++ /dev/null @@ -1,73 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@10..19 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@19..22 "foo" [] [], - }, - SEMICOLON@22..24 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - ], - eof_token: EOF@25..26 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..26 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..25 - 0: JS_CLASS_DECLARATION@0..25 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..24 - 0: JS_BOGUS_MEMBER@10..24 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@10..19 - 0: TS_ABSTRACT_MODIFIER@10..19 - 0: ABSTRACT_KW@10..19 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@19..22 - 0: IDENT@19..22 "foo" [] [] - 2: SEMICOLON@22..24 ";" [] [Whitespace(" ")] - 9: R_CURLY@24..25 "}" [] [] - 4: EOF@25..26 "" [Newline("\n")] [] --- -class_member_modifier.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Only abstract classes can have abstract members - - > 1 │ class A { abstract foo; } - │ ^^^^^^^^ - 2 │ - --- -class A { abstract foo; } diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.rast b/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.rast deleted file mode 100644 index 37ca2d48307f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.rast +++ /dev/null @@ -1,108 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@9..23 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@23..30 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@30..34 "foo" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@34..36 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@36..37 "1" [] [], - }, - }, - SEMICOLON@37..38 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@38..40 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: JS_CLASS_DECLARATION@0..40 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..38 - 0: JS_BOGUS_MEMBER@9..38 - 0: JS_PROPERTY_MODIFIER_LIST@9..30 - 0: JS_ACCESSOR_MODIFIER@9..23 - 0: ACCESSOR_KW@9..23 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@23..30 - 0: STATIC_KW@23..30 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@30..34 - 0: IDENT@30..34 "foo" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@34..37 - 0: EQ@34..36 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@36..37 - 0: JS_NUMBER_LITERAL@36..37 "1" [] [] - 3: SEMICOLON@37..38 ";" [] [] - 9: R_CURLY@38..40 "}" [Newline("\n")] [] - 4: EOF@40..41 "" [Newline("\n")] [] --- -class_member_static_accessor_precedence.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' must precede 'accessor' - - 1 │ class A { - > 2 │ accessor static foo = 1; - │ ^^^^^^ - 3 │ } - 4 │ - - i move this modifier - - 1 │ class A { - > 2 │ accessor static foo = 1; - │ ^^^^^^ - 3 │ } - 4 │ - - i before this modifier - - 1 │ class A { - > 2 │ accessor static foo = 1; - │ ^^^^^^^^ - 3 │ } - 4 │ - --- -class A { - accessor static foo = 1; -} diff --git a/crates/biome_js_parser/test_data/inline/err/class_property_initializer.rast b/crates/biome_js_parser/test_data/inline/err/class_property_initializer.rast deleted file mode 100644 index 243086ce9b11..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_property_initializer.rast +++ /dev/null @@ -1,80 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..16 "lorem" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@16..18 "=" [] [Whitespace(" ")], - expression: missing (required), - }, - semicolon_token: SEMICOLON@18..20 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_CLASS_DECLARATION@0..21 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..20 - 0: JS_PROPERTY_CLASS_MEMBER@10..20 - 0: JS_PROPERTY_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..16 - 0: IDENT@10..16 "lorem" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@16..18 - 0: EQ@16..18 "=" [] [Whitespace(" ")] - 1: (empty) - 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] - 9: R_CURLY@20..21 "}" [] [] - 4: EOF@21..22 "" [Newline("\n")] [] --- -class_property_initializer.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ';'. - - > 1 │ class B { lorem = ; } - │ ^ - 2 │ - - i Expected an expression, or an assignment here. - - > 1 │ class B { lorem = ; } - │ ^ - 2 │ - --- -class B { lorem = ; } diff --git a/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.rast b/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.rast deleted file mode 100644 index 9c96d31cce4e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.rast +++ /dev/null @@ -1,131 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@16..24 "function" [] [], - star_token: STAR@24..26 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@26..30 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@30..31 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@33..34 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@43..45 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@45..46 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@56..58 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@58..63 "yield" [] [], - ], - }, - ], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - ], - r_curly_token: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_curly_token: R_CURLY@68..70 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@70..71 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..71 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..70 - 0: JS_FUNCTION_DECLARATION@0..70 - 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@16..24 "function" [] [] - 2: STAR@24..26 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@26..30 - 0: IDENT@26..30 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@30..33 - 0: L_PAREN@30..31 "(" [] [] - 1: JS_PARAMETER_LIST@31..31 - 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@33..70 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_DIRECTIVE_LIST@34..34 - 2: JS_STATEMENT_LIST@34..68 - 0: JS_CLASS_DECLARATION@34..68 - 0: JS_DECORATOR_LIST@34..34 - 1: (empty) - 2: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@45..46 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@46..64 - 0: JS_PROPERTY_CLASS_MEMBER@46..64 - 0: JS_PROPERTY_MODIFIER_LIST@46..46 - 1: JS_LITERAL_MEMBER_NAME@46..56 - 0: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@56..63 - 0: EQ@56..58 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@58..63 - 0: JS_BOGUS@58..63 - 0: IDENT@58..63 "yield" [] [] - 4: SEMICOLON@63..64 ";" [] [] - 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] - 3: R_CURLY@68..70 "}" [Newline("\n")] [] - 4: EOF@70..71 "" [Newline("\n")] [] --- -class_yield_property_initializer.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - 2 │ async function* test() { - 3 │ class A { - > 4 │ prop = yield; - │ ^^^^^ - 5 │ } - 6 │ } - --- -// SCRIPT -async function* test() { - class A { - prop = yield; - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.rast b/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.rast deleted file mode 100644 index f6e903775346..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.rast +++ /dev/null @@ -1,186 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@4..6 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@6..10 "bar" [] [Whitespace(" ")], - }, - }, - colon_token: missing (required), - alternate: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..13 "baz" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..18 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@18..20 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..24 "bar" [] [Whitespace(" ")], - }, - }, - colon_token: missing (required), - alternate: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..28 "baz" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@28..30 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..34 "foo" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - alternate: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@36..39 "bar" [] [], - }, - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@39..44 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@44..46 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..50 "bar" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@50..51 ":" [] [], - alternate: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@51..52 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..52 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..51 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_CONDITIONAL_EXPRESSION@0..13 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "foo" [] [Whitespace(" ")] - 1: QUESTION@4..6 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@6..10 - 0: JS_REFERENCE_IDENTIFIER@6..10 - 0: IDENT@6..10 "bar" [] [Whitespace(" ")] - 3: (empty) - 4: JS_IDENTIFIER_EXPRESSION@10..13 - 0: JS_REFERENCE_IDENTIFIER@10..13 - 0: IDENT@10..13 "baz" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@13..39 - 0: JS_CONDITIONAL_EXPRESSION@13..39 - 0: JS_IDENTIFIER_EXPRESSION@13..18 - 0: JS_REFERENCE_IDENTIFIER@13..18 - 0: IDENT@13..18 "foo" [Newline("\n")] [Whitespace(" ")] - 1: QUESTION@18..20 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@20..24 - 0: JS_REFERENCE_IDENTIFIER@20..24 - 0: IDENT@20..24 "bar" [] [Whitespace(" ")] - 3: (empty) - 4: JS_CONDITIONAL_EXPRESSION@24..39 - 0: JS_IDENTIFIER_EXPRESSION@24..28 - 0: JS_REFERENCE_IDENTIFIER@24..28 - 0: IDENT@24..28 "baz" [] [Whitespace(" ")] - 1: QUESTION@28..30 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@30..34 - 0: JS_REFERENCE_IDENTIFIER@30..34 - 0: IDENT@30..34 "foo" [] [Whitespace(" ")] - 3: COLON@34..36 ":" [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@36..39 - 0: JS_REFERENCE_IDENTIFIER@36..39 - 0: IDENT@36..39 "bar" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@39..51 - 0: JS_CONDITIONAL_EXPRESSION@39..51 - 0: JS_IDENTIFIER_EXPRESSION@39..44 - 0: JS_REFERENCE_IDENTIFIER@39..44 - 0: IDENT@39..44 "foo" [Newline("\n")] [Whitespace(" ")] - 1: QUESTION@44..46 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@46..50 - 0: JS_REFERENCE_IDENTIFIER@46..50 - 0: IDENT@46..50 "bar" [] [Whitespace(" ")] - 3: COLON@50..51 ":" [] [] - 4: (empty) - 1: (empty) - 4: EOF@51..52 "" [Newline("\n")] [] --- -conditional_expr_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `baz` - - > 1 │ foo ? bar baz - │ ^^^ - 2 │ foo ? bar baz ? foo : bar - 3 │ foo ? bar : - - i Remove baz - --- -conditional_expr_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `baz` - - 1 │ foo ? bar baz - > 2 │ foo ? bar baz ? foo : bar - │ ^^^ - 3 │ foo ? bar : - 4 │ - - i Remove baz - --- -conditional_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found the end of the file. - - 2 │ foo ? bar baz ? foo : bar - 3 │ foo ? bar : - > 4 │ - │ - - i Expected an expression, or an assignment here. - - 2 │ foo ? bar baz ? foo : bar - 3 │ foo ? bar : - > 4 │ - │ - --- -foo ? bar baz -foo ? bar baz ? foo : bar -foo ? bar : diff --git a/crates/biome_js_parser/test_data/inline/err/continue_stmt.rast b/crates/biome_js_parser/test_data/inline/err/continue_stmt.rast deleted file mode 100644 index 938333cd3e7b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/continue_stmt.rast +++ /dev/null @@ -1,197 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - CONTINUE_KW@17..25 "continue" [] [], - SEMICOLON@25..27 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@28..35 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@35..36 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@36..40 "true" [] [], - }, - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@42..43 "{" [] [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - CONTINUE_KW@43..55 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLabel { - value_token: IDENT@55..58 "foo" [] [], - }, - SEMICOLON@58..59 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@59..61 "}" [Newline("\n")] [], - }, - }, - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@61..65 "foo" [Newline("\n")] [], - }, - colon_token: COLON@65..67 ":" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@67..68 "{" [] [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - CONTINUE_KW@68..80 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLabel { - value_token: IDENT@80..83 "foo" [] [], - }, - SEMICOLON@83..84 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@84..86 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@86..87 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..87 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..86 - 0: JS_FUNCTION_DECLARATION@0..28 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..28 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..27 - 0: JS_BOGUS_STATEMENT@17..27 - 0: CONTINUE_KW@17..25 "continue" [] [] - 1: SEMICOLON@25..27 ";" [] [Whitespace(" ")] - 3: R_CURLY@27..28 "}" [] [] - 1: JS_WHILE_STATEMENT@28..61 - 0: WHILE_KW@28..35 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@35..36 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@36..40 - 0: TRUE_KW@36..40 "true" [] [] - 3: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@42..61 - 0: L_CURLY@42..43 "{" [] [] - 1: JS_STATEMENT_LIST@43..59 - 0: JS_BOGUS_STATEMENT@43..59 - 0: CONTINUE_KW@43..55 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LABEL@55..58 - 0: IDENT@55..58 "foo" [] [] - 2: SEMICOLON@58..59 ";" [] [] - 2: R_CURLY@59..61 "}" [Newline("\n")] [] - 2: JS_LABELED_STATEMENT@61..86 - 0: JS_LABEL@61..65 - 0: IDENT@61..65 "foo" [Newline("\n")] [] - 1: COLON@65..67 ":" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@67..86 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_STATEMENT_LIST@68..84 - 0: JS_BOGUS_STATEMENT@68..84 - 0: CONTINUE_KW@68..80 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LABEL@80..83 - 0: IDENT@80..83 "foo" [] [] - 2: SEMICOLON@83..84 ";" [] [] - 2: R_CURLY@84..86 "}" [Newline("\n")] [] - 4: EOF@86..87 "" [Newline("\n")] [] --- -continue_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. - - > 1 │ function foo() { continue; } - │ ^^^^^^^^ - 2 │ while (true) { - 3 │ continue foo; - --- -continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Use of undefined statement label `foo` - - 1 │ function foo() { continue; } - 2 │ while (true) { - > 3 │ continue foo; - │ ^^^ - 4 │ } - 5 │ foo: { - - i This label is used, but it is never defined - --- -continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `continue` statement can only jump to a label of an enclosing `for`, `while` or `do while` statement. - - 4 │ } - 5 │ foo: { - > 6 │ continue foo; - │ ^^^ - 7 │ } - 8 │ - - i This label - - 4 │ } - 5 │ foo: { - > 6 │ continue foo; - │ ^^^ - 7 │ } - 8 │ - - i points to non-iteration statement - - 3 │ continue foo; - 4 │ } - > 5 │ foo: { - │ ^^^ - 6 │ continue foo; - 7 │ } - --- -function foo() { continue; } -while (true) { - continue foo; -} -foo: { - continue foo; -} diff --git a/crates/biome_js_parser/test_data/inline/err/debugger_stmt.rast b/crates/biome_js_parser/test_data/inline/err/debugger_stmt.rast deleted file mode 100644 index d02882d160aa..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/debugger_stmt.rast +++ /dev/null @@ -1,139 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsDebuggerStatement { - debugger_token: DEBUGGER_KW@16..28 "debugger" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@28..29 "{" [] [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@29..38 "var" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@38..48 "something" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@48..50 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@50..57 "\"lorem\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@57..58 ";" [] [], - }, - ], - r_curly_token: R_CURLY@58..62 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_curly_token: R_CURLY@62..64 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: JS_FUNCTION_DECLARATION@0..64 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..64 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..62 - 0: JS_DEBUGGER_STATEMENT@16..28 - 0: DEBUGGER_KW@16..28 "debugger" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: JS_BLOCK_STATEMENT@28..62 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_STATEMENT_LIST@29..58 - 0: JS_VARIABLE_STATEMENT@29..58 - 0: JS_VARIABLE_DECLARATION@29..57 - 0: (empty) - 1: VAR_KW@29..38 "var" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@38..57 - 0: JS_VARIABLE_DECLARATOR@38..57 - 0: JS_IDENTIFIER_BINDING@38..48 - 0: IDENT@38..48 "something" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@48..57 - 0: EQ@48..50 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@50..57 - 0: JS_STRING_LITERAL@50..57 "\"lorem\"" [] [] - 1: SEMICOLON@57..58 ";" [] [] - 2: R_CURLY@58..62 "}" [Newline("\n"), Whitespace(" ")] [] - 3: R_CURLY@62..64 "}" [Newline("\n")] [] - 4: EOF@64..65 "" [Newline("\n")] [] --- -debugger_stmt.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ function foo() { - > 2 │ debugger { - │ ^ - 3 │ var something = "lorem"; - 4 │ } - - i An explicit or implicit semicolon is expected here... - - 1 │ function foo() { - > 2 │ debugger { - │ ^ - 3 │ var something = "lorem"; - 4 │ } - - i ...Which is required to end this statement - - 1 │ function foo() { - > 2 │ debugger { - │ ^^^^^^^^ - 3 │ var something = "lorem"; - 4 │ } - --- -function foo() { - debugger { - var something = "lorem"; - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/decorator.rast b/crates/biome_js_parser/test_data/inline/err/decorator.rast deleted file mode 100644 index e91f20d188c7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator.rast +++ /dev/null @@ -1,1861 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsBogusExpression { - items: [ - JS_STRING_LITERAL@1..9 "'dsads'" [] [Whitespace(" ")], - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..23 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@23..24 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@25..27 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JS_NUMBER_LITERAL@27..29 "1" [] [Whitespace(" ")], - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@29..35 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@35..43 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@43..44 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@44..45 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@45..47 "@" [Newline("\n")] [], - expression: missing (required), - }, - ], - }, - JsExpressionStatement { - expression: JsPreUpdateExpression { - operator_token: PLUS2@47..49 "++" [] [], - operand: JsBogusAssignment { - items: [ - JS_NUMBER_LITERAL@49..51 "1" [] [Whitespace(" ")], - ], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@51..57 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@57..65 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@65..66 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@66..67 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@67..69 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - L_BRACK@69..70 "[" [] [], - JsArrayElementList [], - R_BRACK@70..72 "]" [] [Whitespace(" ")], - ], - }, - }, - ], - }, - JsBogusStatement { - items: [ - IN_KW@72..75 "in" [] [Whitespace(" ")], - JS_NUMBER_LITERAL@75..77 "1" [] [Whitespace(" ")], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@77..83 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@83..91 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@91..92 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@93..95 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - L_BRACK@95..96 "[" [] [], - JsArrayElementList [], - R_BRACK@96..98 "]" [] [Whitespace(" ")], - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@98..104 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@104..112 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@112..113 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@113..114 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@114..116 "@" [Newline("\n")] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@116..117 "(" [] [], - expression: missing (required), - r_paren_token: R_PAREN@117..119 ")" [] [Whitespace(" ")], - }, - }, - ], - }, - JsBogusStatement { - items: [ - FAT_ARROW@119..122 "=>" [] [Whitespace(" ")], - ], - }, - JsBlockStatement { - l_curly_token: L_CURLY@122..123 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@123..125 "}" [] [Whitespace(" ")], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@125..131 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@131..139 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@139..140 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@140..141 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@141..143 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JS_NUMBER_LITERAL@143..145 "1" [] [Whitespace(" ")], - ], - }, - }, - ], - }, - JsBogusStatement { - items: [ - EQ2@145..148 "==" [] [Whitespace(" ")], - JS_NUMBER_LITERAL@148..150 "2" [] [Whitespace(" ")], - QUESTION@150..152 "?" [] [Whitespace(" ")], - TRUE_KW@152..157 "true" [] [Whitespace(" ")], - COLON@157..159 ":" [] [Whitespace(" ")], - FALSE_KW@159..165 "false" [] [Whitespace(" ")], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@165..171 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@171..179 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@179..180 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@180..181 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@181..183 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@183..189 "await" [] [Whitespace(" ")], - ], - }, - ], - }, - }, - ], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@189..192 "fn" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@192..198 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@198..206 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@206..207 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@207..208 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@208..210 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - FUNCTION_KW@210..218 "function" [] [], - JsParameters { - l_paren_token: L_PAREN@218..219 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@219..220 ")" [] [], - }, - JsFunctionBody { - l_curly_token: L_CURLY@220..221 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@221..223 "}" [] [Whitespace(" ")], - }, - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@223..229 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@229..237 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@237..238 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@238..239 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@239..241 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@241..245 "obj" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsBogusStatement { - items: [ - INSTANCEOF_KW@245..256 "instanceof" [] [Whitespace(" ")], - IDENT@256..263 "Object" [] [Whitespace(" ")], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@263..269 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@269..277 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@277..278 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@278..279 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@279..281 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JS_NUMBER_LITERAL@281..283 "1" [] [Whitespace(" ")], - ], - }, - }, - ], - }, - JsBogusStatement { - items: [ - EQ3@283..287 "===" [] [Whitespace(" ")], - JS_NUMBER_LITERAL@287..289 "2" [] [Whitespace(" ")], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@289..295 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@295..303 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@303..304 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@304..305 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@305..307 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - NEW_KW@307..311 "new" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@311..317 "Object" [] [], - }, - }, - JsCallArguments { - l_paren_token: L_PAREN@317..318 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@318..320 ")" [] [Whitespace(" ")], - }, - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@320..326 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@326..334 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@334..335 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@335..336 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@336..338 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - L_CURLY@338..339 "{" [] [], - JsObjectMemberList [], - R_CURLY@339..341 "}" [] [Whitespace(" ")], - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@341..347 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@347..355 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@355..356 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@356..357 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@357..359 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@359..360 "a" [] [], - }, - }, - }, - ], - }, - JsExpressionStatement { - expression: JsPreUpdateExpression { - operator_token: PLUS2@360..363 "++" [] [Whitespace(" ")], - operand: JsBogusAssignment { - items: [ - JsDecoratorList [], - CLASS_KW@363..369 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@369..377 "MyClass" [] [Whitespace(" ")], - }, - L_CURLY@377..378 "{" [] [], - JsClassMemberList [], - R_CURLY@378..379 "}" [] [], - ], - }, - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@379..381 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@381..382 "a" [] [], - }, - }, - }, - ], - }, - JsBogusStatement { - items: [ - COMMA@382..383 "," [] [], - IDENT@383..385 "b" [] [Whitespace(" ")], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@385..391 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@391..399 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@399..400 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@400..401 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@401..403 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - BACKTICK@403..404 "`" [] [], - JsTemplateElementList [ - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@404..406 "${" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@406..407 "d" [] [], - }, - }, - r_curly_token: R_CURLY@407..408 "}" [] [], - }, - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@408..411 "foo" [] [], - }, - ], - BACKTICK@411..413 "`" [] [Whitespace(" ")], - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@413..419 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@419..427 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@427..428 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@428..429 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@429..431 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@431..435 "obj" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@435..438 "as" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@438..445 "MyType" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@445..451 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@451..459 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@459..460 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@460..461 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@461..463 "@" [Newline("\n")] [], - expression: missing (required), - }, - ], - }, - JsExpressionStatement { - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@463..464 "<" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@464..470 "MyType" [] [], - }, - type_arguments: missing (optional), - }, - r_angle_token: R_ANGLE@470..471 ">" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@471..475 "obj" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@475..481 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@481..489 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@489..490 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@490..491 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@491..493 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@493..497 "obj" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@497..507 "satisfies" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@507..514 "MyType" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@514..520 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@520..528 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@528..529 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@529..530 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@530..532 "@" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@532..535 "obj" [] [], - }, - }, - BANG@535..537 "!" [] [Whitespace(" ")], - ], - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@537..543 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@543..551 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@551..552 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@552..553 "}" [] [], - }, - ], - eof_token: EOF@553..554 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..554 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..553 - 0: JS_CLASS_DECLARATION@0..25 - 0: JS_DECORATOR_LIST@0..9 - 0: JS_DECORATOR@0..9 - 0: AT@0..1 "@" [] [] - 1: JS_BOGUS_EXPRESSION@1..9 - 0: JS_STRING_LITERAL@1..9 "'dsads'" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..23 - 0: IDENT@15..23 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@23..24 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@24..24 - 9: R_CURLY@24..25 "}" [] [] - 1: JS_CLASS_DECLARATION@25..45 - 0: JS_DECORATOR_LIST@25..29 - 0: JS_DECORATOR@25..29 - 0: AT@25..27 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@27..29 - 0: JS_NUMBER_LITERAL@27..29 "1" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@29..35 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@35..43 - 0: IDENT@35..43 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@43..44 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@44..44 - 9: R_CURLY@44..45 "}" [] [] - 2: JS_BOGUS_STATEMENT@45..47 - 0: JS_DECORATOR@45..47 - 0: AT@45..47 "@" [Newline("\n")] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@47..51 - 0: JS_PRE_UPDATE_EXPRESSION@47..51 - 0: PLUS2@47..49 "++" [] [] - 1: JS_BOGUS_ASSIGNMENT@49..51 - 0: JS_NUMBER_LITERAL@49..51 "1" [] [Whitespace(" ")] - 1: (empty) - 4: JS_CLASS_DECLARATION@51..67 - 0: JS_DECORATOR_LIST@51..51 - 1: (empty) - 2: CLASS_KW@51..57 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@57..65 - 0: IDENT@57..65 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@65..66 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@66..66 - 9: R_CURLY@66..67 "}" [] [] - 5: JS_BOGUS_STATEMENT@67..72 - 0: JS_DECORATOR@67..72 - 0: AT@67..69 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@69..72 - 0: L_BRACK@69..70 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@70..70 - 2: R_BRACK@70..72 "]" [] [Whitespace(" ")] - 6: JS_BOGUS_STATEMENT@72..77 - 0: IN_KW@72..75 "in" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL@75..77 "1" [] [Whitespace(" ")] - 7: JS_CLASS_DECLARATION@77..93 - 0: JS_DECORATOR_LIST@77..77 - 1: (empty) - 2: CLASS_KW@77..83 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@83..91 - 0: IDENT@83..91 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@91..92 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@92..92 - 9: R_CURLY@92..93 "}" [] [] - 8: JS_CLASS_DECLARATION@93..114 - 0: JS_DECORATOR_LIST@93..98 - 0: JS_DECORATOR@93..98 - 0: AT@93..95 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@95..98 - 0: L_BRACK@95..96 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@96..96 - 2: R_BRACK@96..98 "]" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@98..104 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@104..112 - 0: IDENT@104..112 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@112..113 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@113..113 - 9: R_CURLY@113..114 "}" [] [] - 9: JS_BOGUS_STATEMENT@114..119 - 0: JS_DECORATOR@114..119 - 0: AT@114..116 "@" [Newline("\n")] [] - 1: JS_PARENTHESIZED_EXPRESSION@116..119 - 0: L_PAREN@116..117 "(" [] [] - 1: (empty) - 2: R_PAREN@117..119 ")" [] [Whitespace(" ")] - 10: JS_BOGUS_STATEMENT@119..122 - 0: FAT_ARROW@119..122 "=>" [] [Whitespace(" ")] - 11: JS_BLOCK_STATEMENT@122..125 - 0: L_CURLY@122..123 "{" [] [] - 1: JS_STATEMENT_LIST@123..123 - 2: R_CURLY@123..125 "}" [] [Whitespace(" ")] - 12: JS_CLASS_DECLARATION@125..141 - 0: JS_DECORATOR_LIST@125..125 - 1: (empty) - 2: CLASS_KW@125..131 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@131..139 - 0: IDENT@131..139 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@139..140 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@140..140 - 9: R_CURLY@140..141 "}" [] [] - 13: JS_BOGUS_STATEMENT@141..145 - 0: JS_DECORATOR@141..145 - 0: AT@141..143 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@143..145 - 0: JS_NUMBER_LITERAL@143..145 "1" [] [Whitespace(" ")] - 14: JS_BOGUS_STATEMENT@145..165 - 0: EQ2@145..148 "==" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL@148..150 "2" [] [Whitespace(" ")] - 2: QUESTION@150..152 "?" [] [Whitespace(" ")] - 3: TRUE_KW@152..157 "true" [] [Whitespace(" ")] - 4: COLON@157..159 ":" [] [Whitespace(" ")] - 5: FALSE_KW@159..165 "false" [] [Whitespace(" ")] - 15: JS_CLASS_DECLARATION@165..181 - 0: JS_DECORATOR_LIST@165..165 - 1: (empty) - 2: CLASS_KW@165..171 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@171..179 - 0: IDENT@171..179 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@179..180 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@180..180 - 9: R_CURLY@180..181 "}" [] [] - 16: JS_BOGUS_STATEMENT@181..189 - 0: JS_DECORATOR@181..189 - 0: AT@181..183 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@183..189 - 0: JS_BOGUS@183..189 - 0: IDENT@183..189 "await" [] [Whitespace(" ")] - 17: JS_EXPRESSION_STATEMENT@189..192 - 0: JS_IDENTIFIER_EXPRESSION@189..192 - 0: JS_REFERENCE_IDENTIFIER@189..192 - 0: IDENT@189..192 "fn" [] [Whitespace(" ")] - 1: (empty) - 18: JS_CLASS_DECLARATION@192..208 - 0: JS_DECORATOR_LIST@192..192 - 1: (empty) - 2: CLASS_KW@192..198 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@198..206 - 0: IDENT@198..206 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@206..207 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@207..207 - 9: R_CURLY@207..208 "}" [] [] - 19: JS_CLASS_DECLARATION@208..239 - 0: JS_DECORATOR_LIST@208..223 - 0: JS_DECORATOR@208..223 - 0: AT@208..210 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@210..223 - 0: FUNCTION_KW@210..218 "function" [] [] - 1: JS_PARAMETERS@218..220 - 0: L_PAREN@218..219 "(" [] [] - 1: JS_PARAMETER_LIST@219..219 - 2: R_PAREN@219..220 ")" [] [] - 2: JS_FUNCTION_BODY@220..223 - 0: L_CURLY@220..221 "{" [] [] - 1: JS_DIRECTIVE_LIST@221..221 - 2: JS_STATEMENT_LIST@221..221 - 3: R_CURLY@221..223 "}" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@223..229 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@229..237 - 0: IDENT@229..237 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@237..238 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@238..238 - 9: R_CURLY@238..239 "}" [] [] - 20: JS_BOGUS_STATEMENT@239..245 - 0: JS_DECORATOR@239..245 - 0: AT@239..241 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@241..245 - 0: JS_REFERENCE_IDENTIFIER@241..245 - 0: IDENT@241..245 "obj" [] [Whitespace(" ")] - 21: JS_BOGUS_STATEMENT@245..263 - 0: INSTANCEOF_KW@245..256 "instanceof" [] [Whitespace(" ")] - 1: IDENT@256..263 "Object" [] [Whitespace(" ")] - 22: JS_CLASS_DECLARATION@263..279 - 0: JS_DECORATOR_LIST@263..263 - 1: (empty) - 2: CLASS_KW@263..269 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@269..277 - 0: IDENT@269..277 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@277..278 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@278..278 - 9: R_CURLY@278..279 "}" [] [] - 23: JS_BOGUS_STATEMENT@279..283 - 0: JS_DECORATOR@279..283 - 0: AT@279..281 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@281..283 - 0: JS_NUMBER_LITERAL@281..283 "1" [] [Whitespace(" ")] - 24: JS_BOGUS_STATEMENT@283..289 - 0: EQ3@283..287 "===" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL@287..289 "2" [] [Whitespace(" ")] - 25: JS_CLASS_DECLARATION@289..305 - 0: JS_DECORATOR_LIST@289..289 - 1: (empty) - 2: CLASS_KW@289..295 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@295..303 - 0: IDENT@295..303 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@303..304 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@304..304 - 9: R_CURLY@304..305 "}" [] [] - 26: JS_CLASS_DECLARATION@305..336 - 0: JS_DECORATOR_LIST@305..320 - 0: JS_DECORATOR@305..320 - 0: AT@305..307 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@307..320 - 0: NEW_KW@307..311 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@311..317 - 0: JS_REFERENCE_IDENTIFIER@311..317 - 0: IDENT@311..317 "Object" [] [] - 2: JS_CALL_ARGUMENTS@317..320 - 0: L_PAREN@317..318 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@318..318 - 2: R_PAREN@318..320 ")" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@320..326 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@326..334 - 0: IDENT@326..334 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@334..335 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@335..335 - 9: R_CURLY@335..336 "}" [] [] - 27: JS_CLASS_DECLARATION@336..357 - 0: JS_DECORATOR_LIST@336..341 - 0: JS_DECORATOR@336..341 - 0: AT@336..338 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@338..341 - 0: L_CURLY@338..339 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@339..339 - 2: R_CURLY@339..341 "}" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@341..347 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@347..355 - 0: IDENT@347..355 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@355..356 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@356..356 - 9: R_CURLY@356..357 "}" [] [] - 28: JS_BOGUS_STATEMENT@357..360 - 0: JS_DECORATOR@357..360 - 0: AT@357..359 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@359..360 - 0: JS_REFERENCE_IDENTIFIER@359..360 - 0: IDENT@359..360 "a" [] [] - 29: JS_EXPRESSION_STATEMENT@360..379 - 0: JS_PRE_UPDATE_EXPRESSION@360..379 - 0: PLUS2@360..363 "++" [] [Whitespace(" ")] - 1: JS_BOGUS_ASSIGNMENT@363..379 - 0: JS_DECORATOR_LIST@363..363 - 1: CLASS_KW@363..369 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@369..377 - 0: IDENT@369..377 "MyClass" [] [Whitespace(" ")] - 3: L_CURLY@377..378 "{" [] [] - 4: JS_CLASS_MEMBER_LIST@378..378 - 5: R_CURLY@378..379 "}" [] [] - 1: (empty) - 30: JS_BOGUS_STATEMENT@379..382 - 0: JS_DECORATOR@379..382 - 0: AT@379..381 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@381..382 - 0: JS_REFERENCE_IDENTIFIER@381..382 - 0: IDENT@381..382 "a" [] [] - 31: JS_BOGUS_STATEMENT@382..385 - 0: COMMA@382..383 "," [] [] - 1: IDENT@383..385 "b" [] [Whitespace(" ")] - 32: JS_CLASS_DECLARATION@385..401 - 0: JS_DECORATOR_LIST@385..385 - 1: (empty) - 2: CLASS_KW@385..391 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@391..399 - 0: IDENT@391..399 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@399..400 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@400..400 - 9: R_CURLY@400..401 "}" [] [] - 33: JS_CLASS_DECLARATION@401..429 - 0: JS_DECORATOR_LIST@401..413 - 0: JS_DECORATOR@401..413 - 0: AT@401..403 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@403..413 - 0: BACKTICK@403..404 "`" [] [] - 1: JS_TEMPLATE_ELEMENT_LIST@404..411 - 0: JS_TEMPLATE_ELEMENT@404..408 - 0: DOLLAR_CURLY@404..406 "${" [] [] - 1: JS_IDENTIFIER_EXPRESSION@406..407 - 0: JS_REFERENCE_IDENTIFIER@406..407 - 0: IDENT@406..407 "d" [] [] - 2: R_CURLY@407..408 "}" [] [] - 1: JS_TEMPLATE_CHUNK_ELEMENT@408..411 - 0: TEMPLATE_CHUNK@408..411 "foo" [] [] - 2: BACKTICK@411..413 "`" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@413..419 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@419..427 - 0: IDENT@419..427 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@427..428 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@428..428 - 9: R_CURLY@428..429 "}" [] [] - 34: JS_BOGUS_STATEMENT@429..435 - 0: JS_DECORATOR@429..435 - 0: AT@429..431 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@431..435 - 0: JS_REFERENCE_IDENTIFIER@431..435 - 0: IDENT@431..435 "obj" [] [Whitespace(" ")] - 35: JS_EXPRESSION_STATEMENT@435..438 - 0: JS_IDENTIFIER_EXPRESSION@435..438 - 0: JS_REFERENCE_IDENTIFIER@435..438 - 0: IDENT@435..438 "as" [] [Whitespace(" ")] - 1: (empty) - 36: JS_EXPRESSION_STATEMENT@438..445 - 0: JS_IDENTIFIER_EXPRESSION@438..445 - 0: JS_REFERENCE_IDENTIFIER@438..445 - 0: IDENT@438..445 "MyType" [] [Whitespace(" ")] - 1: (empty) - 37: JS_CLASS_DECLARATION@445..461 - 0: JS_DECORATOR_LIST@445..445 - 1: (empty) - 2: CLASS_KW@445..451 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@451..459 - 0: IDENT@451..459 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@459..460 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@460..460 - 9: R_CURLY@460..461 "}" [] [] - 38: JS_BOGUS_STATEMENT@461..463 - 0: JS_DECORATOR@461..463 - 0: AT@461..463 "@" [Newline("\n")] [] - 1: (empty) - 39: JS_EXPRESSION_STATEMENT@463..475 - 0: TS_TYPE_ASSERTION_EXPRESSION@463..475 - 0: L_ANGLE@463..464 "<" [] [] - 1: TS_REFERENCE_TYPE@464..470 - 0: JS_REFERENCE_IDENTIFIER@464..470 - 0: IDENT@464..470 "MyType" [] [] - 1: (empty) - 2: R_ANGLE@470..471 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@471..475 - 0: JS_REFERENCE_IDENTIFIER@471..475 - 0: IDENT@471..475 "obj" [] [Whitespace(" ")] - 1: (empty) - 40: JS_CLASS_DECLARATION@475..491 - 0: JS_DECORATOR_LIST@475..475 - 1: (empty) - 2: CLASS_KW@475..481 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@481..489 - 0: IDENT@481..489 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@489..490 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@490..490 - 9: R_CURLY@490..491 "}" [] [] - 41: JS_BOGUS_STATEMENT@491..497 - 0: JS_DECORATOR@491..497 - 0: AT@491..493 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@493..497 - 0: JS_REFERENCE_IDENTIFIER@493..497 - 0: IDENT@493..497 "obj" [] [Whitespace(" ")] - 42: JS_EXPRESSION_STATEMENT@497..507 - 0: JS_IDENTIFIER_EXPRESSION@497..507 - 0: JS_REFERENCE_IDENTIFIER@497..507 - 0: IDENT@497..507 "satisfies" [] [Whitespace(" ")] - 1: (empty) - 43: JS_EXPRESSION_STATEMENT@507..514 - 0: JS_IDENTIFIER_EXPRESSION@507..514 - 0: JS_REFERENCE_IDENTIFIER@507..514 - 0: IDENT@507..514 "MyType" [] [Whitespace(" ")] - 1: (empty) - 44: JS_CLASS_DECLARATION@514..530 - 0: JS_DECORATOR_LIST@514..514 - 1: (empty) - 2: CLASS_KW@514..520 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@520..528 - 0: IDENT@520..528 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@528..529 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@529..529 - 9: R_CURLY@529..530 "}" [] [] - 45: JS_CLASS_DECLARATION@530..553 - 0: JS_DECORATOR_LIST@530..537 - 0: JS_DECORATOR@530..537 - 0: AT@530..532 "@" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@532..537 - 0: JS_IDENTIFIER_EXPRESSION@532..535 - 0: JS_REFERENCE_IDENTIFIER@532..535 - 0: IDENT@532..535 "obj" [] [] - 1: BANG@535..537 "!" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@537..543 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@543..551 - 0: IDENT@543..551 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@551..552 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@552..552 - 9: R_CURLY@552..553 "}" [] [] - 4: EOF@553..554 "" [Newline("\n")] [] --- -decorator.ts:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `'dsads'` - - > 1 │ @'dsads' class MyClass {} - │ ^^^^^^^ - 2 │ @1 class MyClass {} - 3 │ @++1 class MyClass {} - --- -decorator.ts:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `1` - - 1 │ @'dsads' class MyClass {} - > 2 │ @1 class MyClass {} - │ ^ - 3 │ @++1 class MyClass {} - 4 │ @[] in 1 class MyClass {} - --- -decorator.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '++'. - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - - i Expected an expression here. - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - --- -decorator.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `1` - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - - i This expression cannot be assigned to - --- -decorator.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^^^^^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - - i An explicit or implicit semicolon is expected here... - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^^^^^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - - i ...Which is required to end this statement - - 1 │ @'dsads' class MyClass {} - 2 │ @1 class MyClass {} - > 3 │ @++1 class MyClass {} - │ ^^^^^^^^^ - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - --- -decorator.ts:4:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `[]` - - 2 │ @1 class MyClass {} - 3 │ @++1 class MyClass {} - > 4 │ @[] in 1 class MyClass {} - │ ^^ - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - --- -decorator.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ @1 class MyClass {} - 3 │ @++1 class MyClass {} - > 4 │ @[] in 1 class MyClass {} - │ ^^^ - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found 'in 1'. - - 2 │ @1 class MyClass {} - 3 │ @++1 class MyClass {} - > 4 │ @[] in 1 class MyClass {} - │ ^^^^ - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - - i Expected a statement here. - - 2 │ @1 class MyClass {} - 3 │ @++1 class MyClass {} - > 4 │ @[] in 1 class MyClass {} - │ ^^^^ - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - --- -decorator.ts:5:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `[]` - - 3 │ @++1 class MyClass {} - 4 │ @[] in 1 class MyClass {} - > 5 │ @[] class MyClass {} - │ ^^ - 6 │ @() => {} class MyClass {} - 7 │ @1 == 2 ? true : false class MyClass {} - --- -decorator.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Parenthesized expression didnt contain anything - - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - > 6 │ @() => {} class MyClass {} - │ ^ - 7 │ @1 == 2 ? true : false class MyClass {} - 8 │ @await fn class MyClass {} - - i Expected an expression here - --- -decorator.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - > 6 │ @() => {} class MyClass {} - │ ^^^ - 7 │ @1 == 2 ? true : false class MyClass {} - 8 │ @await fn class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '=>'. - - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - > 6 │ @() => {} class MyClass {} - │ ^^ - 7 │ @1 == 2 ? true : false class MyClass {} - 8 │ @await fn class MyClass {} - - i Expected a statement here. - - 4 │ @[] in 1 class MyClass {} - 5 │ @[] class MyClass {} - > 6 │ @() => {} class MyClass {} - │ ^^ - 7 │ @1 == 2 ? true : false class MyClass {} - 8 │ @await fn class MyClass {} - --- -decorator.ts:7:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `1` - - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - > 7 │ @1 == 2 ? true : false class MyClass {} - │ ^ - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - --- -decorator.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - > 7 │ @1 == 2 ? true : false class MyClass {} - │ ^^ - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '== 2 ? true : false'. - - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - > 7 │ @1 == 2 ? true : false class MyClass {} - │ ^^^^^^^^^^^^^^^^^^^ - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - - i Expected a statement here. - - 5 │ @[] class MyClass {} - 6 │ @() => {} class MyClass {} - > 7 │ @1 == 2 ? true : false class MyClass {} - │ ^^^^^^^^^^^^^^^^^^^ - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - --- -decorator.ts:8:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - 6 │ @() => {} class MyClass {} - 7 │ @1 == 2 ? true : false class MyClass {} - > 8 │ @await fn class MyClass {} - │ ^^^^^ - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - --- -decorator.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 6 │ @() => {} class MyClass {} - 7 │ @1 == 2 ? true : false class MyClass {} - > 8 │ @await fn class MyClass {} - │ ^^^^^^ - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:8:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 6 │ @() => {} class MyClass {} - 7 │ @1 == 2 ? true : false class MyClass {} - > 8 │ @await fn class MyClass {} - │ ^^^^^ - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - - i An explicit or implicit semicolon is expected here... - - 6 │ @() => {} class MyClass {} - 7 │ @1 == 2 ? true : false class MyClass {} - > 8 │ @await fn class MyClass {} - │ ^^^^^ - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - - i ...Which is required to end this statement - - 6 │ @() => {} class MyClass {} - 7 │ @1 == 2 ? true : false class MyClass {} - > 8 │ @await fn class MyClass {} - │ ^^^^^^^^ - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - --- -decorator.ts:9:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `function(){}` - - 7 │ @1 == 2 ? true : false class MyClass {} - 8 │ @await fn class MyClass {} - > 9 │ @function(){} class MyClass {} - │ ^^^^^^^^^^^^ - 10 │ @obj instanceof Object class MyClass {} - 11 │ @1 === 2 class MyClass {} - --- -decorator.ts:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - > 10 │ @obj instanceof Object class MyClass {} - │ ^^^^ - 11 │ @1 === 2 class MyClass {} - 12 │ @new Object() class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found 'instanceof Object'. - - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - > 10 │ @obj instanceof Object class MyClass {} - │ ^^^^^^^^^^^^^^^^^ - 11 │ @1 === 2 class MyClass {} - 12 │ @new Object() class MyClass {} - - i Expected a statement here. - - 8 │ @await fn class MyClass {} - 9 │ @function(){} class MyClass {} - > 10 │ @obj instanceof Object class MyClass {} - │ ^^^^^^^^^^^^^^^^^ - 11 │ @1 === 2 class MyClass {} - 12 │ @new Object() class MyClass {} - --- -decorator.ts:11:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `1` - - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - > 11 │ @1 === 2 class MyClass {} - │ ^ - 12 │ @new Object() class MyClass {} - 13 │ @{} class MyClass {} - --- -decorator.ts:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - > 11 │ @1 === 2 class MyClass {} - │ ^^ - 12 │ @new Object() class MyClass {} - 13 │ @{} class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:11:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '=== 2'. - - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - > 11 │ @1 === 2 class MyClass {} - │ ^^^^^ - 12 │ @new Object() class MyClass {} - 13 │ @{} class MyClass {} - - i Expected a statement here. - - 9 │ @function(){} class MyClass {} - 10 │ @obj instanceof Object class MyClass {} - > 11 │ @1 === 2 class MyClass {} - │ ^^^^^ - 12 │ @new Object() class MyClass {} - 13 │ @{} class MyClass {} - --- -decorator.ts:12:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `new Object()` - - 10 │ @obj instanceof Object class MyClass {} - 11 │ @1 === 2 class MyClass {} - > 12 │ @new Object() class MyClass {} - │ ^^^^^^^^^^^^ - 13 │ @{} class MyClass {} - 14 │ @a++ class MyClass {} - --- -decorator.ts:13:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `{}` - - 11 │ @1 === 2 class MyClass {} - 12 │ @new Object() class MyClass {} - > 13 │ @{} class MyClass {} - │ ^^ - 14 │ @a++ class MyClass {} - 15 │ @a,b class MyClass {} - --- -decorator.ts:14:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 12 │ @new Object() class MyClass {} - 13 │ @{} class MyClass {} - > 14 │ @a++ class MyClass {} - │ ^^ - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:14:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `class MyClass {}` - - 12 │ @new Object() class MyClass {} - 13 │ @{} class MyClass {} - > 14 │ @a++ class MyClass {} - │ ^^^^^^^^^^^^^^^^ - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - - i This expression cannot be assigned to - --- -decorator.ts:15:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 13 │ @{} class MyClass {} - 14 │ @a++ class MyClass {} - > 15 │ @a,b class MyClass {} - │ ^^ - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found ',b'. - - 13 │ @{} class MyClass {} - 14 │ @a++ class MyClass {} - > 15 │ @a,b class MyClass {} - │ ^^ - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - - i Expected a statement here. - - 13 │ @{} class MyClass {} - 14 │ @a++ class MyClass {} - > 15 │ @a,b class MyClass {} - │ ^^ - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - --- -decorator.ts:16:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator ``${d}foo`` - - 14 │ @a++ class MyClass {} - 15 │ @a,b class MyClass {} - > 16 │ @`${d}foo` class MyClass {} - │ ^^^^^^^^^ - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - --- -decorator.ts:17:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:17:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - - i An explicit or implicit semicolon is expected here... - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - - i ...Which is required to end this statement - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^^^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - --- -decorator.ts:17:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - - i An explicit or implicit semicolon is expected here... - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - - i ...Which is required to end this statement - - 15 │ @a,b class MyClass {} - 16 │ @`${d}foo` class MyClass {} - > 17 │ @obj as MyType class MyClass {} - │ ^^^^^^^^^^^^ - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - --- -decorator.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '<'. - - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - > 18 │ @obj class MyClass {} - │ ^ - 19 │ @obj satisfies MyType class MyClass {} - 20 │ @obj! class MyClass {} - - i Expected an expression here. - - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - > 18 │ @obj class MyClass {} - │ ^ - 19 │ @obj satisfies MyType class MyClass {} - 20 │ @obj! class MyClass {} - --- -decorator.ts:18:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - > 18 │ @obj class MyClass {} - │ ^ - 19 │ @obj satisfies MyType class MyClass {} - 20 │ @obj! class MyClass {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:18:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - > 18 │ @obj class MyClass {} - │ ^^^^^ - 19 │ @obj satisfies MyType class MyClass {} - 20 │ @obj! class MyClass {} - - i An explicit or implicit semicolon is expected here... - - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - > 18 │ @obj class MyClass {} - │ ^^^^^ - 19 │ @obj satisfies MyType class MyClass {} - 20 │ @obj! class MyClass {} - - i ...Which is required to end this statement - - 16 │ @`${d}foo` class MyClass {} - 17 │ @obj as MyType class MyClass {} - > 18 │ @obj class MyClass {} - │ ^^^^^^^^^^^^^^^^^ - 19 │ @obj satisfies MyType class MyClass {} - 20 │ @obj! class MyClass {} - --- -decorator.ts:19:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^ - 20 │ @obj! class MyClass {} - 21 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator.ts:19:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^^^ - 20 │ @obj! class MyClass {} - 21 │ - - i An explicit or implicit semicolon is expected here... - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^^^ - 20 │ @obj! class MyClass {} - 21 │ - - i ...Which is required to end this statement - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^^^^^^^^^^^^^ - 20 │ @obj! class MyClass {} - 21 │ - --- -decorator.ts:19:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^^ - 20 │ @obj! class MyClass {} - 21 │ - - i An explicit or implicit semicolon is expected here... - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^^ - 20 │ @obj! class MyClass {} - 21 │ - - i ...Which is required to end this statement - - 17 │ @obj as MyType class MyClass {} - 18 │ @obj class MyClass {} - > 19 │ @obj satisfies MyType class MyClass {} - │ ^^^^^^^^^^^^ - 20 │ @obj! class MyClass {} - 21 │ - --- -decorator.ts:20:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `obj!` - - 18 │ @obj class MyClass {} - 19 │ @obj satisfies MyType class MyClass {} - > 20 │ @obj! class MyClass {} - │ ^^^^ - 21 │ - --- -@'dsads' class MyClass {} -@1 class MyClass {} -@++1 class MyClass {} -@[] in 1 class MyClass {} -@[] class MyClass {} -@() => {} class MyClass {} -@1 == 2 ? true : false class MyClass {} -@await fn class MyClass {} -@function(){} class MyClass {} -@obj instanceof Object class MyClass {} -@1 === 2 class MyClass {} -@new Object() class MyClass {} -@{} class MyClass {} -@a++ class MyClass {} -@a,b class MyClass {} -@`${d}foo` class MyClass {} -@obj as MyType class MyClass {} -@obj class MyClass {} -@obj satisfies MyType class MyClass {} -@obj! class MyClass {} diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast b/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast deleted file mode 100644 index 0ae95764243e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: ASYNC_KW@26..32 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@32..41 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@41..44 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@47..49 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@49..50 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@50..51 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..51 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..50 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_EXPORT@10..50 - 0: JS_DECORATOR_LIST@10..10 - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..50 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@26..50 - 0: ASYNC_KW@26..32 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@32..41 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@41..44 - 0: IDENT@41..44 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..45 - 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@47..50 - 0: L_CURLY@47..49 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@49..49 - 2: JS_STATEMENT_LIST@49..49 - 3: R_CURLY@49..50 "}" [] [] - 2: (empty) - 4: EOF@50..51 "" [Newline("\n")] [] --- -decorator_async_function_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ export default async function foo() { } - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -@decorator -export default async function foo() { } diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.rast b/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.rast deleted file mode 100644 index 547729bdc138..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.rast +++ /dev/null @@ -1,202 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "bar" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..32 "decorator" [] [], - }, - }, - }, - ], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@32..42 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@42..43 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@44..51 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@51..61 "decorator" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@61..62 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@62..72 "decorator2" [] [], - }, - }, - }, - ], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@72..87 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@87..90 "Foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@90..91 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@91..93 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@95..96 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@96..98 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@98..99 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..99 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..98 - 0: JS_FUNCTION_DECLARATION@0..98 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "bar" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..98 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..96 - 0: JS_BOGUS_STATEMENT@16..32 - 0: JS_DECORATOR@16..32 - 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@23..32 - 0: JS_REFERENCE_IDENTIFIER@23..32 - 0: IDENT@23..32 "decorator" [] [] - 1: JS_VARIABLE_STATEMENT@32..44 - 0: JS_VARIABLE_DECLARATION@32..43 - 0: (empty) - 1: LET_KW@32..42 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@42..43 - 0: JS_VARIABLE_DECLARATOR@42..43 - 0: JS_IDENTIFIER_BINDING@42..43 - 0: IDENT@42..43 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@43..44 ";" [] [] - 2: JS_BOGUS_STATEMENT@44..72 - 0: JS_DECORATOR@44..61 - 0: AT@44..51 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@51..61 - 0: JS_REFERENCE_IDENTIFIER@51..61 - 0: IDENT@51..61 "decorator" [] [Whitespace(" ")] - 1: JS_DECORATOR@61..72 - 0: AT@61..62 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@62..72 - 0: JS_REFERENCE_IDENTIFIER@62..72 - 0: IDENT@62..72 "decorator2" [] [] - 3: JS_FUNCTION_DECLARATION@72..96 - 0: (empty) - 1: FUNCTION_KW@72..87 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@87..90 - 0: IDENT@87..90 "Foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@90..93 - 0: L_PAREN@90..91 "(" [] [] - 1: JS_PARAMETER_LIST@91..91 - 2: R_PAREN@91..93 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@93..96 - 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@95..95 - 2: JS_STATEMENT_LIST@95..95 - 3: R_CURLY@95..96 "}" [] [] - 3: R_CURLY@96..98 "}" [Newline("\n")] [] - 4: EOF@98..99 "" [Newline("\n")] [] --- -decorator_class_declaration.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ function bar() { - > 2 │ @decorator - │ ^^^^^^^^^^ - 3 │ let a; - 4 │ @decorator @decorator2 - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_declaration.js:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ @decorator - 3 │ let a; - > 4 │ @decorator @decorator2 - │ ^^^^^^^^^^^^^^^^^^^^^^ - 5 │ function Foo() { } - 6 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -function bar() { - @decorator - let a; - @decorator @decorator2 - function Foo() { } -} diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast b/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast deleted file mode 100644 index 73e7709ed30f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast +++ /dev/null @@ -1,160 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@17..19 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@19..30 "decorator1" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@30..31 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..41 "decorator2" [] [], - }, - }, - }, - ], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@51..54 "Foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@54..55 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@55..57 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - }, - ], - eof_token: EOF@60..61 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..61 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..60 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_VARIABLE_STATEMENT@10..17 - 0: JS_VARIABLE_DECLARATION@10..16 - 0: (empty) - 1: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@15..16 - 0: JS_VARIABLE_DECLARATOR@15..16 - 0: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@16..17 ";" [] [] - 2: JS_BOGUS_STATEMENT@17..41 - 0: JS_DECORATOR@17..30 - 0: AT@17..19 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@19..30 - 0: JS_REFERENCE_IDENTIFIER@19..30 - 0: IDENT@19..30 "decorator1" [] [Whitespace(" ")] - 1: JS_DECORATOR@30..41 - 0: AT@30..31 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@31..41 - 0: JS_REFERENCE_IDENTIFIER@31..41 - 0: IDENT@31..41 "decorator2" [] [] - 3: JS_FUNCTION_DECLARATION@41..60 - 0: (empty) - 1: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@51..54 - 0: IDENT@51..54 "Foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@54..57 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_PARAMETER_LIST@55..55 - 2: R_PAREN@55..57 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@57..60 - 0: L_CURLY@57..59 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..60 "}" [] [] - 4: EOF@60..61 "" [Newline("\n")] [] --- -decorator_class_declaration_top_level.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ let a; - 3 │ @decorator1 @decorator2 - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_declaration_top_level.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ @decorator - 2 │ let a; - > 3 │ @decorator1 @decorator2 - │ ^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ function Foo() { } - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -@decorator -let a; -@decorator1 @decorator2 -function Foo() { } diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_member.rast b/crates/biome_js_parser/test_data/inline/err/decorator_class_member.rast deleted file mode 100644 index f3a4cfe74a61..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_class_member.rast +++ /dev/null @@ -1,713 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@11..16 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..20 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsLiteralMemberName { - value: IDENT@20..31 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@34..35 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@35..36 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@36..41 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..45 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - L_BRACK@45..46 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@46..51 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@51..53 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@53..59 "string" [] [], - }, - }, - }, - R_BRACK@59..60 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@60..62 ":" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@62..64 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@64..69 "props" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@71..78 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@78..79 "}" [] [], - }, - }, - ], - }, - ], - r_curly_token: R_CURLY@79..81 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@81..88 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@88..93 "Quiz" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@93..94 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@94..99 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@99..103 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@103..110 "public" [] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@110..121 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@121..122 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@122..124 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@124..125 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@126..128 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@128..135 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@135..139 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@139..147 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@147..151 "Foo" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@151..152 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@152..157 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@157..160 "dec" [] [], - }, - }, - }, - ], - }, - JsLiteralMemberName { - value: IDENT@160..175 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@175..176 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@176..177 ")" [] [], - }, - SEMICOLON@177..178 ";" [] [], - ], - }, - TsConstructorSignatureClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@178..193 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@193..194 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@194..195 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@195..197 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@197..203 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@203..204 ")" [] [], - }, - semicolon_token: missing (optional), - }, - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@204..219 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@219..220 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@220..221 "a" [] [], - }, - question_mark_token: QUESTION@221..222 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@222..224 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@224..230 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@230..232 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@232..233 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@233..234 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@234..236 "}" [Newline("\n")] [], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@236..245 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@245..251 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@251..255 "Baz" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@255..256 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@256..260 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@260..264 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@264..270 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@270..271 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@271..272 ")" [] [], - }, - SEMICOLON@272..273 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@273..277 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@277..281 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - GET_KW@281..285 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@285..288 "foo" [] [], - }, - L_PAREN@288..289 "(" [] [], - R_PAREN@289..290 ")" [] [], - SEMICOLON@290..291 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@291..295 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@295..299 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - SET_KW@299..303 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@303..306 "foo" [] [], - }, - L_PAREN@306..307 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@307..308 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - R_PAREN@308..309 ")" [] [], - SEMICOLON@309..310 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@310..312 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@312..313 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..313 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..312 - 0: JS_CLASS_DECLARATION@0..81 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..79 - 0: JS_BOGUS_MEMBER@11..36 - 0: JS_BOGUS@11..20 - 0: JS_DECORATOR@11..20 - 0: AT@11..16 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@16..20 - 0: JS_REFERENCE_IDENTIFIER@16..20 - 0: IDENT@16..20 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@20..31 - 0: IDENT@20..31 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@31..34 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..32 - 2: R_PAREN@32..34 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@34..36 - 0: L_CURLY@34..35 "{" [] [] - 1: JS_DIRECTIVE_LIST@35..35 - 2: JS_STATEMENT_LIST@35..35 - 3: R_CURLY@35..36 "}" [] [] - 1: JS_BOGUS_MEMBER@36..79 - 0: JS_BOGUS@36..45 - 0: JS_DECORATOR@36..45 - 0: AT@36..41 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@41..45 - 0: JS_REFERENCE_IDENTIFIER@41..45 - 0: IDENT@41..45 "dec" [] [Whitespace(" ")] - 1: L_BRACK@45..46 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@46..59 - 0: JS_IDENTIFIER_BINDING@46..51 - 0: IDENT@46..51 "index" [] [] - 1: TS_TYPE_ANNOTATION@51..59 - 0: COLON@51..53 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@53..59 - 0: STRING_KW@53..59 "string" [] [] - 3: R_BRACK@59..60 "]" [] [] - 4: TS_TYPE_ANNOTATION@60..79 - 0: COLON@60..62 ":" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@62..79 - 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@64..78 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@64..78 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@64..69 - 0: IDENT@64..69 "props" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@69..78 - 0: COLON@69..71 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@71..78 - 0: STRING_KW@71..78 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@78..79 "}" [] [] - 9: R_CURLY@79..81 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@81..128 - 0: JS_DECORATOR_LIST@81..81 - 1: (empty) - 2: CLASS_KW@81..88 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@88..93 - 0: IDENT@88..93 "Quiz" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@93..94 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@94..126 - 0: JS_BOGUS_MEMBER@94..126 - 0: JS_BOGUS@94..110 - 0: JS_DECORATOR@94..103 - 0: AT@94..99 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@99..103 - 0: JS_REFERENCE_IDENTIFIER@99..103 - 0: IDENT@99..103 "dec" [] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@103..110 - 0: PUBLIC_KW@103..110 "public" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@110..121 - 0: IDENT@110..121 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@121..124 - 0: L_PAREN@121..122 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@122..122 - 2: R_PAREN@122..124 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@124..126 - 0: L_CURLY@124..125 "{" [] [] - 1: JS_DIRECTIVE_LIST@125..125 - 2: JS_STATEMENT_LIST@125..125 - 3: R_CURLY@125..126 "}" [] [] - 9: R_CURLY@126..128 "}" [Newline("\n")] [] - 2: JS_CLASS_DECLARATION@128..236 - 0: JS_DECORATOR_LIST@128..128 - 1: (empty) - 2: CLASS_KW@128..135 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@135..139 - 0: IDENT@135..139 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@139..151 - 0: EXTENDS_KW@139..147 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@147..151 - 0: JS_REFERENCE_IDENTIFIER@147..151 - 0: IDENT@147..151 "Foo" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@151..152 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@152..234 - 0: JS_BOGUS_MEMBER@152..178 - 0: JS_BOGUS@152..160 - 0: JS_DECORATOR@152..160 - 0: AT@152..157 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@157..160 - 0: JS_REFERENCE_IDENTIFIER@157..160 - 0: IDENT@157..160 "dec" [] [] - 1: JS_LITERAL_MEMBER_NAME@160..175 - 0: IDENT@160..175 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@175..177 - 0: L_PAREN@175..176 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@176..176 - 2: R_PAREN@176..177 ")" [] [] - 3: SEMICOLON@177..178 ";" [] [] - 1: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@178..204 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@178..178 - 1: JS_LITERAL_MEMBER_NAME@178..193 - 0: IDENT@178..193 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@193..204 - 0: L_PAREN@193..194 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@194..203 - 0: JS_FORMAL_PARAMETER@194..203 - 0: JS_DECORATOR_LIST@194..194 - 1: JS_IDENTIFIER_BINDING@194..195 - 0: IDENT@194..195 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@195..203 - 0: COLON@195..197 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@197..203 - 0: JS_REFERENCE_IDENTIFIER@197..203 - 0: IDENT@197..203 "String" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@203..204 ")" [] [] - 3: (empty) - 2: JS_CONSTRUCTOR_CLASS_MEMBER@204..234 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@204..204 - 1: JS_LITERAL_MEMBER_NAME@204..219 - 0: IDENT@204..219 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@219..232 - 0: L_PAREN@219..220 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@220..230 - 0: JS_FORMAL_PARAMETER@220..230 - 0: JS_DECORATOR_LIST@220..220 - 1: JS_IDENTIFIER_BINDING@220..221 - 0: IDENT@220..221 "a" [] [] - 2: QUESTION@221..222 "?" [] [] - 3: TS_TYPE_ANNOTATION@222..230 - 0: COLON@222..224 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@224..230 - 0: JS_REFERENCE_IDENTIFIER@224..230 - 0: IDENT@224..230 "String" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@230..232 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@232..234 - 0: L_CURLY@232..233 "{" [] [] - 1: JS_DIRECTIVE_LIST@233..233 - 2: JS_STATEMENT_LIST@233..233 - 3: R_CURLY@233..234 "}" [] [] - 9: R_CURLY@234..236 "}" [Newline("\n")] [] - 3: TS_DECLARE_STATEMENT@236..312 - 0: DECLARE_KW@236..245 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@245..312 - 0: JS_DECORATOR_LIST@245..245 - 1: (empty) - 2: CLASS_KW@245..251 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@251..255 - 0: IDENT@251..255 "Baz" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@255..256 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@256..310 - 0: JS_BOGUS_MEMBER@256..273 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@256..264 - 0: JS_DECORATOR@256..264 - 0: AT@256..260 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@260..264 - 0: JS_REFERENCE_IDENTIFIER@260..264 - 0: IDENT@260..264 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@264..270 - 0: IDENT@264..270 "method" [] [] - 2: JS_PARAMETERS@270..272 - 0: L_PAREN@270..271 "(" [] [] - 1: JS_PARAMETER_LIST@271..271 - 2: R_PAREN@271..272 ")" [] [] - 3: SEMICOLON@272..273 ";" [] [] - 1: JS_BOGUS_MEMBER@273..291 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@273..281 - 0: JS_DECORATOR@273..281 - 0: AT@273..277 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@277..281 - 0: JS_REFERENCE_IDENTIFIER@277..281 - 0: IDENT@277..281 "dec" [] [Whitespace(" ")] - 1: GET_KW@281..285 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@285..288 - 0: IDENT@285..288 "foo" [] [] - 3: L_PAREN@288..289 "(" [] [] - 4: R_PAREN@289..290 ")" [] [] - 5: SEMICOLON@290..291 ";" [] [] - 2: JS_BOGUS_MEMBER@291..310 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@291..299 - 0: JS_DECORATOR@291..299 - 0: AT@291..295 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@295..299 - 0: JS_REFERENCE_IDENTIFIER@295..299 - 0: IDENT@295..299 "dec" [] [Whitespace(" ")] - 1: SET_KW@299..303 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@303..306 - 0: IDENT@303..306 "foo" [] [] - 3: L_PAREN@306..307 "(" [] [] - 4: JS_FORMAL_PARAMETER@307..308 - 0: JS_DECORATOR_LIST@307..307 - 1: JS_IDENTIFIER_BINDING@307..308 - 0: IDENT@307..308 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: R_PAREN@308..309 ")" [] [] - 6: SEMICOLON@309..310 ";" [] [] - 9: R_CURLY@310..312 "}" [Newline("\n")] [] - 4: EOF@312..313 "" [Newline("\n")] [] --- -decorator_class_member.ts:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class Foo { - > 2 │ @dec constructor() {} - │ ^^^^ - 3 │ @dec [index: string]: { props: string } - 4 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_member.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class Foo { - 2 │ @dec constructor() {} - > 3 │ @dec [index: string]: { props: string } - │ ^^^^ - 4 │ } - 5 │ class Quiz { - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_member.ts:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ } - 5 │ class Quiz { - > 6 │ @dec public constructor() {} - │ ^^^^ - 7 │ } - 8 │ class Bar extends Foo { - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_member.ts:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 7 │ } - 8 │ class Bar extends Foo { - > 9 │ @dec - │ ^^^^ - 10 │ constructor(); - 11 │ constructor(a: String) - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_member.ts:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 13 │ } - 14 │ declare class Baz { - > 15 │ @dec method(); - │ ^^^^ - 16 │ @dec get foo(); - 17 │ @dec set foo(a); - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_member.ts:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 14 │ declare class Baz { - 15 │ @dec method(); - > 16 │ @dec get foo(); - │ ^^^^ - 17 │ @dec set foo(a); - 18 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_class_member.ts:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 15 │ @dec method(); - 16 │ @dec get foo(); - > 17 │ @dec set foo(a); - │ ^^^^ - 18 │ } - 19 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -class Foo { - @dec constructor() {} - @dec [index: string]: { props: string } -} -class Quiz { - @dec public constructor() {} -} -class Bar extends Foo { - @dec - constructor(); - constructor(a: String) - constructor(a?: String) {} -} -declare class Baz { - @dec method(); - @dec get foo(); - @dec set foo(a); -} diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.rast b/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.rast deleted file mode 100644 index df3c8f12704f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.rast +++ /dev/null @@ -1,127 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@26..31 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@31..33 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@35..36 "X" [] [], - }, - initializer: missing (optional), - }, - COMMA@36..38 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@38..39 "Y" [] [], - }, - initializer: missing (optional), - }, - COMMA@39..41 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@41..43 "Z" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - ], - }, - ], - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_BOGUS_STATEMENT@10..44 - 0: JS_DECORATOR_LIST@10..10 - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@18..44 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: TS_ENUM_DECLARATION@26..44 - 0: (empty) - 1: ENUM_KW@26..31 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "A" [] [Whitespace(" ")] - 3: L_CURLY@33..35 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@35..43 - 0: TS_ENUM_MEMBER@35..36 - 0: TS_LITERAL_ENUM_MEMBER_NAME@35..36 - 0: IDENT@35..36 "X" [] [] - 1: (empty) - 1: COMMA@36..38 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@38..39 - 0: TS_LITERAL_ENUM_MEMBER_NAME@38..39 - 0: IDENT@38..39 "Y" [] [] - 1: (empty) - 3: COMMA@39..41 "," [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER@41..43 - 0: TS_LITERAL_ENUM_MEMBER_NAME@41..43 - 0: IDENT@41..43 "Z" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@43..44 "}" [] [] - 4: EOF@44..45 "" [Newline("\n")] [] --- -decorator_enum_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ export default enum A { X, Y, Z } - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_enum_export_default_declaration_clause.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. - - 1 │ @decorator - > 2 │ export default enum A { X, Y, Z } - │ ^^^^^^^^^^^^^^^^^^ - 3 │ - --- -@decorator -export default enum A { X, Y, Z } diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export.rast b/crates/biome_js_parser/test_data/inline/err/decorator_export.rast deleted file mode 100644 index bb34427fda85..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_export.rast +++ /dev/null @@ -1,269 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsDecoratorList [ - JsDecorator { - at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..32 "decorator" [] [], - }, - }, - }, - ], - EXPORT_KW@32..45 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@45..51 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@51..55 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [ - JsDecorator { - at_token: AT@58..65 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@65..70 "first" [] [], - }, - }, - operator_token: DOT@70..71 "." [] [], - member: JsName { - value_token: IDENT@71..77 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@77..78 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..85 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@85..86 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@86..87 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@87..88 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@88..90 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@93..102 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@102..103 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@103..104 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@104..105 ")" [] [], - }, - }, - }, - ], - EXPORT_KW@105..118 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@118..124 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@124..128 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@128..129 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@129..130 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@130..132 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@132..133 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..133 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..132 - 0: JS_FUNCTION_DECLARATION@0..132 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..132 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..130 - 0: JS_BOGUS_STATEMENT@16..58 - 0: JS_DECORATOR_LIST@16..32 - 0: JS_DECORATOR@16..32 - 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@23..32 - 0: JS_REFERENCE_IDENTIFIER@23..32 - 0: IDENT@23..32 "decorator" [] [] - 1: EXPORT_KW@32..45 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@45..58 - 0: JS_DECORATOR_LIST@45..45 - 1: (empty) - 2: CLASS_KW@45..51 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@51..55 - 0: IDENT@51..55 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@55..57 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@57..57 - 9: R_CURLY@57..58 "}" [] [] - 1: JS_BOGUS_STATEMENT@58..130 - 0: JS_DECORATOR_LIST@58..105 - 0: JS_DECORATOR@58..77 - 0: AT@58..65 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@65..77 - 0: JS_IDENTIFIER_EXPRESSION@65..70 - 0: JS_REFERENCE_IDENTIFIER@65..70 - 0: IDENT@65..70 "first" [] [] - 1: DOT@70..71 "." [] [] - 2: JS_NAME@71..77 - 0: IDENT@71..77 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@77..85 - 0: AT@77..78 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@78..85 - 0: JS_REFERENCE_IDENTIFIER@78..85 - 0: IDENT@78..85 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@85..105 - 0: AT@85..86 "@" [] [] - 1: JS_CALL_EXPRESSION@86..105 - 0: JS_PARENTHESIZED_EXPRESSION@86..103 - 0: L_PAREN@86..87 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@87..102 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@87..90 - 0: L_PAREN@87..88 "(" [] [] - 1: JS_PARAMETER_LIST@88..88 - 2: R_PAREN@88..90 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@93..102 - 0: JS_REFERENCE_IDENTIFIER@93..102 - 0: IDENT@93..102 "decorator" [] [] - 2: R_PAREN@102..103 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@103..105 - 0: L_PAREN@103..104 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@104..104 - 2: R_PAREN@104..105 ")" [] [] - 1: EXPORT_KW@105..118 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@118..130 - 0: JS_DECORATOR_LIST@118..118 - 1: (empty) - 2: CLASS_KW@118..124 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@124..128 - 0: IDENT@124..128 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@128..129 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@129..129 - 9: R_CURLY@129..130 "}" [] [] - 3: R_CURLY@130..132 "}" [Newline("\n")] [] - 4: EOF@132..133 "" [Newline("\n")] [] --- -decorator_export.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of an export declaration not at the top level - - 1 │ function foo() { - > 2 │ @decorator - │ ^^^^^^^^^^ - > 3 │ export class Foo { } - │ ^^^^^^^^^^^^^^^^^^^^ - 4 │ @first.field @second @(() => decorator)() - 5 │ export class Bar {} - - i move this declaration to the top level - --- -decorator_export.js:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of an export declaration not at the top level - - 2 │ @decorator - 3 │ export class Foo { } - > 4 │ @first.field @second @(() => decorator)() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - > 5 │ export class Bar {} - │ ^^^^^^^^^^^^^^^^^^^ - 6 │ } - 7 │ - - i move this declaration to the top level - --- -function foo() { - @decorator - export class Foo { } - @first.field @second @(() => decorator)() - export class Bar {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.rast b/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.rast deleted file mode 100644 index cdb3c69ce745..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.rast +++ /dev/null @@ -1,174 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@18..22 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@22..23 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@24..26 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..37 "decorator1" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@37..38 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..48 "decorator2" [] [], - }, - }, - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@56..65 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@65..68 "Foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@68..69 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@73..74 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..74 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_EXPORT@10..24 - 0: JS_DECORATOR_LIST@10..10 - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@18..24 - 0: JS_VARIABLE_DECLARATION@18..23 - 0: (empty) - 1: LET_KW@18..22 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@22..23 - 0: JS_VARIABLE_DECLARATOR@22..23 - 0: JS_IDENTIFIER_BINDING@22..23 - 0: IDENT@22..23 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@23..24 ";" [] [] - 2: JS_BOGUS_STATEMENT@24..48 - 0: JS_DECORATOR@24..37 - 0: AT@24..26 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@26..37 - 0: JS_REFERENCE_IDENTIFIER@26..37 - 0: IDENT@26..37 "decorator1" [] [Whitespace(" ")] - 1: JS_DECORATOR@37..48 - 0: AT@37..38 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..48 - 0: JS_REFERENCE_IDENTIFIER@38..48 - 0: IDENT@38..48 "decorator2" [] [] - 3: JS_EXPORT@48..74 - 0: JS_DECORATOR_LIST@48..48 - 1: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@56..74 - 0: (empty) - 1: FUNCTION_KW@56..65 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@65..68 - 0: IDENT@65..68 "Foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@68..71 - 0: L_PAREN@68..69 "(" [] [] - 1: JS_PARAMETER_LIST@69..69 - 2: R_PAREN@69..71 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@71..74 - 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@73..73 - 2: JS_STATEMENT_LIST@73..73 - 3: R_CURLY@73..74 "}" [] [] - 4: EOF@74..75 "" [Newline("\n")] [] --- -decorator_export_class_clause.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ export let a; - 3 │ @decorator1 @decorator2 - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_export_class_clause.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ @decorator - 2 │ export let a; - > 3 │ @decorator1 @decorator2 - │ ^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ export function Foo() { } - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -@decorator -export let a; -@decorator1 @decorator2 -export function Foo() { } diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.rast b/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.rast deleted file mode 100644 index 4c1bed0b5018..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.rast +++ /dev/null @@ -1,70 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultExpressionClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..27 "a" [] [], - }, - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_EXPORT@10..28 - 0: JS_DECORATOR_LIST@10..10 - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@18..28 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@26..27 - 0: JS_REFERENCE_IDENTIFIER@26..27 - 0: IDENT@26..27 "a" [] [] - 2: SEMICOLON@27..28 ";" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] --- -decorator_export_default_expression_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ export default a; - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -@decorator -export default a; diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.rast b/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.rast deleted file mode 100644 index 480e90d3b848..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.rast +++ /dev/null @@ -1,384 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@0..4 "let" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - EQ@6..8 "=" [] [Whitespace(" ")], - JsBogusExpression { - items: [ - JsDecorator { - at_token: AT@8..9 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..19 "decorator" [] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@19..20 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: missing (required), - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - ], - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@27..28 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsIdentifierBinding { - name_token: IDENT@33..35 "b" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - EQ@35..37 "=" [] [Whitespace(" ")], - JsBogusExpression { - items: [ - JsDecorator { - at_token: AT@37..38 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..44 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@44..45 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..52 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@52..61 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@61..64 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@64..65 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@67..68 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@68..69 "}" [] [], - }, - }, - ], - }, - ], - }, - ], - }, - ], - }, - ], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@69..74 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@74..76 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - JsDecorator { - at_token: AT@78..79 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@79..89 "decorator" [] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@89..91 "(" [] [Whitespace(" ")], - args: JsCallArgumentList [ - JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@91..92 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@92..94 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@94..97 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@97..98 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@98..100 "}" [] [Whitespace(" ")], - }, - }, - ], - r_paren_token: R_PAREN@100..101 ")" [] [], - }, - }, - }, - ], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@101..102 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..102 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..101 - 0: JS_BOGUS_STATEMENT@0..28 - 0: JS_BOGUS@0..27 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_BOGUS@4..27 - 0: JS_BOGUS@4..27 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: JS_BOGUS@6..27 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@8..22 - 0: JS_DECORATOR@8..22 - 0: AT@8..9 "@" [] [] - 1: JS_CALL_EXPRESSION@9..22 - 0: JS_IDENTIFIER_EXPRESSION@9..19 - 0: JS_REFERENCE_IDENTIFIER@9..19 - 0: IDENT@9..19 "decorator" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@19..22 - 0: L_PAREN@19..20 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@20..20 - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 2: JS_ARROW_FUNCTION_EXPRESSION@22..27 - 0: (empty) - 1: (empty) - 2: (empty) - 3: (empty) - 4: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..26 - 3: R_CURLY@26..27 "}" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_BOGUS_STATEMENT@28..69 - 0: JS_BOGUS@28..69 - 0: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@33..69 - 0: JS_BOGUS@33..69 - 0: JS_IDENTIFIER_BINDING@33..35 - 0: IDENT@33..35 "b" [] [Whitespace(" ")] - 1: JS_BOGUS@35..69 - 0: EQ@35..37 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@37..52 - 0: JS_DECORATOR@37..44 - 0: AT@37..38 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..44 - 0: JS_REFERENCE_IDENTIFIER@38..44 - 0: IDENT@38..44 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@44..52 - 0: AT@44..45 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@45..52 - 0: JS_REFERENCE_IDENTIFIER@45..52 - 0: IDENT@45..52 "second" [] [Whitespace(" ")] - 2: JS_FUNCTION_EXPRESSION@52..69 - 0: (empty) - 1: FUNCTION_KW@52..61 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@61..64 - 0: IDENT@61..64 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@64..67 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_PARAMETER_LIST@65..65 - 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@67..69 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_DIRECTIVE_LIST@68..68 - 2: JS_STATEMENT_LIST@68..68 - 3: R_CURLY@68..69 "}" [] [] - 2: JS_VARIABLE_STATEMENT@69..101 - 0: JS_VARIABLE_DECLARATION@69..101 - 0: (empty) - 1: LET_KW@69..74 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@74..101 - 0: JS_VARIABLE_DECLARATOR@74..101 - 0: JS_IDENTIFIER_BINDING@74..76 - 0: IDENT@74..76 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@76..101 - 0: EQ@76..78 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@78..101 - 0: JS_DECORATOR@78..101 - 0: AT@78..79 "@" [] [] - 1: JS_CALL_EXPRESSION@79..101 - 0: JS_IDENTIFIER_EXPRESSION@79..89 - 0: JS_REFERENCE_IDENTIFIER@79..89 - 0: IDENT@79..89 "decorator" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@89..101 - 0: L_PAREN@89..91 "(" [] [Whitespace(" ")] - 1: JS_CALL_ARGUMENT_LIST@91..100 - 0: JS_ARROW_FUNCTION_EXPRESSION@91..100 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@91..94 - 0: L_PAREN@91..92 "(" [] [] - 1: JS_PARAMETER_LIST@92..92 - 2: R_PAREN@92..94 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@94..97 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@97..100 - 0: L_CURLY@97..98 "{" [] [] - 1: JS_DIRECTIVE_LIST@98..98 - 2: JS_STATEMENT_LIST@98..98 - 3: R_CURLY@98..100 "}" [] [Whitespace(" ")] - 2: R_PAREN@100..101 ")" [] [] - 1: (empty) - 4: EOF@101..102 "" [Newline("\n")] [] --- -decorator_expression_class.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ let a = @decorator () => {}; - │ ^^^^^^^^^^^^^ - 2 │ let b = @first @second function foo() {} - 3 │ let a = @decorator ( () => {} ) - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_expression_class.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parenthesis '(' but instead found '=>'. - - > 1 │ let a = @decorator () => {}; - │ ^^ - 2 │ let b = @first @second function foo() {} - 3 │ let a = @decorator ( () => {} ) - - i Expected a parenthesis '(' here. - - > 1 │ let a = @decorator () => {}; - │ ^^ - 2 │ let b = @first @second function foo() {} - 3 │ let a = @decorator ( () => {} ) - --- -decorator_expression_class.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ let a = @decorator () => {}; - > 2 │ let b = @first @second function foo() {} - │ ^^^^^^^^^^^^^^ - 3 │ let a = @decorator ( () => {} ) - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_expression_class.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ let a = @decorator () => {}; - 2 │ let b = @first @second function foo() {} - > 3 │ let a = @decorator ( () => {} ) - │ ^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -decorator_expression_class.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found the end of the file. - - 2 │ let b = @first @second function foo() {} - 3 │ let a = @decorator ( () => {} ) - > 4 │ - │ - - i Expected an expression, or an assignment here. - - 2 │ let b = @first @second function foo() {} - 3 │ let a = @decorator ( () => {} ) - > 4 │ - │ - --- -let a = @decorator () => {}; -let b = @first @second function foo() {} -let a = @decorator ( () => {} ) diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.rast b/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.rast deleted file mode 100644 index 63ea7b6447f0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@26..35 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@35..38 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_EXPORT@10..44 - 0: JS_DECORATOR_LIST@10..10 - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..44 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@26..44 - 0: (empty) - 1: FUNCTION_KW@26..35 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@35..38 - 0: IDENT@35..38 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@38..41 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..39 - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@41..44 - 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@43..43 - 2: JS_STATEMENT_LIST@43..43 - 3: R_CURLY@43..44 "}" [] [] - 2: (empty) - 4: EOF@44..45 "" [Newline("\n")] [] --- -decorator_function_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ export default function foo() { } - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -@decorator -export default function foo() { } diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.rast b/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.rast deleted file mode 100644 index 29a791cbb842..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.rast +++ /dev/null @@ -1,82 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@26..36 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@36..38 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@41..42 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..42 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..41 - 0: JS_BOGUS_STATEMENT@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: JS_EXPORT@10..41 - 0: JS_DECORATOR_LIST@10..10 - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..41 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@26..41 - 0: INTERFACE_KW@26..36 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@36..38 - 0: IDENT@36..38 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@40..40 - 6: R_CURLY@40..41 "}" [] [] - 2: (empty) - 4: EOF@41..42 "" [Newline("\n")] [] --- -decorator_interface_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ @decorator - │ ^^^^^^^^^^ - 2 │ export default interface A { } - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -@decorator -export default interface A { } diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.rast b/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.rast deleted file mode 100644 index 819618032276..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.rast +++ /dev/null @@ -1,746 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@11..21 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@21..22 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@22..26 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - GET_KW@26..30 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@30..33 "foo" [] [], - }, - L_PAREN@33..34 "(" [] [], - R_PAREN@34..36 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@36..37 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@38..48 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@48..49 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..53 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@53..56 "foo" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@56..58 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@58..64 "string" [] [], - }, - }, - SEMICOLON@64..65 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsReadonlyModifier { - modifier_token: READONLY_KW@65..77 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@77..78 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..82 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsLiteralMemberName { - value: IDENT@82..86 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@86..87 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@87..89 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@89..90 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@90..91 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@91..102 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@102..103 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@103..107 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@107..111 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@111..112 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@112..114 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@114..115 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@115..116 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@116..129 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@129..130 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@130..134 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@134..138 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@138..139 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@139..141 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@141..142 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@142..143 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@143..145 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@152..156 "Qux" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@156..164 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@164..168 "Bar" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@168..169 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@169..179 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@179..180 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@180..184 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - GET_KW@184..188 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@188..191 "foo" [] [], - }, - L_PAREN@191..192 "(" [] [], - R_PAREN@192..194 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@194..195 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@195..196 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@196..206 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@206..207 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@207..211 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@211..214 "foo" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@214..216 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@216..222 "string" [] [], - }, - }, - SEMICOLON@222..223 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsReadonlyModifier { - modifier_token: READONLY_KW@223..235 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@235..236 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@236..240 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsLiteralMemberName { - value: IDENT@240..244 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@244..245 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@247..248 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@248..249 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@249..260 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@260..261 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@261..265 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@265..269 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@269..270 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@270..272 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@272..273 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@273..274 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@274..286 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsDecorator { - at_token: AT@286..287 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@287..291 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsLiteralMemberName { - value: IDENT@291..295 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@295..296 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@296..298 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@298..299 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@299..300 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@300..302 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@302..303 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..303 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..302 - 0: JS_CLASS_DECLARATION@0..145 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..143 - 0: JS_BOGUS_MEMBER@11..38 - 0: JS_METHOD_MODIFIER_LIST@11..26 - 0: TS_ACCESSIBILITY_MODIFIER@11..21 - 0: PUBLIC_KW@11..21 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@21..26 - 0: AT@21..22 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@22..26 - 0: JS_REFERENCE_IDENTIFIER@22..26 - 0: IDENT@22..26 "dec" [] [Whitespace(" ")] - 1: GET_KW@26..30 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@30..33 - 0: IDENT@30..33 "foo" [] [] - 3: L_PAREN@33..34 "(" [] [] - 4: R_PAREN@34..36 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@36..38 - 0: L_CURLY@36..37 "{" [] [] - 1: JS_DIRECTIVE_LIST@37..37 - 2: JS_STATEMENT_LIST@37..37 - 3: R_CURLY@37..38 "}" [] [] - 1: JS_BOGUS_MEMBER@38..65 - 0: JS_PROPERTY_MODIFIER_LIST@38..53 - 0: JS_STATIC_MODIFIER@38..48 - 0: STATIC_KW@38..48 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@48..53 - 0: AT@48..49 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@49..53 - 0: JS_REFERENCE_IDENTIFIER@49..53 - 0: IDENT@49..53 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@53..56 - 0: IDENT@53..56 "foo" [] [] - 2: TS_TYPE_ANNOTATION@56..64 - 0: COLON@56..58 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@58..64 - 0: STRING_KW@58..64 "string" [] [] - 3: SEMICOLON@64..65 ";" [] [] - 2: JS_BOGUS_MEMBER@65..91 - 0: JS_BOGUS@65..82 - 0: TS_READONLY_MODIFIER@65..77 - 0: READONLY_KW@65..77 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@77..82 - 0: AT@77..78 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@78..82 - 0: JS_REFERENCE_IDENTIFIER@78..82 - 0: IDENT@78..82 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@82..86 - 0: IDENT@82..86 "test" [] [] - 2: JS_PARAMETERS@86..89 - 0: L_PAREN@86..87 "(" [] [] - 1: JS_PARAMETER_LIST@87..87 - 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@89..91 - 0: L_CURLY@89..90 "{" [] [] - 1: JS_DIRECTIVE_LIST@90..90 - 2: JS_STATEMENT_LIST@90..90 - 3: R_CURLY@90..91 "}" [] [] - 3: JS_BOGUS_MEMBER@91..116 - 0: JS_METHOD_MODIFIER_LIST@91..107 - 0: TS_ACCESSIBILITY_MODIFIER@91..102 - 0: PRIVATE_KW@91..102 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@102..107 - 0: AT@102..103 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@103..107 - 0: JS_REFERENCE_IDENTIFIER@103..107 - 0: IDENT@103..107 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@107..111 - 0: IDENT@107..111 "test" [] [] - 2: JS_PARAMETERS@111..114 - 0: L_PAREN@111..112 "(" [] [] - 1: JS_PARAMETER_LIST@112..112 - 2: R_PAREN@112..114 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@114..116 - 0: L_CURLY@114..115 "{" [] [] - 1: JS_DIRECTIVE_LIST@115..115 - 2: JS_STATEMENT_LIST@115..115 - 3: R_CURLY@115..116 "}" [] [] - 4: JS_BOGUS_MEMBER@116..143 - 0: JS_METHOD_MODIFIER_LIST@116..134 - 0: TS_ACCESSIBILITY_MODIFIER@116..129 - 0: PROTECTED_KW@116..129 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@129..134 - 0: AT@129..130 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@130..134 - 0: JS_REFERENCE_IDENTIFIER@130..134 - 0: IDENT@130..134 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@134..138 - 0: IDENT@134..138 "test" [] [] - 2: JS_PARAMETERS@138..141 - 0: L_PAREN@138..139 "(" [] [] - 1: JS_PARAMETER_LIST@139..139 - 2: R_PAREN@139..141 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@141..143 - 0: L_CURLY@141..142 "{" [] [] - 1: JS_DIRECTIVE_LIST@142..142 - 2: JS_STATEMENT_LIST@142..142 - 3: R_CURLY@142..143 "}" [] [] - 9: R_CURLY@143..145 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@145..302 - 0: JS_DECORATOR_LIST@145..145 - 1: (empty) - 2: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@152..156 - 0: IDENT@152..156 "Qux" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@156..168 - 0: EXTENDS_KW@156..164 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@164..168 - 0: JS_REFERENCE_IDENTIFIER@164..168 - 0: IDENT@164..168 "Bar" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@168..169 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@169..300 - 0: JS_BOGUS_MEMBER@169..196 - 0: JS_METHOD_MODIFIER_LIST@169..184 - 0: TS_ACCESSIBILITY_MODIFIER@169..179 - 0: PUBLIC_KW@169..179 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@179..184 - 0: AT@179..180 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@180..184 - 0: JS_REFERENCE_IDENTIFIER@180..184 - 0: IDENT@180..184 "dec" [] [Whitespace(" ")] - 1: GET_KW@184..188 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@188..191 - 0: IDENT@188..191 "foo" [] [] - 3: L_PAREN@191..192 "(" [] [] - 4: R_PAREN@192..194 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@194..196 - 0: L_CURLY@194..195 "{" [] [] - 1: JS_DIRECTIVE_LIST@195..195 - 2: JS_STATEMENT_LIST@195..195 - 3: R_CURLY@195..196 "}" [] [] - 1: JS_BOGUS_MEMBER@196..223 - 0: JS_PROPERTY_MODIFIER_LIST@196..211 - 0: JS_STATIC_MODIFIER@196..206 - 0: STATIC_KW@196..206 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@206..211 - 0: AT@206..207 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@207..211 - 0: JS_REFERENCE_IDENTIFIER@207..211 - 0: IDENT@207..211 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@211..214 - 0: IDENT@211..214 "foo" [] [] - 2: TS_TYPE_ANNOTATION@214..222 - 0: COLON@214..216 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@216..222 - 0: STRING_KW@216..222 "string" [] [] - 3: SEMICOLON@222..223 ";" [] [] - 2: JS_BOGUS_MEMBER@223..249 - 0: JS_BOGUS@223..240 - 0: TS_READONLY_MODIFIER@223..235 - 0: READONLY_KW@223..235 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@235..240 - 0: AT@235..236 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@236..240 - 0: JS_REFERENCE_IDENTIFIER@236..240 - 0: IDENT@236..240 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@240..244 - 0: IDENT@240..244 "test" [] [] - 2: JS_PARAMETERS@244..247 - 0: L_PAREN@244..245 "(" [] [] - 1: JS_PARAMETER_LIST@245..245 - 2: R_PAREN@245..247 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@247..249 - 0: L_CURLY@247..248 "{" [] [] - 1: JS_DIRECTIVE_LIST@248..248 - 2: JS_STATEMENT_LIST@248..248 - 3: R_CURLY@248..249 "}" [] [] - 3: JS_BOGUS_MEMBER@249..274 - 0: JS_METHOD_MODIFIER_LIST@249..265 - 0: TS_ACCESSIBILITY_MODIFIER@249..260 - 0: PRIVATE_KW@249..260 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@260..265 - 0: AT@260..261 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@261..265 - 0: JS_REFERENCE_IDENTIFIER@261..265 - 0: IDENT@261..265 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@265..269 - 0: IDENT@265..269 "test" [] [] - 2: JS_PARAMETERS@269..272 - 0: L_PAREN@269..270 "(" [] [] - 1: JS_PARAMETER_LIST@270..270 - 2: R_PAREN@270..272 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@272..274 - 0: L_CURLY@272..273 "{" [] [] - 1: JS_DIRECTIVE_LIST@273..273 - 2: JS_STATEMENT_LIST@273..273 - 3: R_CURLY@273..274 "}" [] [] - 4: JS_BOGUS_MEMBER@274..300 - 0: JS_BOGUS@274..291 - 0: JS_ACCESSOR_MODIFIER@274..286 - 0: ACCESSOR_KW@274..286 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_DECORATOR@286..291 - 0: AT@286..287 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@287..291 - 0: JS_REFERENCE_IDENTIFIER@287..291 - 0: IDENT@287..291 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@291..295 - 0: IDENT@291..295 "test" [] [] - 2: JS_PARAMETERS@295..298 - 0: L_PAREN@295..296 "(" [] [] - 1: JS_PARAMETER_LIST@296..296 - 2: R_PAREN@296..298 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@298..300 - 0: L_CURLY@298..299 "{" [] [] - 1: JS_DIRECTIVE_LIST@299..299 - 2: JS_STATEMENT_LIST@299..299 - 3: R_CURLY@299..300 "}" [] [] - 9: R_CURLY@300..302 "}" [Newline("\n")] [] - 4: EOF@302..303 "" [Newline("\n")] [] --- -decorator_precede_class_member.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 1 │ class Bar { - > 2 │ public @dec get foo() {} - │ ^^^^ - 3 │ static @dec foo: string; - 4 │ readonly @dec test() {} - --- -decorator_precede_class_member.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 1 │ class Bar { - 2 │ public @dec get foo() {} - > 3 │ static @dec foo: string; - │ ^^^^ - 4 │ readonly @dec test() {} - 5 │ private @dec test() {} - --- -decorator_precede_class_member.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Readonly can only appear on a property declaration or index signature. - - 2 │ public @dec get foo() {} - 3 │ static @dec foo: string; - > 4 │ readonly @dec test() {} - │ ^^^^^^^^ - 5 │ private @dec test() {} - 6 │ protected @dec test() {} - --- -decorator_precede_class_member.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 2 │ public @dec get foo() {} - 3 │ static @dec foo: string; - > 4 │ readonly @dec test() {} - │ ^^^^ - 5 │ private @dec test() {} - 6 │ protected @dec test() {} - --- -decorator_precede_class_member.ts:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 3 │ static @dec foo: string; - 4 │ readonly @dec test() {} - > 5 │ private @dec test() {} - │ ^^^^ - 6 │ protected @dec test() {} - 7 │ } - --- -decorator_precede_class_member.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 4 │ readonly @dec test() {} - 5 │ private @dec test() {} - > 6 │ protected @dec test() {} - │ ^^^^ - 7 │ } - 8 │ class Qux extends Bar { - --- -decorator_precede_class_member.ts:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 7 │ } - 8 │ class Qux extends Bar { - > 9 │ public @dec get foo() {} - │ ^^^^ - 10 │ static @dec foo: string; - 11 │ readonly @dec test() {} - --- -decorator_precede_class_member.ts:10:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 8 │ class Qux extends Bar { - 9 │ public @dec get foo() {} - > 10 │ static @dec foo: string; - │ ^^^^ - 11 │ readonly @dec test() {} - 12 │ private @dec test() {} - --- -decorator_precede_class_member.ts:11:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Readonly can only appear on a property declaration or index signature. - - 9 │ public @dec get foo() {} - 10 │ static @dec foo: string; - > 11 │ readonly @dec test() {} - │ ^^^^^^^^ - 12 │ private @dec test() {} - 13 │ accessor @dec test() {} - --- -decorator_precede_class_member.ts:11:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 9 │ public @dec get foo() {} - 10 │ static @dec foo: string; - > 11 │ readonly @dec test() {} - │ ^^^^ - 12 │ private @dec test() {} - 13 │ accessor @dec test() {} - --- -decorator_precede_class_member.ts:12:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 10 │ static @dec foo: string; - 11 │ readonly @dec test() {} - > 12 │ private @dec test() {} - │ ^^^^ - 13 │ accessor @dec test() {} - 14 │ } - --- -decorator_precede_class_member.ts:13:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' modifier is only allowed on properties. - - 11 │ readonly @dec test() {} - 12 │ private @dec test() {} - > 13 │ accessor @dec test() {} - │ ^^^^^^^^ - 14 │ } - 15 │ - --- -decorator_precede_class_member.ts:13:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators must precede the name and all keywords of property declarations. - - 11 │ readonly @dec test() {} - 12 │ private @dec test() {} - > 13 │ accessor @dec test() {} - │ ^^^^ - 14 │ } - 15 │ - --- -class Bar { - public @dec get foo() {} - static @dec foo: string; - readonly @dec test() {} - private @dec test() {} - protected @dec test() {} -} -class Qux extends Bar { - public @dec get foo() {} - static @dec foo: string; - readonly @dec test() {} - private @dec test() {} - accessor @dec test() {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.rast b/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.rast deleted file mode 100644 index 433a1ca4b7c8..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.rast +++ /dev/null @@ -1,354 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsDoWhileStatement { - do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@3..5 "{" [] [Whitespace(" ")], - statements: JsStatementList [], - r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], - }, - while_token: missing (required), - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - BREAK_KW@7..13 "break" [] [Whitespace(" ")], - ], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@13..14 "(" [] [], - expression: missing (required), - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - CONTINUE_KW@14..22 "continue" [] [], - ], - }, - JsBogusStatement { - items: [ - R_PAREN@22..23 ")" [] [], - ], - }, - JsDoWhileStatement { - do_token: DO_KW@23..27 "do" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..31 "}" [] [Whitespace(" ")], - }, - while_token: missing (required), - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - CONTINUE_KW@31..40 "continue" [] [Whitespace(" ")], - ], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@40..41 "(" [] [], - expression: missing (required), - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - BREAK_KW@41..46 "break" [] [], - ], - }, - JsBogusStatement { - items: [ - R_PAREN@46..47 ")" [] [], - ], - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_DO_WHILE_STATEMENT@0..7 - 0: DO_KW@0..3 "do" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@3..7 - 0: L_CURLY@3..5 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@5..5 - 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 1: JS_BOGUS_STATEMENT@7..13 - 0: BREAK_KW@7..13 "break" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@13..14 - 0: JS_PARENTHESIZED_EXPRESSION@13..14 - 0: L_PAREN@13..14 "(" [] [] - 1: (empty) - 2: (empty) - 1: (empty) - 3: JS_BOGUS_STATEMENT@14..22 - 0: CONTINUE_KW@14..22 "continue" [] [] - 4: JS_BOGUS_STATEMENT@22..23 - 0: R_PAREN@22..23 ")" [] [] - 5: JS_DO_WHILE_STATEMENT@23..31 - 0: DO_KW@23..27 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@27..31 - 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@29..29 - 2: R_CURLY@29..31 "}" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 6: JS_BOGUS_STATEMENT@31..40 - 0: CONTINUE_KW@31..40 "continue" [] [Whitespace(" ")] - 7: JS_EXPRESSION_STATEMENT@40..41 - 0: JS_PARENTHESIZED_EXPRESSION@40..41 - 0: L_PAREN@40..41 "(" [] [] - 1: (empty) - 2: (empty) - 1: (empty) - 8: JS_BOGUS_STATEMENT@41..46 - 0: BREAK_KW@41..46 "break" [] [] - 9: JS_BOGUS_STATEMENT@46..47 - 0: R_PAREN@46..47 ")" [] [] - 4: EOF@47..48 "" [Newline("\n")] [] --- -do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `while` but instead found `break` - - > 1 │ do { } break (continue) - │ ^^^^^ - 2 │ do { } continue (break) - 3 │ - - i Remove break - --- -do_while_no_continue_break.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ do { } break (continue) - │ ^ - 2 │ do { } continue (break) - 3 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ do { } break (continue) - │ ^ - 2 │ do { } continue (break) - 3 │ - - i ...Which is required to end this statement - - > 1 │ do { } break (continue) - │ ^^^^^^^ - 2 │ do { } continue (break) - 3 │ - --- -do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `break` statement can only be used within an enclosing iteration or switch statement. - - > 1 │ do { } break (continue) - │ ^^^^^ - 2 │ do { } continue (break) - 3 │ - --- -do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `continue` - - > 1 │ do { } break (continue) - │ ^^^^^^^^ - 2 │ do { } continue (break) - 3 │ - - i Remove continue - --- -do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ do { } break (continue) - │ ^ - 2 │ do { } continue (break) - 3 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ do { } break (continue) - │ ^ - 2 │ do { } continue (break) - 3 │ - - i ...Which is required to end this statement - - > 1 │ do { } break (continue) - │ ^^^^^^^^^ - 2 │ do { } continue (break) - 3 │ - --- -do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. - - > 1 │ do { } break (continue) - │ ^^^^^^^^ - 2 │ do { } continue (break) - 3 │ - --- -do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found ')'. - - > 1 │ do { } break (continue) - │ ^ - 2 │ do { } continue (break) - 3 │ - - i Expected a statement here. - - > 1 │ do { } break (continue) - │ ^ - 2 │ do { } continue (break) - 3 │ - --- -do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `while` but instead found `continue` - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^^^^^^^^ - 3 │ - - i Remove continue - --- -do_while_no_continue_break.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^ - 3 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^ - 3 │ - - i ...Which is required to end this statement - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^^^^^^^^^^ - 3 │ - --- -do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^^^^^^^^ - 3 │ - --- -do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `break` - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^^^^^ - 3 │ - - i Remove break - --- -do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^ - 3 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^ - 3 │ - - i ...Which is required to end this statement - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^^^^^^ - 3 │ - --- -do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A `break` statement can only be used within an enclosing iteration or switch statement. - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^^^^^ - 3 │ - --- -do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found ')'. - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^ - 3 │ - - i Expected a statement here. - - 1 │ do { } break (continue) - > 2 │ do { } continue (break) - │ ^ - 3 │ - --- -do { } break (continue) -do { } continue (break) diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.rast deleted file mode 100644 index 8fbf8c762c1f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.rast +++ /dev/null @@ -1,154 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsDoWhileStatement { - do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], - body: JsWhileStatement { - while_token: WHILE_KW@3..9 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@9..10 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@10..14 "true" [] [], - }, - r_paren_token: R_PAREN@14..15 ")" [] [], - body: JsDoWhileStatement { - do_token: DO_KW@15..19 "do" [Newline("\n")] [Whitespace(" ")], - body: JsWhileStatement { - while_token: WHILE_KW@19..25 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@25..26 "(" [] [], - test: missing (required), - r_paren_token: R_PAREN@26..27 ")" [] [], - body: JsDoWhileStatement { - do_token: DO_KW@27..31 "do" [Newline("\n")] [Whitespace(" ")], - body: JsWhileStatement { - while_token: WHILE_KW@31..37 "while" [] [Whitespace(" ")], - l_paren_token: missing (required), - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@37..41 "true" [] [], - }, - r_paren_token: missing (required), - body: missing (required), - }, - while_token: missing (required), - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - semicolon_token: missing (optional), - }, - }, - while_token: missing (required), - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - semicolon_token: missing (optional), - }, - }, - while_token: missing (required), - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@41..42 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..42 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..41 - 0: JS_DO_WHILE_STATEMENT@0..41 - 0: DO_KW@0..3 "do" [] [Whitespace(" ")] - 1: JS_WHILE_STATEMENT@3..41 - 0: WHILE_KW@3..9 "while" [] [Whitespace(" ")] - 1: L_PAREN@9..10 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@10..14 - 0: TRUE_KW@10..14 "true" [] [] - 3: R_PAREN@14..15 ")" [] [] - 4: JS_DO_WHILE_STATEMENT@15..41 - 0: DO_KW@15..19 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_WHILE_STATEMENT@19..41 - 0: WHILE_KW@19..25 "while" [] [Whitespace(" ")] - 1: L_PAREN@25..26 "(" [] [] - 2: (empty) - 3: R_PAREN@26..27 ")" [] [] - 4: JS_DO_WHILE_STATEMENT@27..41 - 0: DO_KW@27..31 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_WHILE_STATEMENT@31..41 - 0: WHILE_KW@31..37 "while" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BOOLEAN_LITERAL_EXPRESSION@37..41 - 0: TRUE_KW@37..41 "true" [] [] - 3: (empty) - 4: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 4: EOF@41..42 "" [Newline("\n")] [] --- -do_while_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ')'. - - 1 │ do while (true) - > 2 │ do while () - │ ^ - 3 │ do while true - 4 │ - - i Expected an expression here. - - 1 │ do while (true) - > 2 │ do while () - │ ^ - 3 │ do while true - 4 │ - --- -do_while_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `true` - - 1 │ do while (true) - 2 │ do while () - > 3 │ do while true - │ ^^^^ - 4 │ - - i Remove true - --- -do_while_stmt_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead the file ends - - 2 │ do while () - 3 │ do while true - > 4 │ - │ - - i the file ends here - - 2 │ do while () - 3 │ do while true - > 4 │ - │ - --- -do while (true) -do while () -do while true diff --git a/crates/biome_js_parser/test_data/inline/err/double_label.rast b/crates/biome_js_parser/test_data/inline/err/double_label.rast deleted file mode 100644 index ec19e64223b4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/double_label.rast +++ /dev/null @@ -1,108 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..6 "label1" [] [], - }, - colon_token: COLON@6..8 ":" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@8..9 "{" [] [], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@9..18 "label2" [Newline("\n"), Whitespace(" ")] [], - }, - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@20..21 "{" [] [], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@21..32 "label1" [Newline("\n"), Whitespace(" ")] [], - }, - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@34..35 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@35..36 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@36..40 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@40..42 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@42..43 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_LABELED_STATEMENT@0..42 - 0: JS_LABEL@0..6 - 0: IDENT@0..6 "label1" [] [] - 1: COLON@6..8 ":" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@8..42 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_STATEMENT_LIST@9..40 - 0: JS_LABELED_STATEMENT@9..40 - 0: JS_LABEL@9..18 - 0: IDENT@9..18 "label2" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@18..20 ":" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@20..40 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_STATEMENT_LIST@21..36 - 0: JS_LABELED_STATEMENT@21..36 - 0: JS_LABEL@21..32 - 0: IDENT@21..32 "label1" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@32..34 ":" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@34..36 - 0: L_CURLY@34..35 "{" [] [] - 1: JS_STATEMENT_LIST@35..35 - 2: R_CURLY@35..36 "}" [] [] - 2: R_CURLY@36..40 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@40..42 "}" [Newline("\n")] [] - 4: EOF@42..43 "" [Newline("\n")] [] --- -double_label.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Duplicate statement labels are not allowed - - 1 │ label1: { - 2 │ label2: { - > 3 │ label1: {} - │ ^^^^^^ - 4 │ } - 5 │ } - - i a second use of `label1` here is not allowed - - 1 │ label1: { - 2 │ label2: { - > 3 │ label1: {} - │ ^^^^^^ - 4 │ } - 5 │ } - - i `label1` is first used as a label here - - > 1 │ label1: { - │ ^^^^^^ - 2 │ label2: { - 3 │ label1: {} - --- -label1: { - label2: { - label1: {} - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast b/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast deleted file mode 100644 index 2070c3303a72..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast +++ /dev/null @@ -1,42 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: missing (required), - r_paren_token: R_PAREN@1..2 ")" [] [], - }, - semicolon_token: SEMICOLON@2..3 ";" [] [], - }, - ], - eof_token: EOF@3..4 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..4 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..3 - 0: JS_EXPRESSION_STATEMENT@0..3 - 0: JS_PARENTHESIZED_EXPRESSION@0..2 - 0: L_PAREN@0..1 "(" [] [] - 1: (empty) - 2: R_PAREN@1..2 ")" [] [] - 1: SEMICOLON@2..3 ";" [] [] - 4: EOF@3..4 "" [Newline("\n")] [] --- -empty_parenthesized_expression.js:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Parenthesized expression didnt contain anything - - > 1 │ (); - │ ^ - 2 │ - - i Expected an expression here - --- -(); diff --git a/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.rast b/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.rast deleted file mode 100644 index 1d61665affad..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.rast +++ /dev/null @@ -1,143 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], - id: missing (required), - l_curly_token: L_CURLY@5..6 "{" [] [], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@6..7 "A" [] [], - }, - initializer: missing (optional), - }, - COMMA@7..8 "," [] [], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@8..9 "B" [] [], - }, - initializer: missing (optional), - }, - COMMA@9..10 "," [] [], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@10..11 "C" [] [], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@11..12 "}" [] [], - }, - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@12..18 "enum" [Newline("\n")] [Whitespace(" ")], - id: JsBogusBinding { - items: [ - JS_NUMBER_LITERAL@18..20 "1" [] [Whitespace(" ")], - ], - }, - l_curly_token: L_CURLY@20..21 "{" [] [], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@21..22 "A" [] [], - }, - initializer: missing (optional), - }, - COMMA@22..23 "," [] [], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@23..24 "B" [] [], - }, - initializer: missing (optional), - }, - COMMA@24..25 "," [] [], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@25..26 "C" [] [], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: TS_ENUM_DECLARATION@0..12 - 0: (empty) - 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] - 2: (empty) - 3: L_CURLY@5..6 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@6..11 - 0: TS_ENUM_MEMBER@6..7 - 0: TS_LITERAL_ENUM_MEMBER_NAME@6..7 - 0: IDENT@6..7 "A" [] [] - 1: (empty) - 1: COMMA@7..8 "," [] [] - 2: TS_ENUM_MEMBER@8..9 - 0: TS_LITERAL_ENUM_MEMBER_NAME@8..9 - 0: IDENT@8..9 "B" [] [] - 1: (empty) - 3: COMMA@9..10 "," [] [] - 4: TS_ENUM_MEMBER@10..11 - 0: TS_LITERAL_ENUM_MEMBER_NAME@10..11 - 0: IDENT@10..11 "C" [] [] - 1: (empty) - 5: R_CURLY@11..12 "}" [] [] - 1: TS_ENUM_DECLARATION@12..27 - 0: (empty) - 1: ENUM_KW@12..18 "enum" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS_BINDING@18..20 - 0: JS_NUMBER_LITERAL@18..20 "1" [] [Whitespace(" ")] - 3: L_CURLY@20..21 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@21..26 - 0: TS_ENUM_MEMBER@21..22 - 0: TS_LITERAL_ENUM_MEMBER_NAME@21..22 - 0: IDENT@21..22 "A" [] [] - 1: (empty) - 1: COMMA@22..23 "," [] [] - 2: TS_ENUM_MEMBER@23..24 - 0: TS_LITERAL_ENUM_MEMBER_NAME@23..24 - 0: IDENT@23..24 "B" [] [] - 1: (empty) - 3: COMMA@24..25 "," [] [] - 4: TS_ENUM_MEMBER@25..26 - 0: TS_LITERAL_ENUM_MEMBER_NAME@25..26 - 0: IDENT@25..26 "C" [] [] - 1: (empty) - 5: R_CURLY@26..27 "}" [] [] - 4: EOF@27..28 "" [Newline("\n")] [] --- -enum_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `enum` statements must have a name - - > 1 │ enum {A,B,C} - │ ^^^^^ - 2 │ enum 1 {A,B,C} - 3 │ - --- -enum_decl_no_id.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × invalid `enum` name - - 1 │ enum {A,B,C} - > 2 │ enum 1 {A,B,C} - │ ^ - 3 │ - --- -enum {A,B,C} -enum 1 {A,B,C} diff --git a/crates/biome_js_parser/test_data/inline/err/enum_in_js.rast b/crates/biome_js_parser/test_data/inline/err/enum_in_js.rast deleted file mode 100644 index 733ac8c53f53..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/enum_in_js.rast +++ /dev/null @@ -1,46 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - ENUM_KW@0..5 "enum" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - L_CURLY@7..8 "{" [] [], - TsEnumMemberList [], - R_CURLY@8..9 "}" [] [], - ], - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_BOGUS_STATEMENT@0..9 - 0: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: L_CURLY@7..8 "{" [] [] - 3: TS_ENUM_MEMBER_LIST@8..8 - 4: R_CURLY@8..9 "}" [] [] - 4: EOF@9..10 "" [Newline("\n")] [] --- -enum_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - > 1 │ enum A {} - │ ^^^^^^^^^ - 2 │ - - i TypeScript only syntax - --- -enum A {} diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.rast b/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.rast deleted file mode 100644 index c4220e3c3666..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@0..4 "enum" [] [], - id: missing (required), - l_curly_token: missing (required), - members: TsEnumMemberList [], - r_curly_token: missing (required), - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@4..5 ";" [] [], - }, - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@5..11 "enum" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@11..12 "A" [] [], - }, - l_curly_token: missing (required), - members: TsEnumMemberList [], - r_curly_token: missing (required), - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: TS_ENUM_DECLARATION@0..4 - 0: (empty) - 1: ENUM_KW@0..4 "enum" [] [] - 2: (empty) - 3: (empty) - 4: TS_ENUM_MEMBER_LIST@4..4 - 5: (empty) - 1: JS_EMPTY_STATEMENT@4..5 - 0: SEMICOLON@4..5 ";" [] [] - 2: TS_ENUM_DECLARATION@5..12 - 0: (empty) - 1: ENUM_KW@5..11 "enum" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@11..12 - 0: IDENT@11..12 "A" [] [] - 3: (empty) - 4: TS_ENUM_MEMBER_LIST@12..12 - 5: (empty) - 3: JS_EMPTY_STATEMENT@12..13 - 0: SEMICOLON@12..13 ";" [] [] - 4: EOF@13..14 "" [Newline("\n")] [] --- -enum_no_l_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `enum` statements must have a name - - > 1 │ enum; - │ ^^^^ - 2 │ enum A; - 3 │ - --- -enum_no_l_curly.ts:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `;` - - > 1 │ enum; - │ ^ - 2 │ enum A; - 3 │ - - i Remove ; - --- -enum_no_l_curly.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `;` - - 1 │ enum; - > 2 │ enum A; - │ ^ - 3 │ - - i Remove ; - --- -enum; -enum A; diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.rast b/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.rast deleted file mode 100644 index 71724c217c18..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.rast +++ /dev/null @@ -1,105 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], - id: missing (required), - l_curly_token: L_CURLY@5..6 "{" [] [], - members: TsEnumMemberList [], - r_curly_token: missing (required), - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@6..7 ";" [] [], - }, - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@7..13 "enum" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@13..15 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@15..16 "{" [] [], - members: TsEnumMemberList [], - r_curly_token: missing (required), - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: TS_ENUM_DECLARATION@0..6 - 0: (empty) - 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] - 2: (empty) - 3: L_CURLY@5..6 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@6..6 - 5: (empty) - 1: JS_EMPTY_STATEMENT@6..7 - 0: SEMICOLON@6..7 ";" [] [] - 2: TS_ENUM_DECLARATION@7..16 - 0: (empty) - 1: ENUM_KW@7..13 "enum" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@13..15 - 0: IDENT@13..15 "A" [] [Whitespace(" ")] - 3: L_CURLY@15..16 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@16..16 - 5: (empty) - 3: JS_EMPTY_STATEMENT@16..17 - 0: SEMICOLON@16..17 ";" [] [] - 4: EOF@17..18 "" [Newline("\n")] [] --- -enum_no_r_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `enum` statements must have a name - - > 1 │ enum {; - │ ^^^^^ - 2 │ enum A {; - 3 │ - --- -enum_no_r_curly.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, or a computed name but instead found ';'. - - > 1 │ enum {; - │ ^ - 2 │ enum A {; - 3 │ - - i Expected an identifier, a string literal, or a computed name here. - - > 1 │ enum {; - │ ^ - 2 │ enum A {; - 3 │ - --- -enum_no_r_curly.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, or a computed name but instead found ';'. - - 1 │ enum {; - > 2 │ enum A {; - │ ^ - 3 │ - - i Expected an identifier, a string literal, or a computed name here. - - 1 │ enum {; - > 2 │ enum A {; - │ ^ - 3 │ - --- -enum {; -enum A {; diff --git a/crates/biome_js_parser/test_data/inline/err/escaped_from.rast b/crates/biome_js_parser/test_data/inline/err/escaped_from.rast deleted file mode 100644 index c79122fe67e3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/escaped_from.rast +++ /dev/null @@ -1,55 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@7..8 "{" [] [], - JsExportNamedFromSpecifierList [], - R_CURLY@8..10 "}" [] [Whitespace(" ")], - ERROR_TOKEN@10..20 "\\u0066rom" [] [Whitespace(" ")], - JsModuleSource { - value_token: JS_STRING_LITERAL@20..39 "\"./escaped-from.js\"" [] [], - }, - SEMICOLON@39..40 ";" [] [], - ], - }, - ], - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: JS_BOGUS_STATEMENT@0..40 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_BOGUS@7..40 - 0: L_CURLY@7..8 "{" [] [] - 1: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@8..8 - 2: R_CURLY@8..10 "}" [] [Whitespace(" ")] - 3: ERROR_TOKEN@10..20 "\\u0066rom" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@20..39 - 0: JS_STRING_LITERAL@20..39 "\"./escaped-from.js\"" [] [] - 5: SEMICOLON@39..40 ";" [] [] - 4: EOF@40..41 "" [Newline("\n")] [] --- -escaped_from.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'from' keyword cannot contain escape character. - - > 1 │ export {} \u0066rom "./escaped-from.js"; - │ ^^^^^^^^^ - 2 │ - --- -export {} \u0066rom "./escaped-from.js"; diff --git a/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.rast b/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.rast deleted file mode 100644 index e5107e21a9ed..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.rast +++ /dev/null @@ -1,82 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@0..5 "eval" [] [Whitespace(" ")], - ], - }, - operator_token: EQ@5..7 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@7..13 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - IDENT@14..25 "arguments" [Newline("\n")] [Whitespace(" ")], - ], - }, - operator_token: EQ@25..27 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@27..33 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_ASSIGNMENT_EXPRESSION@0..13 - 0: JS_BOGUS_ASSIGNMENT@0..5 - 0: IDENT@0..5 "eval" [] [Whitespace(" ")] - 1: EQ@5..7 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@7..13 - 0: JS_STRING_LITERAL@7..13 "\"test\"" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..34 - 0: JS_ASSIGNMENT_EXPRESSION@14..33 - 0: JS_BOGUS_ASSIGNMENT@14..25 - 0: IDENT@14..25 "arguments" [Newline("\n")] [Whitespace(" ")] - 1: EQ@25..27 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@27..33 - 0: JS_STRING_LITERAL@27..33 "\"test\"" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] --- -eval_arguments_assignment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - > 1 │ eval = "test"; - │ ^^^^ - 2 │ arguments = "test"; - 3 │ - --- -eval_arguments_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `arguments` as an identifier in strict mode - - 1 │ eval = "test"; - > 2 │ arguments = "test"; - │ ^^^^^^^^^ - 3 │ - --- -eval = "test"; -arguments = "test"; diff --git a/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast b/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast deleted file mode 100644 index 10b1d9f80a53..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast +++ /dev/null @@ -1,429 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: DELETE_KW@0..7 "delete" [] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..8 "a" [] [], - }, - }, - operator_token: DOT@8..9 "." [] [], - member: JsName { - value_token: IDENT@9..11 "b" [] [Whitespace(" ")], - }, - }, - }, - STAR2@11..14 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@14..15 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: VOID_KW@16..22 "void" [Newline("\n")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@22..28 "ident" [] [Whitespace(" ")], - }, - }, - }, - STAR2@28..31 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@31..32 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: TYPEOF_KW@33..41 "typeof" [Newline("\n")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..47 "ident" [] [Whitespace(" ")], - }, - }, - }, - STAR2@47..50 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@50..51 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@51..52 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: MINUS@52..54 "-" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@54..56 "3" [] [Whitespace(" ")], - }, - }, - STAR2@56..59 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@59..60 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: PLUS@61..63 "+" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@63..65 "3" [] [Whitespace(" ")], - }, - }, - STAR2@65..68 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@68..69 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: TILDE@70..72 "~" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@72..74 "3" [] [Whitespace(" ")], - }, - }, - STAR2@74..77 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@77..78 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@78..79 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsUnaryExpression { - operator_token: BANG@79..81 "!" [Newline("\n")] [], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@81..86 "true" [] [Whitespace(" ")], - }, - }, - STAR2@86..89 "**" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@89..90 "2" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@90..91 ";" [] [], - }, - ], - eof_token: EOF@91..92 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..92 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..91 - 0: JS_EXPRESSION_STATEMENT@0..16 - 0: JS_BOGUS_EXPRESSION@0..15 - 0: JS_UNARY_EXPRESSION@0..11 - 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@7..11 - 0: JS_IDENTIFIER_EXPRESSION@7..8 - 0: JS_REFERENCE_IDENTIFIER@7..8 - 0: IDENT@7..8 "a" [] [] - 1: DOT@8..9 "." [] [] - 2: JS_NAME@9..11 - 0: IDENT@9..11 "b" [] [Whitespace(" ")] - 1: STAR2@11..14 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@14..15 - 0: JS_NUMBER_LITERAL@14..15 "2" [] [] - 1: SEMICOLON@15..16 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@16..33 - 0: JS_BOGUS_EXPRESSION@16..32 - 0: JS_UNARY_EXPRESSION@16..28 - 0: VOID_KW@16..22 "void" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@22..28 - 0: JS_REFERENCE_IDENTIFIER@22..28 - 0: IDENT@22..28 "ident" [] [Whitespace(" ")] - 1: STAR2@28..31 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@31..32 - 0: JS_NUMBER_LITERAL@31..32 "2" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..52 - 0: JS_BOGUS_EXPRESSION@33..51 - 0: JS_UNARY_EXPRESSION@33..47 - 0: TYPEOF_KW@33..41 "typeof" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@41..47 - 0: JS_REFERENCE_IDENTIFIER@41..47 - 0: IDENT@41..47 "ident" [] [Whitespace(" ")] - 1: STAR2@47..50 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@50..51 - 0: JS_NUMBER_LITERAL@50..51 "2" [] [] - 1: SEMICOLON@51..52 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@52..61 - 0: JS_BOGUS_EXPRESSION@52..60 - 0: JS_UNARY_EXPRESSION@52..56 - 0: MINUS@52..54 "-" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@54..56 - 0: JS_NUMBER_LITERAL@54..56 "3" [] [Whitespace(" ")] - 1: STAR2@56..59 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@59..60 - 0: JS_NUMBER_LITERAL@59..60 "2" [] [] - 1: SEMICOLON@60..61 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@61..70 - 0: JS_BOGUS_EXPRESSION@61..69 - 0: JS_UNARY_EXPRESSION@61..65 - 0: PLUS@61..63 "+" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@63..65 - 0: JS_NUMBER_LITERAL@63..65 "3" [] [Whitespace(" ")] - 1: STAR2@65..68 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@68..69 - 0: JS_NUMBER_LITERAL@68..69 "2" [] [] - 1: SEMICOLON@69..70 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@70..79 - 0: JS_BOGUS_EXPRESSION@70..78 - 0: JS_UNARY_EXPRESSION@70..74 - 0: TILDE@70..72 "~" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@72..74 - 0: JS_NUMBER_LITERAL@72..74 "3" [] [Whitespace(" ")] - 1: STAR2@74..77 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@77..78 - 0: JS_NUMBER_LITERAL@77..78 "2" [] [] - 1: SEMICOLON@78..79 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@79..91 - 0: JS_BOGUS_EXPRESSION@79..90 - 0: JS_UNARY_EXPRESSION@79..86 - 0: BANG@79..81 "!" [Newline("\n")] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@81..86 - 0: TRUE_KW@81..86 "true" [] [Whitespace(" ")] - 1: STAR2@86..89 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@89..90 - 0: JS_NUMBER_LITERAL@89..90 "2" [] [] - 1: SEMICOLON@90..91 ";" [] [] - 4: EOF@91..92 "" [Newline("\n")] [] --- -exponent_unary_unparenthesized.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - > 1 │ delete a.b ** 2; - │ ^^^^^^^^^^ - 2 │ void ident ** 2; - 3 │ typeof ident ** 2; - - i The operation - - > 1 │ delete a.b ** 2; - │ ^^ - 2 │ void ident ** 2; - 3 │ typeof ident ** 2; - - i The left-hand side - - > 1 │ delete a.b ** 2; - │ ^^^^^^^^^^ - 2 │ void ident ** 2; - 3 │ typeof ident ** 2; - --- -exponent_unary_unparenthesized.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - 1 │ delete a.b ** 2; - > 2 │ void ident ** 2; - │ ^^^^^^^^^^ - 3 │ typeof ident ** 2; - 4 │ -3 ** 2; - - i The operation - - 1 │ delete a.b ** 2; - > 2 │ void ident ** 2; - │ ^^ - 3 │ typeof ident ** 2; - 4 │ -3 ** 2; - - i The left-hand side - - 1 │ delete a.b ** 2; - > 2 │ void ident ** 2; - │ ^^^^^^^^^^ - 3 │ typeof ident ** 2; - 4 │ -3 ** 2; - --- -exponent_unary_unparenthesized.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - 1 │ delete a.b ** 2; - 2 │ void ident ** 2; - > 3 │ typeof ident ** 2; - │ ^^^^^^^^^^^^ - 4 │ -3 ** 2; - 5 │ +3 ** 2; - - i The operation - - 1 │ delete a.b ** 2; - 2 │ void ident ** 2; - > 3 │ typeof ident ** 2; - │ ^^ - 4 │ -3 ** 2; - 5 │ +3 ** 2; - - i The left-hand side - - 1 │ delete a.b ** 2; - 2 │ void ident ** 2; - > 3 │ typeof ident ** 2; - │ ^^^^^^^^^^^^ - 4 │ -3 ** 2; - 5 │ +3 ** 2; - --- -exponent_unary_unparenthesized.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - 2 │ void ident ** 2; - 3 │ typeof ident ** 2; - > 4 │ -3 ** 2; - │ ^^ - 5 │ +3 ** 2; - 6 │ ~3 ** 2; - - i The operation - - 2 │ void ident ** 2; - 3 │ typeof ident ** 2; - > 4 │ -3 ** 2; - │ ^^ - 5 │ +3 ** 2; - 6 │ ~3 ** 2; - - i The left-hand side - - 2 │ void ident ** 2; - 3 │ typeof ident ** 2; - > 4 │ -3 ** 2; - │ ^^ - 5 │ +3 ** 2; - 6 │ ~3 ** 2; - --- -exponent_unary_unparenthesized.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - 3 │ typeof ident ** 2; - 4 │ -3 ** 2; - > 5 │ +3 ** 2; - │ ^^ - 6 │ ~3 ** 2; - 7 │ !true ** 2; - - i The operation - - 3 │ typeof ident ** 2; - 4 │ -3 ** 2; - > 5 │ +3 ** 2; - │ ^^ - 6 │ ~3 ** 2; - 7 │ !true ** 2; - - i The left-hand side - - 3 │ typeof ident ** 2; - 4 │ -3 ** 2; - > 5 │ +3 ** 2; - │ ^^ - 6 │ ~3 ** 2; - 7 │ !true ** 2; - --- -exponent_unary_unparenthesized.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - 4 │ -3 ** 2; - 5 │ +3 ** 2; - > 6 │ ~3 ** 2; - │ ^^ - 7 │ !true ** 2; - 8 │ - - i The operation - - 4 │ -3 ** 2; - 5 │ +3 ** 2; - > 6 │ ~3 ** 2; - │ ^^ - 7 │ !true ** 2; - 8 │ - - i The left-hand side - - 4 │ -3 ** 2; - 5 │ +3 ** 2; - > 6 │ ~3 ** 2; - │ ^^ - 7 │ !true ** 2; - 8 │ - --- -exponent_unary_unparenthesized.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unparenthesized unary expression can't appear on the left-hand side of '**' - - 5 │ +3 ** 2; - 6 │ ~3 ** 2; - > 7 │ !true ** 2; - │ ^^^^^ - 8 │ - - i The operation - - 5 │ +3 ** 2; - 6 │ ~3 ** 2; - > 7 │ !true ** 2; - │ ^^ - 8 │ - - i The left-hand side - - 5 │ +3 ** 2; - 6 │ ~3 ** 2; - > 7 │ !true ** 2; - │ ^^^^^ - 8 │ - --- -delete a.b ** 2; -void ident ** 2; -typeof ident ** 2; --3 ** 2; -+3 ** 2; -~3 ** 2; -!true ** 2; diff --git a/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.rast b/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.rast deleted file mode 100644 index 635d6cc7590c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.rast +++ /dev/null @@ -1,67 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: missing (required), - as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@12..14 "c" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@14..15 "}" [] [], - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@15..16 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..16 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..15 - 0: JS_EXPORT@0..15 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@7..15 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..14 - 0: JS_EXPORT_NAMED_SPECIFIER@9..14 - 0: (empty) - 1: (empty) - 2: AS_KW@9..12 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@12..14 - 0: IDENT@12..14 "c" [] [Whitespace(" ")] - 3: R_CURLY@14..15 "}" [] [] - 4: (empty) - 4: EOF@15..16 "" [Newline("\n")] [] --- -export_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found ''. - - > 1 │ export { as c } - │ - 2 │ - - i Expected an identifier here. - - > 1 │ export { as c } - │ - 2 │ - --- -export { as c } diff --git a/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.rast b/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.rast deleted file mode 100644 index e8f26c1307e0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.rast +++ /dev/null @@ -1,86 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBlockStatement { - l_curly_token: L_CURLY@0..1 "{" [] [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@1..10 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@10..12 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@12..17 "pain" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], - from_token: FROM_KW@19..24 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@24..30 "\"life\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@31..33 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@33..34 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..34 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..33 - 0: JS_BLOCK_STATEMENT@0..33 - 0: L_CURLY@0..1 "{" [] [] - 1: JS_STATEMENT_LIST@1..31 - 0: JS_BOGUS_STATEMENT@1..31 - 0: JS_DECORATOR_LIST@1..1 - 1: EXPORT_KW@1..10 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@10..31 - 0: (empty) - 1: L_CURLY@10..12 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@12..17 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@12..17 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@12..17 - 0: IDENT@12..17 "pain" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@17..19 "}" [] [Whitespace(" ")] - 4: FROM_KW@19..24 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@24..30 - 0: JS_STRING_LITERAL@24..30 "\"life\"" [] [] - 6: (empty) - 7: SEMICOLON@30..31 ";" [] [] - 2: R_CURLY@31..33 "}" [Newline("\n")] [] - 4: EOF@33..34 "" [Newline("\n")] [] --- -export_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of an export declaration not at the top level - - 1 │ { - > 2 │ export { pain } from "life"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - - i move this declaration to the top level - --- -{ - export { pain } from "life"; -} diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.rast b/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.rast deleted file mode 100644 index 0cbd3646e754..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.rast +++ /dev/null @@ -1,205 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")], - DEFAULT_KW@24..32 "default" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@32..33 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..42 "decorator" [] [], - }, - }, - }, - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")], - DEFAULT_KW@50..57 "default" [] [], - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")], - DEFAULT_KW@65..73 "default" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@73..74 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..83 "decorator" [] [], - }, - }, - }, - ], - }, - ], - }, - ], - eof_token: EOF@83..84 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..84 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..83 - 0: JS_BOGUS_STATEMENT@0..15 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_EMPTY_STATEMENT@15..16 - 0: SEMICOLON@15..16 ";" [] [] - 2: JS_BOGUS_STATEMENT@16..42 - 0: JS_DECORATOR_LIST@16..16 - 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] - 2: DEFAULT_KW@24..32 "default" [] [Whitespace(" ")] - 3: JS_BOGUS_STATEMENT@32..42 - 0: JS_DECORATOR@32..42 - 0: AT@32..33 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@33..42 - 0: JS_REFERENCE_IDENTIFIER@33..42 - 0: IDENT@33..42 "decorator" [] [] - 3: JS_BOGUS_STATEMENT@42..57 - 0: JS_DECORATOR_LIST@42..42 - 1: EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")] - 2: DEFAULT_KW@50..57 "default" [] [] - 4: JS_BOGUS_STATEMENT@57..83 - 0: JS_DECORATOR_LIST@57..57 - 1: EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")] - 2: DEFAULT_KW@65..73 "default" [] [Whitespace(" ")] - 3: JS_BOGUS_STATEMENT@73..83 - 0: JS_DECORATOR@73..83 - 0: AT@73..74 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@74..83 - 0: JS_REFERENCE_IDENTIFIER@74..83 - 0: IDENT@74..83 "decorator" [] [] - 4: EOF@83..84 "" [Newline("\n")] [] --- -export_default_expression_broken.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found ';'. - - > 1 │ export default ; - │ ^ - 2 │ export default @decorator - 3 │ export default - - i Expected a class, a function, or a variable declaration here. - - > 1 │ export default ; - │ ^ - 2 │ export default @decorator - 3 │ export default - --- -export_default_expression_broken.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ export default ; - > 2 │ export default @decorator - │ ^^^^^^^^^^ - 3 │ export default - 4 │ export default @decorator - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -export_default_expression_broken.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found 'export'. - - 1 │ export default ; - 2 │ export default @decorator - > 3 │ export default - │ ^^^^^^ - 4 │ export default @decorator - 5 │ - - i Expected a class, a function, or a variable declaration here. - - 1 │ export default ; - 2 │ export default @decorator - > 3 │ export default - │ ^^^^^^ - 4 │ export default @decorator - 5 │ - --- -export_default_expression_broken.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found 'export'. - - 2 │ export default @decorator - 3 │ export default - > 4 │ export default @decorator - │ ^^^^^^ - 5 │ - - i Expected a class, a function, or a variable declaration here. - - 2 │ export default @decorator - 3 │ export default - > 4 │ export default @decorator - │ ^^^^^^ - 5 │ - --- -export_default_expression_broken.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ export default @decorator - 3 │ export default - > 4 │ export default @decorator - │ ^^^^^^^^^^ - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -export_default_expression_broken.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found the end of the file. - - 3 │ export default - 4 │ export default @decorator - > 5 │ - │ - - i Expected a class, a function, or a variable declaration here. - - 3 │ export default - 4 │ export default @decorator - > 5 │ - │ - --- -export default ; -export default @decorator -export default -export default @decorator diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast b/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast deleted file mode 100644 index ddb66f648fbe..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast +++ /dev/null @@ -1,74 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultExpressionClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "a" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - JsBogusStatement { - items: [ - COMMA@16..18 "," [] [Whitespace(" ")], - IDENT@18..19 "b" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_EXPORT@0..16 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@7..16 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "a" [] [] - 2: (empty) - 1: JS_BOGUS_STATEMENT@16..19 - 0: COMMA@16..18 "," [] [Whitespace(" ")] - 1: IDENT@18..19 "b" [] [] - 2: JS_EMPTY_STATEMENT@19..20 - 0: SEMICOLON@19..20 ";" [] [] - 4: EOF@20..21 "" [Newline("\n")] [] --- -export_default_expression_clause_err.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ export default a, b; - │ ^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ export default a, b; - │ ^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ export default a, b; - │ ^^^^^^^^^ - 2 │ - --- -export default a, b; diff --git a/crates/biome_js_parser/test_data/inline/err/export_err.rast b/crates/biome_js_parser/test_data/inline/err/export_err.rast deleted file mode 100644 index ce465c6a69f2..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_err.rast +++ /dev/null @@ -1,41 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..6 "export" [] [], - export_clause: missing (required), - }, - ], - eof_token: EOF@6..7 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..7 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..6 - 0: JS_EXPORT@0..6 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..6 "export" [] [] - 2: (empty) - 4: EOF@6..7 "" [Newline("\n")] [] --- -export_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found the end of the file. - - 1 │ export - > 2 │ - │ - - i Expected a class, a function, or a variable declaration here. - - 1 │ export - > 2 │ - │ - --- -export diff --git a/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.rast b/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.rast deleted file mode 100644 index 4717e5773db4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.rast +++ /dev/null @@ -1,397 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: STAR@7..8 "*" [] [], - export_as: missing (optional), - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@9..17 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: STAR@17..19 "*" [] [Whitespace(" ")], - export_as: missing (optional), - from_token: FROM_KW@19..24 "from" [] [Whitespace(" ")], - source: missing (required), - assertion: missing (optional), - semicolon_token: missing (optional), - }, - }, - JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@24..25 "5" [] [], - }, - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: missing (required), - export_as: JsExportAsClause { - as_token: AS_KW@34..37 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@37..42 "from" [] [Whitespace(" ")], - }, - }, - from_token: missing (required), - source: JsModuleSource { - value_token: JS_STRING_LITERAL@42..48 "\"test\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@48..49 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@49..57 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: missing (required), - export_as: missing (optional), - from_token: FROM_KW@57..62 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@62..68 "\"test\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@68..69 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@69..77 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: TYPE_KW@77..82 "type" [] [Whitespace(" ")], - star_token: STAR@82..83 "*" [] [], - export_as: missing (optional), - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: TYPE_KW@92..97 "type" [] [Whitespace(" ")], - star_token: STAR@97..99 "*" [] [Whitespace(" ")], - export_as: missing (optional), - from_token: FROM_KW@99..103 "from" [] [], - source: missing (required), - assertion: missing (optional), - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@104..112 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: TYPE_KW@112..117 "type" [] [Whitespace(" ")], - star_token: STAR@117..119 "*" [] [Whitespace(" ")], - export_as: JsExportAsClause { - as_token: AS_KW@119..122 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@122..126 "from" [] [], - }, - }, - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - semicolon_token: SEMICOLON@126..127 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@127..135 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: TYPE_KW@135..140 "type" [] [Whitespace(" ")], - star_token: STAR@140..142 "*" [] [Whitespace(" ")], - export_as: JsExportAsClause { - as_token: AS_KW@142..145 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@145..148 "ns" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@148..152 "from" [] [], - source: missing (required), - assertion: missing (optional), - semicolon_token: SEMICOLON@152..153 ";" [] [], - }, - }, - ], - eof_token: EOF@153..154 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..154 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..153 - 0: JS_EXPORT@0..9 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@7..9 - 0: (empty) - 1: STAR@7..8 "*" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: SEMICOLON@8..9 ";" [] [] - 1: JS_EXPORT@9..24 - 0: JS_DECORATOR_LIST@9..9 - 1: EXPORT_KW@9..17 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@17..24 - 0: (empty) - 1: STAR@17..19 "*" [] [Whitespace(" ")] - 2: (empty) - 3: FROM_KW@19..24 "from" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 2: JS_EXPRESSION_STATEMENT@24..26 - 0: JS_NUMBER_LITERAL_EXPRESSION@24..25 - 0: JS_NUMBER_LITERAL@24..25 "5" [] [] - 1: SEMICOLON@25..26 ";" [] [] - 3: JS_EXPORT@26..49 - 0: JS_DECORATOR_LIST@26..26 - 1: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@34..49 - 0: (empty) - 1: (empty) - 2: JS_EXPORT_AS_CLAUSE@34..42 - 0: AS_KW@34..37 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@37..42 - 0: IDENT@37..42 "from" [] [Whitespace(" ")] - 3: (empty) - 4: JS_MODULE_SOURCE@42..48 - 0: JS_STRING_LITERAL@42..48 "\"test\"" [] [] - 5: (empty) - 6: SEMICOLON@48..49 ";" [] [] - 4: JS_EXPORT@49..69 - 0: JS_DECORATOR_LIST@49..49 - 1: EXPORT_KW@49..57 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@57..69 - 0: (empty) - 1: (empty) - 2: (empty) - 3: FROM_KW@57..62 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@62..68 - 0: JS_STRING_LITERAL@62..68 "\"test\"" [] [] - 5: (empty) - 6: SEMICOLON@68..69 ";" [] [] - 5: JS_EXPORT@69..84 - 0: JS_DECORATOR_LIST@69..69 - 1: EXPORT_KW@69..77 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@77..84 - 0: TYPE_KW@77..82 "type" [] [Whitespace(" ")] - 1: STAR@82..83 "*" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: SEMICOLON@83..84 ";" [] [] - 6: JS_EXPORT@84..104 - 0: JS_DECORATOR_LIST@84..84 - 1: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@92..104 - 0: TYPE_KW@92..97 "type" [] [Whitespace(" ")] - 1: STAR@97..99 "*" [] [Whitespace(" ")] - 2: (empty) - 3: FROM_KW@99..103 "from" [] [] - 4: (empty) - 5: (empty) - 6: SEMICOLON@103..104 ";" [] [] - 7: JS_EXPORT@104..127 - 0: JS_DECORATOR_LIST@104..104 - 1: EXPORT_KW@104..112 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@112..127 - 0: TYPE_KW@112..117 "type" [] [Whitespace(" ")] - 1: STAR@117..119 "*" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@119..126 - 0: AS_KW@119..122 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@122..126 - 0: IDENT@122..126 "from" [] [] - 3: (empty) - 4: (empty) - 5: (empty) - 6: SEMICOLON@126..127 ";" [] [] - 8: JS_EXPORT@127..153 - 0: JS_DECORATOR_LIST@127..127 - 1: EXPORT_KW@127..135 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@135..153 - 0: TYPE_KW@135..140 "type" [] [Whitespace(" ")] - 1: STAR@140..142 "*" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@142..148 - 0: AS_KW@142..145 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@145..148 - 0: IDENT@145..148 "ns" [] [Whitespace(" ")] - 3: FROM_KW@148..152 "from" [] [] - 4: (empty) - 5: (empty) - 6: SEMICOLON@152..153 ";" [] [] - 4: EOF@153..154 "" [Newline("\n")] [] --- -export_from_clause_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `;` - - > 1 │ export *; - │ ^ - 2 │ export * from 5; - 3 │ export as from "test"; - - i Remove ; - --- -export_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal but instead found '5'. - - 1 │ export *; - > 2 │ export * from 5; - │ ^ - 3 │ export as from "test"; - 4 │ export from "test"; - - i Expected a string literal here. - - 1 │ export *; - > 2 │ export * from 5; - │ ^ - 3 │ export as from "test"; - 4 │ export from "test"; - --- -export_from_clause_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `*` but instead found `as` - - 1 │ export *; - 2 │ export * from 5; - > 3 │ export as from "test"; - │ ^^ - 4 │ export from "test"; - 5 │ export type *; - - i Remove as - --- -export_from_clause_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `"test"` - - 1 │ export *; - 2 │ export * from 5; - > 3 │ export as from "test"; - │ ^^^^^^ - 4 │ export from "test"; - 5 │ export type *; - - i Remove "test" - --- -export_from_clause_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `*` but instead found `from` - - 2 │ export * from 5; - 3 │ export as from "test"; - > 4 │ export from "test"; - │ ^^^^ - 5 │ export type *; - 6 │ export type * from; - - i Remove from - --- -export_from_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `;` - - 3 │ export as from "test"; - 4 │ export from "test"; - > 5 │ export type *; - │ ^ - 6 │ export type * from; - 7 │ export type * as from; - - i Remove ; - --- -export_from_clause_err.js:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal but instead found ';'. - - 4 │ export from "test"; - 5 │ export type *; - > 6 │ export type * from; - │ ^ - 7 │ export type * as from; - 8 │ export type * as ns from; - - i Expected a string literal here. - - 4 │ export from "test"; - 5 │ export type *; - > 6 │ export type * from; - │ ^ - 7 │ export type * as from; - 8 │ export type * as ns from; - --- -export_from_clause_err.js:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `;` - - 5 │ export type *; - 6 │ export type * from; - > 7 │ export type * as from; - │ ^ - 8 │ export type * as ns from; - 9 │ - - i Remove ; - --- -export_from_clause_err.js:8:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal but instead found ';'. - - 6 │ export type * from; - 7 │ export type * as from; - > 8 │ export type * as ns from; - │ ^ - 9 │ - - i Expected a string literal here. - - 6 │ export type * from; - 7 │ export type * as from; - > 8 │ export type * as ns from; - │ ^ - 9 │ - --- -export *; -export * from 5; -export as from "test"; -export from "test"; -export type *; -export type * from; -export type * as from; -export type * as ns from; diff --git a/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.rast b/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.rast deleted file mode 100644 index 6b8ab9058093..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.rast +++ /dev/null @@ -1,90 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@0..17 "export" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@26..28 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@31..33 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@33..40 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@40..1438 "\"Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere.\"" [] [], - }, - semicolon_token: SEMICOLON@1438..1440 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@1440..1441 "}" [] [], - }, - }, - ], - }, - ], - eof_token: EOF@1441..1442 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..1442 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..1441 - 0: JS_BOGUS_STATEMENT@0..1441 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..17 "export" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@17..1441 - 0: (empty) - 1: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "A" [] [Whitespace(" ")] - 4: (empty) - 5: JS_PARAMETERS@28..31 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..29 - 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@31..1441 - 0: L_CURLY@31..33 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@33..33 - 2: JS_STATEMENT_LIST@33..1440 - 0: JS_RETURN_STATEMENT@33..1440 - 0: RETURN_KW@33..40 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@40..1438 - 0: JS_STRING_LITERAL@40..1438 "\"Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere.\"" [] [] - 2: SEMICOLON@1438..1440 ";" [] [Whitespace(" ")] - 3: R_CURLY@1440..1441 "}" [] [] - 4: EOF@1441..1442 "" [Newline("\n")] [] --- -export_huge_function_in_script.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of an export declaration outside of a module - - 1 │ // SCRIPT - > 2 │ export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 │ - - i not allowed inside scripts - --- -// SCRIPT -export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.rast b/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.rast deleted file mode 100644 index 5d3c0db0ee6c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.rast +++ /dev/null @@ -1,330 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@7..9 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsLiteralExportName { - value: IDENT@9..17 "default" [] [Whitespace(" ")], - }, - AS_KW@17..20 "as" [] [Whitespace(" ")], - JsLiteralExportName { - value: JS_STRING_LITERAL@20..24 "\"b\"" [] [Whitespace(" ")], - }, - ], - }, - ], - }, - R_CURLY@24..25 "}" [] [], - SEMICOLON@25..26 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@34..36 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsLiteralExportName { - value: JS_STRING_LITERAL@36..40 "\"a\"" [] [Whitespace(" ")], - }, - AS_KW@40..43 "as" [] [Whitespace(" ")], - JsLiteralExportName { - value: IDENT@43..45 "b" [] [Whitespace(" ")], - }, - ], - }, - ], - }, - R_CURLY@45..46 "}" [] [], - SEMICOLON@46..47 ";" [] [], - ], - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: missing (required), - as_token: AS_KW@57..60 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@60..62 "b" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@62..63 "}" [] [], - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@72..74 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@74..76 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@76..79 "as" [] [Whitespace(" ")], - exported_name: missing (required), - }, - JsBogus { - items: [ - JS_NUMBER_LITERAL@79..81 "5" [] [Whitespace(" ")], - ], - }, - ], - }, - R_CURLY@81..82 "}" [] [], - SEMICOLON@82..83 ";" [] [], - ], - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@83..91 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@91..93 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@93..95 "a" [] [Whitespace(" ")], - }, - }, - missing separator, - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@95..97 "b" [] [Whitespace(" ")], - }, - }, - missing separator, - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@97..99 "c" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@99..100 "}" [] [], - semicolon_token: SEMICOLON@100..101 ";" [] [], - }, - }, - ], - eof_token: EOF@101..102 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..102 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..101 - 0: JS_BOGUS_STATEMENT@0..26 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_BOGUS@7..26 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@9..24 - 0: JS_BOGUS@9..24 - 0: JS_LITERAL_EXPORT_NAME@9..17 - 0: IDENT@9..17 "default" [] [Whitespace(" ")] - 1: AS_KW@17..20 "as" [] [Whitespace(" ")] - 2: JS_LITERAL_EXPORT_NAME@20..24 - 0: JS_STRING_LITERAL@20..24 "\"b\"" [] [Whitespace(" ")] - 2: R_CURLY@24..25 "}" [] [] - 3: SEMICOLON@25..26 ";" [] [] - 1: JS_BOGUS_STATEMENT@26..47 - 0: JS_DECORATOR_LIST@26..26 - 1: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@34..47 - 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@36..45 - 0: JS_BOGUS@36..45 - 0: JS_LITERAL_EXPORT_NAME@36..40 - 0: JS_STRING_LITERAL@36..40 "\"a\"" [] [Whitespace(" ")] - 1: AS_KW@40..43 "as" [] [Whitespace(" ")] - 2: JS_LITERAL_EXPORT_NAME@43..45 - 0: IDENT@43..45 "b" [] [Whitespace(" ")] - 2: R_CURLY@45..46 "}" [] [] - 3: SEMICOLON@46..47 ";" [] [] - 2: JS_EXPORT@47..64 - 0: JS_DECORATOR_LIST@47..47 - 1: EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@55..64 - 0: (empty) - 1: L_CURLY@55..57 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@57..62 - 0: JS_EXPORT_NAMED_SPECIFIER@57..62 - 0: (empty) - 1: (empty) - 2: AS_KW@57..60 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@60..62 - 0: IDENT@60..62 "b" [] [Whitespace(" ")] - 3: R_CURLY@62..63 "}" [] [] - 4: SEMICOLON@63..64 ";" [] [] - 3: JS_BOGUS_STATEMENT@64..83 - 0: JS_DECORATOR_LIST@64..64 - 1: EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@72..83 - 0: L_CURLY@72..74 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@74..81 - 0: JS_EXPORT_NAMED_SPECIFIER@74..79 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@74..76 - 0: IDENT@74..76 "a" [] [Whitespace(" ")] - 2: AS_KW@76..79 "as" [] [Whitespace(" ")] - 3: (empty) - 1: JS_BOGUS@79..81 - 0: JS_NUMBER_LITERAL@79..81 "5" [] [Whitespace(" ")] - 2: R_CURLY@81..82 "}" [] [] - 3: SEMICOLON@82..83 ";" [] [] - 4: JS_EXPORT@83..101 - 0: JS_DECORATOR_LIST@83..83 - 1: EXPORT_KW@83..91 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@91..101 - 0: (empty) - 1: L_CURLY@91..93 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@93..99 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@93..95 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@93..95 - 0: IDENT@93..95 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@95..97 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@95..97 - 0: IDENT@95..97 "b" [] [Whitespace(" ")] - 3: (empty) - 4: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@97..99 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@97..99 - 0: IDENT@97..99 "c" [] [Whitespace(" ")] - 3: R_CURLY@99..100 "}" [] [] - 4: SEMICOLON@100..101 ";" [] [] - 4: EOF@101..102 "" [Newline("\n")] [] --- -export_named_clause_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × "default" can only be used with "export ... from ..." - - > 1 │ export { default as "b" }; - │ ^^^^^^^ - 2 │ export { "a" as b }; - 3 │ export { as b }; - --- -export_named_clause_err.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A string literal cannot be used as an export binding without `from`. - - 1 │ export { default as "b" }; - > 2 │ export { "a" as b }; - │ ^^^ - 3 │ export { as b }; - 4 │ export { a as 5 }; - --- -export_named_clause_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found ''. - - 1 │ export { default as "b" }; - 2 │ export { "a" as b }; - > 3 │ export { as b }; - │ - 4 │ export { a as 5 }; - 5 │ export { a b c }; - - i Expected an identifier here. - - 1 │ export { default as "b" }; - 2 │ export { "a" as b }; - > 3 │ export { as b }; - │ - 4 │ export { a as 5 }; - 5 │ export { a b c }; - --- -export_named_clause_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal, or an identifier but instead found '5'. - - 2 │ export { "a" as b }; - 3 │ export { as b }; - > 4 │ export { a as 5 }; - │ ^ - 5 │ export { a b c }; - 6 │ - - i Expected a string literal, or an identifier here. - - 2 │ export { "a" as b }; - 3 │ export { as b }; - > 4 │ export { a as 5 }; - │ ^ - 5 │ export { a b c }; - 6 │ - --- -export_named_clause_err.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `b` - - 3 │ export { as b }; - 4 │ export { a as 5 }; - > 5 │ export { a b c }; - │ ^ - 6 │ - - i Remove b - --- -export_named_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `c` - - 3 │ export { as b }; - 4 │ export { a as 5 }; - > 5 │ export { a b c }; - │ ^ - 6 │ - - i Remove c - --- -export { default as "b" }; -export { "a" as b }; -export { as b }; -export { a as 5 }; -export { a b c }; diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.rast b/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.rast deleted file mode 100644 index 2038c35ee9b5..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.rast +++ /dev/null @@ -1,319 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: missing (required), - export_as: JsExportAsClause { - as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@12..14 "b" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], - from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@21..26 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@27..35 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@35..37 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@37..39 "a" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@39..42 "as" [] [Whitespace(" ")], - exported_name: missing (required), - }, - }, - JsBogus { - items: [ - JS_NUMBER_LITERAL@42..44 "5" [] [Whitespace(" ")], - ], - }, - ], - }, - R_CURLY@44..46 "}" [] [Whitespace(" ")], - FROM_KW@46..51 "from" [] [Whitespace(" ")], - JsModuleSource { - value_token: JS_STRING_LITERAL@51..56 "\"mod\"" [] [], - }, - SEMICOLON@56..57 ";" [] [], - ], - }, - ], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@65..67 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@67..69 "a" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - missing separator, - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@69..71 "b" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - missing separator, - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@71..73 "c" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@73..75 "}" [] [Whitespace(" ")], - from_token: FROM_KW@75..80 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@80..85 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@85..86 ";" [] [], - }, - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@94..96 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JS_NUMBER_LITERAL@96..98 "5" [] [Whitespace(" ")], - AS_KW@98..101 "as" [] [Whitespace(" ")], - IDENT@101..103 "b" [] [Whitespace(" ")], - ], - }, - ], - }, - R_CURLY@103..105 "}" [] [Whitespace(" ")], - FROM_KW@105..110 "from" [] [Whitespace(" ")], - JsModuleSource { - value_token: JS_STRING_LITERAL@110..115 "\"mod\"" [] [], - }, - SEMICOLON@115..116 ";" [] [], - ], - }, - ], - }, - ], - eof_token: EOF@116..117 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..117 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..116 - 0: JS_EXPORT@0..27 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..27 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@9..14 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@9..14 - 0: (empty) - 1: (empty) - 2: JS_EXPORT_AS_CLAUSE@9..14 - 0: AS_KW@9..12 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@12..14 - 0: IDENT@12..14 "b" [] [Whitespace(" ")] - 3: R_CURLY@14..16 "}" [] [Whitespace(" ")] - 4: FROM_KW@16..21 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@21..26 - 0: JS_STRING_LITERAL@21..26 "\"mod\"" [] [] - 6: (empty) - 7: SEMICOLON@26..27 ";" [] [] - 1: JS_BOGUS_STATEMENT@27..57 - 0: JS_DECORATOR_LIST@27..27 - 1: EXPORT_KW@27..35 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@35..57 - 0: L_CURLY@35..37 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@37..44 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@37..42 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@37..39 - 0: IDENT@37..39 "a" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@39..42 - 0: AS_KW@39..42 "as" [] [Whitespace(" ")] - 1: (empty) - 1: JS_BOGUS@42..44 - 0: JS_NUMBER_LITERAL@42..44 "5" [] [Whitespace(" ")] - 2: R_CURLY@44..46 "}" [] [Whitespace(" ")] - 3: FROM_KW@46..51 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@51..56 - 0: JS_STRING_LITERAL@51..56 "\"mod\"" [] [] - 5: SEMICOLON@56..57 ";" [] [] - 2: JS_EXPORT@57..86 - 0: JS_DECORATOR_LIST@57..57 - 1: EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@65..86 - 0: (empty) - 1: L_CURLY@65..67 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@67..73 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@67..69 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@67..69 - 0: IDENT@67..69 "a" [] [Whitespace(" ")] - 2: (empty) - 1: (empty) - 2: JS_EXPORT_NAMED_FROM_SPECIFIER@69..71 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@69..71 - 0: IDENT@69..71 "b" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_EXPORT_NAMED_FROM_SPECIFIER@71..73 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@71..73 - 0: IDENT@71..73 "c" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@73..75 "}" [] [Whitespace(" ")] - 4: FROM_KW@75..80 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@80..85 - 0: JS_STRING_LITERAL@80..85 "\"mod\"" [] [] - 6: (empty) - 7: SEMICOLON@85..86 ";" [] [] - 3: JS_BOGUS_STATEMENT@86..116 - 0: JS_DECORATOR_LIST@86..86 - 1: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@94..116 - 0: L_CURLY@94..96 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@96..103 - 0: JS_BOGUS@96..103 - 0: JS_NUMBER_LITERAL@96..98 "5" [] [Whitespace(" ")] - 1: AS_KW@98..101 "as" [] [Whitespace(" ")] - 2: IDENT@101..103 "b" [] [Whitespace(" ")] - 2: R_CURLY@103..105 "}" [] [Whitespace(" ")] - 3: FROM_KW@105..110 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@110..115 - 0: JS_STRING_LITERAL@110..115 "\"mod\"" [] [] - 5: SEMICOLON@115..116 ";" [] [] - 4: EOF@116..117 "" [Newline("\n")] [] --- -export_named_from_clause_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal, or an identifier but instead found ''. - - > 1 │ export { as b } from "mod"; - │ - 2 │ export { a as 5 } from "mod"; - 3 │ export { a b c } from "mod"; - - i Expected a string literal, or an identifier here. - - > 1 │ export { as b } from "mod"; - │ - 2 │ export { a as 5 } from "mod"; - 3 │ export { a b c } from "mod"; - --- -export_named_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal, or an identifier but instead found '5'. - - 1 │ export { as b } from "mod"; - > 2 │ export { a as 5 } from "mod"; - │ ^ - 3 │ export { a b c } from "mod"; - 4 │ export { 5 as b } from "mod"; - - i Expected a string literal, or an identifier here. - - 1 │ export { as b } from "mod"; - > 2 │ export { a as 5 } from "mod"; - │ ^ - 3 │ export { a b c } from "mod"; - 4 │ export { 5 as b } from "mod"; - --- -export_named_from_clause_err.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `b` - - 1 │ export { as b } from "mod"; - 2 │ export { a as 5 } from "mod"; - > 3 │ export { a b c } from "mod"; - │ ^ - 4 │ export { 5 as b } from "mod"; - 5 │ - - i Remove b - --- -export_named_from_clause_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `c` - - 1 │ export { as b } from "mod"; - 2 │ export { a as 5 } from "mod"; - > 3 │ export { a b c } from "mod"; - │ ^ - 4 │ export { 5 as b } from "mod"; - 5 │ - - i Remove c - --- -export_named_from_clause_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal, or an identifier but instead found '5 as b'. - - 2 │ export { a as 5 } from "mod"; - 3 │ export { a b c } from "mod"; - > 4 │ export { 5 as b } from "mod"; - │ ^^^^^^ - 5 │ - - i Expected a string literal, or an identifier here. - - 2 │ export { a as 5 } from "mod"; - 3 │ export { a b c } from "mod"; - > 4 │ export { 5 as b } from "mod"; - │ ^^^^^^ - 5 │ - --- -export { as b } from "mod"; -export { a as 5 } from "mod"; -export { a b c } from "mod"; -export { 5 as b } from "mod"; diff --git a/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.rast b/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.rast deleted file mode 100644 index 1459909572f4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.rast +++ /dev/null @@ -1,170 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@7..11 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@11..13 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@13..15 "=" [] [Whitespace(" ")], - expression: missing (required), - }, - }, - ], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@24..30 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@30..31 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@32..40 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@40..44 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@44..45 "d" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@45..47 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@47..48 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@48..49 ";" [] [], - }, - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_EXPORT@0..16 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@7..16 - 0: JS_VARIABLE_DECLARATION@7..15 - 0: (empty) - 1: LET_KW@7..11 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@11..15 - 0: JS_VARIABLE_DECLARATOR@11..15 - 0: JS_IDENTIFIER_BINDING@11..13 - 0: IDENT@11..13 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@13..15 - 0: EQ@13..15 "=" [] [Whitespace(" ")] - 1: (empty) - 1: SEMICOLON@15..16 ";" [] [] - 1: JS_EXPORT@16..32 - 0: JS_DECORATOR_LIST@16..16 - 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@24..32 - 0: JS_VARIABLE_DECLARATION@24..31 - 0: (empty) - 1: CONST_KW@24..30 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@30..31 - 0: JS_VARIABLE_DECLARATOR@30..31 - 0: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "b" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@31..32 ";" [] [] - 2: JS_EXPORT@32..49 - 0: JS_DECORATOR_LIST@32..32 - 1: EXPORT_KW@32..40 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@40..49 - 0: JS_VARIABLE_DECLARATION@40..48 - 0: (empty) - 1: LET_KW@40..44 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@44..48 - 0: JS_VARIABLE_DECLARATOR@44..45 - 0: JS_IDENTIFIER_BINDING@44..45 - 0: IDENT@44..45 "d" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@45..47 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@47..48 - 0: JS_IDENTIFIER_BINDING@47..48 - 0: IDENT@47..48 "c" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@48..49 ";" [] [] - 4: EOF@49..50 "" [Newline("\n")] [] --- -export_variable_clause_error.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ';'. - - > 1 │ export let a = ; - │ ^ - 2 │ export const b; - 3 │ export let d, c; - - i Expected an expression, or an assignment here. - - > 1 │ export let a = ; - │ ^ - 2 │ export const b; - 3 │ export let d, c; - --- -export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Const declarations must have an initialized value. - - 1 │ export let a = ; - > 2 │ export const b; - │ ^ - 3 │ export let d, c; - 4 │ - - i This variable needs to be initialized. - --- -export let a = ; -export const b; -export let d, c; diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast b/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast deleted file mode 100644 index 722387036be7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast +++ /dev/null @@ -1,366 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsForInStatement { - for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@14..15 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@15..19 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@19..21 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@21..23 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - in_token: IN_KW@25..28 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@28..29 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@29..30 "]" [] [], - }, - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@32..33 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - JsForInStatement { - for_token: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@39..40 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: CONST_KW@40..46 "const" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@46..48 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@48..50 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - in_token: IN_KW@52..55 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@55..56 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@56..57 "]" [] [], - }, - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@59..60 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@66..67 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: VAR_KW@67..71 "var" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@71..73 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - of_token: OF_KW@77..80 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@80..81 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@81..82 "]" [] [], - }, - r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@84..85 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@85..86 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@91..92 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@92..96 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@96..98 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@98..100 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - of_token: OF_KW@102..105 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@105..106 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@106..107 "]" [] [], - }, - r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@109..110 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@110..111 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@116..117 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: CONST_KW@117..123 "const" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@123..125 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@125..127 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - of_token: OF_KW@129..132 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@132..133 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@133..134 "]" [] [], - }, - r_paren_token: R_PAREN@134..136 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@136..137 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@137..138 "}" [] [], - }, - }, - ], - eof_token: EOF@138..139 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..139 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..138 - 0: JS_FOR_IN_STATEMENT@0..34 - 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@14..15 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@15..25 - 0: (empty) - 1: LET_KW@15..19 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@19..25 - 0: JS_IDENTIFIER_BINDING@19..21 - 0: IDENT@19..21 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@21..25 - 0: EQ@21..23 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@23..25 - 0: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")] - 3: IN_KW@25..28 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@28..30 - 0: L_BRACK@28..29 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@29..29 - 2: R_BRACK@29..30 "]" [] [] - 5: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@32..34 - 0: L_CURLY@32..33 "{" [] [] - 1: JS_STATEMENT_LIST@33..33 - 2: R_CURLY@33..34 "}" [] [] - 1: JS_FOR_IN_STATEMENT@34..61 - 0: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@39..40 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@40..52 - 0: (empty) - 1: CONST_KW@40..46 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@46..52 - 0: JS_IDENTIFIER_BINDING@46..48 - 0: IDENT@46..48 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@48..52 - 0: EQ@48..50 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@50..52 - 0: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")] - 3: IN_KW@52..55 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@55..57 - 0: L_BRACK@55..56 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@56..56 - 2: R_BRACK@56..57 "]" [] [] - 5: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@59..61 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_STATEMENT_LIST@60..60 - 2: R_CURLY@60..61 "}" [] [] - 2: JS_FOR_OF_STATEMENT@61..86 - 0: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@66..67 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@67..77 - 0: (empty) - 1: VAR_KW@67..71 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@71..77 - 0: JS_IDENTIFIER_BINDING@71..73 - 0: IDENT@71..73 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@73..77 - 0: EQ@73..75 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@75..77 - 0: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")] - 4: OF_KW@77..80 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@80..82 - 0: L_BRACK@80..81 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@81..81 - 2: R_BRACK@81..82 "]" [] [] - 6: R_PAREN@82..84 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@84..86 - 0: L_CURLY@84..85 "{" [] [] - 1: JS_STATEMENT_LIST@85..85 - 2: R_CURLY@85..86 "}" [] [] - 3: JS_FOR_OF_STATEMENT@86..111 - 0: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@91..92 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@92..102 - 0: (empty) - 1: LET_KW@92..96 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@96..102 - 0: JS_IDENTIFIER_BINDING@96..98 - 0: IDENT@96..98 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@98..102 - 0: EQ@98..100 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@100..102 - 0: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")] - 4: OF_KW@102..105 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@105..107 - 0: L_BRACK@105..106 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@106..106 - 2: R_BRACK@106..107 "]" [] [] - 6: R_PAREN@107..109 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@109..111 - 0: L_CURLY@109..110 "{" [] [] - 1: JS_STATEMENT_LIST@110..110 - 2: R_CURLY@110..111 "}" [] [] - 4: JS_FOR_OF_STATEMENT@111..138 - 0: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@116..117 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@117..129 - 0: (empty) - 1: CONST_KW@117..123 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@123..129 - 0: JS_IDENTIFIER_BINDING@123..125 - 0: IDENT@123..125 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@125..129 - 0: EQ@125..127 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@127..129 - 0: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")] - 4: OF_KW@129..132 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@132..134 - 0: L_BRACK@132..133 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@133..133 - 2: R_BRACK@133..134 "]" [] [] - 6: R_PAREN@134..136 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@136..138 - 0: L_CURLY@136..137 "{" [] [] - 1: JS_STATEMENT_LIST@137..137 - 2: R_CURLY@137..138 "}" [] [] - 4: EOF@138..139 "" [Newline("\n")] [] --- -for_in_and_of_initializer_loose_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..in` statement declarators cannot have an initializer expression - - 1 │ // SCRIPT - > 2 │ for (let i = 0 in []) {} - │ ^^^ - 3 │ for (const i = 0 in []) {} - 4 │ for (var i = 0 of []) {} - --- -for_in_and_of_initializer_loose_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..in` statement declarators cannot have an initializer expression - - 1 │ // SCRIPT - 2 │ for (let i = 0 in []) {} - > 3 │ for (const i = 0 in []) {} - │ ^^^ - 4 │ for (var i = 0 of []) {} - 5 │ for (let i = 0 of []) {} - --- -for_in_and_of_initializer_loose_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 2 │ for (let i = 0 in []) {} - 3 │ for (const i = 0 in []) {} - > 4 │ for (var i = 0 of []) {} - │ ^^^ - 5 │ for (let i = 0 of []) {} - 6 │ for (const i = 0 of []) {} - --- -for_in_and_of_initializer_loose_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 3 │ for (const i = 0 in []) {} - 4 │ for (var i = 0 of []) {} - > 5 │ for (let i = 0 of []) {} - │ ^^^ - 6 │ for (const i = 0 of []) {} - 7 │ - --- -for_in_and_of_initializer_loose_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 4 │ for (var i = 0 of []) {} - 5 │ for (let i = 0 of []) {} - > 6 │ for (const i = 0 of []) {} - │ ^^^ - 7 │ - --- -// SCRIPT -for (let i = 0 in []) {} -for (const i = 0 in []) {} -for (var i = 0 of []) {} -for (let i = 0 of []) {} -for (const i = 0 of []) {} diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast b/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast deleted file mode 100644 index 2f5bf06a8f0c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast +++ /dev/null @@ -1,744 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForInStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: VAR_KW@5..9 "var" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@9..11 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@11..13 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - in_token: IN_KW@15..18 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@18..19 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@19..20 "]" [] [], - }, - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@22..23 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - JsForInStatement { - for_token: FOR_KW@24..29 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@29..30 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@30..34 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@34..36 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@38..40 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - in_token: IN_KW@40..43 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@43..44 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@44..45 "]" [] [], - }, - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@47..48 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - }, - JsForInStatement { - for_token: FOR_KW@49..54 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@54..55 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: CONST_KW@55..61 "const" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@61..63 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@63..65 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@65..67 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - in_token: IN_KW@67..70 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@70..71 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@71..72 "]" [] [], - }, - r_paren_token: R_PAREN@72..74 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@74..75 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@75..76 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@76..81 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@81..82 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: VAR_KW@82..86 "var" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@86..88 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@88..90 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@90..92 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - of_token: OF_KW@92..95 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@95..96 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@96..97 "]" [] [], - }, - r_paren_token: R_PAREN@97..99 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@99..100 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@100..101 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@101..106 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@106..107 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@107..111 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@111..113 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@113..115 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@115..117 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - of_token: OF_KW@117..120 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@120..121 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@121..122 "]" [] [], - }, - r_paren_token: R_PAREN@122..124 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@124..125 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@126..131 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@131..132 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: CONST_KW@132..138 "const" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@138..140 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@140..142 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@142..144 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - of_token: OF_KW@144..147 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@147..148 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@148..149 "]" [] [], - }, - r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@151..152 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@152..153 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@153..158 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@158..159 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: USING_KW@159..165 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@165..167 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@167..169 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@169..171 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - of_token: OF_KW@171..174 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@174..175 "z" [] [], - }, - }, - r_paren_token: R_PAREN@175..177 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@177..178 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@178..179 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@179..180 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@180..185 "for" [Newline("\n")] [Whitespace(" ")], - await_token: AWAIT_KW@185..191 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@191..192 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: USING_KW@192..198 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@198..200 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@200..202 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@202..204 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - of_token: OF_KW@204..207 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@207..208 "z" [] [], - }, - }, - r_paren_token: R_PAREN@208..210 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@210..211 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@211..212 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@212..213 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@213..218 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@218..219 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: AWAIT_KW@219..225 "await" [] [Whitespace(" ")], - kind_token: USING_KW@225..231 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@231..233 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@233..235 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@235..237 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - of_token: OF_KW@237..240 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@240..241 "z" [] [], - }, - }, - r_paren_token: R_PAREN@241..243 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@243..244 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@244..245 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@245..246 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@246..251 "for" [Newline("\n")] [Whitespace(" ")], - await_token: AWAIT_KW@251..257 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@257..258 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: AWAIT_KW@258..264 "await" [] [Whitespace(" ")], - kind_token: USING_KW@264..270 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@270..272 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@272..274 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@274..276 "y" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - of_token: OF_KW@276..279 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@279..280 "z" [] [], - }, - }, - r_paren_token: R_PAREN@280..282 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@282..283 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@283..284 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@284..285 ";" [] [], - }, - ], - eof_token: EOF@285..286 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..286 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..285 - 0: JS_FOR_IN_STATEMENT@0..24 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@5..15 - 0: (empty) - 1: VAR_KW@5..9 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@9..15 - 0: JS_IDENTIFIER_BINDING@9..11 - 0: IDENT@9..11 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@11..15 - 0: EQ@11..13 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@13..15 - 0: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")] - 3: IN_KW@15..18 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@18..20 - 0: L_BRACK@18..19 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@19..19 - 2: R_BRACK@19..20 "]" [] [] - 5: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@22..24 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_STATEMENT_LIST@23..23 - 2: R_CURLY@23..24 "}" [] [] - 1: JS_FOR_IN_STATEMENT@24..49 - 0: FOR_KW@24..29 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@29..30 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@30..40 - 0: (empty) - 1: LET_KW@30..34 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@34..40 - 0: JS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@36..40 - 0: EQ@36..38 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@38..40 - 0: JS_NUMBER_LITERAL@38..40 "0" [] [Whitespace(" ")] - 3: IN_KW@40..43 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@43..45 - 0: L_BRACK@43..44 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@44..44 - 2: R_BRACK@44..45 "]" [] [] - 5: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@47..49 - 0: L_CURLY@47..48 "{" [] [] - 1: JS_STATEMENT_LIST@48..48 - 2: R_CURLY@48..49 "}" [] [] - 2: JS_FOR_IN_STATEMENT@49..76 - 0: FOR_KW@49..54 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@54..55 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@55..67 - 0: (empty) - 1: CONST_KW@55..61 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@61..67 - 0: JS_IDENTIFIER_BINDING@61..63 - 0: IDENT@61..63 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@63..67 - 0: EQ@63..65 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@65..67 - 0: JS_NUMBER_LITERAL@65..67 "0" [] [Whitespace(" ")] - 3: IN_KW@67..70 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@70..72 - 0: L_BRACK@70..71 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@71..71 - 2: R_BRACK@71..72 "]" [] [] - 5: R_PAREN@72..74 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@74..76 - 0: L_CURLY@74..75 "{" [] [] - 1: JS_STATEMENT_LIST@75..75 - 2: R_CURLY@75..76 "}" [] [] - 3: JS_FOR_OF_STATEMENT@76..101 - 0: FOR_KW@76..81 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@81..82 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@82..92 - 0: (empty) - 1: VAR_KW@82..86 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@86..92 - 0: JS_IDENTIFIER_BINDING@86..88 - 0: IDENT@86..88 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@88..92 - 0: EQ@88..90 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@90..92 - 0: JS_NUMBER_LITERAL@90..92 "0" [] [Whitespace(" ")] - 4: OF_KW@92..95 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@95..97 - 0: L_BRACK@95..96 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@96..96 - 2: R_BRACK@96..97 "]" [] [] - 6: R_PAREN@97..99 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@99..101 - 0: L_CURLY@99..100 "{" [] [] - 1: JS_STATEMENT_LIST@100..100 - 2: R_CURLY@100..101 "}" [] [] - 4: JS_FOR_OF_STATEMENT@101..126 - 0: FOR_KW@101..106 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@106..107 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@107..117 - 0: (empty) - 1: LET_KW@107..111 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@111..117 - 0: JS_IDENTIFIER_BINDING@111..113 - 0: IDENT@111..113 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@113..117 - 0: EQ@113..115 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@115..117 - 0: JS_NUMBER_LITERAL@115..117 "0" [] [Whitespace(" ")] - 4: OF_KW@117..120 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@120..122 - 0: L_BRACK@120..121 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@121..121 - 2: R_BRACK@121..122 "]" [] [] - 6: R_PAREN@122..124 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@124..126 - 0: L_CURLY@124..125 "{" [] [] - 1: JS_STATEMENT_LIST@125..125 - 2: R_CURLY@125..126 "}" [] [] - 5: JS_FOR_OF_STATEMENT@126..153 - 0: FOR_KW@126..131 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@131..132 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@132..144 - 0: (empty) - 1: CONST_KW@132..138 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@138..144 - 0: JS_IDENTIFIER_BINDING@138..140 - 0: IDENT@138..140 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@140..144 - 0: EQ@140..142 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@142..144 - 0: JS_NUMBER_LITERAL@142..144 "0" [] [Whitespace(" ")] - 4: OF_KW@144..147 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@147..149 - 0: L_BRACK@147..148 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@148..148 - 2: R_BRACK@148..149 "]" [] [] - 6: R_PAREN@149..151 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@151..153 - 0: L_CURLY@151..152 "{" [] [] - 1: JS_STATEMENT_LIST@152..152 - 2: R_CURLY@152..153 "}" [] [] - 6: JS_FOR_OF_STATEMENT@153..179 - 0: FOR_KW@153..158 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@158..159 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@159..171 - 0: (empty) - 1: USING_KW@159..165 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@165..171 - 0: JS_IDENTIFIER_BINDING@165..167 - 0: IDENT@165..167 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@167..171 - 0: EQ@167..169 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@169..171 - 0: JS_REFERENCE_IDENTIFIER@169..171 - 0: IDENT@169..171 "y" [] [Whitespace(" ")] - 4: OF_KW@171..174 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@174..175 - 0: JS_REFERENCE_IDENTIFIER@174..175 - 0: IDENT@174..175 "z" [] [] - 6: R_PAREN@175..177 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@177..179 - 0: L_CURLY@177..178 "{" [] [] - 1: JS_STATEMENT_LIST@178..178 - 2: R_CURLY@178..179 "}" [] [] - 7: JS_EMPTY_STATEMENT@179..180 - 0: SEMICOLON@179..180 ";" [] [] - 8: JS_FOR_OF_STATEMENT@180..212 - 0: FOR_KW@180..185 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@185..191 "await" [] [Whitespace(" ")] - 2: L_PAREN@191..192 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@192..204 - 0: (empty) - 1: USING_KW@192..198 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@198..204 - 0: JS_IDENTIFIER_BINDING@198..200 - 0: IDENT@198..200 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@200..204 - 0: EQ@200..202 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@202..204 - 0: JS_REFERENCE_IDENTIFIER@202..204 - 0: IDENT@202..204 "y" [] [Whitespace(" ")] - 4: OF_KW@204..207 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@207..208 - 0: JS_REFERENCE_IDENTIFIER@207..208 - 0: IDENT@207..208 "z" [] [] - 6: R_PAREN@208..210 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@210..212 - 0: L_CURLY@210..211 "{" [] [] - 1: JS_STATEMENT_LIST@211..211 - 2: R_CURLY@211..212 "}" [] [] - 9: JS_EMPTY_STATEMENT@212..213 - 0: SEMICOLON@212..213 ";" [] [] - 10: JS_FOR_OF_STATEMENT@213..245 - 0: FOR_KW@213..218 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@218..219 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@219..237 - 0: AWAIT_KW@219..225 "await" [] [Whitespace(" ")] - 1: USING_KW@225..231 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@231..237 - 0: JS_IDENTIFIER_BINDING@231..233 - 0: IDENT@231..233 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@233..237 - 0: EQ@233..235 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@235..237 - 0: JS_REFERENCE_IDENTIFIER@235..237 - 0: IDENT@235..237 "y" [] [Whitespace(" ")] - 4: OF_KW@237..240 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@240..241 - 0: JS_REFERENCE_IDENTIFIER@240..241 - 0: IDENT@240..241 "z" [] [] - 6: R_PAREN@241..243 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@243..245 - 0: L_CURLY@243..244 "{" [] [] - 1: JS_STATEMENT_LIST@244..244 - 2: R_CURLY@244..245 "}" [] [] - 11: JS_EMPTY_STATEMENT@245..246 - 0: SEMICOLON@245..246 ";" [] [] - 12: JS_FOR_OF_STATEMENT@246..284 - 0: FOR_KW@246..251 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@251..257 "await" [] [Whitespace(" ")] - 2: L_PAREN@257..258 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@258..276 - 0: AWAIT_KW@258..264 "await" [] [Whitespace(" ")] - 1: USING_KW@264..270 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@270..276 - 0: JS_IDENTIFIER_BINDING@270..272 - 0: IDENT@270..272 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@272..276 - 0: EQ@272..274 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@274..276 - 0: JS_REFERENCE_IDENTIFIER@274..276 - 0: IDENT@274..276 "y" [] [Whitespace(" ")] - 4: OF_KW@276..279 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@279..280 - 0: JS_REFERENCE_IDENTIFIER@279..280 - 0: IDENT@279..280 "z" [] [] - 6: R_PAREN@280..282 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@282..284 - 0: L_CURLY@282..283 "{" [] [] - 1: JS_STATEMENT_LIST@283..283 - 2: R_CURLY@283..284 "}" [] [] - 13: JS_EMPTY_STATEMENT@284..285 - 0: SEMICOLON@284..285 ";" [] [] - 4: EOF@285..286 "" [Newline("\n")] [] --- -for_in_and_of_initializer_strict_mode.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..in` statement declarators cannot have an initializer expression - - > 1 │ for (var i = 0 in []) {} - │ ^^^ - 2 │ for (let i = 0 in []) {} - 3 │ for (const i = 0 in []) {} - --- -for_in_and_of_initializer_strict_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..in` statement declarators cannot have an initializer expression - - 1 │ for (var i = 0 in []) {} - > 2 │ for (let i = 0 in []) {} - │ ^^^ - 3 │ for (const i = 0 in []) {} - 4 │ for (var i = 0 of []) {} - --- -for_in_and_of_initializer_strict_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..in` statement declarators cannot have an initializer expression - - 1 │ for (var i = 0 in []) {} - 2 │ for (let i = 0 in []) {} - > 3 │ for (const i = 0 in []) {} - │ ^^^ - 4 │ for (var i = 0 of []) {} - 5 │ for (let i = 0 of []) {} - --- -for_in_and_of_initializer_strict_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 2 │ for (let i = 0 in []) {} - 3 │ for (const i = 0 in []) {} - > 4 │ for (var i = 0 of []) {} - │ ^^^ - 5 │ for (let i = 0 of []) {} - 6 │ for (const i = 0 of []) {} - --- -for_in_and_of_initializer_strict_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 3 │ for (const i = 0 in []) {} - 4 │ for (var i = 0 of []) {} - > 5 │ for (let i = 0 of []) {} - │ ^^^ - 6 │ for (const i = 0 of []) {} - 7 │ for (using x = y of z) {}; - --- -for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 4 │ for (var i = 0 of []) {} - 5 │ for (let i = 0 of []) {} - > 6 │ for (const i = 0 of []) {} - │ ^^^ - 7 │ for (using x = y of z) {}; - 8 │ for await (using x = y of z) {}; - --- -for_in_and_of_initializer_strict_mode.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 5 │ for (let i = 0 of []) {} - 6 │ for (const i = 0 of []) {} - > 7 │ for (using x = y of z) {}; - │ ^^^ - 8 │ for await (using x = y of z) {}; - 9 │ for (await using x = y of z) {}; - --- -for_in_and_of_initializer_strict_mode.js:8:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 6 │ for (const i = 0 of []) {} - 7 │ for (using x = y of z) {}; - > 8 │ for await (using x = y of z) {}; - │ ^^^ - 9 │ for (await using x = y of z) {}; - 10 │ for await (await using x = y of z) {}; - --- -for_in_and_of_initializer_strict_mode.js:9:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 7 │ for (using x = y of z) {}; - 8 │ for await (using x = y of z) {}; - > 9 │ for (await using x = y of z) {}; - │ ^^^ - 10 │ for await (await using x = y of z) {}; - 11 │ - --- -for_in_and_of_initializer_strict_mode.js:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..of` statement declarators cannot have an initializer expression - - 8 │ for await (using x = y of z) {}; - 9 │ for (await using x = y of z) {}; - > 10 │ for await (await using x = y of z) {}; - │ ^^^ - 11 │ - --- -for (var i = 0 in []) {} -for (let i = 0 in []) {} -for (const i = 0 in []) {} -for (var i = 0 of []) {} -for (let i = 0 of []) {} -for (const i = 0 of []) {} -for (using x = y of z) {}; -for await (using x = y of z) {}; -for (await using x = y of z) {}; -for await (await using x = y of z) {}; diff --git a/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.rast b/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.rast deleted file mode 100644 index 765c84758d5e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..9 "async" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@10..15 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@15..16 "(" [] [], - initializer: JsBogusAssignment { - items: [ - IDENT@16..22 "async" [] [Whitespace(" ")], - ], - }, - of_token: OF_KW@22..25 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@25..26 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@26..27 "1" [] [], - }, - ], - r_brack_token: R_BRACK@27..28 "]" [] [], - }, - r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], - body: JsEmptyStatement { - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - }, - ], - eof_token: EOF@31..32 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..32 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..31 - 0: JS_VARIABLE_STATEMENT@0..10 - 0: JS_VARIABLE_DECLARATION@0..9 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..9 - 0: JS_VARIABLE_DECLARATOR@4..9 - 0: JS_IDENTIFIER_BINDING@4..9 - 0: IDENT@4..9 "async" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_FOR_OF_STATEMENT@10..31 - 0: FOR_KW@10..15 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@15..16 "(" [] [] - 3: JS_BOGUS_ASSIGNMENT@16..22 - 0: IDENT@16..22 "async" [] [Whitespace(" ")] - 4: OF_KW@22..25 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@25..28 - 0: L_BRACK@25..26 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@26..27 - 0: JS_NUMBER_LITERAL_EXPRESSION@26..27 - 0: JS_NUMBER_LITERAL@26..27 "1" [] [] - 2: R_BRACK@27..28 "]" [] [] - 6: R_PAREN@28..30 ")" [] [Whitespace(" ")] - 7: JS_EMPTY_STATEMENT@30..31 - 0: SEMICOLON@30..31 ";" [] [] - 4: EOF@31..32 "" [Newline("\n")] [] --- -for_of_async_identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × The left-hand side of a `for...of` statement may not be `async` - - 1 │ let async; - > 2 │ for (async of [1]) ; - │ ^^^^^ - 3 │ - --- -let async; -for (async of [1]) ; diff --git a/crates/biome_js_parser/test_data/inline/err/for_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/for_stmt_err.rast deleted file mode 100644 index a99fb9ea9309..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/for_stmt_err.rast +++ /dev/null @@ -1,678 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: missing (required), - initializer: missing (optional), - first_semi_token: SEMICOLON@4..5 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@5..7 ";" [] [Whitespace(" ")], - update: JsObjectExpression { - l_curly_token: L_CURLY@7..8 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@8..9 "}" [] [], - }, - r_paren_token: missing (required), - body: JsForStatement { - for_token: FOR_KW@9..14 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - initializer: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@14..18 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@18..20 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@20..22 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@22..23 "5" [] [], - }, - }, - }, - ], - }, - first_semi_token: SEMICOLON@23..25 ";" [] [Whitespace(" ")], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@25..27 "i" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@27..29 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@29..31 "10" [] [], - }, - }, - second_semi_token: SEMICOLON@31..33 ";" [] [Whitespace(" ")], - update: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@33..34 "i" [] [], - }, - operator_token: PLUS2@34..37 "++" [] [Whitespace(" ")], - }, - r_paren_token: missing (required), - body: JsBlockStatement { - l_curly_token: L_CURLY@37..38 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - }, - }, - JsForStatement { - for_token: FOR_KW@39..44 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - initializer: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@44..48 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@48..50 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@50..52 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@52..53 "5" [] [], - }, - }, - }, - ], - }, - first_semi_token: SEMICOLON@53..55 ";" [] [Whitespace(" ")], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..57 "i" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@57..59 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@59..61 "10" [] [], - }, - }, - second_semi_token: SEMICOLON@61..63 ";" [] [Whitespace(" ")], - update: JsPreUpdateExpression { - operator_token: PLUS2@63..65 "++" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@65..67 "i" [] [Whitespace(" ")], - }, - }, - r_paren_token: missing (required), - body: JsBlockStatement { - l_curly_token: L_CURLY@67..68 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@68..69 "}" [] [], - }, - }, - JsForInStatement { - for_token: FOR_KW@69..74 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@74..75 "(" [] [], - initializer: missing (required), - in_token: IN_KW@75..78 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@78..79 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@79..80 "]" [] [], - }, - r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@82..83 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@83..84 "}" [] [], - }, - }, - JsBogusStatement { - items: [ - FOR_KW@84..89 "for" [Newline("\n")] [Whitespace(" ")], - L_PAREN@89..90 "(" [] [], - JsBogus { - items: [ - LET_KW@90..94 "let" [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@94..95 "i" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@95..97 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@97..99 "j" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@99..101 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@101..103 "6" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - OF_KW@103..106 "of" [] [Whitespace(" ")], - JsArrayExpression { - l_brack_token: L_BRACK@106..107 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@107..108 "]" [] [], - }, - R_PAREN@108..110 ")" [] [Whitespace(" ")], - JsBlockStatement { - l_curly_token: L_CURLY@110..111 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@111..112 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - FOR_KW@112..117 "for" [Newline("\n")] [Whitespace(" ")], - AWAIT_KW@117..123 "await" [] [Whitespace(" ")], - L_PAREN@123..124 "(" [] [], - JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@124..128 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@128..130 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - IN_KW@130..133 "in" [] [Whitespace(" ")], - JsArrayExpression { - l_brack_token: L_BRACK@133..134 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@134..135 "]" [] [], - }, - R_PAREN@135..137 ")" [] [Whitespace(" ")], - JsBlockStatement { - l_curly_token: L_CURLY@137..138 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@138..139 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - FOR_KW@139..144 "for" [Newline("\n")] [Whitespace(" ")], - AWAIT_KW@144..150 "await" [] [Whitespace(" ")], - L_PAREN@150..151 "(" [] [], - JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@151..155 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@155..157 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@157..159 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@159..160 "0" [] [], - }, - }, - }, - ], - }, - SEMICOLON@160..162 ";" [] [Whitespace(" ")], - JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@162..164 "i" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@164..166 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@166..168 "10" [] [], - }, - }, - SEMICOLON@168..170 ";" [] [Whitespace(" ")], - JsPreUpdateExpression { - operator_token: PLUS2@170..172 "++" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@172..173 "i" [] [], - }, - }, - R_PAREN@173..175 ")" [] [Whitespace(" ")], - JsBlockStatement { - l_curly_token: L_CURLY@175..176 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@176..177 "}" [] [], - }, - ], - }, - JsForStatement { - for_token: FOR_KW@177..182 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@182..183 "(" [] [], - initializer: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@183..187 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@187..188 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@188..189 "a" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@189..190 "]" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - first_semi_token: SEMICOLON@190..191 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@191..192 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@194..195 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@195..196 "}" [] [], - }, - }, - ], - eof_token: EOF@196..197 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..197 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..196 - 0: JS_FOR_STATEMENT@0..39 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: SEMICOLON@4..5 ";" [] [] - 4: (empty) - 5: SEMICOLON@5..7 ";" [] [Whitespace(" ")] - 6: JS_OBJECT_EXPRESSION@7..9 - 0: L_CURLY@7..8 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@8..8 - 2: R_CURLY@8..9 "}" [] [] - 7: (empty) - 8: JS_FOR_STATEMENT@9..39 - 0: FOR_KW@9..14 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_VARIABLE_DECLARATION@14..23 - 0: (empty) - 1: LET_KW@14..18 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@18..23 - 0: JS_VARIABLE_DECLARATOR@18..23 - 0: JS_IDENTIFIER_BINDING@18..20 - 0: IDENT@18..20 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@20..23 - 0: EQ@20..22 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@22..23 - 0: JS_NUMBER_LITERAL@22..23 "5" [] [] - 3: SEMICOLON@23..25 ";" [] [Whitespace(" ")] - 4: JS_BINARY_EXPRESSION@25..31 - 0: JS_IDENTIFIER_EXPRESSION@25..27 - 0: JS_REFERENCE_IDENTIFIER@25..27 - 0: IDENT@25..27 "i" [] [Whitespace(" ")] - 1: L_ANGLE@27..29 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@29..31 - 0: JS_NUMBER_LITERAL@29..31 "10" [] [] - 5: SEMICOLON@31..33 ";" [] [Whitespace(" ")] - 6: JS_POST_UPDATE_EXPRESSION@33..37 - 0: JS_IDENTIFIER_ASSIGNMENT@33..34 - 0: IDENT@33..34 "i" [] [] - 1: PLUS2@34..37 "++" [] [Whitespace(" ")] - 7: (empty) - 8: JS_BLOCK_STATEMENT@37..39 - 0: L_CURLY@37..38 "{" [] [] - 1: JS_STATEMENT_LIST@38..38 - 2: R_CURLY@38..39 "}" [] [] - 1: JS_FOR_STATEMENT@39..69 - 0: FOR_KW@39..44 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_VARIABLE_DECLARATION@44..53 - 0: (empty) - 1: LET_KW@44..48 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@48..53 - 0: JS_VARIABLE_DECLARATOR@48..53 - 0: JS_IDENTIFIER_BINDING@48..50 - 0: IDENT@48..50 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@50..53 - 0: EQ@50..52 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@52..53 - 0: JS_NUMBER_LITERAL@52..53 "5" [] [] - 3: SEMICOLON@53..55 ";" [] [Whitespace(" ")] - 4: JS_BINARY_EXPRESSION@55..61 - 0: JS_IDENTIFIER_EXPRESSION@55..57 - 0: JS_REFERENCE_IDENTIFIER@55..57 - 0: IDENT@55..57 "i" [] [Whitespace(" ")] - 1: L_ANGLE@57..59 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@59..61 - 0: JS_NUMBER_LITERAL@59..61 "10" [] [] - 5: SEMICOLON@61..63 ";" [] [Whitespace(" ")] - 6: JS_PRE_UPDATE_EXPRESSION@63..67 - 0: PLUS2@63..65 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@65..67 - 0: IDENT@65..67 "i" [] [Whitespace(" ")] - 7: (empty) - 8: JS_BLOCK_STATEMENT@67..69 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_STATEMENT_LIST@68..68 - 2: R_CURLY@68..69 "}" [] [] - 2: JS_FOR_IN_STATEMENT@69..84 - 0: FOR_KW@69..74 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@74..75 "(" [] [] - 2: (empty) - 3: IN_KW@75..78 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@78..80 - 0: L_BRACK@78..79 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@79..79 - 2: R_BRACK@79..80 "]" [] [] - 5: R_PAREN@80..82 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@82..84 - 0: L_CURLY@82..83 "{" [] [] - 1: JS_STATEMENT_LIST@83..83 - 2: R_CURLY@83..84 "}" [] [] - 3: JS_BOGUS_STATEMENT@84..112 - 0: FOR_KW@84..89 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@89..90 "(" [] [] - 2: JS_BOGUS@90..103 - 0: LET_KW@90..94 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR@94..95 - 0: JS_IDENTIFIER_BINDING@94..95 - 0: IDENT@94..95 "i" [] [] - 1: (empty) - 2: (empty) - 2: COMMA@95..97 "," [] [Whitespace(" ")] - 3: JS_VARIABLE_DECLARATOR@97..103 - 0: JS_IDENTIFIER_BINDING@97..99 - 0: IDENT@97..99 "j" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@99..103 - 0: EQ@99..101 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@101..103 - 0: JS_NUMBER_LITERAL@101..103 "6" [] [Whitespace(" ")] - 3: OF_KW@103..106 "of" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@106..108 - 0: L_BRACK@106..107 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@107..107 - 2: R_BRACK@107..108 "]" [] [] - 5: R_PAREN@108..110 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@110..112 - 0: L_CURLY@110..111 "{" [] [] - 1: JS_STATEMENT_LIST@111..111 - 2: R_CURLY@111..112 "}" [] [] - 4: JS_BOGUS_STATEMENT@112..139 - 0: FOR_KW@112..117 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@117..123 "await" [] [Whitespace(" ")] - 2: L_PAREN@123..124 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@124..130 - 0: (empty) - 1: LET_KW@124..128 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@128..130 - 0: JS_IDENTIFIER_BINDING@128..130 - 0: IDENT@128..130 "a" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: IN_KW@130..133 "in" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@133..135 - 0: L_BRACK@133..134 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@134..134 - 2: R_BRACK@134..135 "]" [] [] - 6: R_PAREN@135..137 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@137..139 - 0: L_CURLY@137..138 "{" [] [] - 1: JS_STATEMENT_LIST@138..138 - 2: R_CURLY@138..139 "}" [] [] - 5: JS_BOGUS_STATEMENT@139..177 - 0: FOR_KW@139..144 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@144..150 "await" [] [Whitespace(" ")] - 2: L_PAREN@150..151 "(" [] [] - 3: JS_VARIABLE_DECLARATION@151..160 - 0: (empty) - 1: LET_KW@151..155 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@155..160 - 0: JS_VARIABLE_DECLARATOR@155..160 - 0: JS_IDENTIFIER_BINDING@155..157 - 0: IDENT@155..157 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@157..160 - 0: EQ@157..159 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@159..160 - 0: JS_NUMBER_LITERAL@159..160 "0" [] [] - 4: SEMICOLON@160..162 ";" [] [Whitespace(" ")] - 5: JS_BINARY_EXPRESSION@162..168 - 0: JS_IDENTIFIER_EXPRESSION@162..164 - 0: JS_REFERENCE_IDENTIFIER@162..164 - 0: IDENT@162..164 "i" [] [Whitespace(" ")] - 1: L_ANGLE@164..166 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@166..168 - 0: JS_NUMBER_LITERAL@166..168 "10" [] [] - 6: SEMICOLON@168..170 ";" [] [Whitespace(" ")] - 7: JS_PRE_UPDATE_EXPRESSION@170..173 - 0: PLUS2@170..172 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@172..173 - 0: IDENT@172..173 "i" [] [] - 8: R_PAREN@173..175 ")" [] [Whitespace(" ")] - 9: JS_BLOCK_STATEMENT@175..177 - 0: L_CURLY@175..176 "{" [] [] - 1: JS_STATEMENT_LIST@176..176 - 2: R_CURLY@176..177 "}" [] [] - 6: JS_FOR_STATEMENT@177..196 - 0: FOR_KW@177..182 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@182..183 "(" [] [] - 2: JS_VARIABLE_DECLARATION@183..190 - 0: (empty) - 1: LET_KW@183..187 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@187..190 - 0: JS_VARIABLE_DECLARATOR@187..190 - 0: JS_ARRAY_BINDING_PATTERN@187..190 - 0: L_BRACK@187..188 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@188..189 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@188..189 - 0: JS_IDENTIFIER_BINDING@188..189 - 0: IDENT@188..189 "a" [] [] - 1: (empty) - 2: R_BRACK@189..190 "]" [] [] - 1: (empty) - 2: (empty) - 3: SEMICOLON@190..191 ";" [] [] - 4: (empty) - 5: SEMICOLON@191..192 ";" [] [] - 6: (empty) - 7: R_PAREN@192..194 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@194..196 - 0: L_CURLY@194..195 "{" [] [] - 1: JS_STATEMENT_LIST@195..195 - 2: R_CURLY@195..196 "}" [] [] - 4: EOF@196..197 "" [Newline("\n")] [] --- -for_stmt_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `;` - - > 1 │ for ;; {} - │ ^ - 2 │ for let i = 5; i < 10; i++ {} - 3 │ for let i = 5; i < 10; ++i {} - - i Remove ; - --- -for_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `for` - - 1 │ for ;; {} - > 2 │ for let i = 5; i < 10; i++ {} - │ ^^^ - 3 │ for let i = 5; i < 10; ++i {} - 4 │ for (in []) {} - - i Remove for - --- -for_stmt_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `let` - - 1 │ for ;; {} - > 2 │ for let i = 5; i < 10; i++ {} - │ ^^^ - 3 │ for let i = 5; i < 10; ++i {} - 4 │ for (in []) {} - - i Remove let - --- -for_stmt_err.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `{` - - 1 │ for ;; {} - > 2 │ for let i = 5; i < 10; i++ {} - │ ^ - 3 │ for let i = 5; i < 10; ++i {} - 4 │ for (in []) {} - - i Remove { - --- -for_stmt_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `let` - - 1 │ for ;; {} - 2 │ for let i = 5; i < 10; i++ {} - > 3 │ for let i = 5; i < 10; ++i {} - │ ^^^ - 4 │ for (in []) {} - 5 │ for (let i, j = 6 of []) {} - - i Remove let - --- -for_stmt_err.js:3:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `{` - - 1 │ for ;; {} - 2 │ for let i = 5; i < 10; i++ {} - > 3 │ for let i = 5; i < 10; ++i {} - │ ^ - 4 │ for (in []) {} - 5 │ for (let i, j = 6 of []) {} - - i Remove { - --- -for_stmt_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Only a single declaration is allowed in a `for...of` statement. - - 3 │ for let i = 5; i < 10; ++i {} - 4 │ for (in []) {} - > 5 │ for (let i, j = 6 of []) {} - │ ^^^^^ - 6 │ for await (let a in []) {} - 7 │ for await (let i = 0; i < 10; ++i) {} - - i additional declarations - --- -for_stmt_err.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × await can only be used in conjunction with `for...of` statements - - 4 │ for (in []) {} - 5 │ for (let i, j = 6 of []) {} - > 6 │ for await (let a in []) {} - │ ^^^^^ - 7 │ for await (let i = 0; i < 10; ++i) {} - 8 │ for (let [a];;) {} - - i Remove the await here - - 4 │ for (in []) {} - 5 │ for (let i, j = 6 of []) {} - > 6 │ for await (let a in []) {} - │ ^^^^^ - 7 │ for await (let i = 0; i < 10; ++i) {} - 8 │ for (let [a];;) {} - - i or convert this to a `for...of` statement - - 4 │ for (in []) {} - 5 │ for (let i, j = 6 of []) {} - > 6 │ for await (let a in []) {} - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ - 7 │ for await (let i = 0; i < 10; ++i) {} - 8 │ for (let [a];;) {} - --- -for_stmt_err.js:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × await can only be used in conjunction with `for...of` statements - - 5 │ for (let i, j = 6 of []) {} - 6 │ for await (let a in []) {} - > 7 │ for await (let i = 0; i < 10; ++i) {} - │ ^^^^^ - 8 │ for (let [a];;) {} - 9 │ - - i Remove the await here - - 5 │ for (let i, j = 6 of []) {} - 6 │ for await (let a in []) {} - > 7 │ for await (let i = 0; i < 10; ++i) {} - │ ^^^^^ - 8 │ for (let [a];;) {} - 9 │ - - i or convert this to a `for...of` statement - - 5 │ for (let i, j = 6 of []) {} - 6 │ for await (let a in []) {} - > 7 │ for await (let i = 0; i < 10; ++i) {} - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 8 │ for (let [a];;) {} - 9 │ - --- -for_stmt_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Object and Array patterns require initializers. - - 6 │ for await (let a in []) {} - 7 │ for await (let i = 0; i < 10; ++i) {} - > 8 │ for (let [a];;) {} - │ ^^^ - 9 │ - - i This pattern is declared, but it is not given an initialized value. - --- -for ;; {} -for let i = 5; i < 10; i++ {} -for let i = 5; i < 10; ++i {} -for (in []) {} -for (let i, j = 6 of []) {} -for await (let a in []) {} -for await (let i = 0; i < 10; ++i) {} -for (let [a];;) {} diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.rast b/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.rast deleted file mode 100644 index 95d497a1fc8e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.rast +++ /dev/null @@ -1,116 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (required), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@9..10 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@10..11 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - missing separator, - JsBogusParameter { - items: [ - PLUS2@11..13 "++" [] [], - ], - }, - COMMA@13..15 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@15..16 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@18..19 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@19..20 "}" [] [], - }, - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_FUNCTION_DECLARATION@0..20 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@9..18 - 0: L_PAREN@9..10 "(" [] [] - 1: JS_PARAMETER_LIST@10..16 - 0: JS_FORMAL_PARAMETER@10..11 - 0: JS_DECORATOR_LIST@10..10 - 1: JS_IDENTIFIER_BINDING@10..11 - 0: IDENT@10..11 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: (empty) - 2: JS_BOGUS_PARAMETER@11..13 - 0: PLUS2@11..13 "++" [] [] - 3: COMMA@13..15 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@15..16 - 0: JS_DECORATOR_LIST@15..15 - 1: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "c" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@18..20 - 0: L_CURLY@18..19 "{" [] [] - 1: JS_DIRECTIVE_LIST@19..19 - 2: JS_STATEMENT_LIST@19..19 - 3: R_CURLY@19..20 "}" [] [] - 4: EOF@20..21 "" [Newline("\n")] [] --- -formal_params_invalid.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a name for the function in a function declaration, but found none - - > 1 │ function (a++, c) {} - │ ^ - 2 │ - --- -formal_params_invalid.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `++` - - > 1 │ function (a++, c) {} - │ ^^ - 2 │ - - i Remove ++ - --- -function (a++, c) {} diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast b/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast deleted file mode 100644 index 286166a21e2d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast +++ /dev/null @@ -1,78 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - TRUE_KW@13..17 "true" [] [], - ], - }, - ], - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@19..20 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_FUNCTION_DECLARATION@0..21 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..19 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..17 - 0: JS_BOGUS_PARAMETER@13..17 - 0: TRUE_KW@13..17 "true" [] [] - 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@19..21 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_DIRECTIVE_LIST@20..20 - 2: JS_STATEMENT_LIST@20..20 - 3: R_CURLY@20..21 "}" [] [] - 4: EOF@21..22 "" [Newline("\n")] [] --- -formal_params_no_binding_element.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parameter but instead found 'true'. - - > 1 │ function foo(true) {} - │ ^^^^ - 2 │ - - i Expected a parameter here. - - > 1 │ function foo(true) {} - │ ^^^^ - 2 │ - --- -function foo(true) {} diff --git a/crates/biome_js_parser/test_data/inline/err/function_broken.rast b/crates/biome_js_parser/test_data/inline/err/function_broken.rast deleted file mode 100644 index 6338f2cbe682..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/function_broken.rast +++ /dev/null @@ -1,128 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..14 ")" [] [], - }, - return_type_annotation: missing (optional), - body: missing (required), - }, - JsBogusStatement { - items: [ - R_PAREN@14..15 ")" [] [], - R_CURLY@15..16 "}" [] [], - R_PAREN@16..17 ")" [] [], - R_CURLY@17..18 "}" [] [], - ], - }, - JsBlockStatement { - l_curly_token: L_CURLY@18..19 "{" [] [], - statements: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@19..20 "{" [] [], - statements: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@20..23 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@23..24 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - ], - r_curly_token: missing (required), - }, - ], - r_curly_token: missing (required), - }, - ], - r_curly_token: missing (required), - }, - ], - eof_token: EOF@25..26 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..26 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..25 - 0: JS_FUNCTION_DECLARATION@0..14 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..14 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..14 ")" [] [] - 6: (empty) - 7: (empty) - 1: JS_BOGUS_STATEMENT@14..18 - 0: R_PAREN@14..15 ")" [] [] - 1: R_CURLY@15..16 "}" [] [] - 2: R_PAREN@16..17 ")" [] [] - 3: R_CURLY@17..18 "}" [] [] - 2: JS_BLOCK_STATEMENT@18..25 - 0: L_CURLY@18..19 "{" [] [] - 1: JS_STATEMENT_LIST@19..25 - 0: JS_BLOCK_STATEMENT@19..25 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_STATEMENT_LIST@20..25 - 0: JS_BLOCK_STATEMENT@20..25 - 0: L_CURLY@20..23 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@23..25 - 0: JS_BLOCK_STATEMENT@23..25 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_STATEMENT_LIST@24..24 - 2: R_CURLY@24..25 "}" [] [] - 2: (empty) - 2: (empty) - 2: (empty) - 4: EOF@25..26 "" [Newline("\n")] [] --- -function_broken.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a function body but instead found ')'. - - > 1 │ function foo())})}{{{ {} - │ ^ - 2 │ - - i Expected a function body here. - - > 1 │ function foo())})}{{{ {} - │ ^ - 2 │ - --- -function_broken.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead the file ends - - 1 │ function foo())})}{{{ {} - > 2 │ - │ - - i the file ends here - - 1 │ function foo())})}{{{ {} - > 2 │ - │ - --- -function foo())})}{{{ {} diff --git a/crates/biome_js_parser/test_data/inline/err/function_decl_err.rast b/crates/biome_js_parser/test_data/inline/err/function_decl_err.rast deleted file mode 100644 index 5759cdcb9509..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/function_decl_err.rast +++ /dev/null @@ -1,571 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..8 "function" [] [], - star_token: missing (optional), - id: missing (required), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@8..9 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@9..11 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@11..12 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@12..13 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@13..23 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@23..27 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - parameters: missing (required), - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@27..28 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: missing (required), - type_parameters: missing (optional), - parameters: missing (required), - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@39..40 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@51..52 "*" [] [], - id: missing (required), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@52..53 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@55..56 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@56..57 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@57..64 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@64..72 "function" [] [], - star_token: missing (optional), - id: missing (required), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@72..73 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@73..75 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@75..76 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@76..77 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")], - star_token: STAR@93..94 "*" [] [], - id: missing (required), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@94..95 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@95..97 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@97..98 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@98..99 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@99..109 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@109..110 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@110..114 "foo2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@114..115 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@117..118 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@118..119 "}" [] [], - }, - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@119..126 "yield" [Newline("\n")] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@126..130 "foo3" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@130..131 ";" [] [], - }, - JsBogusStatement { - items: [ - FUNCTION_KW@131..141 "function" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@141..146 "test2" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@146..147 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@147..148 ")" [] [], - }, - JsBogus { - items: [ - COLON@148..150 ":" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@150..157 "number" [] [Whitespace(" ")], - }, - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@157..158 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@158..159 "}" [] [], - }, - ], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@159..169 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@169..173 "foo4" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@173..174 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@174..179 "await" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@179..181 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@181..182 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@182..183 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@183..193 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@193..197 "foo5" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@197..198 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@198..203 "yield" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@203..205 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@205..206 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@206..207 "}" [] [], - }, - }, - ], - eof_token: EOF@207..208 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..208 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..207 - 0: JS_FUNCTION_DECLARATION@0..13 - 0: (empty) - 1: FUNCTION_KW@0..8 "function" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@8..11 - 0: L_PAREN@8..9 "(" [] [] - 1: JS_PARAMETER_LIST@9..9 - 2: R_PAREN@9..11 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@11..13 - 0: L_CURLY@11..12 "{" [] [] - 1: JS_DIRECTIVE_LIST@12..12 - 2: JS_STATEMENT_LIST@12..12 - 3: R_CURLY@12..13 "}" [] [] - 1: JS_FUNCTION_DECLARATION@13..29 - 0: (empty) - 1: FUNCTION_KW@13..23 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@23..27 - 0: IDENT@23..27 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: JS_FUNCTION_BODY@27..29 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..28 - 3: R_CURLY@28..29 "}" [] [] - 2: JS_FUNCTION_DECLARATION@29..41 - 0: (empty) - 1: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: JS_FUNCTION_BODY@39..41 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..40 - 3: R_CURLY@40..41 "}" [] [] - 3: JS_FUNCTION_DECLARATION@41..57 - 0: (empty) - 1: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@51..52 "*" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@52..55 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_PARAMETER_LIST@53..53 - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@55..57 - 0: L_CURLY@55..56 "{" [] [] - 1: JS_DIRECTIVE_LIST@56..56 - 2: JS_STATEMENT_LIST@56..56 - 3: R_CURLY@56..57 "}" [] [] - 4: JS_FUNCTION_DECLARATION@57..77 - 0: ASYNC_KW@57..64 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@64..72 "function" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@72..75 - 0: L_PAREN@72..73 "(" [] [] - 1: JS_PARAMETER_LIST@73..73 - 2: R_PAREN@73..75 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@75..77 - 0: L_CURLY@75..76 "{" [] [] - 1: JS_DIRECTIVE_LIST@76..76 - 2: JS_STATEMENT_LIST@76..76 - 3: R_CURLY@76..77 "}" [] [] - 5: JS_FUNCTION_DECLARATION@77..99 - 0: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")] - 2: STAR@93..94 "*" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@94..97 - 0: L_PAREN@94..95 "(" [] [] - 1: JS_PARAMETER_LIST@95..95 - 2: R_PAREN@95..97 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@97..99 - 0: L_CURLY@97..98 "{" [] [] - 1: JS_DIRECTIVE_LIST@98..98 - 2: JS_STATEMENT_LIST@98..98 - 3: R_CURLY@98..99 "}" [] [] - 6: JS_FUNCTION_DECLARATION@99..119 - 0: (empty) - 1: FUNCTION_KW@99..109 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@109..110 "*" [] [] - 3: JS_IDENTIFIER_BINDING@110..114 - 0: IDENT@110..114 "foo2" [] [] - 4: (empty) - 5: JS_PARAMETERS@114..117 - 0: L_PAREN@114..115 "(" [] [] - 1: JS_PARAMETER_LIST@115..115 - 2: R_PAREN@115..117 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@117..119 - 0: L_CURLY@117..118 "{" [] [] - 1: JS_DIRECTIVE_LIST@118..118 - 2: JS_STATEMENT_LIST@118..118 - 3: R_CURLY@118..119 "}" [] [] - 7: JS_EXPRESSION_STATEMENT@119..131 - 0: JS_BOGUS_EXPRESSION@119..130 - 0: YIELD_KW@119..126 "yield" [Newline("\n")] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@126..130 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@126..130 - 0: JS_REFERENCE_IDENTIFIER@126..130 - 0: IDENT@126..130 "foo3" [] [] - 1: SEMICOLON@130..131 ";" [] [] - 8: JS_BOGUS_STATEMENT@131..159 - 0: FUNCTION_KW@131..141 "function" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@141..146 - 0: IDENT@141..146 "test2" [] [] - 2: JS_PARAMETERS@146..148 - 0: L_PAREN@146..147 "(" [] [] - 1: JS_PARAMETER_LIST@147..147 - 2: R_PAREN@147..148 ")" [] [] - 3: JS_BOGUS@148..157 - 0: COLON@148..150 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@150..157 - 0: NUMBER_KW@150..157 "number" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@157..159 - 0: L_CURLY@157..158 "{" [] [] - 1: JS_DIRECTIVE_LIST@158..158 - 2: JS_STATEMENT_LIST@158..158 - 3: R_CURLY@158..159 "}" [] [] - 9: JS_FUNCTION_DECLARATION@159..183 - 0: (empty) - 1: FUNCTION_KW@159..169 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@169..173 - 0: IDENT@169..173 "foo4" [] [] - 4: (empty) - 5: JS_PARAMETERS@173..181 - 0: L_PAREN@173..174 "(" [] [] - 1: JS_PARAMETER_LIST@174..179 - 0: JS_FORMAL_PARAMETER@174..179 - 0: JS_DECORATOR_LIST@174..174 - 1: JS_BOGUS_BINDING@174..179 - 0: IDENT@174..179 "await" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@179..181 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@181..183 - 0: L_CURLY@181..182 "{" [] [] - 1: JS_DIRECTIVE_LIST@182..182 - 2: JS_STATEMENT_LIST@182..182 - 3: R_CURLY@182..183 "}" [] [] - 10: JS_FUNCTION_DECLARATION@183..207 - 0: (empty) - 1: FUNCTION_KW@183..193 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@193..197 - 0: IDENT@193..197 "foo5" [] [] - 4: (empty) - 5: JS_PARAMETERS@197..205 - 0: L_PAREN@197..198 "(" [] [] - 1: JS_PARAMETER_LIST@198..203 - 0: JS_FORMAL_PARAMETER@198..203 - 0: JS_DECORATOR_LIST@198..198 - 1: JS_BOGUS_BINDING@198..203 - 0: IDENT@198..203 "yield" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@203..205 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@205..207 - 0: L_CURLY@205..206 "{" [] [] - 1: JS_DIRECTIVE_LIST@206..206 - 2: JS_STATEMENT_LIST@206..206 - 3: R_CURLY@206..207 "}" [] [] - 4: EOF@207..208 "" [Newline("\n")] [] --- -function_decl_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a name for the function in a function declaration, but found none - - > 1 │ function() {} - │ ^ - 2 │ function foo {} - 3 │ function {} - --- -function_decl_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parenthesis '(' but instead found '{'. - - 1 │ function() {} - > 2 │ function foo {} - │ ^ - 3 │ function {} - 4 │ function *() {} - - i Expected a parenthesis '(' here. - - 1 │ function() {} - > 2 │ function foo {} - │ ^ - 3 │ function {} - 4 │ function *() {} - --- -function_decl_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a name for the function in a function declaration, but found none - - 1 │ function() {} - 2 │ function foo {} - > 3 │ function {} - │ ^ - 4 │ function *() {} - 5 │ async function() {} - --- -function_decl_err.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a name for the function in a function declaration, but found none - - 2 │ function foo {} - 3 │ function {} - > 4 │ function *() {} - │ ^ - 5 │ async function() {} - 6 │ async function *() {} - --- -function_decl_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a name for the function in a function declaration, but found none - - 3 │ function {} - 4 │ function *() {} - > 5 │ async function() {} - │ ^ - 6 │ async function *() {} - 7 │ function *foo2() {} - --- -function_decl_err.js:6:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a name for the function in a function declaration, but found none - - 4 │ function *() {} - 5 │ async function() {} - > 6 │ async function *() {} - │ ^ - 7 │ function *foo2() {} - 8 │ yield foo3; - --- -function_decl_err.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 6 │ async function *() {} - 7 │ function *foo2() {} - > 8 │ yield foo3; - │ ^^^^^ - 9 │ function test2(): number {} - 10 │ function foo4(await) {} - --- -function_decl_err.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × return types can only be used in TypeScript files - - 7 │ function *foo2() {} - 8 │ yield foo3; - > 9 │ function test2(): number {} - │ ^^^^^^^^ - 10 │ function foo4(await) {} - 11 │ function foo5(yield) {} - --- -function_decl_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier inside of a module - - 8 │ yield foo3; - 9 │ function test2(): number {} - > 10 │ function foo4(await) {} - │ ^^^^^ - 11 │ function foo5(yield) {} - 12 │ - --- -function_decl_err.js:11:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - 9 │ function test2(): number {} - 10 │ function foo4(await) {} - > 11 │ function foo5(yield) {} - │ ^^^^^ - 12 │ - --- -function() {} -function foo {} -function {} -function *() {} -async function() {} -async function *() {} -function *foo2() {} -yield foo3; -function test2(): number {} -function foo4(await) {} -function foo5(yield) {} diff --git a/crates/biome_js_parser/test_data/inline/err/function_escaped_async.rast b/crates/biome_js_parser/test_data/inline/err/function_escaped_async.rast deleted file mode 100644 index 740e15007784..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/function_escaped_async.rast +++ /dev/null @@ -1,70 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: VOID_KW@0..5 "void" [] [Whitespace(" ")], - argument: JsBogusExpression { - items: [ - ERROR_TOKEN@5..16 "\\u0061sync" [] [Whitespace(" ")], - FUNCTION_KW@16..25 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@25..26 "f" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@26..27 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@27..28 ")" [] [], - }, - JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - ], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_EXPRESSION_STATEMENT@0..30 - 0: JS_UNARY_EXPRESSION@0..30 - 0: VOID_KW@0..5 "void" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@5..30 - 0: ERROR_TOKEN@5..16 "\\u0061sync" [] [Whitespace(" ")] - 1: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "f" [] [] - 3: JS_PARAMETERS@26..28 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_PARAMETER_LIST@27..27 - 2: R_PAREN@27..28 ")" [] [] - 4: JS_FUNCTION_BODY@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..30 "}" [] [] - 1: (empty) - 4: EOF@30..31 "" [Newline("\n")] [] --- -function_escaped_async.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'async' keyword cannot contain escape character. - - > 1 │ void \u0061sync function f(){} - │ ^^^^^^^^^^ - 2 │ - --- -void \u0061sync function f(){} diff --git a/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.rast b/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.rast deleted file mode 100644 index ee09f09e9b36..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.rast +++ /dev/null @@ -1,234 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsFunctionExpression { - async_token: ASYNC_KW@1..7 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsBogusBinding { - items: [ - IDENT@16..21 "await" [] [], - ], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@24..25 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - }, - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@28..30 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@30..38 "function" [] [], - star_token: STAR@38..40 "*" [] [Whitespace(" ")], - id: JsBogusBinding { - items: [ - IDENT@40..45 "yield" [] [], - ], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@45..46 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@48..49 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@49..50 "}" [] [], - }, - }, - r_paren_token: R_PAREN@50..51 ")" [] [], - }, - semicolon_token: SEMICOLON@51..52 ";" [] [], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@52..61 "function" [Newline("\n")] [], - star_token: STAR@61..63 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@63..67 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@67..68 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@70..72 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@72..81 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsBogusBinding { - items: [ - IDENT@81..86 "yield" [] [], - ], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@86..87 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@87..89 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@89..90 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@90..92 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - }, - ], - eof_token: EOF@93..94 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..94 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..93 - 0: JS_EXPRESSION_STATEMENT@0..28 - 0: JS_PARENTHESIZED_EXPRESSION@0..27 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_FUNCTION_EXPRESSION@1..26 - 0: ASYNC_KW@1..7 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_BOGUS_BINDING@16..21 - 0: IDENT@16..21 "await" [] [] - 4: (empty) - 5: JS_PARAMETERS@21..24 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_PARAMETER_LIST@22..22 - 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@24..26 - 0: L_CURLY@24..25 "{" [] [] - 1: JS_DIRECTIVE_LIST@25..25 - 2: JS_STATEMENT_LIST@25..25 - 3: R_CURLY@25..26 "}" [] [] - 2: R_PAREN@26..27 ")" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@28..52 - 0: JS_PARENTHESIZED_EXPRESSION@28..51 - 0: L_PAREN@28..30 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@30..50 - 0: (empty) - 1: FUNCTION_KW@30..38 "function" [] [] - 2: STAR@38..40 "*" [] [Whitespace(" ")] - 3: JS_BOGUS_BINDING@40..45 - 0: IDENT@40..45 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@45..48 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_PARAMETER_LIST@46..46 - 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@48..50 - 0: L_CURLY@48..49 "{" [] [] - 1: JS_DIRECTIVE_LIST@49..49 - 2: JS_STATEMENT_LIST@49..49 - 3: R_CURLY@49..50 "}" [] [] - 2: R_PAREN@50..51 ")" [] [] - 1: SEMICOLON@51..52 ";" [] [] - 2: JS_FUNCTION_DECLARATION@52..93 - 0: (empty) - 1: FUNCTION_KW@52..61 "function" [Newline("\n")] [] - 2: STAR@61..63 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@63..67 - 0: IDENT@63..67 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@67..70 - 0: L_PAREN@67..68 "(" [] [] - 1: JS_PARAMETER_LIST@68..68 - 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@70..93 - 0: L_CURLY@70..72 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@72..72 - 2: JS_STATEMENT_LIST@72..92 - 0: JS_FUNCTION_DECLARATION@72..92 - 0: (empty) - 1: FUNCTION_KW@72..81 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_BOGUS_BINDING@81..86 - 0: IDENT@81..86 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@86..89 - 0: L_PAREN@86..87 "(" [] [] - 1: JS_PARAMETER_LIST@87..87 - 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@89..92 - 0: L_CURLY@89..90 "{" [] [] - 1: JS_DIRECTIVE_LIST@90..90 - 2: JS_STATEMENT_LIST@90..90 - 3: R_CURLY@90..92 "}" [] [Whitespace(" ")] - 3: R_CURLY@92..93 "}" [] [] - 4: EOF@93..94 "" [Newline("\n")] [] --- -function_expression_id_err.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - > 1 │ (async function await() {}); - │ ^^^^^ - 2 │ (function* yield() {}); - 3 │ function* test() { function yield() {} } - --- -function_expression_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `yield` as an identifier in generator function - - 1 │ (async function await() {}); - > 2 │ (function* yield() {}); - │ ^^^^^ - 3 │ function* test() { function yield() {} } - 4 │ - --- -function_expression_id_err.js:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `yield` as an identifier in generator function - - 1 │ (async function await() {}); - 2 │ (function* yield() {}); - > 3 │ function* test() { function yield() {} } - │ ^^^^^ - 4 │ - --- -(async function await() {}); -(function* yield() {}); -function* test() { function yield() {} } diff --git a/crates/biome_js_parser/test_data/inline/err/function_id_err.rast b/crates/biome_js_parser/test_data/inline/err/function_id_err.rast deleted file mode 100644 index 22b552d00266..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/function_id_err.rast +++ /dev/null @@ -1,126 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..8 "function" [] [], - star_token: STAR@8..10 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@10..14 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@14..15 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - id: JsBogusBinding { - items: [ - IDENT@30..35 "yield" [] [], - ], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@35..36 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@36..40 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@42..43 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@46..47 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_FUNCTION_DECLARATION@0..46 - 0: (empty) - 1: FUNCTION_KW@0..8 "function" [] [] - 2: STAR@8..10 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@10..14 - 0: IDENT@10..14 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@14..17 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_PARAMETER_LIST@15..15 - 2: R_PAREN@15..17 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@17..46 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..44 - 0: JS_FUNCTION_DECLARATION@18..44 - 0: (empty) - 1: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_BOGUS_BINDING@30..35 - 0: IDENT@30..35 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@35..42 - 0: L_PAREN@35..36 "(" [] [] - 1: JS_PARAMETER_LIST@36..40 - 0: JS_FORMAL_PARAMETER@36..40 - 0: JS_DECORATOR_LIST@36..36 - 1: JS_IDENTIFIER_BINDING@36..40 - 0: IDENT@36..40 "test" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@42..44 - 0: L_CURLY@42..43 "{" [] [] - 1: JS_DIRECTIVE_LIST@43..43 - 2: JS_STATEMENT_LIST@43..43 - 3: R_CURLY@43..44 "}" [] [] - 3: R_CURLY@44..46 "}" [Newline("\n")] [] - 4: EOF@46..47 "" [Newline("\n")] [] --- -function_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `yield` as an identifier in generator function - - 1 │ function* test() { - > 2 │ function yield(test) {} - │ ^^^^^ - 3 │ } - 4 │ - --- -function* test() { - function yield(test) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast b/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast deleted file mode 100644 index 41cfbe02fa55..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast +++ /dev/null @@ -1,193 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsBogusStatement { - items: [ - FUNCTION_KW@10..19 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@19..20 "a" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@23..24 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - ], - }, - else_clause: missing (optional), - }, - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@25..32 "label1" [Newline("\n")] [], - }, - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - body: JsBogusStatement { - items: [ - FUNCTION_KW@34..43 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@43..44 "b" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@47..48 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - ], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@49..56 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@56..57 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@57..61 "true" [] [], - }, - r_paren_token: R_PAREN@61..63 ")" [] [Whitespace(" ")], - body: JsBogusStatement { - items: [ - FUNCTION_KW@63..72 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@72..73 "c" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@73..74 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@74..76 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@76..77 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@77..78 "}" [] [], - }, - ], - }, - }, - ], - eof_token: EOF@78..79 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..79 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..78 - 0: JS_IF_STATEMENT@0..25 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@10..25 - 0: FUNCTION_KW@10..19 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@19..20 - 0: IDENT@19..20 "a" [] [] - 2: JS_PARAMETERS@20..23 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..21 - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@23..25 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_DIRECTIVE_LIST@24..24 - 2: JS_STATEMENT_LIST@24..24 - 3: R_CURLY@24..25 "}" [] [] - 5: (empty) - 1: JS_LABELED_STATEMENT@25..49 - 0: JS_LABEL@25..32 - 0: IDENT@25..32 "label1" [Newline("\n")] [] - 1: COLON@32..34 ":" [] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@34..49 - 0: FUNCTION_KW@34..43 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@43..44 - 0: IDENT@43..44 "b" [] [] - 2: JS_PARAMETERS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..45 - 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@47..49 - 0: L_CURLY@47..48 "{" [] [] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..48 - 3: R_CURLY@48..49 "}" [] [] - 2: JS_WHILE_STATEMENT@49..78 - 0: WHILE_KW@49..56 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@56..57 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@57..61 - 0: TRUE_KW@57..61 "true" [] [] - 3: R_PAREN@61..63 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@63..78 - 0: FUNCTION_KW@63..72 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@72..73 - 0: IDENT@72..73 "c" [] [] - 2: JS_PARAMETERS@73..76 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_PARAMETER_LIST@74..74 - 2: R_PAREN@74..76 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@76..78 - 0: L_CURLY@76..77 "{" [] [] - 1: JS_DIRECTIVE_LIST@77..77 - 2: JS_STATEMENT_LIST@77..77 - 3: R_CURLY@77..78 "}" [] [] - 4: EOF@78..79 "" [Newline("\n")] [] --- -function_in_single_statement_context_strict.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In strict mode code, functions can only be declared at top level or inside a block - - > 1 │ if (true) function a() {} - │ ^^^^^^^^^^^^^^^ - 2 │ label1: function b() {} - 3 │ while (true) function c() {} - - i wrap the function in a block statement - --- -function_in_single_statement_context_strict.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In strict mode code, functions can only be declared at top level or inside a block - - 1 │ if (true) function a() {} - > 2 │ label1: function b() {} - │ ^^^^^^^^^^^^^^^ - 3 │ while (true) function c() {} - 4 │ - - i wrap the function in a block statement - --- -function_in_single_statement_context_strict.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In strict mode code, functions can only be declared at top level or inside a block - - 1 │ if (true) function a() {} - 2 │ label1: function b() {} - > 3 │ while (true) function c() {} - │ ^^^^^^^^^^^^^^^ - 4 │ - - i wrap the function in a block statement - --- -if (true) function a() {} -label1: function b() {} -while (true) function c() {} diff --git a/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.rast b/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.rast deleted file mode 100644 index 73e855011d20..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.rast +++ /dev/null @@ -1,85 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..14 "Getters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsClassMemberList [ - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@22..25 "foo" [] [], - }, - l_paren_token: L_PAREN@25..26 "(" [] [], - r_paren_token: R_PAREN@26..27 ")" [] [], - return_type: missing (optional), - body: missing (required), - }, - ], - r_curly_token: R_CURLY@27..29 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_CLASS_DECLARATION@0..29 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..14 - 0: IDENT@6..14 "Getters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@14..15 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@15..27 - 0: JS_GETTER_CLASS_MEMBER@15..27 - 0: JS_METHOD_MODIFIER_LIST@15..15 - 1: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@22..25 - 0: IDENT@22..25 "foo" [] [] - 3: L_PAREN@25..26 "(" [] [] - 4: R_PAREN@26..27 ")" [] [] - 5: (empty) - 6: (empty) - 9: R_CURLY@27..29 "}" [Newline("\n")] [] - 4: EOF@29..30 "" [Newline("\n")] [] --- -getter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found '}'. - - 1 │ class Getters { - 2 │ get foo() - > 3 │ } - │ ^ - 4 │ - - i Expected a class method body here. - - 1 │ class Getters { - 2 │ get foo() - > 3 │ } - │ ^ - 4 │ - --- -class Getters { - get foo() -} diff --git a/crates/biome_js_parser/test_data/inline/err/identifier.rast b/crates/biome_js_parser/test_data/inline/err/identifier.rast deleted file mode 100644 index 8bdf6d8d91c5..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/identifier.rast +++ /dev/null @@ -1,74 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@0..5 "yield" [] [], - ], - }, - ], - }, - semicolon_token: SEMICOLON@5..6 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@6..12 "await" [Newline("\n")] [], - argument: missing (required), - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: JS_EXPRESSION_STATEMENT@0..6 - 0: JS_BOGUS_EXPRESSION@0..5 - 0: JS_BOGUS@0..5 - 0: IDENT@0..5 "yield" [] [] - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@6..13 - 0: JS_AWAIT_EXPRESSION@6..12 - 0: AWAIT_KW@6..12 "await" [Newline("\n")] [] - 1: (empty) - 1: SEMICOLON@12..13 ";" [] [] - 4: EOF@13..14 "" [Newline("\n")] [] --- -identifier.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - > 1 │ yield; - │ ^^^^^ - 2 │ await; - 3 │ - --- -identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an unary expression but instead found ';'. - - 1 │ yield; - > 2 │ await; - │ ^ - 3 │ - - i Expected an unary expression here. - - 1 │ yield; - > 2 │ await; - │ ^ - 3 │ - --- -yield; -await; diff --git a/crates/biome_js_parser/test_data/inline/err/identifier_err.rast b/crates/biome_js_parser/test_data/inline/err/identifier_err.rast deleted file mode 100644 index 3c26919695bb..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/identifier_err.rast +++ /dev/null @@ -1,304 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@0..5 "yield" [] [], - ], - }, - ], - }, - semicolon_token: SEMICOLON@5..6 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@6..12 "await" [Newline("\n")] [], - argument: missing (required), - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@13..20 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@20..29 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@29..33 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@33..34 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@34..39 "await" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@41..42 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@43..52 "function" [Newline("\n")] [], - star_token: STAR@52..54 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@54..58 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@58..59 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@59..64 "yield" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@66..67 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@67..68 "}" [] [], - }, - }, - JsBogusStatement { - items: [ - ENUM_KW@68..73 "enum" [Newline("\n")] [], - TsEnumMemberList [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@73..74 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@74..85 "implements" [Newline("\n")] [], - ], - }, - ], - }, - semicolon_token: SEMICOLON@85..86 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@86..96 "interface" [Newline("\n")] [], - ], - }, - ], - }, - semicolon_token: SEMICOLON@96..97 ";" [] [], - }, - ], - eof_token: EOF@97..98 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..98 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..97 - 0: JS_EXPRESSION_STATEMENT@0..6 - 0: JS_BOGUS_EXPRESSION@0..5 - 0: JS_BOGUS@0..5 - 0: IDENT@0..5 "yield" [] [] - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@6..13 - 0: JS_AWAIT_EXPRESSION@6..12 - 0: AWAIT_KW@6..12 "await" [Newline("\n")] [] - 1: (empty) - 1: SEMICOLON@12..13 ";" [] [] - 2: JS_FUNCTION_DECLARATION@13..43 - 0: ASYNC_KW@13..20 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@20..29 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@29..33 - 0: IDENT@29..33 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@33..41 - 0: L_PAREN@33..34 "(" [] [] - 1: JS_PARAMETER_LIST@34..39 - 0: JS_FORMAL_PARAMETER@34..39 - 0: JS_DECORATOR_LIST@34..34 - 1: JS_BOGUS_BINDING@34..39 - 0: IDENT@34..39 "await" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@41..43 - 0: L_CURLY@41..42 "{" [] [] - 1: JS_DIRECTIVE_LIST@42..42 - 2: JS_STATEMENT_LIST@42..42 - 3: R_CURLY@42..43 "}" [] [] - 3: JS_FUNCTION_DECLARATION@43..68 - 0: (empty) - 1: FUNCTION_KW@43..52 "function" [Newline("\n")] [] - 2: STAR@52..54 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@54..58 - 0: IDENT@54..58 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@58..66 - 0: L_PAREN@58..59 "(" [] [] - 1: JS_PARAMETER_LIST@59..64 - 0: JS_FORMAL_PARAMETER@59..64 - 0: JS_DECORATOR_LIST@59..59 - 1: JS_BOGUS_BINDING@59..64 - 0: IDENT@59..64 "yield" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@64..66 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@66..68 - 0: L_CURLY@66..67 "{" [] [] - 1: JS_DIRECTIVE_LIST@67..67 - 2: JS_STATEMENT_LIST@67..67 - 3: R_CURLY@67..68 "}" [] [] - 4: JS_BOGUS_STATEMENT@68..73 - 0: ENUM_KW@68..73 "enum" [Newline("\n")] [] - 1: TS_ENUM_MEMBER_LIST@73..73 - 5: JS_EMPTY_STATEMENT@73..74 - 0: SEMICOLON@73..74 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@74..86 - 0: JS_BOGUS_EXPRESSION@74..85 - 0: JS_BOGUS@74..85 - 0: IDENT@74..85 "implements" [Newline("\n")] [] - 1: SEMICOLON@85..86 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@86..97 - 0: JS_BOGUS_EXPRESSION@86..96 - 0: JS_BOGUS@86..96 - 0: IDENT@86..96 "interface" [Newline("\n")] [] - 1: SEMICOLON@96..97 ";" [] [] - 4: EOF@97..98 "" [Newline("\n")] [] --- -identifier_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - > 1 │ yield; - │ ^^^^^ - 2 │ await; - 3 │ async function test(await) {} - --- -identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an unary expression but instead found ';'. - - 1 │ yield; - > 2 │ await; - │ ^ - 3 │ async function test(await) {} - 4 │ function* test(yield) {} - - i Expected an unary expression here. - - 1 │ yield; - > 2 │ await; - │ ^ - 3 │ async function test(await) {} - 4 │ function* test(yield) {} - --- -identifier_err.js:3:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - 1 │ yield; - 2 │ await; - > 3 │ async function test(await) {} - │ ^^^^^ - 4 │ function* test(yield) {} - 5 │ enum; - --- -identifier_err.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `yield` as an identifier in generator function - - 2 │ await; - 3 │ async function test(await) {} - > 4 │ function* test(yield) {} - │ ^^^^^ - 5 │ enum; - 6 │ implements; - --- -identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 3 │ async function test(await) {} - 4 │ function* test(yield) {} - > 5 │ enum; - │ ^^^^ - 6 │ implements; - 7 │ interface; - - i TypeScript only syntax - --- -identifier_err.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `implements` as an identifier in strict mode - - 4 │ function* test(yield) {} - 5 │ enum; - > 6 │ implements; - │ ^^^^^^^^^^ - 7 │ interface; - 8 │ - --- -identifier_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `interface` as an identifier in strict mode - - 5 │ enum; - 6 │ implements; - > 7 │ interface; - │ ^^^^^^^^^ - 8 │ - --- -yield; -await; -async function test(await) {} -function* test(yield) {} -enum; -implements; -interface; diff --git a/crates/biome_js_parser/test_data/inline/err/if_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/if_stmt_err.rast deleted file mode 100644 index ad06fce7d21b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/if_stmt_err.rast +++ /dev/null @@ -1,263 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: missing (required), - else_clause: JsElseClause { - else_token: ELSE_KW@10..15 "else" [] [Whitespace(" ")], - alternate: JsBlockStatement { - l_curly_token: L_CURLY@15..16 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - }, - JsIfStatement { - if_token: IF_KW@17..21 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@21..22 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@22..26 "true" [] [], - }, - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - consequent: missing (required), - else_clause: JsElseClause { - else_token: ELSE_KW@28..32 "else" [] [], - alternate: JsIfStatement { - if_token: IF_KW@32..36 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - consequent: missing (required), - else_clause: JsElseClause { - else_token: ELSE_KW@36..41 "else" [] [Whitespace(" ")], - alternate: JsBlockStatement { - l_curly_token: L_CURLY@41..42 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - }, - }, - }, - }, - JsIfStatement { - if_token: IF_KW@43..47 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@47..48 "(" [] [], - test: missing (required), - r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], - consequent: JsBlockStatement { - l_curly_token: L_CURLY@50..51 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@51..53 "}" [] [Whitespace(" ")], - }, - else_clause: JsElseClause { - else_token: ELSE_KW@53..58 "else" [] [Whitespace(" ")], - alternate: JsBlockStatement { - l_curly_token: L_CURLY@58..59 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - }, - }, - JsIfStatement { - if_token: IF_KW@60..64 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@64..65 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@65..69 "true" [] [], - }, - r_paren_token: R_PAREN@69..70 ")" [] [], - consequent: missing (required), - else_clause: missing (optional), - }, - JsBogusStatement { - items: [ - R_CURLY@70..71 "}" [] [], - R_CURLY@71..72 "}" [] [], - R_CURLY@72..73 "}" [] [], - R_CURLY@73..75 "}" [] [Whitespace(" ")], - ], - }, - JsBlockStatement { - l_curly_token: L_CURLY@75..76 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@76..77 "}" [] [], - }, - ], - eof_token: EOF@77..78 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..78 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..77 - 0: JS_IF_STATEMENT@0..17 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_ELSE_CLAUSE@10..17 - 0: ELSE_KW@10..15 "else" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@15..17 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_STATEMENT_LIST@16..16 - 2: R_CURLY@16..17 "}" [] [] - 1: JS_IF_STATEMENT@17..43 - 0: IF_KW@17..21 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@21..22 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@22..26 - 0: TRUE_KW@22..26 "true" [] [] - 3: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_ELSE_CLAUSE@28..43 - 0: ELSE_KW@28..32 "else" [] [] - 1: JS_IF_STATEMENT@32..43 - 0: IF_KW@32..36 "if" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_ELSE_CLAUSE@36..43 - 0: ELSE_KW@36..41 "else" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@41..43 - 0: L_CURLY@41..42 "{" [] [] - 1: JS_STATEMENT_LIST@42..42 - 2: R_CURLY@42..43 "}" [] [] - 2: JS_IF_STATEMENT@43..60 - 0: IF_KW@43..47 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@47..48 "(" [] [] - 2: (empty) - 3: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@50..53 - 0: L_CURLY@50..51 "{" [] [] - 1: JS_STATEMENT_LIST@51..51 - 2: R_CURLY@51..53 "}" [] [Whitespace(" ")] - 5: JS_ELSE_CLAUSE@53..60 - 0: ELSE_KW@53..58 "else" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@58..60 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_STATEMENT_LIST@59..59 - 2: R_CURLY@59..60 "}" [] [] - 3: JS_IF_STATEMENT@60..70 - 0: IF_KW@60..64 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@64..65 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@65..69 - 0: TRUE_KW@65..69 "true" [] [] - 3: R_PAREN@69..70 ")" [] [] - 4: (empty) - 5: (empty) - 4: JS_BOGUS_STATEMENT@70..75 - 0: R_CURLY@70..71 "}" [] [] - 1: R_CURLY@71..72 "}" [] [] - 2: R_CURLY@72..73 "}" [] [] - 3: R_CURLY@73..75 "}" [] [Whitespace(" ")] - 5: JS_BLOCK_STATEMENT@75..77 - 0: L_CURLY@75..76 "{" [] [] - 1: JS_STATEMENT_LIST@76..76 - 2: R_CURLY@76..77 "}" [] [] - 4: EOF@77..78 "" [Newline("\n")] [] --- -if_stmt_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found 'else'. - - > 1 │ if (true) else {} - │ ^^^^ - 2 │ if (true) else - 3 │ if else {} - - i Expected a statement here. - - > 1 │ if (true) else {} - │ ^^^^ - 2 │ if (true) else - 3 │ if else {} - --- -if_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found 'else'. - - 1 │ if (true) else {} - > 2 │ if (true) else - │ ^^^^ - 3 │ if else {} - 4 │ if () {} else {} - - i Expected a statement here. - - 1 │ if (true) else {} - > 2 │ if (true) else - │ ^^^^ - 3 │ if else {} - 4 │ if () {} else {} - --- -if_stmt_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `else` - - 1 │ if (true) else {} - 2 │ if (true) else - > 3 │ if else {} - │ ^^^^ - 4 │ if () {} else {} - 5 │ if (true)}}}} {} - - i Remove else - --- -if_stmt_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ')'. - - 2 │ if (true) else - 3 │ if else {} - > 4 │ if () {} else {} - │ ^ - 5 │ if (true)}}}} {} - 6 │ - - i Expected an expression here. - - 2 │ if (true) else - 3 │ if else {} - > 4 │ if () {} else {} - │ ^ - 5 │ if (true)}}}} {} - 6 │ - --- -if_stmt_err.js:5:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - 3 │ if else {} - 4 │ if () {} else {} - > 5 │ if (true)}}}} {} - │ ^ - 6 │ - - i Expected a statement here. - - 3 │ if else {} - 4 │ if () {} else {} - > 5 │ if (true)}}}} {} - │ ^ - 6 │ - --- -if (true) else {} -if (true) else -if else {} -if () {} else {} -if (true)}}}} {} diff --git a/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.rast b/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.rast deleted file mode 100644 index 7754de5f8b1e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.rast +++ /dev/null @@ -1,77 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: missing (required), - as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@12..14 "c" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@21..27 "\"test\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_IMPORT@0..28 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@7..27 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@7..16 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..14 - 0: JS_NAMED_IMPORT_SPECIFIER@9..14 - 0: (empty) - 1: (empty) - 2: AS_KW@9..12 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@12..14 - 0: IDENT@12..14 "c" [] [Whitespace(" ")] - 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] - 2: FROM_KW@16..21 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@21..27 - 0: JS_STRING_LITERAL@21..27 "\"test\"" [] [] - 4: (empty) - 2: SEMICOLON@27..28 ";" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] --- -import_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal, or an identifier but instead found ''. - - > 1 │ import { as c } from "test"; - │ - 2 │ - - i Expected a string literal, or an identifier here. - - > 1 │ import { as c } from "test"; - │ - 2 │ - --- -import { as c } from "test"; diff --git a/crates/biome_js_parser/test_data/inline/err/import_assertion_err.rast b/crates/biome_js_parser/test_data/inline/err/import_assertion_err.rast deleted file mode 100644 index 56e6ee81ee9f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_assertion_err.rast +++ /dev/null @@ -1,653 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@13..20 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@22..26 "type" [] [], - colon_token: missing (required), - value_token: missing (required), - }, - COMMA@26..28 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: JS_STRING_LITERAL@28..35 "\"json\"" [] [Whitespace(" ")], - colon_token: missing (required), - value_token: missing (required), - }, - ], - r_curly_token: R_CURLY@35..36 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsBogusStatement { - items: [ - IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsModuleSource { - value_token: JS_STRING_LITERAL@45..51 "\"bar\"" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - ERROR_TOKEN@51..63 "\\u{61}ssert" [] [Whitespace(" ")], - L_CURLY@63..65 "{" [] [Whitespace(" ")], - JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@65..69 "type" [] [], - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@71..78 "\"json\"" [] [Whitespace(" ")], - }, - ], - R_CURLY@78..79 "}" [] [], - ], - }, - ], - }, - SEMICOLON@79..80 ";" [] [], - ], - }, - JsImport { - import_token: IMPORT_KW@80..88 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@88..90 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@90..94 "foo" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@94..96 "}" [] [Whitespace(" ")], - }, - from_token: missing (required), - source: missing (required), - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@96..103 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@103..105 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@105..109 "type" [] [], - colon_token: COLON@109..111 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@118..119 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@119..120 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@128..135 "\"lorem\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@135..143 "assert" [Newline("\n")] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@143..145 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@145..149 "type" [] [], - }, - colon_token: COLON@149..151 ":" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@151..158 "\"json\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@158..159 "}" [] [], - }, - JsImport { - import_token: IMPORT_KW@159..167 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@167..172 "foo2" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@172..177 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@177..188 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@188..195 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@195..197 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: JS_STRING_LITERAL@197..203 "\"type\"" [] [], - colon_token: COLON@203..205 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@205..211 "\"json\"" [] [], - }, - COMMA@211..213 "," [] [Whitespace(" ")], - JsBogusImportAssertionEntry { - items: [ - IDENT@213..217 "type" [] [], - COLON@217..219 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@219..225 "\"html\"" [] [], - ], - }, - COMMA@225..227 "," [] [Whitespace(" ")], - JsBogusImportAssertionEntry { - items: [ - JS_STRING_LITERAL@227..233 "\"type\"" [] [], - COLON@233..235 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@235..240 "\"js\"" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@240..241 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@241..242 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@242..250 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@250..254 "\"x\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@254..260 "assert" [] [], - l_curly_token: missing (required), - assertions: JsImportAssertionEntryList [], - r_curly_token: missing (required), - }, - }, - semicolon_token: SEMICOLON@260..261 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@261..269 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@269..275 "ipsum" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@275..280 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@280..293 "\"ipsum.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@293..300 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@300..302 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@302..306 "type" [] [], - colon_token: COLON@306..308 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@308..314 "\"json\"" [] [], - }, - COMMA@314..316 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: IDENT@316..320 "lazy" [] [], - colon_token: COLON@320..322 ":" [] [Whitespace(" ")], - value_token: missing (required), - }, - missing separator, - JsImportAssertionEntry { - key: IDENT@322..326 "true" [] [], - colon_token: missing (required), - value_token: missing (required), - }, - COMMA@326..328 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: IDENT@328..339 "startAtLine" [] [], - colon_token: COLON@339..341 ":" [] [Whitespace(" ")], - value_token: missing (required), - }, - missing separator, - JsBogusImportAssertionEntry { - items: [ - JS_NUMBER_LITERAL@341..343 "1" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@343..344 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@344..345 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@345..353 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@353..355 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@355..357 "a" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@357..359 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@359..364 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@364..373 "\"a.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@373..379 "assert" [] [], - l_curly_token: missing (required), - assertions: JsImportAssertionEntryList [], - r_curly_token: missing (required), - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@379..380 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..380 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..379 - 0: JS_IMPORT@0..37 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@7..36 - 0: JS_MODULE_SOURCE@7..13 - 0: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@13..36 - 0: ASSERT_KW@13..20 "assert" [] [Whitespace(" ")] - 1: L_CURLY@20..22 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@22..35 - 0: JS_IMPORT_ASSERTION_ENTRY@22..26 - 0: IDENT@22..26 "type" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@26..28 "," [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY@28..35 - 0: JS_STRING_LITERAL@28..35 "\"json\"" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: R_CURLY@35..36 "}" [] [] - 2: SEMICOLON@36..37 ";" [] [] - 1: JS_BOGUS_STATEMENT@37..80 - 0: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@45..79 - 0: JS_MODULE_SOURCE@45..51 - 0: JS_STRING_LITERAL@45..51 "\"bar\"" [] [Whitespace(" ")] - 1: JS_BOGUS@51..79 - 0: ERROR_TOKEN@51..63 "\\u{61}ssert" [] [Whitespace(" ")] - 1: L_CURLY@63..65 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@65..78 - 0: JS_IMPORT_ASSERTION_ENTRY@65..78 - 0: IDENT@65..69 "type" [] [] - 1: COLON@69..71 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@71..78 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@78..79 "}" [] [] - 2: SEMICOLON@79..80 ";" [] [] - 2: JS_IMPORT@80..120 - 0: IMPORT_KW@80..88 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@88..119 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@88..96 - 0: L_CURLY@88..90 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@90..94 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@90..94 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@90..94 - 0: IDENT@90..94 "foo" [] [Whitespace(" ")] - 2: R_CURLY@94..96 "}" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_IMPORT_ASSERTION@96..119 - 0: ASSERT_KW@96..103 "assert" [] [Whitespace(" ")] - 1: L_CURLY@103..105 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@105..118 - 0: JS_IMPORT_ASSERTION_ENTRY@105..118 - 0: IDENT@105..109 "type" [] [] - 1: COLON@109..111 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@118..119 "}" [] [] - 2: SEMICOLON@119..120 ";" [] [] - 3: JS_IMPORT@120..135 - 0: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@128..135 - 0: JS_MODULE_SOURCE@128..135 - 0: JS_STRING_LITERAL@128..135 "\"lorem\"" [] [] - 1: (empty) - 2: (empty) - 4: JS_EXPRESSION_STATEMENT@135..143 - 0: JS_IDENTIFIER_EXPRESSION@135..143 - 0: JS_REFERENCE_IDENTIFIER@135..143 - 0: IDENT@135..143 "assert" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 5: JS_BLOCK_STATEMENT@143..159 - 0: L_CURLY@143..145 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@145..158 - 0: JS_LABELED_STATEMENT@145..158 - 0: JS_LABEL@145..149 - 0: IDENT@145..149 "type" [] [] - 1: COLON@149..151 ":" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@151..158 - 0: JS_STRING_LITERAL_EXPRESSION@151..158 - 0: JS_STRING_LITERAL@151..158 "\"json\"" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@158..159 "}" [] [] - 6: JS_IMPORT@159..242 - 0: IMPORT_KW@159..167 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@167..241 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@167..172 - 0: JS_IDENTIFIER_BINDING@167..172 - 0: IDENT@167..172 "foo2" [] [Whitespace(" ")] - 2: FROM_KW@172..177 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@177..188 - 0: JS_STRING_LITERAL@177..188 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@188..241 - 0: ASSERT_KW@188..195 "assert" [] [Whitespace(" ")] - 1: L_CURLY@195..197 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@197..240 - 0: JS_IMPORT_ASSERTION_ENTRY@197..211 - 0: JS_STRING_LITERAL@197..203 "\"type\"" [] [] - 1: COLON@203..205 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@205..211 "\"json\"" [] [] - 1: COMMA@211..213 "," [] [Whitespace(" ")] - 2: JS_BOGUS_IMPORT_ASSERTION_ENTRY@213..225 - 0: IDENT@213..217 "type" [] [] - 1: COLON@217..219 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@219..225 "\"html\"" [] [] - 3: COMMA@225..227 "," [] [Whitespace(" ")] - 4: JS_BOGUS_IMPORT_ASSERTION_ENTRY@227..240 - 0: JS_STRING_LITERAL@227..233 "\"type\"" [] [] - 1: COLON@233..235 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@235..240 "\"js\"" [] [Whitespace(" ")] - 3: R_CURLY@240..241 "}" [] [] - 2: SEMICOLON@241..242 ";" [] [] - 7: JS_IMPORT@242..261 - 0: IMPORT_KW@242..250 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@250..260 - 0: JS_MODULE_SOURCE@250..254 - 0: JS_STRING_LITERAL@250..254 "\"x\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@254..260 - 0: ASSERT_KW@254..260 "assert" [] [] - 1: (empty) - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@260..260 - 3: (empty) - 2: SEMICOLON@260..261 ";" [] [] - 8: JS_IMPORT@261..345 - 0: IMPORT_KW@261..269 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@269..344 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@269..275 - 0: JS_IDENTIFIER_BINDING@269..275 - 0: IDENT@269..275 "ipsum" [] [Whitespace(" ")] - 2: FROM_KW@275..280 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@280..293 - 0: JS_STRING_LITERAL@280..293 "\"ipsum.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@293..344 - 0: ASSERT_KW@293..300 "assert" [] [Whitespace(" ")] - 1: L_CURLY@300..302 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@302..343 - 0: JS_IMPORT_ASSERTION_ENTRY@302..314 - 0: IDENT@302..306 "type" [] [] - 1: COLON@306..308 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@308..314 "\"json\"" [] [] - 1: COMMA@314..316 "," [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY@316..322 - 0: IDENT@316..320 "lazy" [] [] - 1: COLON@320..322 ":" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_IMPORT_ASSERTION_ENTRY@322..326 - 0: IDENT@322..326 "true" [] [] - 1: (empty) - 2: (empty) - 5: COMMA@326..328 "," [] [Whitespace(" ")] - 6: JS_IMPORT_ASSERTION_ENTRY@328..341 - 0: IDENT@328..339 "startAtLine" [] [] - 1: COLON@339..341 ":" [] [Whitespace(" ")] - 2: (empty) - 7: (empty) - 8: JS_BOGUS_IMPORT_ASSERTION_ENTRY@341..343 - 0: JS_NUMBER_LITERAL@341..343 "1" [] [Whitespace(" ")] - 3: R_CURLY@343..344 "}" [] [] - 2: SEMICOLON@344..345 ";" [] [] - 9: JS_IMPORT@345..379 - 0: IMPORT_KW@345..353 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@353..379 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@353..359 - 0: L_CURLY@353..355 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@355..357 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@355..357 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@355..357 - 0: IDENT@355..357 "a" [] [Whitespace(" ")] - 2: R_CURLY@357..359 "}" [] [Whitespace(" ")] - 2: FROM_KW@359..364 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@364..373 - 0: JS_STRING_LITERAL@364..373 "\"a.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@373..379 - 0: ASSERT_KW@373..379 "assert" [] [] - 1: (empty) - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@379..379 - 3: (empty) - 2: (empty) - 4: EOF@379..380 "" [Newline("\n")] [] --- -import_assertion_err.js:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `,` - - > 1 │ import "foo" assert { type, "json" }; - │ ^ - 2 │ import "bar" \u{61}ssert { type: "json" }; - 3 │ import { foo } assert { type: "json" }; - - i Remove , - --- -import_assertion_err.js:1:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `}` - - > 1 │ import "foo" assert { type, "json" }; - │ ^ - 2 │ import "bar" \u{61}ssert { type: "json" }; - 3 │ import { foo } assert { type: "json" }; - - i Remove } - --- -import_assertion_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'assert' keyword cannot contain escape character. - - 1 │ import "foo" assert { type, "json" }; - > 2 │ import "bar" \u{61}ssert { type: "json" }; - │ ^^^^^^^^^^^ - 3 │ import { foo } assert { type: "json" }; - 4 │ import "lorem" - --- -import_assertion_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `assert` - - 1 │ import "foo" assert { type, "json" }; - 2 │ import "bar" \u{61}ssert { type: "json" }; - > 3 │ import { foo } assert { type: "json" }; - │ ^^^^^^ - 4 │ import "lorem" - 5 │ assert { type: "json" } - - i Remove assert - --- -import_assertion_err.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 3 │ import { foo } assert { type: "json" }; - 4 │ import "lorem" - > 5 │ assert { type: "json" } - │ ^ - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - 7 │ import "x" assert; - - i An explicit or implicit semicolon is expected here... - - 3 │ import { foo } assert { type: "json" }; - 4 │ import "lorem" - > 5 │ assert { type: "json" } - │ ^ - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - 7 │ import "x" assert; - - i ...Which is required to end this statement - - 3 │ import { foo } assert { type: "json" }; - 4 │ import "lorem" - > 5 │ assert { type: "json" } - │ ^^^^^^^^ - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - 7 │ import "x" assert; - --- -import_assertion_err.js:6:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Duplicate assertion keys are not allowed - - 4 │ import "lorem" - 5 │ assert { type: "json" } - > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - │ ^^^^^^ - 7 │ import "x" assert; - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - - i First use of the key `type` - - 4 │ import "lorem" - 5 │ assert { type: "json" } - > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - │ ^^^^^^ - 7 │ import "x" assert; - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - - i second use here - - 4 │ import "lorem" - 5 │ assert { type: "json" } - > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - │ ^^^^ - 7 │ import "x" assert; - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - --- -import_assertion_err.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `;` - - 5 │ assert { type: "json" } - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - > 7 │ import "x" assert; - │ ^ - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - 9 │ import { a } from "a.json" assert - - i Remove ; - --- -import_assertion_err.js:8:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `string literal` but instead found `true` - - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - 7 │ import "x" assert; - > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - │ ^^^^ - 9 │ import { a } from "a.json" assert - 10 │ - - i Remove true - --- -import_assertion_err.js:8:65 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `,` - - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - 7 │ import "x" assert; - > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - │ ^ - 9 │ import { a } from "a.json" assert - 10 │ - - i Remove , - --- -import_assertion_err.js:8:80 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `string literal` but instead found `1` - - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - 7 │ import "x" assert; - > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - │ ^ - 9 │ import { a } from "a.json" assert - 10 │ - - i Remove 1 - --- -import_assertion_err.js:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead the file ends - - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - 9 │ import { a } from "a.json" assert - > 10 │ - │ - - i the file ends here - - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - 9 │ import { a } from "a.json" assert - > 10 │ - │ - --- -import "foo" assert { type, "json" }; -import "bar" \u{61}ssert { type: "json" }; -import { foo } assert { type: "json" }; -import "lorem" -assert { type: "json" } -import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; -import "x" assert; -import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; -import { a } from "a.json" assert diff --git a/crates/biome_js_parser/test_data/inline/err/import_attribute_err.rast b/crates/biome_js_parser/test_data/inline/err/import_attribute_err.rast deleted file mode 100644 index d7b0cb42cca5..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_attribute_err.rast +++ /dev/null @@ -1,598 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@13..18 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@20..24 "type" [] [], - colon_token: missing (required), - value_token: missing (required), - }, - COMMA@24..26 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")], - colon_token: missing (required), - value_token: missing (required), - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@35..43 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@45..49 "foo" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], - }, - from_token: missing (required), - source: missing (required), - assertion: JsImportAssertion { - assertion_kind: WITH_KW@51..56 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@56..58 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@58..62 "type" [] [], - colon_token: COLON@62..64 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@64..71 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@71..72 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@72..73 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@73..81 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@81..88 "\"lorem\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@88..96 "assert" [Newline("\n")] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@96..98 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@98..102 "type" [] [], - }, - colon_token: COLON@102..104 ":" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@104..111 "\"json\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@111..112 "}" [] [], - }, - JsImport { - import_token: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@120..125 "foo2" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@125..130 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@130..141 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@141..146 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@146..148 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: JS_STRING_LITERAL@148..154 "\"type\"" [] [], - colon_token: COLON@154..156 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@156..162 "\"json\"" [] [], - }, - COMMA@162..164 "," [] [Whitespace(" ")], - JsBogusImportAssertionEntry { - items: [ - IDENT@164..168 "type" [] [], - COLON@168..170 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@170..176 "\"html\"" [] [], - ], - }, - COMMA@176..178 "," [] [Whitespace(" ")], - JsBogusImportAssertionEntry { - items: [ - JS_STRING_LITERAL@178..184 "\"type\"" [] [], - COLON@184..186 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@186..191 "\"js\"" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@191..192 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@192..193 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@193..201 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@201..205 "\"x\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@205..209 "with" [] [], - l_curly_token: missing (required), - assertions: JsImportAssertionEntryList [], - r_curly_token: missing (required), - }, - }, - semicolon_token: SEMICOLON@209..210 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@210..218 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@218..224 "ipsum" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@224..229 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@229..242 "\"ipsum.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@242..247 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@247..249 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@249..253 "type" [] [], - colon_token: COLON@253..255 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@255..261 "\"json\"" [] [], - }, - COMMA@261..263 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: IDENT@263..267 "lazy" [] [], - colon_token: COLON@267..269 ":" [] [Whitespace(" ")], - value_token: missing (required), - }, - missing separator, - JsImportAssertionEntry { - key: IDENT@269..273 "true" [] [], - colon_token: missing (required), - value_token: missing (required), - }, - COMMA@273..275 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: IDENT@275..286 "startAtLine" [] [], - colon_token: COLON@286..288 ":" [] [Whitespace(" ")], - value_token: missing (required), - }, - missing separator, - JsBogusImportAssertionEntry { - items: [ - JS_NUMBER_LITERAL@288..290 "1" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@290..291 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@291..292 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@292..300 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@300..302 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@302..304 "a" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@304..306 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@306..311 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@311..320 "\"a.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@320..324 "with" [] [], - l_curly_token: missing (required), - assertions: JsImportAssertionEntryList [], - r_curly_token: missing (required), - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@324..325 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..325 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..324 - 0: JS_IMPORT@0..35 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@7..34 - 0: JS_MODULE_SOURCE@7..13 - 0: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@13..34 - 0: WITH_KW@13..18 "with" [] [Whitespace(" ")] - 1: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@20..33 - 0: JS_IMPORT_ASSERTION_ENTRY@20..24 - 0: IDENT@20..24 "type" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY@26..33 - 0: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: R_CURLY@33..34 "}" [] [] - 2: SEMICOLON@34..35 ";" [] [] - 1: JS_IMPORT@35..73 - 0: IMPORT_KW@35..43 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@43..72 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@43..51 - 0: L_CURLY@43..45 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@45..49 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@45..49 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@45..49 - 0: IDENT@45..49 "foo" [] [Whitespace(" ")] - 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_IMPORT_ASSERTION@51..72 - 0: WITH_KW@51..56 "with" [] [Whitespace(" ")] - 1: L_CURLY@56..58 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@58..71 - 0: JS_IMPORT_ASSERTION_ENTRY@58..71 - 0: IDENT@58..62 "type" [] [] - 1: COLON@62..64 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@64..71 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@71..72 "}" [] [] - 2: SEMICOLON@72..73 ";" [] [] - 2: JS_IMPORT@73..88 - 0: IMPORT_KW@73..81 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@81..88 - 0: JS_MODULE_SOURCE@81..88 - 0: JS_STRING_LITERAL@81..88 "\"lorem\"" [] [] - 1: (empty) - 2: (empty) - 3: JS_EXPRESSION_STATEMENT@88..96 - 0: JS_IDENTIFIER_EXPRESSION@88..96 - 0: JS_REFERENCE_IDENTIFIER@88..96 - 0: IDENT@88..96 "assert" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 4: JS_BLOCK_STATEMENT@96..112 - 0: L_CURLY@96..98 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@98..111 - 0: JS_LABELED_STATEMENT@98..111 - 0: JS_LABEL@98..102 - 0: IDENT@98..102 "type" [] [] - 1: COLON@102..104 ":" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@104..111 - 0: JS_STRING_LITERAL_EXPRESSION@104..111 - 0: JS_STRING_LITERAL@104..111 "\"json\"" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@111..112 "}" [] [] - 5: JS_IMPORT@112..193 - 0: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@120..192 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@120..125 - 0: JS_IDENTIFIER_BINDING@120..125 - 0: IDENT@120..125 "foo2" [] [Whitespace(" ")] - 2: FROM_KW@125..130 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@130..141 - 0: JS_STRING_LITERAL@130..141 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@141..192 - 0: WITH_KW@141..146 "with" [] [Whitespace(" ")] - 1: L_CURLY@146..148 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@148..191 - 0: JS_IMPORT_ASSERTION_ENTRY@148..162 - 0: JS_STRING_LITERAL@148..154 "\"type\"" [] [] - 1: COLON@154..156 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@156..162 "\"json\"" [] [] - 1: COMMA@162..164 "," [] [Whitespace(" ")] - 2: JS_BOGUS_IMPORT_ASSERTION_ENTRY@164..176 - 0: IDENT@164..168 "type" [] [] - 1: COLON@168..170 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@170..176 "\"html\"" [] [] - 3: COMMA@176..178 "," [] [Whitespace(" ")] - 4: JS_BOGUS_IMPORT_ASSERTION_ENTRY@178..191 - 0: JS_STRING_LITERAL@178..184 "\"type\"" [] [] - 1: COLON@184..186 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@186..191 "\"js\"" [] [Whitespace(" ")] - 3: R_CURLY@191..192 "}" [] [] - 2: SEMICOLON@192..193 ";" [] [] - 6: JS_IMPORT@193..210 - 0: IMPORT_KW@193..201 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@201..209 - 0: JS_MODULE_SOURCE@201..205 - 0: JS_STRING_LITERAL@201..205 "\"x\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@205..209 - 0: WITH_KW@205..209 "with" [] [] - 1: (empty) - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@209..209 - 3: (empty) - 2: SEMICOLON@209..210 ";" [] [] - 7: JS_IMPORT@210..292 - 0: IMPORT_KW@210..218 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@218..291 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@218..224 - 0: JS_IDENTIFIER_BINDING@218..224 - 0: IDENT@218..224 "ipsum" [] [Whitespace(" ")] - 2: FROM_KW@224..229 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@229..242 - 0: JS_STRING_LITERAL@229..242 "\"ipsum.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@242..291 - 0: WITH_KW@242..247 "with" [] [Whitespace(" ")] - 1: L_CURLY@247..249 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@249..290 - 0: JS_IMPORT_ASSERTION_ENTRY@249..261 - 0: IDENT@249..253 "type" [] [] - 1: COLON@253..255 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@255..261 "\"json\"" [] [] - 1: COMMA@261..263 "," [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY@263..269 - 0: IDENT@263..267 "lazy" [] [] - 1: COLON@267..269 ":" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_IMPORT_ASSERTION_ENTRY@269..273 - 0: IDENT@269..273 "true" [] [] - 1: (empty) - 2: (empty) - 5: COMMA@273..275 "," [] [Whitespace(" ")] - 6: JS_IMPORT_ASSERTION_ENTRY@275..288 - 0: IDENT@275..286 "startAtLine" [] [] - 1: COLON@286..288 ":" [] [Whitespace(" ")] - 2: (empty) - 7: (empty) - 8: JS_BOGUS_IMPORT_ASSERTION_ENTRY@288..290 - 0: JS_NUMBER_LITERAL@288..290 "1" [] [Whitespace(" ")] - 3: R_CURLY@290..291 "}" [] [] - 2: SEMICOLON@291..292 ";" [] [] - 8: JS_IMPORT@292..324 - 0: IMPORT_KW@292..300 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@300..324 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@300..306 - 0: L_CURLY@300..302 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@302..304 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@302..304 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@302..304 - 0: IDENT@302..304 "a" [] [Whitespace(" ")] - 2: R_CURLY@304..306 "}" [] [Whitespace(" ")] - 2: FROM_KW@306..311 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@311..320 - 0: JS_STRING_LITERAL@311..320 "\"a.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@320..324 - 0: WITH_KW@320..324 "with" [] [] - 1: (empty) - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@324..324 - 3: (empty) - 2: (empty) - 4: EOF@324..325 "" [Newline("\n")] [] --- -import_attribute_err.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `,` - - > 1 │ import "foo" with { type, "json" }; - │ ^ - 2 │ import { foo } with { type: "json" }; - 3 │ import "lorem" - - i Remove , - --- -import_attribute_err.js:1:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `}` - - > 1 │ import "foo" with { type, "json" }; - │ ^ - 2 │ import { foo } with { type: "json" }; - 3 │ import "lorem" - - i Remove } - --- -import_attribute_err.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `with` - - 1 │ import "foo" with { type, "json" }; - > 2 │ import { foo } with { type: "json" }; - │ ^^^^ - 3 │ import "lorem" - 4 │ assert { type: "json" } - - i Remove with - --- -import_attribute_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 2 │ import { foo } with { type: "json" }; - 3 │ import "lorem" - > 4 │ assert { type: "json" } - │ ^ - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - 6 │ import "x" with; - - i An explicit or implicit semicolon is expected here... - - 2 │ import { foo } with { type: "json" }; - 3 │ import "lorem" - > 4 │ assert { type: "json" } - │ ^ - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - 6 │ import "x" with; - - i ...Which is required to end this statement - - 2 │ import { foo } with { type: "json" }; - 3 │ import "lorem" - > 4 │ assert { type: "json" } - │ ^^^^^^^^ - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - 6 │ import "x" with; - --- -import_attribute_err.js:5:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Duplicate assertion keys are not allowed - - 3 │ import "lorem" - 4 │ assert { type: "json" } - > 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - │ ^^^^^^ - 6 │ import "x" with; - 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - - i First use of the key `type` - - 3 │ import "lorem" - 4 │ assert { type: "json" } - > 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - │ ^^^^^^ - 6 │ import "x" with; - 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - - i second use here - - 3 │ import "lorem" - 4 │ assert { type: "json" } - > 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - │ ^^^^ - 6 │ import "x" with; - 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - --- -import_attribute_err.js:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `;` - - 4 │ assert { type: "json" } - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - > 6 │ import "x" with; - │ ^ - 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - 8 │ import { a } from "a.json" with - - i Remove ; - --- -import_attribute_err.js:7:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `string literal` but instead found `true` - - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - 6 │ import "x" with; - > 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - │ ^^^^ - 8 │ import { a } from "a.json" with - 9 │ - - i Remove true - --- -import_attribute_err.js:7:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `,` - - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - 6 │ import "x" with; - > 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - │ ^ - 8 │ import { a } from "a.json" with - 9 │ - - i Remove , - --- -import_attribute_err.js:7:78 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `string literal` but instead found `1` - - 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; - 6 │ import "x" with; - > 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - │ ^ - 8 │ import { a } from "a.json" with - 9 │ - - i Remove 1 - --- -import_attribute_err.js:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead the file ends - - 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - 8 │ import { a } from "a.json" with - > 9 │ - │ - - i the file ends here - - 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; - 8 │ import { a } from "a.json" with - > 9 │ - │ - --- -import "foo" with { type, "json" }; -import { foo } with { type: "json" }; -import "lorem" -assert { type: "json" } -import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; -import "x" with; -import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; -import { a } from "a.json" with diff --git a/crates/biome_js_parser/test_data/inline/err/import_call.rast b/crates/biome_js_parser/test_data/inline/err/import_call.rast deleted file mode 100644 index a11e682a4a69..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_call.rast +++ /dev/null @@ -1,40 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@0..6 "import" [] [], - l_paren_token: L_PAREN@6..7 "(" [] [], - argument: missing (required), - r_paren_token: R_PAREN@7..8 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@8..9 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..9 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..8 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_IMPORT_CALL_EXPRESSION@0..8 - 0: IMPORT_KW@0..6 "import" [] [] - 1: L_PAREN@6..7 "(" [] [] - 2: (empty) - 3: R_PAREN@7..8 ")" [] [] - 1: (empty) - 4: EOF@8..9 "" [Newline("\n")] [] --- -error[SyntaxError]: expected an expression, or an assignment but instead found ')' - ┌─ import_call.js:1:8 - │ -1 │ import() - │ ^ Expected an expression, or an assignment here - --- -import() diff --git a/crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast b/crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast deleted file mode 100644 index 64c6c99be711..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declarations: JsVariableDeclarations { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - items: JsVariableDeclarationList [ - JsVariableDeclaration { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - excl_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsImportCallExpression { - import_token: IMPORT_KW@8..14 "import" [] [], - l_paren_token: L_PAREN@14..15 "(" [] [], - argument: missing (required), - r_paren_token: R_PAREN@15..16 ")" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..21 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token_token: missing (optional), - type_args: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@21..22 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@22..23 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_VARIABLE_STATEMENT@0..17 - 0: JS_VARIABLE_DECLARATIONS@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_LIST@4..16 - 0: JS_VARIABLE_DECLARATION@4..16 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@6..16 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_IMPORT_CALL_EXPRESSION@8..16 - 0: IMPORT_KW@8..14 "import" [] [] - 1: L_PAREN@14..15 "(" [] [] - 2: (empty) - 3: R_PAREN@15..16 ")" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@17..24 - 0: JS_CALL_EXPRESSION@17..23 - 0: JS_IDENTIFIER_EXPRESSION@17..21 - 0: JS_REFERENCE_IDENTIFIER@17..21 - 0: IDENT@17..21 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@21..23 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@22..22 - 2: R_PAREN@22..23 ")" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] --- -error[SyntaxError]: expected an expression, or an assignment but instead found ')' - ┌─ import_call_no_arg.js:1:16 - │ -1 │ let a = import(); - │ ^ Expected an expression, or an assignment here - --- -let a = import(); -foo(); diff --git a/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.rast b/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.rast deleted file mode 100644 index 3db1686c5362..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.rast +++ /dev/null @@ -1,73 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBlockStatement { - l_curly_token: L_CURLY@0..1 "{" [] [], - statements: JsStatementList [ - JsBogusStatement { - items: [ - IMPORT_KW@1..10 "import" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@10..14 "foo" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@14..19 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@19..24 "\"bar\"" [] [], - }, - assertion: missing (optional), - }, - SEMICOLON@24..25 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@25..27 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: JS_BLOCK_STATEMENT@0..27 - 0: L_CURLY@0..1 "{" [] [] - 1: JS_STATEMENT_LIST@1..25 - 0: JS_BOGUS_STATEMENT@1..25 - 0: IMPORT_KW@1..10 "import" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@10..24 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@10..14 - 0: JS_IDENTIFIER_BINDING@10..14 - 0: IDENT@10..14 "foo" [] [Whitespace(" ")] - 2: FROM_KW@14..19 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@19..24 - 0: JS_STRING_LITERAL@19..24 "\"bar\"" [] [] - 4: (empty) - 2: SEMICOLON@24..25 ";" [] [] - 2: R_CURLY@25..27 "}" [Newline("\n")] [] - 4: EOF@27..28 "" [Newline("\n")] [] --- -import_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of an import declaration not at the top level - - 1 │ { - > 2 │ import foo from "bar"; - │ ^^^^^^^^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - - i move this declaration to the top level - --- -{ - import foo from "bar"; -} diff --git a/crates/biome_js_parser/test_data/inline/err/import_err.rast b/crates/biome_js_parser/test_data/inline/err/import_err.rast deleted file mode 100644 index 33550b72d731..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_err.rast +++ /dev/null @@ -1,725 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..6 "import" [] [], - import_clause: missing (required), - semicolon_token: SEMICOLON@6..7 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@7..15 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamespaceClause { - type_token: missing (optional), - namespace_specifier: JsNamespaceImportSpecifier { - star_token: STAR@15..16 "*" [] [], - as_token: missing (required), - local_name: missing (required), - }, - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@17..25 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamespaceClause { - type_token: missing (optional), - namespace_specifier: JsNamespaceImportSpecifier { - star_token: STAR@25..27 "*" [] [Whitespace(" ")], - as_token: AS_KW@27..30 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@30..31 "c" [] [], - }, - }, - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - COMMA@31..33 "," [] [Whitespace(" ")], - ], - }, - JsBlockStatement { - l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "a" [] [], - }, - }, - comma_token: COMMA@36..38 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..40 "b" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@40..42 "}" [] [Whitespace(" ")], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..47 "from" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@47..50 "\"c\"" [] [], - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@51..59 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@61..64 "aa" [] [Whitespace(" ")], - }, - }, - missing separator, - JsBogusNamedImportSpecifier { - items: [ - PLUS@64..66 "+" [] [Whitespace(" ")], - IDENT@66..68 "bb" [] [], - ], - }, - COMMA@68..70 "," [] [Whitespace(" ")], - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@70..73 "dd" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@73..75 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@75..80 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@80..83 "\"c\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@84..92 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@92..94 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@94..96 "ab" [] [], - }, - }, - COMMA@96..98 "," [] [Whitespace(" ")], - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@98..101 "ac" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@101..103 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@103..108 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@108..111 "\"c\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@120..122 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@122..130 "default" [] [Whitespace(" ")], - }, - as_token: missing (required), - local_name: missing (required), - }, - ], - r_curly_token: R_CURLY@130..132 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@132..137 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@137..140 "\"c\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@140..141 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@141..149 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@149..151 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: JS_STRING_LITERAL@151..155 "\"a\"" [] [Whitespace(" ")], - }, - as_token: missing (required), - local_name: missing (required), - }, - ], - r_curly_token: R_CURLY@155..157 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@157..162 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@162..165 "\"c\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@165..166 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@166..174 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@174..176 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: missing (required), - as_token: AS_KW@176..179 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@179..181 "x" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@181..183 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@183..188 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@188..191 "\"c\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@191..192 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@192..200 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: missing (required), - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@200..202 "4" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@202..207 "from" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@207..210 "\"c\"" [] [], - }, - semicolon_token: SEMICOLON@210..211 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@211..219 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@219..221 "y" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@221..226 "from" [] [Whitespace(" ")], - source: missing (required), - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@226..227 "4" [] [], - }, - semicolon_token: SEMICOLON@227..228 ";" [] [], - }, - ], - eof_token: EOF@228..229 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..229 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..228 - 0: JS_IMPORT@0..7 - 0: IMPORT_KW@0..6 "import" [] [] - 1: (empty) - 2: SEMICOLON@6..7 ";" [] [] - 1: JS_IMPORT@7..17 - 0: IMPORT_KW@7..15 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMESPACE_CLAUSE@15..16 - 0: (empty) - 1: JS_NAMESPACE_IMPORT_SPECIFIER@15..16 - 0: STAR@15..16 "*" [] [] - 1: (empty) - 2: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 2: SEMICOLON@16..17 ";" [] [] - 2: JS_IMPORT@17..31 - 0: IMPORT_KW@17..25 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMESPACE_CLAUSE@25..31 - 0: (empty) - 1: JS_NAMESPACE_IMPORT_SPECIFIER@25..31 - 0: STAR@25..27 "*" [] [Whitespace(" ")] - 1: AS_KW@27..30 "as" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "c" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: (empty) - 3: JS_BOGUS_STATEMENT@31..33 - 0: COMMA@31..33 "," [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@33..42 - 0: L_CURLY@33..35 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@35..40 - 0: JS_EXPRESSION_STATEMENT@35..40 - 0: JS_SEQUENCE_EXPRESSION@35..40 - 0: JS_IDENTIFIER_EXPRESSION@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "a" [] [] - 1: COMMA@36..38 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@38..40 - 0: JS_REFERENCE_IDENTIFIER@38..40 - 0: IDENT@38..40 "b" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@40..42 "}" [] [Whitespace(" ")] - 5: JS_EXPRESSION_STATEMENT@42..47 - 0: JS_IDENTIFIER_EXPRESSION@42..47 - 0: JS_REFERENCE_IDENTIFIER@42..47 - 0: IDENT@42..47 "from" [] [Whitespace(" ")] - 1: (empty) - 6: JS_EXPRESSION_STATEMENT@47..51 - 0: JS_STRING_LITERAL_EXPRESSION@47..50 - 0: JS_STRING_LITERAL@47..50 "\"c\"" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 7: JS_IMPORT@51..84 - 0: IMPORT_KW@51..59 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@59..83 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@59..75 - 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@61..73 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@61..64 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@61..64 - 0: IDENT@61..64 "aa" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BOGUS_NAMED_IMPORT_SPECIFIER@64..68 - 0: PLUS@64..66 "+" [] [Whitespace(" ")] - 1: IDENT@66..68 "bb" [] [] - 3: COMMA@68..70 "," [] [Whitespace(" ")] - 4: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@70..73 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@70..73 - 0: IDENT@70..73 "dd" [] [Whitespace(" ")] - 2: R_CURLY@73..75 "}" [] [Whitespace(" ")] - 2: FROM_KW@75..80 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@80..83 - 0: JS_STRING_LITERAL@80..83 "\"c\"" [] [] - 4: (empty) - 2: SEMICOLON@83..84 ";" [] [] - 8: JS_IMPORT@84..112 - 0: IMPORT_KW@84..92 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@92..111 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@92..103 - 0: L_CURLY@92..94 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@94..101 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@94..96 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@94..96 - 0: IDENT@94..96 "ab" [] [] - 1: COMMA@96..98 "," [] [Whitespace(" ")] - 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@98..101 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@98..101 - 0: IDENT@98..101 "ac" [] [Whitespace(" ")] - 2: R_CURLY@101..103 "}" [] [Whitespace(" ")] - 2: FROM_KW@103..108 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@108..111 - 0: JS_STRING_LITERAL@108..111 "\"c\"" [] [] - 4: (empty) - 2: SEMICOLON@111..112 ";" [] [] - 9: JS_IMPORT@112..141 - 0: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@120..140 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@120..132 - 0: L_CURLY@120..122 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@122..130 - 0: JS_NAMED_IMPORT_SPECIFIER@122..130 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@122..130 - 0: IDENT@122..130 "default" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@130..132 "}" [] [Whitespace(" ")] - 2: FROM_KW@132..137 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@137..140 - 0: JS_STRING_LITERAL@137..140 "\"c\"" [] [] - 4: (empty) - 2: SEMICOLON@140..141 ";" [] [] - 10: JS_IMPORT@141..166 - 0: IMPORT_KW@141..149 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@149..165 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@149..157 - 0: L_CURLY@149..151 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@151..155 - 0: JS_NAMED_IMPORT_SPECIFIER@151..155 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@151..155 - 0: JS_STRING_LITERAL@151..155 "\"a\"" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@155..157 "}" [] [Whitespace(" ")] - 2: FROM_KW@157..162 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@162..165 - 0: JS_STRING_LITERAL@162..165 "\"c\"" [] [] - 4: (empty) - 2: SEMICOLON@165..166 ";" [] [] - 11: JS_IMPORT@166..192 - 0: IMPORT_KW@166..174 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@174..191 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@174..183 - 0: L_CURLY@174..176 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@176..181 - 0: JS_NAMED_IMPORT_SPECIFIER@176..181 - 0: (empty) - 1: (empty) - 2: AS_KW@176..179 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@179..181 - 0: IDENT@179..181 "x" [] [Whitespace(" ")] - 2: R_CURLY@181..183 "}" [] [Whitespace(" ")] - 2: FROM_KW@183..188 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@188..191 - 0: JS_STRING_LITERAL@188..191 "\"c\"" [] [] - 4: (empty) - 2: SEMICOLON@191..192 ";" [] [] - 12: JS_IMPORT@192..200 - 0: IMPORT_KW@192..200 "import" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 13: JS_EXPRESSION_STATEMENT@200..202 - 0: JS_NUMBER_LITERAL_EXPRESSION@200..202 - 0: JS_NUMBER_LITERAL@200..202 "4" [] [Whitespace(" ")] - 1: (empty) - 14: JS_EXPRESSION_STATEMENT@202..207 - 0: JS_IDENTIFIER_EXPRESSION@202..207 - 0: JS_REFERENCE_IDENTIFIER@202..207 - 0: IDENT@202..207 "from" [] [Whitespace(" ")] - 1: (empty) - 15: JS_EXPRESSION_STATEMENT@207..211 - 0: JS_STRING_LITERAL_EXPRESSION@207..210 - 0: JS_STRING_LITERAL@207..210 "\"c\"" [] [] - 1: SEMICOLON@210..211 ";" [] [] - 16: JS_IMPORT@211..226 - 0: IMPORT_KW@211..219 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@219..226 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@219..221 - 0: JS_IDENTIFIER_BINDING@219..221 - 0: IDENT@219..221 "y" [] [Whitespace(" ")] - 2: FROM_KW@221..226 "from" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 2: (empty) - 17: JS_EXPRESSION_STATEMENT@226..228 - 0: JS_NUMBER_LITERAL_EXPRESSION@226..227 - 0: JS_NUMBER_LITERAL@226..227 "4" [] [] - 1: SEMICOLON@227..228 ";" [] [] - 4: EOF@228..229 "" [Newline("\n")] [] --- -import_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a default import, a namespace import, or a named import but instead found ';'. - - > 1 │ import; - │ ^ - 2 │ import *; - 3 │ import * as c, { a, b } from "c"; - - i Expected a default import, a namespace import, or a named import here. - - > 1 │ import; - │ ^ - 2 │ import *; - 3 │ import * as c, { a, b } from "c"; - --- -import_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `;` - - 1 │ import; - > 2 │ import *; - │ ^ - 3 │ import * as c, { a, b } from "c"; - 4 │ import { aa + bb, dd } from "c"; - - i Remove ; - --- -import_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `,` - - 1 │ import; - 2 │ import *; - > 3 │ import * as c, { a, b } from "c"; - │ ^ - 4 │ import { aa + bb, dd } from "c"; - 5 │ import { ab, ac } from "c"; - - i Remove , - --- -import_err.js:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ import; - 2 │ import *; - > 3 │ import * as c, { a, b } from "c"; - │ ^^^ - 4 │ import { aa + bb, dd } from "c"; - 5 │ import { ab, ac } from "c"; - - i An explicit or implicit semicolon is expected here... - - 1 │ import; - 2 │ import *; - > 3 │ import * as c, { a, b } from "c"; - │ ^^^ - 4 │ import { aa + bb, dd } from "c"; - 5 │ import { ab, ac } from "c"; - - i ...Which is required to end this statement - - 1 │ import; - 2 │ import *; - > 3 │ import * as c, { a, b } from "c"; - │ ^^^^^^^^ - 4 │ import { aa + bb, dd } from "c"; - 5 │ import { ab, ac } from "c"; - --- -import_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `+` - - 2 │ import *; - 3 │ import * as c, { a, b } from "c"; - > 4 │ import { aa + bb, dd } from "c"; - │ ^ - 5 │ import { ab, ac } from "c"; - 6 │ import { default } from "c"; - - i Remove + - --- -import_err.js:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `}` - - 4 │ import { aa + bb, dd } from "c"; - 5 │ import { ab, ac } from "c"; - > 6 │ import { default } from "c"; - │ ^ - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - - i Remove } - --- -import_err.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `}` - - 5 │ import { ab, ac } from "c"; - 6 │ import { default } from "c"; - > 7 │ import { "a" } from "c"; - │ ^ - 8 │ import { as x } from "c"; - 9 │ import 4 from "c"; - - i Remove } - --- -import_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal, or an identifier but instead found ''. - - 6 │ import { default } from "c"; - 7 │ import { "a" } from "c"; - > 8 │ import { as x } from "c"; - │ - 9 │ import 4 from "c"; - 10 │ import y from 4; - - i Expected a string literal, or an identifier here. - - 6 │ import { default } from "c"; - 7 │ import { "a" } from "c"; - > 8 │ import { as x } from "c"; - │ - 9 │ import 4 from "c"; - 10 │ import y from 4; - --- -import_err.js:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a default import, a namespace import, or a named import but instead found '4'. - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^ - 10 │ import y from 4; - 11 │ - - i Expected a default import, a namespace import, or a named import here. - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^ - 10 │ import y from 4; - 11 │ - --- -import_err.js:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^^^^ - 10 │ import y from 4; - 11 │ - - i An explicit or implicit semicolon is expected here... - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^^^^ - 10 │ import y from 4; - 11 │ - - i ...Which is required to end this statement - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^^^^^^ - 10 │ import y from 4; - 11 │ - --- -import_err.js:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^^^ - 10 │ import y from 4; - 11 │ - - i An explicit or implicit semicolon is expected here... - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^^^ - 10 │ import y from 4; - 11 │ - - i ...Which is required to end this statement - - 7 │ import { "a" } from "c"; - 8 │ import { as x } from "c"; - > 9 │ import 4 from "c"; - │ ^^^^^^^^ - 10 │ import y from 4; - 11 │ - --- -import_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a string literal but instead found '4'. - - 8 │ import { as x } from "c"; - 9 │ import 4 from "c"; - > 10 │ import y from 4; - │ ^ - 11 │ - - i Expected a string literal here. - - 8 │ import { as x } from "c"; - 9 │ import 4 from "c"; - > 10 │ import y from 4; - │ ^ - 11 │ - --- -import; -import *; -import * as c, { a, b } from "c"; -import { aa + bb, dd } from "c"; -import { ab, ac } from "c"; -import { default } from "c"; -import { "a" } from "c"; -import { as x } from "c"; -import 4 from "c"; -import y from 4; diff --git a/crates/biome_js_parser/test_data/inline/err/import_invalid_args.rast b/crates/biome_js_parser/test_data/inline/err/import_invalid_args.rast deleted file mode 100644 index f875058a6c77..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_invalid_args.rast +++ /dev/null @@ -1,289 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@0..6 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@6..7 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@7..8 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - IMPORT_KW@8..15 "import" [Newline("\n")] [], - JsBogus { - items: [ - L_PAREN@15..16 "(" [] [], - JsBogus { - items: [ - JsBogusMember { - items: [ - DOT3@16..19 "..." [] [], - JsArrayExpression { - l_brack_token: L_BRACK@19..20 "[" [] [], - elements: JsArrayElementList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@20..25 "\"foo\"" [] [], - }, - ], - r_brack_token: R_BRACK@25..26 "]" [] [], - }, - ], - }, - ], - }, - R_PAREN@26..27 ")" [] [], - ], - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@27..34 "import" [Newline("\n")] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@34..35 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@35..40 "\"foo\"" [] [], - }, - COMMA@40..42 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@44..50 "assert" [] [], - }, - colon_token: COLON@50..52 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@52..54 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@54..58 "type" [] [], - }, - colon_token: COLON@58..60 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@60..67 "'json'" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@67..69 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@69..70 "}" [] [], - }, - COMMA@70..72 "," [] [Whitespace(" ")], - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@72..77 "\"bar\"" [] [], - }, - ], - r_paren_token: R_PAREN@77..78 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@78..85 "import" [Newline("\n")] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@85..86 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@86..91 "\"foo\"" [] [], - }, - COMMA@91..93 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@95..99 "with" [] [], - }, - colon_token: COLON@99..101 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@101..103 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@103..107 "type" [] [], - }, - colon_token: COLON@107..109 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@109..116 "'json'" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@116..118 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@118..119 "}" [] [], - }, - COMMA@119..121 "," [] [Whitespace(" ")], - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@121..126 "\"bar\"" [] [], - }, - ], - r_paren_token: R_PAREN@126..127 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@127..128 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..128 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..127 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_IMPORT_CALL_EXPRESSION@0..8 - 0: IMPORT_KW@0..6 "import" [] [] - 1: JS_CALL_ARGUMENTS@6..8 - 0: L_PAREN@6..7 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@7..7 - 2: R_PAREN@7..8 ")" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@8..27 - 0: JS_BOGUS_EXPRESSION@8..27 - 0: IMPORT_KW@8..15 "import" [Newline("\n")] [] - 1: JS_BOGUS@15..27 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_BOGUS@16..26 - 0: JS_BOGUS_MEMBER@16..26 - 0: DOT3@16..19 "..." [] [] - 1: JS_ARRAY_EXPRESSION@19..26 - 0: L_BRACK@19..20 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@20..25 - 0: JS_STRING_LITERAL_EXPRESSION@20..25 - 0: JS_STRING_LITERAL@20..25 "\"foo\"" [] [] - 2: R_BRACK@25..26 "]" [] [] - 2: R_PAREN@26..27 ")" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@27..78 - 0: JS_IMPORT_CALL_EXPRESSION@27..78 - 0: IMPORT_KW@27..34 "import" [Newline("\n")] [] - 1: JS_CALL_ARGUMENTS@34..78 - 0: L_PAREN@34..35 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@35..77 - 0: JS_STRING_LITERAL_EXPRESSION@35..40 - 0: JS_STRING_LITERAL@35..40 "\"foo\"" [] [] - 1: COMMA@40..42 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@42..70 - 0: L_CURLY@42..44 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@44..69 - 0: JS_PROPERTY_OBJECT_MEMBER@44..69 - 0: JS_LITERAL_MEMBER_NAME@44..50 - 0: IDENT@44..50 "assert" [] [] - 1: COLON@50..52 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@52..69 - 0: L_CURLY@52..54 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@54..67 - 0: JS_PROPERTY_OBJECT_MEMBER@54..67 - 0: JS_LITERAL_MEMBER_NAME@54..58 - 0: IDENT@54..58 "type" [] [] - 1: COLON@58..60 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@60..67 - 0: JS_STRING_LITERAL@60..67 "'json'" [] [Whitespace(" ")] - 2: R_CURLY@67..69 "}" [] [Whitespace(" ")] - 2: R_CURLY@69..70 "}" [] [] - 3: COMMA@70..72 "," [] [Whitespace(" ")] - 4: JS_STRING_LITERAL_EXPRESSION@72..77 - 0: JS_STRING_LITERAL@72..77 "\"bar\"" [] [] - 2: R_PAREN@77..78 ")" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@78..127 - 0: JS_IMPORT_CALL_EXPRESSION@78..127 - 0: IMPORT_KW@78..85 "import" [Newline("\n")] [] - 1: JS_CALL_ARGUMENTS@85..127 - 0: L_PAREN@85..86 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@86..126 - 0: JS_STRING_LITERAL_EXPRESSION@86..91 - 0: JS_STRING_LITERAL@86..91 "\"foo\"" [] [] - 1: COMMA@91..93 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@93..119 - 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@95..118 - 0: JS_PROPERTY_OBJECT_MEMBER@95..118 - 0: JS_LITERAL_MEMBER_NAME@95..99 - 0: IDENT@95..99 "with" [] [] - 1: COLON@99..101 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@101..118 - 0: L_CURLY@101..103 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@103..116 - 0: JS_PROPERTY_OBJECT_MEMBER@103..116 - 0: JS_LITERAL_MEMBER_NAME@103..107 - 0: IDENT@103..107 "type" [] [] - 1: COLON@107..109 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@109..116 - 0: JS_STRING_LITERAL@109..116 "'json'" [] [Whitespace(" ")] - 2: R_CURLY@116..118 "}" [] [Whitespace(" ")] - 2: R_CURLY@118..119 "}" [] [] - 3: COMMA@119..121 "," [] [Whitespace(" ")] - 4: JS_STRING_LITERAL_EXPRESSION@121..126 - 0: JS_STRING_LITERAL@121..126 "\"bar\"" [] [] - 2: R_PAREN@126..127 ")" [] [] - 1: (empty) - 4: EOF@127..128 "" [Newline("\n")] [] --- -import_invalid_args.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `import()` requires exactly one or two arguments. - - > 1 │ import() - │ ^ - 2 │ import(...["foo"]) - 3 │ import("foo", { assert: { type: 'json' } }, "bar") - --- -import_invalid_args.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `...` is not allowed in `import()` - - 1 │ import() - > 2 │ import(...["foo"]) - │ ^^^^^^^^^^ - 3 │ import("foo", { assert: { type: 'json' } }, "bar") - 4 │ import("foo", { with: { type: 'json' } }, "bar") - --- -import_invalid_args.js:3:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `import()` requires exactly one or two arguments. - - 1 │ import() - 2 │ import(...["foo"]) - > 3 │ import("foo", { assert: { type: 'json' } }, "bar") - │ ^^^^^^ - 4 │ import("foo", { with: { type: 'json' } }, "bar") - 5 │ - --- -import_invalid_args.js:4:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `import()` requires exactly one or two arguments. - - 2 │ import(...["foo"]) - 3 │ import("foo", { assert: { type: 'json' } }, "bar") - > 4 │ import("foo", { with: { type: 'json' } }, "bar") - │ ^^^^^^ - 5 │ - --- -import() -import(...["foo"]) -import("foo", { assert: { type: 'json' } }, "bar") -import("foo", { with: { type: 'json' } }, "bar") diff --git a/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast b/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast deleted file mode 100644 index dd3def2a1b53..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast +++ /dev/null @@ -1,88 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: missing (required), - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@8..14 "import" [] [], - import_clause: missing (required), - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - ], - eof_token: EOF@15..16 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..16 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..15 - 0: JS_VARIABLE_STATEMENT@0..8 - 0: JS_VARIABLE_DECLARATION@0..8 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..8 - 0: JS_VARIABLE_DECLARATOR@4..8 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..8 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 1: JS_IMPORT@8..15 - 0: IMPORT_KW@8..14 "import" [] [] - 1: (empty) - 2: SEMICOLON@14..15 ";" [] [] - 4: EOF@15..16 "" [Newline("\n")] [] --- -import_keyword_in_expression_position.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found 'import'. - - > 1 │ let a = import; - │ ^^^^^^ - 2 │ - - i Expected an expression, or an assignment here. - - > 1 │ let a = import; - │ ^^^^^^ - 2 │ - --- -import_keyword_in_expression_position.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a default import, a namespace import, or a named import but instead found ';'. - - > 1 │ let a = import; - │ ^ - 2 │ - - i Expected a default import, a namespace import, or a named import here. - - > 1 │ let a = import; - │ ^ - 2 │ - --- -let a = import; diff --git a/crates/biome_js_parser/test_data/inline/err/import_no_meta.rast b/crates/biome_js_parser/test_data/inline/err/import_no_meta.rast deleted file mode 100644 index a2e0756d2632..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_no_meta.rast +++ /dev/null @@ -1,80 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - IMPORT_KW@0..6 "import" [] [], - DOT@6..7 "." [] [], - JsBogus { - items: [ - IDENT@7..10 "foo" [] [], - ], - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - IMPORT_KW@10..17 "import" [Newline("\n")] [], - DOT@17..18 "." [] [], - JsBogus { - items: [ - IDENT@18..23 "metaa" [] [], - ], - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_EXPRESSION_STATEMENT@0..10 - 0: JS_BOGUS_EXPRESSION@0..10 - 0: IMPORT_KW@0..6 "import" [] [] - 1: DOT@6..7 "." [] [] - 2: JS_BOGUS@7..10 - 0: IDENT@7..10 "foo" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@10..23 - 0: JS_BOGUS_EXPRESSION@10..23 - 0: IMPORT_KW@10..17 "import" [Newline("\n")] [] - 1: DOT@17..18 "." [] [] - 2: JS_BOGUS@18..23 - 0: IDENT@18..23 "metaa" [] [] - 1: (empty) - 4: EOF@23..24 "" [Newline("\n")] [] --- -import_no_meta.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected `meta` following an import keyword, but found `foo` - - > 1 │ import.foo - │ ^^^ - 2 │ import.metaa - 3 │ - --- -import_no_meta.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected `meta` following an import keyword, but found `metaa` - - 1 │ import.foo - > 2 │ import.metaa - │ ^^^^^ - 3 │ - --- -import.foo -import.metaa diff --git a/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast b/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast deleted file mode 100644 index 6bc653dae2d4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast +++ /dev/null @@ -1,120 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..2 "a" [] [], - }, - }, - comma_token: COMMA@2..3 "," [] [], - right: missing (required), - }, - r_paren_token: missing (required), - }, - semicolon_token: SEMICOLON@3..4 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@4..6 "(" [Newline("\n")] [], - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@6..7 "a" [] [], - }, - }, - comma_token: COMMA@7..9 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..10 "b" [] [], - }, - }, - }, - comma_token: COMMA@10..12 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..13 "c" [] [], - }, - }, - }, - r_paren_token: missing (required), - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - ], - eof_token: EOF@14..15 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..15 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..14 - 0: JS_EXPRESSION_STATEMENT@0..4 - 0: JS_PARENTHESIZED_EXPRESSION@0..3 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@1..3 - 0: JS_IDENTIFIER_EXPRESSION@1..2 - 0: JS_REFERENCE_IDENTIFIER@1..2 - 0: IDENT@1..2 "a" [] [] - 1: COMMA@2..3 "," [] [] - 2: (empty) - 2: (empty) - 1: SEMICOLON@3..4 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@4..14 - 0: JS_PARENTHESIZED_EXPRESSION@4..13 - 0: L_PAREN@4..6 "(" [Newline("\n")] [] - 1: JS_SEQUENCE_EXPRESSION@6..13 - 0: JS_SEQUENCE_EXPRESSION@6..10 - 0: JS_IDENTIFIER_EXPRESSION@6..7 - 0: JS_REFERENCE_IDENTIFIER@6..7 - 0: IDENT@6..7 "a" [] [] - 1: COMMA@7..9 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@9..10 - 0: JS_REFERENCE_IDENTIFIER@9..10 - 0: IDENT@9..10 "b" [] [] - 1: COMMA@10..12 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@12..13 - 0: JS_REFERENCE_IDENTIFIER@12..13 - 0: IDENT@12..13 "c" [] [] - 2: (empty) - 1: SEMICOLON@13..14 ";" [] [] - 4: EOF@14..15 "" [Newline("\n")] [] --- -incomplete_parenthesized_sequence_expression.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ';'. - - > 1 │ (a,; - │ ^ - 2 │ (a, b, c; - 3 │ - - i Expected an expression here. - - > 1 │ (a,; - │ ^ - 2 │ (a, b, c; - 3 │ - --- -incomplete_parenthesized_sequence_expression.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `;` - - 1 │ (a,; - > 2 │ (a, b, c; - │ ^ - 3 │ - - i Remove ; - --- -(a,; -(a, b, c; diff --git a/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast b/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast deleted file mode 100644 index 2c82e5e0d5d2..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast +++ /dev/null @@ -1,98 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@18..24 "number" [] [], - }, - }, - }, - R_BRACK@24..25 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@27..33 "string" [] [], - }, - }, - SEMICOLON@33..34 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@34..36 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@36..37 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..37 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..36 - 0: JS_CLASS_DECLARATION@0..36 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..34 - 0: JS_BOGUS_MEMBER@9..34 - 0: L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [] - 1: TS_INDEX_SIGNATURE_PARAMETER@15..24 - 0: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 1: TS_TYPE_ANNOTATION@16..24 - 0: COLON@16..18 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@18..24 - 0: NUMBER_KW@18..24 "number" [] [] - 2: R_BRACK@24..25 "]" [] [] - 3: TS_TYPE_ANNOTATION@25..33 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@27..33 - 0: STRING_KW@27..33 "string" [] [] - 4: SEMICOLON@33..34 ";" [] [] - 9: R_CURLY@34..36 "}" [Newline("\n")] [] - 4: EOF@36..37 "" [Newline("\n")] [] --- -index_signature_class_member_in_js.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Index signatures are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 1 │ class A { - > 2 │ [a: number]: string; - │ ^^^^^^^^^^^^^^^^^^^^ - 3 │ } - 4 │ - - i TypeScript only syntax - --- -class A { - [a: number]: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.rast b/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.rast deleted file mode 100644 index b3804ad53b6b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.rast +++ /dev/null @@ -1,78 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - JsBogus { - items: [ - IDENT@10..20 "undefined" [] [Whitespace(" ")], - ], - }, - L_CURLY@20..21 "{" [] [], - TsTypeMemberList [], - R_CURLY@21..22 "}" [] [], - ], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@22..33 "interface" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - IDENT@33..37 "any" [] [Whitespace(" ")], - ], - }, - L_CURLY@37..38 "{" [] [], - TsTypeMemberList [], - R_CURLY@38..39 "}" [] [], - ], - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_BOGUS_STATEMENT@0..22 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: JS_BOGUS@10..20 - 0: IDENT@10..20 "undefined" [] [Whitespace(" ")] - 2: L_CURLY@20..21 "{" [] [] - 3: TS_TYPE_MEMBER_LIST@21..21 - 4: R_CURLY@21..22 "}" [] [] - 1: JS_BOGUS_STATEMENT@22..39 - 0: INTERFACE_KW@22..33 "interface" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@33..37 - 0: IDENT@33..37 "any" [] [Whitespace(" ")] - 2: L_CURLY@37..38 "{" [] [] - 3: TS_TYPE_MEMBER_LIST@38..38 - 4: R_CURLY@38..39 "}" [] [] - 4: EOF@39..40 "" [Newline("\n")] [] --- -interface_cannot_be_reserved_world.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type alias cannot be undefined - - > 1 │ interface undefined {} - │ ^^^^^^^^^ - 2 │ interface any {} - 3 │ - --- -interface_cannot_be_reserved_world.ts:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type alias cannot be any - - 1 │ interface undefined {} - > 2 │ interface any {} - │ ^^^ - 3 │ - --- -interface undefined {} -interface any {} diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.rast b/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.rast deleted file mode 100644 index 97a07c34d0fc..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.rast +++ /dev/null @@ -1,447 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@13..16 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@16..20 "args" [] [], - }, - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@29..30 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@32..33 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@33..35 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@35..36 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@37..41 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@41..42 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..43 "a" [] [], - }, - }, - COMMA@43..44 "," [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "b" [] [], - }, - }, - ], - r_paren_token: missing (required), - }, - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..50 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@50..51 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@51..52 "a" [] [], - }, - }, - COMMA@52..53 "," [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..55 "b" [] [Whitespace(" ")], - }, - }, - ], - r_paren_token: missing (required), - }, - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - VAR_KW@55..58 "var" [] [], - JsBogus { - items: [], - }, - ], - }, - SEMICOLON@58..59 ";" [] [], - ], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..64 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@64..65 "(" [] [], - args: JsCallArgumentList [ - missing element, - COMMA@65..66 "," [] [], - missing element, - COMMA@66..67 "," [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@67..68 "b" [] [], - }, - }, - ], - r_paren_token: R_PAREN@68..69 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@70..75 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@75..76 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@76..77 "a" [] [], - }, - }, - COMMA@77..79 "," [] [Whitespace(" ")], - JsSpread { - dotdotdot_token: DOT3@79..82 "..." [] [], - argument: missing (required), - }, - ], - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: JS_FUNCTION_DECLARATION@0..24 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..22 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..20 - 0: JS_REST_PARAMETER@13..20 - 0: JS_DECORATOR_LIST@13..13 - 1: DOT3@13..16 "..." [] [] - 2: JS_IDENTIFIER_BINDING@16..20 - 0: IDENT@16..20 "args" [] [] - 3: (empty) - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@22..24 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..23 - 3: R_CURLY@23..24 "}" [] [] - 1: JS_VARIABLE_STATEMENT@24..37 - 0: JS_VARIABLE_DECLARATION@24..36 - 0: (empty) - 1: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@29..36 - 0: JS_VARIABLE_DECLARATOR@29..30 - 0: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@30..32 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@32..33 - 0: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "b" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@33..35 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@35..36 - 0: JS_IDENTIFIER_BINDING@35..36 - 0: IDENT@35..36 "c" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@36..37 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@37..46 - 0: JS_CALL_EXPRESSION@37..45 - 0: JS_IDENTIFIER_EXPRESSION@37..41 - 0: JS_REFERENCE_IDENTIFIER@37..41 - 0: IDENT@37..41 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@41..45 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@42..45 - 0: JS_IDENTIFIER_EXPRESSION@42..43 - 0: JS_REFERENCE_IDENTIFIER@42..43 - 0: IDENT@42..43 "a" [] [] - 1: COMMA@43..44 "," [] [] - 2: JS_IDENTIFIER_EXPRESSION@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "b" [] [] - 2: (empty) - 1: SEMICOLON@45..46 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@46..55 - 0: JS_CALL_EXPRESSION@46..55 - 0: JS_IDENTIFIER_EXPRESSION@46..50 - 0: JS_REFERENCE_IDENTIFIER@46..50 - 0: IDENT@46..50 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@50..55 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@51..55 - 0: JS_IDENTIFIER_EXPRESSION@51..52 - 0: JS_REFERENCE_IDENTIFIER@51..52 - 0: IDENT@51..52 "a" [] [] - 1: COMMA@52..53 "," [] [] - 2: JS_IDENTIFIER_EXPRESSION@53..55 - 0: JS_REFERENCE_IDENTIFIER@53..55 - 0: IDENT@53..55 "b" [] [Whitespace(" ")] - 2: (empty) - 1: (empty) - 4: JS_BOGUS_STATEMENT@55..59 - 0: JS_BOGUS@55..58 - 0: VAR_KW@55..58 "var" [] [] - 1: JS_BOGUS@58..58 - 1: SEMICOLON@58..59 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@59..70 - 0: JS_CALL_EXPRESSION@59..69 - 0: JS_IDENTIFIER_EXPRESSION@59..64 - 0: JS_REFERENCE_IDENTIFIER@59..64 - 0: IDENT@59..64 "foo" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@64..69 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@65..68 - 0: (empty) - 1: COMMA@65..66 "," [] [] - 2: (empty) - 3: COMMA@66..67 "," [] [] - 4: JS_IDENTIFIER_EXPRESSION@67..68 - 0: JS_REFERENCE_IDENTIFIER@67..68 - 0: IDENT@67..68 "b" [] [] - 2: R_PAREN@68..69 ")" [] [] - 1: SEMICOLON@69..70 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@70..84 - 0: JS_CALL_EXPRESSION@70..83 - 0: JS_IDENTIFIER_EXPRESSION@70..75 - 0: JS_REFERENCE_IDENTIFIER@70..75 - 0: IDENT@70..75 "foo" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@75..83 - 0: L_PAREN@75..76 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@76..82 - 0: JS_IDENTIFIER_EXPRESSION@76..77 - 0: JS_REFERENCE_IDENTIFIER@76..77 - 0: IDENT@76..77 "a" [] [] - 1: COMMA@77..79 "," [] [Whitespace(" ")] - 2: JS_SPREAD@79..82 - 0: DOT3@79..82 "..." [] [] - 1: (empty) - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 4: EOF@84..85 "" [Newline("\n")] [] --- -invalid_arg_list.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `;` - - 1 │ function foo(...args) {} - 2 │ let a, b, c; - > 3 │ foo(a,b; - │ ^ - 4 │ foo(a,b var; - 5 │ foo (,,b); - - i Remove ; - --- -invalid_arg_list.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `var` - - 2 │ let a, b, c; - 3 │ foo(a,b; - > 4 │ foo(a,b var; - │ ^^^ - 5 │ foo (,,b); - 6 │ foo (a, ...); - - i Remove var - --- -invalid_arg_list.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found ';'. - - 2 │ let a, b, c; - 3 │ foo(a,b; - > 4 │ foo(a,b var; - │ ^ - 5 │ foo (,,b); - 6 │ foo (a, ...); - - i Expected an identifier, an array pattern, or an object pattern here. - - 2 │ let a, b, c; - 3 │ foo(a,b; - > 4 │ foo(a,b var; - │ ^ - 5 │ foo (,,b); - 6 │ foo (a, ...); - --- -invalid_arg_list.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ','. - - 3 │ foo(a,b; - 4 │ foo(a,b var; - > 5 │ foo (,,b); - │ ^ - 6 │ foo (a, ...); - 7 │ - - i Expected an expression here. - - 3 │ foo(a,b; - 4 │ foo(a,b var; - > 5 │ foo (,,b); - │ ^ - 6 │ foo (a, ...); - 7 │ - --- -invalid_arg_list.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ','. - - 3 │ foo(a,b; - 4 │ foo(a,b var; - > 5 │ foo (,,b); - │ ^ - 6 │ foo (a, ...); - 7 │ - - i Expected an expression here. - - 3 │ foo(a,b; - 4 │ foo(a,b var; - > 5 │ foo (,,b); - │ ^ - 6 │ foo (a, ...); - 7 │ - --- -invalid_arg_list.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ')'. - - 4 │ foo(a,b var; - 5 │ foo (,,b); - > 6 │ foo (a, ...); - │ ^ - 7 │ - - i Expected an expression, or an assignment here. - - 4 │ foo(a,b var; - 5 │ foo (,,b); - > 6 │ foo (a, ...); - │ ^ - 7 │ - --- -function foo(...args) {} -let a, b, c; -foo(a,b; -foo(a,b var; -foo (,,b); -foo (a, ...); diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.rast b/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.rast deleted file mode 100644 index 49e039419406..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.rast +++ /dev/null @@ -1,338 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - PLUS2@0..2 "++" [] [], - JsIdentifierAssignment { - name_token: IDENT@2..4 "a" [] [Whitespace(" ")], - }, - ], - }, - operator_token: EQ@4..6 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@6..7 "b" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@7..8 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@8..10 "(" [Newline("\n")] [], - assignment: JsBogusAssignment { - items: [ - PLUS2@10..12 "++" [] [], - JsIdentifierAssignment { - name_token: IDENT@12..13 "a" [] [], - }, - ], - }, - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@15..17 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..18 "b" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@19..21 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@21..23 "a" [] [Whitespace(" ")], - }, - operator_token: EQ@23..25 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@25..26 "b" [] [], - }, - }, - }, - r_paren_token: missing (required), - }, - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..29 "a" [Newline("\n")] [], - }, - }, - QUESTIONDOT@29..31 "?." [] [], - JsName { - value_token: IDENT@31..33 "b" [] [Whitespace(" ")], - }, - ], - }, - operator_token: EQ@33..35 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "b" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@37..39 "a" [Newline("\n")] [], - }, - }, - QUESTIONDOT@39..41 "?." [] [], - L_BRACK@41..42 "[" [] [], - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@42..45 "\"b\"" [] [], - }, - R_BRACK@45..47 "]" [] [Whitespace(" ")], - ], - }, - operator_token: EQ@47..49 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..50 "b" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@51..53 "(" [Newline("\n")] [], - assignment: JsBogusAssignment { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..55 "a" [] [Whitespace(" ")], - }, - }, - PLUS@55..56 "+" [] [], - ], - }, - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@58..60 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@60..61 "b" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@61..62 ";" [] [], - }, - ], - eof_token: EOF@62..63 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..63 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..62 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_ASSIGNMENT_EXPRESSION@0..7 - 0: JS_BOGUS_ASSIGNMENT@0..4 - 0: PLUS2@0..2 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@2..4 - 0: IDENT@2..4 "a" [] [Whitespace(" ")] - 1: EQ@4..6 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@6..7 - 0: JS_REFERENCE_IDENTIFIER@6..7 - 0: IDENT@6..7 "b" [] [] - 1: SEMICOLON@7..8 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@8..19 - 0: JS_ASSIGNMENT_EXPRESSION@8..18 - 0: JS_PARENTHESIZED_ASSIGNMENT@8..15 - 0: L_PAREN@8..10 "(" [Newline("\n")] [] - 1: JS_BOGUS_ASSIGNMENT@10..13 - 0: PLUS2@10..12 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@12..13 - 0: IDENT@12..13 "a" [] [] - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 1: EQ@15..17 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@17..18 - 0: JS_REFERENCE_IDENTIFIER@17..18 - 0: IDENT@17..18 "b" [] [] - 1: SEMICOLON@18..19 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@19..27 - 0: JS_PARENTHESIZED_EXPRESSION@19..26 - 0: L_PAREN@19..21 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@21..26 - 0: JS_IDENTIFIER_ASSIGNMENT@21..23 - 0: IDENT@21..23 "a" [] [Whitespace(" ")] - 1: EQ@23..25 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@25..26 - 0: JS_REFERENCE_IDENTIFIER@25..26 - 0: IDENT@25..26 "b" [] [] - 2: (empty) - 1: SEMICOLON@26..27 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@27..37 - 0: JS_ASSIGNMENT_EXPRESSION@27..36 - 0: JS_BOGUS_ASSIGNMENT@27..33 - 0: JS_IDENTIFIER_EXPRESSION@27..29 - 0: JS_REFERENCE_IDENTIFIER@27..29 - 0: IDENT@27..29 "a" [Newline("\n")] [] - 1: QUESTIONDOT@29..31 "?." [] [] - 2: JS_NAME@31..33 - 0: IDENT@31..33 "b" [] [Whitespace(" ")] - 1: EQ@33..35 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "b" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@37..51 - 0: JS_ASSIGNMENT_EXPRESSION@37..50 - 0: JS_BOGUS_ASSIGNMENT@37..47 - 0: JS_IDENTIFIER_EXPRESSION@37..39 - 0: JS_REFERENCE_IDENTIFIER@37..39 - 0: IDENT@37..39 "a" [Newline("\n")] [] - 1: QUESTIONDOT@39..41 "?." [] [] - 2: L_BRACK@41..42 "[" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@42..45 - 0: JS_STRING_LITERAL@42..45 "\"b\"" [] [] - 4: R_BRACK@45..47 "]" [] [Whitespace(" ")] - 1: EQ@47..49 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@49..50 - 0: JS_REFERENCE_IDENTIFIER@49..50 - 0: IDENT@49..50 "b" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@51..62 - 0: JS_ASSIGNMENT_EXPRESSION@51..61 - 0: JS_PARENTHESIZED_ASSIGNMENT@51..58 - 0: L_PAREN@51..53 "(" [Newline("\n")] [] - 1: JS_BOGUS_ASSIGNMENT@53..56 - 0: JS_IDENTIFIER_EXPRESSION@53..55 - 0: JS_REFERENCE_IDENTIFIER@53..55 - 0: IDENT@53..55 "a" [] [Whitespace(" ")] - 1: PLUS@55..56 "+" [] [] - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 1: EQ@58..60 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@60..61 - 0: JS_REFERENCE_IDENTIFIER@60..61 - 0: IDENT@60..61 "b" [] [] - 1: SEMICOLON@61..62 ";" [] [] - 4: EOF@62..63 "" [Newline("\n")] [] --- -invalid_assignment_target.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `++a` - - > 1 │ ++a = b; - │ ^^^ - 2 │ (++a) = b; - 3 │ (a = b; - - i This expression cannot be assigned to - --- -invalid_assignment_target.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `++a` - - 1 │ ++a = b; - > 2 │ (++a) = b; - │ ^^^ - 3 │ (a = b; - 4 │ a?.b = b; - - i This expression cannot be assigned to - --- -invalid_assignment_target.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `;` - - 1 │ ++a = b; - 2 │ (++a) = b; - > 3 │ (a = b; - │ ^ - 4 │ a?.b = b; - 5 │ a?.["b"] = b; - - i Remove ; - --- -invalid_assignment_target.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `a?.b` - - 2 │ (++a) = b; - 3 │ (a = b; - > 4 │ a?.b = b; - │ ^^^^ - 5 │ a?.["b"] = b; - 6 │ (a +) = b; - - i This expression cannot be assigned to - --- -invalid_assignment_target.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `a?.["b"]` - - 3 │ (a = b; - 4 │ a?.b = b; - > 5 │ a?.["b"] = b; - │ ^^^^^^^^ - 6 │ (a +) = b; - 7 │ - - i This expression cannot be assigned to - --- -invalid_assignment_target.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ')'. - - 4 │ a?.b = b; - 5 │ a?.["b"] = b; - > 6 │ (a +) = b; - │ ^ - 7 │ - - i Expected an expression here. - - 4 │ a?.b = b; - 5 │ a?.["b"] = b; - > 6 │ (a +) = b; - │ ^ - 7 │ - --- -invalid_assignment_target.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `a +` - - 4 │ a?.b = b; - 5 │ a?.["b"] = b; - > 6 │ (a +) = b; - │ ^^^ - 7 │ - - i This expression cannot be assigned to - --- -++a = b; -(++a) = b; -(a = b; -a?.b = b; -a?.["b"] = b; -(a +) = b; diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.rast b/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.rast deleted file mode 100644 index c789bc1c6a54..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.rast +++ /dev/null @@ -1,181 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@6..7 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsComputedMemberName { - l_brack_token: L_BRACK@7..11 "[" [Newline("\n"), Whitespace(" ")] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@11..13 "1" [] [Whitespace(" ")], - }, - operator_token: PLUS@13..15 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@15..16 "1" [] [], - }, - }, - r_brack_token: R_BRACK@16..18 "]" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@18..20 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@27..36 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@36..37 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@37..38 "=" [] [], - expression: missing (required), - }, - }, - ], - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - ], - r_curly_token: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - ], - r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_CLASS_DECLARATION@0..46 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@6..7 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@7..44 - 0: JS_PROPERTY_CLASS_MEMBER@7..44 - 0: JS_PROPERTY_MODIFIER_LIST@7..7 - 1: JS_COMPUTED_MEMBER_NAME@7..18 - 0: L_BRACK@7..11 "[" [Newline("\n"), Whitespace(" ")] [] - 1: JS_BINARY_EXPRESSION@11..16 - 0: JS_NUMBER_LITERAL_EXPRESSION@11..13 - 0: JS_NUMBER_LITERAL@11..13 "1" [] [Whitespace(" ")] - 1: PLUS@13..15 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@15..16 - 0: JS_NUMBER_LITERAL@15..16 "1" [] [] - 2: R_BRACK@16..18 "]" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@18..43 - 0: EQ@18..20 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@20..43 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@20..23 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..21 - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@26..43 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..39 - 0: JS_VARIABLE_STATEMENT@27..39 - 0: JS_VARIABLE_DECLARATION@27..38 - 0: (empty) - 1: LET_KW@27..36 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@36..38 - 0: JS_VARIABLE_DECLARATOR@36..38 - 0: JS_IDENTIFIER_BINDING@36..37 - 0: IDENT@36..37 "a" [] [] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@37..38 - 0: EQ@37..38 "=" [] [] - 1: (empty) - 1: SEMICOLON@38..39 ";" [] [] - 3: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [] - 4: SEMICOLON@43..44 ";" [] [] - 9: R_CURLY@44..46 "}" [Newline("\n")] [] - 1: JS_EMPTY_STATEMENT@46..47 - 0: SEMICOLON@46..47 ";" [] [] - 4: EOF@47..48 "" [Newline("\n")] [] --- -invalid_method_recover.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - > 1 │ class { - │ ^^^^^^ - 2 │ [1 + 1] = () => { - 3 │ let a=; - --- -invalid_method_recover.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ';'. - - 1 │ class { - 2 │ [1 + 1] = () => { - > 3 │ let a=; - │ ^ - 4 │ }; - 5 │ }; - - i Expected an expression, or an assignment here. - - 1 │ class { - 2 │ [1 + 1] = () => { - > 3 │ let a=; - │ ^ - 4 │ }; - 5 │ }; - --- -class { - [1 + 1] = () => { - let a=; - }; -}; diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast b/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast deleted file mode 100644 index f220de87158d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast +++ /dev/null @@ -1,456 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsNewExpression { - new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..8 "Test" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@8..9 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@9..15 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@15..16 ">" [] [], - }, - arguments: missing (optional), - }, - operator_token: QUESTIONDOT@16..18 "?." [] [], - member: JsName { - value_token: IDENT@18..22 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@22..23 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@23..24 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsNewExpression { - new_token: NEW_KW@25..30 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..34 "Test" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - operator_token: QUESTIONDOT@34..36 "?." [] [], - member: JsName { - value_token: IDENT@36..40 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@40..41 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@41..42 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsNewExpression { - new_token: NEW_KW@43..48 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@48..49 "A" [] [], - }, - }, - operator_token: DOT@49..50 "." [] [], - member: JsName { - value_token: IDENT@50..51 "b" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - operator_token: QUESTIONDOT@51..53 "?." [] [], - member: JsName { - value_token: IDENT@53..54 "c" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@54..55 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@55..56 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsNewExpression { - new_token: NEW_KW@56..61 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@61..62 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@62..63 "A" [] [], - }, - }, - operator_token: DOT@63..64 "." [] [], - member: JsName { - value_token: IDENT@64..65 "b" [] [], - }, - }, - r_paren_token: R_PAREN@65..66 ")" [] [], - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - operator_token: QUESTIONDOT@66..68 "?." [] [], - member: JsName { - value_token: IDENT@68..69 "c" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@69..70 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@70..71 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@71..76 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@76..77 "(" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@77..78 "A" [] [], - }, - }, - operator_token: DOT@78..79 "." [] [], - member: JsName { - value_token: IDENT@79..80 "b" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@80..82 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@82..83 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@83..84 ")" [] [], - }, - }, - r_paren_token: R_PAREN@84..85 ")" [] [], - }, - operator_token: DOT@85..86 "." [] [], - member: JsName { - value_token: IDENT@86..87 "c" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@87..88 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@88..89 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsCallExpression { - callee: JsNewExpression { - new_token: NEW_KW@89..94 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@94..95 "A" [] [], - }, - }, - operator_token: DOT@95..96 "." [] [], - member: JsName { - value_token: IDENT@96..97 "b" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - optional_chain_token: QUESTIONDOT@97..99 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@99..100 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@100..101 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@101..102 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@102..103 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@103..104 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..104 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..103 - 0: JS_EXPRESSION_STATEMENT@0..25 - 0: JS_CALL_EXPRESSION@0..24 - 0: JS_STATIC_MEMBER_EXPRESSION@0..22 - 0: JS_NEW_EXPRESSION@0..16 - 0: NEW_KW@0..4 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@4..8 - 0: JS_REFERENCE_IDENTIFIER@4..8 - 0: IDENT@4..8 "Test" [] [] - 2: TS_TYPE_ARGUMENTS@8..16 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@9..15 - 0: TS_STRING_TYPE@9..15 - 0: STRING_KW@9..15 "string" [] [] - 2: R_ANGLE@15..16 ">" [] [] - 3: (empty) - 1: QUESTIONDOT@16..18 "?." [] [] - 2: JS_NAME@18..22 - 0: IDENT@18..22 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@22..24 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@23..23 - 2: R_PAREN@23..24 ")" [] [] - 1: SEMICOLON@24..25 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@25..43 - 0: JS_CALL_EXPRESSION@25..42 - 0: JS_STATIC_MEMBER_EXPRESSION@25..40 - 0: JS_NEW_EXPRESSION@25..34 - 0: NEW_KW@25..30 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@30..34 - 0: JS_REFERENCE_IDENTIFIER@30..34 - 0: IDENT@30..34 "Test" [] [] - 2: (empty) - 3: (empty) - 1: QUESTIONDOT@34..36 "?." [] [] - 2: JS_NAME@36..40 - 0: IDENT@36..40 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@40..42 - 0: L_PAREN@40..41 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@41..41 - 2: R_PAREN@41..42 ")" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@43..56 - 0: JS_CALL_EXPRESSION@43..56 - 0: JS_STATIC_MEMBER_EXPRESSION@43..54 - 0: JS_NEW_EXPRESSION@43..51 - 0: NEW_KW@43..48 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@48..51 - 0: JS_IDENTIFIER_EXPRESSION@48..49 - 0: JS_REFERENCE_IDENTIFIER@48..49 - 0: IDENT@48..49 "A" [] [] - 1: DOT@49..50 "." [] [] - 2: JS_NAME@50..51 - 0: IDENT@50..51 "b" [] [] - 2: (empty) - 3: (empty) - 1: QUESTIONDOT@51..53 "?." [] [] - 2: JS_NAME@53..54 - 0: IDENT@53..54 "c" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@54..56 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@55..55 - 2: R_PAREN@55..56 ")" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@56..71 - 0: JS_CALL_EXPRESSION@56..71 - 0: JS_STATIC_MEMBER_EXPRESSION@56..69 - 0: JS_NEW_EXPRESSION@56..66 - 0: NEW_KW@56..61 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@61..66 - 0: L_PAREN@61..62 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@62..65 - 0: JS_IDENTIFIER_EXPRESSION@62..63 - 0: JS_REFERENCE_IDENTIFIER@62..63 - 0: IDENT@62..63 "A" [] [] - 1: DOT@63..64 "." [] [] - 2: JS_NAME@64..65 - 0: IDENT@64..65 "b" [] [] - 2: R_PAREN@65..66 ")" [] [] - 2: (empty) - 3: (empty) - 1: QUESTIONDOT@66..68 "?." [] [] - 2: JS_NAME@68..69 - 0: IDENT@68..69 "c" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@69..71 - 0: L_PAREN@69..70 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@70..70 - 2: R_PAREN@70..71 ")" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@71..89 - 0: JS_NEW_EXPRESSION@71..89 - 0: NEW_KW@71..76 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@76..87 - 0: JS_PARENTHESIZED_EXPRESSION@76..85 - 0: L_PAREN@76..77 "(" [] [] - 1: JS_CALL_EXPRESSION@77..84 - 0: JS_STATIC_MEMBER_EXPRESSION@77..80 - 0: JS_IDENTIFIER_EXPRESSION@77..78 - 0: JS_REFERENCE_IDENTIFIER@77..78 - 0: IDENT@77..78 "A" [] [] - 1: DOT@78..79 "." [] [] - 2: JS_NAME@79..80 - 0: IDENT@79..80 "b" [] [] - 1: QUESTIONDOT@80..82 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@82..84 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@83..83 - 2: R_PAREN@83..84 ")" [] [] - 2: R_PAREN@84..85 ")" [] [] - 1: DOT@85..86 "." [] [] - 2: JS_NAME@86..87 - 0: IDENT@86..87 "c" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@87..89 - 0: L_PAREN@87..88 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@88..88 - 2: R_PAREN@88..89 ")" [] [] - 1: (empty) - 5: JS_EXPRESSION_STATEMENT@89..103 - 0: JS_CALL_EXPRESSION@89..103 - 0: JS_CALL_EXPRESSION@89..101 - 0: JS_NEW_EXPRESSION@89..97 - 0: NEW_KW@89..94 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@94..97 - 0: JS_IDENTIFIER_EXPRESSION@94..95 - 0: JS_REFERENCE_IDENTIFIER@94..95 - 0: IDENT@94..95 "A" [] [] - 1: DOT@95..96 "." [] [] - 2: JS_NAME@96..97 - 0: IDENT@96..97 "b" [] [] - 2: (empty) - 3: (empty) - 1: QUESTIONDOT@97..99 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@99..101 - 0: L_PAREN@99..100 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@100..100 - 2: R_PAREN@100..101 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@101..103 - 0: L_PAREN@101..102 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@102..102 - 2: R_PAREN@102..103 ")" [] [] - 1: (empty) - 4: EOF@103..104 "" [Newline("\n")] [] --- -invalid_optional_chain_from_new_expressions.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid optional chain from new expression. - - > 1 │ new Test?.test(); - │ ^^ - 2 │ new Test?.test(); - 3 │ new A.b?.c() - - i Did you mean to call 'Test()'? - --- -invalid_optional_chain_from_new_expressions.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid optional chain from new expression. - - 1 │ new Test?.test(); - > 2 │ new Test?.test(); - │ ^^ - 3 │ new A.b?.c() - 4 │ new (A.b)?.c() - - i Did you mean to call 'Test()'? - --- -invalid_optional_chain_from_new_expressions.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid optional chain from new expression. - - 1 │ new Test?.test(); - 2 │ new Test?.test(); - > 3 │ new A.b?.c() - │ ^^ - 4 │ new (A.b)?.c() - 5 │ new (A.b?.()).c() - - i Did you mean to call 'A.b()'? - --- -invalid_optional_chain_from_new_expressions.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid optional chain from new expression. - - 2 │ new Test?.test(); - 3 │ new A.b?.c() - > 4 │ new (A.b)?.c() - │ ^^ - 5 │ new (A.b?.()).c() - 6 │ new A.b?.()() - - i Did you mean to call '(A.b)()'? - --- -invalid_optional_chain_from_new_expressions.ts:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid optional chain from new expression. - - 4 │ new (A.b)?.c() - 5 │ new (A.b?.()).c() - > 6 │ new A.b?.()() - │ ^^ - 7 │ - - i Did you mean to call 'A.b()'? - --- -new Test?.test(); -new Test?.test(); -new A.b?.c() -new (A.b)?.c() -new (A.b?.()).c() -new A.b?.()() diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast b/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast deleted file mode 100644 index 8f5a5bc48d8d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast +++ /dev/null @@ -1,230 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsVariableDeclaration { - await_token: AWAIT_KW@5..11 "await" [] [Whitespace(" ")], - kind: USING_KW@11..17 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@17..20 "of" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - first_semi_token: missing (required), - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..21 "x" [] [], - }, - }, - second_semi_token: missing (required), - update: missing (optional), - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@23..24 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - JsBogusStatement { - items: [ - FOR_KW@26..31 "for" [Newline("\n")] [Whitespace(" ")], - AWAIT_KW@31..37 "await" [] [Whitespace(" ")], - L_PAREN@37..38 "(" [] [], - JsVariableDeclaration { - await_token: AWAIT_KW@38..44 "await" [] [Whitespace(" ")], - kind: USING_KW@44..50 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@50..53 "of" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..54 "x" [] [], - }, - }, - R_PAREN@54..56 ")" [] [Whitespace(" ")], - JsBlockStatement { - l_curly_token: L_CURLY@56..57 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - ], - eof_token: EOF@59..60 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..60 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..59 - 0: JS_FOR_STATEMENT@0..25 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_VARIABLE_DECLARATION@5..20 - 0: AWAIT_KW@5..11 "await" [] [Whitespace(" ")] - 1: USING_KW@11..17 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@17..20 - 0: JS_VARIABLE_DECLARATOR@17..20 - 0: JS_IDENTIFIER_BINDING@17..20 - 0: IDENT@17..20 "of" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: JS_IDENTIFIER_EXPRESSION@20..21 - 0: JS_REFERENCE_IDENTIFIER@20..21 - 0: IDENT@20..21 "x" [] [] - 5: (empty) - 6: (empty) - 7: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@23..25 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_STATEMENT_LIST@24..24 - 2: R_CURLY@24..25 "}" [] [] - 1: JS_EMPTY_STATEMENT@25..26 - 0: SEMICOLON@25..26 ";" [] [] - 2: JS_BOGUS_STATEMENT@26..58 - 0: FOR_KW@26..31 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@31..37 "await" [] [Whitespace(" ")] - 2: L_PAREN@37..38 "(" [] [] - 3: JS_VARIABLE_DECLARATION@38..53 - 0: AWAIT_KW@38..44 "await" [] [Whitespace(" ")] - 1: USING_KW@44..50 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@50..53 - 0: JS_VARIABLE_DECLARATOR@50..53 - 0: JS_IDENTIFIER_BINDING@50..53 - 0: IDENT@50..53 "of" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: JS_IDENTIFIER_EXPRESSION@53..54 - 0: JS_REFERENCE_IDENTIFIER@53..54 - 0: IDENT@53..54 "x" [] [] - 5: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@56..58 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_STATEMENT_LIST@57..57 - 2: R_CURLY@57..58 "}" [] [] - 3: JS_EMPTY_STATEMENT@58..59 - 0: SEMICOLON@58..59 ";" [] [] - 4: EOF@59..60 "" [Newline("\n")] [] --- -invalid_using_declarations_inside_for_statement.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - > 1 │ for (await using of x) {}; - │ ^^ - 2 │ for await (await using of x) {}; - 3 │ - - i This variable needs to be initialized. - --- -invalid_using_declarations_inside_for_statement.js:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `x` - - > 1 │ for (await using of x) {}; - │ ^ - 2 │ for await (await using of x) {}; - 3 │ - - i Remove x - --- -invalid_using_declarations_inside_for_statement.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `)` - - > 1 │ for (await using of x) {}; - │ ^ - 2 │ for await (await using of x) {}; - 3 │ - - i Remove ) - --- -invalid_using_declarations_inside_for_statement.js:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - 1 │ for (await using of x) {}; - > 2 │ for await (await using of x) {}; - │ ^^ - 3 │ - - i This variable needs to be initialized. - --- -invalid_using_declarations_inside_for_statement.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `x` - - 1 │ for (await using of x) {}; - > 2 │ for await (await using of x) {}; - │ ^ - 3 │ - - i Remove x - --- -invalid_using_declarations_inside_for_statement.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `;` but instead found `)` - - 1 │ for (await using of x) {}; - > 2 │ for await (await using of x) {}; - │ ^ - 3 │ - - i Remove ) - --- -invalid_using_declarations_inside_for_statement.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × await can only be used in conjunction with `for...of` statements - - 1 │ for (await using of x) {}; - > 2 │ for await (await using of x) {}; - │ ^^^^^ - 3 │ - - i Remove the await here - - 1 │ for (await using of x) {}; - > 2 │ for await (await using of x) {}; - │ ^^^^^ - 3 │ - - i or convert this to a `for...of` statement - - 1 │ for (await using of x) {}; - > 2 │ for await (await using of x) {}; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 │ - --- -for (await using of x) {}; -for await (await using of x) {}; diff --git a/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast b/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast deleted file mode 100644 index e88d3b2d2d6d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast +++ /dev/null @@ -1,171 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsPropertyModifierList [], - JsLiteralMemberName { - value: IDENT@9..12 "a" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - COLON@12..14 ":" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@14..20 "string" [] [], - }, - ], - }, - SEMICOLON@20..21 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [], - JsLiteralMemberName { - value: IDENT@21..24 "b" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - QUESTION@24..25 "?" [] [], - TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@27..33 "string" [] [], - }, - }, - ], - }, - SEMICOLON@33..34 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [], - JsLiteralMemberName { - value: IDENT@34..37 "c" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - BANG@37..38 "!" [] [], - TsTypeAnnotation { - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@40..46 "string" [] [], - }, - }, - ], - }, - ], - }, - ], - r_curly_token: R_CURLY@46..48 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@48..49 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..49 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..48 - 0: JS_CLASS_DECLARATION@0..48 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..46 - 0: JS_BOGUS_MEMBER@9..21 - 0: JS_PROPERTY_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..12 - 0: IDENT@9..12 "a" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@12..20 - 0: COLON@12..14 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@14..20 - 0: STRING_KW@14..20 "string" [] [] - 3: SEMICOLON@20..21 ";" [] [] - 1: JS_BOGUS_MEMBER@21..34 - 0: JS_PROPERTY_MODIFIER_LIST@21..21 - 1: JS_LITERAL_MEMBER_NAME@21..24 - 0: IDENT@21..24 "b" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@24..33 - 0: QUESTION@24..25 "?" [] [] - 1: TS_TYPE_ANNOTATION@25..33 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@27..33 - 0: STRING_KW@27..33 "string" [] [] - 3: SEMICOLON@33..34 ";" [] [] - 2: JS_BOGUS_MEMBER@34..46 - 0: JS_PROPERTY_MODIFIER_LIST@34..34 - 1: JS_LITERAL_MEMBER_NAME@34..37 - 0: IDENT@34..37 "c" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@37..46 - 0: BANG@37..38 "!" [] [] - 1: TS_TYPE_ANNOTATION@38..46 - 0: COLON@38..40 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@40..46 - 0: STRING_KW@40..46 "string" [] [] - 9: R_CURLY@46..48 "}" [Newline("\n")] [] - 4: EOF@48..49 "" [Newline("\n")] [] --- -js_class_property_with_ts_annotation.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × return types can only be used in TypeScript files - - 1 │ class A { - > 2 │ a: string; - │ ^^^^^^^^ - 3 │ b?: string; - 4 │ c!: string - - i remove this type annotation - --- -js_class_property_with_ts_annotation.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `?` modifiers can only be used in TypeScript files - - 1 │ class A { - 2 │ a: string; - > 3 │ b?: string; - │ ^ - 4 │ c!: string - 5 │ } - --- -js_class_property_with_ts_annotation.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `!` modifiers can only be used in TypeScript files - - 2 │ a: string; - 3 │ b?: string; - > 4 │ c!: string - │ ^ - 5 │ } - 6 │ - --- -class A { - a: string; - b?: string; - c!: string -} diff --git a/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast b/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast deleted file mode 100644 index 74ce8dfec427..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast +++ /dev/null @@ -1,182 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@16..18 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@20..31 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@32..40 "readonly" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@40..42 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@42..49 "private" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@49..51 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@51..60 "protected" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@60..62 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsBogusBinding { - items: [ - IDENT@62..68 "public" [] [], - ], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@70..71 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@73..74 "}" [] [], - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..74 - 0: JS_CLASS_DECLARATION@0..74 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@16..18 - 0: IDENT@16..18 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@20..73 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..73 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..31 - 0: IDENT@20..31 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@31..70 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..68 - 0: JS_FORMAL_PARAMETER@32..40 - 0: JS_DECORATOR_LIST@32..32 - 1: JS_IDENTIFIER_BINDING@32..40 - 0: IDENT@32..40 "readonly" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@40..42 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@42..49 - 0: JS_DECORATOR_LIST@42..42 - 1: JS_BOGUS_BINDING@42..49 - 0: IDENT@42..49 "private" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@49..51 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@51..60 - 0: JS_DECORATOR_LIST@51..51 - 1: JS_BOGUS_BINDING@51..60 - 0: IDENT@51..60 "protected" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: COMMA@60..62 "," [] [Whitespace(" ")] - 6: JS_FORMAL_PARAMETER@62..68 - 0: JS_DECORATOR_LIST@62..62 - 1: JS_BOGUS_BINDING@62..68 - 0: IDENT@62..68 "public" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@70..73 - 0: L_CURLY@70..71 "{" [] [] - 1: JS_DIRECTIVE_LIST@71..71 - 2: JS_STATEMENT_LIST@71..71 - 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] - 9: R_CURLY@73..74 "}" [] [] - 4: EOF@74..75 "" [Newline("\n")] [] --- -js_constructor_parameter_reserved_names.js:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `private` as an identifier in strict mode - - 1 │ // SCRIPT - > 2 │ class A { constructor(readonly, private, protected, public) {} } - │ ^^^^^^^ - 3 │ - --- -js_constructor_parameter_reserved_names.js:2:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `protected` as an identifier in strict mode - - 1 │ // SCRIPT - > 2 │ class A { constructor(readonly, private, protected, public) {} } - │ ^^^^^^^^^ - 3 │ - --- -js_constructor_parameter_reserved_names.js:2:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `public` as an identifier in strict mode - - 1 │ // SCRIPT - > 2 │ class A { constructor(readonly, private, protected, public) {} } - │ ^^^^^^ - 3 │ - --- -// SCRIPT -class A { constructor(readonly, private, protected, public) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.rast b/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.rast deleted file mode 100644 index 36627f76fb15..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.rast +++ /dev/null @@ -1,158 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - JsIdentifierBinding { - name_token: IDENT@11..12 "x" [] [], - }, - JsBogus { - items: [ - COLON@12..14 ":" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@14..20 "string" [] [], - }, - ], - }, - ], - }, - ], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@24..34 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@34..35 "b" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@35..36 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - JsIdentifierBinding { - name_token: IDENT@36..37 "x" [] [], - }, - QUESTION@37..38 "?" [] [], - ], - }, - ], - r_paren_token: R_PAREN@38..40 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@40..41 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@41..42 "}" [] [], - }, - }, - ], - eof_token: EOF@42..43 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_FUNCTION_DECLARATION@0..24 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..22 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..20 - 0: JS_BOGUS_PARAMETER@11..20 - 0: JS_DECORATOR_LIST@11..11 - 1: JS_IDENTIFIER_BINDING@11..12 - 0: IDENT@11..12 "x" [] [] - 2: JS_BOGUS@12..20 - 0: COLON@12..14 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@14..20 - 0: STRING_KW@14..20 "string" [] [] - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@22..24 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..23 - 3: R_CURLY@23..24 "}" [] [] - 1: JS_FUNCTION_DECLARATION@24..42 - 0: (empty) - 1: FUNCTION_KW@24..34 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@34..35 - 0: IDENT@34..35 "b" [] [] - 4: (empty) - 5: JS_PARAMETERS@35..40 - 0: L_PAREN@35..36 "(" [] [] - 1: JS_PARAMETER_LIST@36..38 - 0: JS_BOGUS_PARAMETER@36..38 - 0: JS_DECORATOR_LIST@36..36 - 1: JS_IDENTIFIER_BINDING@36..37 - 0: IDENT@36..37 "x" [] [] - 2: QUESTION@37..38 "?" [] [] - 2: R_PAREN@38..40 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@40..42 - 0: L_CURLY@40..41 "{" [] [] - 1: JS_DIRECTIVE_LIST@41..41 - 2: JS_STATEMENT_LIST@41..41 - 3: R_CURLY@41..42 "}" [] [] - 4: EOF@42..43 "" [Newline("\n")] [] --- -js_formal_parameter_error.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - > 1 │ function a(x: string) {} - │ ^^^^^^^^ - 2 │ function b(x?) {} - 3 │ - - i TypeScript only syntax - --- -js_formal_parameter_error.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × optional parameters are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 1 │ function a(x: string) {} - > 2 │ function b(x?) {} - │ ^ - 3 │ - - i TypeScript only syntax - --- -function a(x: string) {} -function b(x?) {} diff --git a/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.rast b/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.rast deleted file mode 100644 index 252549c70113..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.rast +++ /dev/null @@ -1,320 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsArrayExpression { - l_brack_token: L_BRACK@1..2 "[" [] [], - elements: JsArrayElementList [ - JsBogusExpression { - items: [ - EQ@2..3 "=" [] [], - ], - }, - missing separator, - JsArrayExpression { - l_brack_token: L_BRACK@3..4 "[" [] [], - elements: JsArrayElementList [ - JsParenthesizedExpression { - l_paren_token: L_PAREN@4..5 "(" [] [], - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@5..6 "p" [] [], - }, - }, - l_brack_token: L_BRACK@6..7 "[" [] [], - member: missing (required), - r_brack_token: missing (required), - }, - operator_token: EQ@7..8 "=" [] [], - right: JsBinaryExpression { - left: JsArrayExpression { - l_brack_token: L_BRACK@8..9 "[" [] [], - elements: JsArrayElementList [ - JsParenthesizedExpression { - l_paren_token: L_PAREN@9..10 "(" [] [], - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..11 "p" [] [], - }, - }, - operator_token: PERCENT@11..12 "%" [] [], - right: missing (required), - }, - r_paren_token: missing (required), - }, - ], - r_brack_token: R_BRACK@12..13 "]" [] [], - }, - operator_token: R_ANGLE@13..14 ">" [] [], - right: JsParenthesizedExpression { - l_paren_token: L_PAREN@14..15 "(" [] [], - expression: JsArrayExpression { - l_brack_token: L_BRACK@15..16 "[" [] [], - elements: JsArrayElementList [ - JsBogusExpression { - items: [ - EQ@16..17 "=" [] [], - ], - }, - missing separator, - JsArrayExpression { - l_brack_token: L_BRACK@17..18 "[" [] [], - elements: JsArrayElementList [ - JsParenthesizedExpression { - l_paren_token: L_PAREN@18..19 "(" [] [], - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@19..20 "p" [] [], - }, - }, - l_brack_token: L_BRACK@20..21 "[" [] [], - member: missing (required), - r_brack_token: missing (required), - }, - operator_token: EQ@21..22 "=" [] [], - right: JsArrayExpression { - l_brack_token: L_BRACK@22..23 "[" [] [], - elements: JsArrayElementList [ - JsParenthesizedExpression { - l_paren_token: L_PAREN@23..24 "(" [] [], - expression: missing (required), - r_paren_token: missing (required), - }, - ], - r_brack_token: missing (required), - }, - }, - r_paren_token: missing (required), - }, - ], - r_brack_token: missing (required), - }, - ], - r_brack_token: missing (required), - }, - r_paren_token: missing (required), - }, - }, - }, - r_paren_token: missing (required), - }, - ], - r_brack_token: missing (required), - }, - ], - r_brack_token: missing (required), - }, - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_EXPRESSION_STATEMENT@0..24 - 0: JS_PARENTHESIZED_EXPRESSION@0..24 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ARRAY_EXPRESSION@1..24 - 0: L_BRACK@1..2 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@2..24 - 0: JS_BOGUS_EXPRESSION@2..3 - 0: EQ@2..3 "=" [] [] - 1: (empty) - 2: JS_ARRAY_EXPRESSION@3..24 - 0: L_BRACK@3..4 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@4..24 - 0: JS_PARENTHESIZED_EXPRESSION@4..24 - 0: L_PAREN@4..5 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@5..24 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@5..7 - 0: JS_IDENTIFIER_EXPRESSION@5..6 - 0: JS_REFERENCE_IDENTIFIER@5..6 - 0: IDENT@5..6 "p" [] [] - 1: L_BRACK@6..7 "[" [] [] - 2: (empty) - 3: (empty) - 1: EQ@7..8 "=" [] [] - 2: JS_BINARY_EXPRESSION@8..24 - 0: JS_ARRAY_EXPRESSION@8..13 - 0: L_BRACK@8..9 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@9..12 - 0: JS_PARENTHESIZED_EXPRESSION@9..12 - 0: L_PAREN@9..10 "(" [] [] - 1: JS_BINARY_EXPRESSION@10..12 - 0: JS_IDENTIFIER_EXPRESSION@10..11 - 0: JS_REFERENCE_IDENTIFIER@10..11 - 0: IDENT@10..11 "p" [] [] - 1: PERCENT@11..12 "%" [] [] - 2: (empty) - 2: (empty) - 2: R_BRACK@12..13 "]" [] [] - 1: R_ANGLE@13..14 ">" [] [] - 2: JS_PARENTHESIZED_EXPRESSION@14..24 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_ARRAY_EXPRESSION@15..24 - 0: L_BRACK@15..16 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@16..24 - 0: JS_BOGUS_EXPRESSION@16..17 - 0: EQ@16..17 "=" [] [] - 1: (empty) - 2: JS_ARRAY_EXPRESSION@17..24 - 0: L_BRACK@17..18 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@18..24 - 0: JS_PARENTHESIZED_EXPRESSION@18..24 - 0: L_PAREN@18..19 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@19..24 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@19..21 - 0: JS_IDENTIFIER_EXPRESSION@19..20 - 0: JS_REFERENCE_IDENTIFIER@19..20 - 0: IDENT@19..20 "p" [] [] - 1: L_BRACK@20..21 "[" [] [] - 2: (empty) - 3: (empty) - 1: EQ@21..22 "=" [] [] - 2: JS_ARRAY_EXPRESSION@22..24 - 0: L_BRACK@22..23 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@23..24 - 0: JS_PARENTHESIZED_EXPRESSION@23..24 - 0: L_PAREN@23..24 "(" [] [] - 1: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 1: (empty) - 4: EOF@24..25 "" [Newline("\n")] [] --- -js_invalid_assignment.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a property, an expression, or a method but instead found '='. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Expected a property, an expression, or a method here. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - --- -js_invalid_assignment.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `[` - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Remove [ - --- -js_invalid_assignment.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '='. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - --- -js_invalid_assignment.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ']'. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - --- -js_invalid_assignment.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a property, an expression, or a method but instead found '='. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Expected a property, an expression, or a method here. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - --- -js_invalid_assignment.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `[` - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Remove [ - --- -js_invalid_assignment.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '='. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ - 2 │ - --- -js_invalid_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead the file ends - - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - > 2 │ - │ - - i the file ends here - - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - > 2 │ - │ - --- -([=[(p[=[(p%]>([=[(p[=[( diff --git a/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.rast b/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.rast deleted file mode 100644 index ba270cc8dec5..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.rast +++ /dev/null @@ -1,68 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - JS_REGEX_LITERAL@0..8 "/=0*_:m/" [] [], - ], - }, - operator_token: EQ@8..15 "=" [] [Comments("/*_:|\n")], - right: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@15..15 "" [] [], -} - -0: JS_MODULE@0..15 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..15 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JS_ASSIGNMENT_EXPRESSION@0..15 - 0: JS_BOGUS_ASSIGNMENT@0..8 - 0: JS_REGEX_LITERAL@0..8 "/=0*_:m/" [] [] - 1: EQ@8..15 "=" [] [Comments("/*_:|\n")] - 2: (empty) - 1: (empty) - 4: EOF@15..15 "" [] [] --- -js_regex_assignment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `/=0*_:m/` - - > 1 │ /=0*_:m/=/*_:| - │ ^^^^^^^^ - 2 │ - - i This expression cannot be assigned to - --- -js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated block comment - - 1 │ /=0*_:m/=/*_:| - > 2 │ - │ - - i ... but the file ends here - - 1 │ /=0*_:m/=/*_:| - > 2 │ - │ - - i A block comment starts here - - > 1 │ /=0*_:m/=/*_:| - │ ^^ - 2 │ - --- -/=0*_:m/=/*_:| diff --git a/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast b/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast deleted file mode 100644 index 25b7a45d0244..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast +++ /dev/null @@ -1,182 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@1..2 "(" [] [], - expression: JsArrayExpression { - l_brack_token: L_BRACK@2..3 "[" [] [], - elements: JsArrayElementList [ - JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@3..9 "zAgRvz" [] [], - }, - operator_token: EQ@9..10 "=" [] [], - right: JsArrayExpression { - l_brack_token: L_BRACK@10..11 "[" [] [], - elements: JsArrayElementList [ - JsBogusExpression { - items: [ - EQ@11..12 "=" [] [], - ], - }, - missing separator, - JsParenthesizedExpression { - l_paren_token: L_PAREN@12..13 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..14 "e" [] [], - }, - }, - r_paren_token: missing (required), - }, - missing separator, - JsObjectExpression { - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "V" [] [], - }, - }, - missing separator, - JsBogusMember { - items: [ - L_CURLY@16..17 "{" [] [], - ], - }, - ], - r_curly_token: missing (required), - }, - ], - r_brack_token: missing (required), - }, - }, - ], - r_brack_token: missing (required), - }, - r_paren_token: missing (required), - }, - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: JS_EXPRESSION_STATEMENT@0..17 - 0: JS_PARENTHESIZED_EXPRESSION@0..17 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@1..17 - 0: L_PAREN@1..2 "(" [] [] - 1: JS_ARRAY_EXPRESSION@2..17 - 0: L_BRACK@2..3 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@3..17 - 0: JS_ASSIGNMENT_EXPRESSION@3..17 - 0: JS_IDENTIFIER_ASSIGNMENT@3..9 - 0: IDENT@3..9 "zAgRvz" [] [] - 1: EQ@9..10 "=" [] [] - 2: JS_ARRAY_EXPRESSION@10..17 - 0: L_BRACK@10..11 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@11..17 - 0: JS_BOGUS_EXPRESSION@11..12 - 0: EQ@11..12 "=" [] [] - 1: (empty) - 2: JS_PARENTHESIZED_EXPRESSION@12..14 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@13..14 - 0: JS_REFERENCE_IDENTIFIER@13..14 - 0: IDENT@13..14 "e" [] [] - 2: (empty) - 3: (empty) - 4: JS_OBJECT_EXPRESSION@14..17 - 0: L_CURLY@14..15 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@15..17 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "V" [] [] - 1: (empty) - 2: JS_BOGUS_MEMBER@16..17 - 0: L_CURLY@16..17 "{" [] [] - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 2: (empty) - 1: (empty) - 4: EOF@17..18 "" [Newline("\n")] [] --- -js_rewind_at_eof_token.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a property, an expression, or a method but instead found '='. - - > 1 │ (([zAgRvz=[=(e{V{ - │ ^ - 2 │ - - i Expected a property, an expression, or a method here. - - > 1 │ (([zAgRvz=[=(e{V{ - │ ^ - 2 │ - --- -js_rewind_at_eof_token.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `(` - - > 1 │ (([zAgRvz=[=(e{V{ - │ ^ - 2 │ - - i Remove ( - --- -js_rewind_at_eof_token.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `{` - - > 1 │ (([zAgRvz=[=(e{V{ - │ ^ - 2 │ - - i Remove { - --- -js_rewind_at_eof_token.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `{` - - > 1 │ (([zAgRvz=[=(e{V{ - │ ^ - 2 │ - - i Remove { - --- -js_rewind_at_eof_token.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead the file ends - - 1 │ (([zAgRvz=[=(e{V{ - > 2 │ - │ - - i the file ends here - - 1 │ (([zAgRvz=[=(e{V{ - > 2 │ - │ - --- -(([zAgRvz=[=(e{V{ diff --git a/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.rast b/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.rast deleted file mode 100644 index b40f5f8987b9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.rast +++ /dev/null @@ -1,59 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..2 "1" [] [Whitespace(" ")], - }, - operator_token: SHR@2..21 ">>" [] [Whitespace(" "), Comments("/* a comment */"), Whitespace(" ")], - right: missing (required), - }, - operator_token: R_ANGLE@21..23 ">" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@23..24 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - ], - eof_token: EOF@25..26 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..26 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..25 - 0: JS_EXPRESSION_STATEMENT@0..25 - 0: JS_BINARY_EXPRESSION@0..24 - 0: JS_BINARY_EXPRESSION@0..21 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 - 0: JS_NUMBER_LITERAL@0..2 "1" [] [Whitespace(" ")] - 1: SHR@2..21 ">>" [] [Whitespace(" "), Comments("/* a comment */"), Whitespace(" ")] - 2: (empty) - 1: R_ANGLE@21..23 ">" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@23..24 - 0: JS_NUMBER_LITERAL@23..24 "2" [] [] - 1: SEMICOLON@24..25 ";" [] [] - 4: EOF@25..26 "" [Newline("\n")] [] --- -js_right_shift_comments.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '>'. - - > 1 │ 1 >> /* a comment */ > 2; - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ 1 >> /* a comment */ > 2; - │ ^ - 2 │ - --- -1 >> /* a comment */ > 2; diff --git a/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.rast b/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.rast deleted file mode 100644 index 864f973a452e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.rast +++ /dev/null @@ -1,109 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@0..4 "let" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - JsBogus { - items: [ - COLON@5..7 ":" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@7..13 "string" [] [], - }, - ], - }, - ], - }, - COMMA@13..15 "," [] [Whitespace(" ")], - JsBogus { - items: [ - JsIdentifierBinding { - name_token: IDENT@15..16 "b" [] [], - }, - JsBogus { - items: [ - BANG@16..17 "!" [] [], - TsTypeAnnotation { - colon_token: COLON@17..19 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@19..25 "number" [] [], - }, - }, - ], - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@25..26 ";" [] [], - ], - }, - ], - eof_token: EOF@26..27 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..27 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..26 - 0: JS_BOGUS_STATEMENT@0..26 - 0: JS_BOGUS@0..25 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_BOGUS@4..25 - 0: JS_BOGUS@4..13 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: JS_BOGUS@5..13 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@7..13 - 0: STRING_KW@7..13 "string" [] [] - 1: COMMA@13..15 "," [] [Whitespace(" ")] - 2: JS_BOGUS@15..25 - 0: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "b" [] [] - 1: JS_BOGUS@16..25 - 0: BANG@16..17 "!" [] [] - 1: TS_TYPE_ANNOTATION@17..25 - 0: COLON@17..19 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@19..25 - 0: NUMBER_KW@19..25 "number" [] [] - 1: SEMICOLON@25..26 ";" [] [] - 4: EOF@26..27 "" [Newline("\n")] [] --- -js_type_variable_annotation.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - > 1 │ let a: string, b!: number; - │ ^^^^^^^^ - 2 │ - - i TypeScript only syntax - --- -js_type_variable_annotation.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × definite assertion assignments are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - > 1 │ let a: string, b!: number; - │ ^^^^^^^^^ - 2 │ - - i TypeScript only syntax - --- -let a: string, b!: number; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast b/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast deleted file mode 100644 index deec3939eab2..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast +++ /dev/null @@ -1,94 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [ - JsxExpressionChild { - l_curly_token: L_CURLY@6..8 "{" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@8..10 "4" [] [Whitespace(" ")], - }, - operator_token: PLUS@10..12 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@12..13 "3" [] [], - }, - }, - r_curly_token: missing (required), - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@13..14 "<" [] [], - slash_token: SLASH@14..15 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@15..19 "test" [] [], - }, - r_angle_token: R_ANGLE@19..20 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_EXPRESSION_STATEMENT@0..20 - 0: JSX_TAG_EXPRESSION@0..20 - 0: JSX_ELEMENT@0..20 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..13 - 0: JSX_EXPRESSION_CHILD@6..13 - 0: L_CURLY@6..8 "{" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@8..13 - 0: JS_NUMBER_LITERAL_EXPRESSION@8..10 - 0: JS_NUMBER_LITERAL@8..10 "4" [] [Whitespace(" ")] - 1: PLUS@10..12 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@12..13 - 0: JS_NUMBER_LITERAL@12..13 "3" [] [] - 2: (empty) - 2: JSX_CLOSING_ELEMENT@13..20 - 0: L_ANGLE@13..14 "<" [] [] - 1: SLASH@14..15 "/" [] [] - 2: JSX_NAME@15..19 - 0: JSX_IDENT@15..19 "test" [] [] - 3: R_ANGLE@19..20 ">" [] [] - 1: (empty) - 4: EOF@20..21 "" [Newline("\n")] [] --- -jsx_child_expression_missing_r_curly.jsx:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead found `<` - - > 1 │ { 4 + 3 - │ ^ - 2 │ - - i Remove < - --- -{ 4 + 3 diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast b/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast deleted file mode 100644 index 0484e08d1579..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast +++ /dev/null @@ -1,110 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@6..9 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@11..13 "5" [] [Whitespace(" ")], - }, - operator_token: PLUS@13..15 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@15..16 "3" [] [], - }, - }, - r_curly_token: missing (required), - }, - JsxText { - value_token: JSX_TEXT_LITERAL@16..29 "some text\n" [Newline("\n"), Whitespace(" ")] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@29..30 "<" [] [], - slash_token: SLASH@30..31 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@31..35 "test" [] [], - }, - r_angle_token: R_ANGLE@35..36 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@36..37 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..37 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..36 - 0: JS_EXPRESSION_STATEMENT@0..36 - 0: JSX_TAG_EXPRESSION@0..36 - 0: JSX_ELEMENT@0..36 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..29 - 0: JSX_TEXT@6..9 - 0: JSX_TEXT_LITERAL@6..9 "\n " [] [] - 1: JSX_EXPRESSION_CHILD@9..16 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@11..16 - 0: JS_NUMBER_LITERAL_EXPRESSION@11..13 - 0: JS_NUMBER_LITERAL@11..13 "5" [] [Whitespace(" ")] - 1: PLUS@13..15 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@15..16 - 0: JS_NUMBER_LITERAL@15..16 "3" [] [] - 2: (empty) - 2: JSX_TEXT@16..29 - 0: JSX_TEXT_LITERAL@16..29 "some text\n" [Newline("\n"), Whitespace(" ")] [] - 2: JSX_CLOSING_ELEMENT@29..36 - 0: L_ANGLE@29..30 "<" [] [] - 1: SLASH@30..31 "/" [] [] - 2: JSX_NAME@31..35 - 0: JSX_IDENT@31..35 "test" [] [] - 3: R_ANGLE@35..36 ">" [] [] - 1: (empty) - 4: EOF@36..37 "" [Newline("\n")] [] --- -jsx_children_expression_missing_r_curly.jsx:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead found `some` - - 1 │ - 2 │ { 5 + 3 - > 3 │ some text - │ ^^^^ - 4 │ - 5 │ - - i Remove some - --- - - { 5 + 3 - some text - diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast b/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast deleted file mode 100644 index 76c7c7c3dd60..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast +++ /dev/null @@ -1,231 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..4 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@4..5 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@5..8 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@8..9 "{" [] [], - expression: JsBogusExpression { - items: [ - IMPORT_KW@9..15 "import" [] [], - DOT@15..16 "." [] [], - META@16..20 "meta" [] [], - ], - }, - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@21..24 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@24..25 "{" [] [], - expression: JsBogusExpression { - items: [ - JsDecoratorList [], - CLASS_KW@25..31 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@31..32 "A" [] [], - }, - L_CURLY@32..33 "{" [] [], - JsClassMemberList [], - R_CURLY@33..34 "}" [] [], - ], - }, - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@35..38 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@38..39 "{" [] [], - expression: JsCallExpression { - callee: JsBogusExpression { - items: [ - SUPER_KW@39..44 "super" [] [], - ], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@44..45 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@45..46 ")" [] [], - }, - }, - r_curly_token: R_CURLY@46..47 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@47..50 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@50..51 "{" [] [], - expression: JsBogusExpression { - items: [ - NEW_KW@51..54 "new" [] [], - DOT@54..55 "." [] [], - TARGET@55..61 "target" [] [], - ], - }, - r_curly_token: R_CURLY@61..62 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@62..63 "\n" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@63..64 "<" [] [], - slash_token: SLASH@64..65 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@65..68 "div" [] [], - }, - r_angle_token: R_ANGLE@68..69 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@69..70 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..70 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..69 - 0: JS_EXPRESSION_STATEMENT@0..69 - 0: JSX_TAG_EXPRESSION@0..69 - 0: JSX_ELEMENT@0..69 - 0: JSX_OPENING_ELEMENT@0..5 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..4 - 0: JSX_IDENT@1..4 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@4..4 - 4: R_ANGLE@4..5 ">" [] [] - 1: JSX_CHILD_LIST@5..63 - 0: JSX_TEXT@5..8 - 0: JSX_TEXT_LITERAL@5..8 "\n " [] [] - 1: JSX_EXPRESSION_CHILD@8..21 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_BOGUS_EXPRESSION@9..20 - 0: IMPORT_KW@9..15 "import" [] [] - 1: DOT@15..16 "." [] [] - 2: META@16..20 "meta" [] [] - 2: R_CURLY@20..21 "}" [] [] - 2: JSX_TEXT@21..24 - 0: JSX_TEXT_LITERAL@21..24 "\n " [] [] - 3: JSX_EXPRESSION_CHILD@24..35 - 0: L_CURLY@24..25 "{" [] [] - 1: JS_BOGUS_EXPRESSION@25..34 - 0: JS_DECORATOR_LIST@25..25 - 1: CLASS_KW@25..31 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@31..32 - 0: IDENT@31..32 "A" [] [] - 3: L_CURLY@32..33 "{" [] [] - 4: JS_CLASS_MEMBER_LIST@33..33 - 5: R_CURLY@33..34 "}" [] [] - 2: R_CURLY@34..35 "}" [] [] - 4: JSX_TEXT@35..38 - 0: JSX_TEXT_LITERAL@35..38 "\n " [] [] - 5: JSX_EXPRESSION_CHILD@38..47 - 0: L_CURLY@38..39 "{" [] [] - 1: JS_CALL_EXPRESSION@39..46 - 0: JS_BOGUS_EXPRESSION@39..44 - 0: SUPER_KW@39..44 "super" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@44..46 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@45..45 - 2: R_PAREN@45..46 ")" [] [] - 2: R_CURLY@46..47 "}" [] [] - 6: JSX_TEXT@47..50 - 0: JSX_TEXT_LITERAL@47..50 "\n " [] [] - 7: JSX_EXPRESSION_CHILD@50..62 - 0: L_CURLY@50..51 "{" [] [] - 1: JS_BOGUS_EXPRESSION@51..61 - 0: NEW_KW@51..54 "new" [] [] - 1: DOT@54..55 "." [] [] - 2: TARGET@55..61 "target" [] [] - 2: R_CURLY@61..62 "}" [] [] - 8: JSX_TEXT@62..63 - 0: JSX_TEXT_LITERAL@62..63 "\n" [] [] - 2: JSX_CLOSING_ELEMENT@63..69 - 0: L_ANGLE@63..64 "<" [] [] - 1: SLASH@64..65 "/" [] [] - 2: JSX_NAME@65..68 - 0: JSX_IDENT@65..68 "div" [] [] - 3: R_ANGLE@68..69 ">" [] [] - 1: (empty) - 4: EOF@69..70 "" [Newline("\n")] [] --- -jsx_children_expressions_not_accepted.jsx:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × This expression is not valid as a JSX expression. - - 1 │
- > 2 │ {import.meta} - │ ^^^^^^^^^^^ - 3 │ {class A{}} - 4 │ {super()} - --- -jsx_children_expressions_not_accepted.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × This expression is not valid as a JSX expression. - - 1 │
- 2 │ {import.meta} - > 3 │ {class A{}} - │ ^^^^^^^^^ - 4 │ {super()} - 5 │ {new.target} - --- -jsx_children_expressions_not_accepted.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `super` is only valid inside of a class constructor of a subclass. - - 2 │ {import.meta} - 3 │ {class A{}} - > 4 │ {super()} - │ ^^^^^ - 5 │ {new.target} - 6 │
- --- -jsx_children_expressions_not_accepted.jsx:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × This expression is not valid as a JSX expression. - - 3 │ {class A{}} - 4 │ {super()} - > 5 │ {new.target} - │ ^^^^^^^^^^ - 6 │
- 7 │ - --- -
- {import.meta} - {class A{}} - {super()} - {new.target} -
diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast b/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast deleted file mode 100644 index 11002745e6d9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast +++ /dev/null @@ -1,390 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@6..7 "<" [] [], - slash_token: SLASH@7..8 "/" [] [], - name: missing (required), - r_angle_token: R_ANGLE@8..9 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@10..12 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@12..16 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@16..17 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@17..18 "<" [] [], - slash_token: SLASH@18..19 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@19..23 "text" [] [], - }, - r_angle_token: R_ANGLE@23..24 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@25..27 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@27..31 "some" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@31..32 ">" [] [], - }, - children: JsxChildList [ - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@32..33 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@33..39 "nested" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@39..40 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@40..41 "<" [] [], - slash_token: SLASH@41..42 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@42..46 "some" [] [], - }, - r_angle_token: R_ANGLE@46..47 ">" [] [], - }, - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@47..48 "<" [] [], - slash_token: SLASH@48..49 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@49..55 "nested" [] [], - }, - r_angle_token: R_ANGLE@55..56 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@56..57 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - JsxOpeningFragment { - l_angle_token: L_ANGLE@57..59 "<" [Newline("\n")] [], - r_angle_token: R_ANGLE@59..60 ">" [] [], - }, - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_ANGLE@60..61 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JS_NUMBER_LITERAL@61..62 "5" [] [], - ], - }, - ], - }, - R_ANGLE@62..63 ">" [] [], - ], - }, - JsxChildList [], - JsxClosingElement { - l_angle_token: L_ANGLE@63..64 "<" [] [], - slash_token: SLASH@64..65 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@65..69 "test" [] [], - }, - r_angle_token: R_ANGLE@69..70 ">" [] [], - }, - ], - }, - ], - }, - JsxClosingFragment { - l_angle_token: L_ANGLE@70..71 "<" [] [], - slash_token: SLASH@71..72 "/" [] [], - r_angle_token: R_ANGLE@72..73 ">" [] [], - }, - ], - }, - ], - }, - semicolon_token: SEMICOLON@73..74 ";" [] [], - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..74 - 0: JS_EXPRESSION_STATEMENT@0..10 - 0: JSX_TAG_EXPRESSION@0..9 - 0: JSX_ELEMENT@0..9 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..6 - 2: JSX_CLOSING_ELEMENT@6..9 - 0: L_ANGLE@6..7 "<" [] [] - 1: SLASH@7..8 "/" [] [] - 2: (empty) - 3: R_ANGLE@8..9 ">" [] [] - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@10..25 - 0: JSX_TAG_EXPRESSION@10..24 - 0: JSX_ELEMENT@10..24 - 0: JSX_OPENING_ELEMENT@10..17 - 0: L_ANGLE@10..12 "<" [Newline("\n")] [] - 1: JSX_NAME@12..16 - 0: JSX_IDENT@12..16 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@16..16 - 4: R_ANGLE@16..17 ">" [] [] - 1: JSX_CHILD_LIST@17..17 - 2: JSX_CLOSING_ELEMENT@17..24 - 0: L_ANGLE@17..18 "<" [] [] - 1: SLASH@18..19 "/" [] [] - 2: JSX_NAME@19..23 - 0: JSX_IDENT@19..23 "text" [] [] - 3: R_ANGLE@23..24 ">" [] [] - 1: SEMICOLON@24..25 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@25..57 - 0: JSX_TAG_EXPRESSION@25..56 - 0: JSX_ELEMENT@25..56 - 0: JSX_OPENING_ELEMENT@25..32 - 0: L_ANGLE@25..27 "<" [Newline("\n")] [] - 1: JSX_NAME@27..31 - 0: JSX_IDENT@27..31 "some" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@31..31 - 4: R_ANGLE@31..32 ">" [] [] - 1: JSX_CHILD_LIST@32..47 - 0: JSX_ELEMENT@32..47 - 0: JSX_OPENING_ELEMENT@32..40 - 0: L_ANGLE@32..33 "<" [] [] - 1: JSX_NAME@33..39 - 0: JSX_IDENT@33..39 "nested" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@39..39 - 4: R_ANGLE@39..40 ">" [] [] - 1: JSX_CHILD_LIST@40..40 - 2: JSX_CLOSING_ELEMENT@40..47 - 0: L_ANGLE@40..41 "<" [] [] - 1: SLASH@41..42 "/" [] [] - 2: JSX_NAME@42..46 - 0: JSX_IDENT@42..46 "some" [] [] - 3: R_ANGLE@46..47 ">" [] [] - 2: JSX_CLOSING_ELEMENT@47..56 - 0: L_ANGLE@47..48 "<" [] [] - 1: SLASH@48..49 "/" [] [] - 2: JSX_NAME@49..55 - 0: JSX_IDENT@49..55 "nested" [] [] - 3: R_ANGLE@55..56 ">" [] [] - 1: SEMICOLON@56..57 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@57..74 - 0: JS_BOGUS_EXPRESSION@57..73 - 0: JS_BOGUS@57..73 - 0: JSX_OPENING_FRAGMENT@57..60 - 0: L_ANGLE@57..59 "<" [Newline("\n")] [] - 1: R_ANGLE@59..60 ">" [] [] - 1: JS_BOGUS@60..70 - 0: JS_BOGUS@60..70 - 0: JS_BOGUS@60..63 - 0: L_ANGLE@60..61 "<" [] [] - 1: JS_BOGUS@61..62 - 0: JS_BOGUS@61..62 - 0: JS_NUMBER_LITERAL@61..62 "5" [] [] - 2: R_ANGLE@62..63 ">" [] [] - 1: JSX_CHILD_LIST@63..63 - 2: JSX_CLOSING_ELEMENT@63..70 - 0: L_ANGLE@63..64 "<" [] [] - 1: SLASH@64..65 "/" [] [] - 2: JSX_NAME@65..69 - 0: JSX_IDENT@65..69 "test" [] [] - 3: R_ANGLE@69..70 ">" [] [] - 2: JSX_CLOSING_FRAGMENT@70..73 - 0: L_ANGLE@70..71 "<" [] [] - 1: SLASH@71..72 "/" [] [] - 2: R_ANGLE@72..73 ">" [] [] - 1: SEMICOLON@73..74 ";" [] [] - 4: EOF@74..75 "" [Newline("\n")] [] --- -jsx_closing_element_mismatch.jsx:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected corresponding JSX closing tag for 'test'. - - > 1 │ ; - │ ^^^^^^ - 2 │ ; - 3 │ ; - - i Opening tag - - > 1 │ ; - │ ^^^^^^ - 2 │ ; - 3 │ ; - - i closing tag - - > 1 │ ; - │ ^^^ - 2 │ ; - 3 │ ; - --- -jsx_closing_element_mismatch.jsx:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected corresponding JSX closing tag for 'test'. - - 1 │ ; - > 2 │ ; - │ ^^^^^^ - 3 │ ; - 4 │ <><5>; - - i Opening tag - - 1 │ ; - > 2 │ ; - │ ^^^^^^ - 3 │ ; - 4 │ <><5>; - - i closing tag - - 1 │ ; - > 2 │ ; - │ ^^^^^^^ - 3 │ ; - 4 │ <><5>; - --- -jsx_closing_element_mismatch.jsx:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected corresponding JSX closing tag for 'nested'. - - 1 │ ; - 2 │ ; - > 3 │ ; - │ ^^^^^^^^ - 4 │ <><5>; - 5 │ - - i Opening tag - - 1 │ ; - 2 │ ; - > 3 │ ; - │ ^^^^^^^^ - 4 │ <><5>; - 5 │ - - i closing tag - - 1 │ ; - 2 │ ; - > 3 │ ; - │ ^^^^^^^ - 4 │ <><5>; - 5 │ - --- -jsx_closing_element_mismatch.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected corresponding JSX closing tag for 'some'. - - 1 │ ; - 2 │ ; - > 3 │ ; - │ ^^^^^^ - 4 │ <><5>; - 5 │ - - i Opening tag - - 1 │ ; - 2 │ ; - > 3 │ ; - │ ^^^^^^ - 4 │ <><5>; - 5 │ - - i closing tag - - 1 │ ; - 2 │ ; - > 3 │ ; - │ ^^^^^^^^^ - 4 │ <><5>; - 5 │ - --- -jsx_closing_element_mismatch.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found '5'. - - 2 │ ; - 3 │ ; - > 4 │ <><5>; - │ ^ - 5 │ - - i Expected an identifier here. - - 2 │ ; - 3 │ ; - > 4 │ <><5>; - │ ^ - 5 │ - --- -; -; -; -<><5>; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast b/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast deleted file mode 100644 index 1a18ef506e7d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast +++ /dev/null @@ -1,104 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@0..1 "<" [] [], - r_angle_token: R_ANGLE@1..2 ">" [] [], - }, - children: JsxChildList [ - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@2..3 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@3..7 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@7..8 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@8..12 "abcd" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@12..13 "<" [] [], - slash_token: SLASH@13..14 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@14..19 "test" [] [Whitespace(" ")], - }, - r_angle_token: missing (required), - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@19..44 "more content follows here" [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@44..45 "<" [] [], - slash_token: SLASH@45..46 "/" [] [], - r_angle_token: R_ANGLE@46..47 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_EXPRESSION_STATEMENT@0..47 - 0: JSX_TAG_EXPRESSION@0..47 - 0: JSX_FRAGMENT@0..47 - 0: JSX_OPENING_FRAGMENT@0..2 - 0: L_ANGLE@0..1 "<" [] [] - 1: R_ANGLE@1..2 ">" [] [] - 1: JSX_CHILD_LIST@2..44 - 0: JSX_ELEMENT@2..19 - 0: JSX_OPENING_ELEMENT@2..8 - 0: L_ANGLE@2..3 "<" [] [] - 1: JSX_NAME@3..7 - 0: JSX_IDENT@3..7 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@7..7 - 4: R_ANGLE@7..8 ">" [] [] - 1: JSX_CHILD_LIST@8..12 - 0: JSX_TEXT@8..12 - 0: JSX_TEXT_LITERAL@8..12 "abcd" [] [] - 2: JSX_CLOSING_ELEMENT@12..19 - 0: L_ANGLE@12..13 "<" [] [] - 1: SLASH@13..14 "/" [] [] - 2: JSX_NAME@14..19 - 0: JSX_IDENT@14..19 "test" [] [Whitespace(" ")] - 3: (empty) - 1: JSX_TEXT@19..44 - 0: JSX_TEXT_LITERAL@19..44 "more content follows here" [] [] - 2: JSX_CLOSING_FRAGMENT@44..47 - 0: L_ANGLE@44..45 "<" [] [] - 1: SLASH@45..46 "/" [] [] - 2: R_ANGLE@46..47 ">" [] [] - 1: (empty) - 4: EOF@47..48 "" [Newline("\n")] [] --- -jsx_closing_missing_r_angle.jsx:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `>` but instead found `more` - - > 1 │ <>abcd - │ ^^^^ - 2 │ - - i Remove more - --- -<>abcd diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast b/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast deleted file mode 100644 index 442be5282709..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast +++ /dev/null @@ -1,83 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@5..14 "className" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@14..15 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@15..16 "{" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..21 "asdf" [] [Whitespace(" ")], - }, - }, - r_curly_token: R_CURLY@21..27 "}" [Skipped("asdf")] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@27..28 "/" [] [], - r_angle_token: R_ANGLE@28..29 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@29..30 ";" [] [], - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_EXPRESSION_STATEMENT@0..30 - 0: JSX_TAG_EXPRESSION@0..29 - 0: JSX_SELF_CLOSING_ELEMENT@0..29 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..27 - 0: JSX_ATTRIBUTE@5..27 - 0: JSX_NAME@5..14 - 0: JSX_IDENT@5..14 "className" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@14..27 - 0: EQ@14..15 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@15..27 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_IDENTIFIER_EXPRESSION@16..21 - 0: JS_REFERENCE_IDENTIFIER@16..21 - 0: IDENT@16..21 "asdf" [] [Whitespace(" ")] - 2: R_CURLY@21..27 "}" [Skipped("asdf")] [Whitespace(" ")] - 4: SLASH@27..28 "/" [] [] - 5: R_ANGLE@28..29 ">" [] [] - 1: SEMICOLON@29..30 ";" [] [] - 4: EOF@30..31 "" [Newline("\n")] [] --- -jsx_element_attribute_expression_error.jsx:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead found `asdf` - - > 1 │
; - │ ^^^^ - 2 │ - - i Remove asdf - --- -
; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast b/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast deleted file mode 100644 index be73eaf7ffe0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast +++ /dev/null @@ -1,138 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@26..27 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@27..31 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@31..45 "string_literal" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - value: missing (required), - }, - }, - ], - r_angle_token: R_ANGLE@47..48 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@48..49 "<" [] [], - slash_token: SLASH@49..50 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@50..53 "div" [] [], - }, - r_angle_token: R_ANGLE@53..54 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@54..55 ";" [] [], - }, - ], - r_curly_token: R_CURLY@55..57 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@57..58 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..58 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..57 - 0: JS_FUNCTION_DECLARATION@0..57 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@13..57 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..55 - 0: JS_RETURN_STATEMENT@14..55 - 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JSX_TAG_EXPRESSION@26..54 - 0: JSX_ELEMENT@26..54 - 0: JSX_OPENING_ELEMENT@26..48 - 0: L_ANGLE@26..27 "<" [] [] - 1: JSX_NAME@27..31 - 0: JSX_IDENT@27..31 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@31..47 - 0: JSX_ATTRIBUTE@31..47 - 0: JSX_NAME@31..45 - 0: JSX_IDENT@31..45 "string_literal" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@45..47 - 0: EQ@45..47 "=" [] [Whitespace(" ")] - 1: (empty) - 4: R_ANGLE@47..48 ">" [] [] - 1: JSX_CHILD_LIST@48..48 - 2: JSX_CLOSING_ELEMENT@48..54 - 0: L_ANGLE@48..49 "<" [] [] - 1: SLASH@49..50 "/" [] [] - 2: JSX_NAME@50..53 - 0: JSX_IDENT@50..53 "div" [] [] - 3: R_ANGLE@53..54 ">" [] [] - 2: SEMICOLON@54..55 ";" [] [] - 3: R_CURLY@55..57 "}" [Newline("\n")] [] - 4: EOF@57..58 "" [Newline("\n")] [] --- -jsx_element_attribute_missing_value.jsx:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a JSX attribute value but instead found '>'. - - 1 │ function f() { - > 2 │ return
; - │ ^ - 3 │ } - 4 │ - - i Expected a JSX attribute value here. - - 1 │ function f() { - > 2 │ return
; - │ ^ - 3 │ } - 4 │ - --- -function f() { - return
; -} diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast b/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast deleted file mode 100644 index 66c4014d3083..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast +++ /dev/null @@ -1,104 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..4 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@4..5 ">" [] [], - }, - children: JsxChildList [ - JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@5..6 "<" [] [], - r_angle_token: R_ANGLE@6..7 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@7..11 "test" [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@11..12 "<" [] [], - slash_token: SLASH@12..14 "/" [] [Whitespace(" ")], - r_angle_token: missing (required), - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@14..28 "5 more content" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@28..29 "<" [] [], - slash_token: SLASH@29..30 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@30..33 "div" [] [], - }, - r_angle_token: R_ANGLE@33..34 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_EXPRESSION_STATEMENT@0..34 - 0: JSX_TAG_EXPRESSION@0..34 - 0: JSX_ELEMENT@0..34 - 0: JSX_OPENING_ELEMENT@0..5 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..4 - 0: JSX_IDENT@1..4 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@4..4 - 4: R_ANGLE@4..5 ">" [] [] - 1: JSX_CHILD_LIST@5..28 - 0: JSX_FRAGMENT@5..14 - 0: JSX_OPENING_FRAGMENT@5..7 - 0: L_ANGLE@5..6 "<" [] [] - 1: R_ANGLE@6..7 ">" [] [] - 1: JSX_CHILD_LIST@7..11 - 0: JSX_TEXT@7..11 - 0: JSX_TEXT_LITERAL@7..11 "test" [] [] - 2: JSX_CLOSING_FRAGMENT@11..14 - 0: L_ANGLE@11..12 "<" [] [] - 1: SLASH@12..14 "/" [] [Whitespace(" ")] - 2: (empty) - 1: JSX_TEXT@14..28 - 0: JSX_TEXT_LITERAL@14..28 "5 more content" [] [] - 2: JSX_CLOSING_ELEMENT@28..34 - 0: L_ANGLE@28..29 "<" [] [] - 1: SLASH@29..30 "/" [] [] - 2: JSX_NAME@30..33 - 0: JSX_IDENT@30..33 "div" [] [] - 3: R_ANGLE@33..34 ">" [] [] - 1: (empty) - 4: EOF@34..35 "" [Newline("\n")] [] --- -jsx_fragment_closing_missing_r_angle.jsx:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `>` but instead found `5` - - > 1 │
<>test - │ ^ - 2 │ - - i Remove 5 - --- -
<>test diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.rast b/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.rast deleted file mode 100644 index a0c02bd27336..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.rast +++ /dev/null @@ -1,136 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..2 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@2..3 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@3..10 " test >" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@10..11 "<" [] [], - slash_token: SLASH@11..12 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@12..13 "a" [] [], - }, - r_angle_token: R_ANGLE@13..14 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@15..17 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@17..18 "b" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@18..19 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@19..29 " invalid }" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@29..30 "<" [] [], - slash_token: SLASH@30..31 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@31..32 "b" [] [], - }, - r_angle_token: R_ANGLE@32..33 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JSX_TAG_EXPRESSION@0..14 - 0: JSX_ELEMENT@0..14 - 0: JSX_OPENING_ELEMENT@0..3 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..2 - 0: JSX_IDENT@1..2 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@2..2 - 4: R_ANGLE@2..3 ">" [] [] - 1: JSX_CHILD_LIST@3..10 - 0: JSX_TEXT@3..10 - 0: JSX_TEXT_LITERAL@3..10 " test >" [] [] - 2: JSX_CLOSING_ELEMENT@10..14 - 0: L_ANGLE@10..11 "<" [] [] - 1: SLASH@11..12 "/" [] [] - 2: JSX_NAME@12..13 - 0: JSX_IDENT@12..13 "a" [] [] - 3: R_ANGLE@13..14 ">" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@15..34 - 0: JSX_TAG_EXPRESSION@15..33 - 0: JSX_ELEMENT@15..33 - 0: JSX_OPENING_ELEMENT@15..19 - 0: L_ANGLE@15..17 "<" [Newline("\n")] [] - 1: JSX_NAME@17..18 - 0: JSX_IDENT@17..18 "b" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@18..18 - 4: R_ANGLE@18..19 ">" [] [] - 1: JSX_CHILD_LIST@19..29 - 0: JSX_TEXT@19..29 - 0: JSX_TEXT_LITERAL@19..29 " invalid }" [] [] - 2: JSX_CLOSING_ELEMENT@29..33 - 0: L_ANGLE@29..30 "<" [] [] - 1: SLASH@30..31 "/" [] [] - 2: JSX_NAME@31..32 - 0: JSX_IDENT@31..32 "b" [] [] - 3: R_ANGLE@32..33 ">" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] --- -jsx_invalid_text.jsx:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Unexpected token. Did you mean `{'>'}` or `>`? - - > 1 │ test >; - │ ^ - 2 │ invalid }; - 3 │ - --- -jsx_invalid_text.jsx:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Unexpected token. Did you mean `{'}'}` or `}`? - - 1 │ test >; - > 2 │ invalid }; - │ ^ - 3 │ - --- - test >; - invalid }; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast b/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast deleted file mode 100644 index 4db2bab525a0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast +++ /dev/null @@ -1,186 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - JsxOpeningFragment { - l_angle_token: L_ANGLE@0..1 "<" [] [], - r_angle_token: R_ANGLE@1..2 ">" [] [], - }, - JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@2..6 "test" [] [], - }, - ], - JsBogus { - items: [ - L_ANGLE@6..7 "<" [] [], - SLASH@7..8 "/" [] [], - JsxName { - value_token: JSX_IDENT@8..12 "test" [] [], - }, - R_ANGLE@12..13 ">" [] [], - ], - }, - ], - }, - ], - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@14..16 "<" [Newline("\n")] [], - r_angle_token: R_ANGLE@16..17 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@17..21 "test" [] [], - }, - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@21..22 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@22..27 "inner" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@27..28 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@28..38 " some text" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@38..39 "<" [] [], - slash_token: SLASH@39..40 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@40..45 "inner" [] [], - }, - r_angle_token: R_ANGLE@45..46 ">" [] [], - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@46..48 ";\n" [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: missing (required), - slash_token: missing (required), - r_angle_token: missing (required), - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@48..48 "" [] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..48 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_BOGUS_EXPRESSION@0..13 - 0: JS_BOGUS@0..13 - 0: JSX_OPENING_FRAGMENT@0..2 - 0: L_ANGLE@0..1 "<" [] [] - 1: R_ANGLE@1..2 ">" [] [] - 1: JSX_CHILD_LIST@2..6 - 0: JSX_TEXT@2..6 - 0: JSX_TEXT_LITERAL@2..6 "test" [] [] - 2: JS_BOGUS@6..13 - 0: L_ANGLE@6..7 "<" [] [] - 1: SLASH@7..8 "/" [] [] - 2: JSX_NAME@8..12 - 0: JSX_IDENT@8..12 "test" [] [] - 3: R_ANGLE@12..13 ">" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..48 - 0: JSX_TAG_EXPRESSION@14..48 - 0: JSX_FRAGMENT@14..48 - 0: JSX_OPENING_FRAGMENT@14..17 - 0: L_ANGLE@14..16 "<" [Newline("\n")] [] - 1: R_ANGLE@16..17 ">" [] [] - 1: JSX_CHILD_LIST@17..48 - 0: JSX_TEXT@17..21 - 0: JSX_TEXT_LITERAL@17..21 "test" [] [] - 1: JSX_ELEMENT@21..46 - 0: JSX_OPENING_ELEMENT@21..28 - 0: L_ANGLE@21..22 "<" [] [] - 1: JSX_NAME@22..27 - 0: JSX_IDENT@22..27 "inner" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@27..27 - 4: R_ANGLE@27..28 ">" [] [] - 1: JSX_CHILD_LIST@28..38 - 0: JSX_TEXT@28..38 - 0: JSX_TEXT_LITERAL@28..38 " some text" [] [] - 2: JSX_CLOSING_ELEMENT@38..46 - 0: L_ANGLE@38..39 "<" [] [] - 1: SLASH@39..40 "/" [] [] - 2: JSX_NAME@40..45 - 0: JSX_IDENT@40..45 "inner" [] [] - 3: R_ANGLE@45..46 ">" [] [] - 2: JSX_TEXT@46..48 - 0: JSX_TEXT_LITERAL@46..48 ";\n" [] [] - 2: JSX_CLOSING_FRAGMENT@48..48 - 0: (empty) - 1: (empty) - 2: (empty) - 1: (empty) - 4: EOF@48..48 "" [] [] --- -jsx_missing_closing_fragment.jsx:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × JSX fragment has no corresponding closing tag. - - > 1 │ <>test; - │ ^^ - 2 │ <>test some text; - 3 │ - - i Opening fragment - - > 1 │ <>test; - │ ^^ - 2 │ <>test some text; - 3 │ - - i Closing tag - - > 1 │ <>test; - │ ^^^^ - 2 │ <>test some text; - 3 │ - --- -jsx_missing_closing_fragment.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `<` but instead the file ends - - 1 │ <>test; - 2 │ <>test some text; - > 3 │ - │ - - i the file ends here - - 1 │ <>test; - 2 │ <>test some text; - > 3 │ - │ - --- -<>test; -<>test some text; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast b/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast deleted file mode 100644 index aed5f065fccf..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast +++ /dev/null @@ -1,198 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@1..10 "namespace" [] [], - }, - colon_token: COLON@10..11 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@11..12 "a" [] [], - }, - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@12..13 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@13..14 "<" [] [], - slash_token: SLASH@14..15 "/" [] [], - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@15..24 "namespace" [] [], - }, - colon_token: COLON@24..25 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@25..26 "a" [] [], - }, - }, - r_angle_token: R_ANGLE@26..27 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_ANGLE@28..30 "<" [Newline("\n")] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsxName { - value_token: JSX_IDENT@30..39 "namespace" [] [], - }, - COLON@39..40 ":" [] [], - JsxName { - value_token: JSX_IDENT@40..41 "a" [] [], - }, - ], - }, - DOT@41..42 "." [] [], - JsName { - value_token: IDENT@42..43 "b" [] [], - }, - ], - }, - JsxAttributeList [], - R_ANGLE@43..44 ">" [] [], - ], - }, - JsxChildList [], - JsBogus { - items: [ - L_ANGLE@44..45 "<" [] [], - SLASH@45..46 "/" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsxName { - value_token: JSX_IDENT@46..55 "namespace" [] [], - }, - COLON@55..56 ":" [] [], - JsxName { - value_token: JSX_IDENT@56..57 "a" [] [], - }, - ], - }, - DOT@57..58 "." [] [], - JsName { - value_token: IDENT@58..59 "b" [] [], - }, - ], - }, - R_ANGLE@59..60 ">" [] [], - ], - }, - ], - }, - ], - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - ], - eof_token: EOF@61..62 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..62 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..61 - 0: JS_EXPRESSION_STATEMENT@0..28 - 0: JSX_TAG_EXPRESSION@0..27 - 0: JSX_ELEMENT@0..27 - 0: JSX_OPENING_ELEMENT@0..13 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAMESPACE_NAME@1..12 - 0: JSX_NAME@1..10 - 0: JSX_IDENT@1..10 "namespace" [] [] - 1: COLON@10..11 ":" [] [] - 2: JSX_NAME@11..12 - 0: JSX_IDENT@11..12 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@12..12 - 4: R_ANGLE@12..13 ">" [] [] - 1: JSX_CHILD_LIST@13..13 - 2: JSX_CLOSING_ELEMENT@13..27 - 0: L_ANGLE@13..14 "<" [] [] - 1: SLASH@14..15 "/" [] [] - 2: JSX_NAMESPACE_NAME@15..26 - 0: JSX_NAME@15..24 - 0: JSX_IDENT@15..24 "namespace" [] [] - 1: COLON@24..25 ":" [] [] - 2: JSX_NAME@25..26 - 0: JSX_IDENT@25..26 "a" [] [] - 3: R_ANGLE@26..27 ">" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@28..61 - 0: JS_BOGUS_EXPRESSION@28..60 - 0: JS_BOGUS@28..60 - 0: JS_BOGUS@28..44 - 0: L_ANGLE@28..30 "<" [Newline("\n")] [] - 1: JS_BOGUS@30..43 - 0: JS_BOGUS@30..41 - 0: JSX_NAME@30..39 - 0: JSX_IDENT@30..39 "namespace" [] [] - 1: COLON@39..40 ":" [] [] - 2: JSX_NAME@40..41 - 0: JSX_IDENT@40..41 "a" [] [] - 1: DOT@41..42 "." [] [] - 2: JS_NAME@42..43 - 0: IDENT@42..43 "b" [] [] - 2: JSX_ATTRIBUTE_LIST@43..43 - 3: R_ANGLE@43..44 ">" [] [] - 1: JSX_CHILD_LIST@44..44 - 2: JS_BOGUS@44..60 - 0: L_ANGLE@44..45 "<" [] [] - 1: SLASH@45..46 "/" [] [] - 2: JS_BOGUS@46..59 - 0: JS_BOGUS@46..57 - 0: JSX_NAME@46..55 - 0: JSX_IDENT@46..55 "namespace" [] [] - 1: COLON@55..56 ":" [] [] - 2: JSX_NAME@56..57 - 0: JSX_IDENT@56..57 "a" [] [] - 1: DOT@57..58 "." [] [] - 2: JS_NAME@58..59 - 0: IDENT@58..59 "b" [] [] - 3: R_ANGLE@59..60 ">" [] [] - 1: SEMICOLON@60..61 ";" [] [] - 4: EOF@61..62 "" [Newline("\n")] [] --- -jsx_namespace_member_element_name.jsx:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × JSX property access expressions cannot include JSX namespace names. - - 1 │ ; - > 2 │ ; - │ ^^^^^^^^^^^ - 3 │ - --- -jsx_namespace_member_element_name.jsx:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × JSX property access expressions cannot include JSX namespace names. - - 1 │ ; - > 2 │ ; - │ ^^^^^^^^^^^ - 3 │ - --- -; -; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast b/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast deleted file mode 100644 index 08a414e28a91..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast +++ /dev/null @@ -1,135 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@0..1 "<" [] [], - r_angle_token: R_ANGLE@1..2 ">" [] [], - }, - children: JsxChildList [ - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@2..3 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@3..8 "test" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: missing (required), - }, - children: JsxChildList [ - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@8..9 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@9..14 "inner" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@14..15 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@15..28 " some content" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@28..29 "<" [] [], - slash_token: SLASH@29..30 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@30..35 "inner" [] [], - }, - r_angle_token: R_ANGLE@35..36 ">" [] [], - }, - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@36..37 "<" [] [], - slash_token: SLASH@37..38 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@38..42 "test" [] [], - }, - r_angle_token: R_ANGLE@42..43 ">" [] [], - }, - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@43..44 "<" [] [], - slash_token: SLASH@44..45 "/" [] [], - r_angle_token: R_ANGLE@45..46 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@46..47 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_EXPRESSION_STATEMENT@0..46 - 0: JSX_TAG_EXPRESSION@0..46 - 0: JSX_FRAGMENT@0..46 - 0: JSX_OPENING_FRAGMENT@0..2 - 0: L_ANGLE@0..1 "<" [] [] - 1: R_ANGLE@1..2 ">" [] [] - 1: JSX_CHILD_LIST@2..43 - 0: JSX_ELEMENT@2..43 - 0: JSX_OPENING_ELEMENT@2..8 - 0: L_ANGLE@2..3 "<" [] [] - 1: JSX_NAME@3..8 - 0: JSX_IDENT@3..8 "test" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@8..8 - 4: (empty) - 1: JSX_CHILD_LIST@8..36 - 0: JSX_ELEMENT@8..36 - 0: JSX_OPENING_ELEMENT@8..15 - 0: L_ANGLE@8..9 "<" [] [] - 1: JSX_NAME@9..14 - 0: JSX_IDENT@9..14 "inner" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@14..14 - 4: R_ANGLE@14..15 ">" [] [] - 1: JSX_CHILD_LIST@15..28 - 0: JSX_TEXT@15..28 - 0: JSX_TEXT_LITERAL@15..28 " some content" [] [] - 2: JSX_CLOSING_ELEMENT@28..36 - 0: L_ANGLE@28..29 "<" [] [] - 1: SLASH@29..30 "/" [] [] - 2: JSX_NAME@30..35 - 0: JSX_IDENT@30..35 "inner" [] [] - 3: R_ANGLE@35..36 ">" [] [] - 2: JSX_CLOSING_ELEMENT@36..43 - 0: L_ANGLE@36..37 "<" [] [] - 1: SLASH@37..38 "/" [] [] - 2: JSX_NAME@38..42 - 0: JSX_IDENT@38..42 "test" [] [] - 3: R_ANGLE@42..43 ">" [] [] - 2: JSX_CLOSING_FRAGMENT@43..46 - 0: L_ANGLE@43..44 "<" [] [] - 1: SLASH@44..45 "/" [] [] - 2: R_ANGLE@45..46 ">" [] [] - 1: (empty) - 4: EOF@46..47 "" [Newline("\n")] [] --- -jsx_opening_element_missing_r_angle.jsx:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `>` but instead found `<` - - > 1 │ <> some content - │ ^ - 2 │ - - i Remove < - --- -<> some content diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast b/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast deleted file mode 100644 index ce3642745d78..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast +++ /dev/null @@ -1,472 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..20 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@23..24 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@33..35 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@35..37 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBogusExpression { - items: [ - L_ANGLE@37..38 "<" [] [], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@38..41 "div" [] [], - }, - type_arguments: missing (optional), - }, - R_ANGLE@41..42 ">" [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..43 "a" [] [], - }, - }, - ], - }, - operator_token: L_ANGLE@43..44 "<" [] [], - right: JsBinaryExpression { - left: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@44..52 "/div>; /" [] [], - }, - operator_token: SLASH@52..54 "/" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@54..57 "JSX" [] [], - }, - }, - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@66..68 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@68..70 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - L_ANGLE@70..71 "<" [] [], - TsStringType { - string_token: STRING_KW@71..77 "string" [] [], - }, - R_ANGLE@77..78 ">" [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..79 "b" [] [], - }, - }, - ], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@79..98 ";" [] [Whitespace(" "), Comments("// type assertion")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@98..107 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@107..109 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@109..111 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsBogusExpression { - items: [ - L_ANGLE@111..112 "<" [] [], - TsStringType { - string_token: STRING_KW@112..118 "string" [] [], - }, - R_ANGLE@118..119 ">" [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@119..120 "b" [] [], - }, - }, - ], - }, - operator_token: L_ANGLE@120..121 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@121..122 "a" [] [], - }, - }, - }, - operator_token: R_ANGLE@122..123 ">" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@123..124 "d" [] [], - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@124..143 ";" [] [Whitespace(" "), Comments("// type assertion")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@143..152 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@152..154 "d" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@154..156 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBogusExpression { - items: [ - L_ANGLE@156..157 "<" [] [], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@157..160 "div" [] [], - }, - type_arguments: missing (optional), - }, - R_ANGLE@160..161 ">" [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@161..162 "a" [] [], - }, - }, - ], - }, - operator_token: L_ANGLE@162..163 "<" [] [], - right: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@163..169 "/div>/" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@169..248 ";" [] [Whitespace(" "), Comments("// ambiguous: JSX or ...")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@248..257 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@257..259 "d" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@259..261 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBogusExpression { - items: [ - L_ANGLE@261..262 "<" [] [], - TsStringType { - string_token: STRING_KW@262..268 "string" [] [], - }, - R_ANGLE@268..269 ">" [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@269..270 "a" [] [], - }, - }, - ], - }, - operator_token: L_ANGLE@270..271 "<" [] [], - right: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@271..280 "/string>/" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@280..281 ";" [] [], - }, - ], - r_curly_token: R_CURLY@281..283 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@283..284 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..284 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..283 - 0: JS_FUNCTION_DECLARATION@0..283 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..20 - 0: IDENT@19..20 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@20..23 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..21 - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@23..283 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_DIRECTIVE_LIST@24..24 - 2: JS_STATEMENT_LIST@24..281 - 0: JS_VARIABLE_STATEMENT@24..57 - 0: JS_VARIABLE_DECLARATION@24..57 - 0: (empty) - 1: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@33..57 - 0: JS_VARIABLE_DECLARATOR@33..57 - 0: JS_IDENTIFIER_BINDING@33..35 - 0: IDENT@33..35 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@35..57 - 0: EQ@35..37 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@37..57 - 0: JS_BOGUS_EXPRESSION@37..43 - 0: L_ANGLE@37..38 "<" [] [] - 1: TS_REFERENCE_TYPE@38..41 - 0: JS_REFERENCE_IDENTIFIER@38..41 - 0: IDENT@38..41 "div" [] [] - 1: (empty) - 2: R_ANGLE@41..42 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@42..43 - 0: JS_REFERENCE_IDENTIFIER@42..43 - 0: IDENT@42..43 "a" [] [] - 1: L_ANGLE@43..44 "<" [] [] - 2: JS_BINARY_EXPRESSION@44..57 - 0: JS_REGEX_LITERAL_EXPRESSION@44..52 - 0: JS_REGEX_LITERAL@44..52 "/div>; /" [] [] - 1: SLASH@52..54 "/" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@54..57 - 0: JS_REFERENCE_IDENTIFIER@54..57 - 0: IDENT@54..57 "JSX" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@57..98 - 0: JS_VARIABLE_DECLARATION@57..79 - 0: (empty) - 1: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@66..79 - 0: JS_VARIABLE_DECLARATOR@66..79 - 0: JS_IDENTIFIER_BINDING@66..68 - 0: IDENT@66..68 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@68..79 - 0: EQ@68..70 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@70..79 - 0: L_ANGLE@70..71 "<" [] [] - 1: TS_STRING_TYPE@71..77 - 0: STRING_KW@71..77 "string" [] [] - 2: R_ANGLE@77..78 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@78..79 - 0: JS_REFERENCE_IDENTIFIER@78..79 - 0: IDENT@78..79 "b" [] [] - 1: SEMICOLON@79..98 ";" [] [Whitespace(" "), Comments("// type assertion")] - 2: JS_VARIABLE_STATEMENT@98..143 - 0: JS_VARIABLE_DECLARATION@98..124 - 0: (empty) - 1: LET_KW@98..107 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@107..124 - 0: JS_VARIABLE_DECLARATOR@107..124 - 0: JS_IDENTIFIER_BINDING@107..109 - 0: IDENT@107..109 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@109..124 - 0: EQ@109..111 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@111..124 - 0: JS_BINARY_EXPRESSION@111..122 - 0: JS_BOGUS_EXPRESSION@111..120 - 0: L_ANGLE@111..112 "<" [] [] - 1: TS_STRING_TYPE@112..118 - 0: STRING_KW@112..118 "string" [] [] - 2: R_ANGLE@118..119 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@119..120 - 0: JS_REFERENCE_IDENTIFIER@119..120 - 0: IDENT@119..120 "b" [] [] - 1: L_ANGLE@120..121 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@121..122 - 0: JS_REFERENCE_IDENTIFIER@121..122 - 0: IDENT@121..122 "a" [] [] - 1: R_ANGLE@122..123 ">" [] [] - 2: JS_IDENTIFIER_EXPRESSION@123..124 - 0: JS_REFERENCE_IDENTIFIER@123..124 - 0: IDENT@123..124 "d" [] [] - 1: SEMICOLON@124..143 ";" [] [Whitespace(" "), Comments("// type assertion")] - 3: JS_VARIABLE_STATEMENT@143..248 - 0: JS_VARIABLE_DECLARATION@143..169 - 0: (empty) - 1: LET_KW@143..152 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@152..169 - 0: JS_VARIABLE_DECLARATOR@152..169 - 0: JS_IDENTIFIER_BINDING@152..154 - 0: IDENT@152..154 "d" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@154..169 - 0: EQ@154..156 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@156..169 - 0: JS_BOGUS_EXPRESSION@156..162 - 0: L_ANGLE@156..157 "<" [] [] - 1: TS_REFERENCE_TYPE@157..160 - 0: JS_REFERENCE_IDENTIFIER@157..160 - 0: IDENT@157..160 "div" [] [] - 1: (empty) - 2: R_ANGLE@160..161 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@161..162 - 0: JS_REFERENCE_IDENTIFIER@161..162 - 0: IDENT@161..162 "a" [] [] - 1: L_ANGLE@162..163 "<" [] [] - 2: JS_REGEX_LITERAL_EXPRESSION@163..169 - 0: JS_REGEX_LITERAL@163..169 "/div>/" [] [] - 1: SEMICOLON@169..248 ";" [] [Whitespace(" "), Comments("// ambiguous: JSX or ...")] - 4: JS_VARIABLE_STATEMENT@248..281 - 0: JS_VARIABLE_DECLARATION@248..280 - 0: (empty) - 1: LET_KW@248..257 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@257..280 - 0: JS_VARIABLE_DECLARATOR@257..280 - 0: JS_IDENTIFIER_BINDING@257..259 - 0: IDENT@257..259 "d" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@259..280 - 0: EQ@259..261 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@261..280 - 0: JS_BOGUS_EXPRESSION@261..270 - 0: L_ANGLE@261..262 "<" [] [] - 1: TS_STRING_TYPE@262..268 - 0: STRING_KW@262..268 "string" [] [] - 2: R_ANGLE@268..269 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@269..270 - 0: JS_REFERENCE_IDENTIFIER@269..270 - 0: IDENT@269..270 "a" [] [] - 1: L_ANGLE@270..271 "<" [] [] - 2: JS_REGEX_LITERAL_EXPRESSION@271..280 - 0: JS_REGEX_LITERAL@271..280 "/string>/" [] [] - 1: SEMICOLON@280..281 ";" [] [] - 3: R_CURLY@281..283 "}" [Newline("\n")] [] - 4: EOF@283..284 "" [Newline("\n")] [] --- -jsx_or_type_assertion.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 1 │ // SCRIPT - 2 │ function f() { - > 3 │ let a =
a
; // JSX - │ ^^^^^^ - 4 │ let b = b; // type assertion - 5 │ let c = bd; // type assertion - - i TypeScript only syntax - --- -jsx_or_type_assertion.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 2 │ function f() { - 3 │ let a =
a
; // JSX - > 4 │ let b = b; // type assertion - │ ^^^^^^^^^ - 5 │ let c = b
d; // type assertion - 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - - i TypeScript only syntax - --- -jsx_or_type_assertion.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 3 │ let a =
a
; // JSX - 4 │ let b = b; // type assertion - > 5 │ let c = b
d; // type assertion - │ ^^^^^^^^^ - 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - 7 │ let d = a/; - - i TypeScript only syntax - --- -jsx_or_type_assertion.js:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 4 │ let b = b; // type assertion - 5 │ let c = b
d; // type assertion - > 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - │ ^^^^^^ - 7 │ let d = a/; - 8 │ } - - i TypeScript only syntax - --- -jsx_or_type_assertion.js:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 5 │ let c = b
d; // type assertion - 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - > 7 │ let d = a/; - │ ^^^^^^^^^ - 8 │ } - 9 │ - - i TypeScript only syntax - --- -// SCRIPT -function f() { - let a =
a
; // JSX - let b = b; // type assertion - let c = b
d; // type assertion - let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - let d = a/; -} diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast b/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast deleted file mode 100644 index 4ce0d3297a2d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast +++ /dev/null @@ -1,99 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@0..1 "<" [] [], - r_angle_token: R_ANGLE@1..2 ">" [] [], - }, - children: JsxChildList [ - JsxSelfClosingElement { - l_angle_token: L_ANGLE@2..3 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@3..8 "test" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@8..10 "/" [] [Whitespace(" ")], - r_angle_token: missing (required), - }, - JsxText { - value_token: JSX_TEXT_LITERAL@10..31 "some test followed by" [] [], - }, - JsxSelfClosingElement { - l_angle_token: L_ANGLE@31..32 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@32..34 "a" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@34..35 "/" [] [], - r_angle_token: R_ANGLE@35..36 ">" [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@36..37 "<" [] [], - slash_token: SLASH@37..38 "/" [] [], - r_angle_token: R_ANGLE@38..39 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@39..40 ";" [] [], - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: JS_EXPRESSION_STATEMENT@0..40 - 0: JSX_TAG_EXPRESSION@0..39 - 0: JSX_FRAGMENT@0..39 - 0: JSX_OPENING_FRAGMENT@0..2 - 0: L_ANGLE@0..1 "<" [] [] - 1: R_ANGLE@1..2 ">" [] [] - 1: JSX_CHILD_LIST@2..36 - 0: JSX_SELF_CLOSING_ELEMENT@2..10 - 0: L_ANGLE@2..3 "<" [] [] - 1: JSX_NAME@3..8 - 0: JSX_IDENT@3..8 "test" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@8..8 - 4: SLASH@8..10 "/" [] [Whitespace(" ")] - 5: (empty) - 1: JSX_TEXT@10..31 - 0: JSX_TEXT_LITERAL@10..31 "some test followed by" [] [] - 2: JSX_SELF_CLOSING_ELEMENT@31..36 - 0: L_ANGLE@31..32 "<" [] [] - 1: JSX_NAME@32..34 - 0: JSX_IDENT@32..34 "a" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@34..34 - 4: SLASH@34..35 "/" [] [] - 5: R_ANGLE@35..36 ">" [] [] - 2: JSX_CLOSING_FRAGMENT@36..39 - 0: L_ANGLE@36..37 "<" [] [] - 1: SLASH@37..38 "/" [] [] - 2: R_ANGLE@38..39 ">" [] [] - 1: SEMICOLON@39..40 ";" [] [] - 4: EOF@40..41 "" [Newline("\n")] [] --- -jsx_self_closing_element_missing_r_angle.jsx:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `>` but instead found `some` - - > 1 │ <>; - │ ^^^^ - 2 │ - - i Remove some - --- -<>; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast b/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast deleted file mode 100644 index b6ec7ebe7251..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast +++ /dev/null @@ -1,327 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "obj" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@11..12 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@13..15 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@15..17 "a" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@17..18 "{" [] [], - dotdotdot_token: DOT3@18..21 "..." [] [], - argument: JsBogusExpression { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "obj" [] [], - }, - }, - COMMA@24..26 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "other" [] [], - }, - }, - ], - }, - r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@33..34 "/" [] [], - r_angle_token: R_ANGLE@34..35 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@36..38 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@38..40 "a" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: missing (required), - dotdotdot_token: DOT3@40..43 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..46 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@46..48 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@48..49 "/" [] [], - r_angle_token: R_ANGLE@49..50 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@51..53 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@53..55 "a" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@55..56 "{" [] [], - dotdotdot_token: missing (required), - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..59 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@61..62 "/" [] [], - r_angle_token: R_ANGLE@62..63 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@64..66 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@66..69 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [], - dotdotdot_token: DOT3@77..80 "..." [] [], - argument: JsObjectExpression { - l_curly_token: L_CURLY@80..81 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")], - }, - r_curly_token: missing (required), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@148..149 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [], - }, - }, - }, - ], - slash_token: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [], - r_angle_token: R_ANGLE@167..168 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@168..169 ";" [] [], - }, - ], - eof_token: EOF@169..170 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..170 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..169 - 0: JS_VARIABLE_STATEMENT@0..13 - 0: JS_VARIABLE_DECLARATION@0..12 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..12 - 0: JS_VARIABLE_DECLARATOR@4..12 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "obj" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..12 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@10..12 - 0: L_CURLY@10..11 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@11..11 - 2: R_CURLY@11..12 "}" [] [] - 1: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@13..36 - 0: JSX_TAG_EXPRESSION@13..35 - 0: JSX_SELF_CLOSING_ELEMENT@13..35 - 0: L_ANGLE@13..15 "<" [Newline("\n")] [] - 1: JSX_NAME@15..17 - 0: JSX_IDENT@15..17 "a" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@17..33 - 0: JSX_SPREAD_ATTRIBUTE@17..33 - 0: L_CURLY@17..18 "{" [] [] - 1: DOT3@18..21 "..." [] [] - 2: JS_BOGUS_EXPRESSION@21..31 - 0: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "obj" [] [] - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "other" [] [] - 3: R_CURLY@31..33 "}" [] [Whitespace(" ")] - 4: SLASH@33..34 "/" [] [] - 5: R_ANGLE@34..35 ">" [] [] - 1: SEMICOLON@35..36 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@36..51 - 0: JSX_TAG_EXPRESSION@36..50 - 0: JSX_SELF_CLOSING_ELEMENT@36..50 - 0: L_ANGLE@36..38 "<" [Newline("\n")] [] - 1: JSX_NAME@38..40 - 0: JSX_IDENT@38..40 "a" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@40..48 - 0: JSX_SPREAD_ATTRIBUTE@40..48 - 0: (empty) - 1: DOT3@40..43 "..." [] [] - 2: JS_IDENTIFIER_EXPRESSION@43..46 - 0: JS_REFERENCE_IDENTIFIER@43..46 - 0: IDENT@43..46 "obj" [] [] - 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] - 4: SLASH@48..49 "/" [] [] - 5: R_ANGLE@49..50 ">" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@51..64 - 0: JSX_TAG_EXPRESSION@51..63 - 0: JSX_SELF_CLOSING_ELEMENT@51..63 - 0: L_ANGLE@51..53 "<" [Newline("\n")] [] - 1: JSX_NAME@53..55 - 0: JSX_IDENT@53..55 "a" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@55..61 - 0: JSX_SPREAD_ATTRIBUTE@55..61 - 0: L_CURLY@55..56 "{" [] [] - 1: (empty) - 2: JS_IDENTIFIER_EXPRESSION@56..59 - 0: JS_REFERENCE_IDENTIFIER@56..59 - 0: IDENT@56..59 "obj" [] [] - 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] - 4: SLASH@61..62 "/" [] [] - 5: R_ANGLE@62..63 ">" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@64..169 - 0: JSX_TAG_EXPRESSION@64..168 - 0: JSX_SELF_CLOSING_ELEMENT@64..168 - 0: L_ANGLE@64..66 "<" [Newline("\n")] [] - 1: JSX_NAME@66..69 - 0: JSX_IDENT@66..69 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@69..161 - 0: JSX_SPREAD_ATTRIBUTE@69..130 - 0: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [] - 1: DOT3@77..80 "..." [] [] - 2: JS_OBJECT_EXPRESSION@80..130 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@81..81 - 2: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")] - 3: (empty) - 1: JSX_ATTRIBUTE@130..161 - 0: JSX_NAME@130..148 - 0: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@148..161 - 0: EQ@148..149 "=" [] [] - 1: JSX_STRING@149..161 - 0: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [] - 4: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [] - 5: R_ANGLE@167..168 ">" [] [] - 1: SEMICOLON@168..169 ";" [] [] - 4: EOF@169..170 "" [Newline("\n")] [] --- -jsx_spread_attribute_error.jsx:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Comma operator isn't a valid value for a JSX spread argument. - - 1 │ let obj = {}; - > 2 │
; - │ ^^^^^^^^^^ - 3 │ ; - 4 │ ; - --- -jsx_spread_attribute_error.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `...` - - 1 │ let obj = {}; - 2 │ ; - > 3 │ ; - │ ^^^ - 4 │ ; - 5 │
; - 3 │ ; - > 4 │ ; - │ ^^^ - 5 │
8 │ invalidProp="HelloWorld" - │ ^^^^^^^^^^^ - 9 │ />; - 10 │ - - i Remove invalidProp - --- -let obj = {}; -; -; -; -
; diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast b/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast deleted file mode 100644 index 3f3338c63a05..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast +++ /dev/null @@ -1,87 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [ - JsxSpreadChild { - l_curly_token: L_CURLY@6..7 "{" [] [], - dotdotdot_token: DOT3@7..10 "..." [] [], - expression: missing (required), - r_curly_token: R_CURLY@10..11 "}" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@11..12 "<" [] [], - slash_token: SLASH@12..13 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@13..17 "test" [] [], - }, - r_angle_token: R_ANGLE@17..18 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@18..19 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..19 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..18 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JSX_TAG_EXPRESSION@0..18 - 0: JSX_ELEMENT@0..18 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..11 - 0: JSX_SPREAD_CHILD@6..11 - 0: L_CURLY@6..7 "{" [] [] - 1: DOT3@7..10 "..." [] [] - 2: (empty) - 3: R_CURLY@10..11 "}" [] [] - 2: JSX_CLOSING_ELEMENT@11..18 - 0: L_ANGLE@11..12 "<" [] [] - 1: SLASH@12..13 "/" [] [] - 2: JSX_NAME@13..17 - 0: JSX_IDENT@13..17 "test" [] [] - 3: R_ANGLE@17..18 ">" [] [] - 1: (empty) - 4: EOF@18..19 "" [Newline("\n")] [] --- -jsx_spread_no_expression.jsx:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '}'. - - > 1 │ {...} - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ {...} - │ ^ - 2 │ - --- -{...} diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast b/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast deleted file mode 100644 index c716a93b2ebe..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast +++ /dev/null @@ -1,96 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsLabeledStatement { - label: JsLabel { - value_token: IDENT@10..16 "label1" [] [], - }, - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - body: JsLabeledStatement { - label: JsLabel { - value_token: IDENT@18..24 "label2" [] [], - }, - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - body: JsBogusStatement { - items: [ - FUNCTION_KW@26..35 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@35..36 "a" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@39..40 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - ], - }, - }, - }, - else_clause: missing (optional), - }, - ], - eof_token: EOF@41..42 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..42 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..41 - 0: JS_IF_STATEMENT@0..41 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_LABELED_STATEMENT@10..41 - 0: JS_LABEL@10..16 - 0: IDENT@10..16 "label1" [] [] - 1: COLON@16..18 ":" [] [Whitespace(" ")] - 2: JS_LABELED_STATEMENT@18..41 - 0: JS_LABEL@18..24 - 0: IDENT@18..24 "label2" [] [] - 1: COLON@24..26 ":" [] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@26..41 - 0: FUNCTION_KW@26..35 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@35..36 - 0: IDENT@35..36 "a" [] [] - 2: JS_PARAMETERS@36..39 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_PARAMETER_LIST@37..37 - 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@39..41 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..40 - 3: R_CURLY@40..41 "}" [] [] - 5: (empty) - 4: EOF@41..42 "" [Newline("\n")] [] --- -labelled_function_decl_in_single_statement_context.js:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In strict mode code, functions can only be declared at top level or inside a block - - > 1 │ if (true) label1: label2: function a() {} - │ ^^^^^^^^^^^^^^^ - 2 │ - - i wrap the function in a block statement - --- -if (true) label1: label2: function a() {} diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast b/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast deleted file mode 100644 index 4c7277f8cac8..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast +++ /dev/null @@ -1,70 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..6 "label1" [] [], - }, - colon_token: COLON@6..8 ":" [] [Whitespace(" ")], - body: JsBogusStatement { - items: [ - FUNCTION_KW@8..17 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@17..18 "a" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@18..19 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@21..22 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - ], - }, - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_LABELED_STATEMENT@0..23 - 0: JS_LABEL@0..6 - 0: IDENT@0..6 "label1" [] [] - 1: COLON@6..8 ":" [] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@8..23 - 0: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@17..18 - 0: IDENT@17..18 "a" [] [] - 2: JS_PARAMETERS@18..21 - 0: L_PAREN@18..19 "(" [] [] - 1: JS_PARAMETER_LIST@19..19 - 2: R_PAREN@19..21 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@21..23 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_DIRECTIVE_LIST@22..22 - 2: JS_STATEMENT_LIST@22..22 - 3: R_CURLY@22..23 "}" [] [] - 4: EOF@23..24 "" [Newline("\n")] [] --- -labelled_function_declaration_strict_mode.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In strict mode code, functions can only be declared at top level or inside a block - - > 1 │ label1: function a() {} - │ ^^^^^^^^^^^^^^^ - 2 │ - - i wrap the function in a block statement - --- -label1: function a() {} diff --git a/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.rast b/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.rast deleted file mode 100644 index 3cb011f3b785..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [], - }, - colon_token: COLON@11..13 ":" [] [Whitespace(" ")], - body: JsBogusStatement { - items: [ - JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@13..16 "let" [] [], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@16..18 "[" [Newline("\n")] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@18..19 "a" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@19..21 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@21..23 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@23..24 "0" [] [], - }, - }, - }, - ], - }, - SEMICOLON@24..25 ";" [] [], - ], - }, - }, - ], - eof_token: EOF@25..26 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..26 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..25 - 0: JS_LABELED_STATEMENT@0..25 - 0: JS_LABEL@0..11 - 0: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [] - 1: COLON@11..13 ":" [] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@13..25 - 0: JS_VARIABLE_DECLARATION@13..24 - 0: (empty) - 1: LET_KW@13..16 "let" [] [] - 2: JS_VARIABLE_DECLARATOR_LIST@16..24 - 0: JS_VARIABLE_DECLARATOR@16..24 - 0: JS_ARRAY_BINDING_PATTERN@16..21 - 0: L_BRACK@16..18 "[" [Newline("\n")] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@18..19 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@18..19 - 0: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "a" [] [] - 1: (empty) - 2: R_BRACK@19..21 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@21..24 - 0: EQ@21..23 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@23..24 - 0: JS_NUMBER_LITERAL@23..24 "0" [] [] - 1: SEMICOLON@24..25 ";" [] [] - 4: EOF@25..26 "" [Newline("\n")] [] --- -let_array_with_new_line.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Lexical declaration cannot appear in a single-statement context - - 1 │ // SCRIPT - > 2 │ L: let - │ ^^^ - > 3 │ [a] = 0; - │ ^^^^^^^^ - 4 │ - - i Wrap this declaration in a block statement - --- -// SCRIPT -L: let -[a] = 0; diff --git a/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.rast b/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.rast deleted file mode 100644 index 159ebd0520ba..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.rast +++ /dev/null @@ -1,141 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@15..16 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@16..17 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@19..20 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@20..26 "let" [Newline("\n"), Whitespace(" ")] [], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsBogusBinding { - items: [ - IDENT@26..35 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - ], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@35..36 "0" [] [], - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - ], - r_curly_token: R_CURLY@37..39 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_FUNCTION_DECLARATION@0..39 - 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@16..19 - 0: L_PAREN@16..17 "(" [] [] - 1: JS_PARAMETER_LIST@17..17 - 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@19..39 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_DIRECTIVE_LIST@20..20 - 2: JS_STATEMENT_LIST@20..37 - 0: JS_VARIABLE_STATEMENT@20..35 - 0: JS_VARIABLE_DECLARATION@20..35 - 0: (empty) - 1: LET_KW@20..26 "let" [Newline("\n"), Whitespace(" ")] [] - 2: JS_VARIABLE_DECLARATOR_LIST@26..35 - 0: JS_VARIABLE_DECLARATOR@26..35 - 0: JS_BOGUS_BINDING@26..35 - 0: IDENT@26..35 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@35..37 - 0: JS_NUMBER_LITERAL_EXPRESSION@35..36 - 0: JS_NUMBER_LITERAL@35..36 "0" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 3: R_CURLY@37..39 "}" [Newline("\n")] [] - 4: EOF@39..40 "" [Newline("\n")] [] --- -let_newline_in_async_function.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - 1 │ async function f() { - 2 │ let - > 3 │ await 0; - │ ^^^^^ - 4 │ } - 5 │ - --- -let_newline_in_async_function.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ async function f() { - 2 │ let - > 3 │ await 0; - │ ^ - 4 │ } - 5 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ async function f() { - 2 │ let - > 3 │ await 0; - │ ^ - 4 │ } - 5 │ - - i ...Which is required to end this statement - - 1 │ async function f() { - > 2 │ let - │ ^^^ - > 3 │ await 0; - │ ^^^^^^ - 4 │ } - 5 │ - --- -async function f() { - let - await 0; -} diff --git a/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast b/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast deleted file mode 100644 index a7d66975b58b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast +++ /dev/null @@ -1,138 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsBogusStatement { - items: [ - JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@10..14 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - SEMICOLON@15..16 ";" [] [], - ], - }, - else_clause: missing (optional), - }, - JsWhileStatement { - while_token: WHILE_KW@16..23 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@23..24 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@24..28 "true" [] [], - }, - r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], - body: JsBogusStatement { - items: [ - JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@30..36 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@36..38 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@40..41 "5" [] [], - }, - }, - }, - ], - }, - SEMICOLON@41..42 ";" [] [], - ], - }, - }, - ], - eof_token: EOF@42..43 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_IF_STATEMENT@0..16 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@10..16 - 0: JS_VARIABLE_DECLARATION@10..15 - 0: (empty) - 1: LET_KW@10..14 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..15 - 0: JS_VARIABLE_DECLARATOR@14..15 - 0: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@15..16 ";" [] [] - 5: (empty) - 1: JS_WHILE_STATEMENT@16..42 - 0: WHILE_KW@16..23 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@23..24 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@24..28 - 0: TRUE_KW@24..28 "true" [] [] - 3: R_PAREN@28..30 ")" [] [Whitespace(" ")] - 4: JS_BOGUS_STATEMENT@30..42 - 0: JS_VARIABLE_DECLARATION@30..41 - 0: (empty) - 1: CONST_KW@30..36 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@36..41 - 0: JS_VARIABLE_DECLARATOR@36..41 - 0: JS_IDENTIFIER_BINDING@36..38 - 0: IDENT@36..38 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@38..41 - 0: EQ@38..40 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@40..41 - 0: JS_NUMBER_LITERAL@40..41 "5" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 4: EOF@42..43 "" [Newline("\n")] [] --- -lexical_declaration_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Lexical declaration cannot appear in a single-statement context - - > 1 │ if (true) let a; - │ ^^^^^^ - 2 │ while (true) const b = 5; - 3 │ - - i Wrap this declaration in a block statement - --- -lexical_declaration_in_single_statement_context.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Lexical declaration cannot appear in a single-statement context - - 1 │ if (true) let a; - > 2 │ while (true) const b = 5; - │ ^^^^^^^^^^^^ - 3 │ - - i Wrap this declaration in a block statement - --- -if (true) let a; -while (true) const b = 5; diff --git a/crates/biome_js_parser/test_data/inline/err/literals.rast b/crates/biome_js_parser/test_data/inline/err/literals.rast deleted file mode 100644 index 5663c0aecb8a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/literals.rast +++ /dev/null @@ -1,238 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..2 "00" [] [], - }, - comma_token: COMMA@2..4 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@4..7 "012" [] [], - }, - }, - comma_token: COMMA@7..9 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@9..11 "08" [] [], - }, - }, - comma_token: COMMA@11..13 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..16 "091" [] [], - }, - }, - comma_token: COMMA@16..18 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@18..39 "0789" [] [Whitespace(" "), Comments("// parser errors")], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsBigintLiteralExpression { - value_token: JS_BIGINT_LITERAL@39..43 "01n" [Newline("\n")] [], - }, - comma_token: COMMA@43..45 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@45..48 "0_0" [] [], - }, - }, - comma_token: COMMA@48..50 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@50..70 "01.2" [] [Whitespace(" "), Comments("// lexer errors")], - }, - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - ERROR_TOKEN@70..76 "\"test" [Newline("\n")] [], - IDENT@76..86 "continues" [Newline("\n")] [], - ERROR_TOKEN@86..118 "\" // unterminated string literal" [] [], - ], - }, - ], - eof_token: EOF@118..119 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..119 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..118 - 0: JS_EXPRESSION_STATEMENT@0..39 - 0: JS_SEQUENCE_EXPRESSION@0..39 - 0: JS_SEQUENCE_EXPRESSION@0..16 - 0: JS_SEQUENCE_EXPRESSION@0..11 - 0: JS_SEQUENCE_EXPRESSION@0..7 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 - 0: JS_NUMBER_LITERAL@0..2 "00" [] [] - 1: COMMA@2..4 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@4..7 - 0: JS_NUMBER_LITERAL@4..7 "012" [] [] - 1: COMMA@7..9 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@9..11 - 0: JS_NUMBER_LITERAL@9..11 "08" [] [] - 1: COMMA@11..13 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@13..16 - 0: JS_NUMBER_LITERAL@13..16 "091" [] [] - 1: COMMA@16..18 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@18..39 - 0: JS_NUMBER_LITERAL@18..39 "0789" [] [Whitespace(" "), Comments("// parser errors")] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@39..70 - 0: JS_SEQUENCE_EXPRESSION@39..70 - 0: JS_SEQUENCE_EXPRESSION@39..48 - 0: JS_BIGINT_LITERAL_EXPRESSION@39..43 - 0: JS_BIGINT_LITERAL@39..43 "01n" [Newline("\n")] [] - 1: COMMA@43..45 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@45..48 - 0: JS_NUMBER_LITERAL@45..48 "0_0" [] [] - 1: COMMA@48..50 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@50..70 - 0: JS_NUMBER_LITERAL@50..70 "01.2" [] [Whitespace(" "), Comments("// lexer errors")] - 1: (empty) - 2: JS_BOGUS_STATEMENT@70..118 - 0: ERROR_TOKEN@70..76 "\"test" [Newline("\n")] [] - 1: IDENT@76..86 "continues" [Newline("\n")] [] - 2: ERROR_TOKEN@86..118 "\" // unterminated string literal" [] [] - 4: EOF@118..119 "" [Newline("\n")] [] --- -literals.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. - - > 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^ - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - --- -literals.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. - - > 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^^ - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - --- -literals.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decimals with leading zeros are not allowed in strict mode. - - > 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^ - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - --- -literals.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decimals with leading zeros are not allowed in strict mode. - - > 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^^ - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - --- -literals.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decimals with leading zeros are not allowed in strict mode. - - > 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^^^ - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - --- -literals.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Octal literals are not allowed for BigInts. - - 1 │ 00, 012, 08, 091, 0789 // parser errors - > 2 │ 01n, 0_0, 01.2 // lexer errors - │ ^^^ - 3 │ "test - 4 │ continues" // unterminated string literal - --- -literals.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × numeric separator can not be used after leading 0 - - 1 │ 00, 012, 08, 091, 0789 // parser errors - > 2 │ 01n, 0_0, 01.2 // lexer errors - │ - 3 │ "test - 4 │ continues" // unterminated string literal - --- -literals.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unexpected number - - 1 │ 00, 012, 08, 091, 0789 // parser errors - > 2 │ 01n, 0_0, 01.2 // lexer errors - │ ^^^ - 3 │ "test - 4 │ continues" // unterminated string literal - --- -literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated string literal - - 1 │ 00, 012, 08, 091, 0789 // parser errors - 2 │ 01n, 0_0, 01.2 // lexer errors - > 3 │ "test - │ ^^^^^ - 4 │ continues" // unterminated string literal - 5 │ - - i - - 1 │ 00, 012, 08, 091, 0789 // parser errors - 2 │ 01n, 0_0, 01.2 // lexer errors - > 3 │ "test - │ ^^^^^ - 4 │ continues" // unterminated string literal - 5 │ - - i The closing quote must be on the same line. - --- -literals.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated string literal - - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - > 4 │ continues" // unterminated string literal - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 5 │ - - i - - 2 │ 01n, 0_0, 01.2 // lexer errors - 3 │ "test - > 4 │ continues" // unterminated string literal - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 5 │ - - i The closing quote must be on the same line. - --- -00, 012, 08, 091, 0789 // parser errors -01n, 0_0, 01.2 // lexer errors -"test -continues" // unterminated string literal diff --git a/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.rast b/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.rast deleted file mode 100644 index 6866a2b1f863..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.rast +++ /dev/null @@ -1,156 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], - }, - }, - operator_token: QUESTION2@4..7 "??" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: missing (required), - operator_token: STAR@7..9 "*" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@9..10 "2" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsUnaryExpression { - operator_token: BANG@11..13 "!" [Newline("\n")] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..17 "foo" [] [Whitespace(" ")], - }, - }, - }, - operator_token: AMP2@17..20 "&&" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..23 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..28 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@28..29 "(" [] [], - args: JsCallArgumentList [ - JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@29..33 "foo" [] [Whitespace(" ")], - }, - }, - operator_token: PIPE2@33..35 "||" [] [], - right: missing (required), - }, - ], - r_paren_token: R_PAREN@35..36 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@36..37 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..37 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..36 - 0: JS_EXPRESSION_STATEMENT@0..11 - 0: JS_LOGICAL_EXPRESSION@0..10 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "foo" [] [Whitespace(" ")] - 1: QUESTION2@4..7 "??" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@7..10 - 0: (empty) - 1: STAR@7..9 "*" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@9..10 - 0: JS_NUMBER_LITERAL@9..10 "2" [] [] - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@11..24 - 0: JS_LOGICAL_EXPRESSION@11..23 - 0: JS_UNARY_EXPRESSION@11..17 - 0: BANG@11..13 "!" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@13..17 - 0: JS_REFERENCE_IDENTIFIER@13..17 - 0: IDENT@13..17 "foo" [] [Whitespace(" ")] - 1: AMP2@17..20 "&&" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@20..23 - 0: JS_REFERENCE_IDENTIFIER@20..23 - 0: IDENT@20..23 "bar" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@24..36 - 0: JS_CALL_EXPRESSION@24..36 - 0: JS_IDENTIFIER_EXPRESSION@24..28 - 0: JS_REFERENCE_IDENTIFIER@24..28 - 0: IDENT@24..28 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@28..36 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@29..35 - 0: JS_LOGICAL_EXPRESSION@29..35 - 0: JS_IDENTIFIER_EXPRESSION@29..33 - 0: JS_REFERENCE_IDENTIFIER@29..33 - 0: IDENT@29..33 "foo" [] [Whitespace(" ")] - 1: PIPE2@33..35 "||" [] [] - 2: (empty) - 2: R_PAREN@35..36 ")" [] [] - 1: (empty) - 4: EOF@36..37 "" [Newline("\n")] [] --- -logical_expressions_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression for the left hand side of the `*` operator. - - > 1 │ foo ?? * 2; - │ ^ - 2 │ !foo && bar; - 3 │ foo(foo ||) - - i This operator requires a left hand side value - --- -logical_expressions_err.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ')'. - - 1 │ foo ?? * 2; - 2 │ !foo && bar; - > 3 │ foo(foo ||) - │ ^ - 4 │ - - i Expected an expression here. - - 1 │ foo ?? * 2; - 2 │ !foo && bar; - > 3 │ foo(foo ||) - │ ^ - 4 │ - --- -foo ?? * 2; -!foo && bar; -foo(foo ||) diff --git a/crates/biome_js_parser/test_data/inline/err/method_getter_err.rast b/crates/biome_js_parser/test_data/inline/err/method_getter_err.rast deleted file mode 100644 index d9ed1d3eb5fe..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/method_getter_err.rast +++ /dev/null @@ -1,125 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@11..17 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsBogusMember { - items: [ - L_CURLY@17..18 "{" [] [], - ], - }, - ], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - JsBogusStatement { - items: [ - R_CURLY@19..21 "}" [Newline("\n")] [], - ], - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_CLASS_DECLARATION@0..19 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..18 - 0: JS_PROPERTY_CLASS_MEMBER@11..17 - 0: JS_PROPERTY_MODIFIER_LIST@11..11 - 1: JS_LITERAL_MEMBER_NAME@11..17 - 0: IDENT@11..17 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 1: JS_BOGUS_MEMBER@17..18 - 0: L_CURLY@17..18 "{" [] [] - 9: R_CURLY@18..19 "}" [] [] - 1: JS_BOGUS_STATEMENT@19..21 - 0: R_CURLY@19..21 "}" [Newline("\n")] [] - 4: EOF@21..22 "" [Newline("\n")] [] --- -method_getter_err.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the class property, but found none - - 1 │ class foo { - > 2 │ get {} - │ ^^^ - 3 │ } - 4 │ - --- -method_getter_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. - - 1 │ class foo { - > 2 │ get {} - │ ^ - 3 │ } - 4 │ - - i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. - - 1 │ class foo { - > 2 │ get {} - │ ^ - 3 │ } - 4 │ - --- -method_getter_err.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - 1 │ class foo { - 2 │ get {} - > 3 │ } - │ ^ - 4 │ - - i Expected a statement here. - - 1 │ class foo { - 2 │ get {} - > 3 │ } - │ ^ - 4 │ - --- -class foo { - get {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/module_closing_curly.rast b/crates/biome_js_parser/test_data/inline/err/module_closing_curly.rast deleted file mode 100644 index cab6f4cd6847..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/module_closing_curly.rast +++ /dev/null @@ -1,108 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@17..18 "{" [] [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@18..26 "\"name\"" [Newline("\n"), Whitespace(" ")] [], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - COLON@26..28 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@28..45 "\"troublesome-lib\"" [] [], - COMMA@45..46 "," [] [], - JS_STRING_LITERAL@46..57 "\"typings\"" [Newline("\n"), Whitespace(" ")] [], - COLON@57..59 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@59..75 "\"lib/index.d.ts\"" [] [], - COMMA@75..76 "," [] [], - JS_STRING_LITERAL@76..87 "\"version\"" [Newline("\n"), Whitespace(" ")] [], - COLON@87..89 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@89..96 "\"0.0.1\"" [] [], - ], - }, - ], - r_curly_token: R_CURLY@96..98 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@98..99 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..99 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..98 - 0: TS_DECLARE_STATEMENT@0..98 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..98 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@17..98 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_MODULE_ITEM_LIST@18..96 - 0: JS_EXPRESSION_STATEMENT@18..26 - 0: JS_STRING_LITERAL_EXPRESSION@18..26 - 0: JS_STRING_LITERAL@18..26 "\"name\"" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 1: JS_BOGUS_STATEMENT@26..96 - 0: COLON@26..28 ":" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL@28..45 "\"troublesome-lib\"" [] [] - 2: COMMA@45..46 "," [] [] - 3: JS_STRING_LITERAL@46..57 "\"typings\"" [Newline("\n"), Whitespace(" ")] [] - 4: COLON@57..59 ":" [] [Whitespace(" ")] - 5: JS_STRING_LITERAL@59..75 "\"lib/index.d.ts\"" [] [] - 6: COMMA@75..76 "," [] [] - 7: JS_STRING_LITERAL@76..87 "\"version\"" [Newline("\n"), Whitespace(" ")] [] - 8: COLON@87..89 ":" [] [Whitespace(" ")] - 9: JS_STRING_LITERAL@89..96 "\"0.0.1\"" [] [] - 2: R_CURLY@96..98 "}" [Newline("\n")] [] - 4: EOF@98..99 "" [Newline("\n")] [] --- -module_closing_curly.ts:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ declare module A { - > 2 │ "name": "troublesome-lib", - │ ^ - 3 │ "typings": "lib/index.d.ts", - 4 │ "version": "0.0.1" - - i An explicit or implicit semicolon is expected here... - - 1 │ declare module A { - > 2 │ "name": "troublesome-lib", - │ ^ - 3 │ "typings": "lib/index.d.ts", - 4 │ "version": "0.0.1" - - i ...Which is required to end this statement - - 1 │ declare module A { - > 2 │ "name": "troublesome-lib", - │ ^^^^^^^ - 3 │ "typings": "lib/index.d.ts", - 4 │ "version": "0.0.1" - --- -declare module A { - "name": "troublesome-lib", - "typings": "lib/index.d.ts", - "version": "0.0.1" -} diff --git a/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.rast b/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.rast deleted file mode 100644 index ab667da66cb2..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.rast +++ /dev/null @@ -1,213 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultExpressionClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@15..16 "(" [] [], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@16..22 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@22..23 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - r_paren_token: R_PAREN@24..25 ")" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@25..33 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - DEFAULT_KW@33..41 "default" [] [Whitespace(" ")], - JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..43 "a" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@43..45 "+" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..46 "b" [] [], - }, - }, - }, - SEMICOLON@46..47 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - DEFAULT_KW@55..63 "default" [] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@63..64 "(" [] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@73..74 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@74..75 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@77..78 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@78..79 "}" [] [], - }, - }, - r_paren_token: R_PAREN@79..80 ")" [] [], - }, - ], - }, - ], - }, - ], - eof_token: EOF@80..81 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..81 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..80 - 0: JS_EXPORT@0..25 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@7..25 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@15..25 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_CLASS_EXPRESSION@16..24 - 0: JS_DECORATOR_LIST@16..16 - 1: CLASS_KW@16..22 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@22..23 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@23..23 - 8: R_CURLY@23..24 "}" [] [] - 2: R_PAREN@24..25 ")" [] [] - 2: (empty) - 1: JS_BOGUS_STATEMENT@25..47 - 0: JS_DECORATOR_LIST@25..25 - 1: EXPORT_KW@25..33 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@33..47 - 0: DEFAULT_KW@33..41 "default" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@41..46 - 0: JS_IDENTIFIER_EXPRESSION@41..43 - 0: JS_REFERENCE_IDENTIFIER@41..43 - 0: IDENT@41..43 "a" [] [Whitespace(" ")] - 1: PLUS@43..45 "+" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@45..46 - 0: JS_REFERENCE_IDENTIFIER@45..46 - 0: IDENT@45..46 "b" [] [] - 2: SEMICOLON@46..47 ";" [] [] - 2: JS_BOGUS_STATEMENT@47..80 - 0: JS_DECORATOR_LIST@47..47 - 1: EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@55..80 - 0: DEFAULT_KW@55..63 "default" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@63..80 - 0: L_PAREN@63..64 "(" [] [] - 1: JS_FUNCTION_EXPRESSION@64..79 - 0: (empty) - 1: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@73..74 - 0: IDENT@73..74 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@74..77 - 0: L_PAREN@74..75 "(" [] [] - 1: JS_PARAMETER_LIST@75..75 - 2: R_PAREN@75..77 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@77..79 - 0: L_CURLY@77..78 "{" [] [] - 1: JS_DIRECTIVE_LIST@78..78 - 2: JS_STATEMENT_LIST@78..78 - 3: R_CURLY@78..79 "}" [] [] - 2: R_PAREN@79..80 ")" [] [] - 4: EOF@80..81 "" [Newline("\n")] [] --- -multiple_default_exports_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal duplicate default export declarations - - 1 │ export default (class {}) - > 2 │ export default a + b; - │ ^^^^^^^^^^^^^^ - 3 │ export default (function a() {}) - 4 │ - - i multiple default exports are erroneous - - 1 │ export default (class {}) - > 2 │ export default a + b; - │ ^^^^^^^^^^^^^^ - 3 │ export default (function a() {}) - 4 │ - - i the module's default export is first defined here - - > 1 │ export default (class {}) - │ ^^^^^^^^^^^^^^^^^^ - 2 │ export default a + b; - 3 │ export default (function a() {}) - --- -multiple_default_exports_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal duplicate default export declarations - - 1 │ export default (class {}) - 2 │ export default a + b; - > 3 │ export default (function a() {}) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ - - i multiple default exports are erroneous - - 1 │ export default (class {}) - 2 │ export default a + b; - > 3 │ export default (function a() {}) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ - - i the module's default export is first defined here - - > 1 │ export default (class {}) - │ ^^^^^^^^^^^^^^^^^^ - 2 │ export default a + b; - 3 │ export default (function a() {}) - --- -export default (class {}) -export default a + b; -export default (function a() {}) diff --git a/crates/biome_js_parser/test_data/inline/err/new_exprs.rast b/crates/biome_js_parser/test_data/inline/err/new_exprs.rast deleted file mode 100644 index 05e41bff537c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/new_exprs.rast +++ /dev/null @@ -1,48 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@0..3 "new" [] [], - callee: missing (required), - type_arguments: missing (optional), - arguments: missing (optional), - }, - semicolon_token: SEMICOLON@3..4 ";" [] [], - }, - ], - eof_token: EOF@4..5 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..5 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..4 - 0: JS_EXPRESSION_STATEMENT@0..4 - 0: JS_NEW_EXPRESSION@0..3 - 0: NEW_KW@0..3 "new" [] [] - 1: (empty) - 2: (empty) - 3: (empty) - 1: SEMICOLON@3..4 ";" [] [] - 4: EOF@4..5 "" [Newline("\n")] [] --- -new_exprs.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ';'. - - > 1 │ new; - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ new; - │ ^ - 2 │ - --- -new; diff --git a/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast b/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast deleted file mode 100644 index 631b03eafa5a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast +++ /dev/null @@ -1,104 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@25..29 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@29..30 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@32..33 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - AWAIT_KW@34..41 "await" [Newline("\n")] [Whitespace(" ")], - JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..45 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@45..46 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@46..47 ")" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - ], - eof_token: EOF@48..49 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..49 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..48 - 0: JS_FUNCTION_DECLARATION@0..34 - 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@25..29 - 0: IDENT@25..29 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@29..32 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_PARAMETER_LIST@30..30 - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@32..34 - 0: L_CURLY@32..33 "{" [] [] - 1: JS_DIRECTIVE_LIST@33..33 - 2: JS_STATEMENT_LIST@33..33 - 3: R_CURLY@33..34 "}" [] [] - 1: JS_EXPRESSION_STATEMENT@34..48 - 0: JS_BOGUS_EXPRESSION@34..47 - 0: AWAIT_KW@34..41 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@41..47 - 0: JS_IDENTIFIER_EXPRESSION@41..45 - 0: JS_REFERENCE_IDENTIFIER@41..45 - 0: IDENT@41..45 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@45..47 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@46..46 - 2: R_PAREN@46..47 ")" [] [] - 1: SEMICOLON@47..48 ";" [] [] - 4: EOF@48..49 "" [Newline("\n")] [] --- -no_top_level_await_in_scripts.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `await` is only allowed within async functions and at the top levels of modules. - - 1 │ // SCRIPT - 2 │ async function test() {} - > 3 │ await test(); - │ ^^^^^ - 4 │ - --- -// SCRIPT -async function test() {} -await test(); diff --git a/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.rast b/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.rast deleted file mode 100644 index bcbe6a5b65de..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.rast +++ /dev/null @@ -1,458 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@6..8 "5" [] [Whitespace(" ")], - }, - colon_token: missing (required), - pattern: missing (required), - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@8..10 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_CURLY@10..12 "}" [] [Whitespace(" ")], - EQ@12..14 "=" [] [Whitespace(" ")], - ], - }, - JsBlockStatement { - l_curly_token: L_CURLY@14..16 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@16..20 "eval" [] [], - }, - colon_token: COLON@20..22 ":" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@22..28 "\"foo\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@29..30 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@30..35 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@35..37 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsBogusBinding { - items: [ - IDENT@37..42 "eval" [] [Whitespace(" ")], - ], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@44..46 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@48..52 "eval" [] [], - }, - colon_token: COLON@52..54 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@54..60 "\"foo\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@61..62 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@62..67 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@67..69 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@69..70 "5" [] [], - }, - colon_token: missing (required), - pattern: missing (required), - init: missing (optional), - }, - COMMA@70..72 "," [] [Whitespace(" ")], - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@72..74 "6" [] [Whitespace(" ")], - }, - colon_token: missing (required), - pattern: missing (required), - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@74..76 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@80..84 "eval" [] [], - }, - colon_token: COLON@84..86 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@86..92 "\"foo\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@93..94 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@94..99 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@99..101 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@101..109 "default" [] [Whitespace(" ")], - }, - colon_token: missing (required), - pattern: missing (required), - init: missing (optional), - }, - COMMA@109..111 "," [] [Whitespace(" ")], - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@111..115 "eval" [] [], - }, - colon_token: COLON@115..117 ":" [] [Whitespace(" ")], - pattern: missing (required), - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@117..119 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@119..121 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@121..122 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@122..123 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@123..124 ";" [] [], - }, - ], - eof_token: EOF@124..125 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..125 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..124 - 0: JS_VARIABLE_STATEMENT@0..10 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_OBJECT_BINDING_PATTERN@4..10 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..8 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@6..8 - 0: JS_LITERAL_MEMBER_NAME@6..8 - 0: JS_NUMBER_LITERAL@6..8 "5" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 2: R_CURLY@8..10 "}" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 1: (empty) - 1: JS_BOGUS_STATEMENT@10..14 - 0: R_CURLY@10..12 "}" [] [Whitespace(" ")] - 1: EQ@12..14 "=" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@14..29 - 0: L_CURLY@14..16 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@16..28 - 0: JS_LABELED_STATEMENT@16..28 - 0: JS_LABEL@16..20 - 0: IDENT@16..20 "eval" [] [] - 1: COLON@20..22 ":" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@22..28 - 0: JS_STRING_LITERAL_EXPRESSION@22..28 - 0: JS_STRING_LITERAL@22..28 "\"foo\"" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@28..29 "}" [] [] - 3: JS_EMPTY_STATEMENT@29..30 - 0: SEMICOLON@29..30 ";" [] [] - 4: JS_VARIABLE_STATEMENT@30..62 - 0: JS_VARIABLE_DECLARATION@30..61 - 0: (empty) - 1: LET_KW@30..35 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@35..61 - 0: JS_VARIABLE_DECLARATOR@35..61 - 0: JS_OBJECT_BINDING_PATTERN@35..44 - 0: L_CURLY@35..37 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@37..42 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@37..42 - 0: JS_BOGUS_BINDING@37..42 - 0: IDENT@37..42 "eval" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@42..44 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@44..61 - 0: EQ@44..46 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@46..61 - 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@48..60 - 0: JS_PROPERTY_OBJECT_MEMBER@48..60 - 0: JS_LITERAL_MEMBER_NAME@48..52 - 0: IDENT@48..52 "eval" [] [] - 1: COLON@52..54 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@54..60 - 0: JS_STRING_LITERAL@54..60 "\"foo\"" [] [Whitespace(" ")] - 2: R_CURLY@60..61 "}" [] [] - 1: SEMICOLON@61..62 ";" [] [] - 5: JS_VARIABLE_STATEMENT@62..94 - 0: JS_VARIABLE_DECLARATION@62..93 - 0: (empty) - 1: LET_KW@62..67 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@67..93 - 0: JS_VARIABLE_DECLARATOR@67..93 - 0: JS_OBJECT_BINDING_PATTERN@67..76 - 0: L_CURLY@67..69 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@69..74 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@69..70 - 0: JS_LITERAL_MEMBER_NAME@69..70 - 0: JS_NUMBER_LITERAL@69..70 "5" [] [] - 1: (empty) - 2: (empty) - 3: (empty) - 1: COMMA@70..72 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_PROPERTY@72..74 - 0: JS_LITERAL_MEMBER_NAME@72..74 - 0: JS_NUMBER_LITERAL@72..74 "6" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 2: R_CURLY@74..76 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@76..93 - 0: EQ@76..78 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@78..93 - 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@80..92 - 0: JS_PROPERTY_OBJECT_MEMBER@80..92 - 0: JS_LITERAL_MEMBER_NAME@80..84 - 0: IDENT@80..84 "eval" [] [] - 1: COLON@84..86 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@86..92 - 0: JS_STRING_LITERAL@86..92 "\"foo\"" [] [Whitespace(" ")] - 2: R_CURLY@92..93 "}" [] [] - 1: SEMICOLON@93..94 ";" [] [] - 6: JS_VARIABLE_STATEMENT@94..124 - 0: JS_VARIABLE_DECLARATION@94..123 - 0: (empty) - 1: LET_KW@94..99 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@99..123 - 0: JS_VARIABLE_DECLARATOR@99..123 - 0: JS_OBJECT_BINDING_PATTERN@99..119 - 0: L_CURLY@99..101 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@101..117 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@101..109 - 0: JS_LITERAL_MEMBER_NAME@101..109 - 0: IDENT@101..109 "default" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 1: COMMA@109..111 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_PROPERTY@111..117 - 0: JS_LITERAL_MEMBER_NAME@111..115 - 0: IDENT@111..115 "eval" [] [] - 1: COLON@115..117 ":" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@117..119 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@119..123 - 0: EQ@119..121 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@121..123 - 0: L_CURLY@121..122 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@122..122 - 2: R_CURLY@122..123 "}" [] [] - 1: SEMICOLON@123..124 ";" [] [] - 4: EOF@124..125 "" [Newline("\n")] [] --- -object_binding_pattern.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `}` - - > 1 │ let { 5 } } = { eval: "foo" }; - │ ^ - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - - i Remove } - --- -object_binding_pattern.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Object and Array patterns require initializers. - - > 1 │ let { 5 } } = { eval: "foo" }; - │ ^^^^^ - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - - i This pattern is declared, but it is not given an initialized value. - --- -object_binding_pattern.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '} ='. - - > 1 │ let { 5 } } = { eval: "foo" }; - │ ^^^ - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - - i Expected a statement here. - - > 1 │ let { 5 } } = { eval: "foo" }; - │ ^^^ - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - --- -object_binding_pattern.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `eval` as an identifier in strict mode - - 1 │ let { 5 } } = { eval: "foo" }; - > 2 │ let { eval } = { eval: "foo" }; - │ ^^^^ - 3 │ let { 5, 6 } = { eval: "foo" }; - 4 │ let { default , eval: } = {}; - --- -object_binding_pattern.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `,` - - 1 │ let { 5 } } = { eval: "foo" }; - 2 │ let { eval } = { eval: "foo" }; - > 3 │ let { 5, 6 } = { eval: "foo" }; - │ ^ - 4 │ let { default , eval: } = {}; - 5 │ - - i Remove , - --- -object_binding_pattern.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `}` - - 1 │ let { 5 } } = { eval: "foo" }; - 2 │ let { eval } = { eval: "foo" }; - > 3 │ let { 5, 6 } = { eval: "foo" }; - │ ^ - 4 │ let { default , eval: } = {}; - 5 │ - - i Remove } - --- -object_binding_pattern.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `,` - - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - > 4 │ let { default , eval: } = {}; - │ ^ - 5 │ - - i Remove , - --- -object_binding_pattern.js:4:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found '}'. - - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - > 4 │ let { default , eval: } = {}; - │ ^ - 5 │ - - i Expected an identifier, an array pattern, or an object pattern here. - - 2 │ let { eval } = { eval: "foo" }; - 3 │ let { 5, 6 } = { eval: "foo" }; - > 4 │ let { default , eval: } = {}; - │ ^ - 5 │ - --- -let { 5 } } = { eval: "foo" }; -let { eval } = { eval: "foo" }; -let { 5, 6 } = { eval: "foo" }; -let { default , eval: } = {}; diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_err.rast b/crates/biome_js_parser/test_data/inline/err/object_expr_err.rast deleted file mode 100644 index efcfe4a8163c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_err.rast +++ /dev/null @@ -1,207 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - missing element, - COMMA@9..11 "," [] [Whitespace(" ")], - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@11..14 "foo" [] [], - }, - }, - ], - r_curly_token: R_CURLY@14..15 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@20..22 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@26..30 "foo" [] [Whitespace(" ")], - }, - }, - missing separator, - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@30..34 "bar" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@40..42 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@46..49 "foo" [] [], - }, - }, - ], - r_curly_token: missing (required), - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_VARIABLE_STATEMENT@0..15 - 0: JS_VARIABLE_DECLARATION@0..15 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..15 - 0: JS_VARIABLE_DECLARATOR@4..15 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..15 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..15 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..14 - 0: (empty) - 1: COMMA@9..11 "," [] [Whitespace(" ")] - 2: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@11..14 - 0: JS_REFERENCE_IDENTIFIER@11..14 - 0: IDENT@11..14 "foo" [] [] - 2: R_CURLY@14..15 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@15..35 - 0: JS_VARIABLE_DECLARATION@15..35 - 0: (empty) - 1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@20..35 - 0: JS_VARIABLE_DECLARATOR@20..35 - 0: JS_IDENTIFIER_BINDING@20..22 - 0: IDENT@20..22 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@22..35 - 0: EQ@22..24 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@24..35 - 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@26..34 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@26..30 - 0: JS_REFERENCE_IDENTIFIER@26..30 - 0: IDENT@26..30 "foo" [] [Whitespace(" ")] - 1: (empty) - 2: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@30..34 - 0: JS_REFERENCE_IDENTIFIER@30..34 - 0: IDENT@30..34 "bar" [] [Whitespace(" ")] - 2: R_CURLY@34..35 "}" [] [] - 1: (empty) - 2: JS_VARIABLE_STATEMENT@35..49 - 0: JS_VARIABLE_DECLARATION@35..49 - 0: (empty) - 1: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@40..49 - 0: JS_VARIABLE_DECLARATOR@40..49 - 0: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@42..49 - 0: EQ@42..44 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@44..49 - 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@46..49 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@46..49 - 0: JS_REFERENCE_IDENTIFIER@46..49 - 0: IDENT@46..49 "foo" [] [] - 2: (empty) - 1: (empty) - 4: EOF@49..50 "" [Newline("\n")] [] --- -object_expr_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `bar` - - 1 │ let a = {, foo} - > 2 │ let b = { foo bar } - │ ^^^ - 3 │ let b = { foo - 4 │ - - i Remove bar - --- -object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead the file ends - - 2 │ let b = { foo bar } - 3 │ let b = { foo - > 4 │ - │ - - i the file ends here - - 2 │ let b = { foo bar } - 3 │ let b = { foo - > 4 │ - │ - --- -let a = {, foo} -let b = { foo bar } -let b = { foo diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast b/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast deleted file mode 100644 index 9418d1c9f636..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast +++ /dev/null @@ -1,220 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - SLASH@10..11 "/" [] [], - ], - }, - COLON@11..13 ":" [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..14 "6" [] [], - }, - ], - }, - COMMA@14..16 "," [] [Whitespace(" ")], - JsBogusMember { - items: [ - JsBogus { - items: [ - SLASH@16..17 "/" [] [], - ], - }, - COLON@17..19 ":" [] [Whitespace(" ")], - JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@19..25 "/foo/" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@26..31 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@31..33 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@33..35 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@35..36 "{" [] [], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - L_CURLY@36..37 "{" [] [], - ], - }, - ], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_CURLY@38..39 "}" [] [], - ], - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_VARIABLE_STATEMENT@0..26 - 0: JS_VARIABLE_DECLARATION@0..26 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..26 - 0: JS_VARIABLE_DECLARATOR@4..26 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..26 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..26 - 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@10..25 - 0: JS_BOGUS_MEMBER@10..14 - 0: JS_BOGUS@10..11 - 0: SLASH@10..11 "/" [] [] - 1: COLON@11..13 ":" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@13..14 - 0: JS_NUMBER_LITERAL@13..14 "6" [] [] - 1: COMMA@14..16 "," [] [Whitespace(" ")] - 2: JS_BOGUS_MEMBER@16..25 - 0: JS_BOGUS@16..17 - 0: SLASH@16..17 "/" [] [] - 1: COLON@17..19 ":" [] [Whitespace(" ")] - 2: JS_REGEX_LITERAL_EXPRESSION@19..25 - 0: JS_REGEX_LITERAL@19..25 "/foo/" [] [Whitespace(" ")] - 2: R_CURLY@25..26 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@26..38 - 0: JS_VARIABLE_DECLARATION@26..38 - 0: (empty) - 1: LET_KW@26..31 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@31..38 - 0: JS_VARIABLE_DECLARATOR@31..38 - 0: JS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@33..38 - 0: EQ@33..35 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@35..38 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@36..37 - 0: JS_BOGUS_MEMBER@36..37 - 0: L_CURLY@36..37 "{" [] [] - 2: R_CURLY@37..38 "}" [] [] - 1: (empty) - 2: JS_BOGUS_STATEMENT@38..39 - 0: R_CURLY@38..39 "}" [] [] - 4: EOF@39..40 "" [Newline("\n")] [] --- -object_expr_error_prop_name.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '/'. - - > 1 │ let a = { /: 6, /: /foo/ } - │ ^ - 2 │ let b = {{}} - 3 │ - - i Expected a property, a shorthand property, a getter, a setter, or a method here. - - > 1 │ let a = { /: 6, /: /foo/ } - │ ^ - 2 │ let b = {{}} - 3 │ - --- -object_expr_error_prop_name.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '/'. - - > 1 │ let a = { /: 6, /: /foo/ } - │ ^ - 2 │ let b = {{}} - 3 │ - - i Expected a property, a shorthand property, a getter, a setter, or a method here. - - > 1 │ let a = { /: 6, /: /foo/ } - │ ^ - 2 │ let b = {{}} - 3 │ - --- -object_expr_error_prop_name.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{'. - - 1 │ let a = { /: 6, /: /foo/ } - > 2 │ let b = {{}} - │ ^ - 3 │ - - i Expected a property, a shorthand property, a getter, a setter, or a method here. - - 1 │ let a = { /: 6, /: /foo/ } - > 2 │ let b = {{}} - │ ^ - 3 │ - --- -object_expr_error_prop_name.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - 1 │ let a = { /: 6, /: /foo/ } - > 2 │ let b = {{}} - │ ^ - 3 │ - - i Expected a statement here. - - 1 │ let a = { /: 6, /: /foo/ } - > 2 │ let b = {{}} - │ ^ - 3 │ - --- -let a = { /: 6, /: /foo/ } -let b = {{}} diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_method.rast b/crates/biome_js_parser/test_data/inline/err/object_expr_method.rast deleted file mode 100644 index 2e5a461ee4e4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_method.rast +++ /dev/null @@ -1,85 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@10..13 "foo" [] [], - }, - }, - missing separator, - JsBogusMember { - items: [ - R_PAREN@13..15 ")" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@15..16 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@16..17 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..17 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..16 - 0: JS_VARIABLE_STATEMENT@0..16 - 0: JS_VARIABLE_DECLARATION@0..16 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..16 - 0: JS_VARIABLE_DECLARATOR@4..16 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..16 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..16 - 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@10..15 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@10..13 - 0: JS_REFERENCE_IDENTIFIER@10..13 - 0: IDENT@10..13 "foo" [] [] - 1: (empty) - 2: JS_BOGUS_MEMBER@13..15 - 0: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 2: R_CURLY@15..16 "}" [] [] - 1: (empty) - 4: EOF@16..17 "" [Newline("\n")] [] --- -object_expr_method.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `)` - - > 1 │ let b = { foo) } - │ ^ - 2 │ - - i Remove ) - --- -let b = { foo) } diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast b/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast deleted file mode 100644 index 467cf8d56858..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast +++ /dev/null @@ -1,80 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "d" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@9..10 "5" [] [], - }, - colon_token: missing (required), - value: missing (required), - }, - ], - r_curly_token: R_CURLY@10..11 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..11 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..11 - 0: JS_VARIABLE_DECLARATOR@4..11 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "d" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..11 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..11 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..10 - 0: JS_PROPERTY_OBJECT_MEMBER@9..10 - 0: JS_LITERAL_MEMBER_NAME@9..10 - 0: JS_NUMBER_LITERAL@9..10 "5" [] [] - 1: (empty) - 2: (empty) - 2: R_CURLY@10..11 "}" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] --- -object_expr_non_ident_literal_prop.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `}` - - > 1 │ let d = {5} - │ ^ - 2 │ - - i Remove } - --- -let d = {5} diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_setter.rast b/crates/biome_js_parser/test_data/inline/err/object_expr_setter.rast deleted file mode 100644 index 59c622f44880..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_setter.rast +++ /dev/null @@ -1,122 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsSetterObjectMember { - set_token: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..18 "foo" [] [], - }, - l_paren_token: L_PAREN@18..19 "(" [] [], - parameter: missing (required), - comma_token: missing (optional), - r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@21..22 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@22..34 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@34..35 "5" [] [], - }, - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - ], - r_curly_token: R_CURLY@36..39 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@39..41 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@41..42 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..42 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..41 - 0: JS_VARIABLE_STATEMENT@0..41 - 0: JS_VARIABLE_DECLARATION@0..41 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..41 - 0: JS_VARIABLE_DECLARATOR@4..41 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..41 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..41 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..39 - 0: JS_SETTER_OBJECT_MEMBER@9..39 - 0: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..18 - 0: IDENT@15..18 "foo" [] [] - 2: L_PAREN@18..19 "(" [] [] - 3: (empty) - 4: (empty) - 5: R_PAREN@19..21 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@21..39 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_DIRECTIVE_LIST@22..22 - 2: JS_STATEMENT_LIST@22..36 - 0: JS_RETURN_STATEMENT@22..36 - 0: RETURN_KW@22..34 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@34..35 - 0: JS_NUMBER_LITERAL@34..35 "5" [] [] - 2: SEMICOLON@35..36 ";" [] [] - 3: R_CURLY@36..39 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@39..41 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@41..42 "" [Newline("\n")] [] --- -object_expr_setter.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parameter but instead found ')'. - - 1 │ let b = { - > 2 │ set foo() { - │ ^ - 3 │ return 5; - 4 │ } - - i Expected a parameter here. - - 1 │ let b = { - > 2 │ set foo() { - │ ^ - 3 │ return 5; - 4 │ } - --- -let b = { - set foo() { - return 5; - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.rast b/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.rast deleted file mode 100644 index 7fa0476ead3b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.rast +++ /dev/null @@ -1,275 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@6..9 "foo" [] [], - }, - colon_token: COLON@9..11 ":" [] [Whitespace(" ")], - pattern: missing (required), - init: missing (optional), - }, - COMMA@11..13 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@13..17 "bar" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@19..21 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@21..22 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: missing (required), - colon_token: COLON@30..32 ":" [] [Whitespace(" ")], - pattern: JsIdentifierBinding { - name_token: IDENT@32..38 "lorem" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@40..47 "\"test\"" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@47..49 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@49..51 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@51..52 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@53..58 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@58..60 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - missing element, - COMMA@60..62 "," [] [Whitespace(" ")], - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@62..67 "ipsum" [] [], - }, - colon_token: COLON@67..69 ":" [] [Whitespace(" ")], - pattern: JsIdentifierBinding { - name_token: IDENT@69..74 "bazz" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@74..76 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@78..79 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@79..80 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@80..81 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..81 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..80 - 0: JS_VARIABLE_STATEMENT@0..23 - 0: JS_VARIABLE_DECLARATION@0..23 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..23 - 0: JS_VARIABLE_DECLARATOR@4..23 - 0: JS_OBJECT_BINDING_PATTERN@4..19 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..17 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@6..11 - 0: JS_LITERAL_MEMBER_NAME@6..9 - 0: IDENT@6..9 "foo" [] [] - 1: COLON@9..11 ":" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 1: COMMA@11..13 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@13..17 - 0: JS_IDENTIFIER_BINDING@13..17 - 0: IDENT@13..17 "bar" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@19..23 - 0: EQ@19..21 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@21..23 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@22..22 - 2: R_CURLY@22..23 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@23..53 - 0: JS_VARIABLE_DECLARATION@23..53 - 0: (empty) - 1: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@28..53 - 0: JS_VARIABLE_DECLARATOR@28..53 - 0: JS_OBJECT_BINDING_PATTERN@28..49 - 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@30..47 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@30..47 - 0: (empty) - 1: COLON@30..32 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@32..38 - 0: IDENT@32..38 "lorem" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@38..47 - 0: EQ@38..40 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@40..47 - 0: JS_STRING_LITERAL@40..47 "\"test\"" [] [Whitespace(" ")] - 2: R_CURLY@47..49 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@49..53 - 0: EQ@49..51 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@51..53 - 0: L_CURLY@51..52 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@52..52 - 2: R_CURLY@52..53 "}" [] [] - 1: (empty) - 2: JS_VARIABLE_STATEMENT@53..80 - 0: JS_VARIABLE_DECLARATION@53..80 - 0: (empty) - 1: LET_KW@53..58 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@58..80 - 0: JS_VARIABLE_DECLARATOR@58..80 - 0: JS_OBJECT_BINDING_PATTERN@58..76 - 0: L_CURLY@58..60 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@60..74 - 0: (empty) - 1: COMMA@60..62 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_PROPERTY@62..74 - 0: JS_LITERAL_MEMBER_NAME@62..67 - 0: IDENT@62..67 "ipsum" [] [] - 1: COLON@67..69 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@69..74 - 0: IDENT@69..74 "bazz" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@74..76 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@76..80 - 0: EQ@76..78 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@78..80 - 0: L_CURLY@78..79 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@79..79 - 2: R_CURLY@79..80 "}" [] [] - 1: (empty) - 4: EOF@80..81 "" [Newline("\n")] [] --- -object_property_binding_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found ','. - - > 1 │ let { foo: , bar } = {} - │ ^ - 2 │ let { : lorem = "test" } = {} - 3 │ let { , ipsum: bazz } = {} - - i Expected an identifier, an array pattern, or an object pattern here. - - > 1 │ let { foo: , bar } = {} - │ ^ - 2 │ let { : lorem = "test" } = {} - 3 │ let { , ipsum: bazz } = {} - --- -object_property_binding_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. - - 1 │ let { foo: , bar } = {} - > 2 │ let { : lorem = "test" } = {} - │ ^ - 3 │ let { , ipsum: bazz } = {} - 4 │ - - i Expected an identifier, a string literal, a number literal, or a computed property here. - - 1 │ let { foo: , bar } = {} - > 2 │ let { : lorem = "test" } = {} - │ ^ - 3 │ let { , ipsum: bazz } = {} - 4 │ - --- -object_property_binding_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a member name, or a rest pattern but instead found ','. - - 1 │ let { foo: , bar } = {} - 2 │ let { : lorem = "test" } = {} - > 3 │ let { , ipsum: bazz } = {} - │ ^ - 4 │ - - i Expected an identifier, a member name, or a rest pattern here. - - 1 │ let { foo: , bar } = {} - 2 │ let { : lorem = "test" } = {} - > 3 │ let { , ipsum: bazz } = {} - │ ^ - 4 │ - --- -let { foo: , bar } = {} -let { : lorem = "test" } = {} -let { , ipsum: bazz } = {} diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.rast b/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.rast deleted file mode 100644 index 8dd58860d9d5..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.rast +++ /dev/null @@ -1,249 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@6..8 "a" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - missing separator, - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@8..10 "b" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@10..12 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@12..14 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..15 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: missing (required), - init: JsInitializerClause { - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@24..31 "\"test\"" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@33..35 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@36..41 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - missing element, - COMMA@43..45 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@45..47 "d" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@47..49 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@49..51 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@51..52 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@52..53 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..53 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..52 - 0: JS_VARIABLE_STATEMENT@0..15 - 0: JS_VARIABLE_DECLARATION@0..15 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..15 - 0: JS_VARIABLE_DECLARATOR@4..15 - 0: JS_OBJECT_BINDING_PATTERN@4..12 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..10 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@6..8 - 0: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "a" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@8..10 - 0: JS_IDENTIFIER_BINDING@8..10 - 0: IDENT@8..10 "b" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@10..12 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@12..15 - 0: EQ@12..14 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@14..15 - 0: JS_REFERENCE_IDENTIFIER@14..15 - 0: IDENT@14..15 "c" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@15..36 - 0: JS_VARIABLE_DECLARATION@15..36 - 0: (empty) - 1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@20..36 - 0: JS_VARIABLE_DECLARATOR@20..36 - 0: JS_OBJECT_BINDING_PATTERN@20..33 - 0: L_CURLY@20..22 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@22..31 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@22..31 - 0: (empty) - 1: JS_INITIALIZER_CLAUSE@22..31 - 0: EQ@22..24 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@24..31 - 0: JS_STRING_LITERAL@24..31 "\"test\"" [] [Whitespace(" ")] - 2: R_CURLY@31..33 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@33..36 - 0: EQ@33..35 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "c" [] [] - 1: (empty) - 2: JS_VARIABLE_STATEMENT@36..52 - 0: JS_VARIABLE_DECLARATION@36..52 - 0: (empty) - 1: LET_KW@36..41 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@41..52 - 0: JS_VARIABLE_DECLARATOR@41..52 - 0: JS_OBJECT_BINDING_PATTERN@41..49 - 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@43..47 - 0: (empty) - 1: COMMA@43..45 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@45..47 - 0: JS_IDENTIFIER_BINDING@45..47 - 0: IDENT@45..47 "d" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@47..49 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@49..52 - 0: EQ@49..51 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@51..52 - 0: JS_REFERENCE_IDENTIFIER@51..52 - 0: IDENT@51..52 "c" [] [] - 1: (empty) - 4: EOF@52..53 "" [Newline("\n")] [] --- -object_shorthand_property_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `b` - - > 1 │ let { a b } = c - │ ^ - 2 │ let { = "test" } = c - 3 │ let { , d } = c - - i Remove b - --- -object_shorthand_property_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found '='. - - 1 │ let { a b } = c - > 2 │ let { = "test" } = c - │ ^ - 3 │ let { , d } = c - 4 │ - - i Expected an identifier here. - - 1 │ let { a b } = c - > 2 │ let { = "test" } = c - │ ^ - 3 │ let { , d } = c - 4 │ - --- -object_shorthand_property_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a member name, or a rest pattern but instead found ','. - - 1 │ let { a b } = c - 2 │ let { = "test" } = c - > 3 │ let { , d } = c - │ ^ - 4 │ - - i Expected an identifier, a member name, or a rest pattern here. - - 1 │ let { a b } = c - 2 │ let { = "test" } = c - > 3 │ let { , d } = c - │ ^ - 4 │ - --- -let { a b } = c -let { = "test" } = c -let { , d } = c diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast b/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast deleted file mode 100644 index bc94df09cad7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - JsReferenceIdentifier { - value_token: IDENT@3..9 "arrow" [] [Whitespace(" ")], - }, - EQ@9..11 "=" [] [Whitespace(" ")], - JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@11..12 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@12..14 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], - }, - }, - ], - }, - ], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - r_paren_token: R_PAREN@21..22 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@22..23 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..23 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..22 - 0: JS_EXPRESSION_STATEMENT@0..22 - 0: JS_PARENTHESIZED_EXPRESSION@0..22 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..21 - 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@3..20 - 0: JS_BOGUS_MEMBER@3..20 - 0: JS_REFERENCE_IDENTIFIER@3..9 - 0: IDENT@3..9 "arrow" [] [Whitespace(" ")] - 1: EQ@9..11 "=" [] [Whitespace(" ")] - 2: JS_ARROW_FUNCTION_EXPRESSION@11..20 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@11..14 - 0: L_PAREN@11..12 "(" [] [] - 1: JS_PARAMETER_LIST@12..12 - 2: R_PAREN@12..14 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@17..20 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..18 - 3: R_CURLY@18..20 "}" [] [Whitespace(" ")] - 2: R_CURLY@20..21 "}" [] [] - 2: R_PAREN@21..22 ")" [] [] - 1: (empty) - 4: EOF@22..23 "" [Newline("\n")] [] --- -object_shorthand_with_initializer.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. - - > 1 │ ({ arrow = () => {} }) - │ ^ - 2 │ - --- -({ arrow = () => {} }) diff --git a/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast b/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast deleted file mode 100644 index b24531336c74..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast +++ /dev/null @@ -1,185 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@10..14 "test" [] [], - }, - colon_token: COLON@14..16 ":" [] [Whitespace(" ")], - value: JsNullLiteralExpression { - value_token: NULL_KW@16..21 "null" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..25 "a" [Newline("\n")] [], - }, - }, - operator_token: DOT@25..26 "." [] [], - member: JsName { - value_token: IDENT@26..30 "test" [] [], - }, - }, - operator_token: QUESTIONDOT@30..32 "?." [] [], - member: missing (required), - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..35 "a" [Newline("\n")] [], - }, - }, - operator_token: DOT@35..36 "." [] [], - member: JsName { - value_token: IDENT@36..40 "test" [] [], - }, - }, - operator_token: QUESTIONDOT@40..42 "?." [] [], - member: missing (required), - }, - operator_token: L_ANGLE@42..43 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..45 "ab" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - ], - eof_token: EOF@46..47 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_VARIABLE_STATEMENT@0..23 - 0: JS_VARIABLE_DECLARATION@0..22 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..22 - 0: JS_VARIABLE_DECLARATOR@4..22 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..22 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..22 - 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@10..21 - 0: JS_PROPERTY_OBJECT_MEMBER@10..21 - 0: JS_LITERAL_MEMBER_NAME@10..14 - 0: IDENT@10..14 "test" [] [] - 1: COLON@14..16 ":" [] [Whitespace(" ")] - 2: JS_NULL_LITERAL_EXPRESSION@16..21 - 0: NULL_KW@16..21 "null" [] [Whitespace(" ")] - 2: R_CURLY@21..22 "}" [] [] - 1: SEMICOLON@22..23 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@23..33 - 0: JS_STATIC_MEMBER_EXPRESSION@23..32 - 0: JS_STATIC_MEMBER_EXPRESSION@23..30 - 0: JS_IDENTIFIER_EXPRESSION@23..25 - 0: JS_REFERENCE_IDENTIFIER@23..25 - 0: IDENT@23..25 "a" [Newline("\n")] [] - 1: DOT@25..26 "." [] [] - 2: JS_NAME@26..30 - 0: IDENT@26..30 "test" [] [] - 1: QUESTIONDOT@30..32 "?." [] [] - 2: (empty) - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..46 - 0: JS_BINARY_EXPRESSION@33..45 - 0: JS_STATIC_MEMBER_EXPRESSION@33..42 - 0: JS_STATIC_MEMBER_EXPRESSION@33..40 - 0: JS_IDENTIFIER_EXPRESSION@33..35 - 0: JS_REFERENCE_IDENTIFIER@33..35 - 0: IDENT@33..35 "a" [Newline("\n")] [] - 1: DOT@35..36 "." [] [] - 2: JS_NAME@36..40 - 0: IDENT@36..40 "test" [] [] - 1: QUESTIONDOT@40..42 "?." [] [] - 2: (empty) - 1: L_ANGLE@42..43 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@43..45 - 0: JS_REFERENCE_IDENTIFIER@43..45 - 0: IDENT@43..45 "ab" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 4: EOF@46..47 "" [Newline("\n")] [] --- -optional_chain_call_without_arguments.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found ';'. - - 1 │ let a = { test: null }; - > 2 │ a.test?.; - │ ^ - 3 │ a.test?. 2 │ a.test?.; - │ ^ - 3 │ a.test?. 3 │ a.test?. 3 │ a.test?. 1 │ class B { foo?; } - │ ^ - 2 │ - --- -class B { foo?; } diff --git a/crates/biome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast b/crates/biome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast deleted file mode 100644 index 485934e16c2e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast +++ /dev/null @@ -1,428 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@1..3 "5" [] [Whitespace(" ")], - }, - operator_token: PLUS@3..5 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@5..6 "5" [] [], - }, - }, - r_paren_token: R_PAREN@6..8 ")" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - FAT_ARROW@8..11 "=>" [] [Whitespace(" ")], - ], - }, - JsBlockStatement { - l_curly_token: L_CURLY@11..12 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@12..13 "}" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..15 "(" [Newline("\n")] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@16..18 "," [] [Whitespace(" ")], - missing element, - COMMA@18..19 "," [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@19..20 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@27..29 "(" [Newline("\n")] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@29..30 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@32..33 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@35..37 "=>" [] [], - body: missing (required), - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..40 "(" [Newline("\n")] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - JsIdentifierBinding { - name_token: IDENT@40..41 "a" [] [], - }, - JsBogus { - items: [ - COLON@41..43 ":" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@43..49 "string" [] [], - }, - ], - }, - ], - }, - ], - r_paren_token: missing (required), - }, - return_type_annotation: missing (optional), - fat_arrow_token: missing (required), - body: missing (required), - }, - semicolon_token: SEMICOLON@49..50 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@50..52 "(" [Newline("\n")] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@52..53 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@53..55 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@55..56 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@57..62 "=>" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@62..63 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@63..64 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_PARENTHESIZED_EXPRESSION@0..8 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_BINARY_EXPRESSION@1..6 - 0: JS_NUMBER_LITERAL_EXPRESSION@1..3 - 0: JS_NUMBER_LITERAL@1..3 "5" [] [Whitespace(" ")] - 1: PLUS@3..5 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@5..6 - 0: JS_NUMBER_LITERAL@5..6 "5" [] [] - 2: R_PAREN@6..8 ")" [] [Whitespace(" ")] - 1: (empty) - 1: JS_BOGUS_STATEMENT@8..11 - 0: FAT_ARROW@8..11 "=>" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@11..13 - 0: L_CURLY@11..12 "{" [] [] - 1: JS_STATEMENT_LIST@12..12 - 2: R_CURLY@12..13 "}" [] [] - 3: JS_EXPRESSION_STATEMENT@13..27 - 0: JS_ARROW_FUNCTION_EXPRESSION@13..27 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@13..22 - 0: L_PAREN@13..15 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@15..20 - 0: JS_FORMAL_PARAMETER@15..16 - 0: JS_DECORATOR_LIST@15..15 - 1: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@16..18 "," [] [Whitespace(" ")] - 2: (empty) - 3: COMMA@18..19 "," [] [] - 4: JS_FORMAL_PARAMETER@19..20 - 0: JS_DECORATOR_LIST@19..19 - 1: JS_IDENTIFIER_BINDING@19..20 - 0: IDENT@19..20 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..26 - 3: R_CURLY@26..27 "}" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@27..38 - 0: JS_ARROW_FUNCTION_EXPRESSION@27..37 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@27..35 - 0: L_PAREN@27..29 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@29..33 - 0: JS_FORMAL_PARAMETER@29..30 - 0: JS_DECORATOR_LIST@29..29 - 1: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@30..32 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@32..33 - 0: JS_DECORATOR_LIST@32..32 - 1: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@35..37 "=>" [] [] - 5: (empty) - 1: SEMICOLON@37..38 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@38..50 - 0: JS_ARROW_FUNCTION_EXPRESSION@38..49 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@38..49 - 0: L_PAREN@38..40 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@40..49 - 0: JS_BOGUS_PARAMETER@40..49 - 0: JS_DECORATOR_LIST@40..40 - 1: JS_IDENTIFIER_BINDING@40..41 - 0: IDENT@40..41 "a" [] [] - 2: JS_BOGUS@41..49 - 0: COLON@41..43 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@43..49 - 0: STRING_KW@43..49 "string" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 1: SEMICOLON@49..50 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@50..64 - 0: JS_ARROW_FUNCTION_EXPRESSION@50..64 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@50..57 - 0: L_PAREN@50..52 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@52..56 - 0: JS_FORMAL_PARAMETER@52..53 - 0: JS_DECORATOR_LIST@52..52 - 1: JS_IDENTIFIER_BINDING@52..53 - 0: IDENT@52..53 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@53..55 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@55..56 - 0: JS_DECORATOR_LIST@55..55 - 1: JS_IDENTIFIER_BINDING@55..56 - 0: IDENT@55..56 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@56..57 ")" [] [] - 3: (empty) - 4: FAT_ARROW@57..62 "=>" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@62..64 - 0: L_CURLY@62..63 "{" [] [] - 1: JS_DIRECTIVE_LIST@63..63 - 2: JS_STATEMENT_LIST@63..63 - 3: R_CURLY@63..64 "}" [] [] - 1: (empty) - 4: EOF@64..65 "" [Newline("\n")] [] --- -paren_or_arrow_expr_invalid_params.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ (5 + 5) => {} - │ ^^ - 2 │ (a, ,b) => {} - 3 │ (a, b) =>; - - i An explicit or implicit semicolon is expected here... - - > 1 │ (5 + 5) => {} - │ ^^ - 2 │ (a, ,b) => {} - 3 │ (a, b) =>; - - i ...Which is required to end this statement - - > 1 │ (5 + 5) => {} - │ ^^^^^^^^^^ - 2 │ (a, ,b) => {} - 3 │ (a, b) =>; - --- -paren_or_arrow_expr_invalid_params.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parameter but instead found ','. - - 1 │ (5 + 5) => {} - > 2 │ (a, ,b) => {} - │ ^ - 3 │ (a, b) =>; - 4 │ (a: string; - - i Expected a parameter here. - - 1 │ (5 + 5) => {} - > 2 │ (a, ,b) => {} - │ ^ - 3 │ (a, b) =>; - 4 │ (a: string; - --- -paren_or_arrow_expr_invalid_params.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a function body, or an expression but instead found ';'. - - 1 │ (5 + 5) => {} - 2 │ (a, ,b) => {} - > 3 │ (a, b) =>; - │ ^ - 4 │ (a: string; - 5 │ (a, b) - - i Expected a function body, or an expression here. - - 1 │ (5 + 5) => {} - 2 │ (a, ,b) => {} - > 3 │ (a, b) =>; - │ ^ - 4 │ (a: string; - 5 │ (a, b) - --- -paren_or_arrow_expr_invalid_params.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 2 │ (a, ,b) => {} - 3 │ (a, b) =>; - > 4 │ (a: string; - │ ^^^^^^^^ - 5 │ (a, b) - 6 │ => {} - - i TypeScript only syntax - --- -paren_or_arrow_expr_invalid_params.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `;` - - 2 │ (a, ,b) => {} - 3 │ (a, b) =>; - > 4 │ (a: string; - │ ^ - 5 │ (a, b) - 6 │ => {} - - i Remove ; - --- -paren_or_arrow_expr_invalid_params.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Line terminator not permitted before arrow. - - 4 │ (a: string; - 5 │ (a, b) - > 6 │ => {} - │ ^^ - 7 │ - --- -(5 + 5) => {} -(a, ,b) => {} -(a, b) =>; -(a: string; -(a, b) - => {} diff --git a/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast b/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast deleted file mode 100644 index 85e7a15ee417..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast +++ /dev/null @@ -1,98 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@0..4 "let" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - EQ@6..8 "=" [] [Whitespace(" ")], - JsBogus { - items: [ - ERROR_TOKEN@8..9 "\\" [] [], - ], - }, - ], - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@9..11 ";" [] [Whitespace(" ")], - ], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..14 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@14..15 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@15..16 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: JS_BOGUS_STATEMENT@0..11 - 0: JS_BOGUS@0..9 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_BOGUS@4..9 - 0: JS_BOGUS@4..9 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: JS_BOGUS@6..9 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_BOGUS@8..9 - 0: ERROR_TOKEN@8..9 "\\" [] [] - 1: SEMICOLON@9..11 ";" [] [Whitespace(" ")] - 1: JS_EXPRESSION_STATEMENT@11..17 - 0: JS_CALL_EXPRESSION@11..16 - 0: JS_IDENTIFIER_EXPRESSION@11..14 - 0: JS_REFERENCE_IDENTIFIER@11..14 - 0: IDENT@11..14 "foo" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@14..16 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@15..15 - 2: R_PAREN@15..16 ")" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 4: EOF@17..18 "" [Newline("\n")] [] --- -primary_expr_invalid_recovery.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unexpected token `\` - - > 1 │ let a = \; foo(); - │ ^ - 2 │ - --- -let a = \; foo(); diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast b/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast deleted file mode 100644 index 567dd3388565..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast +++ /dev/null @@ -1,257 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [], - id_token: IDENT@12..16 "prop" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsInExpression { - property: JsInExpression { - property: JsPrivateName { - hash_token: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [], - value_token: IDENT@32..37 "prop" [] [Whitespace(" ")], - }, - in_token: IN_KW@37..40 "in" [] [Whitespace(" ")], - object: JsBogusExpression { - items: [ - HASH@40..41 "#" [] [], - IDENT@41..46 "prop" [] [Whitespace(" ")], - ], - }, - }, - in_token: IN_KW@46..49 "in" [] [Whitespace(" ")], - object: JsThisExpression { - this_token: THIS_KW@49..53 "this" [] [], - }, - }, - semicolon_token: SEMICOLON@53..54 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@54..60 "5" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - operator_token: PLUS@60..62 "+" [] [Whitespace(" ")], - right: JsBogusExpression { - items: [ - HASH@62..63 "#" [] [], - IDENT@63..67 "prop" [] [], - ], - }, - }, - semicolon_token: SEMICOLON@67..68 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - HASH@68..73 "#" [Newline("\n"), Whitespace(" ")] [], - IDENT@73..77 "prop" [] [], - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBogusExpression { - items: [ - HASH@77..82 "#" [Newline("\n"), Whitespace(" ")] [], - IDENT@82..87 "prop" [] [Whitespace(" ")], - ], - }, - operator_token: PLUS@87..89 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@89..90 "5" [] [], - }, - }, - semicolon_token: SEMICOLON@90..91 ";" [] [], - }, - ], - r_curly_token: R_CURLY@91..94 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@94..96 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@96..97 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..97 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..96 - 0: JS_CLASS_DECLARATION@0..96 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..94 - 0: JS_PROPERTY_CLASS_MEMBER@9..17 - 0: JS_PROPERTY_MODIFIER_LIST@9..9 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@9..16 - 0: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [] - 1: IDENT@12..16 "prop" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@16..17 ";" [] [] - 1: JS_METHOD_CLASS_MEMBER@17..94 - 0: JS_METHOD_MODIFIER_LIST@17..17 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@17..23 - 0: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@26..94 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..91 - 0: JS_EXPRESSION_STATEMENT@27..54 - 0: JS_IN_EXPRESSION@27..53 - 0: JS_IN_EXPRESSION@27..46 - 0: JS_PRIVATE_NAME@27..37 - 0: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@32..37 "prop" [] [Whitespace(" ")] - 1: IN_KW@37..40 "in" [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@40..46 - 0: HASH@40..41 "#" [] [] - 1: IDENT@41..46 "prop" [] [Whitespace(" ")] - 1: IN_KW@46..49 "in" [] [Whitespace(" ")] - 2: JS_THIS_EXPRESSION@49..53 - 0: THIS_KW@49..53 "this" [] [] - 1: SEMICOLON@53..54 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@54..68 - 0: JS_BINARY_EXPRESSION@54..67 - 0: JS_NUMBER_LITERAL_EXPRESSION@54..60 - 0: JS_NUMBER_LITERAL@54..60 "5" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: PLUS@60..62 "+" [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@62..67 - 0: HASH@62..63 "#" [] [] - 1: IDENT@63..67 "prop" [] [] - 1: SEMICOLON@67..68 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@68..77 - 0: JS_BOGUS_EXPRESSION@68..77 - 0: HASH@68..73 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@73..77 "prop" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@77..91 - 0: JS_BINARY_EXPRESSION@77..90 - 0: JS_BOGUS_EXPRESSION@77..87 - 0: HASH@77..82 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@82..87 "prop" [] [Whitespace(" ")] - 1: PLUS@87..89 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@89..90 - 0: JS_NUMBER_LITERAL@89..90 "5" [] [] - 1: SEMICOLON@90..91 ";" [] [] - 3: R_CURLY@91..94 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@94..96 "}" [Newline("\n")] [] - 4: EOF@96..97 "" [Newline("\n")] [] --- -private_name_presence_check_recursive.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Private names are only allowed on the left side of a 'in' expression - - 2 │ #prop; - 3 │ test() { - > 4 │ #prop in #prop in this; - │ ^^^^^ - 5 │ 5 + #prop; - 6 │ #prop - --- -private_name_presence_check_recursive.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Private names are only allowed on the left side of a 'in' expression - - 3 │ test() { - 4 │ #prop in #prop in this; - > 5 │ 5 + #prop; - │ ^^^^^ - 6 │ #prop - 7 │ #prop + 5; - --- -private_name_presence_check_recursive.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Private names are only allowed on the left side of a 'in' expression - - 4 │ #prop in #prop in this; - 5 │ 5 + #prop; - > 6 │ #prop - │ ^^^^^ - 7 │ #prop + 5; - 8 │ } - --- -private_name_presence_check_recursive.js:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Private names are only allowed on the left side of a 'in' expression - - 5 │ 5 + #prop; - 6 │ #prop - > 7 │ #prop + 5; - │ ^^^^^ - 8 │ } - 9 │ } - --- -class A { - #prop; - test() { - #prop in #prop in this; - 5 + #prop; - #prop - #prop + 5; - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_with_space.rast b/crates/biome_js_parser/test_data/inline/err/private_name_with_space.rast deleted file mode 100644 index 10e41e407a2f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/private_name_with_space.rast +++ /dev/null @@ -1,104 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@9..13 "#" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], - id_token: missing (required), - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@13..17 "test" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - ], - r_curly_token: R_CURLY@18..20 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_CLASS_DECLARATION@0..20 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..18 - 0: JS_PROPERTY_CLASS_MEMBER@9..13 - 0: JS_PROPERTY_MODIFIER_LIST@9..9 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@9..13 - 0: HASH@9..13 "#" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@13..18 - 0: JS_PROPERTY_MODIFIER_LIST@13..13 - 1: JS_LITERAL_MEMBER_NAME@13..17 - 0: IDENT@13..17 "test" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@17..18 ";" [] [] - 9: R_CURLY@18..20 "}" [Newline("\n")] [] - 4: EOF@20..21 "" [Newline("\n")] [] --- -private_name_with_space.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Unexpected space or comment between `#` and identifier - - 1 │ class A { - > 2 │ # test; - │ ^ - 3 │ } - 4 │ - - i remove the space here - --- -private_name_with_space.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the class property, but found none - - 1 │ class A { - > 2 │ # test; - │ ^ - 3 │ } - 4 │ - --- -class A { - # test; -} diff --git a/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.rast b/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.rast deleted file mode 100644 index db6255dcc170..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.rast +++ /dev/null @@ -1,444 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@1..2 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: missing (required), - colon_token: COLON@2..3 ":" [] [], - pattern: JsIdentifierAssignment { - name_token: IDENT@3..4 "y" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@4..6 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@6..8 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@9..10 "}" [] [], - }, - }, - r_paren_token: R_PAREN@10..11 ")" [] [], - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@12..14 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@14..15 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: missing (required), - init: JsInitializerClause { - eq_token: EQ@15..16 "=" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "y" [] [], - }, - }, - }, - }, - ], - r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@19..21 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@21..22 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - }, - r_paren_token: R_PAREN@23..24 ")" [] [], - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@25..27 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@27..28 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: missing (required), - colon_token: COLON@28..29 ":" [] [], - pattern: missing (required), - init: JsInitializerClause { - eq_token: EQ@29..30 "=" [] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@30..36 "\"test\"" [] [], - }, - }, - }, - ], - r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@38..40 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@40..41 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@41..42 "}" [] [], - }, - }, - r_paren_token: R_PAREN@42..43 ")" [] [], - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@44..46 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@46..47 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: missing (required), - colon_token: COLON@47..48 ":" [] [], - pattern: missing (required), - init: JsInitializerClause { - eq_token: EQ@48..49 "=" [] [], - expression: missing (required), - }, - }, - ], - r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@51..53 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@53..54 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - }, - r_paren_token: R_PAREN@55..56 ")" [] [], - }, - semicolon_token: SEMICOLON@56..57 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@57..59 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@61..63 "a" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - missing separator, - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@63..65 "b" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@65..67 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@67..69 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@69..70 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@70..71 "}" [] [], - }, - }, - r_paren_token: R_PAREN@71..72 ")" [] [], - }, - semicolon_token: SEMICOLON@72..73 ";" [] [], - }, - ], - eof_token: EOF@73..74 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..74 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..73 - 0: JS_EXPRESSION_STATEMENT@0..12 - 0: JS_PARENTHESIZED_EXPRESSION@0..11 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..10 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..6 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@2..4 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@2..4 - 0: (empty) - 1: COLON@2..3 ":" [] [] - 2: JS_IDENTIFIER_ASSIGNMENT@3..4 - 0: IDENT@3..4 "y" [] [] - 3: (empty) - 2: R_CURLY@4..6 "}" [] [Whitespace(" ")] - 1: EQ@6..8 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@8..10 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..9 - 2: R_CURLY@9..10 "}" [] [] - 2: R_PAREN@10..11 ")" [] [] - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@12..25 - 0: JS_PARENTHESIZED_EXPRESSION@12..24 - 0: L_PAREN@12..14 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@14..23 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@14..19 - 0: L_CURLY@14..15 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@15..17 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@15..17 - 0: (empty) - 1: JS_INITIALIZER_CLAUSE@15..17 - 0: EQ@15..16 "=" [] [] - 1: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "y" [] [] - 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] - 1: EQ@19..21 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@21..23 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@22..22 - 2: R_CURLY@22..23 "}" [] [] - 2: R_PAREN@23..24 ")" [] [] - 1: SEMICOLON@24..25 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@25..44 - 0: JS_PARENTHESIZED_EXPRESSION@25..43 - 0: L_PAREN@25..27 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@27..42 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@27..38 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@28..36 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@28..36 - 0: (empty) - 1: COLON@28..29 ":" [] [] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@29..36 - 0: EQ@29..30 "=" [] [] - 1: JS_STRING_LITERAL_EXPRESSION@30..36 - 0: JS_STRING_LITERAL@30..36 "\"test\"" [] [] - 2: R_CURLY@36..38 "}" [] [Whitespace(" ")] - 1: EQ@38..40 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@40..42 - 0: L_CURLY@40..41 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@41..41 - 2: R_CURLY@41..42 "}" [] [] - 2: R_PAREN@42..43 ")" [] [] - 1: SEMICOLON@43..44 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@44..57 - 0: JS_PARENTHESIZED_EXPRESSION@44..56 - 0: L_PAREN@44..46 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@46..55 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@46..51 - 0: L_CURLY@46..47 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@47..49 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@47..49 - 0: (empty) - 1: COLON@47..48 ":" [] [] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@48..49 - 0: EQ@48..49 "=" [] [] - 1: (empty) - 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] - 1: EQ@51..53 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@53..55 - 0: L_CURLY@53..54 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@54..54 - 2: R_CURLY@54..55 "}" [] [] - 2: R_PAREN@55..56 ")" [] [] - 1: SEMICOLON@56..57 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@57..73 - 0: JS_PARENTHESIZED_EXPRESSION@57..72 - 0: L_PAREN@57..59 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@59..71 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@59..67 - 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@61..65 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@61..63 - 0: JS_IDENTIFIER_ASSIGNMENT@61..63 - 0: IDENT@61..63 "a" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@63..65 - 0: JS_IDENTIFIER_ASSIGNMENT@63..65 - 0: IDENT@63..65 "b" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@65..67 "}" [] [Whitespace(" ")] - 1: EQ@67..69 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@69..71 - 0: L_CURLY@69..70 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@70..70 - 2: R_CURLY@70..71 "}" [] [] - 2: R_PAREN@71..72 ")" [] [] - 1: SEMICOLON@72..73 ";" [] [] - 4: EOF@73..74 "" [Newline("\n")] [] --- -property_assignment_target_err.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. - - > 1 │ ({:y} = {}); - │ ^ - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - - i Expected an identifier, a string literal, a number literal, or a computed property here. - - > 1 │ ({:y} = {}); - │ ^ - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - --- -property_assignment_target_err.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found '='. - - 1 │ ({:y} = {}); - > 2 │ ({=y} = {}); - │ ^ - 3 │ ({:="test"} = {}); - 4 │ ({:=} = {}); - - i Expected an identifier here. - - 1 │ ({:y} = {}); - > 2 │ ({=y} = {}); - │ ^ - 3 │ ({:="test"} = {}); - 4 │ ({:=} = {}); - --- -property_assignment_target_err.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. - - 1 │ ({:y} = {}); - 2 │ ({=y} = {}); - > 3 │ ({:="test"} = {}); - │ ^ - 4 │ ({:=} = {}); - 5 │ ({ a b } = {}); - - i Expected an identifier, a string literal, a number literal, or a computed property here. - - 1 │ ({:y} = {}); - 2 │ ({=y} = {}); - > 3 │ ({:="test"} = {}); - │ ^ - 4 │ ({:=} = {}); - 5 │ ({ a b } = {}); - --- -property_assignment_target_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or an assignment target but instead found '='. - - 1 │ ({:y} = {}); - 2 │ ({=y} = {}); - > 3 │ ({:="test"} = {}); - │ ^ - 4 │ ({:=} = {}); - 5 │ ({ a b } = {}); - - i Expected an identifier, or an assignment target here. - - 1 │ ({:y} = {}); - 2 │ ({=y} = {}); - > 3 │ ({:="test"} = {}); - │ ^ - 4 │ ({:=} = {}); - 5 │ ({ a b } = {}); - --- -property_assignment_target_err.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. - - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - > 4 │ ({:=} = {}); - │ ^ - 5 │ ({ a b } = {}); - 6 │ - - i Expected an identifier, a string literal, a number literal, or a computed property here. - - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - > 4 │ ({:=} = {}); - │ ^ - 5 │ ({ a b } = {}); - 6 │ - --- -property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or an assignment target but instead found '='. - - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - > 4 │ ({:=} = {}); - │ ^ - 5 │ ({ a b } = {}); - 6 │ - - i Expected an identifier, or an assignment target here. - - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - > 4 │ ({:=} = {}); - │ ^ - 5 │ ({ a b } = {}); - 6 │ - --- -property_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found '}'. - - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - > 4 │ ({:=} = {}); - │ ^ - 5 │ ({ a b } = {}); - 6 │ - - i Expected an expression, or an assignment here. - - 2 │ ({=y} = {}); - 3 │ ({:="test"} = {}); - > 4 │ ({:=} = {}); - │ ^ - 5 │ ({ a b } = {}); - 6 │ - --- -property_assignment_target_err.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `b` - - 3 │ ({:="test"} = {}); - 4 │ ({:=} = {}); - > 5 │ ({ a b } = {}); - │ ^ - 6 │ - - i Remove b - --- -({:y} = {}); -({=y} = {}); -({:="test"} = {}); -({:=} = {}); -({ a b } = {}); diff --git a/crates/biome_js_parser/test_data/inline/err/regex.rast b/crates/biome_js_parser/test_data/inline/err/regex.rast deleted file mode 100644 index 7fa4f1dd3152..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/regex.rast +++ /dev/null @@ -1,62 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@0..25 "/[\\p{Control}--[\\t\\n]]/vv" [] [], - }, - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - JsExpressionStatement { - expression: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@26..52 "/[\\p{Control}--[\\t\\n]]/uv" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@52..53 ";" [] [], - }, - ], - eof_token: EOF@53..54 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..54 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..53 - 0: JS_EXPRESSION_STATEMENT@0..26 - 0: JS_REGEX_LITERAL_EXPRESSION@0..25 - 0: JS_REGEX_LITERAL@0..25 "/[\\p{Control}--[\\t\\n]]/vv" [] [] - 1: SEMICOLON@25..26 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@26..53 - 0: JS_REGEX_LITERAL_EXPRESSION@26..52 - 0: JS_REGEX_LITERAL@26..52 "/[\\p{Control}--[\\t\\n]]/uv" [Newline("\n")] [] - 1: SEMICOLON@52..53 ";" [] [] - 4: EOF@53..54 "" [Newline("\n")] [] --- -regex.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Duplicate flag `v`. - - > 1 │ /[\p{Control}--[\t\n]]/vv; - │ ^ - 2 │ /[\p{Control}--[\t\n]]/uv; - 3 │ - - i This flag was already used. - --- -regex.js:2:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid regex flag. - - 1 │ /[\p{Control}--[\t\n]]/vv; - > 2 │ /[\p{Control}--[\t\n]]/uv; - │ ^ - 3 │ - - i The 'u' and 'v' regular expression flags cannot be enabled at the same time. - --- -/[\p{Control}--[\t\n]]/vv; -/[\p{Control}--[\t\n]]/uv; diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast b/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast deleted file mode 100644 index 978734496b6f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast +++ /dev/null @@ -1,399 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@3..7 "..." [] [Whitespace(" ")], - target: missing (required), - }, - ], - r_curly_token: R_CURLY@7..9 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@9..11 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..12 "a" [] [], - }, - }, - }, - r_paren_token: R_PAREN@12..13 ")" [] [], - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@14..16 "(" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_CURLY@16..18 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@18..21 "..." [] [], - JsIdentifierAssignment { - name_token: IDENT@21..23 "c" [] [Whitespace(" ")], - }, - EQ@23..25 "=" [] [Whitespace(" ")], - JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")], - ], - }, - ], - }, - R_CURLY@35..37 "}" [] [Whitespace(" ")], - ], - }, - EQ@37..39 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@39..40 "a" [] [], - }, - }, - ], - }, - r_paren_token: R_PAREN@40..41 ")" [] [], - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@46..49 "..." [] [], - target: JsBogusAssignment { - items: [ - L_CURLY@49..50 "{" [] [], - JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@50..51 "a" [] [], - }, - init: missing (optional), - }, - ], - R_CURLY@51..53 "}" [] [Whitespace(" ")], - ], - }, - }, - ], - r_curly_token: R_CURLY@53..55 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@55..57 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..58 "b" [] [], - }, - }, - }, - r_paren_token: R_PAREN@58..59 ")" [] [], - }, - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@60..62 "(" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_CURLY@62..64 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@64..67 "..." [] [], - JsIdentifierAssignment { - name_token: IDENT@67..71 "rest" [] [], - }, - ], - }, - COMMA@71..73 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@73..90 "other_assignment" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - }, - R_CURLY@90..92 "}" [] [Whitespace(" ")], - ], - }, - EQ@92..94 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@94..95 "a" [] [], - }, - }, - ], - }, - r_paren_token: R_PAREN@95..96 ")" [] [], - }, - semicolon_token: SEMICOLON@96..97 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@97..99 "(" [Newline("\n")] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_CURLY@99..101 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@101..104 "..." [] [], - JsIdentifierAssignment { - name_token: IDENT@104..108 "rest" [] [], - }, - ], - }, - COMMA@108..110 "," [] [Whitespace(" ")], - ], - }, - R_CURLY@110..112 "}" [] [Whitespace(" ")], - ], - }, - EQ@112..114 "=" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@114..115 "a" [] [], - }, - }, - ], - }, - r_paren_token: R_PAREN@115..116 ")" [] [], - }, - semicolon_token: SEMICOLON@116..117 ";" [] [], - }, - ], - eof_token: EOF@117..118 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..118 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..117 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_PARENTHESIZED_EXPRESSION@0..13 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..12 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..9 - 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@3..7 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@3..7 - 0: DOT3@3..7 "..." [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@7..9 "}" [] [Whitespace(" ")] - 1: EQ@9..11 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@11..12 - 0: JS_REFERENCE_IDENTIFIER@11..12 - 0: IDENT@11..12 "a" [] [] - 2: R_PAREN@12..13 ")" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..42 - 0: JS_PARENTHESIZED_EXPRESSION@14..41 - 0: L_PAREN@14..16 "(" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@16..40 - 0: JS_BOGUS@16..37 - 0: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@18..35 - 0: JS_BOGUS@18..35 - 0: DOT3@18..21 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@21..23 - 0: IDENT@21..23 "c" [] [Whitespace(" ")] - 2: EQ@23..25 "=" [] [Whitespace(" ")] - 3: JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")] - 2: R_CURLY@35..37 "}" [] [Whitespace(" ")] - 1: EQ@37..39 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@39..40 - 0: JS_REFERENCE_IDENTIFIER@39..40 - 0: IDENT@39..40 "a" [] [] - 2: R_PAREN@40..41 ")" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@42..60 - 0: JS_PARENTHESIZED_EXPRESSION@42..59 - 0: L_PAREN@42..44 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@44..58 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@44..55 - 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@46..53 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@46..53 - 0: DOT3@46..49 "..." [] [] - 1: JS_BOGUS_ASSIGNMENT@49..53 - 0: L_CURLY@49..50 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@50..51 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@50..51 - 0: JS_IDENTIFIER_ASSIGNMENT@50..51 - 0: IDENT@50..51 "a" [] [] - 1: (empty) - 2: R_CURLY@51..53 "}" [] [Whitespace(" ")] - 2: R_CURLY@53..55 "}" [] [Whitespace(" ")] - 1: EQ@55..57 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@57..58 - 0: JS_REFERENCE_IDENTIFIER@57..58 - 0: IDENT@57..58 "b" [] [] - 2: R_PAREN@58..59 ")" [] [] - 1: SEMICOLON@59..60 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@60..97 - 0: JS_PARENTHESIZED_EXPRESSION@60..96 - 0: L_PAREN@60..62 "(" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@62..95 - 0: JS_BOGUS@62..92 - 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@64..90 - 0: JS_BOGUS@64..71 - 0: DOT3@64..67 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@67..71 - 0: IDENT@67..71 "rest" [] [] - 1: COMMA@71..73 "," [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@73..90 - 0: JS_IDENTIFIER_ASSIGNMENT@73..90 - 0: IDENT@73..90 "other_assignment" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@90..92 "}" [] [Whitespace(" ")] - 1: EQ@92..94 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@94..95 - 0: JS_REFERENCE_IDENTIFIER@94..95 - 0: IDENT@94..95 "a" [] [] - 2: R_PAREN@95..96 ")" [] [] - 1: SEMICOLON@96..97 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@97..117 - 0: JS_PARENTHESIZED_EXPRESSION@97..116 - 0: L_PAREN@97..99 "(" [Newline("\n")] [] - 1: JS_BOGUS_EXPRESSION@99..115 - 0: JS_BOGUS@99..112 - 0: L_CURLY@99..101 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@101..110 - 0: JS_BOGUS@101..108 - 0: DOT3@101..104 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@104..108 - 0: IDENT@104..108 "rest" [] [] - 1: COMMA@108..110 "," [] [Whitespace(" ")] - 2: R_CURLY@110..112 "}" [] [Whitespace(" ")] - 1: EQ@112..114 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@114..115 - 0: JS_REFERENCE_IDENTIFIER@114..115 - 0: IDENT@114..115 "a" [] [] - 2: R_PAREN@115..116 ")" [] [] - 1: SEMICOLON@116..117 ";" [] [] - 4: EOF@117..118 "" [Newline("\n")] [] --- -rest_property_assignment_target_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or an assignment target but instead found '}'. - - > 1 │ ({ ... } = a); - │ ^ - 2 │ ({ ...c = "default" } = a); - 3 │ ({ ...{a} } = b); - - i Expected an identifier, or an assignment target here. - - > 1 │ ({ ... } = a); - │ ^ - 2 │ ({ ...c = "default" } = a); - 3 │ ({ ...{a} } = b); - --- -rest_property_assignment_target_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element cannot have a default - - 1 │ ({ ... } = a); - > 2 │ ({ ...c = "default" } = a); - │ ^^^^^^^^^^^^ - 3 │ ({ ...{a} } = b); - 4 │ ({ ...rest, other_assignment } = a); - - i Remove the default value here - - 1 │ ({ ... } = a); - > 2 │ ({ ...c = "default" } = a); - │ ^^^^^^^^^^^^ - 3 │ ({ ...{a} } = b); - 4 │ ({ ...rest, other_assignment } = a); - - i Rest element - - 1 │ ({ ... } = a); - > 2 │ ({ ...c = "default" } = a); - │ ^^^^ - 3 │ ({ ...{a} } = b); - 4 │ ({ ...rest, other_assignment } = a); - --- -rest_property_assignment_target_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × object and array assignment targets are not allowed in rest patterns - - 1 │ ({ ... } = a); - 2 │ ({ ...c = "default" } = a); - > 3 │ ({ ...{a} } = b); - │ ^^^ - 4 │ ({ ...rest, other_assignment } = a); - 5 │ ({ ...rest, } = a); - --- -rest_property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element must be the last element - - 2 │ ({ ...c = "default" } = a); - 3 │ ({ ...{a} } = b); - > 4 │ ({ ...rest, other_assignment } = a); - │ ^^^^^^^ - 5 │ ({ ...rest, } = a); - 6 │ - - i Move the rest element to the end of the pattern, right before the closing '}' - --- -rest_property_assignment_target_err.js:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element may not have a trailing comma - - 3 │ ({ ...{a} } = b); - 4 │ ({ ...rest, other_assignment } = a); - > 5 │ ({ ...rest, } = a); - │ ^ - 6 │ - - i Remove the trailing comma here - - 3 │ ({ ...{a} } = b); - 4 │ ({ ...rest, other_assignment } = a); - > 5 │ ({ ...rest, } = a); - │ ^ - 6 │ - - i Rest element - - 3 │ ({ ...{a} } = b); - 4 │ ({ ...rest, other_assignment } = a); - > 5 │ ({ ...rest, } = a); - │ ^^^^^^^ - 6 │ - --- -({ ... } = a); -({ ...c = "default" } = a); -({ ...{a} } = b); -({ ...rest, other_assignment } = a); -({ ...rest, } = a); diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.rast b/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.rast deleted file mode 100644 index f723bde64079..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.rast +++ /dev/null @@ -1,559 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternRest { - dotdotdot_token: DOT3@6..10 "..." [] [Whitespace(" ")], - binding: missing (required), - }, - ], - r_curly_token: R_CURLY@10..12 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@12..14 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..15 "a" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_CURLY@21..23 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@23..26 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@26..28 "c" [] [Whitespace(" ")], - }, - EQ@28..30 "=" [] [Whitespace(" ")], - JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")], - ], - }, - ], - }, - R_CURLY@40..42 "}" [] [Whitespace(" ")], - ], - }, - JsInitializerClause { - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "a" [] [], - }, - }, - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@45..46 ";" [] [], - ], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@51..53 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternRest { - dotdotdot_token: DOT3@53..56 "..." [] [], - binding: JsBogusBinding { - items: [ - L_CURLY@56..57 "{" [] [], - JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@57..58 "a" [] [], - }, - init: missing (optional), - }, - ], - R_CURLY@58..60 "}" [] [Whitespace(" ")], - ], - }, - }, - ], - r_curly_token: R_CURLY@60..62 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@62..64 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@64..65 "b" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@65..66 ";" [] [], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_CURLY@71..73 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@73..76 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@76..80 "rest" [] [], - }, - ], - }, - COMMA@80..82 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@82..99 "other_assignment" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - }, - R_CURLY@99..101 "}" [] [Whitespace(" ")], - ], - }, - JsInitializerClause { - eq_token: EQ@101..103 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@103..104 "a" [] [], - }, - }, - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@104..105 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@105..110 "let" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - L_CURLY@110..112 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@112..115 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@115..120 "rest2" [] [], - }, - ], - }, - COMMA@120..122 "," [] [Whitespace(" ")], - ], - }, - R_CURLY@122..124 "}" [] [Whitespace(" ")], - ], - }, - JsInitializerClause { - eq_token: EQ@124..126 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@126..127 "a" [] [], - }, - }, - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@127..128 ";" [] [], - ], - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@128..135 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@135..144 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@144..148 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@148..149 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@151..152 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@152..159 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@159..161 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternRest { - dotdotdot_token: DOT3@161..164 "..." [] [], - binding: JsBogusBinding { - items: [ - IDENT@164..170 "await" [] [Whitespace(" ")], - ], - }, - }, - ], - r_curly_token: R_CURLY@170..172 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@172..174 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@174..175 "a" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@175..176 ";" [] [], - }, - ], - r_curly_token: R_CURLY@176..178 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@178..179 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..179 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..178 - 0: JS_VARIABLE_STATEMENT@0..16 - 0: JS_VARIABLE_DECLARATION@0..15 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..15 - 0: JS_VARIABLE_DECLARATOR@4..15 - 0: JS_OBJECT_BINDING_PATTERN@4..12 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..10 - 0: JS_OBJECT_BINDING_PATTERN_REST@6..10 - 0: DOT3@6..10 "..." [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@10..12 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@12..15 - 0: EQ@12..14 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@14..15 - 0: JS_REFERENCE_IDENTIFIER@14..15 - 0: IDENT@14..15 "a" [] [] - 1: SEMICOLON@15..16 ";" [] [] - 1: JS_BOGUS_STATEMENT@16..46 - 0: JS_BOGUS@16..45 - 0: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@21..45 - 0: JS_BOGUS@21..45 - 0: JS_BOGUS@21..42 - 0: L_CURLY@21..23 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@23..40 - 0: JS_BOGUS@23..40 - 0: DOT3@23..26 "..." [] [] - 1: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "c" [] [Whitespace(" ")] - 2: EQ@28..30 "=" [] [Whitespace(" ")] - 3: JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")] - 2: R_CURLY@40..42 "}" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@42..45 - 0: EQ@42..44 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "a" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 2: JS_VARIABLE_STATEMENT@46..66 - 0: JS_VARIABLE_DECLARATION@46..65 - 0: (empty) - 1: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@51..65 - 0: JS_VARIABLE_DECLARATOR@51..65 - 0: JS_OBJECT_BINDING_PATTERN@51..62 - 0: L_CURLY@51..53 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@53..60 - 0: JS_OBJECT_BINDING_PATTERN_REST@53..60 - 0: DOT3@53..56 "..." [] [] - 1: JS_BOGUS_BINDING@56..60 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@57..58 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@57..58 - 0: JS_IDENTIFIER_BINDING@57..58 - 0: IDENT@57..58 "a" [] [] - 1: (empty) - 2: R_CURLY@58..60 "}" [] [Whitespace(" ")] - 2: R_CURLY@60..62 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@62..65 - 0: EQ@62..64 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@64..65 - 0: JS_REFERENCE_IDENTIFIER@64..65 - 0: IDENT@64..65 "b" [] [] - 1: SEMICOLON@65..66 ";" [] [] - 3: JS_BOGUS_STATEMENT@66..105 - 0: JS_BOGUS@66..104 - 0: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@71..104 - 0: JS_BOGUS@71..104 - 0: JS_BOGUS@71..101 - 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@73..99 - 0: JS_BOGUS@73..80 - 0: DOT3@73..76 "..." [] [] - 1: JS_IDENTIFIER_BINDING@76..80 - 0: IDENT@76..80 "rest" [] [] - 1: COMMA@80..82 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@82..99 - 0: JS_IDENTIFIER_BINDING@82..99 - 0: IDENT@82..99 "other_assignment" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@99..101 "}" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@101..104 - 0: EQ@101..103 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@103..104 - 0: JS_REFERENCE_IDENTIFIER@103..104 - 0: IDENT@103..104 "a" [] [] - 1: SEMICOLON@104..105 ";" [] [] - 4: JS_BOGUS_STATEMENT@105..128 - 0: JS_BOGUS@105..127 - 0: LET_KW@105..110 "let" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@110..127 - 0: JS_BOGUS@110..127 - 0: JS_BOGUS@110..124 - 0: L_CURLY@110..112 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@112..122 - 0: JS_BOGUS@112..120 - 0: DOT3@112..115 "..." [] [] - 1: JS_IDENTIFIER_BINDING@115..120 - 0: IDENT@115..120 "rest2" [] [] - 1: COMMA@120..122 "," [] [Whitespace(" ")] - 2: R_CURLY@122..124 "}" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@124..127 - 0: EQ@124..126 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@126..127 - 0: JS_REFERENCE_IDENTIFIER@126..127 - 0: IDENT@126..127 "a" [] [] - 1: SEMICOLON@127..128 ";" [] [] - 5: JS_FUNCTION_DECLARATION@128..178 - 0: ASYNC_KW@128..135 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@135..144 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@144..148 - 0: IDENT@144..148 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@148..151 - 0: L_PAREN@148..149 "(" [] [] - 1: JS_PARAMETER_LIST@149..149 - 2: R_PAREN@149..151 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@151..178 - 0: L_CURLY@151..152 "{" [] [] - 1: JS_DIRECTIVE_LIST@152..152 - 2: JS_STATEMENT_LIST@152..176 - 0: JS_VARIABLE_STATEMENT@152..176 - 0: JS_VARIABLE_DECLARATION@152..175 - 0: (empty) - 1: LET_KW@152..159 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@159..175 - 0: JS_VARIABLE_DECLARATOR@159..175 - 0: JS_OBJECT_BINDING_PATTERN@159..172 - 0: L_CURLY@159..161 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@161..170 - 0: JS_OBJECT_BINDING_PATTERN_REST@161..170 - 0: DOT3@161..164 "..." [] [] - 1: JS_BOGUS_BINDING@164..170 - 0: IDENT@164..170 "await" [] [Whitespace(" ")] - 2: R_CURLY@170..172 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@172..175 - 0: EQ@172..174 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@174..175 - 0: JS_REFERENCE_IDENTIFIER@174..175 - 0: IDENT@174..175 "a" [] [] - 1: SEMICOLON@175..176 ";" [] [] - 3: R_CURLY@176..178 "}" [Newline("\n")] [] - 4: EOF@178..179 "" [Newline("\n")] [] --- -rest_property_binding_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found '}'. - - > 1 │ let { ... } = a; - │ ^ - 2 │ let { ...c = "default" } = a; - 3 │ let { ...{a} } = b; - - i Expected an identifier here. - - > 1 │ let { ... } = a; - │ ^ - 2 │ let { ...c = "default" } = a; - 3 │ let { ...{a} } = b; - --- -rest_property_binding_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element cannot have a default - - 1 │ let { ... } = a; - > 2 │ let { ...c = "default" } = a; - │ ^^^^^^^^^^^^ - 3 │ let { ...{a} } = b; - 4 │ let { ...rest, other_assignment } = a; - - i Remove the default value here - - 1 │ let { ... } = a; - > 2 │ let { ...c = "default" } = a; - │ ^^^^^^^^^^^^ - 3 │ let { ...{a} } = b; - 4 │ let { ...rest, other_assignment } = a; - - i Rest element - - 1 │ let { ... } = a; - > 2 │ let { ...c = "default" } = a; - │ ^^^^ - 3 │ let { ...{a} } = b; - 4 │ let { ...rest, other_assignment } = a; - --- -rest_property_binding_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected identifier binding - - 1 │ let { ... } = a; - 2 │ let { ...c = "default" } = a; - > 3 │ let { ...{a} } = b; - │ ^^^ - 4 │ let { ...rest, other_assignment } = a; - 5 │ let { ...rest2, } = a; - - i Object rest patterns must bind to an identifier, other patterns are not allowed. - --- -rest_property_binding_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element must be the last element - - 2 │ let { ...c = "default" } = a; - 3 │ let { ...{a} } = b; - > 4 │ let { ...rest, other_assignment } = a; - │ ^^^^^^^ - 5 │ let { ...rest2, } = a; - 6 │ async function test() { - - i Move the rest element to the end of the pattern, right before the closing '}' - --- -rest_property_binding_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest element may not have a trailing comma - - 3 │ let { ...{a} } = b; - 4 │ let { ...rest, other_assignment } = a; - > 5 │ let { ...rest2, } = a; - │ ^ - 6 │ async function test() { - 7 │ let { ...await } = a; - - i Remove the trailing comma here - - 3 │ let { ...{a} } = b; - 4 │ let { ...rest, other_assignment } = a; - > 5 │ let { ...rest2, } = a; - │ ^ - 6 │ async function test() { - 7 │ let { ...await } = a; - - i Rest element - - 3 │ let { ...{a} } = b; - 4 │ let { ...rest, other_assignment } = a; - > 5 │ let { ...rest2, } = a; - │ ^^^^^^^^ - 6 │ async function test() { - 7 │ let { ...await } = a; - --- -rest_property_binding_err.js:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of `await` as an identifier in an async context - - 5 │ let { ...rest2, } = a; - 6 │ async function test() { - > 7 │ let { ...await } = a; - │ ^^^^^ - 8 │ } - 9 │ - --- -let { ... } = a; -let { ...c = "default" } = a; -let { ...{a} } = b; -let { ...rest, other_assignment } = a; -let { ...rest2, } = a; -async function test() { - let { ...await } = a; -} diff --git a/crates/biome_js_parser/test_data/inline/err/return_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/return_stmt_err.rast deleted file mode 100644 index 6d73b7e56b44..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/return_stmt_err.rast +++ /dev/null @@ -1,64 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - RETURN_KW@0..6 "return" [] [], - SEMICOLON@6..7 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - RETURN_KW@7..15 "return" [Newline("\n")] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..18 "foo" [] [], - }, - }, - SEMICOLON@18..19 ";" [] [], - ], - }, - ], - eof_token: EOF@19..20 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..20 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..19 - 0: JS_BOGUS_STATEMENT@0..7 - 0: RETURN_KW@0..6 "return" [] [] - 1: SEMICOLON@6..7 ";" [] [] - 1: JS_BOGUS_STATEMENT@7..19 - 0: RETURN_KW@7..15 "return" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@15..18 - 0: JS_REFERENCE_IDENTIFIER@15..18 - 0: IDENT@15..18 "foo" [] [] - 2: SEMICOLON@18..19 ";" [] [] - 4: EOF@19..20 "" [Newline("\n")] [] --- -return_stmt_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal return statement outside of a function - - > 1 │ return; - │ ^^^^^^^ - 2 │ return foo; - 3 │ - --- -return_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal return statement outside of a function - - 1 │ return; - > 2 │ return foo; - │ ^^^^^^^^^^^ - 3 │ - --- -return; -return foo; diff --git a/crates/biome_js_parser/test_data/inline/err/semicolons_err.rast b/crates/biome_js_parser/test_data/inline/err/semicolons_err.rast deleted file mode 100644 index ab214d4279fc..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/semicolons_err.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "foo" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..14 "bar" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsThrowStatement { - throw_token: THROW_KW@14..20 "throw" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..23 "foo" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_VARIABLE_STATEMENT@0..14 - 0: JS_VARIABLE_DECLARATION@0..14 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..14 - 0: JS_VARIABLE_DECLARATOR@4..14 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "foo" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..14 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@10..14 - 0: JS_REFERENCE_IDENTIFIER@10..14 - 0: IDENT@10..14 "bar" [] [Whitespace(" ")] - 1: (empty) - 1: JS_THROW_STATEMENT@14..23 - 0: THROW_KW@14..20 "throw" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@20..23 - 0: JS_REFERENCE_IDENTIFIER@20..23 - 0: IDENT@20..23 "foo" [] [] - 2: (empty) - 4: EOF@23..24 "" [Newline("\n")] [] --- -semicolons_err.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ let foo = bar throw foo - │ ^^^^^ - 2 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ let foo = bar throw foo - │ ^^^^^ - 2 │ - - i ...Which is required to end this statement - - > 1 │ let foo = bar throw foo - │ ^^^^^^^^^^^^^^ - 2 │ - --- -let foo = bar throw foo diff --git a/crates/biome_js_parser/test_data/inline/err/sequence_expr.rast b/crates/biome_js_parser/test_data/inline/err/sequence_expr.rast deleted file mode 100644 index d1cc5658f1d4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/sequence_expr.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..1 "1" [] [], - }, - comma_token: COMMA@1..3 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@3..4 "2" [] [], - }, - }, - comma_token: COMMA@4..6 "," [] [Whitespace(" ")], - right: missing (required), - }, - comma_token: COMMA@6..8 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@8..9 "4" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_EXPRESSION_STATEMENT@0..9 - 0: JS_SEQUENCE_EXPRESSION@0..9 - 0: JS_SEQUENCE_EXPRESSION@0..6 - 0: JS_SEQUENCE_EXPRESSION@0..4 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..1 - 0: JS_NUMBER_LITERAL@0..1 "1" [] [] - 1: COMMA@1..3 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@3..4 - 0: JS_NUMBER_LITERAL@3..4 "2" [] [] - 1: COMMA@4..6 "," [] [Whitespace(" ")] - 2: (empty) - 1: COMMA@6..8 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@8..9 - 0: JS_NUMBER_LITERAL@8..9 "4" [] [] - 1: (empty) - 4: EOF@9..10 "" [Newline("\n")] [] --- -sequence_expr.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ','. - - > 1 │ 1, 2, , 4 - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ 1, 2, , 4 - │ ^ - 2 │ - --- -1, 2, , 4 diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_member.rast b/crates/biome_js_parser/test_data/inline/err/setter_class_member.rast deleted file mode 100644 index 6491a8855476..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/setter_class_member.rast +++ /dev/null @@ -1,96 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..14 "Setters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsClassMemberList [ - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@22..25 "foo" [] [], - }, - l_paren_token: L_PAREN@25..26 "(" [] [], - parameter: missing (required), - comma_token: missing (optional), - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@30..32 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@32..33 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..33 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..32 - 0: JS_CLASS_DECLARATION@0..32 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..14 - 0: IDENT@6..14 "Setters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@14..15 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@15..30 - 0: JS_SETTER_CLASS_MEMBER@15..30 - 0: JS_METHOD_MODIFIER_LIST@15..15 - 1: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@22..25 - 0: IDENT@22..25 "foo" [] [] - 3: L_PAREN@25..26 "(" [] [] - 4: (empty) - 5: (empty) - 6: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..30 "}" [] [] - 9: R_CURLY@30..32 "}" [Newline("\n")] [] - 4: EOF@32..33 "" [Newline("\n")] [] --- -setter_class_member.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parameter but instead found ')'. - - 1 │ class Setters { - > 2 │ set foo() {} - │ ^ - 3 │ } - 4 │ - - i Expected a parameter here. - - 1 │ class Setters { - > 2 │ set foo() {} - │ ^ - 3 │ } - 4 │ - --- -class Setters { - set foo() {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.rast b/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.rast deleted file mode 100644 index 77fe1e99520d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.rast +++ /dev/null @@ -1,101 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..14 "Setters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsClassMemberList [ - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@22..25 "foo" [] [], - }, - l_paren_token: L_PAREN@25..26 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@26..27 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@27..28 ")" [] [], - body: missing (required), - }, - ], - r_curly_token: R_CURLY@28..30 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_CLASS_DECLARATION@0..30 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..14 - 0: IDENT@6..14 "Setters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@14..15 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@15..28 - 0: JS_SETTER_CLASS_MEMBER@15..28 - 0: JS_METHOD_MODIFIER_LIST@15..15 - 1: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@22..25 - 0: IDENT@22..25 "foo" [] [] - 3: L_PAREN@25..26 "(" [] [] - 4: JS_FORMAL_PARAMETER@26..27 - 0: JS_DECORATOR_LIST@26..26 - 1: JS_IDENTIFIER_BINDING@26..27 - 0: IDENT@26..27 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@27..28 ")" [] [] - 7: (empty) - 9: R_CURLY@28..30 "}" [Newline("\n")] [] - 4: EOF@30..31 "" [Newline("\n")] [] --- -setter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found '}'. - - 1 │ class Setters { - 2 │ set foo(a) - > 3 │ } - │ ^ - 4 │ - - i Expected a class method body here. - - 1 │ class Setters { - 2 │ set foo(a) - > 3 │ } - │ ^ - 4 │ - --- -class Setters { - set foo(a) -} diff --git a/crates/biome_js_parser/test_data/inline/err/spread.rast b/crates/biome_js_parser/test_data/inline/err/spread.rast deleted file mode 100644 index 5d7508fbbab1..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/spread.rast +++ /dev/null @@ -1,54 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@0..1 "[" [] [], - elements: JsArrayElementList [ - JsSpread { - dotdotdot_token: DOT3@1..4 "..." [] [], - argument: missing (required), - }, - ], - r_brack_token: R_BRACK@4..5 "]" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@5..6 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..6 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..5 - 0: JS_EXPRESSION_STATEMENT@0..5 - 0: JS_ARRAY_EXPRESSION@0..5 - 0: L_BRACK@0..1 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@1..4 - 0: JS_SPREAD@1..4 - 0: DOT3@1..4 "..." [] [] - 1: (empty) - 2: R_BRACK@4..5 "]" [] [] - 1: (empty) - 4: EOF@5..6 "" [Newline("\n")] [] --- -spread.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ']'. - - > 1 │ [...] - │ ^ - 2 │ - - i Expected an expression, or an assignment here. - - > 1 │ [...] - │ ^ - 2 │ - --- -[...] diff --git a/crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast b/crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast deleted file mode 100644 index 207af3df864d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast +++ /dev/null @@ -1,292 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "obj" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@11..12 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@13..15 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@15..17 "a" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@17..18 "{" [] [], - dotdotdot_token: DOT3@18..21 "..." [] [], - argument: JsUnknownExpression { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "obj" [] [], - }, - }, - COMMA@24..26 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "other" [] [], - }, - }, - ], - }, - r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@33..34 "/" [] [], - r_angle_token: R_ANGLE@34..35 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@36..38 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@38..40 "a" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: missing (required), - dotdotdot_token: DOT3@40..43 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..46 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@46..48 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@48..49 "/" [] [], - r_angle_token: R_ANGLE@49..50 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@51..53 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@53..55 "a" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@55..56 "{" [] [], - dotdotdot_token: missing (required), - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..59 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@61..62 "/" [] [], - r_angle_token: R_ANGLE@62..63 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@64..66 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@66..69 "div" [] [], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [], - dotdotdot_token: DOT3@77..80 "..." [] [], - argument: JsObjectExpression { - l_curly_token: L_CURLY@80..81 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")], - }, - r_curly_token: missing (required), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@148..149 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [], - }, - }, - }, - ], - slash_token: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [], - r_angle_token: R_ANGLE@167..168 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@168..169 ";" [] [], - }, - ], - eof_token: EOF@169..170 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..170 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..169 - 0: JS_VARIABLE_STATEMENT@0..13 - 0: JS_VARIABLE_DECLARATION@0..12 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..12 - 0: JS_VARIABLE_DECLARATOR@4..12 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "obj" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..12 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@10..12 - 0: L_CURLY@10..11 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@11..11 - 2: R_CURLY@11..12 "}" [] [] - 1: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@13..36 - 0: JSX_TAG_EXPRESSION@13..35 - 0: JSX_SELF_CLOSING_ELEMENT@13..35 - 0: L_ANGLE@13..15 "<" [Newline("\n")] [] - 1: JSX_NAME@15..17 - 0: JSX_IDENT@15..17 "a" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE_LIST@17..33 - 0: JSX_SPREAD_ATTRIBUTE@17..33 - 0: L_CURLY@17..18 "{" [] [] - 1: DOT3@18..21 "..." [] [] - 2: JS_UNKNOWN_EXPRESSION@21..31 - 0: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "obj" [] [] - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "other" [] [] - 3: R_CURLY@31..33 "}" [] [Whitespace(" ")] - 3: SLASH@33..34 "/" [] [] - 4: R_ANGLE@34..35 ">" [] [] - 1: SEMICOLON@35..36 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@36..51 - 0: JSX_TAG_EXPRESSION@36..50 - 0: JSX_SELF_CLOSING_ELEMENT@36..50 - 0: L_ANGLE@36..38 "<" [Newline("\n")] [] - 1: JSX_NAME@38..40 - 0: JSX_IDENT@38..40 "a" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE_LIST@40..48 - 0: JSX_SPREAD_ATTRIBUTE@40..48 - 0: (empty) - 1: DOT3@40..43 "..." [] [] - 2: JS_IDENTIFIER_EXPRESSION@43..46 - 0: JS_REFERENCE_IDENTIFIER@43..46 - 0: IDENT@43..46 "obj" [] [] - 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] - 3: SLASH@48..49 "/" [] [] - 4: R_ANGLE@49..50 ">" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@51..64 - 0: JSX_TAG_EXPRESSION@51..63 - 0: JSX_SELF_CLOSING_ELEMENT@51..63 - 0: L_ANGLE@51..53 "<" [Newline("\n")] [] - 1: JSX_NAME@53..55 - 0: JSX_IDENT@53..55 "a" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE_LIST@55..61 - 0: JSX_SPREAD_ATTRIBUTE@55..61 - 0: L_CURLY@55..56 "{" [] [] - 1: (empty) - 2: JS_IDENTIFIER_EXPRESSION@56..59 - 0: JS_REFERENCE_IDENTIFIER@56..59 - 0: IDENT@56..59 "obj" [] [] - 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] - 3: SLASH@61..62 "/" [] [] - 4: R_ANGLE@62..63 ">" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@64..169 - 0: JSX_TAG_EXPRESSION@64..168 - 0: JSX_SELF_CLOSING_ELEMENT@64..168 - 0: L_ANGLE@64..66 "<" [Newline("\n")] [] - 1: JSX_NAME@66..69 - 0: JSX_IDENT@66..69 "div" [] [] - 2: JSX_ATTRIBUTE_LIST@69..161 - 0: JSX_SPREAD_ATTRIBUTE@69..130 - 0: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [] - 1: DOT3@77..80 "..." [] [] - 2: JS_OBJECT_EXPRESSION@80..130 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@81..81 - 2: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")] - 3: (empty) - 1: JSX_ATTRIBUTE@130..161 - 0: JSX_NAME@130..148 - 0: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@148..161 - 0: EQ@148..149 "=" [] [] - 1: JSX_STRING@149..161 - 0: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [] - 3: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [] - 4: R_ANGLE@167..168 ">" [] [] - 1: SEMICOLON@168..169 ";" [] [] - 4: EOF@169..170 "" [Newline("\n")] [] --- -error[SyntaxError]: Comma operator isn't a valid value for a JSX spread argument. - ┌─ spread_attribute_error.jsx:2:8 - │ -2 │ ; - │ ^^^^^^^^^^ - --- -error[SyntaxError]: expected `'{'` but instead found `...` - ┌─ spread_attribute_error.jsx:3:4 - │ -3 │ ; - │ ^^^ unexpected - --- -error[SyntaxError]: expected `...` but instead found `obj` - ┌─ spread_attribute_error.jsx:4:5 - │ -4 │ ; - │ ^^^ unexpected - --- -error[SyntaxError]: expected `'}'` but instead found `invalidProp` - ┌─ spread_attribute_error.jsx:8:7 - │ -8 │ invalidProp="HelloWorld" - │ ^^^^^^^^^^^ unexpected - --- -let obj = {}; -; -; -; -
; diff --git a/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.rast b/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.rast deleted file mode 100644 index cd4c0724667a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.rast +++ /dev/null @@ -1,93 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBlockStatement { - l_curly_token: L_CURLY@0..1 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@1..8 "\"name\"" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - COLON@8..10 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@10..27 "\"troublesome-lib\"" [] [], - COMMA@27..28 "," [] [], - JS_STRING_LITERAL@28..38 "\"typings\"" [Newline("\n")] [], - COLON@38..40 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@40..56 "\"lib/index.d.ts\"" [] [], - COMMA@56..57 "," [] [], - JS_STRING_LITERAL@57..67 "\"version\"" [Newline("\n")] [], - COLON@67..69 ":" [] [Whitespace(" ")], - JS_STRING_LITERAL@69..76 "\"0.0.1\"" [] [], - ], - }, - ], - r_curly_token: R_CURLY@76..78 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@78..79 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..79 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..78 - 0: JS_BLOCK_STATEMENT@0..78 - 0: L_CURLY@0..1 "{" [] [] - 1: JS_STATEMENT_LIST@1..76 - 0: JS_EXPRESSION_STATEMENT@1..8 - 0: JS_STRING_LITERAL_EXPRESSION@1..8 - 0: JS_STRING_LITERAL@1..8 "\"name\"" [Newline("\n")] [] - 1: (empty) - 1: JS_BOGUS_STATEMENT@8..76 - 0: COLON@8..10 ":" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL@10..27 "\"troublesome-lib\"" [] [] - 2: COMMA@27..28 "," [] [] - 3: JS_STRING_LITERAL@28..38 "\"typings\"" [Newline("\n")] [] - 4: COLON@38..40 ":" [] [Whitespace(" ")] - 5: JS_STRING_LITERAL@40..56 "\"lib/index.d.ts\"" [] [] - 6: COMMA@56..57 "," [] [] - 7: JS_STRING_LITERAL@57..67 "\"version\"" [Newline("\n")] [] - 8: COLON@67..69 ":" [] [Whitespace(" ")] - 9: JS_STRING_LITERAL@69..76 "\"0.0.1\"" [] [] - 2: R_CURLY@76..78 "}" [Newline("\n")] [] - 4: EOF@78..79 "" [Newline("\n")] [] --- -statements_closing_curly.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ { - > 2 │ "name": "troublesome-lib", - │ ^ - 3 │ "typings": "lib/index.d.ts", - 4 │ "version": "0.0.1" - - i An explicit or implicit semicolon is expected here... - - 1 │ { - > 2 │ "name": "troublesome-lib", - │ ^ - 3 │ "typings": "lib/index.d.ts", - 4 │ "version": "0.0.1" - - i ...Which is required to end this statement - - 1 │ { - > 2 │ "name": "troublesome-lib", - │ ^^^^^^^ - 3 │ "typings": "lib/index.d.ts", - 4 │ "version": "0.0.1" - --- -{ -"name": "troublesome-lib", -"typings": "lib/index.d.ts", -"version": "0.0.1" -} diff --git a/crates/biome_js_parser/test_data/inline/err/subscripts_err.rast b/crates/biome_js_parser/test_data/inline/err/subscripts_err.rast deleted file mode 100644 index ada99321d544..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/subscripts_err.rast +++ /dev/null @@ -1,150 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsComputedMemberExpression { - object: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@3..4 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@4..5 ")" [] [], - }, - }, - operator_token: QUESTIONDOT@5..7 "?." [] [], - member: JsName { - value_token: IDENT@7..10 "baz" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@10..11 "[" [] [], - member: missing (required), - r_brack_token: R_BRACK@11..12 "]" [] [], - }, - operator_token: DOT@12..13 "." [] [], - member: missing (required), - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsTemplateExpression { - tag: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..18 "BAR" [Newline("\n")] [], - }, - }, - type_arguments: missing (optional), - l_tick_token: BACKTICK@18..19 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@19..21 "b\n" [] [], - }, - ], - r_tick_token: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@21..21 "" [] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_STATIC_MEMBER_EXPRESSION@0..13 - 0: JS_COMPUTED_MEMBER_EXPRESSION@0..12 - 0: JS_STATIC_MEMBER_EXPRESSION@0..10 - 0: JS_CALL_EXPRESSION@0..5 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@3..5 - 0: L_PAREN@3..4 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@4..4 - 2: R_PAREN@4..5 ")" [] [] - 1: QUESTIONDOT@5..7 "?." [] [] - 2: JS_NAME@7..10 - 0: IDENT@7..10 "baz" [] [] - 1: (empty) - 2: L_BRACK@10..11 "[" [] [] - 3: (empty) - 4: R_BRACK@11..12 "]" [] [] - 1: DOT@12..13 "." [] [] - 2: (empty) - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..21 - 0: JS_TEMPLATE_EXPRESSION@14..21 - 0: JS_IDENTIFIER_EXPRESSION@14..18 - 0: JS_REFERENCE_IDENTIFIER@14..18 - 0: IDENT@14..18 "BAR" [Newline("\n")] [] - 1: (empty) - 2: BACKTICK@18..19 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@19..21 - 0: JS_TEMPLATE_CHUNK_ELEMENT@19..21 - 0: TEMPLATE_CHUNK@19..21 "b\n" [] [] - 4: (empty) - 1: (empty) - 4: EOF@21..21 "" [] [] --- -subscripts_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ']'. - - > 1 │ foo()?.baz[].; - │ ^ - 2 │ BAR`b - 3 │ - - i Expected an expression here. - - > 1 │ foo()?.baz[].; - │ ^ - 2 │ BAR`b - 3 │ - --- -subscripts_err.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier but instead found ';'. - - > 1 │ foo()?.baz[].; - │ ^ - 2 │ BAR`b - 3 │ - - i Expected an identifier here. - - > 1 │ foo()?.baz[].; - │ ^ - 2 │ BAR`b - 3 │ - --- -subscripts_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated template literal - - 1 │ foo()?.baz[].; - > 2 │ BAR`b - │ ^ - > 3 │ - │ - --- -foo()?.baz[].; -BAR`b diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_err.rast b/crates/biome_js_parser/test_data/inline/err/super_expression_err.rast deleted file mode 100644 index 69ce960f7921..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/super_expression_err.rast +++ /dev/null @@ -1,233 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@19..21 "B" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@21..22 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@22..29 "test" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@29..30 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@32..33 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsBogusExpression { - items: [ - SUPER_KW@33..43 "super" [Newline("\n"), Whitespace(" ")] [], - ], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@43..44 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@44..45 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsBogusExpression { - items: [ - SUPER_KW@46..56 "super" [Newline("\n"), Whitespace(" ")] [], - ], - }, - operator_token: QUESTIONDOT@56..58 "?." [] [], - member: JsName { - value_token: IDENT@58..62 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@62..63 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@63..64 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@64..65 ";" [] [], - }, - ], - r_curly_token: R_CURLY@65..69 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@69..71 "}" [Newline("\n")] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsBogusExpression { - items: [ - SUPER_KW@71..77 "super" [Newline("\n")] [], - ], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@77..78 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@78..79 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@79..80 ";" [] [], - }, - ], - eof_token: EOF@80..81 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..81 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..80 - 0: JS_CLASS_DECLARATION@0..71 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@11..21 - 0: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@19..21 - 0: JS_REFERENCE_IDENTIFIER@19..21 - 0: IDENT@19..21 "B" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@21..22 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@22..69 - 0: JS_METHOD_CLASS_MEMBER@22..69 - 0: JS_METHOD_MODIFIER_LIST@22..22 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@22..29 - 0: IDENT@22..29 "test" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@29..32 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_PARAMETER_LIST@30..30 - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@32..69 - 0: L_CURLY@32..33 "{" [] [] - 1: JS_DIRECTIVE_LIST@33..33 - 2: JS_STATEMENT_LIST@33..65 - 0: JS_EXPRESSION_STATEMENT@33..46 - 0: JS_CALL_EXPRESSION@33..45 - 0: JS_BOGUS_EXPRESSION@33..43 - 0: SUPER_KW@33..43 "super" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@43..45 - 0: L_PAREN@43..44 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@44..44 - 2: R_PAREN@44..45 ")" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@46..65 - 0: JS_CALL_EXPRESSION@46..64 - 0: JS_STATIC_MEMBER_EXPRESSION@46..62 - 0: JS_BOGUS_EXPRESSION@46..56 - 0: SUPER_KW@46..56 "super" [Newline("\n"), Whitespace(" ")] [] - 1: QUESTIONDOT@56..58 "?." [] [] - 2: JS_NAME@58..62 - 0: IDENT@58..62 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@62..64 - 0: L_PAREN@62..63 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@63..63 - 2: R_PAREN@63..64 ")" [] [] - 1: SEMICOLON@64..65 ";" [] [] - 3: R_CURLY@65..69 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@69..71 "}" [Newline("\n")] [] - 1: JS_EXPRESSION_STATEMENT@71..80 - 0: JS_CALL_EXPRESSION@71..79 - 0: JS_BOGUS_EXPRESSION@71..77 - 0: SUPER_KW@71..77 "super" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@77..79 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@78..78 - 2: R_PAREN@78..79 ")" [] [] - 1: SEMICOLON@79..80 ";" [] [] - 4: EOF@80..81 "" [Newline("\n")] [] --- -super_expression_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `super` is only valid inside of a class constructor of a subclass. - - 1 │ class Test extends B { - 2 │ test() { - > 3 │ super(); - │ ^^^^^ - 4 │ super?.test(); - 5 │ } - --- -super_expression_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Super doesn't support optional chaining as super can never be null - - 2 │ test() { - 3 │ super(); - > 4 │ super?.test(); - │ ^^^^^ - 5 │ } - 6 │ } - --- -super_expression_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `super` is only valid inside of a class constructor of a subclass. - - 5 │ } - 6 │ } - > 7 │ super(); - │ ^^^^^ - 8 │ - --- -class Test extends B { - test() { - super(); - super?.test(); - } -} -super(); diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.rast b/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.rast deleted file mode 100644 index 8f83c3064bf6..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.rast +++ /dev/null @@ -1,149 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..18 "B" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@20..31 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - parameters: JsConstructorParameterList [ - JsBogusParameter { - items: [ - SUPER_KW@32..37 "super" [] [], - L_PAREN@37..38 "(" [] [], - ], - }, - ], - r_paren_token: R_PAREN@38..39 ")" [] [], - }, - body: missing (required), - }, - JsBogusMember { - items: [ - R_PAREN@39..41 ")" [] [Whitespace(" ")], - L_CURLY@41..42 "{" [] [], - ], - }, - ], - r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")], - }, - JsBogusStatement { - items: [ - R_CURLY@44..45 "}" [] [], - ], - }, - ], - eof_token: EOF@45..46 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..46 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..45 - 0: JS_CLASS_DECLARATION@0..44 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@8..18 - 0: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@16..18 - 0: JS_REFERENCE_IDENTIFIER@16..18 - 0: IDENT@16..18 "B" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@20..42 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..39 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..31 - 0: IDENT@20..31 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@31..39 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..38 - 0: JS_BOGUS_PARAMETER@32..38 - 0: SUPER_KW@32..37 "super" [] [] - 1: L_PAREN@37..38 "(" [] [] - 2: R_PAREN@38..39 ")" [] [] - 3: (empty) - 1: JS_BOGUS_MEMBER@39..42 - 0: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 1: L_CURLY@41..42 "{" [] [] - 9: R_CURLY@42..44 "}" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@44..45 - 0: R_CURLY@44..45 "}" [] [] - 4: EOF@45..46 "" [Newline("\n")] [] --- -super_expression_in_constructor_parameter_list.js:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parameter but instead found 'super('. - - > 1 │ class A extends B { constructor(super()) {} } - │ ^^^^^^ - 2 │ - - i Expected a parameter here. - - > 1 │ class A extends B { constructor(super()) {} } - │ ^^^^^^ - 2 │ - --- -super_expression_in_constructor_parameter_list.js:1:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found ')'. - - > 1 │ class A extends B { constructor(super()) {} } - │ ^ - 2 │ - - i Expected a class method body here. - - > 1 │ class A extends B { constructor(super()) {} } - │ ^ - 2 │ - --- -super_expression_in_constructor_parameter_list.js:1:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - > 1 │ class A extends B { constructor(super()) {} } - │ ^ - 2 │ - - i Expected a statement here. - - > 1 │ class A extends B { constructor(super()) {} } - │ ^ - 2 │ - --- -class A extends B { constructor(super()) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast b/crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast deleted file mode 100644 index 5f0989672bc4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast +++ /dev/null @@ -1,85 +0,0 @@ -JsRoot { - interpreter_token: missing (optional), - directives: [], - statements: [ - JsSwitchStatement { - switch_token: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")], - l_paren_token: L_PAREN@7..8 "(" [] [], - discriminant: JsReferenceIdentifierExpression { - name_token: IDENT@8..11 "foo" [] [], - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - l_curly_token: L_CURLY@13..14 "{" [] [], - cases: [ - JsDefaultClause { - default_token: DEFAULT_KW@14..23 "default" [Whitespace("\n\t")] [], - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - consequent: [ - JsBlockStatement { - l_curly_token: L_CURLY@25..26 "{" [] [], - statements: [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - ], - }, - JsDefaultClause { - default_token: DEFAULT_KW@27..36 "default" [Whitespace("\n\t")] [], - colon_token: COLON@36..38 ":" [] [Whitespace(" ")], - consequent: [ - JsBlockStatement { - l_curly_token: L_CURLY@38..39 "{" [] [], - statements: [], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@40..42 "}" [Whitespace("\n")] [], - }, - ], -} - -0: JS_ROOT@0..43 - 0: (empty) - 1: LIST@0..0 - 2: LIST@0..42 - 0: JS_SWITCH_STATEMENT@0..42 - 0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")] - 1: L_PAREN@7..8 "(" [] [] - 2: JS_REFERENCE_IDENTIFIER_EXPRESSION@8..11 - 0: IDENT@8..11 "foo" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: L_CURLY@13..14 "{" [] [] - 5: LIST@14..40 - 0: JS_DEFAULT_CLAUSE@14..27 - 0: DEFAULT_KW@14..23 "default" [Whitespace("\n\t")] [] - 1: COLON@23..25 ":" [] [Whitespace(" ")] - 2: LIST@25..27 - 0: JS_BLOCK_STATEMENT@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: LIST@26..26 - 2: R_CURLY@26..27 "}" [] [] - 1: JS_DEFAULT_CLAUSE@27..40 - 0: DEFAULT_KW@27..36 "default" [Whitespace("\n\t")] [] - 1: COLON@36..38 ":" [] [Whitespace(" ")] - 2: LIST@38..40 - 0: JS_BLOCK_STATEMENT@38..40 - 0: L_CURLY@38..39 "{" [] [] - 1: LIST@39..39 - 2: R_CURLY@39..40 "}" [] [] - 6: R_CURLY@40..42 "}" [Whitespace("\n")] [] - 3: EOF@42..43 "" [Whitespace("\n")] [] --- -error[SyntaxError]: Multiple default clauses inside of a switch statement are not allowed - ┌─ switch_stmt_double_default.js:3:2 - │ -2 │ default: {} - │ ---------- the first default clause is defined here -3 │ default: {} - │ ^^^^^^^^^^ a second clause here is not allowed - --- -switch (foo) { - default: {} - default: {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.rast deleted file mode 100644 index 8b784cbf6682..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.rast +++ /dev/null @@ -1,437 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsSwitchStatement { - switch_token: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")], - l_paren_token: missing (required), - discriminant: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..11 "foo" [] [Whitespace(" ")], - }, - }, - r_paren_token: missing (required), - l_curly_token: L_CURLY@11..12 "{" [] [], - cases: JsSwitchCaseList [], - r_curly_token: R_CURLY@12..13 "}" [] [], - }, - JsSwitchStatement { - switch_token: SWITCH_KW@13..21 "switch" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - discriminant: missing (required), - r_paren_token: missing (required), - l_curly_token: L_CURLY@21..22 "{" [] [], - cases: JsSwitchCaseList [], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - JsSwitchStatement { - switch_token: SWITCH_KW@23..31 "switch" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - discriminant: missing (required), - r_paren_token: missing (required), - l_curly_token: L_CURLY@31..33 "{" [] [Whitespace(" ")], - cases: JsSwitchCaseList [ - JsCaseClause { - case_token: missing (required), - test: missing (required), - colon_token: missing (required), - consequent: JsStatementList [ - JsBogusStatement { - items: [ - VAR_KW@33..37 "var" [] [Whitespace(" ")], - IDENT@37..39 "i" [] [Whitespace(" ")], - EQ@39..41 "=" [] [Whitespace(" ")], - JS_NUMBER_LITERAL@41..43 "0" [] [Whitespace(" ")], - ], - }, - ], - }, - ], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - JsSwitchStatement { - switch_token: SWITCH_KW@44..52 "switch" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - discriminant: missing (required), - r_paren_token: missing (required), - l_curly_token: L_CURLY@52..54 "{" [] [Whitespace(" ")], - cases: JsSwitchCaseList [ - JsCaseClause { - case_token: missing (required), - test: missing (required), - colon_token: missing (required), - consequent: JsStatementList [ - JsBogusStatement { - items: [ - VAR_KW@54..58 "var" [] [Whitespace(" ")], - IDENT@58..60 "i" [] [Whitespace(" ")], - EQ@60..62 "=" [] [Whitespace(" ")], - JS_NUMBER_LITERAL@62..63 "0" [] [], - SEMICOLON@63..65 ";" [] [Whitespace(" ")], - ], - }, - ], - }, - JsCaseClause { - case_token: CASE_KW@65..70 "case" [] [Whitespace(" ")], - test: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@70..75 "\"bar\"" [] [], - }, - colon_token: COLON@75..77 ":" [] [Whitespace(" ")], - consequent: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@77..78 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@78..80 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@80..81 "}" [] [], - }, - JsSwitchStatement { - switch_token: SWITCH_KW@81..89 "switch" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@89..90 "(" [] [], - discriminant: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@90..93 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@93..95 ")" [] [Whitespace(" ")], - l_curly_token: L_CURLY@95..96 "{" [] [], - cases: JsSwitchCaseList [ - JsDefaultClause { - default_token: DEFAULT_KW@96..106 "default" [Newline("\n"), Whitespace(" ")] [], - colon_token: COLON@106..108 ":" [] [Whitespace(" ")], - consequent: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@108..109 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@109..110 "}" [] [], - }, - ], - }, - JsCaseClause { - case_token: missing (required), - test: JsBogusExpression { - items: [ - DEFAULT_KW@110..120 "default" [Newline("\n"), Whitespace(" ")] [], - ], - }, - colon_token: COLON@120..122 ":" [] [Whitespace(" ")], - consequent: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@122..123 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@123..124 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@124..126 "}" [Newline("\n")] [], - }, - JsSwitchStatement { - switch_token: SWITCH_KW@126..134 "switch" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@134..135 "(" [] [], - discriminant: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@135..138 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@138..140 ")" [] [Whitespace(" ")], - l_curly_token: L_CURLY@140..142 "{" [] [Whitespace(" ")], - cases: JsSwitchCaseList [ - JsCaseClause { - case_token: CASE_KW@142..147 "case" [] [Whitespace(" ")], - test: missing (required), - colon_token: COLON@147..149 ":" [] [Whitespace(" ")], - consequent: JsStatementList [], - }, - ], - r_curly_token: R_CURLY@149..150 "}" [] [], - }, - ], - eof_token: EOF@150..151 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..151 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..150 - 0: JS_SWITCH_STATEMENT@0..13 - 0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_EXPRESSION@7..11 - 0: JS_REFERENCE_IDENTIFIER@7..11 - 0: IDENT@7..11 "foo" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@11..12 "{" [] [] - 5: JS_SWITCH_CASE_LIST@12..12 - 6: R_CURLY@12..13 "}" [] [] - 1: JS_SWITCH_STATEMENT@13..23 - 0: SWITCH_KW@13..21 "switch" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: L_CURLY@21..22 "{" [] [] - 5: JS_SWITCH_CASE_LIST@22..22 - 6: R_CURLY@22..23 "}" [] [] - 2: JS_SWITCH_STATEMENT@23..44 - 0: SWITCH_KW@23..31 "switch" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: L_CURLY@31..33 "{" [] [Whitespace(" ")] - 5: JS_SWITCH_CASE_LIST@33..43 - 0: JS_CASE_CLAUSE@33..43 - 0: (empty) - 1: (empty) - 2: (empty) - 3: JS_STATEMENT_LIST@33..43 - 0: JS_BOGUS_STATEMENT@33..43 - 0: VAR_KW@33..37 "var" [] [Whitespace(" ")] - 1: IDENT@37..39 "i" [] [Whitespace(" ")] - 2: EQ@39..41 "=" [] [Whitespace(" ")] - 3: JS_NUMBER_LITERAL@41..43 "0" [] [Whitespace(" ")] - 6: R_CURLY@43..44 "}" [] [] - 3: JS_SWITCH_STATEMENT@44..81 - 0: SWITCH_KW@44..52 "switch" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: L_CURLY@52..54 "{" [] [Whitespace(" ")] - 5: JS_SWITCH_CASE_LIST@54..80 - 0: JS_CASE_CLAUSE@54..65 - 0: (empty) - 1: (empty) - 2: (empty) - 3: JS_STATEMENT_LIST@54..65 - 0: JS_BOGUS_STATEMENT@54..65 - 0: VAR_KW@54..58 "var" [] [Whitespace(" ")] - 1: IDENT@58..60 "i" [] [Whitespace(" ")] - 2: EQ@60..62 "=" [] [Whitespace(" ")] - 3: JS_NUMBER_LITERAL@62..63 "0" [] [] - 4: SEMICOLON@63..65 ";" [] [Whitespace(" ")] - 1: JS_CASE_CLAUSE@65..80 - 0: CASE_KW@65..70 "case" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@70..75 - 0: JS_STRING_LITERAL@70..75 "\"bar\"" [] [] - 2: COLON@75..77 ":" [] [Whitespace(" ")] - 3: JS_STATEMENT_LIST@77..80 - 0: JS_BLOCK_STATEMENT@77..80 - 0: L_CURLY@77..78 "{" [] [] - 1: JS_STATEMENT_LIST@78..78 - 2: R_CURLY@78..80 "}" [] [Whitespace(" ")] - 6: R_CURLY@80..81 "}" [] [] - 4: JS_SWITCH_STATEMENT@81..126 - 0: SWITCH_KW@81..89 "switch" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@89..90 "(" [] [] - 2: JS_IDENTIFIER_EXPRESSION@90..93 - 0: JS_REFERENCE_IDENTIFIER@90..93 - 0: IDENT@90..93 "foo" [] [] - 3: R_PAREN@93..95 ")" [] [Whitespace(" ")] - 4: L_CURLY@95..96 "{" [] [] - 5: JS_SWITCH_CASE_LIST@96..124 - 0: JS_DEFAULT_CLAUSE@96..110 - 0: DEFAULT_KW@96..106 "default" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@106..108 ":" [] [Whitespace(" ")] - 2: JS_STATEMENT_LIST@108..110 - 0: JS_BLOCK_STATEMENT@108..110 - 0: L_CURLY@108..109 "{" [] [] - 1: JS_STATEMENT_LIST@109..109 - 2: R_CURLY@109..110 "}" [] [] - 1: JS_CASE_CLAUSE@110..124 - 0: (empty) - 1: JS_BOGUS_EXPRESSION@110..120 - 0: DEFAULT_KW@110..120 "default" [Newline("\n"), Whitespace(" ")] [] - 2: COLON@120..122 ":" [] [Whitespace(" ")] - 3: JS_STATEMENT_LIST@122..124 - 0: JS_BLOCK_STATEMENT@122..124 - 0: L_CURLY@122..123 "{" [] [] - 1: JS_STATEMENT_LIST@123..123 - 2: R_CURLY@123..124 "}" [] [] - 6: R_CURLY@124..126 "}" [Newline("\n")] [] - 5: JS_SWITCH_STATEMENT@126..150 - 0: SWITCH_KW@126..134 "switch" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@134..135 "(" [] [] - 2: JS_IDENTIFIER_EXPRESSION@135..138 - 0: JS_REFERENCE_IDENTIFIER@135..138 - 0: IDENT@135..138 "foo" [] [] - 3: R_PAREN@138..140 ")" [] [Whitespace(" ")] - 4: L_CURLY@140..142 "{" [] [Whitespace(" ")] - 5: JS_SWITCH_CASE_LIST@142..149 - 0: JS_CASE_CLAUSE@142..149 - 0: CASE_KW@142..147 "case" [] [Whitespace(" ")] - 1: (empty) - 2: COLON@147..149 ":" [] [Whitespace(" ")] - 3: JS_STATEMENT_LIST@149..149 - 6: R_CURLY@149..150 "}" [] [] - 4: EOF@150..151 "" [Newline("\n")] [] --- -switch_stmt_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `foo` - - > 1 │ switch foo {} - │ ^^^ - 2 │ switch {} - 3 │ switch { var i = 0 } - - i Remove foo - --- -switch_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `{` - - > 1 │ switch foo {} - │ ^ - 2 │ switch {} - 3 │ switch { var i = 0 } - - i Remove { - --- -switch_stmt_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `{` - - 1 │ switch foo {} - > 2 │ switch {} - │ ^ - 3 │ switch { var i = 0 } - 4 │ switch { var i = 0; case "bar": {} } - - i Remove { - --- -switch_stmt_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `{` - - 1 │ switch foo {} - 2 │ switch {} - > 3 │ switch { var i = 0 } - │ ^ - 4 │ switch { var i = 0; case "bar": {} } - 5 │ switch (foo) { - - i Remove { - --- -switch_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a default, or a case but instead found 'var i = 0'. - - 1 │ switch foo {} - 2 │ switch {} - > 3 │ switch { var i = 0 } - │ ^^^^^^^^^ - 4 │ switch { var i = 0; case "bar": {} } - 5 │ switch (foo) { - - i Expected a default, or a case here. - - 1 │ switch foo {} - 2 │ switch {} - > 3 │ switch { var i = 0 } - │ ^^^^^^^^^ - 4 │ switch { var i = 0; case "bar": {} } - 5 │ switch (foo) { - --- -switch_stmt_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `{` - - 2 │ switch {} - 3 │ switch { var i = 0 } - > 4 │ switch { var i = 0; case "bar": {} } - │ ^ - 5 │ switch (foo) { - 6 │ default: {} - - i Remove { - --- -switch_stmt_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a default, or a case but instead found 'var i = 0;'. - - 2 │ switch {} - 3 │ switch { var i = 0 } - > 4 │ switch { var i = 0; case "bar": {} } - │ ^^^^^^^^^^ - 5 │ switch (foo) { - 6 │ default: {} - - i Expected a default, or a case here. - - 2 │ switch {} - 3 │ switch { var i = 0 } - > 4 │ switch { var i = 0; case "bar": {} } - │ ^^^^^^^^^^ - 5 │ switch (foo) { - 6 │ default: {} - --- -switch_stmt_err.js:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Multiple default clauses inside of a switch statement are not allowed - - 5 │ switch (foo) { - 6 │ default: {} - > 7 │ default: {} - │ ^^^^^^^^^^^ - 8 │ } - 9 │ switch (foo) { case : } - - i a second clause here is not allowed - - 5 │ switch (foo) { - 6 │ default: {} - > 7 │ default: {} - │ ^^^^^^^^^^^ - 8 │ } - 9 │ switch (foo) { case : } - - i the first default clause is defined here - - 4 │ switch { var i = 0; case "bar": {} } - 5 │ switch (foo) { - > 6 │ default: {} - │ ^^^^^^^^^^^ - 7 │ default: {} - 8 │ } - --- -switch_stmt_err.js:9:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ':'. - - 7 │ default: {} - 8 │ } - > 9 │ switch (foo) { case : } - │ ^ - 10 │ - - i Expected an expression here. - - 7 │ default: {} - 8 │ } - > 9 │ switch (foo) { case : } - │ ^ - 10 │ - --- -switch foo {} -switch {} -switch { var i = 0 } -switch { var i = 0; case "bar": {} } -switch (foo) { - default: {} - default: {} -} -switch (foo) { case : } diff --git a/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.rast b/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.rast deleted file mode 100644 index 7d7b1f2806e3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.rast +++ /dev/null @@ -1,223 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "obj" [] [], - }, - }, - operator_token: DOT@3..4 "." [] [], - member: JsName { - value_token: IDENT@4..7 "val" [] [], - }, - }, - operator_token: QUESTIONDOT@7..9 "?." [] [], - member: JsName { - value_token: IDENT@9..13 "prop" [] [], - }, - }, - BACKTICK@13..14 "`" [] [], - JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@14..22 "template" [] [], - }, - ], - BACKTICK@22..23 "`" [] [], - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsComputedMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..27 "obj" [Newline("\n")] [], - }, - }, - operator_token: DOT@27..28 "." [] [], - member: JsName { - value_token: IDENT@28..31 "val" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@31..33 "?." [] [], - l_brack_token: L_BRACK@33..34 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@34..38 "expr" [] [], - }, - }, - r_brack_token: R_BRACK@38..39 "]" [] [], - }, - BACKTICK@39..40 "`" [] [], - JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@40..48 "template" [] [], - }, - ], - BACKTICK@48..49 "`" [] [], - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..53 "obj" [Newline("\n")] [], - }, - }, - operator_token: DOT@53..54 "." [] [], - member: JsName { - value_token: IDENT@54..58 "func" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@58..60 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@60..61 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@61..65 "args" [] [], - }, - }, - ], - r_paren_token: R_PAREN@65..66 ")" [] [], - }, - }, - BACKTICK@66..67 "`" [] [], - JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@67..75 "template" [] [], - }, - ], - BACKTICK@75..76 "`" [] [], - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@76..77 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..77 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..76 - 0: JS_EXPRESSION_STATEMENT@0..23 - 0: JS_BOGUS_EXPRESSION@0..23 - 0: JS_STATIC_MEMBER_EXPRESSION@0..13 - 0: JS_STATIC_MEMBER_EXPRESSION@0..7 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "obj" [] [] - 1: DOT@3..4 "." [] [] - 2: JS_NAME@4..7 - 0: IDENT@4..7 "val" [] [] - 1: QUESTIONDOT@7..9 "?." [] [] - 2: JS_NAME@9..13 - 0: IDENT@9..13 "prop" [] [] - 1: BACKTICK@13..14 "`" [] [] - 2: JS_TEMPLATE_ELEMENT_LIST@14..22 - 0: JS_TEMPLATE_CHUNK_ELEMENT@14..22 - 0: TEMPLATE_CHUNK@14..22 "template" [] [] - 3: BACKTICK@22..23 "`" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@23..49 - 0: JS_BOGUS_EXPRESSION@23..49 - 0: JS_COMPUTED_MEMBER_EXPRESSION@23..39 - 0: JS_STATIC_MEMBER_EXPRESSION@23..31 - 0: JS_IDENTIFIER_EXPRESSION@23..27 - 0: JS_REFERENCE_IDENTIFIER@23..27 - 0: IDENT@23..27 "obj" [Newline("\n")] [] - 1: DOT@27..28 "." [] [] - 2: JS_NAME@28..31 - 0: IDENT@28..31 "val" [] [] - 1: QUESTIONDOT@31..33 "?." [] [] - 2: L_BRACK@33..34 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@34..38 - 0: JS_REFERENCE_IDENTIFIER@34..38 - 0: IDENT@34..38 "expr" [] [] - 4: R_BRACK@38..39 "]" [] [] - 1: BACKTICK@39..40 "`" [] [] - 2: JS_TEMPLATE_ELEMENT_LIST@40..48 - 0: JS_TEMPLATE_CHUNK_ELEMENT@40..48 - 0: TEMPLATE_CHUNK@40..48 "template" [] [] - 3: BACKTICK@48..49 "`" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@49..76 - 0: JS_BOGUS_EXPRESSION@49..76 - 0: JS_CALL_EXPRESSION@49..66 - 0: JS_STATIC_MEMBER_EXPRESSION@49..58 - 0: JS_IDENTIFIER_EXPRESSION@49..53 - 0: JS_REFERENCE_IDENTIFIER@49..53 - 0: IDENT@49..53 "obj" [Newline("\n")] [] - 1: DOT@53..54 "." [] [] - 2: JS_NAME@54..58 - 0: IDENT@54..58 "func" [] [] - 1: QUESTIONDOT@58..60 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@60..66 - 0: L_PAREN@60..61 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@61..65 - 0: JS_IDENTIFIER_EXPRESSION@61..65 - 0: JS_REFERENCE_IDENTIFIER@61..65 - 0: IDENT@61..65 "args" [] [] - 2: R_PAREN@65..66 ")" [] [] - 1: BACKTICK@66..67 "`" [] [] - 2: JS_TEMPLATE_ELEMENT_LIST@67..75 - 0: JS_TEMPLATE_CHUNK_ELEMENT@67..75 - 0: TEMPLATE_CHUNK@67..75 "template" [] [] - 3: BACKTICK@75..76 "`" [] [] - 1: (empty) - 4: EOF@76..77 "" [Newline("\n")] [] --- -template_after_optional_chain.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Tagged template expressions are not permitted in an optional chain. - - > 1 │ obj.val?.prop`template` - │ ^^^^^^^^^^^^^^^^^^^^^^^ - 2 │ obj.val?.[expr]`template` - 3 │ obj.func?.(args)`template` - --- -template_after_optional_chain.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Tagged template expressions are not permitted in an optional chain. - - 1 │ obj.val?.prop`template` - > 2 │ obj.val?.[expr]`template` - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 │ obj.func?.(args)`template` - 4 │ - --- -template_after_optional_chain.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Tagged template expressions are not permitted in an optional chain. - - 1 │ obj.val?.prop`template` - 2 │ obj.val?.[expr]`template` - > 3 │ obj.func?.(args)`template` - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ - --- -obj.val?.prop`template` -obj.val?.[expr]`template` -obj.func?.(args)`template` diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal.rast b/crates/biome_js_parser/test_data/inline/err/template_literal.rast deleted file mode 100644 index 9c31fbffd8a9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/template_literal.rast +++ /dev/null @@ -1,173 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@8..9 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@9..13 "foo " [] [], - }, - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@13..15 "${" [] [], - expression: missing (required), - r_curly_token: R_CURLY@15..16 "}" [] [], - }, - ], - r_tick_token: BACKTICK@16..17 "`" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@22..24 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - BACKTICK@26..27 "`" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - DOLLAR_CURLY@27..29 "${" [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@29..31 "a" [] [Whitespace(" ")], - }, - }, - JsBogus { - items: [ - IDENT@31..32 "a" [] [], - ], - }, - R_CURLY@32..33 "}" [] [], - ], - }, - ], - }, - BACKTICK@33..34 "`" [] [], - ], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_VARIABLE_STATEMENT@0..17 - 0: JS_VARIABLE_DECLARATION@0..17 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..17 - 0: JS_VARIABLE_DECLARATOR@4..17 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..17 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@8..17 - 0: (empty) - 1: (empty) - 2: BACKTICK@8..9 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@9..16 - 0: JS_TEMPLATE_CHUNK_ELEMENT@9..13 - 0: TEMPLATE_CHUNK@9..13 "foo " [] [] - 1: JS_TEMPLATE_ELEMENT@13..16 - 0: DOLLAR_CURLY@13..15 "${" [] [] - 1: (empty) - 2: R_CURLY@15..16 "}" [] [] - 4: BACKTICK@16..17 "`" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@17..34 - 0: JS_VARIABLE_DECLARATION@17..34 - 0: (empty) - 1: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@22..34 - 0: JS_VARIABLE_DECLARATOR@22..34 - 0: JS_IDENTIFIER_BINDING@22..24 - 0: IDENT@22..24 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@24..34 - 0: EQ@24..26 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@26..34 - 0: BACKTICK@26..27 "`" [] [] - 1: JS_BOGUS@27..33 - 0: JS_BOGUS@27..33 - 0: DOLLAR_CURLY@27..29 "${" [] [] - 1: JS_IDENTIFIER_EXPRESSION@29..31 - 0: JS_REFERENCE_IDENTIFIER@29..31 - 0: IDENT@29..31 "a" [] [Whitespace(" ")] - 2: JS_BOGUS@31..32 - 0: IDENT@31..32 "a" [] [] - 3: R_CURLY@32..33 "}" [] [] - 2: BACKTICK@33..34 "`" [] [] - 1: (empty) - 4: EOF@34..35 "" [Newline("\n")] [] --- -template_literal.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '}'. - - > 1 │ let a = `foo ${}` - │ ^ - 2 │ let b = `${a a}` - 3 │ - - i Expected an expression here. - - > 1 │ let a = `foo ${}` - │ ^ - 2 │ let b = `${a a}` - 3 │ - --- -template_literal.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead found `a` - - 1 │ let a = `foo ${}` - > 2 │ let b = `${a a}` - │ ^ - 3 │ - - i Remove a - --- -let a = `foo ${}` -let b = `${a a}` diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.rast b/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.rast deleted file mode 100644 index da0b7ce0d4ca..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@8..9 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@9..11 "${" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..14 "foo" [] [], - }, - }, - r_curly_token: R_CURLY@14..15 "}" [] [], - }, - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@15..20 " bar\n" [] [], - }, - ], - r_tick_token: missing (required), - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@20..20 "" [] [], -} - -0: JS_MODULE@0..20 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_VARIABLE_STATEMENT@0..20 - 0: JS_VARIABLE_DECLARATION@0..20 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..20 - 0: JS_VARIABLE_DECLARATOR@4..20 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..20 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@8..20 - 0: (empty) - 1: (empty) - 2: BACKTICK@8..9 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@9..20 - 0: JS_TEMPLATE_ELEMENT@9..15 - 0: DOLLAR_CURLY@9..11 "${" [] [] - 1: JS_IDENTIFIER_EXPRESSION@11..14 - 0: JS_REFERENCE_IDENTIFIER@11..14 - 0: IDENT@11..14 "foo" [] [] - 2: R_CURLY@14..15 "}" [] [] - 1: JS_TEMPLATE_CHUNK_ELEMENT@15..20 - 0: TEMPLATE_CHUNK@15..20 " bar\n" [] [] - 4: (empty) - 1: (empty) - 4: EOF@20..20 "" [] [] --- -template_literal_unterminated.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated template literal - - > 1 │ let a = `${foo} bar - │ ^^^^ - > 2 │ - │ - --- -let a = `${foo} bar diff --git a/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.rast deleted file mode 100644 index 66b0f553194b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.rast +++ /dev/null @@ -1,112 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsThrowStatement { - throw_token: THROW_KW@0..5 "throw" [] [], - argument: missing (required), - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@5..10 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..15 "Error" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@15..16 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@16..26 "\"oh no :(\"" [] [], - }, - ], - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsThrowStatement { - throw_token: THROW_KW@27..33 "throw" [Newline("\n")] [], - argument: missing (required), - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_THROW_STATEMENT@0..5 - 0: THROW_KW@0..5 "throw" [] [] - 1: (empty) - 2: (empty) - 1: JS_EXPRESSION_STATEMENT@5..27 - 0: JS_NEW_EXPRESSION@5..27 - 0: NEW_KW@5..10 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@10..15 - 0: JS_REFERENCE_IDENTIFIER@10..15 - 0: IDENT@10..15 "Error" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@15..27 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@16..26 - 0: JS_STRING_LITERAL_EXPRESSION@16..26 - 0: JS_STRING_LITERAL@16..26 "\"oh no :(\"" [] [] - 2: R_PAREN@26..27 ")" [] [] - 1: (empty) - 2: JS_THROW_STATEMENT@27..34 - 0: THROW_KW@27..33 "throw" [Newline("\n")] [] - 1: (empty) - 2: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] --- -throw_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Linebreaks between a throw statement and the error to be thrown are not allowed - - 1 │ throw - > 2 │ new Error("oh no :(") - │ ^^^ - 3 │ throw; - 4 │ - - i A linebreak is not allowed here - - i Help: did you mean to throw this? - - 1 │ throw - > 2 │ new Error("oh no :(") - │ ^^^ - 3 │ throw; - 4 │ - --- -throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ';'. - - 1 │ throw - 2 │ new Error("oh no :(") - > 3 │ throw; - │ ^ - 4 │ - - i Expected an expression here. - - 1 │ throw - 2 │ new Error("oh no :(") - > 3 │ throw; - │ ^ - 4 │ - --- -throw -new Error("oh no :(") -throw; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast b/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast deleted file mode 100644 index 3c34d6bbc332..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast +++ /dev/null @@ -1,247 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@28..39 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@39..40 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - }, - ], - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@42..51 "abstract" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@51..57 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@57..58 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - TsGetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@60..69 "abstract" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@69..73 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@73..79 "getter" [] [], - }, - l_paren_token: L_PAREN@79..80 "(" [] [], - r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], - return_type: missing (optional), - semicolon_token: missing (optional), - }, - TsSetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@82..91 "abstract" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@91..95 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@95..101 "setter" [] [], - }, - l_paren_token: L_PAREN@101..102 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@102..107 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], - semicolon_token: missing (optional), - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@109..118 "abstract" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@118..123 "prop" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@123..124 "}" [] [], - }, - ], - eof_token: EOF@124..125 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..125 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..124 - 0: JS_CLASS_DECLARATION@0..124 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@19..123 - 0: JS_BOGUS_MEMBER@19..42 - 0: JS_BOGUS@19..28 - 0: TS_ABSTRACT_MODIFIER@19..28 - 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@28..39 - 0: IDENT@28..39 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@39..42 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@40..40 - 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@42..60 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@42..51 - 0: TS_ABSTRACT_MODIFIER@42..51 - 0: ABSTRACT_KW@42..51 "abstract" [] [Whitespace(" ")] - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@51..57 - 0: IDENT@51..57 "method" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@57..60 - 0: L_PAREN@57..58 "(" [] [] - 1: JS_PARAMETER_LIST@58..58 - 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] - 6: (empty) - 7: (empty) - 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@60..82 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@60..69 - 0: TS_ABSTRACT_MODIFIER@60..69 - 0: ABSTRACT_KW@60..69 "abstract" [] [Whitespace(" ")] - 1: GET_KW@69..73 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@73..79 - 0: IDENT@73..79 "getter" [] [] - 3: L_PAREN@79..80 "(" [] [] - 4: R_PAREN@80..82 ")" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@82..109 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@82..91 - 0: TS_ABSTRACT_MODIFIER@82..91 - 0: ABSTRACT_KW@82..91 "abstract" [] [Whitespace(" ")] - 1: SET_KW@91..95 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@95..101 - 0: IDENT@95..101 "setter" [] [] - 3: L_PAREN@101..102 "(" [] [] - 4: JS_FORMAL_PARAMETER@102..107 - 0: JS_DECORATOR_LIST@102..102 - 1: JS_IDENTIFIER_BINDING@102..107 - 0: IDENT@102..107 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@107..109 ")" [] [Whitespace(" ")] - 7: (empty) - 4: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@109..123 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@109..118 - 0: TS_ABSTRACT_MODIFIER@109..118 - 0: ABSTRACT_KW@109..118 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@118..123 - 0: IDENT@118..123 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 9: R_CURLY@123..124 "}" [] [] - 4: EOF@124..125 "" [Newline("\n")] [] --- -ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found 'abstract'. - - > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^ - 2 │ - - i Expected a class method body here. - - > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^ - 2 │ - --- -ts_abstract_member_ansi.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' cannot appear on a constructor declaration. - - > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^ - 2 │ - --- -ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the method declaration, but found none - - > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^^^^^^^^^^ - 2 │ - --- -ts_abstract_member_ansi.ts:1:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the method declaration, but found none - - > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^^^^^^^^^^^^^^ - 2 │ - --- -ts_abstract_member_ansi.ts:1:83 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the method declaration, but found none - - > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ - 2 │ - --- -abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast b/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast deleted file mode 100644 index ad178e49df32..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast +++ /dev/null @@ -1,94 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@33..37 "name" [] [], - }, - JsBogus { - items: [ - BANG@37..38 "!" [] [], - TsTypeAnnotation { - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@40..46 "string" [] [], - }, - }, - ], - }, - SEMICOLON@46..47 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@47..49 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_CLASS_DECLARATION@0..49 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..47 - 0: JS_BOGUS_MEMBER@18..47 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..33 - 0: TS_ABSTRACT_MODIFIER@18..33 - 0: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@33..37 - 0: IDENT@33..37 "name" [] [] - 2: JS_BOGUS@37..46 - 0: BANG@37..38 "!" [] [] - 1: TS_TYPE_ANNOTATION@38..46 - 0: COLON@38..40 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@40..46 - 0: STRING_KW@40..46 "string" [] [] - 3: SEMICOLON@46..47 ";" [] [] - 9: R_CURLY@47..49 "}" [Newline("\n")] [] - 4: EOF@49..50 "" [Newline("\n")] [] --- -ts_abstract_property_cannot_be_definite.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A definite assignment operator '!' cannot appear on an 'abstract' property. - - 1 │ abstract class A { - > 2 │ abstract name!: string; - │ ^ - 3 │ } - 4 │ - --- -abstract class A { - abstract name!: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast b/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast deleted file mode 100644 index 226a36a92371..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast +++ /dev/null @@ -1,97 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@32..36 "name" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@36..38 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@38..45 "string" [] [Whitespace(" ")], - }, - }, - JsInitializerClause { - eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@47..49 "\"\"" [] [], - }, - }, - SEMICOLON@49..50 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@52..53 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..53 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..52 - 0: JS_CLASS_DECLARATION@0..52 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..50 - 0: JS_BOGUS_MEMBER@18..50 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..32 - 0: TS_ABSTRACT_MODIFIER@18..32 - 0: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@32..36 - 0: IDENT@32..36 "name" [] [] - 2: TS_TYPE_ANNOTATION@36..45 - 0: COLON@36..38 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@38..45 - 0: STRING_KW@38..45 "string" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@45..49 - 0: EQ@45..47 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@47..49 - 0: JS_STRING_LITERAL@47..49 "\"\"" [] [] - 4: SEMICOLON@49..50 ";" [] [] - 9: R_CURLY@50..52 "}" [Newline("\n")] [] - 4: EOF@52..53 "" [Newline("\n")] [] --- -ts_abstract_property_cannot_have_initiliazers.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Property cannot have an initializer because it is marked abstract. - - 1 │ abstract class A { - > 2 │ abstract name: string = ""; - │ ^^^^ - 3 │ } - 4 │ - --- -abstract class A { - abstract name: string = ""; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.rast b/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.rast deleted file mode 100644 index 56ae7e6c1e19..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.rast +++ /dev/null @@ -1,81 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - ASYNC_KW@18..24 "async" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@24..30 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@30..31 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@31..32 ")" [] [], - }, - SEMICOLON@32..34 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: TS_DECLARE_STATEMENT@0..35 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..35 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..34 - 0: JS_BOGUS_MEMBER@18..34 - 0: ASYNC_KW@18..24 "async" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@24..30 - 0: IDENT@24..30 "method" [] [] - 2: JS_PARAMETERS@30..32 - 0: L_PAREN@30..31 "(" [] [] - 1: JS_PARAMETER_LIST@31..31 - 2: R_PAREN@31..32 ")" [] [] - 3: SEMICOLON@32..34 ";" [] [Whitespace(" ")] - 9: R_CURLY@34..35 "}" [] [] - 4: EOF@35..36 "" [Newline("\n")] [] --- -ts_ambient_async_method.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'async' modifier cannot be used in an ambient context. - - > 1 │ declare class A { async method(); } - │ ^^^^^^^^^^^^^^^ - 2 │ - --- -declare class A { async method(); } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast b/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast deleted file mode 100644 index 8b1ee51490d0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast +++ /dev/null @@ -1,154 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@18..24 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@24..25 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@27..34 "method2" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@34..35 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@35..37 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@37..44 "method3" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@47..48 "}" [] [], - }, - }, - ], - eof_token: EOF@48..49 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..49 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..48 - 0: TS_DECLARE_STATEMENT@0..48 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..48 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..47 - 0: TS_METHOD_SIGNATURE_CLASS_MEMBER@18..27 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@18..18 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@18..24 - 0: IDENT@18..24 "method" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@24..27 - 0: L_PAREN@24..25 "(" [] [] - 1: JS_PARAMETER_LIST@25..25 - 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] - 6: (empty) - 7: (empty) - 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@27..37 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@27..27 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@27..34 - 0: IDENT@27..34 "method2" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@34..37 - 0: L_PAREN@34..35 "(" [] [] - 1: JS_PARAMETER_LIST@35..35 - 2: R_PAREN@35..37 ")" [] [Whitespace(" ")] - 6: (empty) - 7: (empty) - 2: TS_METHOD_SIGNATURE_CLASS_MEMBER@37..47 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@37..37 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@37..44 - 0: IDENT@37..44 "method3" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..45 - 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 6: (empty) - 7: (empty) - 9: R_CURLY@47..48 "}" [] [] - 4: EOF@48..49 "" [Newline("\n")] [] --- -ts_ambient_context_semi.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the method declaration, but found none - - > 1 │ declare class A { method() method2() method3() } - │ ^^^^^^^^ - 2 │ - --- -ts_ambient_context_semi.ts:1:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a semicolon to end the method declaration, but found none - - > 1 │ declare class A { method() method2() method3() } - │ ^^^^^^^^^ - 2 │ - --- -declare class A { method() method2() method3() } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast b/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast deleted file mode 100644 index cf797885754e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast +++ /dev/null @@ -1,196 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "T" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@27..28 "b" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@30..37 "string" [] [Whitespace(" ")], - }, - }, - JsInitializerClause { - eq_token: EQ@37..39 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@39..45 "\"test\"" [] [], - }, - }, - SEMICOLON@45..47 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@47..48 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@48..55 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@55..57 "T" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@59..67 "declare" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@67..76 "readonly" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@76..77 "b" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@77..79 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@79..86 "string" [] [Whitespace(" ")], - }, - }, - JsInitializerClause { - eq_token: EQ@86..88 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@88..94 "\"test\"" [] [], - }, - }, - SEMICOLON@94..96 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@96..97 "}" [] [], - }, - ], - eof_token: EOF@97..98 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..98 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..97 - 0: TS_DECLARE_STATEMENT@0..48 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..48 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "T" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..47 - 0: JS_BOGUS_MEMBER@18..47 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..27 - 0: TS_READONLY_MODIFIER@18..27 - 0: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@27..28 - 0: IDENT@27..28 "b" [] [] - 2: TS_TYPE_ANNOTATION@28..37 - 0: COLON@28..30 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@30..37 - 0: STRING_KW@30..37 "string" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@37..45 - 0: EQ@37..39 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@39..45 - 0: JS_STRING_LITERAL@39..45 "\"test\"" [] [] - 4: SEMICOLON@45..47 ";" [] [Whitespace(" ")] - 9: R_CURLY@47..48 "}" [] [] - 1: JS_CLASS_DECLARATION@48..97 - 0: JS_DECORATOR_LIST@48..48 - 1: (empty) - 2: CLASS_KW@48..55 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@55..57 - 0: IDENT@55..57 "T" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@57..59 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@59..96 - 0: JS_BOGUS_MEMBER@59..96 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@59..76 - 0: TS_DECLARE_MODIFIER@59..67 - 0: DECLARE_KW@59..67 "declare" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@67..76 - 0: READONLY_KW@67..76 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@76..77 - 0: IDENT@76..77 "b" [] [] - 2: TS_TYPE_ANNOTATION@77..86 - 0: COLON@77..79 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@79..86 - 0: STRING_KW@79..86 "string" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@86..94 - 0: EQ@86..88 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@88..94 - 0: JS_STRING_LITERAL@88..94 "\"test\"" [] [] - 4: SEMICOLON@94..96 ";" [] [Whitespace(" ")] - 9: R_CURLY@96..97 "}" [] [] - 4: EOF@97..98 "" [Newline("\n")] [] --- -ts_annotated_property_initializer_ambient_context.ts:1:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In ambient contexts, properties cannot have both a type annotation and an initializer. - - > 1 │ declare class T { readonly b: string = "test"; } - │ ^^^^^^^^ - 2 │ class T { declare readonly b: string = "test"; } - 3 │ - - i The type annotation is here: - - > 1 │ declare class T { readonly b: string = "test"; } - │ ^^^^^^^^ - 2 │ class T { declare readonly b: string = "test"; } - 3 │ - --- -ts_annotated_property_initializer_ambient_context.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In ambient contexts, properties cannot have both a type annotation and an initializer. - - 1 │ declare class T { readonly b: string = "test"; } - > 2 │ class T { declare readonly b: string = "test"; } - │ ^^^^^^^^ - 3 │ - - i The type annotation is here: - - 1 │ declare class T { readonly b: string = "test"; } - > 2 │ class T { declare readonly b: string = "test"; } - │ ^^^^^^^^ - 3 │ - --- -declare class T { readonly b: string = "test"; } -class T { declare readonly b: string = "test"; } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast b/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast deleted file mode 100644 index 04fc121156ac..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast +++ /dev/null @@ -1,105 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@8..9 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - THIS_KW@9..13 "this" [] [], - TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@15..21 "string" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_VARIABLE_STATEMENT@0..28 - 0: JS_VARIABLE_DECLARATION@0..28 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..28 - 0: JS_VARIABLE_DECLARATOR@4..28 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..28 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@8..28 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@8..23 - 0: L_PAREN@8..9 "(" [] [] - 1: JS_PARAMETER_LIST@9..21 - 0: JS_BOGUS_PARAMETER@9..21 - 0: THIS_KW@9..13 "this" [] [] - 1: TS_TYPE_ANNOTATION@13..21 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@15..21 - 0: STRING_KW@15..21 "string" [] [] - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@26..28 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..27 - 3: R_CURLY@27..28 "}" [] [] - 1: (empty) - 4: EOF@28..29 "" [Newline("\n")] [] --- -ts_arrow_function_this_parameter.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An arrow function cannot have a 'this' parameter. - - > 1 │ let a = (this: string) => {} - │ ^^^^^^^^^^^^ - 2 │ - --- -let a = (this: string) => {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast b/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast deleted file mode 100644 index 9d0789cb947a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast +++ /dev/null @@ -1,203 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@7..10 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")], - }, - as_token: AS_KW@14..17 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@17..24 "string" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@24..26 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@26..34 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@35..37 "(" [Newline("\n")] [], - assignment: TsAsAssignment { - assignment: JsBogusAssignment { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@37..38 "a" [] [], - }, - }, - JsCallArguments { - l_paren_token: L_PAREN@38..39 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - ], - }, - as_token: AS_KW@41..44 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@44..50 "string" [] [], - }, - }, - r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@52..54 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@54..62 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@62..63 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - L_ANGLE@63..65 "<" [Newline("\n")] [], - TsNumberType { - number_token: NUMBER_KW@65..71 "number" [] [], - }, - R_ANGLE@71..73 ">" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@73..75 "a" [] [Whitespace(" ")], - }, - }, - ], - }, - operator_token: EQ@75..77 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@77..78 "3" [] [], - }, - }, - semicolon_token: SEMICOLON@78..79 ";" [] [], - }, - ], - eof_token: EOF@79..80 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..80 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..79 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_TYPE_ANNOTATION@5..10 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@7..10 - 0: ANY_KW@7..10 "any" [] [] - 2: (empty) - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@11..35 - 0: JS_ASSIGNMENT_EXPRESSION@11..34 - 0: TS_AS_ASSIGNMENT@11..24 - 0: JS_IDENTIFIER_ASSIGNMENT@11..14 - 0: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")] - 1: AS_KW@14..17 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@17..24 - 0: STRING_KW@17..24 "string" [] [Whitespace(" ")] - 1: EQ@24..26 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@26..34 - 0: JS_STRING_LITERAL@26..34 "\"string\"" [] [] - 1: SEMICOLON@34..35 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@35..63 - 0: JS_ASSIGNMENT_EXPRESSION@35..62 - 0: JS_PARENTHESIZED_ASSIGNMENT@35..52 - 0: L_PAREN@35..37 "(" [Newline("\n")] [] - 1: TS_AS_ASSIGNMENT@37..50 - 0: JS_BOGUS_ASSIGNMENT@37..41 - 0: JS_IDENTIFIER_EXPRESSION@37..38 - 0: JS_REFERENCE_IDENTIFIER@37..38 - 0: IDENT@37..38 "a" [] [] - 1: JS_CALL_ARGUMENTS@38..41 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@39..39 - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 1: AS_KW@41..44 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@44..50 - 0: STRING_KW@44..50 "string" [] [] - 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] - 1: EQ@52..54 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@54..62 - 0: JS_STRING_LITERAL@54..62 "\"string\"" [] [] - 1: SEMICOLON@62..63 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@63..79 - 0: JS_ASSIGNMENT_EXPRESSION@63..78 - 0: JS_BOGUS_ASSIGNMENT@63..75 - 0: L_ANGLE@63..65 "<" [Newline("\n")] [] - 1: TS_NUMBER_TYPE@65..71 - 0: NUMBER_KW@65..71 "number" [] [] - 2: R_ANGLE@71..73 ">" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_EXPRESSION@73..75 - 0: JS_REFERENCE_IDENTIFIER@73..75 - 0: IDENT@73..75 "a" [] [Whitespace(" ")] - 1: EQ@75..77 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@77..78 - 0: JS_NUMBER_LITERAL@77..78 "3" [] [] - 1: SEMICOLON@78..79 ";" [] [] - 4: EOF@79..80 "" [Newline("\n")] [] --- -ts_as_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `a()` - - 1 │ let a: any; - 2 │ a as string = "string"; - > 3 │ (a() as string) = "string"; - │ ^^^ - 4 │ a = 3; - 5 │ - - i This expression cannot be assigned to - --- -ts_as_assignment_no_parenthesize.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to ` a` - - 2 │ a as string = "string"; - 3 │ (a() as string) = "string"; - > 4 │ a = 3; - │ ^^^^^^^^^^ - 5 │ - - i This expression cannot be assigned to - --- -let a: any; -a as string = "string"; -(a() as string) = "string"; - a = 3; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.rast b/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.rast deleted file mode 100644 index 8daeac265886..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.rast +++ /dev/null @@ -1,261 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@0..6 "class" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@6..8 "C" [] [Whitespace(" ")], - }, - L_CURLY@8..9 "{" [] [], - JsBogus { - items: [ - JsDecorator { - at_token: AT@9..12 "@" [Newline("\n"), Whitespace("\t")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..21 "decorator" [] [], - }, - }, - }, - ], - }, - R_CURLY@21..24 "}" [Newline("\n"), Whitespace("\t")] [], - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@31..34 "CC" [] [Whitespace(" ")], - }, - L_CURLY@34..35 "{" [] [], - JsBogus { - items: [ - JsDecorator { - at_token: AT@35..38 "@" [Newline("\n"), Whitespace("\t")] [], - expression: missing (required), - }, - ], - }, - R_CURLY@38..41 "}" [Newline("\n"), Whitespace("\t")] [], - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@41..48 "class" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - JsDecorator { - at_token: AT@48..49 "@" [] [], - expression: JsBogusExpression { - items: [ - JsDecoratorList [], - CLASS_KW@49..56 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@56..57 "C" [] [], - }, - JsBogus { - items: [ - JsDecorator { - at_token: AT@57..58 "@" [] [], - expression: missing (required), - }, - ], - }, - ], - }, - }, - ], - }, - ], - }, - ], - eof_token: EOF@58..59 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..59 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..58 - 0: JS_BOGUS_STATEMENT@0..24 - 0: JS_DECORATOR_LIST@0..0 - 1: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "C" [] [Whitespace(" ")] - 3: L_CURLY@8..9 "{" [] [] - 4: JS_BOGUS@9..21 - 0: JS_DECORATOR@9..21 - 0: AT@9..12 "@" [Newline("\n"), Whitespace("\t")] [] - 1: JS_IDENTIFIER_EXPRESSION@12..21 - 0: JS_REFERENCE_IDENTIFIER@12..21 - 0: IDENT@12..21 "decorator" [] [] - 5: R_CURLY@21..24 "}" [Newline("\n"), Whitespace("\t")] [] - 1: JS_BOGUS_STATEMENT@24..41 - 0: JS_DECORATOR_LIST@24..24 - 1: CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@31..34 - 0: IDENT@31..34 "CC" [] [Whitespace(" ")] - 3: L_CURLY@34..35 "{" [] [] - 4: JS_BOGUS@35..38 - 0: JS_DECORATOR@35..38 - 0: AT@35..38 "@" [Newline("\n"), Whitespace("\t")] [] - 1: (empty) - 5: R_CURLY@38..41 "}" [Newline("\n"), Whitespace("\t")] [] - 2: JS_BOGUS_STATEMENT@41..58 - 0: JS_DECORATOR_LIST@41..41 - 1: CLASS_KW@41..48 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@48..58 - 0: JS_DECORATOR@48..58 - 0: AT@48..49 "@" [] [] - 1: JS_BOGUS_EXPRESSION@49..58 - 0: JS_DECORATOR_LIST@49..49 - 1: CLASS_KW@49..56 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@56..57 - 0: IDENT@56..57 "C" [] [] - 3: JS_BOGUS@57..58 - 0: JS_DECORATOR@57..58 - 0: AT@57..58 "@" [] [] - 1: (empty) - 4: EOF@58..59 "" [Newline("\n")] [] --- -ts_broken_class_member_modifiers.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '}'. - - 1 │ class C { - 2 │ @decorator - > 3 │ } - │ ^ - 4 │ class CC { - 5 │ @ - - i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. - - 1 │ class C { - 2 │ @decorator - > 3 │ } - │ ^ - 4 │ class CC { - 5 │ @ - --- -ts_broken_class_member_modifiers.ts:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '}'. - - 4 │ class CC { - 5 │ @ - > 6 │ } - │ ^ - 7 │ class @ - 8 │ class C@ - - i Expected an expression here. - - 4 │ class CC { - 5 │ @ - > 6 │ } - │ ^ - 7 │ class @ - 8 │ class C@ - --- -ts_broken_class_member_modifiers.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - 5 │ @ - 6 │ } - > 7 │ class @ - │ ^^^^^^ - 8 │ class C@ - 9 │ - --- -ts_broken_class_member_modifiers.ts:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `@` - - 5 │ @ - 6 │ } - > 7 │ class @ - │ ^ - 8 │ class C@ - 9 │ - - i Remove @ - --- -ts_broken_class_member_modifiers.ts:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `@` - - 6 │ } - 7 │ class @ - > 8 │ class C@ - │ ^ - 9 │ - - i Remove @ - --- -ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found the end of the file. - - 7 │ class @ - 8 │ class C@ - > 9 │ - │ - - i Expected an expression here. - - 7 │ class @ - 8 │ class C@ - > 9 │ - │ - --- -ts_broken_class_member_modifiers.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid decorator `class C@` - - 6 │ } - 7 │ class @ - > 8 │ class C@ - │ ^^^^^^^^ - 9 │ - --- -ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found the end of the file. - - 7 │ class @ - 8 │ class C@ - > 9 │ - │ - - i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. - - 7 │ class @ - 8 │ class C@ - > 9 │ - │ - --- -class C { - @decorator - } -class CC { - @ - } -class @ -class C@ diff --git a/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast b/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast deleted file mode 100644 index 9e84f1513f86..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast +++ /dev/null @@ -1,81 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsTryStatement { - try_token: TRY_KW@0..4 "try" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@4..5 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@7..13 "catch" [] [Whitespace(" ")], - declaration: JsCatchDeclaration { - l_paren_token: L_PAREN@13..14 "(" [] [], - binding: JsIdentifierBinding { - name_token: IDENT@14..19 "error" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@19..21 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@21..26 "Error" [] [], - }, - type_arguments: missing (optional), - }, - }, - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - }, - body: JsBlockStatement { - l_curly_token: L_CURLY@28..29 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_TRY_STATEMENT@0..30 - 0: TRY_KW@0..4 "try" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@4..7 - 0: L_CURLY@4..5 "{" [] [] - 1: JS_STATEMENT_LIST@5..5 - 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@7..30 - 0: CATCH_KW@7..13 "catch" [] [Whitespace(" ")] - 1: JS_CATCH_DECLARATION@13..28 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_IDENTIFIER_BINDING@14..19 - 0: IDENT@14..19 "error" [] [] - 2: TS_TYPE_ANNOTATION@19..26 - 0: COLON@19..21 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@21..26 - 0: JS_REFERENCE_IDENTIFIER@21..26 - 0: IDENT@21..26 "Error" [] [] - 1: (empty) - 3: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_STATEMENT_LIST@29..29 - 2: R_CURLY@29..30 "}" [] [] - 4: EOF@30..31 "" [Newline("\n")] [] --- -ts_catch_declaration_non_any_unknown_type_annotation.ts:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Catch clause variable type annotation must be 'any' or 'unknown' if specified. - - > 1 │ try {} catch (error: Error) {} - │ ^^^^^ - 2 │ - --- -try {} catch (error: Error) {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast deleted file mode 100644 index dde5b27eba1d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast +++ /dev/null @@ -1,467 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@12..25 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@25..31 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@32..33 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@33..35 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@35..41 "string" [] [], - }, - }, - SEMICOLON@41..42 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@42..55 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@55..66 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@66..67 "(" [] [], - parameters: JsConstructorParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@67..75 "declare" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@75..84 "readonly" [] [Whitespace(" ")], - }, - ], - }, - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@84..88 "prop" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - ], - r_paren_token: R_PAREN@88..90 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@90..91 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@91..92 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - GET_KW@105..109 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@109..113 "test" [] [], - }, - L_PAREN@113..114 "(" [] [], - R_PAREN@114..116 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@116..118 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@118..125 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@125..129 "\"a\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@129..130 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@130..143 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - SET_KW@143..147 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@147..151 "test" [] [], - }, - L_PAREN@151..152 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@152..157 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@157..159 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@159..165 "string" [] [], - }, - }, - initializer: missing (optional), - }, - R_PAREN@165..167 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@167..168 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@168..169 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@169..182 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - L_BRACK@182..183 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@183..187 "name" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@187..189 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@189..195 "string" [] [], - }, - }, - }, - R_BRACK@195..196 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@196..198 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@198..204 "string" [] [], - }, - }, - SEMICOLON@204..205 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@205..218 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@218..227 "accessor" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@227..230 "foo" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@230..232 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@232..238 "string" [] [], - }, - }, - SEMICOLON@238..239 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@239..241 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@241..242 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..242 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..241 - 0: JS_CLASS_DECLARATION@0..241 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..239 - 0: JS_BOGUS_MEMBER@12..42 - 0: JS_BOGUS@12..25 - 0: TS_DECLARE_MODIFIER@12..25 - 0: DECLARE_KW@12..25 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@25..31 - 0: IDENT@25..31 "method" [] [] - 2: JS_PARAMETERS@31..33 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_PARAMETER_LIST@32..32 - 2: R_PAREN@32..33 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@33..41 - 0: COLON@33..35 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@35..41 - 0: STRING_KW@35..41 "string" [] [] - 4: SEMICOLON@41..42 ";" [] [] - 1: JS_BOGUS_MEMBER@42..92 - 0: JS_BOGUS@42..55 - 0: TS_DECLARE_MODIFIER@42..55 - 0: DECLARE_KW@42..55 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@55..66 - 0: IDENT@55..66 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@66..90 - 0: L_PAREN@66..67 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@67..88 - 0: JS_BOGUS_PARAMETER@67..88 - 0: JS_DECORATOR_LIST@67..67 - 1: JS_BOGUS@67..84 - 0: TS_DECLARE_MODIFIER@67..75 - 0: DECLARE_KW@67..75 "declare" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@75..84 - 0: READONLY_KW@75..84 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@84..88 - 0: JS_DECORATOR_LIST@84..84 - 1: JS_IDENTIFIER_BINDING@84..88 - 0: IDENT@84..88 "prop" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@88..90 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@90..92 - 0: L_CURLY@90..91 "{" [] [] - 1: JS_DIRECTIVE_LIST@91..91 - 2: JS_STATEMENT_LIST@91..91 - 3: R_CURLY@91..92 "}" [] [] - 2: JS_BOGUS_MEMBER@92..130 - 0: JS_BOGUS@92..105 - 0: TS_DECLARE_MODIFIER@92..105 - 0: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@105..109 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@109..113 - 0: IDENT@109..113 "test" [] [] - 3: L_PAREN@113..114 "(" [] [] - 4: R_PAREN@114..116 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@116..130 - 0: L_CURLY@116..118 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@118..118 - 2: JS_STATEMENT_LIST@118..129 - 0: JS_RETURN_STATEMENT@118..129 - 0: RETURN_KW@118..125 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@125..129 - 0: JS_STRING_LITERAL@125..129 "\"a\"" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@129..130 "}" [] [] - 3: JS_BOGUS_MEMBER@130..169 - 0: JS_BOGUS@130..143 - 0: TS_DECLARE_MODIFIER@130..143 - 0: DECLARE_KW@130..143 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@143..147 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@147..151 - 0: IDENT@147..151 "test" [] [] - 3: L_PAREN@151..152 "(" [] [] - 4: JS_FORMAL_PARAMETER@152..165 - 0: JS_DECORATOR_LIST@152..152 - 1: JS_IDENTIFIER_BINDING@152..157 - 0: IDENT@152..157 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@157..165 - 0: COLON@157..159 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@159..165 - 0: STRING_KW@159..165 "string" [] [] - 4: (empty) - 5: R_PAREN@165..167 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@167..169 - 0: L_CURLY@167..168 "{" [] [] - 1: JS_DIRECTIVE_LIST@168..168 - 2: JS_STATEMENT_LIST@168..168 - 3: R_CURLY@168..169 "}" [] [] - 4: JS_BOGUS_MEMBER@169..205 - 0: JS_BOGUS@169..182 - 0: TS_DECLARE_MODIFIER@169..182 - 0: DECLARE_KW@169..182 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@182..183 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@183..195 - 0: JS_IDENTIFIER_BINDING@183..187 - 0: IDENT@183..187 "name" [] [] - 1: TS_TYPE_ANNOTATION@187..195 - 0: COLON@187..189 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@189..195 - 0: STRING_KW@189..195 "string" [] [] - 3: R_BRACK@195..196 "]" [] [] - 4: TS_TYPE_ANNOTATION@196..204 - 0: COLON@196..198 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@198..204 - 0: STRING_KW@198..204 "string" [] [] - 5: SEMICOLON@204..205 ";" [] [] - 5: JS_BOGUS_MEMBER@205..239 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@205..227 - 0: TS_DECLARE_MODIFIER@205..218 - 0: DECLARE_KW@205..218 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@218..227 - 0: ACCESSOR_KW@218..227 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@227..230 - 0: IDENT@227..230 "foo" [] [] - 2: TS_TYPE_ANNOTATION@230..238 - 0: COLON@230..232 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@232..238 - 0: STRING_KW@232..238 "string" [] [] - 3: SEMICOLON@238..239 ";" [] [] - 9: R_CURLY@239..241 "}" [Newline("\n")] [] - 4: EOF@241..242 "" [Newline("\n")] [] --- -ts_class_declare_modifier_error.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier is only allowed on properties. - - 1 │ class Test { - > 2 │ declare method(): string; - │ ^^^^^^^ - 3 │ declare constructor(declare readonly prop) {} - 4 │ declare get test() { return "a" } - --- -ts_class_declare_modifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' cannot appear on a parameter. - - 1 │ class Test { - 2 │ declare method(): string; - > 3 │ declare constructor(declare readonly prop) {} - │ ^^^^^^^ - 4 │ declare get test() { return "a" } - 5 │ declare set test(value: string) {} - --- -ts_class_declare_modifier_error.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' cannot appear on a constructor declaration. - - 1 │ class Test { - 2 │ declare method(): string; - > 3 │ declare constructor(declare readonly prop) {} - │ ^^^^^^^ - 4 │ declare get test() { return "a" } - 5 │ declare set test(value: string) {} - --- -ts_class_declare_modifier_error.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier is only allowed on properties. - - 2 │ declare method(): string; - 3 │ declare constructor(declare readonly prop) {} - > 4 │ declare get test() { return "a" } - │ ^^^^^^^ - 5 │ declare set test(value: string) {} - 6 │ declare [name: string]: string; - --- -ts_class_declare_modifier_error.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier is only allowed on properties. - - 3 │ declare constructor(declare readonly prop) {} - 4 │ declare get test() { return "a" } - > 5 │ declare set test(value: string) {} - │ ^^^^^^^ - 6 │ declare [name: string]: string; - 7 │ declare accessor foo: string; - --- -ts_class_declare_modifier_error.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier cannot appear on an index signature. - - 4 │ declare get test() { return "a" } - 5 │ declare set test(value: string) {} - > 6 │ declare [name: string]: string; - │ ^^^^^^^ - 7 │ declare accessor foo: string; - 8 │ } - --- -ts_class_declare_modifier_error.ts:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' cannot be used with 'accessor' modifier. - - 5 │ declare set test(value: string) {} - 6 │ declare [name: string]: string; - > 7 │ declare accessor foo: string; - │ ^^^^^^^ - 8 │ } - 9 │ - - i 'declare' modifier - - 5 │ declare set test(value: string) {} - 6 │ declare [name: string]: string; - > 7 │ declare accessor foo: string; - │ ^^^^^^^ - 8 │ } - 9 │ - - i 'accessor' modifier - - 5 │ declare set test(value: string) {} - 6 │ declare [name: string]: string; - > 7 │ declare accessor foo: string; - │ ^^^^^^^^ - 8 │ } - 9 │ - --- -class Test { - declare method(): string; - declare constructor(declare readonly prop) {} - declare get test() { return "a" } - declare set test(value: string) {} - declare [name: string]: string; - declare accessor foo: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast deleted file mode 100644 index 7e565168f5a4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast +++ /dev/null @@ -1,356 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@9..10 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@10..21 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@21..25 "Int" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@25..26 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@34..36 "B" [] [Whitespace(" ")], - }, - TsImplementsClause { - implements_token: IMPLEMENTS_KW@36..47 "implements" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@47..51 "Int" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - JsExtendsClause { - extends_token: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..61 "A" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - L_CURLY@61..62 "{" [] [], - JsClassMemberList [], - R_CURLY@62..63 "}" [] [], - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@63..70 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@70..72 "C" [] [Whitespace(" ")], - }, - TsImplementsClause { - implements_token: IMPLEMENTS_KW@72..83 "implements" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@83..87 "Int" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - TsImplementsClause { - implements_token: IMPLEMENTS_KW@87..98 "implements" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@98..102 "Int" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - L_CURLY@102..103 "{" [] [], - JsClassMemberList [], - R_CURLY@103..104 "}" [] [], - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@104..111 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@111..113 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: TsImplementsClause { - implements_token: IMPLEMENTS_KW@113..124 "implements" [] [Whitespace(" ")], - types: TsTypeList [], - }, - l_curly_token: L_CURLY@124..125 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@126..133 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@133..135 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@135..143 "extends" [] [Whitespace(" ")], - super_class: missing (required), - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@143..144 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@144..145 "}" [] [], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@152..154 "F" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - EXTENDS_KW@154..162 "extends" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@162..163 "E" [] [], - }, - }, - COMMA@163..165 "," [] [Whitespace(" ")], - ], - }, - L_CURLY@165..166 "{" [] [], - JsClassMemberList [], - R_CURLY@166..167 "}" [] [], - ], - }, - ], - eof_token: EOF@167..168 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..168 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..167 - 0: JS_CLASS_DECLARATION@0..10 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..9 - 9: R_CURLY@9..10 "}" [] [] - 1: TS_INTERFACE_DECLARATION@10..27 - 0: INTERFACE_KW@10..21 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@21..25 - 0: IDENT@21..25 "Int" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@25..26 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@26..26 - 6: R_CURLY@26..27 "}" [] [] - 2: JS_BOGUS_STATEMENT@27..63 - 0: JS_DECORATOR_LIST@27..27 - 1: CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "B" [] [Whitespace(" ")] - 3: TS_IMPLEMENTS_CLAUSE@36..51 - 0: IMPLEMENTS_KW@36..47 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@47..51 - 0: TS_REFERENCE_TYPE@47..51 - 0: JS_REFERENCE_IDENTIFIER@47..51 - 0: IDENT@47..51 "Int" [] [Whitespace(" ")] - 1: (empty) - 4: JS_EXTENDS_CLAUSE@51..61 - 0: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@59..61 - 0: JS_REFERENCE_IDENTIFIER@59..61 - 0: IDENT@59..61 "A" [] [Whitespace(" ")] - 2: (empty) - 5: L_CURLY@61..62 "{" [] [] - 6: JS_CLASS_MEMBER_LIST@62..62 - 7: R_CURLY@62..63 "}" [] [] - 3: JS_BOGUS_STATEMENT@63..104 - 0: JS_DECORATOR_LIST@63..63 - 1: CLASS_KW@63..70 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@70..72 - 0: IDENT@70..72 "C" [] [Whitespace(" ")] - 3: TS_IMPLEMENTS_CLAUSE@72..87 - 0: IMPLEMENTS_KW@72..83 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@83..87 - 0: TS_REFERENCE_TYPE@83..87 - 0: JS_REFERENCE_IDENTIFIER@83..87 - 0: IDENT@83..87 "Int" [] [Whitespace(" ")] - 1: (empty) - 4: TS_IMPLEMENTS_CLAUSE@87..102 - 0: IMPLEMENTS_KW@87..98 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@98..102 - 0: TS_REFERENCE_TYPE@98..102 - 0: JS_REFERENCE_IDENTIFIER@98..102 - 0: IDENT@98..102 "Int" [] [Whitespace(" ")] - 1: (empty) - 5: L_CURLY@102..103 "{" [] [] - 6: JS_CLASS_MEMBER_LIST@103..103 - 7: R_CURLY@103..104 "}" [] [] - 4: JS_CLASS_DECLARATION@104..126 - 0: JS_DECORATOR_LIST@104..104 - 1: (empty) - 2: CLASS_KW@104..111 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@111..113 - 0: IDENT@111..113 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: TS_IMPLEMENTS_CLAUSE@113..124 - 0: IMPLEMENTS_KW@113..124 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@124..124 - 7: L_CURLY@124..125 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@125..125 - 9: R_CURLY@125..126 "}" [] [] - 5: JS_CLASS_DECLARATION@126..145 - 0: JS_DECORATOR_LIST@126..126 - 1: (empty) - 2: CLASS_KW@126..133 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@133..135 - 0: IDENT@133..135 "E" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@135..143 - 0: EXTENDS_KW@135..143 "extends" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 6: (empty) - 7: L_CURLY@143..144 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@144..144 - 9: R_CURLY@144..145 "}" [] [] - 6: JS_BOGUS_STATEMENT@145..167 - 0: JS_DECORATOR_LIST@145..145 - 1: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@152..154 - 0: IDENT@152..154 "F" [] [Whitespace(" ")] - 3: JS_BOGUS@154..165 - 0: EXTENDS_KW@154..162 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@162..163 - 0: JS_REFERENCE_IDENTIFIER@162..163 - 0: IDENT@162..163 "E" [] [] - 2: COMMA@163..165 "," [] [Whitespace(" ")] - 4: L_CURLY@165..166 "{" [] [] - 5: JS_CLASS_MEMBER_LIST@166..166 - 6: R_CURLY@166..167 "}" [] [] - 4: EOF@167..168 "" [Newline("\n")] [] --- -ts_class_heritage_clause_errors.ts:3:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'extends' clause must precede 'implements' clause. - - 1 │ class A {} - 2 │ interface Int {} - > 3 │ class B implements Int extends A {} - │ ^^^^^^^^^ - 4 │ class C implements Int implements Int {} - 5 │ class D implements {} - - i This is where implements was found - - 1 │ class A {} - 2 │ interface Int {} - > 3 │ class B implements Int extends A {} - │ ^^^^^^^^^^^^^^ - 4 │ class C implements Int implements Int {} - 5 │ class D implements {} - --- -ts_class_heritage_clause_errors.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'implements' clause already seen. - - 2 │ interface Int {} - 3 │ class B implements Int extends A {} - > 4 │ class C implements Int implements Int {} - │ ^^^^^^^^^^^^^^ - 5 │ class D implements {} - 6 │ class E extends {} - - i first 'implements' clause - - 2 │ interface Int {} - 3 │ class B implements Int extends A {} - > 4 │ class C implements Int implements Int {} - │ ^^^^^^^^^^^^^^ - 5 │ class D implements {} - 6 │ class E extends {} - --- -ts_class_heritage_clause_errors.ts:5:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'implements' list cannot be empty. - - 3 │ class B implements Int extends A {} - 4 │ class C implements Int implements Int {} - > 5 │ class D implements {} - │ - 6 │ class E extends {} - 7 │ class F extends E, {} - --- -ts_class_heritage_clause_errors.ts:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'extends' list cannot be empty. - - 4 │ class C implements Int implements Int {} - 5 │ class D implements {} - > 6 │ class E extends {} - │ - 7 │ class F extends E, {} - 8 │ - --- -ts_class_heritage_clause_errors.ts:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Trailing comma not allowed. - - 5 │ class D implements {} - 6 │ class E extends {} - > 7 │ class F extends E, {} - │ ^ - 8 │ - --- -class A {} -interface Int {} -class B implements Int extends A {} -class C implements Int implements Int {} -class D implements {} -class E extends {} -class F extends E, {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast deleted file mode 100644 index d64acc1d2598..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast +++ /dev/null @@ -1,75 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@9..19 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - STATIC_KW@19..26 "static" [] [Whitespace(" ")], - L_CURLY@26..28 "{" [] [Whitespace(" ")], - JsStatementList [], - R_CURLY@28..29 "}" [] [], - ], - }, - ], - r_curly_token: R_CURLY@29..31 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@31..32 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..32 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..31 - 0: JS_CLASS_DECLARATION@0..31 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..29 - 0: JS_BOGUS_MEMBER@9..29 - 0: TS_ACCESSIBILITY_MODIFIER@9..19 - 0: PUBLIC_KW@9..19 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: STATIC_KW@19..26 "static" [] [Whitespace(" ")] - 2: L_CURLY@26..28 "{" [] [Whitespace(" ")] - 3: JS_STATEMENT_LIST@28..28 - 4: R_CURLY@28..29 "}" [] [] - 9: R_CURLY@29..31 "}" [Newline("\n")] [] - 4: EOF@31..32 "" [Newline("\n")] [] --- -ts_class_initializer_with_modifiers.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Static class blocks cannot have any modifier. - - 1 │ class A { - > 2 │ public static { } - │ ^^^^^^ - 3 │ } - 4 │ - --- -class A { - public static { } -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast deleted file mode 100644 index 567021c823df..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast +++ /dev/null @@ -1,1094 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..13 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@13..18 "base1" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@18..20 ";" [] [Whitespace(" ")], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@20..25 "base2" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@25..27 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@28..38 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@38..44 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@44..49 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@49..57 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..62 "Base" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@62..63 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@63..77 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@77..86 "override" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@86..91 "base1" [] [], - }, - SEMICOLON@91..92 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@105..113 "declare" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@113..114 "a" [] [], - }, - SEMICOLON@114..115 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@128..138 "protected" [] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@138..145 "public" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@145..146 "c" [] [], - }, - SEMICOLON@146..147 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@147..160 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@160..168 "private" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@168..169 "d" [] [], - }, - SEMICOLON@169..170 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@170..185 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@185..195 "protected" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@195..196 "e" [] [], - }, - SEMICOLON@196..197 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@197..209 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@209..216 "public" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@216..217 "f" [] [], - }, - SEMICOLON@217..218 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@218..232 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@232..241 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@241..242 "g" [] [], - }, - SEMICOLON@242..243 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@243..255 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@255..262 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@262..263 "h" [] [], - }, - SEMICOLON@263..264 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@264..278 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@278..287 "readonly" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@287..288 "i" [] [], - }, - SEMICOLON@288..289 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@289..303 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@303..311 "declare" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@311..316 "base2" [] [], - }, - SEMICOLON@316..317 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@317..330 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@330..339 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@339..340 "j" [] [], - }, - SEMICOLON@340..341 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@341..355 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@355..356 "#" [] [], - id_token: IDENT@356..357 "j" [] [], - }, - SEMICOLON@357..358 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@358..372 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@372..379 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@379..380 "k" [] [], - }, - SEMICOLON@380..381 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@381..395 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ASYNC_KW@395..401 "async" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@401..402 "l" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@402..403 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@403..404 ")" [] [], - }, - SEMICOLON@404..405 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@405..418 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - ASYNC_KW@418..424 "async" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@424..425 "m" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@425..426 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@426..427 ")" [] [], - }, - SEMICOLON@427..428 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@428..441 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@441..442 "#" [] [], - id_token: IDENT@442..443 "l" [] [], - }, - SEMICOLON@443..444 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@444..457 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@457..466 "accessor" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@466..467 "p" [] [], - }, - SEMICOLON@467..468 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@468..482 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@482..491 "accessor" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@491..492 "r" [] [], - }, - SEMICOLON@492..493 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@493..495 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@495..496 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..496 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..495 - 0: JS_CLASS_DECLARATION@0..28 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Base" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..13 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@13..27 - 0: JS_PROPERTY_CLASS_MEMBER@13..20 - 0: JS_PROPERTY_MODIFIER_LIST@13..13 - 1: JS_LITERAL_MEMBER_NAME@13..18 - 0: IDENT@13..18 "base1" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] - 1: JS_PROPERTY_CLASS_MEMBER@20..27 - 0: JS_PROPERTY_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..25 - 0: IDENT@20..25 "base2" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@25..27 ";" [] [Whitespace(" ")] - 9: R_CURLY@27..28 "}" [] [] - 1: JS_CLASS_DECLARATION@28..495 - 0: JS_DECORATOR_LIST@28..28 - 1: ABSTRACT_KW@28..38 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@38..44 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@44..49 - 0: IDENT@44..49 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@49..62 - 0: EXTENDS_KW@49..57 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@57..62 - 0: JS_REFERENCE_IDENTIFIER@57..62 - 0: IDENT@57..62 "Base" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@62..63 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@63..493 - 0: JS_BOGUS_MEMBER@63..92 - 0: JS_PROPERTY_MODIFIER_LIST@63..86 - 0: TS_OVERRIDE_MODIFIER@63..77 - 0: OVERRIDE_KW@63..77 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@77..86 - 0: OVERRIDE_KW@77..86 "override" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@86..91 - 0: IDENT@86..91 "base1" [] [] - 2: SEMICOLON@91..92 ";" [] [] - 1: JS_BOGUS_MEMBER@92..115 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@92..113 - 0: TS_DECLARE_MODIFIER@92..105 - 0: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_DECLARE_MODIFIER@105..113 - 0: DECLARE_KW@105..113 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@113..114 - 0: IDENT@113..114 "a" [] [] - 2: SEMICOLON@114..115 ";" [] [] - 2: JS_BOGUS_MEMBER@115..147 - 0: JS_PROPERTY_MODIFIER_LIST@115..145 - 0: TS_ACCESSIBILITY_MODIFIER@115..128 - 0: PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@128..138 - 0: PROTECTED_KW@128..138 "protected" [] [Whitespace(" ")] - 2: TS_ACCESSIBILITY_MODIFIER@138..145 - 0: PUBLIC_KW@138..145 "public" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@145..146 - 0: IDENT@145..146 "c" [] [] - 2: SEMICOLON@146..147 ";" [] [] - 3: JS_BOGUS_MEMBER@147..170 - 0: JS_PROPERTY_MODIFIER_LIST@147..168 - 0: TS_ACCESSIBILITY_MODIFIER@147..160 - 0: PRIVATE_KW@147..160 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@160..168 - 0: PRIVATE_KW@160..168 "private" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@168..169 - 0: IDENT@168..169 "d" [] [] - 2: SEMICOLON@169..170 ";" [] [] - 4: JS_BOGUS_MEMBER@170..197 - 0: JS_PROPERTY_MODIFIER_LIST@170..195 - 0: TS_ACCESSIBILITY_MODIFIER@170..185 - 0: PROTECTED_KW@170..185 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@185..195 - 0: PROTECTED_KW@185..195 "protected" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@195..196 - 0: IDENT@195..196 "e" [] [] - 2: SEMICOLON@196..197 ";" [] [] - 5: JS_BOGUS_MEMBER@197..218 - 0: JS_PROPERTY_MODIFIER_LIST@197..216 - 0: TS_ACCESSIBILITY_MODIFIER@197..209 - 0: PUBLIC_KW@197..209 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@209..216 - 0: PUBLIC_KW@209..216 "public" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@216..217 - 0: IDENT@216..217 "f" [] [] - 2: SEMICOLON@217..218 ";" [] [] - 6: JS_BOGUS_MEMBER@218..243 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@218..241 - 0: TS_ABSTRACT_MODIFIER@218..232 - 0: ABSTRACT_KW@218..232 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@232..241 - 0: ABSTRACT_KW@232..241 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@241..242 - 0: IDENT@241..242 "g" [] [] - 2: SEMICOLON@242..243 ";" [] [] - 7: JS_BOGUS_MEMBER@243..264 - 0: JS_PROPERTY_MODIFIER_LIST@243..262 - 0: JS_STATIC_MODIFIER@243..255 - 0: STATIC_KW@243..255 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@255..262 - 0: STATIC_KW@255..262 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@262..263 - 0: IDENT@262..263 "h" [] [] - 2: SEMICOLON@263..264 ";" [] [] - 8: JS_BOGUS_MEMBER@264..289 - 0: JS_PROPERTY_MODIFIER_LIST@264..287 - 0: TS_READONLY_MODIFIER@264..278 - 0: READONLY_KW@264..278 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@278..287 - 0: READONLY_KW@278..287 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@287..288 - 0: IDENT@287..288 "i" [] [] - 2: SEMICOLON@288..289 ";" [] [] - 9: JS_BOGUS_MEMBER@289..317 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@289..311 - 0: TS_OVERRIDE_MODIFIER@289..303 - 0: OVERRIDE_KW@289..303 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_DECLARE_MODIFIER@303..311 - 0: DECLARE_KW@303..311 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@311..316 - 0: IDENT@311..316 "base2" [] [] - 2: SEMICOLON@316..317 ";" [] [] - 10: JS_BOGUS_MEMBER@317..341 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@317..339 - 0: TS_ACCESSIBILITY_MODIFIER@317..330 - 0: PRIVATE_KW@317..330 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@330..339 - 0: ABSTRACT_KW@330..339 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@339..340 - 0: IDENT@339..340 "j" [] [] - 2: SEMICOLON@340..341 ";" [] [] - 11: JS_BOGUS_MEMBER@341..358 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@341..355 - 0: TS_ABSTRACT_MODIFIER@341..355 - 0: ABSTRACT_KW@341..355 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@355..357 - 0: HASH@355..356 "#" [] [] - 1: IDENT@356..357 "j" [] [] - 2: SEMICOLON@357..358 ";" [] [] - 12: JS_BOGUS_MEMBER@358..381 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@358..379 - 0: TS_ABSTRACT_MODIFIER@358..372 - 0: ABSTRACT_KW@358..372 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@372..379 - 0: STATIC_KW@372..379 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@379..380 - 0: IDENT@379..380 "k" [] [] - 2: SEMICOLON@380..381 ";" [] [] - 13: JS_BOGUS_MEMBER@381..405 - 0: TS_ABSTRACT_MODIFIER@381..395 - 0: ABSTRACT_KW@381..395 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@395..401 "async" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@401..402 - 0: IDENT@401..402 "l" [] [] - 3: JS_PARAMETERS@402..404 - 0: L_PAREN@402..403 "(" [] [] - 1: JS_PARAMETER_LIST@403..403 - 2: R_PAREN@403..404 ")" [] [] - 4: SEMICOLON@404..405 ";" [] [] - 14: JS_BOGUS_MEMBER@405..428 - 0: JS_BOGUS@405..418 - 0: TS_DECLARE_MODIFIER@405..418 - 0: DECLARE_KW@405..418 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@418..424 "async" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@424..425 - 0: IDENT@424..425 "m" [] [] - 3: JS_PARAMETERS@425..427 - 0: L_PAREN@425..426 "(" [] [] - 1: JS_PARAMETER_LIST@426..426 - 2: R_PAREN@426..427 ")" [] [] - 4: SEMICOLON@427..428 ";" [] [] - 15: JS_BOGUS_MEMBER@428..444 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@428..441 - 0: TS_DECLARE_MODIFIER@428..441 - 0: DECLARE_KW@428..441 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@441..443 - 0: HASH@441..442 "#" [] [] - 1: IDENT@442..443 "l" [] [] - 2: SEMICOLON@443..444 ";" [] [] - 16: JS_BOGUS_MEMBER@444..468 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@444..466 - 0: TS_DECLARE_MODIFIER@444..457 - 0: DECLARE_KW@444..457 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@457..466 - 0: ACCESSOR_KW@457..466 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@466..467 - 0: IDENT@466..467 "p" [] [] - 2: SEMICOLON@467..468 ";" [] [] - 17: JS_BOGUS_MEMBER@468..493 - 0: JS_PROPERTY_MODIFIER_LIST@468..491 - 0: JS_ACCESSOR_MODIFIER@468..482 - 0: ACCESSOR_KW@468..482 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@482..491 - 0: ACCESSOR_KW@482..491 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@491..492 - 0: IDENT@491..492 "r" [] [] - 2: SEMICOLON@492..493 ";" [] [] - 9: R_CURLY@493..495 "}" [Newline("\n")] [] - 4: EOF@495..496 "" [Newline("\n")] [] --- -ts_class_invalid_modifier_combinations.ts:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'override' already seen - - 1 │ class Base { base1; base2; } - 2 │ abstract class Test extends Base { - > 3 │ override override base1; - │ ^^^^^^^^ - 4 │ declare declare a; - 5 │ private protected public c; - - i duplicate modifier - - 1 │ class Base { base1; base2; } - 2 │ abstract class Test extends Base { - > 3 │ override override base1; - │ ^^^^^^^^ - 4 │ declare declare a; - 5 │ private protected public c; - - i first seen here - - 1 │ class Base { base1; base2; } - 2 │ abstract class Test extends Base { - > 3 │ override override base1; - │ ^^^^^^^^ - 4 │ declare declare a; - 5 │ private protected public c; - --- -ts_class_invalid_modifier_combinations.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' already seen - - 2 │ abstract class Test extends Base { - 3 │ override override base1; - > 4 │ declare declare a; - │ ^^^^^^^ - 5 │ private protected public c; - 6 │ private private d; - - i duplicate modifier - - 2 │ abstract class Test extends Base { - 3 │ override override base1; - > 4 │ declare declare a; - │ ^^^^^^^ - 5 │ private protected public c; - 6 │ private private d; - - i first seen here - - 2 │ abstract class Test extends Base { - 3 │ override override base1; - > 4 │ declare declare a; - │ ^^^^^^^ - 5 │ private protected public c; - 6 │ private private d; - --- -ts_class_invalid_modifier_combinations.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Accessibility modifier already seen. - - 3 │ override override base1; - 4 │ declare declare a; - > 5 │ private protected public c; - │ ^^^^^^^^^ - 6 │ private private d; - 7 │ protected protected e; - - i duplicate modifier - - 3 │ override override base1; - 4 │ declare declare a; - > 5 │ private protected public c; - │ ^^^^^^^^^ - 6 │ private private d; - 7 │ protected protected e; - - i first modifier - - 3 │ override override base1; - 4 │ declare declare a; - > 5 │ private protected public c; - │ ^^^^^^^ - 6 │ private private d; - 7 │ protected protected e; - --- -ts_class_invalid_modifier_combinations.ts:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Accessibility modifier already seen. - - 3 │ override override base1; - 4 │ declare declare a; - > 5 │ private protected public c; - │ ^^^^^^ - 6 │ private private d; - 7 │ protected protected e; - - i duplicate modifier - - 3 │ override override base1; - 4 │ declare declare a; - > 5 │ private protected public c; - │ ^^^^^^ - 6 │ private private d; - 7 │ protected protected e; - - i first modifier - - 3 │ override override base1; - 4 │ declare declare a; - > 5 │ private protected public c; - │ ^^^^^^^ - 6 │ private private d; - 7 │ protected protected e; - --- -ts_class_invalid_modifier_combinations.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Accessibility modifier already seen. - - 4 │ declare declare a; - 5 │ private protected public c; - > 6 │ private private d; - │ ^^^^^^^ - 7 │ protected protected e; - 8 │ public public f; - - i duplicate modifier - - 4 │ declare declare a; - 5 │ private protected public c; - > 6 │ private private d; - │ ^^^^^^^ - 7 │ protected protected e; - 8 │ public public f; - - i first modifier - - 4 │ declare declare a; - 5 │ private protected public c; - > 6 │ private private d; - │ ^^^^^^^ - 7 │ protected protected e; - 8 │ public public f; - --- -ts_class_invalid_modifier_combinations.ts:7:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Accessibility modifier already seen. - - 5 │ private protected public c; - 6 │ private private d; - > 7 │ protected protected e; - │ ^^^^^^^^^ - 8 │ public public f; - 9 │ abstract abstract g; - - i duplicate modifier - - 5 │ private protected public c; - 6 │ private private d; - > 7 │ protected protected e; - │ ^^^^^^^^^ - 8 │ public public f; - 9 │ abstract abstract g; - - i first modifier - - 5 │ private protected public c; - 6 │ private private d; - > 7 │ protected protected e; - │ ^^^^^^^^^ - 8 │ public public f; - 9 │ abstract abstract g; - --- -ts_class_invalid_modifier_combinations.ts:8:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Accessibility modifier already seen. - - 6 │ private private d; - 7 │ protected protected e; - > 8 │ public public f; - │ ^^^^^^ - 9 │ abstract abstract g; - 10 │ static static h; - - i duplicate modifier - - 6 │ private private d; - 7 │ protected protected e; - > 8 │ public public f; - │ ^^^^^^ - 9 │ abstract abstract g; - 10 │ static static h; - - i first modifier - - 6 │ private private d; - 7 │ protected protected e; - > 8 │ public public f; - │ ^^^^^^ - 9 │ abstract abstract g; - 10 │ static static h; - --- -ts_class_invalid_modifier_combinations.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' already seen - - 7 │ protected protected e; - 8 │ public public f; - > 9 │ abstract abstract g; - │ ^^^^^^^^ - 10 │ static static h; - 11 │ readonly readonly i; - - i duplicate modifier - - 7 │ protected protected e; - 8 │ public public f; - > 9 │ abstract abstract g; - │ ^^^^^^^^ - 10 │ static static h; - 11 │ readonly readonly i; - - i first seen here - - 7 │ protected protected e; - 8 │ public public f; - > 9 │ abstract abstract g; - │ ^^^^^^^^ - 10 │ static static h; - 11 │ readonly readonly i; - --- -ts_class_invalid_modifier_combinations.ts:10:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' already seen - - 8 │ public public f; - 9 │ abstract abstract g; - > 10 │ static static h; - │ ^^^^^^ - 11 │ readonly readonly i; - 12 │ override declare base2; - - i duplicate modifier - - 8 │ public public f; - 9 │ abstract abstract g; - > 10 │ static static h; - │ ^^^^^^ - 11 │ readonly readonly i; - 12 │ override declare base2; - - i first seen here - - 8 │ public public f; - 9 │ abstract abstract g; - > 10 │ static static h; - │ ^^^^^^ - 11 │ readonly readonly i; - 12 │ override declare base2; - --- -ts_class_invalid_modifier_combinations.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'readonly' already seen - - 9 │ abstract abstract g; - 10 │ static static h; - > 11 │ readonly readonly i; - │ ^^^^^^^^ - 12 │ override declare base2; - 13 │ private abstract j; - - i duplicate modifier - - 9 │ abstract abstract g; - 10 │ static static h; - > 11 │ readonly readonly i; - │ ^^^^^^^^ - 12 │ override declare base2; - 13 │ private abstract j; - - i first seen here - - 9 │ abstract abstract g; - 10 │ static static h; - > 11 │ readonly readonly i; - │ ^^^^^^^^ - 12 │ override declare base2; - 13 │ private abstract j; - --- -ts_class_invalid_modifier_combinations.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' cannot be used with 'override' modifier. - - 10 │ static static h; - 11 │ readonly readonly i; - > 12 │ override declare base2; - │ ^^^^^^^ - 13 │ private abstract j; - 14 │ abstract #j; - - i 'declare' modifier - - 10 │ static static h; - 11 │ readonly readonly i; - > 12 │ override declare base2; - │ ^^^^^^^ - 13 │ private abstract j; - 14 │ abstract #j; - - i 'override' modifier - - 10 │ static static h; - 11 │ readonly readonly i; - > 12 │ override declare base2; - │ ^^^^^^^^ - 13 │ private abstract j; - 14 │ abstract #j; - --- -ts_class_invalid_modifier_combinations.ts:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'private' cannot be used with 'abstract' modifier. - - 11 │ readonly readonly i; - 12 │ override declare base2; - > 13 │ private abstract j; - │ ^^^^^^^ - 14 │ abstract #j; - 15 │ abstract static k; - - i 'private' modifier - - 11 │ readonly readonly i; - 12 │ override declare base2; - > 13 │ private abstract j; - │ ^^^^^^^ - 14 │ abstract #j; - 15 │ abstract static k; - - i 'abstract' modifier - - 11 │ readonly readonly i; - 12 │ override declare base2; - > 13 │ private abstract j; - │ ^^^^^^^^ - 14 │ abstract #j; - 15 │ abstract static k; - --- -ts_class_invalid_modifier_combinations.ts:14:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' modifier cannot be used with a private identifier'. - - 12 │ override declare base2; - 13 │ private abstract j; - > 14 │ abstract #j; - │ ^^^^^^^^ - 15 │ abstract static k; - 16 │ abstract async l(); - --- -ts_class_invalid_modifier_combinations.ts:15:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' cannot be used with 'static' modifier. - - 13 │ private abstract j; - 14 │ abstract #j; - > 15 │ abstract static k; - │ ^^^^^^^^ - 16 │ abstract async l(); - 17 │ declare async m(); - - i 'abstract' modifier - - 13 │ private abstract j; - 14 │ abstract #j; - > 15 │ abstract static k; - │ ^^^^^^^^ - 16 │ abstract async l(); - 17 │ declare async m(); - - i 'static' modifier - - 13 │ private abstract j; - 14 │ abstract #j; - > 15 │ abstract static k; - │ ^^^^^^ - 16 │ abstract async l(); - 17 │ declare async m(); - --- -ts_class_invalid_modifier_combinations.ts:16:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × async members cannot be abstract - - 14 │ abstract #j; - 15 │ abstract static k; - > 16 │ abstract async l(); - │ ^^^^^^^^ - 17 │ declare async m(); - 18 │ declare #l; - --- -ts_class_invalid_modifier_combinations.ts:17:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier is only allowed on properties. - - 15 │ abstract static k; - 16 │ abstract async l(); - > 17 │ declare async m(); - │ ^^^^^^^ - 18 │ declare #l; - 19 │ declare accessor p; - --- -ts_class_invalid_modifier_combinations.ts:18:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier cannot be used with a private identifier'. - - 16 │ abstract async l(); - 17 │ declare async m(); - > 18 │ declare #l; - │ ^^^^^^^ - 19 │ declare accessor p; - 20 │ accessor accessor r; - --- -ts_class_invalid_modifier_combinations.ts:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' cannot be used with 'accessor' modifier. - - 17 │ declare async m(); - 18 │ declare #l; - > 19 │ declare accessor p; - │ ^^^^^^^ - 20 │ accessor accessor r; - 21 │ } - - i 'declare' modifier - - 17 │ declare async m(); - 18 │ declare #l; - > 19 │ declare accessor p; - │ ^^^^^^^ - 20 │ accessor accessor r; - 21 │ } - - i 'accessor' modifier - - 17 │ declare async m(); - 18 │ declare #l; - > 19 │ declare accessor p; - │ ^^^^^^^^ - 20 │ accessor accessor r; - 21 │ } - --- -ts_class_invalid_modifier_combinations.ts:20:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' already seen - - 18 │ declare #l; - 19 │ declare accessor p; - > 20 │ accessor accessor r; - │ ^^^^^^^^ - 21 │ } - 22 │ - - i duplicate modifier - - 18 │ declare #l; - 19 │ declare accessor p; - > 20 │ accessor accessor r; - │ ^^^^^^^^ - 21 │ } - 22 │ - - i first seen here - - 18 │ declare #l; - 19 │ declare accessor p; - > 20 │ accessor accessor r; - │ ^^^^^^^^ - 21 │ } - 22 │ - --- -class Base { base1; base2; } -abstract class Test extends Base { - override override base1; - declare declare a; - private protected public c; - private private d; - protected protected e; - public public f; - abstract abstract g; - static static h; - readonly readonly i; - override declare base2; - private abstract j; - abstract #j; - abstract static k; - abstract async l(); - declare async m(); - declare #l; - declare accessor p; - accessor accessor r; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast deleted file mode 100644 index f6e95c0837e4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast +++ /dev/null @@ -1,118 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@23..32 "accessor" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@32..35 "foo" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@35..37 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@37..44 "number" [] [Whitespace(" ")], - }, - }, - JsInitializerClause { - eq_token: EQ@44..46 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@46..47 "1" [] [], - }, - }, - SEMICOLON@47..48 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@48..50 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@50..51 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..51 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..50 - 0: JS_CLASS_DECLARATION@0..50 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..48 - 0: JS_BOGUS_MEMBER@9..48 - 0: JS_PROPERTY_MODIFIER_LIST@9..32 - 0: TS_READONLY_MODIFIER@9..23 - 0: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@23..32 - 0: ACCESSOR_KW@23..32 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@32..35 - 0: IDENT@32..35 "foo" [] [] - 2: TS_TYPE_ANNOTATION@35..44 - 0: COLON@35..37 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@37..44 - 0: NUMBER_KW@37..44 "number" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@44..47 - 0: EQ@44..46 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@46..47 - 0: JS_NUMBER_LITERAL@46..47 "1" [] [] - 4: SEMICOLON@47..48 ";" [] [] - 9: R_CURLY@48..50 "}" [Newline("\n")] [] - 4: EOF@50..51 "" [Newline("\n")] [] --- -ts_class_member_accessor_readonly_precedence.ts:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' must precede 'readonly' - - 1 │ class A { - > 2 │ readonly accessor foo: number = 1; - │ ^^^^^^^^ - 3 │ } - 4 │ - - i move this modifier - - 1 │ class A { - > 2 │ readonly accessor foo: number = 1; - │ ^^^^^^^^ - 3 │ } - 4 │ - - i before this modifier - - 1 │ class A { - > 2 │ readonly accessor foo: number = 1; - │ ^^^^^^^^ - 3 │ } - 4 │ - --- -class A { - readonly accessor foo: number = 1; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast deleted file mode 100644 index 5d32a2ba79fa..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast +++ /dev/null @@ -1,871 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..13 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@13..18 "base1" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@18..20 ";" [] [Whitespace(" ")], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@20..25 "base2" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@25..27 ";" [] [Whitespace(" ")], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@27..32 "base3" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@32..34 ";" [] [Whitespace(" ")], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@34..39 "base4" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@39..40 ";" [] [], - }, - ], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@41..51 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@51..57 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@57..62 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@62..70 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@70..75 "Base" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@75..76 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@76..111 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessibility"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@111..119 "private" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@119..120 "a" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@120..122 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@122..128 "string" [] [], - }, - }, - SEMICOLON@128..129 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@129..143 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@143..153 "protected" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@153..158 "base1" [] [], - }, - SEMICOLON@158..159 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@159..171 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@171..179 "private" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@179..180 "b" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@180..182 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@182..188 "string" [] [], - }, - }, - SEMICOLON@188..189 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@189..203 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@203..213 "protected" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@213..214 "d" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@214..216 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@216..222 "string" [] [], - }, - }, - SEMICOLON@222..223 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@223..251 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Static"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@251..258 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@258..259 "c" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@259..261 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@261..267 "string" [] [], - }, - }, - SEMICOLON@267..268 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@268..282 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@282..289 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@289..290 "d" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@290..292 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@292..298 "string" [] [], - }, - }, - SEMICOLON@298..299 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@299..313 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@313..320 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@320..325 "base2" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@325..327 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@327..333 "string" [] [], - }, - }, - SEMICOLON@333..334 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@334..364 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessor"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@364..373 "accessor" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@373..374 "e" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@374..376 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@376..382 "string" [] [], - }, - }, - SEMICOLON@382..383 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@383..397 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@397..406 "accessor" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@406..407 "f" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@407..409 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@409..415 "string" [] [], - }, - }, - SEMICOLON@415..416 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@416..446 "override" [Newline("\n"), Whitespace(" "), Comments("// abstract"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@446..455 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@455..460 "base3" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@460..462 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@462..468 "string" [] [], - }, - }, - SEMICOLON@468..469 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@469..499 "readonly" [Newline("\n"), Whitespace(" "), Comments("// override"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@499..508 "override" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@508..513 "base4" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@513..515 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@515..521 "string" [] [], - }, - }, - SEMICOLON@521..522 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@522..524 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@524..525 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..525 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..524 - 0: JS_CLASS_DECLARATION@0..41 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Base" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..13 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@13..40 - 0: JS_PROPERTY_CLASS_MEMBER@13..20 - 0: JS_PROPERTY_MODIFIER_LIST@13..13 - 1: JS_LITERAL_MEMBER_NAME@13..18 - 0: IDENT@13..18 "base1" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] - 1: JS_PROPERTY_CLASS_MEMBER@20..27 - 0: JS_PROPERTY_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..25 - 0: IDENT@20..25 "base2" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@25..27 ";" [] [Whitespace(" ")] - 2: JS_PROPERTY_CLASS_MEMBER@27..34 - 0: JS_PROPERTY_MODIFIER_LIST@27..27 - 1: JS_LITERAL_MEMBER_NAME@27..32 - 0: IDENT@27..32 "base3" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@32..34 ";" [] [Whitespace(" ")] - 3: JS_PROPERTY_CLASS_MEMBER@34..40 - 0: JS_PROPERTY_MODIFIER_LIST@34..34 - 1: JS_LITERAL_MEMBER_NAME@34..39 - 0: IDENT@34..39 "base4" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@39..40 ";" [] [] - 9: R_CURLY@40..41 "}" [] [] - 1: JS_CLASS_DECLARATION@41..524 - 0: JS_DECORATOR_LIST@41..41 - 1: ABSTRACT_KW@41..51 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@51..57 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@57..62 - 0: IDENT@57..62 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@62..75 - 0: EXTENDS_KW@62..70 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@70..75 - 0: JS_REFERENCE_IDENTIFIER@70..75 - 0: IDENT@70..75 "Base" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@75..76 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@76..522 - 0: JS_BOGUS_MEMBER@76..129 - 0: JS_PROPERTY_MODIFIER_LIST@76..119 - 0: TS_READONLY_MODIFIER@76..111 - 0: READONLY_KW@76..111 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessibility"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@111..119 - 0: PRIVATE_KW@111..119 "private" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@119..120 - 0: IDENT@119..120 "a" [] [] - 2: TS_TYPE_ANNOTATION@120..128 - 0: COLON@120..122 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@122..128 - 0: STRING_KW@122..128 "string" [] [] - 3: SEMICOLON@128..129 ";" [] [] - 1: JS_BOGUS_MEMBER@129..159 - 0: JS_PROPERTY_MODIFIER_LIST@129..153 - 0: TS_OVERRIDE_MODIFIER@129..143 - 0: OVERRIDE_KW@129..143 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@143..153 - 0: PROTECTED_KW@143..153 "protected" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@153..158 - 0: IDENT@153..158 "base1" [] [] - 2: SEMICOLON@158..159 ";" [] [] - 2: JS_BOGUS_MEMBER@159..189 - 0: JS_PROPERTY_MODIFIER_LIST@159..179 - 0: JS_STATIC_MODIFIER@159..171 - 0: STATIC_KW@159..171 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@171..179 - 0: PRIVATE_KW@171..179 "private" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@179..180 - 0: IDENT@179..180 "b" [] [] - 2: TS_TYPE_ANNOTATION@180..188 - 0: COLON@180..182 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@182..188 - 0: STRING_KW@182..188 "string" [] [] - 3: SEMICOLON@188..189 ";" [] [] - 3: JS_BOGUS_MEMBER@189..223 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@189..213 - 0: TS_ABSTRACT_MODIFIER@189..203 - 0: ABSTRACT_KW@189..203 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@203..213 - 0: PROTECTED_KW@203..213 "protected" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@213..214 - 0: IDENT@213..214 "d" [] [] - 2: TS_TYPE_ANNOTATION@214..222 - 0: COLON@214..216 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@216..222 - 0: STRING_KW@216..222 "string" [] [] - 3: SEMICOLON@222..223 ";" [] [] - 4: JS_BOGUS_MEMBER@223..268 - 0: JS_PROPERTY_MODIFIER_LIST@223..258 - 0: TS_READONLY_MODIFIER@223..251 - 0: READONLY_KW@223..251 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Static"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@251..258 - 0: STATIC_KW@251..258 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@258..259 - 0: IDENT@258..259 "c" [] [] - 2: TS_TYPE_ANNOTATION@259..267 - 0: COLON@259..261 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@261..267 - 0: STRING_KW@261..267 "string" [] [] - 3: SEMICOLON@267..268 ";" [] [] - 5: JS_BOGUS_MEMBER@268..299 - 0: JS_PROPERTY_MODIFIER_LIST@268..289 - 0: JS_ACCESSOR_MODIFIER@268..282 - 0: ACCESSOR_KW@268..282 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@282..289 - 0: STATIC_KW@282..289 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@289..290 - 0: IDENT@289..290 "d" [] [] - 2: TS_TYPE_ANNOTATION@290..298 - 0: COLON@290..292 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@292..298 - 0: STRING_KW@292..298 "string" [] [] - 3: SEMICOLON@298..299 ";" [] [] - 6: JS_BOGUS_MEMBER@299..334 - 0: JS_PROPERTY_MODIFIER_LIST@299..320 - 0: TS_OVERRIDE_MODIFIER@299..313 - 0: OVERRIDE_KW@299..313 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@313..320 - 0: STATIC_KW@313..320 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@320..325 - 0: IDENT@320..325 "base2" [] [] - 2: TS_TYPE_ANNOTATION@325..333 - 0: COLON@325..327 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@327..333 - 0: STRING_KW@327..333 "string" [] [] - 3: SEMICOLON@333..334 ";" [] [] - 7: JS_BOGUS_MEMBER@334..383 - 0: JS_PROPERTY_MODIFIER_LIST@334..373 - 0: TS_READONLY_MODIFIER@334..364 - 0: READONLY_KW@334..364 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessor"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@364..373 - 0: ACCESSOR_KW@364..373 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@373..374 - 0: IDENT@373..374 "e" [] [] - 2: TS_TYPE_ANNOTATION@374..382 - 0: COLON@374..376 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@376..382 - 0: STRING_KW@376..382 "string" [] [] - 3: SEMICOLON@382..383 ";" [] [] - 8: JS_BOGUS_MEMBER@383..416 - 0: JS_PROPERTY_MODIFIER_LIST@383..406 - 0: TS_OVERRIDE_MODIFIER@383..397 - 0: OVERRIDE_KW@383..397 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@397..406 - 0: ACCESSOR_KW@397..406 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@406..407 - 0: IDENT@406..407 "f" [] [] - 2: TS_TYPE_ANNOTATION@407..415 - 0: COLON@407..409 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@409..415 - 0: STRING_KW@409..415 "string" [] [] - 3: SEMICOLON@415..416 ";" [] [] - 9: JS_BOGUS_MEMBER@416..469 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@416..455 - 0: TS_OVERRIDE_MODIFIER@416..446 - 0: OVERRIDE_KW@416..446 "override" [Newline("\n"), Whitespace(" "), Comments("// abstract"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@446..455 - 0: ABSTRACT_KW@446..455 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@455..460 - 0: IDENT@455..460 "base3" [] [] - 2: TS_TYPE_ANNOTATION@460..468 - 0: COLON@460..462 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@462..468 - 0: STRING_KW@462..468 "string" [] [] - 3: SEMICOLON@468..469 ";" [] [] - 10: JS_BOGUS_MEMBER@469..522 - 0: JS_PROPERTY_MODIFIER_LIST@469..508 - 0: TS_READONLY_MODIFIER@469..499 - 0: READONLY_KW@469..499 "readonly" [Newline("\n"), Whitespace(" "), Comments("// override"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@499..508 - 0: OVERRIDE_KW@499..508 "override" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@508..513 - 0: IDENT@508..513 "base4" [] [] - 2: TS_TYPE_ANNOTATION@513..521 - 0: COLON@513..515 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@515..521 - 0: STRING_KW@515..521 "string" [] [] - 3: SEMICOLON@521..522 ";" [] [] - 9: R_CURLY@522..524 "}" [Newline("\n")] [] - 4: EOF@524..525 "" [Newline("\n")] [] --- -ts_class_modifier_precedence.ts:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'private' must precede 'readonly' - - 2 │ abstract class Test extends Base { - 3 │ // Accessibility - > 4 │ readonly private a: string; - │ ^^^^^^^ - 5 │ override protected base1; - 6 │ static private b: string; - - i move this modifier - - 2 │ abstract class Test extends Base { - 3 │ // Accessibility - > 4 │ readonly private a: string; - │ ^^^^^^^ - 5 │ override protected base1; - 6 │ static private b: string; - - i before this modifier - - 2 │ abstract class Test extends Base { - 3 │ // Accessibility - > 4 │ readonly private a: string; - │ ^^^^^^^^ - 5 │ override protected base1; - 6 │ static private b: string; - --- -ts_class_modifier_precedence.ts:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'protected' must precede 'override' - - 3 │ // Accessibility - 4 │ readonly private a: string; - > 5 │ override protected base1; - │ ^^^^^^^^^ - 6 │ static private b: string; - 7 │ abstract protected d: string; - - i move this modifier - - 3 │ // Accessibility - 4 │ readonly private a: string; - > 5 │ override protected base1; - │ ^^^^^^^^^ - 6 │ static private b: string; - 7 │ abstract protected d: string; - - i before this modifier - - 3 │ // Accessibility - 4 │ readonly private a: string; - > 5 │ override protected base1; - │ ^^^^^^^^ - 6 │ static private b: string; - 7 │ abstract protected d: string; - --- -ts_class_modifier_precedence.ts:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'private' must precede 'static' - - 4 │ readonly private a: string; - 5 │ override protected base1; - > 6 │ static private b: string; - │ ^^^^^^^ - 7 │ abstract protected d: string; - 8 │ // Static - - i move this modifier - - 4 │ readonly private a: string; - 5 │ override protected base1; - > 6 │ static private b: string; - │ ^^^^^^^ - 7 │ abstract protected d: string; - 8 │ // Static - - i before this modifier - - 4 │ readonly private a: string; - 5 │ override protected base1; - > 6 │ static private b: string; - │ ^^^^^^ - 7 │ abstract protected d: string; - 8 │ // Static - --- -ts_class_modifier_precedence.ts:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'protected' must precede 'abstract' - - 5 │ override protected base1; - 6 │ static private b: string; - > 7 │ abstract protected d: string; - │ ^^^^^^^^^ - 8 │ // Static - 9 │ readonly static c: string; - - i move this modifier - - 5 │ override protected base1; - 6 │ static private b: string; - > 7 │ abstract protected d: string; - │ ^^^^^^^^^ - 8 │ // Static - 9 │ readonly static c: string; - - i before this modifier - - 5 │ override protected base1; - 6 │ static private b: string; - > 7 │ abstract protected d: string; - │ ^^^^^^^^ - 8 │ // Static - 9 │ readonly static c: string; - --- -ts_class_modifier_precedence.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' must precede 'readonly' - - 7 │ abstract protected d: string; - 8 │ // Static - > 9 │ readonly static c: string; - │ ^^^^^^ - 10 │ accessor static d: string; - 11 │ override static base2: string; - - i move this modifier - - 7 │ abstract protected d: string; - 8 │ // Static - > 9 │ readonly static c: string; - │ ^^^^^^ - 10 │ accessor static d: string; - 11 │ override static base2: string; - - i before this modifier - - 7 │ abstract protected d: string; - 8 │ // Static - > 9 │ readonly static c: string; - │ ^^^^^^^^ - 10 │ accessor static d: string; - 11 │ override static base2: string; - --- -ts_class_modifier_precedence.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' must precede 'accessor' - - 8 │ // Static - 9 │ readonly static c: string; - > 10 │ accessor static d: string; - │ ^^^^^^ - 11 │ override static base2: string; - 12 │ // Accessor - - i move this modifier - - 8 │ // Static - 9 │ readonly static c: string; - > 10 │ accessor static d: string; - │ ^^^^^^ - 11 │ override static base2: string; - 12 │ // Accessor - - i before this modifier - - 8 │ // Static - 9 │ readonly static c: string; - > 10 │ accessor static d: string; - │ ^^^^^^^^ - 11 │ override static base2: string; - 12 │ // Accessor - --- -ts_class_modifier_precedence.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' must precede 'override' - - 9 │ readonly static c: string; - 10 │ accessor static d: string; - > 11 │ override static base2: string; - │ ^^^^^^ - 12 │ // Accessor - 13 │ readonly accessor e: string; - - i move this modifier - - 9 │ readonly static c: string; - 10 │ accessor static d: string; - > 11 │ override static base2: string; - │ ^^^^^^ - 12 │ // Accessor - 13 │ readonly accessor e: string; - - i before this modifier - - 9 │ readonly static c: string; - 10 │ accessor static d: string; - > 11 │ override static base2: string; - │ ^^^^^^^^ - 12 │ // Accessor - 13 │ readonly accessor e: string; - --- -ts_class_modifier_precedence.ts:13:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' must precede 'readonly' - - 11 │ override static base2: string; - 12 │ // Accessor - > 13 │ readonly accessor e: string; - │ ^^^^^^^^ - 14 │ override accessor f: string; - 15 │ // abstract - - i move this modifier - - 11 │ override static base2: string; - 12 │ // Accessor - > 13 │ readonly accessor e: string; - │ ^^^^^^^^ - 14 │ override accessor f: string; - 15 │ // abstract - - i before this modifier - - 11 │ override static base2: string; - 12 │ // Accessor - > 13 │ readonly accessor e: string; - │ ^^^^^^^^ - 14 │ override accessor f: string; - 15 │ // abstract - --- -ts_class_modifier_precedence.ts:14:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' cannot be used with 'override' modifier. - - 12 │ // Accessor - 13 │ readonly accessor e: string; - > 14 │ override accessor f: string; - │ ^^^^^^^^ - 15 │ // abstract - 16 │ override abstract base3: string; - - i 'accessor' modifier - - 12 │ // Accessor - 13 │ readonly accessor e: string; - > 14 │ override accessor f: string; - │ ^^^^^^^^ - 15 │ // abstract - 16 │ override abstract base3: string; - - i 'override' modifier - - 12 │ // Accessor - 13 │ readonly accessor e: string; - > 14 │ override accessor f: string; - │ ^^^^^^^^ - 15 │ // abstract - 16 │ override abstract base3: string; - --- -ts_class_modifier_precedence.ts:16:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' must precede 'override' - - 14 │ override accessor f: string; - 15 │ // abstract - > 16 │ override abstract base3: string; - │ ^^^^^^^^ - 17 │ // override - 18 │ readonly override base4: string; - - i move this modifier - - 14 │ override accessor f: string; - 15 │ // abstract - > 16 │ override abstract base3: string; - │ ^^^^^^^^ - 17 │ // override - 18 │ readonly override base4: string; - - i before this modifier - - 14 │ override accessor f: string; - 15 │ // abstract - > 16 │ override abstract base3: string; - │ ^^^^^^^^ - 17 │ // override - 18 │ readonly override base4: string; - --- -ts_class_modifier_precedence.ts:18:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'override' must precede 'readonly' - - 16 │ override abstract base3: string; - 17 │ // override - > 18 │ readonly override base4: string; - │ ^^^^^^^^ - 19 │ } - 20 │ - - i move this modifier - - 16 │ override abstract base3: string; - 17 │ // override - > 18 │ readonly override base4: string; - │ ^^^^^^^^ - 19 │ } - 20 │ - - i before this modifier - - 16 │ override abstract base3: string; - 17 │ // override - > 18 │ readonly override base4: string; - │ ^^^^^^^^ - 19 │ } - 20 │ - --- -class Base { base1; base2; base3; base4;} -abstract class Test extends Base { - // Accessibility - readonly private a: string; - override protected base1; - static private b: string; - abstract protected d: string; - // Static - readonly static c: string; - accessor static d: string; - override static base2: string; - // Accessor - readonly accessor e: string; - override accessor f: string; - // abstract - override abstract base3: string; - // override - readonly override base4: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.rast deleted file mode 100644 index 198aff638578..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.rast +++ /dev/null @@ -1,129 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..16 "undefined" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..17 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@17..18 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@18..25 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@25..32 "string" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@32..33 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@41..45 "any" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@45..46 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@46..47 "}" [] [], - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_CLASS_DECLARATION@0..18 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..16 - 0: IDENT@6..16 "undefined" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..17 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@17..17 - 9: R_CURLY@17..18 "}" [] [] - 1: JS_CLASS_DECLARATION@18..34 - 0: JS_DECORATOR_LIST@18..18 - 1: (empty) - 2: CLASS_KW@18..25 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@25..32 - 0: IDENT@25..32 "string" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@32..33 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@33..33 - 9: R_CURLY@33..34 "}" [] [] - 2: JS_CLASS_DECLARATION@34..47 - 0: JS_DECORATOR_LIST@34..34 - 1: (empty) - 2: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@41..45 - 0: IDENT@41..45 "any" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@45..46 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@46..46 - 9: R_CURLY@46..47 "}" [] [] - 4: EOF@47..48 "" [Newline("\n")] [] --- -ts_class_name_reserved_as_type.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `undefined` cannot be used as a class name because it is already reserved as a type - - > 1 │ class undefined {} - │ ^^^^^^^^^ - 2 │ class string {} - 3 │ class any {} - --- -ts_class_name_reserved_as_type.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `string` cannot be used as a class name because it is already reserved as a type - - 1 │ class undefined {} - > 2 │ class string {} - │ ^^^^^^ - 3 │ class any {} - 4 │ - --- -ts_class_name_reserved_as_type.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `any` cannot be used as a class name because it is already reserved as a type - - 1 │ class undefined {} - 2 │ class string {} - > 3 │ class any {} - │ ^^^ - 4 │ - --- -class undefined {} -class string {} -class any {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.rast b/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.rast deleted file mode 100644 index c0200c69e77d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..16 "BuildError" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@16..17 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@17..19 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@19..20 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_CLASS_DECLARATION@0..21 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..16 - 0: IDENT@6..16 "BuildError" [] [] - 4: TS_TYPE_PARAMETERS@16..19 - 0: L_ANGLE@16..17 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@17..17 - 2: R_ANGLE@17..19 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@19..20 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@20..20 - 9: R_CURLY@20..21 "}" [] [] - 4: EOF@21..22 "" [Newline("\n")] [] --- -ts_class_type_parameters_errors.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - > 1 │ class BuildError<> {} - │ ^ - 2 │ - - i Expected a type parameter here. - - > 1 │ class BuildError<> {} - │ ^ - 2 │ - --- -class BuildError<> {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast b/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast deleted file mode 100644 index 08bf1b505692..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast +++ /dev/null @@ -1,243 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@9..22 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@22..28 "my_age" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@30..36 "number" [] [], - }, - }, - SEMICOLON@36..37 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@37..50 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@50..54 "name" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@54..55 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@55..56 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@56..58 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@58..64 "string" [] [], - }, - }, - SEMICOLON@64..65 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@65..78 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - GET_KW@78..82 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@82..85 "age" [] [], - }, - L_PAREN@85..86 "(" [] [], - R_PAREN@86..87 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@87..89 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@89..95 "number" [] [], - }, - }, - SEMICOLON@95..96 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@96..109 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - SET_KW@109..113 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@113..116 "age" [] [], - }, - L_PAREN@116..117 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@117..118 "v" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - R_PAREN@118..119 ")" [] [], - SEMICOLON@119..120 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@120..122 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@122..123 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..123 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..122 - 0: JS_CLASS_DECLARATION@0..122 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..120 - 0: JS_BOGUS_MEMBER@9..37 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@9..22 - 0: TS_ABSTRACT_MODIFIER@9..22 - 0: ABSTRACT_KW@9..22 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@22..28 - 0: IDENT@22..28 "my_age" [] [] - 2: TS_TYPE_ANNOTATION@28..36 - 0: COLON@28..30 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@30..36 - 0: NUMBER_KW@30..36 "number" [] [] - 3: SEMICOLON@36..37 ";" [] [] - 1: JS_BOGUS_MEMBER@37..65 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@37..50 - 0: TS_ABSTRACT_MODIFIER@37..50 - 0: ABSTRACT_KW@37..50 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@50..54 - 0: IDENT@50..54 "name" [] [] - 2: JS_PARAMETERS@54..56 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_PARAMETER_LIST@55..55 - 2: R_PAREN@55..56 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@56..64 - 0: COLON@56..58 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@58..64 - 0: STRING_KW@58..64 "string" [] [] - 4: SEMICOLON@64..65 ";" [] [] - 2: JS_BOGUS_MEMBER@65..96 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@65..78 - 0: TS_ABSTRACT_MODIFIER@65..78 - 0: ABSTRACT_KW@65..78 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@78..82 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@82..85 - 0: IDENT@82..85 "age" [] [] - 3: L_PAREN@85..86 "(" [] [] - 4: R_PAREN@86..87 ")" [] [] - 5: TS_TYPE_ANNOTATION@87..95 - 0: COLON@87..89 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@89..95 - 0: NUMBER_KW@89..95 "number" [] [] - 6: SEMICOLON@95..96 ";" [] [] - 3: JS_BOGUS_MEMBER@96..120 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@96..109 - 0: TS_ABSTRACT_MODIFIER@96..109 - 0: ABSTRACT_KW@96..109 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@109..113 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@113..116 - 0: IDENT@113..116 "age" [] [] - 3: L_PAREN@116..117 "(" [] [] - 4: JS_FORMAL_PARAMETER@117..118 - 0: JS_DECORATOR_LIST@117..117 - 1: JS_IDENTIFIER_BINDING@117..118 - 0: IDENT@117..118 "v" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: R_PAREN@118..119 ")" [] [] - 6: SEMICOLON@119..120 ";" [] [] - 9: R_CURLY@120..122 "}" [Newline("\n")] [] - 4: EOF@122..123 "" [Newline("\n")] [] --- -ts_concrete_class_with_abstract_members.ts:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Only abstract classes can have abstract members - - 1 │ class A { - > 2 │ abstract my_age: number; - │ ^^^^^^^^ - 3 │ abstract name(): string; - 4 │ abstract get age(): number; - --- -ts_concrete_class_with_abstract_members.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Only abstract classes can have abstract members - - 1 │ class A { - 2 │ abstract my_age: number; - > 3 │ abstract name(): string; - │ ^^^^^^^^ - 4 │ abstract get age(): number; - 5 │ abstract set age(v); - --- -ts_concrete_class_with_abstract_members.ts:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Only abstract classes can have abstract members - - 2 │ abstract my_age: number; - 3 │ abstract name(): string; - > 4 │ abstract get age(): number; - │ ^^^^^^^^ - 5 │ abstract set age(v); - 6 │ } - --- -ts_concrete_class_with_abstract_members.ts:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Only abstract classes can have abstract members - - 3 │ abstract name(): string; - 4 │ abstract get age(): number; - > 5 │ abstract set age(v); - │ ^^^^^^^^ - 6 │ } - 7 │ - --- -class A { - abstract my_age: number; - abstract name(): string; - abstract get age(): number; - abstract set age(v); -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.rast b/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.rast deleted file mode 100644 index 58d825738d14..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.rast +++ /dev/null @@ -1,154 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@11..15 "new" [] [Whitespace(" ")], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@15..16 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@16..17 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@17..18 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@18..19 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@19..21 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@21..22 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..25 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@27..28 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@28..29 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@29..31 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@31..38 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: TS_TYPE_ALIAS_DECLARATION@0..39 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..39 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..38 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@11..38 - 0: NEW_KW@11..15 "new" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETERS@15..17 - 0: L_ANGLE@15..16 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@16..16 - 2: R_ANGLE@16..17 ">" [] [] - 2: JS_PARAMETERS@17..29 - 0: L_PAREN@17..18 "(" [] [] - 1: JS_PARAMETER_LIST@18..28 - 0: JS_FORMAL_PARAMETER@18..22 - 0: JS_DECORATOR_LIST@18..18 - 1: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@19..22 - 0: COLON@19..21 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@21..22 - 0: JS_REFERENCE_IDENTIFIER@21..22 - 0: IDENT@21..22 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@24..28 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@25..28 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@27..28 - 0: JS_REFERENCE_IDENTIFIER@27..28 - 0: IDENT@27..28 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@28..29 ")" [] [] - 3: TS_TYPE_ANNOTATION@29..38 - 0: COLON@29..31 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@31..38 - 0: STRING_KW@31..38 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@38..39 "}" [] [] - 5: (empty) - 4: EOF@39..40 "" [Newline("\n")] [] --- -ts_construct_signature_member_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - > 1 │ type C = { new <>(a: A, b: B): string } - │ ^ - 2 │ - - i Expected a type parameter here. - - > 1 │ type C = { new <>(a: A, b: B): string } - │ ^ - 2 │ - --- -type C = { new <>(a: A, b: B): string } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast b/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast deleted file mode 100644 index 6020f9857424..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..21 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - parameters: JsConstructorParameterList [ - JsBogusParameter { - items: [ - THIS_KW@22..26 "this" [] [], - ], - }, - ], - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..31 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - ], - eof_token: EOF@32..33 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..33 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..32 - 0: JS_CLASS_DECLARATION@0..32 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..31 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..31 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..21 - 0: IDENT@10..21 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@21..28 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..26 - 0: JS_BOGUS_PARAMETER@22..26 - 0: THIS_KW@22..26 "this" [] [] - 2: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@28..31 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..31 "}" [] [Whitespace(" ")] - 9: R_CURLY@31..32 "}" [] [] - 4: EOF@32..33 "" [Newline("\n")] [] --- -ts_constructor_this_parameter.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A constructor cannot have a 'this' parameter. - - > 1 │ class C { constructor(this) {} } - │ ^^^^ - 2 │ - --- -class C { constructor(this) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.rast b/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.rast deleted file mode 100644 index 5e8a33b24496..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.rast +++ /dev/null @@ -1,270 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: missing (optional), - new_token: NEW_KW@9..12 "new" [] [], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@12..13 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@13..14 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@14..15 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@18..19 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@19..21 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@21..22 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@22..24 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@24..25 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@30..36 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@43..45 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: ABSTRACT_KW@47..56 "abstract" [] [Whitespace(" ")], - new_token: NEW_KW@56..59 "new" [] [], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@59..60 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@60..61 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@61..62 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@62..63 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@63..65 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@65..66 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@66..68 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@68..69 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@71..72 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@72..74 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@74..77 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@77..83 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: TS_TYPE_ALIAS_DECLARATION@0..37 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@9..36 - 0: (empty) - 1: NEW_KW@9..12 "new" [] [] - 2: TS_TYPE_PARAMETERS@12..14 - 0: L_ANGLE@12..13 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@13..13 - 2: R_ANGLE@13..14 ">" [] [] - 3: JS_PARAMETERS@14..27 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_PARAMETER_LIST@15..25 - 0: JS_FORMAL_PARAMETER@15..19 - 0: JS_DECORATOR_LIST@15..15 - 1: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@16..19 - 0: COLON@16..18 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@18..19 - 0: JS_REFERENCE_IDENTIFIER@18..19 - 0: IDENT@18..19 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@19..21 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@21..25 - 0: JS_DECORATOR_LIST@21..21 - 1: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@22..25 - 0: COLON@22..24 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@24..25 - 0: JS_REFERENCE_IDENTIFIER@24..25 - 0: IDENT@24..25 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@30..36 - 0: STRING_KW@30..36 "string" [] [] - 5: SEMICOLON@36..37 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@37..84 - 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@45..47 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@47..83 - 0: ABSTRACT_KW@47..56 "abstract" [] [Whitespace(" ")] - 1: NEW_KW@56..59 "new" [] [] - 2: TS_TYPE_PARAMETERS@59..61 - 0: L_ANGLE@59..60 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@60..60 - 2: R_ANGLE@60..61 ">" [] [] - 3: JS_PARAMETERS@61..74 - 0: L_PAREN@61..62 "(" [] [] - 1: JS_PARAMETER_LIST@62..72 - 0: JS_FORMAL_PARAMETER@62..66 - 0: JS_DECORATOR_LIST@62..62 - 1: JS_IDENTIFIER_BINDING@62..63 - 0: IDENT@62..63 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@63..66 - 0: COLON@63..65 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@65..66 - 0: JS_REFERENCE_IDENTIFIER@65..66 - 0: IDENT@65..66 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@66..68 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@68..72 - 0: JS_DECORATOR_LIST@68..68 - 1: JS_IDENTIFIER_BINDING@68..69 - 0: IDENT@68..69 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@69..72 - 0: COLON@69..71 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@71..72 - 0: JS_REFERENCE_IDENTIFIER@71..72 - 0: IDENT@71..72 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@72..74 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@74..77 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@77..83 - 0: STRING_KW@77..83 "string" [] [] - 5: SEMICOLON@83..84 ";" [] [] - 4: EOF@84..85 "" [Newline("\n")] [] --- -ts_constructor_type_err.ts:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - > 1 │ type C = new<>(a: A, b: B) => string; - │ ^ - 2 │ type D = abstract new<>(a: A, b: B) => string; - 3 │ - - i Expected a type parameter here. - - > 1 │ type C = new<>(a: A, b: B) => string; - │ ^ - 2 │ type D = abstract new<>(a: A, b: B) => string; - 3 │ - --- -ts_constructor_type_err.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ type C = new<>(a: A, b: B) => string; - > 2 │ type D = abstract new<>(a: A, b: B) => string; - │ ^ - 3 │ - - i Expected a type parameter here. - - 1 │ type C = new<>(a: A, b: B) => string; - > 2 │ type D = abstract new<>(a: A, b: B) => string; - │ ^ - 3 │ - --- -type C = new<>(a: A, b: B) => string; -type D = abstract new<>(a: A, b: B) => string; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast b/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast deleted file mode 100644 index eff33c49d873..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast +++ /dev/null @@ -1,240 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@10..21 "constructor" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@21..22 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@22..23 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@23..24 ">" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@24..25 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@25..26 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..31 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@32..39 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@39..41 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@43..54 "constructor" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@54..55 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@55..56 ">" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@56..57 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@57..58 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@60..61 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@61..63 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@63..64 "}" [] [], - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: JS_CLASS_DECLARATION@0..32 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..31 - 0: JS_BOGUS_MEMBER@10..31 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..21 - 0: IDENT@10..21 "constructor" [] [] - 2: TS_TYPE_PARAMETERS@21..24 - 0: L_ANGLE@21..22 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@22..23 - 0: TS_TYPE_PARAMETER@22..23 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@22..22 - 1: TS_TYPE_PARAMETER_NAME@22..23 - 0: IDENT@22..23 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@23..24 ">" [] [] - 3: JS_CONSTRUCTOR_PARAMETERS@24..28 - 0: L_PAREN@24..25 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@25..26 - 0: JS_FORMAL_PARAMETER@25..26 - 0: JS_DECORATOR_LIST@25..25 - 1: JS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@28..31 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..31 "}" [] [Whitespace(" ")] - 9: R_CURLY@31..32 "}" [] [] - 1: JS_CLASS_DECLARATION@32..64 - 0: JS_DECORATOR_LIST@32..32 - 1: (empty) - 2: CLASS_KW@32..39 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@39..41 - 0: IDENT@39..41 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@43..63 - 0: JS_BOGUS_MEMBER@43..63 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@43..43 - 1: JS_LITERAL_MEMBER_NAME@43..54 - 0: IDENT@43..54 "constructor" [] [] - 2: TS_TYPE_PARAMETERS@54..56 - 0: L_ANGLE@54..55 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@55..55 - 2: R_ANGLE@55..56 ">" [] [] - 3: JS_CONSTRUCTOR_PARAMETERS@56..60 - 0: L_PAREN@56..57 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@57..58 - 0: JS_FORMAL_PARAMETER@57..58 - 0: JS_DECORATOR_LIST@57..57 - 1: JS_IDENTIFIER_BINDING@57..58 - 0: IDENT@57..58 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@60..63 - 0: L_CURLY@60..61 "{" [] [] - 1: JS_DIRECTIVE_LIST@61..61 - 2: JS_STATEMENT_LIST@61..61 - 3: R_CURLY@61..63 "}" [] [Whitespace(" ")] - 9: R_CURLY@63..64 "}" [] [] - 4: EOF@64..65 "" [Newline("\n")] [] --- -ts_constructor_type_parameters.ts:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × constructors cannot have type parameters. - - > 1 │ class A { constructor(b) {} } - │ ^^^ - 2 │ class A { constructor<>(b) {} } - 3 │ - --- -ts_constructor_type_parameters.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ class A { constructor(b) {} } - > 2 │ class A { constructor<>(b) {} } - │ ^ - 3 │ - - i Expected a type parameter here. - - 1 │ class A { constructor(b) {} } - > 2 │ class A { constructor<>(b) {} } - │ ^ - 3 │ - --- -ts_constructor_type_parameters.ts:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × constructors cannot have type parameters. - - 1 │ class A { constructor(b) {} } - > 2 │ class A { constructor<>(b) {} } - │ ^^ - 3 │ - --- -class A { constructor(b) {} } -class A { constructor<>(b) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.rast deleted file mode 100644 index 5fa8f2dc5c2e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.rast +++ /dev/null @@ -1,58 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - ASYNC_KW@8..14 "async" [] [Whitespace(" ")], - FUNCTION_KW@14..23 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@23..27 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@27..28 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@28..29 ")" [] [], - }, - SEMICOLON@29..30 ";" [] [], - ], - }, - ], - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_BOGUS_STATEMENT@0..30 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@8..30 - 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@14..23 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@23..27 - 0: IDENT@23..27 "test" [] [] - 3: JS_PARAMETERS@27..29 - 0: L_PAREN@27..28 "(" [] [] - 1: JS_PARAMETER_LIST@28..28 - 2: R_PAREN@28..29 ")" [] [] - 4: SEMICOLON@29..30 ";" [] [] - 4: EOF@30..31 "" [Newline("\n")] [] --- -ts_declare_async_function.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'async' modifier cannot be used in an ambient context. - - > 1 │ declare async function test(); - │ ^^^^^ - 2 │ - --- -declare async function test(); diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.rast deleted file mode 100644 index 12357ed8e3f9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.rast +++ /dev/null @@ -1,144 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@8..9 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..19 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@19..25 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@25..27 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@27..28 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - DECLARE_KW@29..38 "declare" [Newline("\n")] [Whitespace(" ")], - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@38..39 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@39..49 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@49..58 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@58..64 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@64..66 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@66..67 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@67..68 "}" [] [], - }, - ], - }, - ], - eof_token: EOF@68..69 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..69 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..68 - 0: JS_BOGUS_STATEMENT@0..29 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@8..19 - 0: JS_DECORATOR@8..19 - 0: AT@8..9 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@9..19 - 0: JS_REFERENCE_IDENTIFIER@9..19 - 0: IDENT@9..19 "decorator" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@19..29 - 0: JS_DECORATOR_LIST@19..19 - 1: (empty) - 2: CLASS_KW@19..25 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@27..28 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@28..28 - 9: R_CURLY@28..29 "}" [] [] - 1: JS_BOGUS_STATEMENT@29..68 - 0: DECLARE_KW@29..38 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@38..49 - 0: JS_DECORATOR@38..49 - 0: AT@38..39 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@39..49 - 0: JS_REFERENCE_IDENTIFIER@39..49 - 0: IDENT@39..49 "decorator" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@49..68 - 0: JS_DECORATOR_LIST@49..49 - 1: ABSTRACT_KW@49..58 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@58..64 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@64..66 - 0: IDENT@64..66 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@66..67 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@67..67 - 9: R_CURLY@67..68 "}" [] [] - 4: EOF@68..69 "" [Newline("\n")] [] --- -ts_declare_const_initializer.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ declare @decorator class D {} - │ ^^^^^^^^^^ - 2 │ declare @decorator abstract class D {} - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_declare_const_initializer.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ declare @decorator class D {} - > 2 │ declare @decorator abstract class D {} - │ ^^^^^^^^^^ - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -declare @decorator class D {} -declare @decorator abstract class D {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast deleted file mode 100644 index 78251ec20c4c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast +++ /dev/null @@ -1,127 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@19..20 "{" [] [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@30..38 "function" [] [], - id: missing (required), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@39..45 "option" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@45..47 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@47..50 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@50..51 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@51..53 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@53..57 "void" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@57..59 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@59..60 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..60 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..59 - 0: TS_DECLARE_STATEMENT@0..59 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@8..59 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@15..19 - 0: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@19..59 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_MODULE_ITEM_LIST@20..57 - 0: JS_EXPORT@20..57 - 0: JS_DECORATOR_LIST@20..20 - 1: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: TS_DECLARE_FUNCTION_DECLARATION@30..57 - 0: (empty) - 1: FUNCTION_KW@30..38 "function" [] [] - 2: (empty) - 3: (empty) - 4: JS_PARAMETERS@38..51 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..50 - 0: JS_FORMAL_PARAMETER@39..50 - 0: JS_DECORATOR_LIST@39..39 - 1: JS_IDENTIFIER_BINDING@39..45 - 0: IDENT@39..45 "option" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@45..50 - 0: COLON@45..47 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@47..50 - 0: ANY_KW@47..50 "any" [] [] - 4: (empty) - 2: R_PAREN@50..51 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@51..57 - 0: COLON@51..53 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@53..57 - 0: VOID_KW@53..57 "void" [] [] - 6: (empty) - 2: R_CURLY@57..59 "}" [Newline("\n")] [] - 4: EOF@59..60 "" [Newline("\n")] [] --- -ts_declare_function_export_declaration_missing_id.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found '('. - - 1 │ declare module 'x' { - > 2 │ export function(option: any): void - │ ^ - 3 │ } - 4 │ - - i Expected an identifier, an array pattern, or an object pattern here. - - 1 │ declare module 'x' { - > 2 │ export function(option: any): void - │ ^ - 3 │ } - 4 │ - --- -declare module 'x' { - export function(option: any): void -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast deleted file mode 100644 index b9102ad14df4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast +++ /dev/null @@ -1,144 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@8..17 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@17..21 "test" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@21..22 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@22..23 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@23..24 ">" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@24..25 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@25..26 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@26..28 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@28..29 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@29..30 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@30..32 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@32..39 "string" [] [Whitespace(" ")], - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@39..41 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@41..48 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@48..78 "\"ambient function with a body\"" [] [], - }, - semicolon_token: SEMICOLON@78..80 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@80..81 "}" [] [], - }, - ], - }, - ], - }, - ], - eof_token: EOF@81..82 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..82 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..81 - 0: JS_BOGUS_STATEMENT@0..81 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@8..81 - 0: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@17..21 - 0: IDENT@17..21 "test" [] [] - 2: TS_TYPE_PARAMETERS@21..24 - 0: L_ANGLE@21..22 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@22..23 - 0: TS_TYPE_PARAMETER@22..23 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@22..22 - 1: TS_TYPE_PARAMETER_NAME@22..23 - 0: IDENT@22..23 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@23..24 ">" [] [] - 3: JS_PARAMETERS@24..30 - 0: L_PAREN@24..25 "(" [] [] - 1: JS_PARAMETER_LIST@25..29 - 0: JS_FORMAL_PARAMETER@25..29 - 0: JS_DECORATOR_LIST@25..25 - 1: JS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@26..29 - 0: COLON@26..28 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@28..29 - 0: JS_REFERENCE_IDENTIFIER@28..29 - 0: IDENT@28..29 "A" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@29..30 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@30..39 - 0: COLON@30..32 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@32..39 - 0: STRING_KW@32..39 "string" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@39..81 - 0: L_CURLY@39..41 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@41..41 - 2: JS_STATEMENT_LIST@41..80 - 0: JS_RETURN_STATEMENT@41..80 - 0: RETURN_KW@41..48 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@48..78 - 0: JS_STRING_LITERAL@48..78 "\"ambient function with a body\"" [] [] - 2: SEMICOLON@78..80 ";" [] [Whitespace(" ")] - 3: R_CURLY@80..81 "}" [] [] - 4: EOF@81..82 "" [Newline("\n")] [] --- -ts_declare_function_with_body.ts:1:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A 'declare' function cannot have a function body - - > 1 │ declare function test(a: A): string { return "ambient function with a body"; } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 2 │ - - i remove this body - --- -declare function test(a: A): string { return "ambient function with a body"; } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.rast deleted file mode 100644 index 27df0533ef2a..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.rast +++ /dev/null @@ -1,158 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@8..16 "function" [] [], - STAR@16..18 "*" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@18..22 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@23..24 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@26..30 "void" [] [], - }, - }, - SEMICOLON@30..31 ";" [] [], - ], - }, - ], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@31..40 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@40..47 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@47..51 "'x'" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@51..52 "{" [] [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@52..62 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsBogus { - items: [ - DEFAULT_KW@62..70 "default" [] [Whitespace(" ")], - JsBogus { - items: [ - FUNCTION_KW@70..78 "function" [] [], - STAR@78..80 "*" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@80..84 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@84..85 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@85..86 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@86..88 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@88..92 "void" [] [], - }, - }, - ], - }, - ], - }, - ], - }, - ], - r_curly_token: R_CURLY@92..94 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@94..95 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..95 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..94 - 0: JS_BOGUS_STATEMENT@0..31 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@8..31 - 0: FUNCTION_KW@8..16 "function" [] [] - 1: STAR@16..18 "*" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@18..22 - 0: IDENT@18..22 "test" [] [] - 3: JS_PARAMETERS@22..24 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_PARAMETER_LIST@23..23 - 2: R_PAREN@23..24 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@24..30 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@26..30 - 0: VOID_KW@26..30 "void" [] [] - 5: SEMICOLON@30..31 ";" [] [] - 1: TS_DECLARE_STATEMENT@31..94 - 0: DECLARE_KW@31..40 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@40..94 - 0: MODULE_KW@40..47 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@47..51 - 0: JS_STRING_LITERAL@47..51 "'x'" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@51..94 - 0: L_CURLY@51..52 "{" [] [] - 1: JS_MODULE_ITEM_LIST@52..92 - 0: JS_BOGUS_STATEMENT@52..92 - 0: JS_DECORATOR_LIST@52..52 - 1: EXPORT_KW@52..62 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_BOGUS@62..92 - 0: DEFAULT_KW@62..70 "default" [] [Whitespace(" ")] - 1: JS_BOGUS@70..92 - 0: FUNCTION_KW@70..78 "function" [] [] - 1: STAR@78..80 "*" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@80..84 - 0: IDENT@80..84 "test" [] [] - 3: JS_PARAMETERS@84..86 - 0: L_PAREN@84..85 "(" [] [] - 1: JS_PARAMETER_LIST@85..85 - 2: R_PAREN@85..86 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@86..92 - 0: COLON@86..88 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@88..92 - 0: VOID_KW@88..92 "void" [] [] - 2: R_CURLY@92..94 "}" [Newline("\n")] [] - 4: EOF@94..95 "" [Newline("\n")] [] --- -ts_declare_generator_function.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Generators are not allowed in an ambient context. - - > 1 │ declare function* test(): void; - │ ^ - 2 │ declare module 'x' { - 3 │ export default function* test(): void - --- -ts_declare_generator_function.ts:3:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Generators are not allowed in an ambient context. - - 1 │ declare function* test(): void; - 2 │ declare module 'x' { - > 3 │ export default function* test(): void - │ ^ - 4 │ } - 5 │ - --- -declare function* test(): void; -declare module 'x' { - export default function* test(): void -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast deleted file mode 100644 index 1aec1d41becf..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsDeclareModifier { - modifier_token: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")], - }, - ], - }, - JsPrivateClassMemberName { - hash_token: HASH@18..19 "#" [] [], - id_token: IDENT@19..23 "name" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..25 ")" [] [], - }, - SEMICOLON@25..27 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_CLASS_DECLARATION@0..28 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..27 - 0: JS_BOGUS_MEMBER@10..27 - 0: JS_BOGUS@10..18 - 0: TS_DECLARE_MODIFIER@10..18 - 0: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@18..23 - 0: HASH@18..19 "#" [] [] - 1: IDENT@19..23 "name" [] [] - 2: JS_PARAMETERS@23..25 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..25 ")" [] [] - 3: SEMICOLON@25..27 ";" [] [Whitespace(" ")] - 9: R_CURLY@27..28 "}" [] [] - 1: JS_EMPTY_STATEMENT@28..29 - 0: SEMICOLON@28..29 ";" [] [] - 4: EOF@29..30 "" [Newline("\n")] [] --- -ts_declare_property_private_name.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'declare' modifier is only allowed on properties. - - > 1 │ class A { declare #name(); }; - │ ^^^^^^^ - 2 │ - --- -class A { declare #name(); }; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_using.rast b/crates/biome_js_parser/test_data/inline/err/ts_declare_using.rast deleted file mode 100644 index 6df23dcf372e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_using.rast +++ /dev/null @@ -1,186 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..8 "declare" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@8..14 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..15 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@15..17 ":" [] [Whitespace(" ")], - ty: TsNullLiteralType { - literal_token: NULL_KW@17..21 "null" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..30 "declare" [Newline("\n")] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: AWAIT_KW@30..36 "await" [] [Whitespace(" ")], - kind: USING_KW@36..42 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@42..43 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@43..45 ":" [] [Whitespace(" ")], - ty: TsNullLiteralType { - literal_token: NULL_KW@45..49 "null" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_IDENTIFIER_EXPRESSION@0..8 - 0: JS_REFERENCE_IDENTIFIER@0..8 - 0: IDENT@0..8 "declare" [] [Whitespace(" ")] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@8..21 - 0: JS_VARIABLE_DECLARATION@8..21 - 0: (empty) - 1: USING_KW@8..14 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..21 - 0: JS_VARIABLE_DECLARATOR@14..21 - 0: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "x" [] [] - 1: TS_TYPE_ANNOTATION@15..21 - 0: COLON@15..17 ":" [] [Whitespace(" ")] - 1: TS_NULL_LITERAL_TYPE@17..21 - 0: NULL_KW@17..21 "null" [] [] - 2: (empty) - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@21..30 - 0: JS_IDENTIFIER_EXPRESSION@21..30 - 0: JS_REFERENCE_IDENTIFIER@21..30 - 0: IDENT@21..30 "declare" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 3: JS_VARIABLE_STATEMENT@30..49 - 0: JS_VARIABLE_DECLARATION@30..49 - 0: AWAIT_KW@30..36 "await" [] [Whitespace(" ")] - 1: USING_KW@36..42 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@42..49 - 0: JS_VARIABLE_DECLARATOR@42..49 - 0: JS_IDENTIFIER_BINDING@42..43 - 0: IDENT@42..43 "x" [] [] - 1: TS_TYPE_ANNOTATION@43..49 - 0: COLON@43..45 ":" [] [Whitespace(" ")] - 1: TS_NULL_LITERAL_TYPE@45..49 - 0: NULL_KW@45..49 "null" [] [] - 2: (empty) - 1: (empty) - 4: EOF@49..50 "" [Newline("\n")] [] --- -ts_declare_using.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ declare using x: null - │ ^^^^^ - 2 │ declare await using x: null - 3 │ - - i An explicit or implicit semicolon is expected here... - - > 1 │ declare using x: null - │ ^^^^^ - 2 │ declare await using x: null - 3 │ - - i ...Which is required to end this statement - - > 1 │ declare using x: null - │ ^^^^^^^^^^^^^ - 2 │ declare await using x: null - 3 │ - --- -ts_declare_using.ts:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - > 1 │ declare using x: null - │ ^ - 2 │ declare await using x: null - 3 │ - - i This variable needs to be initialized. - --- -ts_declare_using.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ declare using x: null - > 2 │ declare await using x: null - │ ^^^^^ - 3 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ declare using x: null - > 2 │ declare await using x: null - │ ^^^^^ - 3 │ - - i ...Which is required to end this statement - - 1 │ declare using x: null - > 2 │ declare await using x: null - │ ^^^^^^^^^^^^^ - 3 │ - --- -ts_declare_using.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - 1 │ declare using x: null - > 2 │ declare await using x: null - │ ^ - 3 │ - - i This variable needs to be initialized. - --- -declare using x: null -declare await using x: null diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.rast deleted file mode 100644 index 24a5299afee8..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.rast +++ /dev/null @@ -1,706 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@25..26 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@26..27 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..31 "foo" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")], - }, - ], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@40..41 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@41..43 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@43..49 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - ], - }, - R_PAREN@49..51 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@51..52 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@62..65 "CC" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@65..66 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@82..83 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@83..84 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..88 "foo" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@88..89 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@89..92 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@92..93 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@93..96 "arg" [] [], - }, - }, - ], - r_paren_token: R_PAREN@96..98 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")], - }, - ], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@107..108 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@108..110 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@110..116 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - ], - }, - R_PAREN@116..118 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@118..119 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@119..120 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@120..122 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@129..132 "CC" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@132..133 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@149..150 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@150..151 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@151..155 "foo" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@155..156 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@156..159 "dec" [] [], - }, - }, - operator_token: DOT@159..160 "." [] [], - member: JsName { - value_token: IDENT@160..166 "method" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@166..167 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@167..170 "arg" [] [], - }, - }, - ], - r_paren_token: R_PAREN@170..172 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")], - }, - ], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@181..182 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@182..184 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@184..190 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - ], - }, - R_PAREN@190..192 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@192..193 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@193..194 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@194..196 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@203..207 "CCC" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@207..208 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@224..225 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@225..226 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@226..230 "foo" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@230..231 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@231..234 "dec" [] [], - }, - }, - operator_token: DOT@234..235 "." [] [], - member: JsName { - value_token: IDENT@235..241 "method" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@241..242 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@242..245 "arg" [] [], - }, - }, - ], - r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")], - }, - ], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@264..265 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@265..267 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@267..273 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - ], - }, - R_PAREN@273..275 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@275..276 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@276..277 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@277..279 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@279..280 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..280 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..279 - 0: JS_CLASS_DECLARATION@0..55 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..53 - 0: JS_BOGUS_MEMBER@9..53 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..25 - 0: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@25..51 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_BOGUS@26..49 - 0: JS_BOGUS@26..49 - 0: JS_BOGUS@26..31 - 0: JS_DECORATOR@26..31 - 0: AT@26..27 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@27..31 - 0: JS_REFERENCE_IDENTIFIER@27..31 - 0: IDENT@27..31 "foo" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@31..40 - 0: TS_READONLY_MODIFIER@31..40 - 0: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@40..49 - 0: JS_DECORATOR_LIST@40..40 - 1: JS_IDENTIFIER_BINDING@40..41 - 0: IDENT@40..41 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@41..49 - 0: COLON@41..43 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@43..49 - 0: NUMBER_KW@43..49 "number" [] [] - 4: (empty) - 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@51..53 - 0: L_CURLY@51..52 "{" [] [] - 1: JS_DIRECTIVE_LIST@52..52 - 2: JS_STATEMENT_LIST@52..52 - 3: R_CURLY@52..53 "}" [] [] - 9: R_CURLY@53..55 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@55..122 - 0: JS_DECORATOR_LIST@55..55 - 1: (empty) - 2: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@62..65 - 0: IDENT@62..65 "CC" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@65..66 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@66..120 - 0: JS_BOGUS_MEMBER@66..120 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@66..66 - 1: JS_LITERAL_MEMBER_NAME@66..82 - 0: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@82..118 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_BOGUS@83..116 - 0: JS_BOGUS@83..116 - 0: JS_BOGUS@83..98 - 0: JS_DECORATOR@83..88 - 0: AT@83..84 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@84..88 - 0: JS_REFERENCE_IDENTIFIER@84..88 - 0: IDENT@84..88 "foo" [] [Whitespace(" ")] - 1: JS_DECORATOR@88..98 - 0: AT@88..89 "@" [] [] - 1: JS_CALL_EXPRESSION@89..98 - 0: JS_IDENTIFIER_EXPRESSION@89..92 - 0: JS_REFERENCE_IDENTIFIER@89..92 - 0: IDENT@89..92 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@92..98 - 0: L_PAREN@92..93 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@93..96 - 0: JS_IDENTIFIER_EXPRESSION@93..96 - 0: JS_REFERENCE_IDENTIFIER@93..96 - 0: IDENT@93..96 "arg" [] [] - 2: R_PAREN@96..98 ")" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@98..107 - 0: TS_READONLY_MODIFIER@98..107 - 0: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@107..116 - 0: JS_DECORATOR_LIST@107..107 - 1: JS_IDENTIFIER_BINDING@107..108 - 0: IDENT@107..108 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@108..116 - 0: COLON@108..110 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@110..116 - 0: NUMBER_KW@110..116 "number" [] [] - 4: (empty) - 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@118..120 - 0: L_CURLY@118..119 "{" [] [] - 1: JS_DIRECTIVE_LIST@119..119 - 2: JS_STATEMENT_LIST@119..119 - 3: R_CURLY@119..120 "}" [] [] - 9: R_CURLY@120..122 "}" [Newline("\n")] [] - 2: JS_CLASS_DECLARATION@122..196 - 0: JS_DECORATOR_LIST@122..122 - 1: (empty) - 2: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@129..132 - 0: IDENT@129..132 "CC" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@132..133 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@133..194 - 0: JS_BOGUS_MEMBER@133..194 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@133..133 - 1: JS_LITERAL_MEMBER_NAME@133..149 - 0: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@149..192 - 0: L_PAREN@149..150 "(" [] [] - 1: JS_BOGUS@150..190 - 0: JS_BOGUS@150..190 - 0: JS_BOGUS@150..172 - 0: JS_DECORATOR@150..155 - 0: AT@150..151 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@151..155 - 0: JS_REFERENCE_IDENTIFIER@151..155 - 0: IDENT@151..155 "foo" [] [Whitespace(" ")] - 1: JS_DECORATOR@155..172 - 0: AT@155..156 "@" [] [] - 1: JS_CALL_EXPRESSION@156..172 - 0: JS_STATIC_MEMBER_EXPRESSION@156..166 - 0: JS_IDENTIFIER_EXPRESSION@156..159 - 0: JS_REFERENCE_IDENTIFIER@156..159 - 0: IDENT@156..159 "dec" [] [] - 1: DOT@159..160 "." [] [] - 2: JS_NAME@160..166 - 0: IDENT@160..166 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@166..172 - 0: L_PAREN@166..167 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@167..170 - 0: JS_IDENTIFIER_EXPRESSION@167..170 - 0: JS_REFERENCE_IDENTIFIER@167..170 - 0: IDENT@167..170 "arg" [] [] - 2: R_PAREN@170..172 ")" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@172..181 - 0: TS_READONLY_MODIFIER@172..181 - 0: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@181..190 - 0: JS_DECORATOR_LIST@181..181 - 1: JS_IDENTIFIER_BINDING@181..182 - 0: IDENT@181..182 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@182..190 - 0: COLON@182..184 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@184..190 - 0: NUMBER_KW@184..190 "number" [] [] - 4: (empty) - 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@192..194 - 0: L_CURLY@192..193 "{" [] [] - 1: JS_DIRECTIVE_LIST@193..193 - 2: JS_STATEMENT_LIST@193..193 - 3: R_CURLY@193..194 "}" [] [] - 9: R_CURLY@194..196 "}" [Newline("\n")] [] - 3: JS_CLASS_DECLARATION@196..279 - 0: JS_DECORATOR_LIST@196..196 - 1: (empty) - 2: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@203..207 - 0: IDENT@203..207 "CCC" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@207..208 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@208..277 - 0: JS_BOGUS_MEMBER@208..277 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@208..208 - 1: JS_LITERAL_MEMBER_NAME@208..224 - 0: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@224..275 - 0: L_PAREN@224..225 "(" [] [] - 1: JS_BOGUS@225..273 - 0: JS_BOGUS@225..273 - 0: JS_BOGUS@225..247 - 0: JS_DECORATOR@225..230 - 0: AT@225..226 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@226..230 - 0: JS_REFERENCE_IDENTIFIER@226..230 - 0: IDENT@226..230 "foo" [] [Whitespace(" ")] - 1: JS_DECORATOR@230..247 - 0: AT@230..231 "@" [] [] - 1: JS_CALL_EXPRESSION@231..247 - 0: JS_STATIC_MEMBER_EXPRESSION@231..241 - 0: JS_IDENTIFIER_EXPRESSION@231..234 - 0: JS_REFERENCE_IDENTIFIER@231..234 - 0: IDENT@231..234 "dec" [] [] - 1: DOT@234..235 "." [] [] - 2: JS_NAME@235..241 - 0: IDENT@235..241 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@241..247 - 0: L_PAREN@241..242 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@242..245 - 0: JS_IDENTIFIER_EXPRESSION@242..245 - 0: JS_REFERENCE_IDENTIFIER@242..245 - 0: IDENT@242..245 "arg" [] [] - 2: R_PAREN@245..247 ")" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@247..264 - 0: TS_ACCESSIBILITY_MODIFIER@247..255 - 0: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@255..264 - 0: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@264..273 - 0: JS_DECORATOR_LIST@264..264 - 1: JS_IDENTIFIER_BINDING@264..265 - 0: IDENT@264..265 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@265..273 - 0: COLON@265..267 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@267..273 - 0: NUMBER_KW@267..273 "number" [] [] - 4: (empty) - 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@275..277 - 0: L_CURLY@275..276 "{" [] [] - 1: JS_DIRECTIVE_LIST@276..276 - 2: JS_STATEMENT_LIST@276..276 - 3: R_CURLY@276..277 "}" [] [] - 9: R_CURLY@277..279 "}" [Newline("\n")] [] - 4: EOF@279..280 "" [Newline("\n")] [] --- -ts_decorator_constructor.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class C { - > 2 │ constructor(@foo readonly x: number) {} - │ ^^^^ - 3 │ } - 4 │ class CC { - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_constructor.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 3 │ } - 4 │ class CC { - > 5 │ constructor(@foo @dec(arg) readonly x: number) {} - │ ^^^^^^^^^^^^^^ - 6 │ } - 7 │ class CC { - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_constructor.ts:8:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 6 │ } - 7 │ class CC { - > 8 │ constructor(@foo @dec.method(arg) readonly x: number) {} - │ ^^^^^^^^^^^^^^^^^^^^^ - 9 │ } - 10 │ class CCC { - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_constructor.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 9 │ } - 10 │ class CCC { - > 11 │ constructor(@foo @dec.method(arg) private readonly x: number) {} - │ ^^^^^^^^^^^^^^^^^^^^^ - 12 │ } - 13 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -class C { - constructor(@foo readonly x: number) {} -} -class CC { - constructor(@foo @dec(arg) readonly x: number) {} -} -class CC { - constructor(@foo @dec.method(arg) readonly x: number) {} -} -class CCC { - constructor(@foo @dec.method(arg) private readonly x: number) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.rast deleted file mode 100644 index e6270575e39d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.rast +++ /dev/null @@ -1,910 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..2 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@2..13 "method" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@14..15 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..19 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@19..20 "x" [] [], - }, - ], - }, - COMMA@20..22 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@22..28 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@28..30 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@30..31 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..35 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@35..41 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@41..43 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@43..52 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@52..54 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@54..55 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@55..56 "}" [] [], - }, - }, - missing separator, - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@56..67 "method" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@67..68 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@68..69 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@69..72 "dec" [] [], - }, - }, - operator_token: DOT@72..73 "." [] [], - member: JsName { - value_token: IDENT@73..75 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@75..76 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@78..79 "x" [] [], - }, - ], - }, - COMMA@79..81 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@81..87 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@87..89 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@89..90 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@90..93 "dec" [] [], - }, - }, - operator_token: DOT@93..94 "." [] [], - member: JsName { - value_token: IDENT@94..96 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@96..97 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@97..99 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@99..105 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@105..107 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@107..116 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@118..119 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@119..120 "}" [] [], - }, - }, - missing separator, - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@120..131 "method" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@131..132 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@132..133 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@133..136 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@136..137 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@137..139 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@139..140 "x" [] [], - }, - ], - }, - COMMA@140..142 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@142..148 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@148..150 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@150..151 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@151..154 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@154..155 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@155..157 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@157..163 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@163..165 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@165..174 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@174..176 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@176..177 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@177..178 "}" [] [], - }, - }, - missing separator, - JsSetterObjectMember { - set_token: SET_KW@178..187 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@187..190 "val" [] [], - }, - l_paren_token: L_PAREN@190..191 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@191..192 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@192..196 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@196..197 "x" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@197..199 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@199..200 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@200..201 "}" [] [], - }, - }, - missing separator, - JsSetterObjectMember { - set_token: SET_KW@201..210 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@210..213 "val" [] [], - }, - l_paren_token: L_PAREN@213..214 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@214..215 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@215..218 "dec" [] [], - }, - }, - operator_token: DOT@218..219 "." [] [], - member: JsName { - value_token: IDENT@219..221 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@221..222 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@222..224 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@224..225 "x" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@225..227 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@227..228 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@228..229 "}" [] [], - }, - }, - missing separator, - JsSetterObjectMember { - set_token: SET_KW@229..238 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@238..241 "val" [] [], - }, - l_paren_token: L_PAREN@241..242 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@242..243 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@243..246 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@246..247 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@247..249 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@249..250 "x" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@250..252 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@252..253 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@253..254 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@254..256 "}" [Newline("\n")] [], - }, - r_paren_token: R_PAREN@256..257 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@257..258 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..258 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..257 - 0: JS_EXPRESSION_STATEMENT@0..257 - 0: JS_PARENTHESIZED_EXPRESSION@0..257 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..256 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@2..254 - 0: JS_METHOD_OBJECT_MEMBER@2..56 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@2..13 - 0: IDENT@2..13 "method" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@13..54 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..52 - 0: JS_BOGUS_PARAMETER@14..20 - 0: JS_BOGUS@14..19 - 0: JS_DECORATOR@14..19 - 0: AT@14..15 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@15..19 - 0: JS_REFERENCE_IDENTIFIER@15..19 - 0: IDENT@15..19 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@19..20 - 0: IDENT@19..20 "x" [] [] - 1: COMMA@20..22 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@22..28 - 0: JS_DECORATOR_LIST@22..22 - 1: JS_IDENTIFIER_BINDING@22..28 - 0: IDENT@22..28 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@28..30 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@30..52 - 0: JS_BOGUS@30..35 - 0: JS_DECORATOR@30..35 - 0: AT@30..31 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@31..35 - 0: JS_REFERENCE_IDENTIFIER@31..35 - 0: IDENT@31..35 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@35..41 - 0: IDENT@35..41 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@41..52 - 0: EQ@41..43 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@43..52 - 0: JS_STRING_LITERAL@43..52 "'default'" [] [] - 2: R_PAREN@52..54 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@54..56 - 0: L_CURLY@54..55 "{" [] [] - 1: JS_DIRECTIVE_LIST@55..55 - 2: JS_STATEMENT_LIST@55..55 - 3: R_CURLY@55..56 "}" [] [] - 1: (empty) - 2: JS_METHOD_OBJECT_MEMBER@56..120 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@56..67 - 0: IDENT@56..67 "method" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@67..118 - 0: L_PAREN@67..68 "(" [] [] - 1: JS_PARAMETER_LIST@68..116 - 0: JS_BOGUS_PARAMETER@68..79 - 0: JS_BOGUS@68..78 - 0: JS_DECORATOR@68..78 - 0: AT@68..69 "@" [] [] - 1: JS_CALL_EXPRESSION@69..78 - 0: JS_STATIC_MEMBER_EXPRESSION@69..75 - 0: JS_IDENTIFIER_EXPRESSION@69..72 - 0: JS_REFERENCE_IDENTIFIER@69..72 - 0: IDENT@69..72 "dec" [] [] - 1: DOT@72..73 "." [] [] - 2: JS_NAME@73..75 - 0: IDENT@73..75 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@75..78 - 0: L_PAREN@75..76 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@76..76 - 2: R_PAREN@76..78 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@78..79 - 0: IDENT@78..79 "x" [] [] - 1: COMMA@79..81 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@81..87 - 0: JS_DECORATOR_LIST@81..81 - 1: JS_IDENTIFIER_BINDING@81..87 - 0: IDENT@81..87 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@87..89 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@89..116 - 0: JS_BOGUS@89..99 - 0: JS_DECORATOR@89..99 - 0: AT@89..90 "@" [] [] - 1: JS_CALL_EXPRESSION@90..99 - 0: JS_STATIC_MEMBER_EXPRESSION@90..96 - 0: JS_IDENTIFIER_EXPRESSION@90..93 - 0: JS_REFERENCE_IDENTIFIER@90..93 - 0: IDENT@90..93 "dec" [] [] - 1: DOT@93..94 "." [] [] - 2: JS_NAME@94..96 - 0: IDENT@94..96 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@96..99 - 0: L_PAREN@96..97 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@97..97 - 2: R_PAREN@97..99 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@99..105 - 0: IDENT@99..105 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@105..116 - 0: EQ@105..107 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@107..116 - 0: JS_STRING_LITERAL@107..116 "'default'" [] [] - 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@118..120 - 0: L_CURLY@118..119 "{" [] [] - 1: JS_DIRECTIVE_LIST@119..119 - 2: JS_STATEMENT_LIST@119..119 - 3: R_CURLY@119..120 "}" [] [] - 3: (empty) - 4: JS_METHOD_OBJECT_MEMBER@120..178 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@120..131 - 0: IDENT@120..131 "method" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@131..176 - 0: L_PAREN@131..132 "(" [] [] - 1: JS_PARAMETER_LIST@132..174 - 0: JS_BOGUS_PARAMETER@132..140 - 0: JS_BOGUS@132..139 - 0: JS_DECORATOR@132..139 - 0: AT@132..133 "@" [] [] - 1: JS_CALL_EXPRESSION@133..139 - 0: JS_IDENTIFIER_EXPRESSION@133..136 - 0: JS_REFERENCE_IDENTIFIER@133..136 - 0: IDENT@133..136 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@136..139 - 0: L_PAREN@136..137 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@137..137 - 2: R_PAREN@137..139 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@139..140 - 0: IDENT@139..140 "x" [] [] - 1: COMMA@140..142 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@142..148 - 0: JS_DECORATOR_LIST@142..142 - 1: JS_IDENTIFIER_BINDING@142..148 - 0: IDENT@142..148 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@148..150 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@150..174 - 0: JS_BOGUS@150..157 - 0: JS_DECORATOR@150..157 - 0: AT@150..151 "@" [] [] - 1: JS_CALL_EXPRESSION@151..157 - 0: JS_IDENTIFIER_EXPRESSION@151..154 - 0: JS_REFERENCE_IDENTIFIER@151..154 - 0: IDENT@151..154 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@154..157 - 0: L_PAREN@154..155 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@155..155 - 2: R_PAREN@155..157 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@157..163 - 0: IDENT@157..163 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@163..174 - 0: EQ@163..165 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@165..174 - 0: JS_STRING_LITERAL@165..174 "'default'" [] [] - 2: R_PAREN@174..176 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@176..178 - 0: L_CURLY@176..177 "{" [] [] - 1: JS_DIRECTIVE_LIST@177..177 - 2: JS_STATEMENT_LIST@177..177 - 3: R_CURLY@177..178 "}" [] [] - 5: (empty) - 6: JS_SETTER_OBJECT_MEMBER@178..201 - 0: SET_KW@178..187 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@187..190 - 0: IDENT@187..190 "val" [] [] - 2: L_PAREN@190..191 "(" [] [] - 3: JS_BOGUS_PARAMETER@191..197 - 0: JS_BOGUS@191..196 - 0: JS_DECORATOR@191..196 - 0: AT@191..192 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@192..196 - 0: JS_REFERENCE_IDENTIFIER@192..196 - 0: IDENT@192..196 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@196..197 - 0: IDENT@196..197 "x" [] [] - 4: (empty) - 5: R_PAREN@197..199 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@199..201 - 0: L_CURLY@199..200 "{" [] [] - 1: JS_DIRECTIVE_LIST@200..200 - 2: JS_STATEMENT_LIST@200..200 - 3: R_CURLY@200..201 "}" [] [] - 7: (empty) - 8: JS_SETTER_OBJECT_MEMBER@201..229 - 0: SET_KW@201..210 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@210..213 - 0: IDENT@210..213 "val" [] [] - 2: L_PAREN@213..214 "(" [] [] - 3: JS_BOGUS_PARAMETER@214..225 - 0: JS_BOGUS@214..224 - 0: JS_DECORATOR@214..224 - 0: AT@214..215 "@" [] [] - 1: JS_CALL_EXPRESSION@215..224 - 0: JS_STATIC_MEMBER_EXPRESSION@215..221 - 0: JS_IDENTIFIER_EXPRESSION@215..218 - 0: JS_REFERENCE_IDENTIFIER@215..218 - 0: IDENT@215..218 "dec" [] [] - 1: DOT@218..219 "." [] [] - 2: JS_NAME@219..221 - 0: IDENT@219..221 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@221..224 - 0: L_PAREN@221..222 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@222..222 - 2: R_PAREN@222..224 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@224..225 - 0: IDENT@224..225 "x" [] [] - 4: (empty) - 5: R_PAREN@225..227 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@227..229 - 0: L_CURLY@227..228 "{" [] [] - 1: JS_DIRECTIVE_LIST@228..228 - 2: JS_STATEMENT_LIST@228..228 - 3: R_CURLY@228..229 "}" [] [] - 9: (empty) - 10: JS_SETTER_OBJECT_MEMBER@229..254 - 0: SET_KW@229..238 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@238..241 - 0: IDENT@238..241 "val" [] [] - 2: L_PAREN@241..242 "(" [] [] - 3: JS_BOGUS_PARAMETER@242..250 - 0: JS_BOGUS@242..249 - 0: JS_DECORATOR@242..249 - 0: AT@242..243 "@" [] [] - 1: JS_CALL_EXPRESSION@243..249 - 0: JS_IDENTIFIER_EXPRESSION@243..246 - 0: JS_REFERENCE_IDENTIFIER@243..246 - 0: IDENT@243..246 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@246..249 - 0: L_PAREN@246..247 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@247..247 - 2: R_PAREN@247..249 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@249..250 - 0: IDENT@249..250 "x" [] [] - 4: (empty) - 5: R_PAREN@250..252 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@252..254 - 0: L_CURLY@252..253 "{" [] [] - 1: JS_DIRECTIVE_LIST@253..253 - 2: JS_STATEMENT_LIST@253..253 - 3: R_CURLY@253..254 "}" [] [] - 2: R_CURLY@254..256 "}" [Newline("\n")] [] - 2: R_PAREN@256..257 ")" [] [] - 1: (empty) - 4: EOF@257..258 "" [Newline("\n")] [] --- -ts_decorator_object.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ ({ - > 2 │ method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ ({ - > 2 │ method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `method` - - 1 │ ({ - 2 │ method(@dec x, second, @dec third = 'default') {} - > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^ - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ set val(@dec x) {} - - i Remove method - --- -ts_decorator_object.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ ({ - 2 │ method(@dec x, second, @dec third = 'default') {} - > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ set val(@dec x) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ ({ - 2 │ method(@dec x, second, @dec third = 'default') {} - > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ set val(@dec x) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `method` - - 2 │ method(@dec x, second, @dec third = 'default') {} - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ set val(@dec x) {} - 6 │ set val(@dec.fn() x) {} - - i Remove method - --- -ts_decorator_object.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ method(@dec x, second, @dec third = 'default') {} - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ set val(@dec x) {} - 6 │ set val(@dec.fn() x) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ method(@dec x, second, @dec third = 'default') {} - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ set val(@dec x) {} - 6 │ set val(@dec.fn() x) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `set` - - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - > 5 │ set val(@dec x) {} - │ ^^^ - 6 │ set val(@dec.fn() x) {} - 7 │ set val(@dec() x) {} - - i Remove set - --- -ts_decorator_object.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - > 5 │ set val(@dec x) {} - │ ^^^^ - 6 │ set val(@dec.fn() x) {} - 7 │ set val(@dec() x) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `set` - - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ set val(@dec x) {} - > 6 │ set val(@dec.fn() x) {} - │ ^^^ - 7 │ set val(@dec() x) {} - 8 │ }) - - i Remove set - --- -ts_decorator_object.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ set val(@dec x) {} - > 6 │ set val(@dec.fn() x) {} - │ ^^^^^^^^^ - 7 │ set val(@dec() x) {} - 8 │ }) - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_object.ts:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `set` - - 5 │ set val(@dec x) {} - 6 │ set val(@dec.fn() x) {} - > 7 │ set val(@dec() x) {} - │ ^^^ - 8 │ }) - 9 │ - - i Remove set - --- -ts_decorator_object.ts:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ set val(@dec x) {} - 6 │ set val(@dec.fn() x) {} - > 7 │ set val(@dec() x) {} - │ ^^^^^^ - 8 │ }) - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -({ - method(@dec x, second, @dec third = 'default') {} - method(@dec.fn() x, second, @dec.fn() third = 'default') {} - method(@dec() x, second, @dec() third = 'default') {} - set val(@dec x) {} - set val(@dec.fn() x) {} - set val(@dec() x) {} -}) diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.rast deleted file mode 100644 index 007d8923b068..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.rast +++ /dev/null @@ -1,1136 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@15..17 "a" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@17..18 "{" [] [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@30..36 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@37..38 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..42 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@42..43 "x" [] [], - }, - ], - }, - COMMA@43..45 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@45..51 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@51..53 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@53..54 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@54..58 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@58..64 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@64..66 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@66..75 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@77..78 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@78..79 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - FUNCTION_KW@79..91 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@91..97 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@97..98 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@98..99 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@99..102 "dec" [] [], - }, - }, - operator_token: DOT@102..103 "." [] [], - member: JsName { - value_token: IDENT@103..105 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@105..106 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@106..108 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@108..109 "x" [] [], - }, - ], - }, - COMMA@109..111 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@111..117 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@117..119 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@119..120 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@120..123 "dec" [] [], - }, - }, - operator_token: DOT@123..124 "." [] [], - member: JsName { - value_token: IDENT@124..126 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@126..127 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@129..135 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@135..137 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@137..146 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@146..148 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@148..149 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@149..150 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - FUNCTION_KW@150..162 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@162..168 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@168..169 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@169..170 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@170..173 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@173..174 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@174..176 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@176..177 "x" [] [], - }, - ], - }, - COMMA@177..179 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@179..185 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@185..187 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@187..188 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@188..191 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@191..192 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@194..200 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@200..202 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@202..211 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@211..213 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@213..214 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@214..215 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@215..217 "}" [Newline("\n")] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@217..226 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@226..235 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@235..241 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@241..242 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@242..243 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@243..247 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@247..248 "x" [] [], - }, - ], - }, - COMMA@248..250 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@250..256 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@256..258 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@258..259 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@259..263 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@263..269 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@269..271 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@271..280 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@280..281 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@281..290 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@290..299 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@299..305 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@305..306 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@306..307 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@307..310 "dec" [] [], - }, - }, - operator_token: DOT@310..311 "." [] [], - member: JsName { - value_token: IDENT@311..313 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@313..314 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@314..316 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@316..317 "x" [] [], - }, - ], - }, - COMMA@317..319 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@319..325 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@325..327 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@327..328 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@328..331 "dec" [] [], - }, - }, - operator_token: DOT@331..332 "." [] [], - member: JsName { - value_token: IDENT@332..334 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@334..335 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@335..337 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@337..343 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@343..345 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@345..354 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@354..355 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@355..364 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@364..373 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@373..379 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@379..380 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@380..381 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@381..384 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@384..385 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@385..387 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@387..388 "x" [] [], - }, - ], - }, - COMMA@388..390 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@390..396 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@396..398 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@398..399 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@399..402 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@402..403 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@403..405 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@405..411 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@411..413 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@413..422 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@422..423 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@423..424 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..424 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..423 - 0: TS_DECLARE_STATEMENT@0..217 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..217 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "a" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@17..217 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_MODULE_ITEM_LIST@18..215 - 0: JS_BOGUS_STATEMENT@18..79 - 0: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@30..36 - 0: IDENT@30..36 "method" [] [] - 2: JS_PARAMETERS@36..77 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_PARAMETER_LIST@37..75 - 0: JS_BOGUS_PARAMETER@37..43 - 0: JS_BOGUS@37..42 - 0: JS_DECORATOR@37..42 - 0: AT@37..38 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..42 - 0: JS_REFERENCE_IDENTIFIER@38..42 - 0: IDENT@38..42 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@42..43 - 0: IDENT@42..43 "x" [] [] - 1: COMMA@43..45 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@45..51 - 0: JS_DECORATOR_LIST@45..45 - 1: JS_IDENTIFIER_BINDING@45..51 - 0: IDENT@45..51 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@51..53 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@53..75 - 0: JS_BOGUS@53..58 - 0: JS_DECORATOR@53..58 - 0: AT@53..54 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@54..58 - 0: JS_REFERENCE_IDENTIFIER@54..58 - 0: IDENT@54..58 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@58..64 - 0: IDENT@58..64 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@64..75 - 0: EQ@64..66 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@66..75 - 0: JS_STRING_LITERAL@66..75 "'default'" [] [] - 2: R_PAREN@75..77 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@77..79 - 0: L_CURLY@77..78 "{" [] [] - 1: JS_DIRECTIVE_LIST@78..78 - 2: JS_STATEMENT_LIST@78..78 - 3: R_CURLY@78..79 "}" [] [] - 1: JS_BOGUS_STATEMENT@79..150 - 0: FUNCTION_KW@79..91 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@91..97 - 0: IDENT@91..97 "method" [] [] - 2: JS_PARAMETERS@97..148 - 0: L_PAREN@97..98 "(" [] [] - 1: JS_PARAMETER_LIST@98..146 - 0: JS_BOGUS_PARAMETER@98..109 - 0: JS_BOGUS@98..108 - 0: JS_DECORATOR@98..108 - 0: AT@98..99 "@" [] [] - 1: JS_CALL_EXPRESSION@99..108 - 0: JS_STATIC_MEMBER_EXPRESSION@99..105 - 0: JS_IDENTIFIER_EXPRESSION@99..102 - 0: JS_REFERENCE_IDENTIFIER@99..102 - 0: IDENT@99..102 "dec" [] [] - 1: DOT@102..103 "." [] [] - 2: JS_NAME@103..105 - 0: IDENT@103..105 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@105..108 - 0: L_PAREN@105..106 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@106..106 - 2: R_PAREN@106..108 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@108..109 - 0: IDENT@108..109 "x" [] [] - 1: COMMA@109..111 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@111..117 - 0: JS_DECORATOR_LIST@111..111 - 1: JS_IDENTIFIER_BINDING@111..117 - 0: IDENT@111..117 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@117..119 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@119..146 - 0: JS_BOGUS@119..129 - 0: JS_DECORATOR@119..129 - 0: AT@119..120 "@" [] [] - 1: JS_CALL_EXPRESSION@120..129 - 0: JS_STATIC_MEMBER_EXPRESSION@120..126 - 0: JS_IDENTIFIER_EXPRESSION@120..123 - 0: JS_REFERENCE_IDENTIFIER@120..123 - 0: IDENT@120..123 "dec" [] [] - 1: DOT@123..124 "." [] [] - 2: JS_NAME@124..126 - 0: IDENT@124..126 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@126..129 - 0: L_PAREN@126..127 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@127..127 - 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@129..135 - 0: IDENT@129..135 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@135..146 - 0: EQ@135..137 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@137..146 - 0: JS_STRING_LITERAL@137..146 "'default'" [] [] - 2: R_PAREN@146..148 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@148..150 - 0: L_CURLY@148..149 "{" [] [] - 1: JS_DIRECTIVE_LIST@149..149 - 2: JS_STATEMENT_LIST@149..149 - 3: R_CURLY@149..150 "}" [] [] - 2: JS_BOGUS_STATEMENT@150..215 - 0: FUNCTION_KW@150..162 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@162..168 - 0: IDENT@162..168 "method" [] [] - 2: JS_PARAMETERS@168..213 - 0: L_PAREN@168..169 "(" [] [] - 1: JS_PARAMETER_LIST@169..211 - 0: JS_BOGUS_PARAMETER@169..177 - 0: JS_BOGUS@169..176 - 0: JS_DECORATOR@169..176 - 0: AT@169..170 "@" [] [] - 1: JS_CALL_EXPRESSION@170..176 - 0: JS_IDENTIFIER_EXPRESSION@170..173 - 0: JS_REFERENCE_IDENTIFIER@170..173 - 0: IDENT@170..173 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@173..176 - 0: L_PAREN@173..174 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@174..174 - 2: R_PAREN@174..176 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@176..177 - 0: IDENT@176..177 "x" [] [] - 1: COMMA@177..179 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@179..185 - 0: JS_DECORATOR_LIST@179..179 - 1: JS_IDENTIFIER_BINDING@179..185 - 0: IDENT@179..185 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@185..187 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@187..211 - 0: JS_BOGUS@187..194 - 0: JS_DECORATOR@187..194 - 0: AT@187..188 "@" [] [] - 1: JS_CALL_EXPRESSION@188..194 - 0: JS_IDENTIFIER_EXPRESSION@188..191 - 0: JS_REFERENCE_IDENTIFIER@188..191 - 0: IDENT@188..191 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@191..194 - 0: L_PAREN@191..192 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@192..192 - 2: R_PAREN@192..194 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@194..200 - 0: IDENT@194..200 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@200..211 - 0: EQ@200..202 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@202..211 - 0: JS_STRING_LITERAL@202..211 "'default'" [] [] - 2: R_PAREN@211..213 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@213..215 - 0: L_CURLY@213..214 "{" [] [] - 1: JS_DIRECTIVE_LIST@214..214 - 2: JS_STATEMENT_LIST@214..214 - 3: R_CURLY@214..215 "}" [] [] - 2: R_CURLY@215..217 "}" [Newline("\n")] [] - 1: TS_DECLARE_STATEMENT@217..281 - 0: DECLARE_KW@217..226 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@226..281 - 0: (empty) - 1: FUNCTION_KW@226..235 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@235..241 - 0: IDENT@235..241 "method" [] [] - 3: (empty) - 4: JS_PARAMETERS@241..281 - 0: L_PAREN@241..242 "(" [] [] - 1: JS_PARAMETER_LIST@242..280 - 0: JS_BOGUS_PARAMETER@242..248 - 0: JS_BOGUS@242..247 - 0: JS_DECORATOR@242..247 - 0: AT@242..243 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@243..247 - 0: JS_REFERENCE_IDENTIFIER@243..247 - 0: IDENT@243..247 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@247..248 - 0: IDENT@247..248 "x" [] [] - 1: COMMA@248..250 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@250..256 - 0: JS_DECORATOR_LIST@250..250 - 1: JS_IDENTIFIER_BINDING@250..256 - 0: IDENT@250..256 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@256..258 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@258..280 - 0: JS_BOGUS@258..263 - 0: JS_DECORATOR@258..263 - 0: AT@258..259 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@259..263 - 0: JS_REFERENCE_IDENTIFIER@259..263 - 0: IDENT@259..263 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@263..269 - 0: IDENT@263..269 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@269..280 - 0: EQ@269..271 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@271..280 - 0: JS_STRING_LITERAL@271..280 "'default'" [] [] - 2: R_PAREN@280..281 ")" [] [] - 5: (empty) - 6: (empty) - 2: TS_DECLARE_STATEMENT@281..355 - 0: DECLARE_KW@281..290 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@290..355 - 0: (empty) - 1: FUNCTION_KW@290..299 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@299..305 - 0: IDENT@299..305 "method" [] [] - 3: (empty) - 4: JS_PARAMETERS@305..355 - 0: L_PAREN@305..306 "(" [] [] - 1: JS_PARAMETER_LIST@306..354 - 0: JS_BOGUS_PARAMETER@306..317 - 0: JS_BOGUS@306..316 - 0: JS_DECORATOR@306..316 - 0: AT@306..307 "@" [] [] - 1: JS_CALL_EXPRESSION@307..316 - 0: JS_STATIC_MEMBER_EXPRESSION@307..313 - 0: JS_IDENTIFIER_EXPRESSION@307..310 - 0: JS_REFERENCE_IDENTIFIER@307..310 - 0: IDENT@307..310 "dec" [] [] - 1: DOT@310..311 "." [] [] - 2: JS_NAME@311..313 - 0: IDENT@311..313 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@313..316 - 0: L_PAREN@313..314 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@314..314 - 2: R_PAREN@314..316 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@316..317 - 0: IDENT@316..317 "x" [] [] - 1: COMMA@317..319 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@319..325 - 0: JS_DECORATOR_LIST@319..319 - 1: JS_IDENTIFIER_BINDING@319..325 - 0: IDENT@319..325 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@325..327 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@327..354 - 0: JS_BOGUS@327..337 - 0: JS_DECORATOR@327..337 - 0: AT@327..328 "@" [] [] - 1: JS_CALL_EXPRESSION@328..337 - 0: JS_STATIC_MEMBER_EXPRESSION@328..334 - 0: JS_IDENTIFIER_EXPRESSION@328..331 - 0: JS_REFERENCE_IDENTIFIER@328..331 - 0: IDENT@328..331 "dec" [] [] - 1: DOT@331..332 "." [] [] - 2: JS_NAME@332..334 - 0: IDENT@332..334 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@334..337 - 0: L_PAREN@334..335 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@335..335 - 2: R_PAREN@335..337 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@337..343 - 0: IDENT@337..343 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@343..354 - 0: EQ@343..345 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@345..354 - 0: JS_STRING_LITERAL@345..354 "'default'" [] [] - 2: R_PAREN@354..355 ")" [] [] - 5: (empty) - 6: (empty) - 3: TS_DECLARE_STATEMENT@355..423 - 0: DECLARE_KW@355..364 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@364..423 - 0: (empty) - 1: FUNCTION_KW@364..373 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@373..379 - 0: IDENT@373..379 "method" [] [] - 3: (empty) - 4: JS_PARAMETERS@379..423 - 0: L_PAREN@379..380 "(" [] [] - 1: JS_PARAMETER_LIST@380..422 - 0: JS_BOGUS_PARAMETER@380..388 - 0: JS_BOGUS@380..387 - 0: JS_DECORATOR@380..387 - 0: AT@380..381 "@" [] [] - 1: JS_CALL_EXPRESSION@381..387 - 0: JS_IDENTIFIER_EXPRESSION@381..384 - 0: JS_REFERENCE_IDENTIFIER@381..384 - 0: IDENT@381..384 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@384..387 - 0: L_PAREN@384..385 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@385..385 - 2: R_PAREN@385..387 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@387..388 - 0: IDENT@387..388 "x" [] [] - 1: COMMA@388..390 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@390..396 - 0: JS_DECORATOR_LIST@390..390 - 1: JS_IDENTIFIER_BINDING@390..396 - 0: IDENT@390..396 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@396..398 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@398..422 - 0: JS_BOGUS@398..405 - 0: JS_DECORATOR@398..405 - 0: AT@398..399 "@" [] [] - 1: JS_CALL_EXPRESSION@399..405 - 0: JS_IDENTIFIER_EXPRESSION@399..402 - 0: JS_REFERENCE_IDENTIFIER@399..402 - 0: IDENT@399..402 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@402..405 - 0: L_PAREN@402..403 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@403..403 - 2: R_PAREN@403..405 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@405..411 - 0: IDENT@405..411 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@411..422 - 0: EQ@411..413 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@413..422 - 0: JS_STRING_LITERAL@413..422 "'default'" [] [] - 2: R_PAREN@422..423 ")" [] [] - 5: (empty) - 6: (empty) - 4: EOF@423..424 "" [Newline("\n")] [] --- -ts_decorator_on_ambient_function.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ declare module a { - > 2 │ function method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:2:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ declare module a { - > 2 │ function method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:2:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A 'declare' function cannot have a function body - - 1 │ declare module a { - > 2 │ function method(@dec x, second, @dec third = 'default') {} - │ ^^ - 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - - i remove this body - --- -ts_decorator_on_ambient_function.ts:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ declare module a { - 2 │ function method(@dec x, second, @dec third = 'default') {} - > 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - 5 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:3:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ declare module a { - 2 │ function method(@dec x, second, @dec third = 'default') {} - > 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - 5 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:3:69 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A 'declare' function cannot have a function body - - 1 │ declare module a { - 2 │ function method(@dec x, second, @dec third = 'default') {} - > 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^ - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - 5 │ } - - i remove this body - --- -ts_decorator_on_ambient_function.ts:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ function method(@dec x, second, @dec third = 'default') {} - 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ function method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ } - 6 │ declare function method(@dec x, second, @dec third = 'default') - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:4:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ function method(@dec x, second, @dec third = 'default') {} - 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ function method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ } - 6 │ declare function method(@dec x, second, @dec third = 'default') - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:4:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A 'declare' function cannot have a function body - - 2 │ function method(@dec x, second, @dec third = 'default') {} - 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ function method(@dec() x, second, @dec() third = 'default') {} - │ ^^ - 5 │ } - 6 │ declare function method(@dec x, second, @dec third = 'default') - - i remove this body - --- -ts_decorator_on_ambient_function.ts:6:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - 5 │ } - > 6 │ declare function method(@dec x, second, @dec third = 'default') - │ ^^^^ - 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') - 8 │ declare function method(@dec() x, second, @dec() third = 'default') - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:6:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ function method(@dec() x, second, @dec() third = 'default') {} - 5 │ } - > 6 │ declare function method(@dec x, second, @dec third = 'default') - │ ^^^^ - 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') - 8 │ declare function method(@dec() x, second, @dec() third = 'default') - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:7:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ } - 6 │ declare function method(@dec x, second, @dec third = 'default') - > 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') - │ ^^^^^^^^^ - 8 │ declare function method(@dec() x, second, @dec() third = 'default') - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:7:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ } - 6 │ declare function method(@dec x, second, @dec third = 'default') - > 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') - │ ^^^^^^^^^ - 8 │ declare function method(@dec() x, second, @dec() third = 'default') - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:8:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 6 │ declare function method(@dec x, second, @dec third = 'default') - 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') - > 8 │ declare function method(@dec() x, second, @dec() third = 'default') - │ ^^^^^^ - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_ambient_function.ts:8:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 6 │ declare function method(@dec x, second, @dec third = 'default') - 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') - > 8 │ declare function method(@dec() x, second, @dec() third = 'default') - │ ^^^^^^ - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -declare module a { - function method(@dec x, second, @dec third = 'default') {} - function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - function method(@dec() x, second, @dec() third = 'default') {} -} -declare function method(@dec x, second, @dec third = 'default') -declare function method(@dec.fn() x, second, @dec.fn() third = 'default') -declare function method(@dec() x, second, @dec() third = 'default') diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast deleted file mode 100644 index a55a1cb86e62..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast +++ /dev/null @@ -1,623 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..13 "method" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@13..15 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@15..16 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@16..17 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..21 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@21..22 "x" [] [], - }, - ], - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..30 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@32..33 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..37 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@37..43 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@43..45 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@45..54 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@56..59 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@59..60 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@61..62 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@62..69 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@69..76 "method" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@78..79 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@79..80 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@80..83 "dec" [] [], - }, - }, - operator_token: DOT@83..84 "." [] [], - member: JsName { - value_token: IDENT@84..86 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@86..87 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@87..89 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@89..90 "x" [] [], - }, - ], - }, - COMMA@90..92 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@92..98 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@98..100 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@100..101 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@101..104 "dec" [] [], - }, - }, - operator_token: DOT@104..105 "." [] [], - member: JsName { - value_token: IDENT@105..107 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@107..108 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@110..116 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@116..118 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@118..127 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@132..133 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@133..134 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@134..135 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@135..142 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@142..149 "method" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@149..151 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@151..152 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@152..153 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@153..156 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@156..157 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@157..159 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@159..160 "x" [] [], - }, - ], - }, - COMMA@160..162 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@162..168 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@168..170 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@170..171 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@171..174 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@174..175 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@175..177 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@177..183 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@183..185 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@185..194 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@194..196 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@196..199 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@199..200 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@200..201 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@201..202 ";" [] [], - }, - ], - eof_token: EOF@202..203 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..203 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..202 - 0: JS_VARIABLE_STATEMENT@0..62 - 0: JS_VARIABLE_DECLARATION@0..61 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..61 - 0: JS_VARIABLE_DECLARATOR@6..61 - 0: JS_IDENTIFIER_BINDING@6..13 - 0: IDENT@6..13 "method" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@13..61 - 0: EQ@13..15 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@15..61 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@15..56 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_PARAMETER_LIST@16..54 - 0: JS_BOGUS_PARAMETER@16..22 - 0: JS_BOGUS@16..21 - 0: JS_DECORATOR@16..21 - 0: AT@16..17 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@17..21 - 0: JS_REFERENCE_IDENTIFIER@17..21 - 0: IDENT@17..21 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "x" [] [] - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@24..30 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..30 - 0: IDENT@24..30 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@30..32 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@32..54 - 0: JS_BOGUS@32..37 - 0: JS_DECORATOR@32..37 - 0: AT@32..33 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@33..37 - 0: JS_REFERENCE_IDENTIFIER@33..37 - 0: IDENT@33..37 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@37..43 - 0: IDENT@37..43 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@43..54 - 0: EQ@43..45 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@45..54 - 0: JS_STRING_LITERAL@45..54 "'default'" [] [] - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@56..59 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@59..61 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_DIRECTIVE_LIST@60..60 - 2: JS_STATEMENT_LIST@60..60 - 3: R_CURLY@60..61 "}" [] [] - 1: SEMICOLON@61..62 ";" [] [] - 1: JS_VARIABLE_STATEMENT@62..135 - 0: JS_VARIABLE_DECLARATION@62..134 - 0: (empty) - 1: CONST_KW@62..69 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@69..134 - 0: JS_VARIABLE_DECLARATOR@69..134 - 0: JS_IDENTIFIER_BINDING@69..76 - 0: IDENT@69..76 "method" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@76..134 - 0: EQ@76..78 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@78..134 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@78..129 - 0: L_PAREN@78..79 "(" [] [] - 1: JS_PARAMETER_LIST@79..127 - 0: JS_BOGUS_PARAMETER@79..90 - 0: JS_BOGUS@79..89 - 0: JS_DECORATOR@79..89 - 0: AT@79..80 "@" [] [] - 1: JS_CALL_EXPRESSION@80..89 - 0: JS_STATIC_MEMBER_EXPRESSION@80..86 - 0: JS_IDENTIFIER_EXPRESSION@80..83 - 0: JS_REFERENCE_IDENTIFIER@80..83 - 0: IDENT@80..83 "dec" [] [] - 1: DOT@83..84 "." [] [] - 2: JS_NAME@84..86 - 0: IDENT@84..86 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@86..89 - 0: L_PAREN@86..87 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@87..87 - 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@89..90 - 0: IDENT@89..90 "x" [] [] - 1: COMMA@90..92 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@92..98 - 0: JS_DECORATOR_LIST@92..92 - 1: JS_IDENTIFIER_BINDING@92..98 - 0: IDENT@92..98 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@98..100 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@100..127 - 0: JS_BOGUS@100..110 - 0: JS_DECORATOR@100..110 - 0: AT@100..101 "@" [] [] - 1: JS_CALL_EXPRESSION@101..110 - 0: JS_STATIC_MEMBER_EXPRESSION@101..107 - 0: JS_IDENTIFIER_EXPRESSION@101..104 - 0: JS_REFERENCE_IDENTIFIER@101..104 - 0: IDENT@101..104 "dec" [] [] - 1: DOT@104..105 "." [] [] - 2: JS_NAME@105..107 - 0: IDENT@105..107 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@107..110 - 0: L_PAREN@107..108 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@108..108 - 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@110..116 - 0: IDENT@110..116 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@116..127 - 0: EQ@116..118 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@118..127 - 0: JS_STRING_LITERAL@118..127 "'default'" [] [] - 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@132..134 - 0: L_CURLY@132..133 "{" [] [] - 1: JS_DIRECTIVE_LIST@133..133 - 2: JS_STATEMENT_LIST@133..133 - 3: R_CURLY@133..134 "}" [] [] - 1: SEMICOLON@134..135 ";" [] [] - 2: JS_VARIABLE_STATEMENT@135..202 - 0: JS_VARIABLE_DECLARATION@135..201 - 0: (empty) - 1: CONST_KW@135..142 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@142..201 - 0: JS_VARIABLE_DECLARATOR@142..201 - 0: JS_IDENTIFIER_BINDING@142..149 - 0: IDENT@142..149 "method" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@149..201 - 0: EQ@149..151 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@151..201 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@151..196 - 0: L_PAREN@151..152 "(" [] [] - 1: JS_PARAMETER_LIST@152..194 - 0: JS_BOGUS_PARAMETER@152..160 - 0: JS_BOGUS@152..159 - 0: JS_DECORATOR@152..159 - 0: AT@152..153 "@" [] [] - 1: JS_CALL_EXPRESSION@153..159 - 0: JS_IDENTIFIER_EXPRESSION@153..156 - 0: JS_REFERENCE_IDENTIFIER@153..156 - 0: IDENT@153..156 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@156..159 - 0: L_PAREN@156..157 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@157..157 - 2: R_PAREN@157..159 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@159..160 - 0: IDENT@159..160 "x" [] [] - 1: COMMA@160..162 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@162..168 - 0: JS_DECORATOR_LIST@162..162 - 1: JS_IDENTIFIER_BINDING@162..168 - 0: IDENT@162..168 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@168..170 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@170..194 - 0: JS_BOGUS@170..177 - 0: JS_DECORATOR@170..177 - 0: AT@170..171 "@" [] [] - 1: JS_CALL_EXPRESSION@171..177 - 0: JS_IDENTIFIER_EXPRESSION@171..174 - 0: JS_REFERENCE_IDENTIFIER@171..174 - 0: IDENT@171..174 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@174..177 - 0: L_PAREN@174..175 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@175..175 - 2: R_PAREN@175..177 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@177..183 - 0: IDENT@177..183 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@183..194 - 0: EQ@183..185 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@185..194 - 0: JS_STRING_LITERAL@185..194 "'default'" [] [] - 2: R_PAREN@194..196 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@196..199 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@199..201 - 0: L_CURLY@199..200 "{" [] [] - 1: JS_DIRECTIVE_LIST@200..200 - 2: JS_STATEMENT_LIST@200..200 - 3: R_CURLY@200..201 "}" [] [] - 1: SEMICOLON@201..202 ";" [] [] - 4: EOF@202..203 "" [Newline("\n")] [] --- -ts_decorator_on_arrow_function.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ const method = (@dec x, second, @dec third = 'default') => {}; - │ ^^^^ - 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; - 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_arrow_function.ts:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ const method = (@dec x, second, @dec third = 'default') => {}; - │ ^^^^ - 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; - 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_arrow_function.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const method = (@dec x, second, @dec third = 'default') => {}; - > 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; - │ ^^^^^^^^^ - 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_arrow_function.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const method = (@dec x, second, @dec third = 'default') => {}; - > 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; - │ ^^^^^^^^^ - 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_arrow_function.ts:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const method = (@dec x, second, @dec third = 'default') => {}; - 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; - > 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_arrow_function.ts:3:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const method = (@dec x, second, @dec third = 'default') => {}; - 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; - > 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -const method = (@dec x, second, @dec third = 'default') => {}; -const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; -const method = (@dec() x, second, @dec() third = 'default') => {}; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.rast deleted file mode 100644 index e013a5f71cb1..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.rast +++ /dev/null @@ -1,1189 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@21..22 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@22..26 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@26..27 "x" [] [], - }, - ], - }, - COMMA@27..29 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@29..35 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@35..37 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@37..38 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..42 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@42..48 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@48..50 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@50..59 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@61..62 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@74..75 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@75..76 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@76..79 "dec" [] [], - }, - }, - operator_token: DOT@79..80 "." [] [], - member: JsName { - value_token: IDENT@80..82 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@82..83 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@85..86 "x" [] [], - }, - ], - }, - COMMA@86..88 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@88..94 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@94..96 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@96..97 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@97..100 "dec" [] [], - }, - }, - operator_token: DOT@100..101 "." [] [], - member: JsName { - value_token: IDENT@101..103 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@103..104 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@104..106 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@106..112 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@112..114 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@114..123 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@123..125 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@125..126 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@126..127 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@138..139 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@139..140 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@140..143 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@143..144 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@144..146 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@146..147 "x" [] [], - }, - ], - }, - COMMA@147..149 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@149..155 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@155..157 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@157..158 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@158..161 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@161..162 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@162..164 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@164..170 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@170..172 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@172..181 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@183..184 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@184..185 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@197..203 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@203..204 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@204..205 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@205..209 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@209..210 "x" [] [], - }, - ], - }, - COMMA@210..212 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@212..218 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@218..220 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@220..221 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@221..225 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@225..231 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@231..233 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@233..242 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@242..244 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@244..245 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@245..246 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@258..264 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@264..265 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@265..266 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@266..269 "dec" [] [], - }, - }, - operator_token: DOT@269..270 "." [] [], - member: JsName { - value_token: IDENT@270..272 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@272..273 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@273..275 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@275..276 "x" [] [], - }, - ], - }, - COMMA@276..278 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@278..284 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@284..286 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@286..287 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@287..290 "dec" [] [], - }, - }, - operator_token: DOT@290..291 "." [] [], - member: JsName { - value_token: IDENT@291..293 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@293..294 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@294..296 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@296..302 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@302..304 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@304..313 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@313..315 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@315..316 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@316..317 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@329..335 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@335..336 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@336..337 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@337..340 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@340..341 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@341..343 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@343..344 "x" [] [], - }, - ], - }, - COMMA@344..346 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@346..352 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@352..354 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@354..355 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@355..358 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@358..359 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@359..361 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@361..367 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@367..369 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@369..378 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@378..380 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@380..381 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@381..382 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@382..384 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@384..385 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..385 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..384 - 0: JS_CLASS_DECLARATION@0..384 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..382 - 0: JS_METHOD_CLASS_MEMBER@9..63 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@9..20 - 0: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@20..61 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..59 - 0: JS_BOGUS_PARAMETER@21..27 - 0: JS_BOGUS@21..26 - 0: JS_DECORATOR@21..26 - 0: AT@21..22 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@22..26 - 0: JS_REFERENCE_IDENTIFIER@22..26 - 0: IDENT@22..26 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@26..27 - 0: IDENT@26..27 "x" [] [] - 1: COMMA@27..29 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@29..35 - 0: JS_DECORATOR_LIST@29..29 - 1: JS_IDENTIFIER_BINDING@29..35 - 0: IDENT@29..35 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@35..37 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@37..59 - 0: JS_BOGUS@37..42 - 0: JS_DECORATOR@37..42 - 0: AT@37..38 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..42 - 0: JS_REFERENCE_IDENTIFIER@38..42 - 0: IDENT@38..42 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@42..48 - 0: IDENT@42..48 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@48..59 - 0: EQ@48..50 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@50..59 - 0: JS_STRING_LITERAL@50..59 "'default'" [] [] - 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@61..63 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_DIRECTIVE_LIST@62..62 - 2: JS_STATEMENT_LIST@62..62 - 3: R_CURLY@62..63 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@63..127 - 0: JS_METHOD_MODIFIER_LIST@63..63 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@63..74 - 0: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@74..125 - 0: L_PAREN@74..75 "(" [] [] - 1: JS_PARAMETER_LIST@75..123 - 0: JS_BOGUS_PARAMETER@75..86 - 0: JS_BOGUS@75..85 - 0: JS_DECORATOR@75..85 - 0: AT@75..76 "@" [] [] - 1: JS_CALL_EXPRESSION@76..85 - 0: JS_STATIC_MEMBER_EXPRESSION@76..82 - 0: JS_IDENTIFIER_EXPRESSION@76..79 - 0: JS_REFERENCE_IDENTIFIER@76..79 - 0: IDENT@76..79 "dec" [] [] - 1: DOT@79..80 "." [] [] - 2: JS_NAME@80..82 - 0: IDENT@80..82 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@82..85 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@83..83 - 2: R_PAREN@83..85 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@85..86 - 0: IDENT@85..86 "x" [] [] - 1: COMMA@86..88 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@88..94 - 0: JS_DECORATOR_LIST@88..88 - 1: JS_IDENTIFIER_BINDING@88..94 - 0: IDENT@88..94 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@94..96 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@96..123 - 0: JS_BOGUS@96..106 - 0: JS_DECORATOR@96..106 - 0: AT@96..97 "@" [] [] - 1: JS_CALL_EXPRESSION@97..106 - 0: JS_STATIC_MEMBER_EXPRESSION@97..103 - 0: JS_IDENTIFIER_EXPRESSION@97..100 - 0: JS_REFERENCE_IDENTIFIER@97..100 - 0: IDENT@97..100 "dec" [] [] - 1: DOT@100..101 "." [] [] - 2: JS_NAME@101..103 - 0: IDENT@101..103 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@103..106 - 0: L_PAREN@103..104 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@104..104 - 2: R_PAREN@104..106 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@106..112 - 0: IDENT@106..112 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@112..123 - 0: EQ@112..114 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@114..123 - 0: JS_STRING_LITERAL@114..123 "'default'" [] [] - 2: R_PAREN@123..125 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@125..127 - 0: L_CURLY@125..126 "{" [] [] - 1: JS_DIRECTIVE_LIST@126..126 - 2: JS_STATEMENT_LIST@126..126 - 3: R_CURLY@126..127 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@127..185 - 0: JS_METHOD_MODIFIER_LIST@127..127 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@127..138 - 0: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@138..183 - 0: L_PAREN@138..139 "(" [] [] - 1: JS_PARAMETER_LIST@139..181 - 0: JS_BOGUS_PARAMETER@139..147 - 0: JS_BOGUS@139..146 - 0: JS_DECORATOR@139..146 - 0: AT@139..140 "@" [] [] - 1: JS_CALL_EXPRESSION@140..146 - 0: JS_IDENTIFIER_EXPRESSION@140..143 - 0: JS_REFERENCE_IDENTIFIER@140..143 - 0: IDENT@140..143 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@143..146 - 0: L_PAREN@143..144 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@144..144 - 2: R_PAREN@144..146 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@146..147 - 0: IDENT@146..147 "x" [] [] - 1: COMMA@147..149 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@149..155 - 0: JS_DECORATOR_LIST@149..149 - 1: JS_IDENTIFIER_BINDING@149..155 - 0: IDENT@149..155 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@155..157 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@157..181 - 0: JS_BOGUS@157..164 - 0: JS_DECORATOR@157..164 - 0: AT@157..158 "@" [] [] - 1: JS_CALL_EXPRESSION@158..164 - 0: JS_IDENTIFIER_EXPRESSION@158..161 - 0: JS_REFERENCE_IDENTIFIER@158..161 - 0: IDENT@158..161 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@161..164 - 0: L_PAREN@161..162 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@162..162 - 2: R_PAREN@162..164 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@164..170 - 0: IDENT@164..170 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@170..181 - 0: EQ@170..172 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@172..181 - 0: JS_STRING_LITERAL@172..181 "'default'" [] [] - 2: R_PAREN@181..183 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@183..185 - 0: L_CURLY@183..184 "{" [] [] - 1: JS_DIRECTIVE_LIST@184..184 - 2: JS_STATEMENT_LIST@184..184 - 3: R_CURLY@184..185 "}" [] [] - 3: JS_METHOD_CLASS_MEMBER@185..246 - 0: JS_METHOD_MODIFIER_LIST@185..197 - 0: JS_STATIC_MODIFIER@185..197 - 0: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@197..203 - 0: IDENT@197..203 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@203..244 - 0: L_PAREN@203..204 "(" [] [] - 1: JS_PARAMETER_LIST@204..242 - 0: JS_BOGUS_PARAMETER@204..210 - 0: JS_BOGUS@204..209 - 0: JS_DECORATOR@204..209 - 0: AT@204..205 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@205..209 - 0: JS_REFERENCE_IDENTIFIER@205..209 - 0: IDENT@205..209 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@209..210 - 0: IDENT@209..210 "x" [] [] - 1: COMMA@210..212 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@212..218 - 0: JS_DECORATOR_LIST@212..212 - 1: JS_IDENTIFIER_BINDING@212..218 - 0: IDENT@212..218 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@218..220 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@220..242 - 0: JS_BOGUS@220..225 - 0: JS_DECORATOR@220..225 - 0: AT@220..221 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@221..225 - 0: JS_REFERENCE_IDENTIFIER@221..225 - 0: IDENT@221..225 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@225..231 - 0: IDENT@225..231 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@231..242 - 0: EQ@231..233 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@233..242 - 0: JS_STRING_LITERAL@233..242 "'default'" [] [] - 2: R_PAREN@242..244 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@244..246 - 0: L_CURLY@244..245 "{" [] [] - 1: JS_DIRECTIVE_LIST@245..245 - 2: JS_STATEMENT_LIST@245..245 - 3: R_CURLY@245..246 "}" [] [] - 4: JS_METHOD_CLASS_MEMBER@246..317 - 0: JS_METHOD_MODIFIER_LIST@246..258 - 0: JS_STATIC_MODIFIER@246..258 - 0: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@258..264 - 0: IDENT@258..264 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@264..315 - 0: L_PAREN@264..265 "(" [] [] - 1: JS_PARAMETER_LIST@265..313 - 0: JS_BOGUS_PARAMETER@265..276 - 0: JS_BOGUS@265..275 - 0: JS_DECORATOR@265..275 - 0: AT@265..266 "@" [] [] - 1: JS_CALL_EXPRESSION@266..275 - 0: JS_STATIC_MEMBER_EXPRESSION@266..272 - 0: JS_IDENTIFIER_EXPRESSION@266..269 - 0: JS_REFERENCE_IDENTIFIER@266..269 - 0: IDENT@266..269 "dec" [] [] - 1: DOT@269..270 "." [] [] - 2: JS_NAME@270..272 - 0: IDENT@270..272 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@272..275 - 0: L_PAREN@272..273 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@273..273 - 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@275..276 - 0: IDENT@275..276 "x" [] [] - 1: COMMA@276..278 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@278..284 - 0: JS_DECORATOR_LIST@278..278 - 1: JS_IDENTIFIER_BINDING@278..284 - 0: IDENT@278..284 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@284..286 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@286..313 - 0: JS_BOGUS@286..296 - 0: JS_DECORATOR@286..296 - 0: AT@286..287 "@" [] [] - 1: JS_CALL_EXPRESSION@287..296 - 0: JS_STATIC_MEMBER_EXPRESSION@287..293 - 0: JS_IDENTIFIER_EXPRESSION@287..290 - 0: JS_REFERENCE_IDENTIFIER@287..290 - 0: IDENT@287..290 "dec" [] [] - 1: DOT@290..291 "." [] [] - 2: JS_NAME@291..293 - 0: IDENT@291..293 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@293..296 - 0: L_PAREN@293..294 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@294..294 - 2: R_PAREN@294..296 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@296..302 - 0: IDENT@296..302 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@302..313 - 0: EQ@302..304 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@304..313 - 0: JS_STRING_LITERAL@304..313 "'default'" [] [] - 2: R_PAREN@313..315 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@315..317 - 0: L_CURLY@315..316 "{" [] [] - 1: JS_DIRECTIVE_LIST@316..316 - 2: JS_STATEMENT_LIST@316..316 - 3: R_CURLY@316..317 "}" [] [] - 5: JS_METHOD_CLASS_MEMBER@317..382 - 0: JS_METHOD_MODIFIER_LIST@317..329 - 0: JS_STATIC_MODIFIER@317..329 - 0: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@329..335 - 0: IDENT@329..335 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@335..380 - 0: L_PAREN@335..336 "(" [] [] - 1: JS_PARAMETER_LIST@336..378 - 0: JS_BOGUS_PARAMETER@336..344 - 0: JS_BOGUS@336..343 - 0: JS_DECORATOR@336..343 - 0: AT@336..337 "@" [] [] - 1: JS_CALL_EXPRESSION@337..343 - 0: JS_IDENTIFIER_EXPRESSION@337..340 - 0: JS_REFERENCE_IDENTIFIER@337..340 - 0: IDENT@337..340 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@340..343 - 0: L_PAREN@340..341 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@341..341 - 2: R_PAREN@341..343 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@343..344 - 0: IDENT@343..344 "x" [] [] - 1: COMMA@344..346 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@346..352 - 0: JS_DECORATOR_LIST@346..346 - 1: JS_IDENTIFIER_BINDING@346..352 - 0: IDENT@346..352 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@352..354 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@354..378 - 0: JS_BOGUS@354..361 - 0: JS_DECORATOR@354..361 - 0: AT@354..355 "@" [] [] - 1: JS_CALL_EXPRESSION@355..361 - 0: JS_IDENTIFIER_EXPRESSION@355..358 - 0: JS_REFERENCE_IDENTIFIER@355..358 - 0: IDENT@355..358 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@358..361 - 0: L_PAREN@358..359 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@359..359 - 2: R_PAREN@359..361 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@361..367 - 0: IDENT@361..367 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@367..378 - 0: EQ@367..369 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@369..378 - 0: JS_STRING_LITERAL@369..378 "'default'" [] [] - 2: R_PAREN@378..380 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@380..382 - 0: L_CURLY@380..381 "{" [] [] - 1: JS_DIRECTIVE_LIST@381..381 - 2: JS_STATEMENT_LIST@381..381 - 3: R_CURLY@381..382 "}" [] [] - 9: R_CURLY@382..384 "}" [Newline("\n")] [] - 4: EOF@384..385 "" [Newline("\n")] [] --- -ts_decorator_on_class_method.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - > 2 │ method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - > 2 │ method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - 2 │ method(@dec x, second, @dec third = 'default') {} - > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ static method(@dec x, second, @dec third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - 2 │ method(@dec x, second, @dec third = 'default') {} - > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ static method(@dec x, second, @dec third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ method(@dec x, second, @dec third = 'default') {} - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ static method(@dec x, second, @dec third = 'default') {} - 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ method(@dec x, second, @dec third = 'default') {} - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 4 │ method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 5 │ static method(@dec x, second, @dec third = 'default') {} - 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:5:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - > 5 │ static method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 7 │ static method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:5:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 4 │ method(@dec() x, second, @dec() third = 'default') {} - > 5 │ static method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 7 │ static method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ static method(@dec x, second, @dec third = 'default') {} - > 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 7 │ static method(@dec() x, second, @dec() third = 'default') {} - 8 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:6:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ method(@dec() x, second, @dec() third = 'default') {} - 5 │ static method(@dec x, second, @dec third = 'default') {} - > 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 7 │ static method(@dec() x, second, @dec() third = 'default') {} - 8 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ static method(@dec x, second, @dec third = 'default') {} - 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 7 │ static method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 8 │ } - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_method.ts:7:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ static method(@dec x, second, @dec third = 'default') {} - 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 7 │ static method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 8 │ } - 9 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -class A { - method(@dec x, second, @dec third = 'default') {} - method(@dec.fn() x, second, @dec.fn() third = 'default') {} - method(@dec() x, second, @dec() third = 'default') {} - static method(@dec x, second, @dec third = 'default') {} - static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - static method(@dec() x, second, @dec() third = 'default') {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.rast deleted file mode 100644 index 9f9ea5c9d5ec..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.rast +++ /dev/null @@ -1,308 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@18..21 "val" [] [], - }, - l_paren_token: L_PAREN@21..22 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@22..23 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..27 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@27..28 "x" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@30..31 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@41..44 "val" [] [], - }, - l_paren_token: L_PAREN@44..45 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@45..46 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..49 "dec" [] [], - }, - }, - operator_token: DOT@49..50 "." [] [], - member: JsName { - value_token: IDENT@50..52 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@52..53 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@55..56 "x" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@69..72 "val" [] [], - }, - l_paren_token: L_PAREN@72..73 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@73..74 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..77 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@77..78 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@80..81 "x" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@83..84 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@84..85 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@85..87 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@87..88 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..88 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..87 - 0: JS_CLASS_DECLARATION@0..87 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..85 - 0: JS_SETTER_CLASS_MEMBER@9..32 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@18..21 - 0: IDENT@18..21 "val" [] [] - 3: L_PAREN@21..22 "(" [] [] - 4: JS_BOGUS_PARAMETER@22..28 - 0: JS_BOGUS@22..27 - 0: JS_DECORATOR@22..27 - 0: AT@22..23 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@23..27 - 0: JS_REFERENCE_IDENTIFIER@23..27 - 0: IDENT@23..27 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@27..28 - 0: IDENT@27..28 "x" [] [] - 5: (empty) - 6: R_PAREN@28..30 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@30..32 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_DIRECTIVE_LIST@31..31 - 2: JS_STATEMENT_LIST@31..31 - 3: R_CURLY@31..32 "}" [] [] - 1: JS_SETTER_CLASS_MEMBER@32..60 - 0: JS_METHOD_MODIFIER_LIST@32..32 - 1: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@41..44 - 0: IDENT@41..44 "val" [] [] - 3: L_PAREN@44..45 "(" [] [] - 4: JS_BOGUS_PARAMETER@45..56 - 0: JS_BOGUS@45..55 - 0: JS_DECORATOR@45..55 - 0: AT@45..46 "@" [] [] - 1: JS_CALL_EXPRESSION@46..55 - 0: JS_STATIC_MEMBER_EXPRESSION@46..52 - 0: JS_IDENTIFIER_EXPRESSION@46..49 - 0: JS_REFERENCE_IDENTIFIER@46..49 - 0: IDENT@46..49 "dec" [] [] - 1: DOT@49..50 "." [] [] - 2: JS_NAME@50..52 - 0: IDENT@50..52 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@52..55 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@53..53 - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@55..56 - 0: IDENT@55..56 "x" [] [] - 5: (empty) - 6: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@58..60 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..60 "}" [] [] - 2: JS_SETTER_CLASS_MEMBER@60..85 - 0: JS_METHOD_MODIFIER_LIST@60..60 - 1: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@69..72 - 0: IDENT@69..72 "val" [] [] - 3: L_PAREN@72..73 "(" [] [] - 4: JS_BOGUS_PARAMETER@73..81 - 0: JS_BOGUS@73..80 - 0: JS_DECORATOR@73..80 - 0: AT@73..74 "@" [] [] - 1: JS_CALL_EXPRESSION@74..80 - 0: JS_IDENTIFIER_EXPRESSION@74..77 - 0: JS_REFERENCE_IDENTIFIER@74..77 - 0: IDENT@74..77 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@77..80 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@78..78 - 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@80..81 - 0: IDENT@80..81 "x" [] [] - 5: (empty) - 6: R_PAREN@81..83 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@83..85 - 0: L_CURLY@83..84 "{" [] [] - 1: JS_DIRECTIVE_LIST@84..84 - 2: JS_STATEMENT_LIST@84..84 - 3: R_CURLY@84..85 "}" [] [] - 9: R_CURLY@85..87 "}" [Newline("\n")] [] - 4: EOF@87..88 "" [Newline("\n")] [] --- -ts_decorator_on_class_setter.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - > 2 │ set val(@dec x) {} - │ ^^^^ - 3 │ set val(@dec.fn() x) {} - 4 │ set val(@dec() x) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_setter.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - 2 │ set val(@dec x) {} - > 3 │ set val(@dec.fn() x) {} - │ ^^^^^^^^^ - 4 │ set val(@dec() x) {} - 5 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_decorator_on_class_setter.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ set val(@dec x) {} - 3 │ set val(@dec.fn() x) {} - > 4 │ set val(@dec() x) {} - │ ^^^^^^ - 5 │ } - 6 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -class A { - set val(@dec x) {} - set val(@dec.fn() x) {} - set val(@dec() x) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.rast deleted file mode 100644 index a5e71b5d4fe9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.rast +++ /dev/null @@ -1,563 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: missing (optional), - new_token: NEW_KW@9..12 "new" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@13..14 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..18 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@18..19 "x" [] [], - }, - ], - }, - COMMA@19..21 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@21..27 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@27..29 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@29..30 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..34 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@34..40 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@42..51 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@53..56 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@56..62 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@62..63 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@63..69 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@69..71 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@71..73 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: ABSTRACT_KW@73..82 "abstract" [] [Whitespace(" ")], - new_token: NEW_KW@82..85 "new" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@85..86 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@86..87 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@87..90 "dec" [] [], - }, - }, - operator_token: DOT@90..91 "." [] [], - member: JsName { - value_token: IDENT@91..93 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@93..94 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@94..96 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@96..97 "x" [] [], - }, - ], - }, - COMMA@97..99 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@99..105 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@105..107 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@107..108 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@108..111 "dec" [] [], - }, - }, - operator_token: DOT@111..112 "." [] [], - member: JsName { - value_token: IDENT@112..114 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@114..115 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@117..123 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@123..125 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@125..134 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@134..136 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@136..139 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@139..145 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@145..146 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@146..152 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@152..154 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@154..156 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")], - new_token: NEW_KW@165..168 "new" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@168..169 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@169..170 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@170..173 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@173..174 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@174..176 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@176..177 "x" [] [], - }, - ], - }, - COMMA@177..179 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@179..185 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@185..187 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@187..188 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@188..191 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@191..192 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@194..200 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@200..202 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@202..211 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@211..213 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@213..216 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@216..222 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@222..223 ";" [] [], - }, - ], - eof_token: EOF@223..224 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..224 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..223 - 0: TS_TYPE_ALIAS_DECLARATION@0..63 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@9..62 - 0: (empty) - 1: NEW_KW@9..12 "new" [] [] - 2: (empty) - 3: JS_PARAMETERS@12..53 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..51 - 0: JS_BOGUS_PARAMETER@13..19 - 0: JS_BOGUS@13..18 - 0: JS_DECORATOR@13..18 - 0: AT@13..14 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@14..18 - 0: JS_REFERENCE_IDENTIFIER@14..18 - 0: IDENT@14..18 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "x" [] [] - 1: COMMA@19..21 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@21..27 - 0: JS_DECORATOR_LIST@21..21 - 1: JS_IDENTIFIER_BINDING@21..27 - 0: IDENT@21..27 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@27..29 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@29..51 - 0: JS_BOGUS@29..34 - 0: JS_DECORATOR@29..34 - 0: AT@29..30 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@30..34 - 0: JS_REFERENCE_IDENTIFIER@30..34 - 0: IDENT@30..34 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@34..40 - 0: IDENT@34..40 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@40..51 - 0: EQ@40..42 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@42..51 - 0: JS_STRING_LITERAL@42..51 "'default'" [] [] - 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@53..56 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@56..62 - 0: STRING_KW@56..62 "string" [] [] - 5: SEMICOLON@62..63 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@63..146 - 0: TYPE_KW@63..69 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@69..71 - 0: IDENT@69..71 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@71..73 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@73..145 - 0: ABSTRACT_KW@73..82 "abstract" [] [Whitespace(" ")] - 1: NEW_KW@82..85 "new" [] [] - 2: (empty) - 3: JS_PARAMETERS@85..136 - 0: L_PAREN@85..86 "(" [] [] - 1: JS_PARAMETER_LIST@86..134 - 0: JS_BOGUS_PARAMETER@86..97 - 0: JS_BOGUS@86..96 - 0: JS_DECORATOR@86..96 - 0: AT@86..87 "@" [] [] - 1: JS_CALL_EXPRESSION@87..96 - 0: JS_STATIC_MEMBER_EXPRESSION@87..93 - 0: JS_IDENTIFIER_EXPRESSION@87..90 - 0: JS_REFERENCE_IDENTIFIER@87..90 - 0: IDENT@87..90 "dec" [] [] - 1: DOT@90..91 "." [] [] - 2: JS_NAME@91..93 - 0: IDENT@91..93 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@93..96 - 0: L_PAREN@93..94 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@94..94 - 2: R_PAREN@94..96 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@96..97 - 0: IDENT@96..97 "x" [] [] - 1: COMMA@97..99 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@99..105 - 0: JS_DECORATOR_LIST@99..99 - 1: JS_IDENTIFIER_BINDING@99..105 - 0: IDENT@99..105 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@105..107 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@107..134 - 0: JS_BOGUS@107..117 - 0: JS_DECORATOR@107..117 - 0: AT@107..108 "@" [] [] - 1: JS_CALL_EXPRESSION@108..117 - 0: JS_STATIC_MEMBER_EXPRESSION@108..114 - 0: JS_IDENTIFIER_EXPRESSION@108..111 - 0: JS_REFERENCE_IDENTIFIER@108..111 - 0: IDENT@108..111 "dec" [] [] - 1: DOT@111..112 "." [] [] - 2: JS_NAME@112..114 - 0: IDENT@112..114 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@114..117 - 0: L_PAREN@114..115 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@115..115 - 2: R_PAREN@115..117 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@117..123 - 0: IDENT@117..123 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@123..134 - 0: EQ@123..125 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@125..134 - 0: JS_STRING_LITERAL@125..134 "'default'" [] [] - 2: R_PAREN@134..136 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@136..139 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@139..145 - 0: STRING_KW@139..145 "string" [] [] - 5: SEMICOLON@145..146 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@146..223 - 0: TYPE_KW@146..152 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@152..154 - 0: IDENT@152..154 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@154..156 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@156..222 - 0: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")] - 1: NEW_KW@165..168 "new" [] [] - 2: (empty) - 3: JS_PARAMETERS@168..213 - 0: L_PAREN@168..169 "(" [] [] - 1: JS_PARAMETER_LIST@169..211 - 0: JS_BOGUS_PARAMETER@169..177 - 0: JS_BOGUS@169..176 - 0: JS_DECORATOR@169..176 - 0: AT@169..170 "@" [] [] - 1: JS_CALL_EXPRESSION@170..176 - 0: JS_IDENTIFIER_EXPRESSION@170..173 - 0: JS_REFERENCE_IDENTIFIER@170..173 - 0: IDENT@170..173 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@173..176 - 0: L_PAREN@173..174 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@174..174 - 2: R_PAREN@174..176 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@176..177 - 0: IDENT@176..177 "x" [] [] - 1: COMMA@177..179 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@179..185 - 0: JS_DECORATOR_LIST@179..179 - 1: JS_IDENTIFIER_BINDING@179..185 - 0: IDENT@179..185 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@185..187 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@187..211 - 0: JS_BOGUS@187..194 - 0: JS_DECORATOR@187..194 - 0: AT@187..188 "@" [] [] - 1: JS_CALL_EXPRESSION@188..194 - 0: JS_IDENTIFIER_EXPRESSION@188..191 - 0: JS_REFERENCE_IDENTIFIER@188..191 - 0: IDENT@188..191 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@191..194 - 0: L_PAREN@191..192 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@192..192 - 2: R_PAREN@192..194 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@194..200 - 0: IDENT@194..200 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@200..211 - 0: EQ@200..202 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@202..211 - 0: JS_STRING_LITERAL@202..211 "'default'" [] [] - 2: R_PAREN@211..213 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@213..216 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@216..222 - 0: STRING_KW@216..222 "string" [] [] - 5: SEMICOLON@222..223 ";" [] [] - 4: EOF@223..224 "" [Newline("\n")] [] --- -ts_decorator_on_constructor_type.ts:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ type I = new(@dec x, second, @dec third = 'default') => string; - │ ^^^^ - 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_constructor_type.ts:1:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ type I = new(@dec x, second, @dec third = 'default') => string; - │ ^^^^ - 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_constructor_type.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type I = new(@dec x, second, @dec third = 'default') => string; - > 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^^^^^^^^^ - 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_constructor_type.ts:2:44 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type I = new(@dec x, second, @dec third = 'default') => string; - > 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^^^^^^^^^ - 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_constructor_type.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type I = new(@dec x, second, @dec third = 'default') => string; - 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_constructor_type.ts:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type I = new(@dec x, second, @dec third = 'default') => string; - 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -type I = new(@dec x, second, @dec third = 'default') => string; -type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; -type I = abstract new(@dec() x, second, @dec() third = 'default') => string; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.rast deleted file mode 100644 index e71f4cf2c02c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.rast +++ /dev/null @@ -1,554 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..15 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@15..16 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@16..17 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..21 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@21..22 "x" [] [], - }, - ], - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..30 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@32..33 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..37 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@37..43 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@43..45 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@45..54 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@56..57 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@58..68 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@68..74 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@74..75 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@75..76 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@76..79 "dec" [] [], - }, - }, - operator_token: DOT@79..80 "." [] [], - member: JsName { - value_token: IDENT@80..82 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@82..83 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@85..86 "x" [] [], - }, - ], - }, - COMMA@86..88 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@88..94 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@94..96 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@96..97 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@97..100 "dec" [] [], - }, - }, - operator_token: DOT@100..101 "." [] [], - member: JsName { - value_token: IDENT@101..103 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@103..104 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@104..106 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@106..112 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@112..114 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@114..123 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@123..125 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@125..126 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@126..127 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@127..137 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@137..143 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@143..144 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@144..145 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@145..148 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@148..149 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@151..152 "x" [] [], - }, - ], - }, - COMMA@152..154 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@154..160 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@160..162 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@162..163 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@163..166 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@166..167 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@167..169 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@169..175 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@175..177 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@177..186 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@186..188 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@188..189 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@189..190 "}" [] [], - }, - }, - ], - eof_token: EOF@190..191 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..191 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..190 - 0: JS_FUNCTION_DECLARATION@0..58 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..15 - 0: IDENT@9..15 "method" [] [] - 4: (empty) - 5: JS_PARAMETERS@15..56 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_PARAMETER_LIST@16..54 - 0: JS_BOGUS_PARAMETER@16..22 - 0: JS_BOGUS@16..21 - 0: JS_DECORATOR@16..21 - 0: AT@16..17 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@17..21 - 0: JS_REFERENCE_IDENTIFIER@17..21 - 0: IDENT@17..21 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "x" [] [] - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@24..30 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..30 - 0: IDENT@24..30 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@30..32 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@32..54 - 0: JS_BOGUS@32..37 - 0: JS_DECORATOR@32..37 - 0: AT@32..33 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@33..37 - 0: JS_REFERENCE_IDENTIFIER@33..37 - 0: IDENT@33..37 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@37..43 - 0: IDENT@37..43 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@43..54 - 0: EQ@43..45 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@45..54 - 0: JS_STRING_LITERAL@45..54 "'default'" [] [] - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@56..58 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..57 - 3: R_CURLY@57..58 "}" [] [] - 1: JS_FUNCTION_DECLARATION@58..127 - 0: (empty) - 1: FUNCTION_KW@58..68 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@68..74 - 0: IDENT@68..74 "method" [] [] - 4: (empty) - 5: JS_PARAMETERS@74..125 - 0: L_PAREN@74..75 "(" [] [] - 1: JS_PARAMETER_LIST@75..123 - 0: JS_BOGUS_PARAMETER@75..86 - 0: JS_BOGUS@75..85 - 0: JS_DECORATOR@75..85 - 0: AT@75..76 "@" [] [] - 1: JS_CALL_EXPRESSION@76..85 - 0: JS_STATIC_MEMBER_EXPRESSION@76..82 - 0: JS_IDENTIFIER_EXPRESSION@76..79 - 0: JS_REFERENCE_IDENTIFIER@76..79 - 0: IDENT@76..79 "dec" [] [] - 1: DOT@79..80 "." [] [] - 2: JS_NAME@80..82 - 0: IDENT@80..82 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@82..85 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@83..83 - 2: R_PAREN@83..85 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@85..86 - 0: IDENT@85..86 "x" [] [] - 1: COMMA@86..88 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@88..94 - 0: JS_DECORATOR_LIST@88..88 - 1: JS_IDENTIFIER_BINDING@88..94 - 0: IDENT@88..94 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@94..96 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@96..123 - 0: JS_BOGUS@96..106 - 0: JS_DECORATOR@96..106 - 0: AT@96..97 "@" [] [] - 1: JS_CALL_EXPRESSION@97..106 - 0: JS_STATIC_MEMBER_EXPRESSION@97..103 - 0: JS_IDENTIFIER_EXPRESSION@97..100 - 0: JS_REFERENCE_IDENTIFIER@97..100 - 0: IDENT@97..100 "dec" [] [] - 1: DOT@100..101 "." [] [] - 2: JS_NAME@101..103 - 0: IDENT@101..103 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@103..106 - 0: L_PAREN@103..104 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@104..104 - 2: R_PAREN@104..106 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@106..112 - 0: IDENT@106..112 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@112..123 - 0: EQ@112..114 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@114..123 - 0: JS_STRING_LITERAL@114..123 "'default'" [] [] - 2: R_PAREN@123..125 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@125..127 - 0: L_CURLY@125..126 "{" [] [] - 1: JS_DIRECTIVE_LIST@126..126 - 2: JS_STATEMENT_LIST@126..126 - 3: R_CURLY@126..127 "}" [] [] - 2: JS_FUNCTION_DECLARATION@127..190 - 0: (empty) - 1: FUNCTION_KW@127..137 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@137..143 - 0: IDENT@137..143 "method" [] [] - 4: (empty) - 5: JS_PARAMETERS@143..188 - 0: L_PAREN@143..144 "(" [] [] - 1: JS_PARAMETER_LIST@144..186 - 0: JS_BOGUS_PARAMETER@144..152 - 0: JS_BOGUS@144..151 - 0: JS_DECORATOR@144..151 - 0: AT@144..145 "@" [] [] - 1: JS_CALL_EXPRESSION@145..151 - 0: JS_IDENTIFIER_EXPRESSION@145..148 - 0: JS_REFERENCE_IDENTIFIER@145..148 - 0: IDENT@145..148 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@148..151 - 0: L_PAREN@148..149 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@149..149 - 2: R_PAREN@149..151 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@151..152 - 0: IDENT@151..152 "x" [] [] - 1: COMMA@152..154 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@154..160 - 0: JS_DECORATOR_LIST@154..154 - 1: JS_IDENTIFIER_BINDING@154..160 - 0: IDENT@154..160 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@160..162 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@162..186 - 0: JS_BOGUS@162..169 - 0: JS_DECORATOR@162..169 - 0: AT@162..163 "@" [] [] - 1: JS_CALL_EXPRESSION@163..169 - 0: JS_IDENTIFIER_EXPRESSION@163..166 - 0: JS_REFERENCE_IDENTIFIER@163..166 - 0: IDENT@163..166 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@166..169 - 0: L_PAREN@166..167 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@167..167 - 2: R_PAREN@167..169 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@169..175 - 0: IDENT@169..175 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@175..186 - 0: EQ@175..177 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@177..186 - 0: JS_STRING_LITERAL@177..186 "'default'" [] [] - 2: R_PAREN@186..188 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@188..190 - 0: L_CURLY@188..189 "{" [] [] - 1: JS_DIRECTIVE_LIST@189..189 - 2: JS_STATEMENT_LIST@189..189 - 3: R_CURLY@189..190 "}" [] [] - 4: EOF@190..191 "" [Newline("\n")] [] --- -ts_decorator_on_function_declaration.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ function method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 3 │ function method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_declaration.ts:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ function method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 3 │ function method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_declaration.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ function method(@dec x, second, @dec third = 'default') {} - > 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 3 │ function method(@dec() x, second, @dec() third = 'default') {} - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_declaration.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ function method(@dec x, second, @dec third = 'default') {} - > 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 3 │ function method(@dec() x, second, @dec() third = 'default') {} - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_declaration.ts:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ function method(@dec x, second, @dec third = 'default') {} - 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 3 │ function method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_declaration.ts:3:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ function method(@dec x, second, @dec third = 'default') {} - 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 3 │ function method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -function method(@dec x, second, @dec third = 'default') {} -function method(@dec.fn() x, second, @dec.fn() third = 'default') {} -function method(@dec() x, second, @dec() third = 'default') {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast deleted file mode 100644 index d9653f143a63..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast +++ /dev/null @@ -1,644 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..11 "expr" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@11..13 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@13..22 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@22..28 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@29..30 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..34 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@34..35 "x" [] [], - }, - ], - }, - COMMA@35..37 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@37..43 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@43..45 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@45..46 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..50 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@50..56 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@56..58 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@58..67 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@67..69 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@69..70 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@70..71 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@71..78 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@78..83 "expr" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@83..85 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@85..94 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@94..100 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@100..101 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@101..102 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@102..105 "dec" [] [], - }, - }, - operator_token: DOT@105..106 "." [] [], - member: JsName { - value_token: IDENT@106..108 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@108..109 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@109..111 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@111..112 "x" [] [], - }, - ], - }, - COMMA@112..114 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@114..120 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@120..122 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@122..123 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@123..126 "dec" [] [], - }, - }, - operator_token: DOT@126..127 "." [] [], - member: JsName { - value_token: IDENT@127..129 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@129..130 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@130..132 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@132..138 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@138..140 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@140..149 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@151..152 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@152..153 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@153..160 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@160..165 "expr" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@165..167 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@167..176 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@176..182 "method" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@182..183 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@183..184 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@184..187 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@187..188 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@188..190 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@190..191 "x" [] [], - }, - ], - }, - COMMA@191..193 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@193..199 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@199..201 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@201..202 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@202..205 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@205..206 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@206..208 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@208..214 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@214..216 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@216..225 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@225..227 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@227..228 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@228..229 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@229..230 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..230 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..229 - 0: JS_VARIABLE_STATEMENT@0..71 - 0: JS_VARIABLE_DECLARATION@0..71 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..71 - 0: JS_VARIABLE_DECLARATOR@6..71 - 0: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "expr" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@11..71 - 0: EQ@11..13 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@13..71 - 0: (empty) - 1: FUNCTION_KW@13..22 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@22..28 - 0: IDENT@22..28 "method" [] [] - 4: (empty) - 5: JS_PARAMETERS@28..69 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..67 - 0: JS_BOGUS_PARAMETER@29..35 - 0: JS_BOGUS@29..34 - 0: JS_DECORATOR@29..34 - 0: AT@29..30 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@30..34 - 0: JS_REFERENCE_IDENTIFIER@30..34 - 0: IDENT@30..34 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@34..35 - 0: IDENT@34..35 "x" [] [] - 1: COMMA@35..37 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@37..43 - 0: JS_DECORATOR_LIST@37..37 - 1: JS_IDENTIFIER_BINDING@37..43 - 0: IDENT@37..43 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@43..45 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@45..67 - 0: JS_BOGUS@45..50 - 0: JS_DECORATOR@45..50 - 0: AT@45..46 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@46..50 - 0: JS_REFERENCE_IDENTIFIER@46..50 - 0: IDENT@46..50 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@50..56 - 0: IDENT@50..56 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@56..67 - 0: EQ@56..58 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@58..67 - 0: JS_STRING_LITERAL@58..67 "'default'" [] [] - 2: R_PAREN@67..69 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@69..71 - 0: L_CURLY@69..70 "{" [] [] - 1: JS_DIRECTIVE_LIST@70..70 - 2: JS_STATEMENT_LIST@70..70 - 3: R_CURLY@70..71 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@71..153 - 0: JS_VARIABLE_DECLARATION@71..153 - 0: (empty) - 1: CONST_KW@71..78 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@78..153 - 0: JS_VARIABLE_DECLARATOR@78..153 - 0: JS_IDENTIFIER_BINDING@78..83 - 0: IDENT@78..83 "expr" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@83..153 - 0: EQ@83..85 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@85..153 - 0: (empty) - 1: FUNCTION_KW@85..94 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@94..100 - 0: IDENT@94..100 "method" [] [] - 4: (empty) - 5: JS_PARAMETERS@100..151 - 0: L_PAREN@100..101 "(" [] [] - 1: JS_PARAMETER_LIST@101..149 - 0: JS_BOGUS_PARAMETER@101..112 - 0: JS_BOGUS@101..111 - 0: JS_DECORATOR@101..111 - 0: AT@101..102 "@" [] [] - 1: JS_CALL_EXPRESSION@102..111 - 0: JS_STATIC_MEMBER_EXPRESSION@102..108 - 0: JS_IDENTIFIER_EXPRESSION@102..105 - 0: JS_REFERENCE_IDENTIFIER@102..105 - 0: IDENT@102..105 "dec" [] [] - 1: DOT@105..106 "." [] [] - 2: JS_NAME@106..108 - 0: IDENT@106..108 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@108..111 - 0: L_PAREN@108..109 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@109..109 - 2: R_PAREN@109..111 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@111..112 - 0: IDENT@111..112 "x" [] [] - 1: COMMA@112..114 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@114..120 - 0: JS_DECORATOR_LIST@114..114 - 1: JS_IDENTIFIER_BINDING@114..120 - 0: IDENT@114..120 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@120..122 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@122..149 - 0: JS_BOGUS@122..132 - 0: JS_DECORATOR@122..132 - 0: AT@122..123 "@" [] [] - 1: JS_CALL_EXPRESSION@123..132 - 0: JS_STATIC_MEMBER_EXPRESSION@123..129 - 0: JS_IDENTIFIER_EXPRESSION@123..126 - 0: JS_REFERENCE_IDENTIFIER@123..126 - 0: IDENT@123..126 "dec" [] [] - 1: DOT@126..127 "." [] [] - 2: JS_NAME@127..129 - 0: IDENT@127..129 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@129..132 - 0: L_PAREN@129..130 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@130..130 - 2: R_PAREN@130..132 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@132..138 - 0: IDENT@132..138 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@138..149 - 0: EQ@138..140 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@140..149 - 0: JS_STRING_LITERAL@140..149 "'default'" [] [] - 2: R_PAREN@149..151 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@151..153 - 0: L_CURLY@151..152 "{" [] [] - 1: JS_DIRECTIVE_LIST@152..152 - 2: JS_STATEMENT_LIST@152..152 - 3: R_CURLY@152..153 "}" [] [] - 1: (empty) - 2: JS_VARIABLE_STATEMENT@153..229 - 0: JS_VARIABLE_DECLARATION@153..229 - 0: (empty) - 1: CONST_KW@153..160 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@160..229 - 0: JS_VARIABLE_DECLARATOR@160..229 - 0: JS_IDENTIFIER_BINDING@160..165 - 0: IDENT@160..165 "expr" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@165..229 - 0: EQ@165..167 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@167..229 - 0: (empty) - 1: FUNCTION_KW@167..176 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@176..182 - 0: IDENT@176..182 "method" [] [] - 4: (empty) - 5: JS_PARAMETERS@182..227 - 0: L_PAREN@182..183 "(" [] [] - 1: JS_PARAMETER_LIST@183..225 - 0: JS_BOGUS_PARAMETER@183..191 - 0: JS_BOGUS@183..190 - 0: JS_DECORATOR@183..190 - 0: AT@183..184 "@" [] [] - 1: JS_CALL_EXPRESSION@184..190 - 0: JS_IDENTIFIER_EXPRESSION@184..187 - 0: JS_REFERENCE_IDENTIFIER@184..187 - 0: IDENT@184..187 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@187..190 - 0: L_PAREN@187..188 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@188..188 - 2: R_PAREN@188..190 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@190..191 - 0: IDENT@190..191 "x" [] [] - 1: COMMA@191..193 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@193..199 - 0: JS_DECORATOR_LIST@193..193 - 1: JS_IDENTIFIER_BINDING@193..199 - 0: IDENT@193..199 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@199..201 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@201..225 - 0: JS_BOGUS@201..208 - 0: JS_DECORATOR@201..208 - 0: AT@201..202 "@" [] [] - 1: JS_CALL_EXPRESSION@202..208 - 0: JS_IDENTIFIER_EXPRESSION@202..205 - 0: JS_REFERENCE_IDENTIFIER@202..205 - 0: IDENT@202..205 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@205..208 - 0: L_PAREN@205..206 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@206..206 - 2: R_PAREN@206..208 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@208..214 - 0: IDENT@208..214 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@214..225 - 0: EQ@214..216 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@216..225 - 0: JS_STRING_LITERAL@216..225 "'default'" [] [] - 2: R_PAREN@225..227 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@227..229 - 0: L_CURLY@227..228 "{" [] [] - 1: JS_DIRECTIVE_LIST@228..228 - 2: JS_STATEMENT_LIST@228..228 - 3: R_CURLY@228..229 "}" [] [] - 1: (empty) - 4: EOF@229..230 "" [Newline("\n")] [] --- -ts_decorator_on_function_expression.ts:1:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_expression.ts:1:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} - │ ^^^^ - 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_expression.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} - > 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_expression.ts:2:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} - > 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - │ ^^^^^^^^^ - 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_expression.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} - 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_expression.ts:3:48 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} - 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - > 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -const expr = function method(@dec x, second, @dec third = 'default') {} -const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} -const expr = function method(@dec() x, second, @dec() third = 'default') {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.rast deleted file mode 100644 index de9b6a155dd4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.rast +++ /dev/null @@ -1,649 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@9..10 "(" [] [], - ty: missing (required), - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@10..11 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..15 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "x" [] [], - }, - }, - comma_token: COMMA@16..18 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..24 "second" [] [], - }, - }, - }, - COMMA@24..26 "," [] [Whitespace(" ")], - JsBogusExpression { - items: [ - JsDecorator { - at_token: AT@26..27 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..31 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@31..37 "third" [] [Whitespace(" ")], - }, - operator_token: EQ@37..39 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@39..48 "'default'" [] [], - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_PAREN@48..50 ")" [] [Whitespace(" ")], - FAT_ARROW@50..53 "=>" [] [Whitespace(" ")], - STRING_KW@53..59 "string" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@60..66 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@66..68 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@68..70 "=" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@70..71 "(" [] [], - ty: missing (required), - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@71..72 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@72..75 "dec" [] [], - }, - }, - operator_token: DOT@75..76 "." [] [], - member: JsName { - value_token: IDENT@76..78 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@78..79 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@79..81 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@81..82 "x" [] [], - }, - }, - comma_token: COMMA@82..84 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..90 "second" [] [], - }, - }, - }, - COMMA@90..92 "," [] [Whitespace(" ")], - JsBogusExpression { - items: [ - JsDecorator { - at_token: AT@92..93 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@93..96 "dec" [] [], - }, - }, - operator_token: DOT@96..97 "." [] [], - member: JsName { - value_token: IDENT@97..99 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@99..100 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@100..102 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@102..108 "third" [] [Whitespace(" ")], - }, - operator_token: EQ@108..110 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@110..119 "'default'" [] [], - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_PAREN@119..121 ")" [] [Whitespace(" ")], - FAT_ARROW@121..124 "=>" [] [Whitespace(" ")], - STRING_KW@124..130 "string" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@130..131 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@131..137 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@137..139 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@139..141 "=" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@141..142 "(" [] [], - ty: missing (required), - r_paren_token: missing (required), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@142..143 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@143..146 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@146..147 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@147..149 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@149..150 "x" [] [], - }, - }, - comma_token: COMMA@150..152 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@152..158 "second" [] [], - }, - }, - }, - COMMA@158..160 "," [] [Whitespace(" ")], - JsBogusExpression { - items: [ - JsDecorator { - at_token: AT@160..161 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@161..164 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@164..165 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@165..167 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@167..173 "third" [] [Whitespace(" ")], - }, - operator_token: EQ@173..175 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@175..184 "'default'" [] [], - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - R_PAREN@184..186 ")" [] [Whitespace(" ")], - FAT_ARROW@186..189 "=>" [] [Whitespace(" ")], - STRING_KW@189..195 "string" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@195..196 ";" [] [], - }, - ], - eof_token: EOF@196..197 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..197 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..196 - 0: TS_TYPE_ALIAS_DECLARATION@0..10 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_PARENTHESIZED_TYPE@9..10 - 0: L_PAREN@9..10 "(" [] [] - 1: (empty) - 2: (empty) - 5: (empty) - 1: JS_BOGUS_STATEMENT@10..15 - 0: JS_DECORATOR@10..15 - 0: AT@10..11 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@11..15 - 0: JS_REFERENCE_IDENTIFIER@11..15 - 0: IDENT@11..15 "dec" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@15..48 - 0: JS_BOGUS_EXPRESSION@15..48 - 0: JS_SEQUENCE_EXPRESSION@15..24 - 0: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "x" [] [] - 1: COMMA@16..18 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@18..24 - 0: JS_REFERENCE_IDENTIFIER@18..24 - 0: IDENT@18..24 "second" [] [] - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@26..31 - 0: JS_DECORATOR@26..31 - 0: AT@26..27 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@27..31 - 0: JS_REFERENCE_IDENTIFIER@27..31 - 0: IDENT@27..31 "dec" [] [Whitespace(" ")] - 3: JS_ASSIGNMENT_EXPRESSION@31..48 - 0: JS_IDENTIFIER_ASSIGNMENT@31..37 - 0: IDENT@31..37 "third" [] [Whitespace(" ")] - 1: EQ@37..39 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@39..48 - 0: JS_STRING_LITERAL@39..48 "'default'" [] [] - 1: (empty) - 3: JS_BOGUS_STATEMENT@48..59 - 0: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 1: FAT_ARROW@50..53 "=>" [] [Whitespace(" ")] - 2: STRING_KW@53..59 "string" [] [] - 4: JS_EMPTY_STATEMENT@59..60 - 0: SEMICOLON@59..60 ";" [] [] - 5: TS_TYPE_ALIAS_DECLARATION@60..71 - 0: TYPE_KW@60..66 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@66..68 - 0: IDENT@66..68 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@68..70 "=" [] [Whitespace(" ")] - 4: TS_PARENTHESIZED_TYPE@70..71 - 0: L_PAREN@70..71 "(" [] [] - 1: (empty) - 2: (empty) - 5: (empty) - 6: JS_BOGUS_STATEMENT@71..81 - 0: JS_DECORATOR@71..81 - 0: AT@71..72 "@" [] [] - 1: JS_CALL_EXPRESSION@72..81 - 0: JS_STATIC_MEMBER_EXPRESSION@72..78 - 0: JS_IDENTIFIER_EXPRESSION@72..75 - 0: JS_REFERENCE_IDENTIFIER@72..75 - 0: IDENT@72..75 "dec" [] [] - 1: DOT@75..76 "." [] [] - 2: JS_NAME@76..78 - 0: IDENT@76..78 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@78..81 - 0: L_PAREN@78..79 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@79..79 - 2: R_PAREN@79..81 ")" [] [Whitespace(" ")] - 7: JS_EXPRESSION_STATEMENT@81..119 - 0: JS_BOGUS_EXPRESSION@81..119 - 0: JS_SEQUENCE_EXPRESSION@81..90 - 0: JS_IDENTIFIER_EXPRESSION@81..82 - 0: JS_REFERENCE_IDENTIFIER@81..82 - 0: IDENT@81..82 "x" [] [] - 1: COMMA@82..84 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@84..90 - 0: JS_REFERENCE_IDENTIFIER@84..90 - 0: IDENT@84..90 "second" [] [] - 1: COMMA@90..92 "," [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@92..102 - 0: JS_DECORATOR@92..102 - 0: AT@92..93 "@" [] [] - 1: JS_CALL_EXPRESSION@93..102 - 0: JS_STATIC_MEMBER_EXPRESSION@93..99 - 0: JS_IDENTIFIER_EXPRESSION@93..96 - 0: JS_REFERENCE_IDENTIFIER@93..96 - 0: IDENT@93..96 "dec" [] [] - 1: DOT@96..97 "." [] [] - 2: JS_NAME@97..99 - 0: IDENT@97..99 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@99..102 - 0: L_PAREN@99..100 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@100..100 - 2: R_PAREN@100..102 ")" [] [Whitespace(" ")] - 3: JS_ASSIGNMENT_EXPRESSION@102..119 - 0: JS_IDENTIFIER_ASSIGNMENT@102..108 - 0: IDENT@102..108 "third" [] [Whitespace(" ")] - 1: EQ@108..110 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@110..119 - 0: JS_STRING_LITERAL@110..119 "'default'" [] [] - 1: (empty) - 8: JS_BOGUS_STATEMENT@119..130 - 0: R_PAREN@119..121 ")" [] [Whitespace(" ")] - 1: FAT_ARROW@121..124 "=>" [] [Whitespace(" ")] - 2: STRING_KW@124..130 "string" [] [] - 9: JS_EMPTY_STATEMENT@130..131 - 0: SEMICOLON@130..131 ";" [] [] - 10: TS_TYPE_ALIAS_DECLARATION@131..142 - 0: TYPE_KW@131..137 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@137..139 - 0: IDENT@137..139 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@139..141 "=" [] [Whitespace(" ")] - 4: TS_PARENTHESIZED_TYPE@141..142 - 0: L_PAREN@141..142 "(" [] [] - 1: (empty) - 2: (empty) - 5: (empty) - 11: JS_BOGUS_STATEMENT@142..149 - 0: JS_DECORATOR@142..149 - 0: AT@142..143 "@" [] [] - 1: JS_CALL_EXPRESSION@143..149 - 0: JS_IDENTIFIER_EXPRESSION@143..146 - 0: JS_REFERENCE_IDENTIFIER@143..146 - 0: IDENT@143..146 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@146..149 - 0: L_PAREN@146..147 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@147..147 - 2: R_PAREN@147..149 ")" [] [Whitespace(" ")] - 12: JS_EXPRESSION_STATEMENT@149..184 - 0: JS_BOGUS_EXPRESSION@149..184 - 0: JS_SEQUENCE_EXPRESSION@149..158 - 0: JS_IDENTIFIER_EXPRESSION@149..150 - 0: JS_REFERENCE_IDENTIFIER@149..150 - 0: IDENT@149..150 "x" [] [] - 1: COMMA@150..152 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@152..158 - 0: JS_REFERENCE_IDENTIFIER@152..158 - 0: IDENT@152..158 "second" [] [] - 1: COMMA@158..160 "," [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@160..167 - 0: JS_DECORATOR@160..167 - 0: AT@160..161 "@" [] [] - 1: JS_CALL_EXPRESSION@161..167 - 0: JS_IDENTIFIER_EXPRESSION@161..164 - 0: JS_REFERENCE_IDENTIFIER@161..164 - 0: IDENT@161..164 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@164..167 - 0: L_PAREN@164..165 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@165..165 - 2: R_PAREN@165..167 ")" [] [Whitespace(" ")] - 3: JS_ASSIGNMENT_EXPRESSION@167..184 - 0: JS_IDENTIFIER_ASSIGNMENT@167..173 - 0: IDENT@167..173 "third" [] [Whitespace(" ")] - 1: EQ@173..175 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@175..184 - 0: JS_STRING_LITERAL@175..184 "'default'" [] [] - 1: (empty) - 13: JS_BOGUS_STATEMENT@184..195 - 0: R_PAREN@184..186 ")" [] [Whitespace(" ")] - 1: FAT_ARROW@186..189 "=>" [] [Whitespace(" ")] - 2: STRING_KW@189..195 "string" [] [] - 14: JS_EMPTY_STATEMENT@195..196 - 0: SEMICOLON@195..196 ";" [] [] - 4: EOF@196..197 "" [Newline("\n")] [] --- -ts_decorator_on_function_type.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type but instead found '@'. - - > 1 │ type I = (@dec x, second, @dec third = 'default') => string; - │ ^ - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - - i Expected a type here. - - > 1 │ type I = (@dec x, second, @dec third = 'default') => string; - │ ^ - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - --- -ts_decorator_on_function_type.ts:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ type I = (@dec x, second, @dec third = 'default') => string; - │ ^^^^ - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_type.ts:1:49 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - > 1 │ type I = (@dec x, second, @dec third = 'default') => string; - │ ^ - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - - i An explicit or implicit semicolon is expected here... - - > 1 │ type I = (@dec x, second, @dec third = 'default') => string; - │ ^ - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - - i ...Which is required to end this statement - - > 1 │ type I = (@dec x, second, @dec third = 'default') => string; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - --- -ts_decorator_on_function_type.ts:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type but instead found '@'. - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^ - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - 4 │ - - i Expected a type here. - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^ - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - 4 │ - --- -ts_decorator_on_function_type.ts:2:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^^^^^^^^^ - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_type.ts:2:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^ - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^ - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - 4 │ - - i ...Which is required to end this statement - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - 4 │ - --- -ts_decorator_on_function_type.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type but instead found '@'. - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - │ ^ - 4 │ - - i Expected a type here. - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - │ ^ - 4 │ - --- -ts_decorator_on_function_type.ts:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - │ ^^^^^^ - 4 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_function_type.ts:3:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - │ ^ - 4 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - │ ^ - 4 │ - - i ...Which is required to end this statement - - 1 │ type I = (@dec x, second, @dec third = 'default') => string; - 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; - > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 4 │ - --- -type I = (@dec x, second, @dec third = 'default') => string; -type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; -type I = (@dec() x, second, @dec() third = 'default') => string; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.rast deleted file mode 100644 index bce3f113090e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.rast +++ /dev/null @@ -1,625 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..10 "{" [] [], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@10..14 "new" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@14..15 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@15..16 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..20 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@20..21 "x" [] [], - }, - ], - }, - COMMA@21..23 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@23..29 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@29..31 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@31..32 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..36 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@36..42 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@44..53 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@53..54 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@54..56 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@56..62 "string" [] [], - }, - }, - separator_token: SEMICOLON@62..64 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@64..65 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@71..73 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@75..76 "{" [] [], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@76..82 "method" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@82..83 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@83..84 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..87 "dec" [] [], - }, - }, - operator_token: DOT@87..88 "." [] [], - member: JsName { - value_token: IDENT@88..90 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@90..91 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@91..93 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@93..94 "x" [] [], - }, - ], - }, - COMMA@94..96 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@96..102 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@102..104 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@104..105 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@105..108 "dec" [] [], - }, - }, - operator_token: DOT@108..109 "." [] [], - member: JsName { - value_token: IDENT@109..111 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@111..112 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@112..114 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@114..120 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@120..122 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@122..131 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@131..132 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@132..134 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@134..140 "string" [] [], - }, - }, - separator_token: SEMICOLON@140..142 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@142..143 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@143..149 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@149..151 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@151..153 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@153..154 "{" [] [], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@154..159 "new" [Newline("\n"), Whitespace(" ")] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@159..160 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@160..161 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@161..164 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@164..165 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@165..167 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@167..168 "x" [] [], - }, - ], - }, - COMMA@168..170 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@170..176 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@176..178 "," [] [Whitespace(" ")], - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@178..179 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@179..182 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@182..183 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@183..185 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@185..191 "third" [] [Whitespace(" ")], - }, - JsInitializerClause { - eq_token: EQ@191..193 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@193..202 "'default'" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@202..203 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@203..205 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@205..211 "string" [] [], - }, - }, - separator_token: SEMICOLON@211..212 ";" [] [], - }, - ], - r_curly_token: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@212..213 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..213 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..212 - 0: TS_TYPE_ALIAS_DECLARATION@0..65 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..65 - 0: L_CURLY@9..10 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@10..64 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@10..64 - 0: NEW_KW@10..14 "new" [] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@14..54 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_PARAMETER_LIST@15..53 - 0: JS_BOGUS_PARAMETER@15..21 - 0: JS_BOGUS@15..20 - 0: JS_DECORATOR@15..20 - 0: AT@15..16 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@16..20 - 0: JS_REFERENCE_IDENTIFIER@16..20 - 0: IDENT@16..20 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@20..21 - 0: IDENT@20..21 "x" [] [] - 1: COMMA@21..23 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@23..29 - 0: JS_DECORATOR_LIST@23..23 - 1: JS_IDENTIFIER_BINDING@23..29 - 0: IDENT@23..29 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@29..31 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@31..53 - 0: JS_BOGUS@31..36 - 0: JS_DECORATOR@31..36 - 0: AT@31..32 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@32..36 - 0: JS_REFERENCE_IDENTIFIER@32..36 - 0: IDENT@32..36 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@36..42 - 0: IDENT@36..42 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@42..53 - 0: EQ@42..44 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@44..53 - 0: JS_STRING_LITERAL@44..53 "'default'" [] [] - 2: R_PAREN@53..54 ")" [] [] - 3: TS_TYPE_ANNOTATION@54..62 - 0: COLON@54..56 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@56..62 - 0: STRING_KW@56..62 "string" [] [] - 4: SEMICOLON@62..64 ";" [] [Whitespace(" ")] - 2: R_CURLY@64..65 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@65..143 - 0: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@71..73 - 0: IDENT@71..73 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@73..75 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@75..143 - 0: L_CURLY@75..76 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@76..142 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@76..142 - 0: JS_LITERAL_MEMBER_NAME@76..82 - 0: IDENT@76..82 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@82..132 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_PARAMETER_LIST@83..131 - 0: JS_BOGUS_PARAMETER@83..94 - 0: JS_BOGUS@83..93 - 0: JS_DECORATOR@83..93 - 0: AT@83..84 "@" [] [] - 1: JS_CALL_EXPRESSION@84..93 - 0: JS_STATIC_MEMBER_EXPRESSION@84..90 - 0: JS_IDENTIFIER_EXPRESSION@84..87 - 0: JS_REFERENCE_IDENTIFIER@84..87 - 0: IDENT@84..87 "dec" [] [] - 1: DOT@87..88 "." [] [] - 2: JS_NAME@88..90 - 0: IDENT@88..90 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@90..93 - 0: L_PAREN@90..91 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@91..91 - 2: R_PAREN@91..93 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@93..94 - 0: IDENT@93..94 "x" [] [] - 1: COMMA@94..96 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@96..102 - 0: JS_DECORATOR_LIST@96..96 - 1: JS_IDENTIFIER_BINDING@96..102 - 0: IDENT@96..102 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@102..104 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@104..131 - 0: JS_BOGUS@104..114 - 0: JS_DECORATOR@104..114 - 0: AT@104..105 "@" [] [] - 1: JS_CALL_EXPRESSION@105..114 - 0: JS_STATIC_MEMBER_EXPRESSION@105..111 - 0: JS_IDENTIFIER_EXPRESSION@105..108 - 0: JS_REFERENCE_IDENTIFIER@105..108 - 0: IDENT@105..108 "dec" [] [] - 1: DOT@108..109 "." [] [] - 2: JS_NAME@109..111 - 0: IDENT@109..111 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@111..114 - 0: L_PAREN@111..112 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@112..112 - 2: R_PAREN@112..114 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@114..120 - 0: IDENT@114..120 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@120..131 - 0: EQ@120..122 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@122..131 - 0: JS_STRING_LITERAL@122..131 "'default'" [] [] - 2: R_PAREN@131..132 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@132..140 - 0: COLON@132..134 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@134..140 - 0: STRING_KW@134..140 "string" [] [] - 5: SEMICOLON@140..142 ";" [] [Whitespace(" ")] - 2: R_CURLY@142..143 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@143..212 - 0: TYPE_KW@143..149 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@149..151 - 0: IDENT@149..151 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@151..153 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@153..212 - 0: L_CURLY@153..154 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@154..212 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@154..212 - 0: NEW_KW@154..159 "new" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: JS_PARAMETERS@159..203 - 0: L_PAREN@159..160 "(" [] [] - 1: JS_PARAMETER_LIST@160..202 - 0: JS_BOGUS_PARAMETER@160..168 - 0: JS_BOGUS@160..167 - 0: JS_DECORATOR@160..167 - 0: AT@160..161 "@" [] [] - 1: JS_CALL_EXPRESSION@161..167 - 0: JS_IDENTIFIER_EXPRESSION@161..164 - 0: JS_REFERENCE_IDENTIFIER@161..164 - 0: IDENT@161..164 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@164..167 - 0: L_PAREN@164..165 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@165..165 - 2: R_PAREN@165..167 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@167..168 - 0: IDENT@167..168 "x" [] [] - 1: COMMA@168..170 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@170..176 - 0: JS_DECORATOR_LIST@170..170 - 1: JS_IDENTIFIER_BINDING@170..176 - 0: IDENT@170..176 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@176..178 "," [] [Whitespace(" ")] - 4: JS_BOGUS_PARAMETER@178..202 - 0: JS_BOGUS@178..185 - 0: JS_DECORATOR@178..185 - 0: AT@178..179 "@" [] [] - 1: JS_CALL_EXPRESSION@179..185 - 0: JS_IDENTIFIER_EXPRESSION@179..182 - 0: JS_REFERENCE_IDENTIFIER@179..182 - 0: IDENT@179..182 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@182..185 - 0: L_PAREN@182..183 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@183..183 - 2: R_PAREN@183..185 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@185..191 - 0: IDENT@185..191 "third" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@191..202 - 0: EQ@191..193 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@193..202 - 0: JS_STRING_LITERAL@193..202 "'default'" [] [] - 2: R_PAREN@202..203 ")" [] [] - 3: TS_TYPE_ANNOTATION@203..211 - 0: COLON@203..205 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@205..211 - 0: STRING_KW@205..211 "string" [] [] - 4: SEMICOLON@211..212 ";" [] [] - 2: (empty) - 5: (empty) - 4: EOF@212..213 "" [Newline("\n")] [] --- -ts_decorator_on_signature_member.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } - │ ^^^^ - 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } - 3 │ type C = { - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_signature_member.ts:1:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } - │ ^^^^ - 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } - 3 │ type C = { - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_signature_member.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } - > 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } - │ ^^^^^^^^^ - 3 │ type C = { - 4 │ new(@dec() x, second, @dec() third = 'default'): string; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_signature_member.ts:2:39 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } - > 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } - │ ^^^^^^^^^ - 3 │ type C = { - 4 │ new(@dec() x, second, @dec() third = 'default'): string; - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_signature_member.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } - 3 │ type C = { - > 4 │ new(@dec() x, second, @dec() third = 'default'): string; - │ ^^^^^^ - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_signature_member.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } - 3 │ type C = { - > 4 │ new(@dec() x, second, @dec() third = 'default'): string; - │ ^^^^^^ - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_on_signature_member.ts:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead the file ends - - 3 │ type C = { - 4 │ new(@dec() x, second, @dec() third = 'default'): string; - > 5 │ - │ - - i the file ends here - - 3 │ type C = { - 4 │ new(@dec() x, second, @dec() third = 'default'): string; - > 5 │ - │ - --- -type A = {new (@dec x, second, @dec third = 'default'): string; } -type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } -type C = { - new(@dec() x, second, @dec() third = 'default'): string; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.rast deleted file mode 100644 index 5d4bddcfeb08..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.rast +++ /dev/null @@ -1,430 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@11..15 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..16 "a" [] [], - }, - l_paren_token: L_PAREN@16..17 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@17..18 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..22 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@22..23 "b" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@25..31 "number" [] [], - }, - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@40..42 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@46..50 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@50..51 "a" [] [], - }, - l_paren_token: L_PAREN@51..52 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@52..53 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..56 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@56..57 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..60 "val" [] [], - }, - }, - ], - r_paren_token: R_PAREN@60..62 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@62..63 "b" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@65..66 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@72..75 "AA" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@75..77 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@77..79 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@79..83 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@83..84 "a" [] [], - }, - l_paren_token: L_PAREN@84..85 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@85..86 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@86..90 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@90..91 "b" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@91..93 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@93..99 "number" [] [], - }, - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@101..102 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@102..108 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@108..111 "BB" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@111..113 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@113..115 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@115..119 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@119..120 "a" [] [], - }, - l_paren_token: L_PAREN@120..121 "(" [] [], - parameter: JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@121..122 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@122..125 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@125..126 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@126..129 "val" [] [], - }, - }, - ], - r_paren_token: R_PAREN@129..131 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@131..132 "b" [] [], - }, - ], - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@132..134 ")" [] [Whitespace(" ")], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@134..135 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@135..136 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..136 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..135 - 0: TS_TYPE_ALIAS_DECLARATION@0..34 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..34 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..33 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@11..33 - 0: SET_KW@11..15 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..16 - 0: IDENT@15..16 "a" [] [] - 2: L_PAREN@16..17 "(" [] [] - 3: JS_BOGUS_PARAMETER@17..31 - 0: JS_BOGUS@17..22 - 0: JS_DECORATOR@17..22 - 0: AT@17..18 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@18..22 - 0: JS_REFERENCE_IDENTIFIER@18..22 - 0: IDENT@18..22 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@22..23 - 0: IDENT@22..23 "b" [] [] - 2: TS_TYPE_ANNOTATION@23..31 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@25..31 - 0: NUMBER_KW@25..31 "number" [] [] - 4: (empty) - 5: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@33..34 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@34..66 - 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@42..44 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@44..66 - 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@46..65 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@46..65 - 0: SET_KW@46..50 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@50..51 - 0: IDENT@50..51 "a" [] [] - 2: L_PAREN@51..52 "(" [] [] - 3: JS_BOGUS_PARAMETER@52..63 - 0: JS_BOGUS@52..62 - 0: JS_DECORATOR@52..62 - 0: AT@52..53 "@" [] [] - 1: JS_CALL_EXPRESSION@53..62 - 0: JS_IDENTIFIER_EXPRESSION@53..56 - 0: JS_REFERENCE_IDENTIFIER@53..56 - 0: IDENT@53..56 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@56..62 - 0: L_PAREN@56..57 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@57..60 - 0: JS_IDENTIFIER_EXPRESSION@57..60 - 0: JS_REFERENCE_IDENTIFIER@57..60 - 0: IDENT@57..60 "val" [] [] - 2: R_PAREN@60..62 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@62..63 - 0: IDENT@62..63 "b" [] [] - 4: (empty) - 5: R_PAREN@63..65 ")" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@65..66 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@66..102 - 0: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@72..75 - 0: IDENT@72..75 "AA" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@75..77 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@77..102 - 0: L_CURLY@77..79 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@79..101 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@79..101 - 0: SET_KW@79..83 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@83..84 - 0: IDENT@83..84 "a" [] [] - 2: L_PAREN@84..85 "(" [] [] - 3: JS_BOGUS_PARAMETER@85..99 - 0: JS_BOGUS@85..90 - 0: JS_DECORATOR@85..90 - 0: AT@85..86 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@86..90 - 0: JS_REFERENCE_IDENTIFIER@86..90 - 0: IDENT@86..90 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@90..91 - 0: IDENT@90..91 "b" [] [] - 2: TS_TYPE_ANNOTATION@91..99 - 0: COLON@91..93 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@93..99 - 0: NUMBER_KW@93..99 "number" [] [] - 4: (empty) - 5: R_PAREN@99..101 ")" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@101..102 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@102..135 - 0: TYPE_KW@102..108 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@108..111 - 0: IDENT@108..111 "BB" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@111..113 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@113..135 - 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@115..134 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@115..134 - 0: SET_KW@115..119 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@119..120 - 0: IDENT@119..120 "a" [] [] - 2: L_PAREN@120..121 "(" [] [] - 3: JS_BOGUS_PARAMETER@121..132 - 0: JS_BOGUS@121..131 - 0: JS_DECORATOR@121..131 - 0: AT@121..122 "@" [] [] - 1: JS_CALL_EXPRESSION@122..131 - 0: JS_IDENTIFIER_EXPRESSION@122..125 - 0: JS_REFERENCE_IDENTIFIER@122..125 - 0: IDENT@122..125 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@125..131 - 0: L_PAREN@125..126 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@126..129 - 0: JS_IDENTIFIER_EXPRESSION@126..129 - 0: JS_REFERENCE_IDENTIFIER@126..129 - 0: IDENT@126..129 "val" [] [] - 2: R_PAREN@129..131 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@131..132 - 0: IDENT@131..132 "b" [] [] - 4: (empty) - 5: R_PAREN@132..134 ")" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@134..135 "}" [] [] - 5: (empty) - 4: EOF@135..136 "" [Newline("\n")] [] --- -ts_decorator_setter_signature.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ type A = { set a(@dec b: number) } - │ ^^^^ - 2 │ type B = { set a(@dec(val) b) } - 3 │ type AA = { set a(@dec b: number) } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_setter_signature.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type A = { set a(@dec b: number) } - > 2 │ type B = { set a(@dec(val) b) } - │ ^^^^^^^^^ - 3 │ type AA = { set a(@dec b: number) } - 4 │ type BB = { set a(@dec(val) b) } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_setter_signature.ts:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ type A = { set a(@dec b: number) } - 2 │ type B = { set a(@dec(val) b) } - > 3 │ type AA = { set a(@dec b: number) } - │ ^^^^ - 4 │ type BB = { set a(@dec(val) b) } - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_setter_signature.ts:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ type B = { set a(@dec(val) b) } - 3 │ type AA = { set a(@dec b: number) } - > 4 │ type BB = { set a(@dec(val) b) } - │ ^^^^^^^^^ - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -type A = { set a(@dec b: number) } -type B = { set a(@dec(val) b) } -type AA = { set a(@dec b: number) } -type BB = { set a(@dec(val) b) } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json deleted file mode 100644 index 435ed7fb84f9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.rast deleted file mode 100644 index 52739a59b219..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.rast +++ /dev/null @@ -1,335 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@18..19 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@19..20 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..24 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsThisParameter { - this_token: THIS_KW@24..28 "this" [] [], - type_annotation: missing (optional), - }, - ], - }, - R_PAREN@28..30 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@30..31 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@41..42 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@42..43 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..46 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@46..47 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@47..50 "val" [] [], - }, - }, - ], - r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsThisParameter { - this_token: THIS_KW@52..56 "this" [] [], - type_annotation: missing (optional), - }, - ], - }, - R_PAREN@56..58 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@69..70 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@70..71 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@71..74 "dec" [] [], - }, - }, - operator_token: DOT@74..75 "." [] [], - member: JsName { - value_token: IDENT@75..77 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@77..78 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..81 "val" [] [], - }, - }, - ], - r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsThisParameter { - this_token: THIS_KW@83..87 "this" [] [], - type_annotation: missing (optional), - }, - ], - }, - R_PAREN@87..89 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@89..90 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@90..91 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@91..93 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@93..94 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..94 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..93 - 0: JS_CLASS_DECLARATION@0..93 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..91 - 0: JS_BOGUS_MEMBER@9..32 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..18 - 0: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@18..30 - 0: L_PAREN@18..19 "(" [] [] - 1: JS_BOGUS@19..28 - 0: JS_BOGUS@19..24 - 0: JS_DECORATOR@19..24 - 0: AT@19..20 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@20..24 - 0: JS_REFERENCE_IDENTIFIER@20..24 - 0: IDENT@20..24 "dec" [] [Whitespace(" ")] - 1: TS_THIS_PARAMETER@24..28 - 0: THIS_KW@24..28 "this" [] [] - 1: (empty) - 2: R_PAREN@28..30 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@30..32 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_DIRECTIVE_LIST@31..31 - 2: JS_STATEMENT_LIST@31..31 - 3: R_CURLY@31..32 "}" [] [] - 1: JS_BOGUS_MEMBER@32..60 - 0: JS_METHOD_MODIFIER_LIST@32..32 - 1: JS_LITERAL_MEMBER_NAME@32..41 - 0: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@41..58 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_BOGUS@42..56 - 0: JS_BOGUS@42..52 - 0: JS_DECORATOR@42..52 - 0: AT@42..43 "@" [] [] - 1: JS_CALL_EXPRESSION@43..52 - 0: JS_IDENTIFIER_EXPRESSION@43..46 - 0: JS_REFERENCE_IDENTIFIER@43..46 - 0: IDENT@43..46 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@46..52 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@47..50 - 0: JS_IDENTIFIER_EXPRESSION@47..50 - 0: JS_REFERENCE_IDENTIFIER@47..50 - 0: IDENT@47..50 "val" [] [] - 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] - 1: TS_THIS_PARAMETER@52..56 - 0: THIS_KW@52..56 "this" [] [] - 1: (empty) - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@58..60 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..60 "}" [] [] - 2: JS_BOGUS_MEMBER@60..91 - 0: JS_METHOD_MODIFIER_LIST@60..60 - 1: JS_LITERAL_MEMBER_NAME@60..69 - 0: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@69..89 - 0: L_PAREN@69..70 "(" [] [] - 1: JS_BOGUS@70..87 - 0: JS_BOGUS@70..83 - 0: JS_DECORATOR@70..83 - 0: AT@70..71 "@" [] [] - 1: JS_CALL_EXPRESSION@71..83 - 0: JS_STATIC_MEMBER_EXPRESSION@71..77 - 0: JS_IDENTIFIER_EXPRESSION@71..74 - 0: JS_REFERENCE_IDENTIFIER@71..74 - 0: IDENT@71..74 "dec" [] [] - 1: DOT@74..75 "." [] [] - 2: JS_NAME@75..77 - 0: IDENT@75..77 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@77..83 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@78..81 - 0: JS_IDENTIFIER_EXPRESSION@78..81 - 0: JS_REFERENCE_IDENTIFIER@78..81 - 0: IDENT@78..81 "val" [] [] - 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] - 1: TS_THIS_PARAMETER@83..87 - 0: THIS_KW@83..87 "this" [] [] - 1: (empty) - 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@89..91 - 0: L_CURLY@89..90 "{" [] [] - 1: JS_DIRECTIVE_LIST@90..90 - 2: JS_STATEMENT_LIST@90..90 - 3: R_CURLY@90..91 "}" [] [] - 9: R_CURLY@91..93 "}" [Newline("\n")] [] - 4: EOF@93..94 "" [Newline("\n")] [] --- -ts_decorator_this_parameter.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - > 2 │ method(@dec this) {} - │ ^^^^ - 3 │ method(@dec(val) this) {} - 4 │ method(@dec.fn(val) this) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_this_parameter.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - 2 │ method(@dec this) {} - > 3 │ method(@dec(val) this) {} - │ ^^^^^^^^^ - 4 │ method(@dec.fn(val) this) {} - 5 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_this_parameter.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ method(@dec this) {} - 3 │ method(@dec(val) this) {} - > 4 │ method(@dec.fn(val) this) {} - │ ^^^^^^^^^^^^ - 5 │ } - 6 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -class A { - method(@dec this) {} - method(@dec(val) this) {} - method(@dec.fn(val) this) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.rast b/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.rast deleted file mode 100644 index c2fd38c3602e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.rast +++ /dev/null @@ -1,335 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@18..19 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@19..20 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..24 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsThisParameter { - this_token: THIS_KW@24..28 "this" [] [], - type_annotation: missing (optional), - }, - ], - }, - R_PAREN@28..30 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@30..31 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@41..42 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@42..43 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..46 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@46..47 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@47..50 "val" [] [], - }, - }, - ], - r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsThisParameter { - this_token: THIS_KW@52..56 "this" [] [], - type_annotation: missing (optional), - }, - ], - }, - R_PAREN@56..58 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [], - }, - JsBogus { - items: [ - L_PAREN@69..70 "(" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@70..71 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@71..74 "dec" [] [], - }, - }, - operator_token: DOT@74..75 "." [] [], - member: JsName { - value_token: IDENT@75..77 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@77..78 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..81 "val" [] [], - }, - }, - ], - r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - TsThisParameter { - this_token: THIS_KW@83..87 "this" [] [], - type_annotation: missing (optional), - }, - ], - }, - R_PAREN@87..89 ")" [] [Whitespace(" ")], - ], - }, - JsFunctionBody { - l_curly_token: L_CURLY@89..90 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@90..91 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@91..93 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@93..94 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..94 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..93 - 0: JS_CLASS_DECLARATION@0..93 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..91 - 0: JS_BOGUS_MEMBER@9..32 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..18 - 0: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@18..30 - 0: L_PAREN@18..19 "(" [] [] - 1: JS_BOGUS@19..28 - 0: JS_BOGUS@19..24 - 0: JS_DECORATOR@19..24 - 0: AT@19..20 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@20..24 - 0: JS_REFERENCE_IDENTIFIER@20..24 - 0: IDENT@20..24 "dec" [] [Whitespace(" ")] - 1: TS_THIS_PARAMETER@24..28 - 0: THIS_KW@24..28 "this" [] [] - 1: (empty) - 2: R_PAREN@28..30 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@30..32 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_DIRECTIVE_LIST@31..31 - 2: JS_STATEMENT_LIST@31..31 - 3: R_CURLY@31..32 "}" [] [] - 1: JS_BOGUS_MEMBER@32..60 - 0: JS_METHOD_MODIFIER_LIST@32..32 - 1: JS_LITERAL_MEMBER_NAME@32..41 - 0: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@41..58 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_BOGUS@42..56 - 0: JS_BOGUS@42..52 - 0: JS_DECORATOR@42..52 - 0: AT@42..43 "@" [] [] - 1: JS_CALL_EXPRESSION@43..52 - 0: JS_IDENTIFIER_EXPRESSION@43..46 - 0: JS_REFERENCE_IDENTIFIER@43..46 - 0: IDENT@43..46 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@46..52 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@47..50 - 0: JS_IDENTIFIER_EXPRESSION@47..50 - 0: JS_REFERENCE_IDENTIFIER@47..50 - 0: IDENT@47..50 "val" [] [] - 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] - 1: TS_THIS_PARAMETER@52..56 - 0: THIS_KW@52..56 "this" [] [] - 1: (empty) - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@58..60 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..60 "}" [] [] - 2: JS_BOGUS_MEMBER@60..91 - 0: JS_METHOD_MODIFIER_LIST@60..60 - 1: JS_LITERAL_MEMBER_NAME@60..69 - 0: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [] - 2: JS_BOGUS@69..89 - 0: L_PAREN@69..70 "(" [] [] - 1: JS_BOGUS@70..87 - 0: JS_BOGUS@70..83 - 0: JS_DECORATOR@70..83 - 0: AT@70..71 "@" [] [] - 1: JS_CALL_EXPRESSION@71..83 - 0: JS_STATIC_MEMBER_EXPRESSION@71..77 - 0: JS_IDENTIFIER_EXPRESSION@71..74 - 0: JS_REFERENCE_IDENTIFIER@71..74 - 0: IDENT@71..74 "dec" [] [] - 1: DOT@74..75 "." [] [] - 2: JS_NAME@75..77 - 0: IDENT@75..77 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@77..83 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@78..81 - 0: JS_IDENTIFIER_EXPRESSION@78..81 - 0: JS_REFERENCE_IDENTIFIER@78..81 - 0: IDENT@78..81 "val" [] [] - 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] - 1: TS_THIS_PARAMETER@83..87 - 0: THIS_KW@83..87 "this" [] [] - 1: (empty) - 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@89..91 - 0: L_CURLY@89..90 "{" [] [] - 1: JS_DIRECTIVE_LIST@90..90 - 2: JS_STATEMENT_LIST@90..90 - 3: R_CURLY@90..91 "}" [] [] - 9: R_CURLY@91..93 "}" [Newline("\n")] [] - 4: EOF@93..94 "" [Newline("\n")] [] --- -ts_decorator_this_parameter_option.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - > 2 │ method(@dec this) {} - │ ^^^^ - 3 │ method(@dec(val) this) {} - 4 │ method(@dec.fn(val) this) {} - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_this_parameter_option.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class A { - 2 │ method(@dec this) {} - > 3 │ method(@dec(val) this) {} - │ ^^^^^^^^^ - 4 │ method(@dec.fn(val) this) {} - 5 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_decorator_this_parameter_option.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ method(@dec this) {} - 3 │ method(@dec(val) this) {} - > 4 │ method(@dec.fn(val) this) {} - │ ^^^^^^^^^^^^ - 5 │ } - 6 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -class A { - method(@dec this) {} - method(@dec(val) this) {} - method(@dec.fn(val) this) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast b/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast deleted file mode 100644 index 3598496a7536..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast +++ /dev/null @@ -1,157 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [], - JsLiteralMemberName { - value: IDENT@18..22 "prop" [] [], - }, - TsDefinitePropertyAnnotation { - excl_token: BANG@22..23 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@25..32 "string" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - ], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@33..40 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@40..42 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@44..52 "declare" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@52..56 "prop" [] [], - }, - TsDefinitePropertyAnnotation { - excl_token: BANG@56..57 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@57..59 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@59..66 "string" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - ], - r_curly_token: R_CURLY@66..67 "}" [] [], - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: TS_DECLARE_STATEMENT@0..33 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..33 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..32 - 0: JS_BOGUS_MEMBER@18..32 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..18 - 1: JS_LITERAL_MEMBER_NAME@18..22 - 0: IDENT@18..22 "prop" [] [] - 2: TS_DEFINITE_PROPERTY_ANNOTATION@22..32 - 0: BANG@22..23 "!" [] [] - 1: TS_TYPE_ANNOTATION@23..32 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@25..32 - 0: STRING_KW@25..32 "string" [] [Whitespace(" ")] - 9: R_CURLY@32..33 "}" [] [] - 1: JS_CLASS_DECLARATION@33..67 - 0: JS_DECORATOR_LIST@33..33 - 1: (empty) - 2: CLASS_KW@33..40 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@42..44 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@44..66 - 0: JS_BOGUS_MEMBER@44..66 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@44..52 - 0: TS_DECLARE_MODIFIER@44..52 - 0: DECLARE_KW@44..52 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@52..56 - 0: IDENT@52..56 "prop" [] [] - 2: TS_DEFINITE_PROPERTY_ANNOTATION@56..66 - 0: BANG@56..57 "!" [] [] - 1: TS_TYPE_ANNOTATION@57..66 - 0: COLON@57..59 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@59..66 - 0: STRING_KW@59..66 "string" [] [Whitespace(" ")] - 9: R_CURLY@66..67 "}" [] [] - 4: EOF@67..68 "" [Newline("\n")] [] --- -ts_definite_assignment_in_ambient_context.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Definite assignment operators '!' aren't allowed in ambient contexts. - - > 1 │ declare class A { prop!: string } - │ ^ - 2 │ class B { declare prop!: string } - 3 │ - --- -ts_definite_assignment_in_ambient_context.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Definite assignment operators '!' aren't allowed in ambient contexts. - - 1 │ declare class A { prop!: string } - > 2 │ class B { declare prop!: string } - │ ^ - 3 │ - --- -declare class A { prop!: string } -class B { declare prop!: string } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast b/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast deleted file mode 100644 index a474db6a2804..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast +++ /dev/null @@ -1,80 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsDefiniteVariableAnnotation { - excl_token: BANG@5..6 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@6..8 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@8..15 "string" [] [Whitespace(" ")], - }, - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@15..17 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@17..23 "\"test\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_VARIABLE_STATEMENT@0..24 - 0: JS_VARIABLE_DECLARATION@0..23 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..23 - 0: JS_VARIABLE_DECLARATOR@4..23 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_DEFINITE_VARIABLE_ANNOTATION@5..15 - 0: BANG@5..6 "!" [] [] - 1: TS_TYPE_ANNOTATION@6..15 - 0: COLON@6..8 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@8..15 - 0: STRING_KW@8..15 "string" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@15..23 - 0: EQ@15..17 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@17..23 - 0: JS_STRING_LITERAL@17..23 "\"test\"" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] --- -ts_definite_variable_with_initializer.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Declarations with initializers cannot also have definite assignment assertions. - - > 1 │ let a!: string = "test"; - │ ^^^^^^^^ - 2 │ - - i Annotation - - > 1 │ let a!: string = "test"; - │ ^^^^^^^^^ - 2 │ - --- -let a!: string = "test"; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_declare.rast b/crates/biome_js_parser/test_data/inline/err/ts_export_declare.rast deleted file mode 100644 index dcc3360802a3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_declare.rast +++ /dev/null @@ -1,162 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - JsBogus { - items: [ - DECLARE_KW@7..15 "declare" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@15..16 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..26 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@32..34 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@34..35 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@35..36 "}" [] [], - }, - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - DECLARE_KW@44..52 "declare" [] [Whitespace(" ")], - JsBogusStatement { - items: [ - JsDecorator { - at_token: AT@52..53 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..63 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@63..72 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@72..78 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@78..80 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@80..81 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@81..82 "}" [] [], - }, - ], - }, - ], - }, - ], - eof_token: EOF@82..83 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..83 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..82 - 0: JS_BOGUS_STATEMENT@0..36 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_BOGUS@7..36 - 0: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@15..26 - 0: JS_DECORATOR@15..26 - 0: AT@15..16 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@16..26 - 0: JS_REFERENCE_IDENTIFIER@16..26 - 0: IDENT@16..26 "decorator" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@26..36 - 0: JS_DECORATOR_LIST@26..26 - 1: (empty) - 2: CLASS_KW@26..32 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@32..34 - 0: IDENT@32..34 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@34..35 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@35..35 - 9: R_CURLY@35..36 "}" [] [] - 1: JS_BOGUS_STATEMENT@36..82 - 0: JS_DECORATOR_LIST@36..36 - 1: EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@44..82 - 0: DECLARE_KW@44..52 "declare" [] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@52..63 - 0: JS_DECORATOR@52..63 - 0: AT@52..53 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@53..63 - 0: JS_REFERENCE_IDENTIFIER@53..63 - 0: IDENT@53..63 "decorator" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@63..82 - 0: JS_DECORATOR_LIST@63..63 - 1: ABSTRACT_KW@63..72 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@72..78 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@78..80 - 0: IDENT@78..80 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@80..81 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@81..81 - 9: R_CURLY@81..82 "}" [] [] - 4: EOF@82..83 "" [Newline("\n")] [] --- -ts_export_declare.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ export declare @decorator class D {} - │ ^^^^^^^^^^ - 2 │ export declare @decorator abstract class D {} - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_export_declare.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ export declare @decorator class D {} - > 2 │ export declare @decorator abstract class D {} - │ ^^^^^^^^^^ - 3 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -export declare @decorator class D {} -export declare @decorator abstract class D {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.rast b/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.rast deleted file mode 100644 index fcac7f7e43b5..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - JsBogus { - items: [ - DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@15..20 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@20..22 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@22..24 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@24..25 "X" [] [], - }, - initializer: missing (optional), - }, - COMMA@25..27 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@27..28 "Y" [] [], - }, - initializer: missing (optional), - }, - COMMA@28..30 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@30..32 "Z" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - ], - }, - ], - }, - ], - eof_token: EOF@33..34 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..34 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..33 - 0: JS_BOGUS_STATEMENT@0..33 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_BOGUS@7..33 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_ENUM_DECLARATION@15..33 - 0: (empty) - 1: ENUM_KW@15..20 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@20..22 - 0: IDENT@20..22 "A" [] [Whitespace(" ")] - 3: L_CURLY@22..24 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@24..32 - 0: TS_ENUM_MEMBER@24..25 - 0: TS_LITERAL_ENUM_MEMBER_NAME@24..25 - 0: IDENT@24..25 "X" [] [] - 1: (empty) - 1: COMMA@25..27 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@27..28 - 0: TS_LITERAL_ENUM_MEMBER_NAME@27..28 - 0: IDENT@27..28 "Y" [] [] - 1: (empty) - 3: COMMA@28..30 "," [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER@30..32 - 0: TS_LITERAL_ENUM_MEMBER_NAME@30..32 - 0: IDENT@30..32 "Z" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@32..33 "}" [] [] - 4: EOF@33..34 "" [Newline("\n")] [] --- -ts_export_default_enum.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. - - > 1 │ export default enum A { X, Y, Z } - │ ^^^^^^^^^^^^^^^^^^ - 2 │ - --- -export default enum A { X, Y, Z } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast b/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast deleted file mode 100644 index 1f0a674706fa..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast +++ /dev/null @@ -1,418 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@5..7 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@7..8 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@8..10 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@10..11 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@12..20 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - TYPE_KW@20..25 "type" [] [Whitespace(" ")], - L_CURLY@25..27 "{" [] [Whitespace(" ")], - JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@27..29 "a" [] [Whitespace(" ")], - }, - }, - ], - R_CURLY@29..30 "}" [] [], - SEMICOLON@30..31 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@39..41 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - TYPE_KW@41..46 "type" [] [Whitespace(" ")], - JsReferenceIdentifier { - value_token: IDENT@46..48 "b" [] [Whitespace(" ")], - }, - ], - }, - ], - }, - R_CURLY@48..49 "}" [] [], - SEMICOLON@49..50 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@50..58 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@58..60 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - TYPE_KW@60..65 "type" [] [Whitespace(" ")], - JsReferenceIdentifier { - value_token: IDENT@65..67 "c" [] [Whitespace(" ")], - }, - AS_KW@67..70 "as" [] [Whitespace(" ")], - JsLiteralExportName { - value: IDENT@70..73 "cc" [] [Whitespace(" ")], - }, - ], - }, - ], - }, - R_CURLY@73..74 "}" [] [], - SEMICOLON@74..75 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@75..83 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - TYPE_KW@83..88 "type" [] [Whitespace(" ")], - L_CURLY@88..90 "{" [] [Whitespace(" ")], - JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@90..92 "d" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - R_CURLY@92..94 "}" [] [Whitespace(" ")], - FROM_KW@94..99 "from" [] [Whitespace(" ")], - JsModuleSource { - value_token: JS_STRING_LITERAL@99..104 "\"./d\"" [] [], - }, - SEMICOLON@104..105 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@105..113 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@113..115 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - TYPE_KW@115..120 "type" [] [Whitespace(" ")], - JsLiteralExportName { - value: IDENT@120..122 "e" [] [Whitespace(" ")], - }, - ], - }, - ], - }, - R_CURLY@122..124 "}" [] [Whitespace(" ")], - FROM_KW@124..129 "from" [] [Whitespace(" ")], - JsModuleSource { - value_token: JS_STRING_LITERAL@129..134 "\"./e\"" [] [], - }, - SEMICOLON@134..135 ";" [] [], - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@135..143 "export" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - L_CURLY@143..145 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - TYPE_KW@145..150 "type" [] [Whitespace(" ")], - JsLiteralExportName { - value: IDENT@150..152 "e" [] [Whitespace(" ")], - }, - JsExportAsClause { - as_token: AS_KW@152..155 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@155..158 "ee" [] [Whitespace(" ")], - }, - }, - ], - }, - ], - }, - R_CURLY@158..160 "}" [] [Whitespace(" ")], - FROM_KW@160..165 "from" [] [Whitespace(" ")], - JsModuleSource { - value_token: JS_STRING_LITERAL@165..170 "\"./e\"" [] [], - }, - SEMICOLON@170..171 ";" [] [], - ], - }, - ], - }, - ], - eof_token: EOF@171..172 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..172 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..171 - 0: JS_VARIABLE_STATEMENT@0..12 - 0: JS_VARIABLE_DECLARATION@0..11 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..11 - 0: JS_VARIABLE_DECLARATOR@4..5 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@5..7 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@7..8 - 0: JS_IDENTIFIER_BINDING@7..8 - 0: IDENT@7..8 "b" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@8..10 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@10..11 - 0: JS_IDENTIFIER_BINDING@10..11 - 0: IDENT@10..11 "c" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_BOGUS_STATEMENT@12..31 - 0: JS_DECORATOR_LIST@12..12 - 1: EXPORT_KW@12..20 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@20..31 - 0: TYPE_KW@20..25 "type" [] [Whitespace(" ")] - 1: L_CURLY@25..27 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@27..29 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@27..29 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@27..29 - 0: IDENT@27..29 "a" [] [Whitespace(" ")] - 3: R_CURLY@29..30 "}" [] [] - 4: SEMICOLON@30..31 ";" [] [] - 2: JS_BOGUS_STATEMENT@31..50 - 0: JS_DECORATOR_LIST@31..31 - 1: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@39..50 - 0: L_CURLY@39..41 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@41..48 - 0: JS_BOGUS@41..48 - 0: TYPE_KW@41..46 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@46..48 - 0: IDENT@46..48 "b" [] [Whitespace(" ")] - 2: R_CURLY@48..49 "}" [] [] - 3: SEMICOLON@49..50 ";" [] [] - 3: JS_BOGUS_STATEMENT@50..75 - 0: JS_DECORATOR_LIST@50..50 - 1: EXPORT_KW@50..58 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@58..75 - 0: L_CURLY@58..60 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@60..73 - 0: JS_BOGUS@60..73 - 0: TYPE_KW@60..65 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@65..67 - 0: IDENT@65..67 "c" [] [Whitespace(" ")] - 2: AS_KW@67..70 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@70..73 - 0: IDENT@70..73 "cc" [] [Whitespace(" ")] - 2: R_CURLY@73..74 "}" [] [] - 3: SEMICOLON@74..75 ";" [] [] - 4: JS_BOGUS_STATEMENT@75..105 - 0: JS_DECORATOR_LIST@75..75 - 1: EXPORT_KW@75..83 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@83..105 - 0: TYPE_KW@83..88 "type" [] [Whitespace(" ")] - 1: L_CURLY@88..90 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@90..92 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@90..92 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@90..92 - 0: IDENT@90..92 "d" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@92..94 "}" [] [Whitespace(" ")] - 4: FROM_KW@94..99 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@99..104 - 0: JS_STRING_LITERAL@99..104 "\"./d\"" [] [] - 6: SEMICOLON@104..105 ";" [] [] - 5: JS_BOGUS_STATEMENT@105..135 - 0: JS_DECORATOR_LIST@105..105 - 1: EXPORT_KW@105..113 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@113..135 - 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@115..122 - 0: JS_BOGUS@115..122 - 0: TYPE_KW@115..120 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@120..122 - 0: IDENT@120..122 "e" [] [Whitespace(" ")] - 2: R_CURLY@122..124 "}" [] [Whitespace(" ")] - 3: FROM_KW@124..129 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@129..134 - 0: JS_STRING_LITERAL@129..134 "\"./e\"" [] [] - 5: SEMICOLON@134..135 ";" [] [] - 6: JS_BOGUS_STATEMENT@135..171 - 0: JS_DECORATOR_LIST@135..135 - 1: EXPORT_KW@135..143 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS@143..171 - 0: L_CURLY@143..145 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@145..158 - 0: JS_BOGUS@145..158 - 0: TYPE_KW@145..150 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@150..152 - 0: IDENT@150..152 "e" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@152..158 - 0: AS_KW@152..155 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@155..158 - 0: IDENT@155..158 "ee" [] [Whitespace(" ")] - 2: R_CURLY@158..160 "}" [] [Whitespace(" ")] - 3: FROM_KW@160..165 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@165..170 - 0: JS_STRING_LITERAL@165..170 "\"./e\"" [] [] - 5: SEMICOLON@170..171 ";" [] [] - 4: EOF@171..172 "" [Newline("\n")] [] --- -ts_export_syntax_in_js.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 1 │ let a, b, c; - > 2 │ export type { a }; - │ ^^^^^^^^^^^ - 3 │ export { type b }; - 4 │ export { type c as cc }; - - i TypeScript only syntax - --- -ts_export_syntax_in_js.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × export { type ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 1 │ let a, b, c; - 2 │ export type { a }; - > 3 │ export { type b }; - │ ^^^^^^ - 4 │ export { type c as cc }; - 5 │ export type { d } from "./d"; - - i TypeScript only syntax - --- -ts_export_syntax_in_js.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × export { type ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 2 │ export type { a }; - 3 │ export { type b }; - > 4 │ export { type c as cc }; - │ ^^^^^^^^^^^^ - 5 │ export type { d } from "./d"; - 6 │ export { type e } from "./e"; - - i TypeScript only syntax - --- -ts_export_syntax_in_js.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 3 │ export { type b }; - 4 │ export { type c as cc }; - > 5 │ export type { d } from "./d"; - │ ^^^^^^^^^^^^^^^^^^^^^^ - 6 │ export { type e } from "./e"; - 7 │ export { type e as ee } from "./e"; - - i TypeScript only syntax - --- -ts_export_syntax_in_js.js:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × export { type ident }'' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 4 │ export { type c as cc }; - 5 │ export type { d } from "./d"; - > 6 │ export { type e } from "./e"; - │ ^^^^^^ - 7 │ export { type e as ee } from "./e"; - 8 │ - - i TypeScript only syntax - --- -ts_export_syntax_in_js.js:7:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × export { type ident }'' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - 5 │ export type { d } from "./d"; - 6 │ export { type e } from "./e"; - > 7 │ export { type e as ee } from "./e"; - │ ^^^^^^^^^^^^ - 8 │ - - i TypeScript only syntax - --- -let a, b, c; -export type { a }; -export { type b }; -export { type c as cc }; -export type { d } from "./d"; -export { type e } from "./e"; -export { type e as ee } from "./e"; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_type.rast b/crates/biome_js_parser/test_data/inline/err/ts_export_type.rast deleted file mode 100644 index 34583ce5341f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_type.rast +++ /dev/null @@ -1,54 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: missing (required), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..11 "type" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_EXPORT@0..7 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: (empty) - 1: JS_EXPRESSION_STATEMENT@7..11 - 0: JS_IDENTIFIER_EXPRESSION@7..11 - 0: JS_REFERENCE_IDENTIFIER@7..11 - 0: IDENT@7..11 "type" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] --- -ts_export_type.ts:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found 'type'. - - > 1 │ export type - │ ^^^^ - 2 │ - - i Expected a class, a function, or a variable declaration here. - - > 1 │ export type - │ ^^^^ - 2 │ - --- -export type diff --git a/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast b/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast deleted file mode 100644 index 5012a9f9e089..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast +++ /dev/null @@ -1,88 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@12..13 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@13..14 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@25..27 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: TsExtendsClause { - extends_token: EXTENDS_KW@27..35 "extends" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@36..38 "," [] [Whitespace(" ")], - missing element, - ], - }, - l_curly_token: L_CURLY@38..39 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: TS_INTERFACE_DECLARATION@0..14 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@12..13 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@13..13 - 6: R_CURLY@13..14 "}" [] [] - 1: TS_INTERFACE_DECLARATION@14..40 - 0: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "B" [] [Whitespace(" ")] - 2: (empty) - 3: TS_EXTENDS_CLAUSE@27..38 - 0: EXTENDS_KW@27..35 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@35..38 - 0: TS_REFERENCE_TYPE@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "A" [] [] - 1: (empty) - 1: COMMA@36..38 "," [] [Whitespace(" ")] - 2: (empty) - 4: L_CURLY@38..39 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@39..39 - 6: R_CURLY@39..40 "}" [] [] - 4: EOF@40..41 "" [Newline("\n")] [] --- -ts_extends_trailing_comma.ts:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Trailing comma not allowed. - - 1 │ interface A {} - > 2 │ interface B extends A, {} - │ ^ - 3 │ - --- -interface A {} -interface B extends A, {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.rast b/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.rast deleted file mode 100644 index cfdab3adde40..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@11..12 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..16 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@16..17 "x" [] [], - }, - ], - }, - ], - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@19..20 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_FUNCTION_DECLARATION@0..21 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..19 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..17 - 0: JS_BOGUS_PARAMETER@11..17 - 0: JS_BOGUS@11..16 - 0: JS_DECORATOR@11..16 - 0: AT@11..12 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@12..16 - 0: JS_REFERENCE_IDENTIFIER@12..16 - 0: IDENT@12..16 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@16..17 - 0: IDENT@16..17 "x" [] [] - 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@19..21 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_DIRECTIVE_LIST@20..20 - 2: JS_STATEMENT_LIST@20..20 - 3: R_CURLY@20..21 "}" [] [] - 4: EOF@21..22 "" [Newline("\n")] [] --- -ts_formal_parameter_decorator.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - > 1 │ function a(@dec x) {} - │ ^^^^ - 2 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -function a(@dec x) {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.rast b/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.rast deleted file mode 100644 index dda25418d6ac..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.rast +++ /dev/null @@ -1,206 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@26..27 "(" [] [], - parameters: JsConstructorParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@27..28 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..32 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@32..33 "x" [] [], - }, - ], - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@35..36 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@47..48 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@48..49 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..53 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsIdentifierBinding { - name_token: IDENT@53..54 "x" [] [], - }, - ], - }, - ], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@56..57 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@58..60 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@60..61 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..61 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..60 - 0: JS_CLASS_DECLARATION@0..60 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..58 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@11..37 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@11..11 - 1: JS_LITERAL_MEMBER_NAME@11..26 - 0: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@26..35 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@27..33 - 0: JS_BOGUS_PARAMETER@27..33 - 0: JS_BOGUS@27..32 - 0: JS_DECORATOR@27..32 - 0: AT@27..28 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@28..32 - 0: JS_REFERENCE_IDENTIFIER@28..32 - 0: IDENT@28..32 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "x" [] [] - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@35..37 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_DIRECTIVE_LIST@36..36 - 2: JS_STATEMENT_LIST@36..36 - 3: R_CURLY@36..37 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@37..58 - 0: JS_METHOD_MODIFIER_LIST@37..37 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@37..47 - 0: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@47..56 - 0: L_PAREN@47..48 "(" [] [] - 1: JS_PARAMETER_LIST@48..54 - 0: JS_BOGUS_PARAMETER@48..54 - 0: JS_BOGUS@48..53 - 0: JS_DECORATOR@48..53 - 0: AT@48..49 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@49..53 - 0: JS_REFERENCE_IDENTIFIER@49..53 - 0: IDENT@49..53 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@53..54 - 0: IDENT@53..54 "x" [] [] - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@56..58 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..57 - 3: R_CURLY@57..58 "}" [] [] - 9: R_CURLY@58..60 "}" [Newline("\n")] [] - 4: EOF@60..61 "" [Newline("\n")] [] --- -ts_formal_parameter_decorator_option.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class Foo { - > 2 │ constructor(@dec x) {} - │ ^^^^ - 3 │ method(@dec x) {} - 4 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -ts_formal_parameter_decorator_option.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ class Foo { - 2 │ constructor(@dec x) {} - > 3 │ method(@dec x) {} - │ ^^^^ - 4 │ } - 5 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - - i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. - --- -class Foo { - constructor(@dec x) {} - method(@dec x) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast b/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast deleted file mode 100644 index 1ab3957c2216..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast +++ /dev/null @@ -1,281 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@11..12 "x" [] [], - }, - question_mark_token: QUESTION@12..13 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@15..22 "string" [] [Whitespace(" ")], - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@24..30 "\"test\"" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@32..33 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@44..45 "b" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@45..46 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - DOT3@46..49 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@49..53 "rest" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@53..55 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsStringType { - string_token: STRING_KW@55..61 "string" [] [], - }, - l_brack_token: L_BRACK@61..62 "[" [] [], - r_brack_token: R_BRACK@62..64 "]" [] [Whitespace(" ")], - }, - }, - JsInitializerClause { - eq_token: EQ@64..66 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@66..72 "\"init\"" [] [], - }, - }, - ], - }, - ], - r_paren_token: R_PAREN@72..74 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@74..75 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@75..76 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@76..86 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@86..87 "c" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@87..88 "(" [] [], - items: JsParameterList [ - JsBogusParameter { - items: [ - JsDecoratorList [], - DOT3@88..91 "..." [] [], - JsIdentifierBinding { - name_token: IDENT@91..95 "rest" [] [], - }, - ], - }, - COMMA@95..97 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@97..98 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@98..100 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@100..106 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@106..108 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@108..109 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@109..110 "}" [] [], - }, - }, - ], - eof_token: EOF@110..111 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..111 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..110 - 0: JS_FUNCTION_DECLARATION@0..34 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..32 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..30 - 0: JS_FORMAL_PARAMETER@11..30 - 0: JS_DECORATOR_LIST@11..11 - 1: JS_IDENTIFIER_BINDING@11..12 - 0: IDENT@11..12 "x" [] [] - 2: QUESTION@12..13 "?" [] [] - 3: TS_TYPE_ANNOTATION@13..22 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@15..22 - 0: STRING_KW@15..22 "string" [] [Whitespace(" ")] - 4: JS_INITIALIZER_CLAUSE@22..30 - 0: EQ@22..24 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@24..30 - 0: JS_STRING_LITERAL@24..30 "\"test\"" [] [] - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@32..34 - 0: L_CURLY@32..33 "{" [] [] - 1: JS_DIRECTIVE_LIST@33..33 - 2: JS_STATEMENT_LIST@33..33 - 3: R_CURLY@33..34 "}" [] [] - 1: JS_FUNCTION_DECLARATION@34..76 - 0: (empty) - 1: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@44..45 - 0: IDENT@44..45 "b" [] [] - 4: (empty) - 5: JS_PARAMETERS@45..74 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_PARAMETER_LIST@46..72 - 0: JS_BOGUS_PARAMETER@46..72 - 0: JS_DECORATOR_LIST@46..46 - 1: DOT3@46..49 "..." [] [] - 2: JS_IDENTIFIER_BINDING@49..53 - 0: IDENT@49..53 "rest" [] [] - 3: TS_TYPE_ANNOTATION@53..64 - 0: COLON@53..55 ":" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@55..64 - 0: TS_STRING_TYPE@55..61 - 0: STRING_KW@55..61 "string" [] [] - 1: L_BRACK@61..62 "[" [] [] - 2: R_BRACK@62..64 "]" [] [Whitespace(" ")] - 4: JS_INITIALIZER_CLAUSE@64..72 - 0: EQ@64..66 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@66..72 - 0: JS_STRING_LITERAL@66..72 "\"init\"" [] [] - 2: R_PAREN@72..74 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@74..76 - 0: L_CURLY@74..75 "{" [] [] - 1: JS_DIRECTIVE_LIST@75..75 - 2: JS_STATEMENT_LIST@75..75 - 3: R_CURLY@75..76 "}" [] [] - 2: JS_FUNCTION_DECLARATION@76..110 - 0: (empty) - 1: FUNCTION_KW@76..86 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@86..87 - 0: IDENT@86..87 "c" [] [] - 4: (empty) - 5: JS_PARAMETERS@87..108 - 0: L_PAREN@87..88 "(" [] [] - 1: JS_PARAMETER_LIST@88..106 - 0: JS_BOGUS_PARAMETER@88..95 - 0: JS_DECORATOR_LIST@88..88 - 1: DOT3@88..91 "..." [] [] - 2: JS_IDENTIFIER_BINDING@91..95 - 0: IDENT@91..95 "rest" [] [] - 1: COMMA@95..97 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@97..106 - 0: JS_DECORATOR_LIST@97..97 - 1: JS_IDENTIFIER_BINDING@97..98 - 0: IDENT@97..98 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@98..106 - 0: COLON@98..100 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@100..106 - 0: STRING_KW@100..106 "string" [] [] - 4: (empty) - 2: R_PAREN@106..108 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@108..110 - 0: L_CURLY@108..109 "{" [] [] - 1: JS_DIRECTIVE_LIST@109..109 - 2: JS_STATEMENT_LIST@109..109 - 3: R_CURLY@109..110 "}" [] [] - 4: EOF@110..111 "" [Newline("\n")] [] --- -ts_formal_parameter_error.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Parameter cannot have question mark and initializer - - > 1 │ function a(x?: string = "test") {} - │ ^^^^^^^^ - 2 │ function b(...rest: string[] = "init") {} - 3 │ function c(...rest, b: string) {} - --- -ts_formal_parameter_error.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest elements may not have default initializers - - 1 │ function a(x?: string = "test") {} - > 2 │ function b(...rest: string[] = "init") {} - │ ^^^^^^^^ - 3 │ function c(...rest, b: string) {} - 4 │ - --- -ts_formal_parameter_error.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × rest elements may not have trailing commas - - 1 │ function a(x?: string = "test") {} - 2 │ function b(...rest: string[] = "init") {} - > 3 │ function c(...rest, b: string) {} - │ ^^^^^^^ - 4 │ - --- -function a(x?: string = "test") {} -function b(...rest: string[] = "init") {} -function c(...rest, b: string) {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.rast b/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.rast deleted file mode 100644 index 5e074872e63c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.rast +++ /dev/null @@ -1,141 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - FUNCTION_KW@0..8 "function" [] [], - STAR@8..10 "*" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@10..14 "test" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@14..15 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@18..24 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@24..25 ")" [] [], - }, - SEMICOLON@25..26 ";" [] [], - ], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@26..35 "function" [Newline("\n")] [], - star_token: STAR@35..37 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@37..41 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@41..42 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@42..43 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@43..45 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@45..51 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@53..54 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - }, - ], - eof_token: EOF@55..56 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..56 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..55 - 0: JS_BOGUS_STATEMENT@0..26 - 0: FUNCTION_KW@0..8 "function" [] [] - 1: STAR@8..10 "*" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@10..14 - 0: IDENT@10..14 "test" [] [] - 3: JS_PARAMETERS@14..25 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_PARAMETER_LIST@15..24 - 0: JS_FORMAL_PARAMETER@15..24 - 0: JS_DECORATOR_LIST@15..15 - 1: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@16..24 - 0: COLON@16..18 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@18..24 - 0: STRING_KW@18..24 "string" [] [] - 4: (empty) - 2: R_PAREN@24..25 ")" [] [] - 4: SEMICOLON@25..26 ";" [] [] - 1: JS_FUNCTION_DECLARATION@26..55 - 0: (empty) - 1: FUNCTION_KW@26..35 "function" [Newline("\n")] [] - 2: STAR@35..37 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@37..41 - 0: IDENT@37..41 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@41..53 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_PARAMETER_LIST@42..51 - 0: JS_FORMAL_PARAMETER@42..51 - 0: JS_DECORATOR_LIST@42..42 - 1: JS_IDENTIFIER_BINDING@42..43 - 0: IDENT@42..43 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@43..51 - 0: COLON@43..45 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@45..51 - 0: STRING_KW@45..51 "string" [] [] - 4: (empty) - 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@53..55 - 0: L_CURLY@53..54 "{" [] [] - 1: JS_DIRECTIVE_LIST@54..54 - 2: JS_STATEMENT_LIST@54..54 - 3: R_CURLY@54..55 "}" [] [] - 4: EOF@55..56 "" [Newline("\n")] [] --- -ts_function_overload_generator.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An overload signature cannot be declared as a generator. - - > 1 │ function* test(a: string); - │ ^ - 2 │ function* test(a: string) {} - 3 │ - --- -function* test(a: string); -function* test(a: string) {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.rast b/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.rast deleted file mode 100644 index f10ba8a867d1..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.rast +++ /dev/null @@ -1,137 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "G" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@9..10 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@11..12 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@12..13 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@16..18 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@18..19 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@19..21 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@21..22 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@27..33 "string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@33..34 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..34 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..33 - 0: TS_TYPE_ALIAS_DECLARATION@0..33 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "G" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@9..33 - 0: TS_TYPE_PARAMETERS@9..11 - 0: L_ANGLE@9..10 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@10..10 - 2: R_ANGLE@10..11 ">" [] [] - 1: JS_PARAMETERS@11..24 - 0: L_PAREN@11..12 "(" [] [] - 1: JS_PARAMETER_LIST@12..22 - 0: JS_FORMAL_PARAMETER@12..16 - 0: JS_DECORATOR_LIST@12..12 - 1: JS_IDENTIFIER_BINDING@12..13 - 0: IDENT@12..13 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@13..16 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@16..18 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@18..22 - 0: JS_DECORATOR_LIST@18..18 - 1: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@19..22 - 0: COLON@19..21 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@21..22 - 0: JS_REFERENCE_IDENTIFIER@21..22 - 0: IDENT@21..22 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@27..33 - 0: STRING_KW@27..33 "string" [] [] - 5: (empty) - 4: EOF@33..34 "" [Newline("\n")] [] --- -ts_function_type_err.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - > 1 │ type G = <>(a: A, b: B) => string - │ ^ - 2 │ - - i Expected a type parameter here. - - > 1 │ type G = <>(a: A, b: B) => string - │ ^ - 2 │ - --- -type G = <>(a: A, b: B) => string diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast b/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast deleted file mode 100644 index 5de85027c479..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast +++ /dev/null @@ -1,220 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@18..19 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@19..20 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@20..21 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@21..22 ">" [] [], - }, - L_PAREN@22..23 "(" [] [], - R_PAREN@23..24 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@26..28 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [], - SET_KW@30..36 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@36..37 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@37..38 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@38..39 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@39..40 ">" [] [], - }, - L_PAREN@40..41 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@41..46 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@46..48 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@48..49 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - R_PAREN@49..51 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@51..52 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@55..56 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..56 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..55 - 0: JS_CLASS_DECLARATION@0..55 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..53 - 0: JS_BOGUS_MEMBER@12..30 - 0: JS_METHOD_MODIFIER_LIST@12..12 - 1: GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@18..19 - 0: IDENT@18..19 "a" [] [] - 3: TS_TYPE_PARAMETERS@19..22 - 0: L_ANGLE@19..20 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@20..21 - 0: TS_TYPE_PARAMETER@20..21 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@20..20 - 1: TS_TYPE_PARAMETER_NAME@20..21 - 0: IDENT@20..21 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@21..22 ">" [] [] - 4: L_PAREN@22..23 "(" [] [] - 5: R_PAREN@23..24 ")" [] [] - 6: TS_TYPE_ANNOTATION@24..28 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@26..28 - 0: JS_REFERENCE_IDENTIFIER@26..28 - 0: IDENT@26..28 "A" [] [Whitespace(" ")] - 1: (empty) - 7: JS_FUNCTION_BODY@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..30 "}" [] [] - 1: JS_BOGUS_MEMBER@30..53 - 0: JS_METHOD_MODIFIER_LIST@30..30 - 1: SET_KW@30..36 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@36..37 - 0: IDENT@36..37 "a" [] [] - 3: TS_TYPE_PARAMETERS@37..40 - 0: L_ANGLE@37..38 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@38..39 - 0: TS_TYPE_PARAMETER@38..39 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@38..38 - 1: TS_TYPE_PARAMETER_NAME@38..39 - 0: IDENT@38..39 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@39..40 ">" [] [] - 4: L_PAREN@40..41 "(" [] [] - 5: JS_FORMAL_PARAMETER@41..49 - 0: JS_DECORATOR_LIST@41..41 - 1: JS_IDENTIFIER_BINDING@41..46 - 0: IDENT@41..46 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@46..49 - 0: COLON@46..48 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@48..49 - 0: JS_REFERENCE_IDENTIFIER@48..49 - 0: IDENT@48..49 "A" [] [] - 1: (empty) - 4: (empty) - 6: R_PAREN@49..51 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@51..53 - 0: L_CURLY@51..52 "{" [] [] - 1: JS_DIRECTIVE_LIST@52..52 - 2: JS_STATEMENT_LIST@52..52 - 3: R_CURLY@52..53 "}" [] [] - 9: R_CURLY@53..55 "}" [Newline("\n")] [] - 4: EOF@55..56 "" [Newline("\n")] [] --- -ts_getter_setter_type_parameters.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - 1 │ class Test { - > 2 │ get a(): A {} - │ ^^^ - 3 │ set a(value: A) {} - 4 │ } - --- -ts_getter_setter_type_parameters.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - 1 │ class Test { - 2 │ get a(): A {} - > 3 │ set a(value: A) {} - │ ^^^ - 4 │ } - 5 │ - --- -class Test { - get a(): A {} - set a(value: A) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.rast b/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.rast deleted file mode 100644 index 7fc27bfa86a0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.rast +++ /dev/null @@ -1,230 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@18..19 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@19..20 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@20..21 ">" [] [], - }, - L_PAREN@21..22 "(" [] [], - R_PAREN@22..23 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@25..27 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@27..28 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsMethodModifierList [], - SET_KW@29..35 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@35..36 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@36..37 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@37..38 ">" [] [], - }, - L_PAREN@38..39 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@39..44 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@44..46 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@46..47 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - R_PAREN@47..49 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@49..50 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@53..54 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..54 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..53 - 0: JS_CLASS_DECLARATION@0..53 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..51 - 0: JS_BOGUS_MEMBER@12..29 - 0: JS_METHOD_MODIFIER_LIST@12..12 - 1: GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@18..19 - 0: IDENT@18..19 "a" [] [] - 3: TS_TYPE_PARAMETERS@19..21 - 0: L_ANGLE@19..20 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@20..20 - 2: R_ANGLE@20..21 ">" [] [] - 4: L_PAREN@21..22 "(" [] [] - 5: R_PAREN@22..23 ")" [] [] - 6: TS_TYPE_ANNOTATION@23..27 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@25..27 - 0: JS_REFERENCE_IDENTIFIER@25..27 - 0: IDENT@25..27 "A" [] [Whitespace(" ")] - 1: (empty) - 7: JS_FUNCTION_BODY@27..29 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..28 - 3: R_CURLY@28..29 "}" [] [] - 1: JS_BOGUS_MEMBER@29..51 - 0: JS_METHOD_MODIFIER_LIST@29..29 - 1: SET_KW@29..35 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@35..36 - 0: IDENT@35..36 "a" [] [] - 3: TS_TYPE_PARAMETERS@36..38 - 0: L_ANGLE@36..37 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@37..37 - 2: R_ANGLE@37..38 ">" [] [] - 4: L_PAREN@38..39 "(" [] [] - 5: JS_FORMAL_PARAMETER@39..47 - 0: JS_DECORATOR_LIST@39..39 - 1: JS_IDENTIFIER_BINDING@39..44 - 0: IDENT@39..44 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@44..47 - 0: COLON@44..46 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@46..47 - 0: JS_REFERENCE_IDENTIFIER@46..47 - 0: IDENT@46..47 "A" [] [] - 1: (empty) - 4: (empty) - 6: R_PAREN@47..49 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@49..51 - 0: L_CURLY@49..50 "{" [] [] - 1: JS_DIRECTIVE_LIST@50..50 - 2: JS_STATEMENT_LIST@50..50 - 3: R_CURLY@50..51 "}" [] [] - 9: R_CURLY@51..53 "}" [Newline("\n")] [] - 4: EOF@53..54 "" [Newline("\n")] [] --- -ts_getter_setter_type_parameters_errors.ts:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ class Test { - > 2 │ get a<>(): A {} - │ ^ - 3 │ set a<>(value: A) {} - 4 │ } - - i Expected a type parameter here. - - 1 │ class Test { - > 2 │ get a<>(): A {} - │ ^ - 3 │ set a<>(value: A) {} - 4 │ } - --- -ts_getter_setter_type_parameters_errors.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - 1 │ class Test { - > 2 │ get a<>(): A {} - │ ^^ - 3 │ set a<>(value: A) {} - 4 │ } - --- -ts_getter_setter_type_parameters_errors.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ class Test { - 2 │ get a<>(): A {} - > 3 │ set a<>(value: A) {} - │ ^ - 4 │ } - 5 │ - - i Expected a type parameter here. - - 1 │ class Test { - 2 │ get a<>(): A {} - > 3 │ set a<>(value: A) {} - │ ^ - 4 │ } - 5 │ - --- -ts_getter_setter_type_parameters_errors.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - 1 │ class Test { - 2 │ get a<>(): A {} - > 3 │ set a<>(value: A) {} - │ ^^ - 4 │ } - 5 │ - --- -class Test { - get a<>(): A {} - set a<>(value: A) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast b/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast deleted file mode 100644 index 945f590ae58f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast +++ /dev/null @@ -1,106 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - L_BRACK@32..33 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@33..34 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@36..42 "number" [] [], - }, - }, - }, - R_BRACK@42..43 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@43..45 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@45..51 "string" [] [], - }, - }, - SEMICOLON@51..52 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_CLASS_DECLARATION@0..54 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..52 - 0: JS_BOGUS_MEMBER@18..52 - 0: JS_BOGUS@18..32 - 0: TS_ABSTRACT_MODIFIER@18..32 - 0: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@32..33 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@33..42 - 0: JS_IDENTIFIER_BINDING@33..34 - 0: IDENT@33..34 "a" [] [] - 1: TS_TYPE_ANNOTATION@34..42 - 0: COLON@34..36 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@36..42 - 0: NUMBER_KW@36..42 "number" [] [] - 3: R_BRACK@42..43 "]" [] [] - 4: TS_TYPE_ANNOTATION@43..51 - 0: COLON@43..45 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@45..51 - 0: STRING_KW@45..51 "string" [] [] - 5: SEMICOLON@51..52 ";" [] [] - 9: R_CURLY@52..54 "}" [Newline("\n")] [] - 4: EOF@54..55 "" [Newline("\n")] [] --- -ts_index_signature_class_member_cannot_be_abstract.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' modifier cannot appear on an index signature. - - 1 │ abstract class A { - > 2 │ abstract [a: number]: string; - │ ^^^^^^^^ - 3 │ } - 4 │ - --- -abstract class A { - abstract [a: number]: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast b/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast deleted file mode 100644 index 7893cf90ddc0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast +++ /dev/null @@ -1,106 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@18..32 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - L_BRACK@32..33 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@33..34 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@36..42 "number" [] [], - }, - }, - }, - R_BRACK@42..43 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@43..45 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@45..51 "string" [] [], - }, - }, - SEMICOLON@51..52 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_CLASS_DECLARATION@0..54 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..52 - 0: JS_BOGUS_MEMBER@18..52 - 0: JS_BOGUS@18..32 - 0: JS_ACCESSOR_MODIFIER@18..32 - 0: ACCESSOR_KW@18..32 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@32..33 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@33..42 - 0: JS_IDENTIFIER_BINDING@33..34 - 0: IDENT@33..34 "a" [] [] - 1: TS_TYPE_ANNOTATION@34..42 - 0: COLON@34..36 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@36..42 - 0: NUMBER_KW@36..42 "number" [] [] - 3: R_BRACK@42..43 "]" [] [] - 4: TS_TYPE_ANNOTATION@43..51 - 0: COLON@43..45 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@45..51 - 0: STRING_KW@45..51 "string" [] [] - 5: SEMICOLON@51..52 ";" [] [] - 9: R_CURLY@52..54 "}" [Newline("\n")] [] - 4: EOF@54..55 "" [Newline("\n")] [] --- -ts_index_signature_class_member_cannot_be_accessor.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'accessor' modifier cannot appear on an index signature. - - 1 │ abstract class A { - > 2 │ accessor [a: number]: string; - │ ^^^^^^^^ - 3 │ } - 4 │ - --- -abstract class A { - accessor [a: number]: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast b/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast deleted file mode 100644 index fb99d8e3fb9e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast +++ /dev/null @@ -1,288 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@9..22 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - L_BRACK@22..23 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@23..24 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@26..32 "number" [] [], - }, - }, - }, - R_BRACK@32..33 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@33..35 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@35..41 "string" [] [], - }, - }, - SEMICOLON@41..42 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@42..44 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@51..53 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@53..54 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@54..68 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - L_BRACK@68..69 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@69..70 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@70..72 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@72..78 "number" [] [], - }, - }, - }, - R_BRACK@78..79 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@79..81 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@81..87 "string" [] [], - }, - }, - SEMICOLON@87..88 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@88..90 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@90..97 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@97..99 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@99..100 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@100..116 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - L_BRACK@116..117 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@117..118 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@118..120 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@120..126 "number" [] [], - }, - }, - }, - R_BRACK@126..127 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@127..129 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@129..135 "string" [] [], - }, - }, - SEMICOLON@135..136 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@136..138 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@138..139 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..139 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..138 - 0: JS_CLASS_DECLARATION@0..44 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..42 - 0: JS_BOGUS_MEMBER@9..42 - 0: JS_BOGUS@9..22 - 0: TS_ACCESSIBILITY_MODIFIER@9..22 - 0: PUBLIC_KW@9..22 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@22..23 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@23..32 - 0: JS_IDENTIFIER_BINDING@23..24 - 0: IDENT@23..24 "a" [] [] - 1: TS_TYPE_ANNOTATION@24..32 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@26..32 - 0: NUMBER_KW@26..32 "number" [] [] - 3: R_BRACK@32..33 "]" [] [] - 4: TS_TYPE_ANNOTATION@33..41 - 0: COLON@33..35 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@35..41 - 0: STRING_KW@35..41 "string" [] [] - 5: SEMICOLON@41..42 ";" [] [] - 9: R_CURLY@42..44 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@44..90 - 0: JS_DECORATOR_LIST@44..44 - 1: (empty) - 2: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@51..53 - 0: IDENT@51..53 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@53..54 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@54..88 - 0: JS_BOGUS_MEMBER@54..88 - 0: JS_BOGUS@54..68 - 0: TS_ACCESSIBILITY_MODIFIER@54..68 - 0: PRIVATE_KW@54..68 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@68..69 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@69..78 - 0: JS_IDENTIFIER_BINDING@69..70 - 0: IDENT@69..70 "a" [] [] - 1: TS_TYPE_ANNOTATION@70..78 - 0: COLON@70..72 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@72..78 - 0: NUMBER_KW@72..78 "number" [] [] - 3: R_BRACK@78..79 "]" [] [] - 4: TS_TYPE_ANNOTATION@79..87 - 0: COLON@79..81 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@81..87 - 0: STRING_KW@81..87 "string" [] [] - 5: SEMICOLON@87..88 ";" [] [] - 9: R_CURLY@88..90 "}" [Newline("\n")] [] - 2: JS_CLASS_DECLARATION@90..138 - 0: JS_DECORATOR_LIST@90..90 - 1: (empty) - 2: CLASS_KW@90..97 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@97..99 - 0: IDENT@97..99 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@99..100 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@100..136 - 0: JS_BOGUS_MEMBER@100..136 - 0: JS_BOGUS@100..116 - 0: TS_ACCESSIBILITY_MODIFIER@100..116 - 0: PROTECTED_KW@100..116 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@116..117 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@117..126 - 0: JS_IDENTIFIER_BINDING@117..118 - 0: IDENT@117..118 "a" [] [] - 1: TS_TYPE_ANNOTATION@118..126 - 0: COLON@118..120 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@120..126 - 0: NUMBER_KW@120..126 "number" [] [] - 3: R_BRACK@126..127 "]" [] [] - 4: TS_TYPE_ANNOTATION@127..135 - 0: COLON@127..129 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@129..135 - 0: STRING_KW@129..135 "string" [] [] - 5: SEMICOLON@135..136 ";" [] [] - 9: R_CURLY@136..138 "}" [Newline("\n")] [] - 4: EOF@138..139 "" [Newline("\n")] [] --- -ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━ - - × 'public' modifier cannot appear on an index signature. - - 1 │ class A { - > 2 │ public [a: number]: string; - │ ^^^^^^ - 3 │ } - 4 │ class B { - --- -ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━ - - × 'private' modifier cannot appear on an index signature. - - 3 │ } - 4 │ class B { - > 5 │ private [a: number]: string; - │ ^^^^^^^ - 6 │ } - 7 │ class C { - --- -ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━ - - × 'protected' modifier cannot appear on an index signature. - - 6 │ } - 7 │ class C { - > 8 │ protected [a: number]: string; - │ ^^^^^^^^^ - 9 │ } - 10 │ - --- -class A { - public [a: number]: string; -} -class B { - private [a: number]: string; -} -class C { - protected [a: number]: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast b/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast deleted file mode 100644 index 39132728aeed..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast +++ /dev/null @@ -1,125 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsIndexSignatureModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@23..30 "static" [] [Whitespace(" ")], - }, - ], - L_BRACK@30..31 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@31..32 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@34..40 "number" [] [], - }, - }, - }, - R_BRACK@40..41 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@41..43 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@43..49 "string" [] [], - }, - }, - SEMICOLON@49..50 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@52..53 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..53 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..52 - 0: JS_CLASS_DECLARATION@0..52 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..50 - 0: JS_BOGUS_MEMBER@9..50 - 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@9..30 - 0: TS_READONLY_MODIFIER@9..23 - 0: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@23..30 - 0: STATIC_KW@23..30 "static" [] [Whitespace(" ")] - 1: L_BRACK@30..31 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@31..40 - 0: JS_IDENTIFIER_BINDING@31..32 - 0: IDENT@31..32 "a" [] [] - 1: TS_TYPE_ANNOTATION@32..40 - 0: COLON@32..34 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@34..40 - 0: NUMBER_KW@34..40 "number" [] [] - 3: R_BRACK@40..41 "]" [] [] - 4: TS_TYPE_ANNOTATION@41..49 - 0: COLON@41..43 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@43..49 - 0: STRING_KW@43..49 "string" [] [] - 5: SEMICOLON@49..50 ";" [] [] - 9: R_CURLY@50..52 "}" [Newline("\n")] [] - 4: EOF@52..53 "" [Newline("\n")] [] --- -ts_index_signature_class_member_static_readonly_precedence.ts:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'static' must precede 'readonly' - - 1 │ class A { - > 2 │ readonly static [a: number]: string; - │ ^^^^^^ - 3 │ } - 4 │ - - i move this modifier - - 1 │ class A { - > 2 │ readonly static [a: number]: string; - │ ^^^^^^ - 3 │ } - 4 │ - - i before this modifier - - 1 │ class A { - > 2 │ readonly static [a: number]: string; - │ ^^^^^^^^ - 3 │ } - 4 │ - --- -class A { - readonly static [a: number]: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast b/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast deleted file mode 100644 index 17b523506df3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast +++ /dev/null @@ -1,240 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - L_CURLY@12..13 "{" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - STATIC_KW@13..25 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - L_BRACK@25..26 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@26..31 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@31..33 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@33..39 "string" [] [], - }, - }, - }, - R_BRACK@39..40 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@40..42 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@42..48 "string" [] [], - }, - }, - ], - }, - ], - }, - R_CURLY@48..50 "}" [Newline("\n")] [], - ], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@50..61 "interface" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@61..63 "B" [] [Whitespace(" ")], - }, - L_CURLY@63..64 "{" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - PUBLIC_KW@64..76 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - L_BRACK@76..77 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@77..82 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@82..84 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@84..90 "string" [] [], - }, - }, - }, - R_BRACK@90..91 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@91..93 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@93..99 "string" [] [], - }, - }, - ], - }, - ], - }, - R_CURLY@99..101 "}" [Newline("\n")] [], - ], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@101..112 "interface" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@112..114 "C" [] [Whitespace(" ")], - }, - L_CURLY@114..115 "{" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - L_BRACK@128..129 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@129..134 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@134..136 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@136..142 "string" [] [], - }, - }, - }, - R_BRACK@142..143 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@143..145 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@145..151 "string" [] [], - }, - }, - ], - }, - ], - }, - R_CURLY@151..153 "}" [Newline("\n")] [], - ], - }, - ], - eof_token: EOF@153..154 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..154 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..153 - 0: JS_BOGUS_STATEMENT@0..50 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: L_CURLY@12..13 "{" [] [] - 3: JS_BOGUS@13..48 - 0: JS_BOGUS@13..48 - 0: STATIC_KW@13..25 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@25..26 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@26..39 - 0: JS_IDENTIFIER_BINDING@26..31 - 0: IDENT@26..31 "index" [] [] - 1: TS_TYPE_ANNOTATION@31..39 - 0: COLON@31..33 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@33..39 - 0: STRING_KW@33..39 "string" [] [] - 3: R_BRACK@39..40 "]" [] [] - 4: TS_TYPE_ANNOTATION@40..48 - 0: COLON@40..42 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@42..48 - 0: STRING_KW@42..48 "string" [] [] - 4: R_CURLY@48..50 "}" [Newline("\n")] [] - 1: JS_BOGUS_STATEMENT@50..101 - 0: INTERFACE_KW@50..61 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@61..63 - 0: IDENT@61..63 "B" [] [Whitespace(" ")] - 2: L_CURLY@63..64 "{" [] [] - 3: JS_BOGUS@64..99 - 0: JS_BOGUS@64..99 - 0: PUBLIC_KW@64..76 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@76..77 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@77..90 - 0: JS_IDENTIFIER_BINDING@77..82 - 0: IDENT@77..82 "index" [] [] - 1: TS_TYPE_ANNOTATION@82..90 - 0: COLON@82..84 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@84..90 - 0: STRING_KW@84..90 "string" [] [] - 3: R_BRACK@90..91 "]" [] [] - 4: TS_TYPE_ANNOTATION@91..99 - 0: COLON@91..93 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@93..99 - 0: STRING_KW@93..99 "string" [] [] - 4: R_CURLY@99..101 "}" [Newline("\n")] [] - 2: JS_BOGUS_STATEMENT@101..153 - 0: INTERFACE_KW@101..112 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@112..114 - 0: IDENT@112..114 "C" [] [Whitespace(" ")] - 2: L_CURLY@114..115 "{" [] [] - 3: JS_BOGUS@115..151 - 0: JS_BOGUS@115..151 - 0: PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@128..129 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@129..142 - 0: JS_IDENTIFIER_BINDING@129..134 - 0: IDENT@129..134 "index" [] [] - 1: TS_TYPE_ANNOTATION@134..142 - 0: COLON@134..136 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@136..142 - 0: STRING_KW@136..142 "string" [] [] - 3: R_BRACK@142..143 "]" [] [] - 4: TS_TYPE_ANNOTATION@143..151 - 0: COLON@143..145 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@145..151 - 0: STRING_KW@145..151 "string" [] [] - 4: R_CURLY@151..153 "}" [Newline("\n")] [] - 4: EOF@153..154 "" [Newline("\n")] [] --- -ts_index_signature_interface_member_cannot_be_static.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × index signature members cannot be static - - 1 │ interface A { - > 2 │ static [index: string]: string - │ ^^^^^^ - 3 │ } - 4 │ interface B { - --- -ts_index_signature_interface_member_cannot_be_static.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × index signature members cannot be public - - 3 │ } - 4 │ interface B { - > 5 │ public [index: string]: string - │ ^^^^^^ - 6 │ } - 7 │ interface C { - --- -ts_index_signature_interface_member_cannot_be_static.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × index signature members cannot be private - - 6 │ } - 7 │ interface C { - > 8 │ private [index: string]: string - │ ^^^^^^^ - 9 │ } - 10 │ - --- -interface A { - static [index: string]: string -} -interface B { - public [index: string]: string -} -interface C { - private [index: string]: string -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast b/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast deleted file mode 100644 index 1c5b93ac1b65..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast +++ /dev/null @@ -1,246 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - L_CURLY@12..13 "{" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - PUBLIC_KW@13..26 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - L_BRACK@26..27 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@27..28 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@30..36 "number" [] [], - }, - }, - }, - R_BRACK@36..37 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@37..39 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@39..45 "string" [] [], - }, - }, - SEMICOLON@45..46 ";" [] [], - ], - }, - ], - }, - R_CURLY@46..48 "}" [Newline("\n")] [], - ], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@48..59 "interface" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@59..61 "B" [] [Whitespace(" ")], - }, - L_CURLY@61..62 "{" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - PRIVATE_KW@62..76 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - L_BRACK@76..77 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@77..78 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@78..80 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@80..86 "number" [] [], - }, - }, - }, - R_BRACK@86..87 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@87..89 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@89..95 "string" [] [], - }, - }, - SEMICOLON@95..96 ";" [] [], - ], - }, - ], - }, - R_CURLY@96..98 "}" [Newline("\n")] [], - ], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@98..109 "interface" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@109..111 "C" [] [Whitespace(" ")], - }, - L_CURLY@111..112 "{" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - PROTECTED_KW@112..128 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - L_BRACK@128..129 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@129..130 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@130..132 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@132..138 "number" [] [], - }, - }, - }, - R_BRACK@138..139 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@139..141 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@141..147 "string" [] [], - }, - }, - SEMICOLON@147..148 ";" [] [], - ], - }, - ], - }, - R_CURLY@148..150 "}" [Newline("\n")] [], - ], - }, - ], - eof_token: EOF@150..151 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..151 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..150 - 0: JS_BOGUS_STATEMENT@0..48 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: L_CURLY@12..13 "{" [] [] - 3: JS_BOGUS@13..46 - 0: JS_BOGUS@13..46 - 0: PUBLIC_KW@13..26 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@26..27 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@27..36 - 0: JS_IDENTIFIER_BINDING@27..28 - 0: IDENT@27..28 "a" [] [] - 1: TS_TYPE_ANNOTATION@28..36 - 0: COLON@28..30 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@30..36 - 0: NUMBER_KW@30..36 "number" [] [] - 3: R_BRACK@36..37 "]" [] [] - 4: TS_TYPE_ANNOTATION@37..45 - 0: COLON@37..39 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@39..45 - 0: STRING_KW@39..45 "string" [] [] - 5: SEMICOLON@45..46 ";" [] [] - 4: R_CURLY@46..48 "}" [Newline("\n")] [] - 1: JS_BOGUS_STATEMENT@48..98 - 0: INTERFACE_KW@48..59 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@59..61 - 0: IDENT@59..61 "B" [] [Whitespace(" ")] - 2: L_CURLY@61..62 "{" [] [] - 3: JS_BOGUS@62..96 - 0: JS_BOGUS@62..96 - 0: PRIVATE_KW@62..76 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@76..77 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@77..86 - 0: JS_IDENTIFIER_BINDING@77..78 - 0: IDENT@77..78 "a" [] [] - 1: TS_TYPE_ANNOTATION@78..86 - 0: COLON@78..80 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@80..86 - 0: NUMBER_KW@80..86 "number" [] [] - 3: R_BRACK@86..87 "]" [] [] - 4: TS_TYPE_ANNOTATION@87..95 - 0: COLON@87..89 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@89..95 - 0: STRING_KW@89..95 "string" [] [] - 5: SEMICOLON@95..96 ";" [] [] - 4: R_CURLY@96..98 "}" [Newline("\n")] [] - 2: JS_BOGUS_STATEMENT@98..150 - 0: INTERFACE_KW@98..109 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@109..111 - 0: IDENT@109..111 "C" [] [Whitespace(" ")] - 2: L_CURLY@111..112 "{" [] [] - 3: JS_BOGUS@112..148 - 0: JS_BOGUS@112..148 - 0: PROTECTED_KW@112..128 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@128..129 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@129..138 - 0: JS_IDENTIFIER_BINDING@129..130 - 0: IDENT@129..130 "a" [] [] - 1: TS_TYPE_ANNOTATION@130..138 - 0: COLON@130..132 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@132..138 - 0: NUMBER_KW@132..138 "number" [] [] - 3: R_BRACK@138..139 "]" [] [] - 4: TS_TYPE_ANNOTATION@139..147 - 0: COLON@139..141 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@141..147 - 0: STRING_KW@141..147 "string" [] [] - 5: SEMICOLON@147..148 ";" [] [] - 4: R_CURLY@148..150 "}" [Newline("\n")] [] - 4: EOF@150..151 "" [Newline("\n")] [] --- -ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:2:5 parse ━━━━━━━━━━━━━━━━━━ - - × index signature members cannot be public - - 1 │ interface A { - > 2 │ public [a: number]: string; - │ ^^^^^^ - 3 │ } - 4 │ interface B { - --- -ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━ - - × index signature members cannot be private - - 3 │ } - 4 │ interface B { - > 5 │ private [a: number]: string; - │ ^^^^^^^ - 6 │ } - 7 │ interface C { - --- -ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━ - - × index signature members cannot be protected - - 6 │ } - 7 │ interface C { - > 8 │ protected [a: number]: string; - │ ^^^^^^^^^ - 9 │ } - 10 │ - --- -interface A { - public [a: number]: string; -} -interface B { - private [a: number]: string; -} -interface C { - protected [a: number]: string; -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast b/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast deleted file mode 100644 index a512341adea4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast +++ /dev/null @@ -1,1067 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..18 "WithSelectors" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@18..19 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@19..20 "S" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@24..26 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@26..34 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@36..44 "getState" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@44..46 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@46..47 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@49..52 "=>" [] [Whitespace(" ")], - return_type: TsInferType { - infer_token: INFER_KW@52..58 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@58..60 "T" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - question_mark_token: QUESTION@61..66 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - true_type: TsObjectType { - l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@68..71 "use" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@71..73 ":" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@75..76 "[" [] [], - property_name: TsTypeParameterName { - ident_token: IDENT@76..78 "K" [] [Whitespace(" ")], - }, - in_token: IN_KW@78..81 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@81..87 "keyof" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - INFER_KW@87..103 "infer" [] [Whitespace(" "), Comments("/*error*/"), Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@103..104 "T" [] [], - }, - ], - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@104..105 "]" [] [], - optional_modifier: missing (optional), - mapped_type: TsTypeAnnotation { - colon_token: COLON@105..107 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@107..108 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@110..113 "=>" [] [Whitespace(" ")], - return_type: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@113..114 "T" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@114..115 "[" [] [], - index_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@115..116 "K" [] [], - }, - type_arguments: missing (optional), - }, - r_brack_token: R_BRACK@116..118 "]" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - r_curly_token: R_CURLY@118..120 "}" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@120..121 "}" [] [], - }, - colon_token: COLON@121..126 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@126..131 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@131..132 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@132..138 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@138..142 "TV1" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@142..144 "=" [] [Whitespace(" ")], - ty: TsTemplateLiteralType { - l_tick_token: BACKTICK@144..145 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@145..147 "${" [] [], - ty: TsBogusType { - items: [ - INFER_KW@147..153 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@153..154 "X" [] [], - }, - ], - }, - r_curly_token: R_CURLY@154..155 "}" [] [], - }, - ], - r_tick_token: BACKTICK@155..156 "`" [] [], - }, - semicolon_token: SEMICOLON@156..157 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@163..166 "T61" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@166..167 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@167..168 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@168..170 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@170..172 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsParenthesizedType { - l_paren_token: L_PAREN@172..173 "(" [] [], - ty: TsBogusType { - items: [ - INFER_KW@173..179 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@179..180 "A" [] [], - }, - ], - }, - r_paren_token: R_PAREN@180..182 ")" [] [Whitespace(" ")], - }, - extends_token: EXTENDS_KW@182..190 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@190..196 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@196..198 "B" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@198..200 "?" [] [Whitespace(" ")], - true_type: TsBogusType { - items: [ - INFER_KW@200..206 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@206..208 "C" [] [Whitespace(" ")], - }, - ], - }, - colon_token: COLON@208..210 ":" [] [Whitespace(" ")], - false_type: TsBogusType { - items: [ - INFER_KW@210..216 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@216..217 "D" [] [], - }, - ], - }, - }, - semicolon_token: SEMICOLON@217..218 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@224..226 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@226..228 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@228..229 "{" [] [], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@229..230 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@230..232 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - INFER_KW@232..238 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@238..239 "T" [] [], - }, - ], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@239..240 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@240..246 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@246..248 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@248..250 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@250..251 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@251..253 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@253..256 "=>" [] [Whitespace(" ")], - return_type: TsBogusType { - items: [ - INFER_KW@256..262 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@262..263 "T" [] [], - }, - ], - }, - }, - semicolon_token: SEMICOLON@263..264 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@264..269 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@269..270 "s" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@270..272 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsParenthesizedType { - l_paren_token: L_PAREN@272..273 "(" [] [], - ty: TsBogusType { - items: [ - INFER_KW@273..279 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@279..285 "string" [] [], - }, - ], - }, - r_paren_token: R_PAREN@285..286 ")" [] [], - }, - l_brack_token: L_BRACK@286..287 "[" [] [], - r_brack_token: R_BRACK@287..289 "]" [] [Whitespace(" ")], - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@289..291 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@291..297 "symbol" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@297..298 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@298..299 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@299..300 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@300..305 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@305..306 "s" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@306..308 ":" [] [Whitespace(" ")], - ty: TsTypeOperatorType { - operator_token: UNIQUE_KW@308..315 "unique" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@315..316 "(" [] [], - ty: TsBogusType { - items: [ - INFER_KW@316..322 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@322..328 "string" [] [], - }, - ], - }, - r_paren_token: R_PAREN@328..329 ")" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@329..330 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@330..335 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@335..336 "s" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@336..338 ":" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@338..339 "[" [] [], - elements: TsTupleTypeElementList [ - TsNumberType { - number_token: NUMBER_KW@339..345 "number" [] [], - }, - COMMA@345..347 "," [] [Whitespace(" ")], - TsRestTupleTypeElement { - dotdotdot_token: DOT3@347..350 "..." [] [], - ty: TsBogusType { - items: [ - INFER_KW@350..356 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@356..362 "string" [] [], - }, - ], - }, - }, - ], - r_brack_token: R_BRACK@362..363 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@363..368 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@368..369 "s" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@369..371 ":" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@371..372 "[" [] [], - elements: TsTupleTypeElementList [ - TsOptionalTupleTypeElement { - ty: TsParenthesizedType { - l_paren_token: L_PAREN@372..373 "(" [] [], - ty: TsBogusType { - items: [ - INFER_KW@373..379 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@379..385 "string" [] [], - }, - ], - }, - r_paren_token: R_PAREN@385..386 ")" [] [], - }, - question_mark_token: QUESTION@386..387 "?" [] [], - }, - ], - r_brack_token: R_BRACK@387..388 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@388..393 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@393..394 "s" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@394..396 ":" [] [Whitespace(" ")], - ty: TsIndexedAccessType { - object_type: TsParenthesizedType { - l_paren_token: L_PAREN@396..397 "(" [] [], - ty: TsBogusType { - items: [ - INFER_KW@397..403 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@403..409 "string" [] [], - }, - ], - }, - r_paren_token: R_PAREN@409..410 ")" [] [], - }, - l_brack_token: L_BRACK@410..411 "[" [] [], - index_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@411..412 "a" [] [], - }, - type_arguments: missing (optional), - }, - r_brack_token: R_BRACK@412..413 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@413..418 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@418..419 "s" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@419..421 ":" [] [Whitespace(" ")], - ty: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@421..422 "a" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@422..423 "[" [] [], - index_type: TsParenthesizedType { - l_paren_token: L_PAREN@423..424 "(" [] [], - ty: TsBogusType { - items: [ - INFER_KW@424..430 "infer" [] [Whitespace(" ")], - TsTypeParameterName { - ident_token: IDENT@430..436 "string" [] [], - }, - ], - }, - r_paren_token: R_PAREN@436..437 ")" [] [], - }, - r_brack_token: R_BRACK@437..438 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@438..439 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..439 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..438 - 0: TS_TYPE_ALIAS_DECLARATION@0..132 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..18 - 0: IDENT@5..18 "WithSelectors" [] [] - 2: TS_TYPE_PARAMETERS@18..22 - 0: L_ANGLE@18..19 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@19..20 - 0: TS_TYPE_PARAMETER@19..20 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 - 1: TS_TYPE_PARAMETER_NAME@19..20 - 0: IDENT@19..20 "S" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] - 3: EQ@22..24 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@24..131 - 0: TS_REFERENCE_TYPE@24..26 - 0: JS_REFERENCE_IDENTIFIER@24..26 - 0: IDENT@24..26 "S" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@26..34 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@34..61 - 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@36..60 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@36..60 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@36..44 - 0: IDENT@36..44 "getState" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@44..60 - 0: COLON@44..46 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@46..60 - 0: (empty) - 1: JS_PARAMETERS@46..49 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_PARAMETER_LIST@47..47 - 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@49..52 "=>" [] [Whitespace(" ")] - 3: TS_INFER_TYPE@52..60 - 0: INFER_KW@52..58 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@58..60 - 0: IDENT@58..60 "T" [] [Whitespace(" ")] - 2: (empty) - 4: (empty) - 2: R_CURLY@60..61 "}" [] [] - 3: QUESTION@61..66 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@66..121 - 0: L_CURLY@66..68 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@68..120 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@68..120 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@68..71 - 0: IDENT@68..71 "use" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@71..120 - 0: COLON@71..73 ":" [] [Whitespace(" ")] - 1: TS_MAPPED_TYPE@73..120 - 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] - 1: (empty) - 2: L_BRACK@75..76 "[" [] [] - 3: TS_TYPE_PARAMETER_NAME@76..78 - 0: IDENT@76..78 "K" [] [Whitespace(" ")] - 4: IN_KW@78..81 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@81..104 - 0: KEYOF_KW@81..87 "keyof" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@87..104 - 0: INFER_KW@87..103 "infer" [] [Whitespace(" "), Comments("/*error*/"), Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@103..104 - 0: IDENT@103..104 "T" [] [] - 6: (empty) - 7: R_BRACK@104..105 "]" [] [] - 8: (empty) - 9: TS_TYPE_ANNOTATION@105..118 - 0: COLON@105..107 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@107..118 - 0: (empty) - 1: JS_PARAMETERS@107..110 - 0: L_PAREN@107..108 "(" [] [] - 1: JS_PARAMETER_LIST@108..108 - 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@110..113 "=>" [] [Whitespace(" ")] - 3: TS_INDEXED_ACCESS_TYPE@113..118 - 0: TS_REFERENCE_TYPE@113..114 - 0: JS_REFERENCE_IDENTIFIER@113..114 - 0: IDENT@113..114 "T" [] [] - 1: (empty) - 1: L_BRACK@114..115 "[" [] [] - 2: TS_REFERENCE_TYPE@115..116 - 0: JS_REFERENCE_IDENTIFIER@115..116 - 0: IDENT@115..116 "K" [] [] - 1: (empty) - 3: R_BRACK@116..118 "]" [] [Whitespace(" ")] - 10: (empty) - 11: R_CURLY@118..120 "}" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@120..121 "}" [] [] - 5: COLON@121..126 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_NEVER_TYPE@126..131 - 0: NEVER_KW@126..131 "never" [] [] - 5: SEMICOLON@131..132 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@132..157 - 0: TYPE_KW@132..138 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@138..142 - 0: IDENT@138..142 "TV1" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@142..144 "=" [] [Whitespace(" ")] - 4: TS_TEMPLATE_LITERAL_TYPE@144..156 - 0: BACKTICK@144..145 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@145..155 - 0: TS_TEMPLATE_ELEMENT@145..155 - 0: DOLLAR_CURLY@145..147 "${" [] [] - 1: TS_BOGUS_TYPE@147..154 - 0: INFER_KW@147..153 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@153..154 - 0: IDENT@153..154 "X" [] [] - 2: R_CURLY@154..155 "}" [] [] - 2: BACKTICK@155..156 "`" [] [] - 5: SEMICOLON@156..157 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@157..218 - 0: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@163..166 - 0: IDENT@163..166 "T61" [] [] - 2: TS_TYPE_PARAMETERS@166..170 - 0: L_ANGLE@166..167 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@167..168 - 0: TS_TYPE_PARAMETER@167..168 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@167..167 - 1: TS_TYPE_PARAMETER_NAME@167..168 - 0: IDENT@167..168 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@168..170 ">" [] [Whitespace(" ")] - 3: EQ@170..172 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@172..217 - 0: TS_PARENTHESIZED_TYPE@172..182 - 0: L_PAREN@172..173 "(" [] [] - 1: TS_BOGUS_TYPE@173..180 - 0: INFER_KW@173..179 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@179..180 - 0: IDENT@179..180 "A" [] [] - 2: R_PAREN@180..182 ")" [] [Whitespace(" ")] - 1: EXTENDS_KW@182..190 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@190..198 - 0: INFER_KW@190..196 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@196..198 - 0: IDENT@196..198 "B" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@198..200 "?" [] [Whitespace(" ")] - 4: TS_BOGUS_TYPE@200..208 - 0: INFER_KW@200..206 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@206..208 - 0: IDENT@206..208 "C" [] [Whitespace(" ")] - 5: COLON@208..210 ":" [] [Whitespace(" ")] - 6: TS_BOGUS_TYPE@210..217 - 0: INFER_KW@210..216 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@216..217 - 0: IDENT@216..217 "D" [] [] - 5: SEMICOLON@217..218 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@218..240 - 0: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@224..226 - 0: IDENT@224..226 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@226..228 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@228..240 - 0: L_CURLY@228..229 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@229..239 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@229..239 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@229..230 - 0: IDENT@229..230 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@230..239 - 0: COLON@230..232 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@232..239 - 0: INFER_KW@232..238 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@238..239 - 0: IDENT@238..239 "T" [] [] - 4: (empty) - 2: R_CURLY@239..240 "}" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@240..264 - 0: TYPE_KW@240..246 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@246..248 - 0: IDENT@246..248 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@248..250 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@250..263 - 0: (empty) - 1: JS_PARAMETERS@250..253 - 0: L_PAREN@250..251 "(" [] [] - 1: JS_PARAMETER_LIST@251..251 - 2: R_PAREN@251..253 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@253..256 "=>" [] [Whitespace(" ")] - 3: TS_BOGUS_TYPE@256..263 - 0: INFER_KW@256..262 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@262..263 - 0: IDENT@262..263 "T" [] [] - 5: SEMICOLON@263..264 ";" [] [] - 5: JS_VARIABLE_STATEMENT@264..300 - 0: JS_VARIABLE_DECLARATION@264..299 - 0: (empty) - 1: LET_KW@264..269 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@269..299 - 0: JS_VARIABLE_DECLARATOR@269..299 - 0: JS_IDENTIFIER_BINDING@269..270 - 0: IDENT@269..270 "s" [] [] - 1: TS_TYPE_ANNOTATION@270..289 - 0: COLON@270..272 ":" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@272..289 - 0: TS_PARENTHESIZED_TYPE@272..286 - 0: L_PAREN@272..273 "(" [] [] - 1: TS_BOGUS_TYPE@273..285 - 0: INFER_KW@273..279 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@279..285 - 0: IDENT@279..285 "string" [] [] - 2: R_PAREN@285..286 ")" [] [] - 1: L_BRACK@286..287 "[" [] [] - 2: R_BRACK@287..289 "]" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@289..299 - 0: EQ@289..291 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@291..299 - 0: JS_IDENTIFIER_EXPRESSION@291..297 - 0: JS_REFERENCE_IDENTIFIER@291..297 - 0: IDENT@291..297 "symbol" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@297..299 - 0: L_PAREN@297..298 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@298..298 - 2: R_PAREN@298..299 ")" [] [] - 1: SEMICOLON@299..300 ";" [] [] - 6: JS_VARIABLE_STATEMENT@300..330 - 0: JS_VARIABLE_DECLARATION@300..329 - 0: (empty) - 1: LET_KW@300..305 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@305..329 - 0: JS_VARIABLE_DECLARATOR@305..329 - 0: JS_IDENTIFIER_BINDING@305..306 - 0: IDENT@305..306 "s" [] [] - 1: TS_TYPE_ANNOTATION@306..329 - 0: COLON@306..308 ":" [] [Whitespace(" ")] - 1: TS_TYPE_OPERATOR_TYPE@308..329 - 0: UNIQUE_KW@308..315 "unique" [] [Whitespace(" ")] - 1: TS_PARENTHESIZED_TYPE@315..329 - 0: L_PAREN@315..316 "(" [] [] - 1: TS_BOGUS_TYPE@316..328 - 0: INFER_KW@316..322 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@322..328 - 0: IDENT@322..328 "string" [] [] - 2: R_PAREN@328..329 ")" [] [] - 2: (empty) - 1: SEMICOLON@329..330 ";" [] [] - 7: JS_VARIABLE_STATEMENT@330..363 - 0: JS_VARIABLE_DECLARATION@330..363 - 0: (empty) - 1: LET_KW@330..335 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@335..363 - 0: JS_VARIABLE_DECLARATOR@335..363 - 0: JS_IDENTIFIER_BINDING@335..336 - 0: IDENT@335..336 "s" [] [] - 1: TS_TYPE_ANNOTATION@336..363 - 0: COLON@336..338 ":" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@338..363 - 0: L_BRACK@338..339 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@339..362 - 0: TS_NUMBER_TYPE@339..345 - 0: NUMBER_KW@339..345 "number" [] [] - 1: COMMA@345..347 "," [] [Whitespace(" ")] - 2: TS_REST_TUPLE_TYPE_ELEMENT@347..362 - 0: DOT3@347..350 "..." [] [] - 1: TS_BOGUS_TYPE@350..362 - 0: INFER_KW@350..356 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@356..362 - 0: IDENT@356..362 "string" [] [] - 2: R_BRACK@362..363 "]" [] [] - 2: (empty) - 1: (empty) - 8: JS_VARIABLE_STATEMENT@363..388 - 0: JS_VARIABLE_DECLARATION@363..388 - 0: (empty) - 1: LET_KW@363..368 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@368..388 - 0: JS_VARIABLE_DECLARATOR@368..388 - 0: JS_IDENTIFIER_BINDING@368..369 - 0: IDENT@368..369 "s" [] [] - 1: TS_TYPE_ANNOTATION@369..388 - 0: COLON@369..371 ":" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@371..388 - 0: L_BRACK@371..372 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@372..387 - 0: TS_OPTIONAL_TUPLE_TYPE_ELEMENT@372..387 - 0: TS_PARENTHESIZED_TYPE@372..386 - 0: L_PAREN@372..373 "(" [] [] - 1: TS_BOGUS_TYPE@373..385 - 0: INFER_KW@373..379 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@379..385 - 0: IDENT@379..385 "string" [] [] - 2: R_PAREN@385..386 ")" [] [] - 1: QUESTION@386..387 "?" [] [] - 2: R_BRACK@387..388 "]" [] [] - 2: (empty) - 1: (empty) - 9: JS_VARIABLE_STATEMENT@388..413 - 0: JS_VARIABLE_DECLARATION@388..413 - 0: (empty) - 1: LET_KW@388..393 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@393..413 - 0: JS_VARIABLE_DECLARATOR@393..413 - 0: JS_IDENTIFIER_BINDING@393..394 - 0: IDENT@393..394 "s" [] [] - 1: TS_TYPE_ANNOTATION@394..413 - 0: COLON@394..396 ":" [] [Whitespace(" ")] - 1: TS_INDEXED_ACCESS_TYPE@396..413 - 0: TS_PARENTHESIZED_TYPE@396..410 - 0: L_PAREN@396..397 "(" [] [] - 1: TS_BOGUS_TYPE@397..409 - 0: INFER_KW@397..403 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@403..409 - 0: IDENT@403..409 "string" [] [] - 2: R_PAREN@409..410 ")" [] [] - 1: L_BRACK@410..411 "[" [] [] - 2: TS_REFERENCE_TYPE@411..412 - 0: JS_REFERENCE_IDENTIFIER@411..412 - 0: IDENT@411..412 "a" [] [] - 1: (empty) - 3: R_BRACK@412..413 "]" [] [] - 2: (empty) - 1: (empty) - 10: JS_VARIABLE_STATEMENT@413..438 - 0: JS_VARIABLE_DECLARATION@413..438 - 0: (empty) - 1: LET_KW@413..418 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@418..438 - 0: JS_VARIABLE_DECLARATOR@418..438 - 0: JS_IDENTIFIER_BINDING@418..419 - 0: IDENT@418..419 "s" [] [] - 1: TS_TYPE_ANNOTATION@419..438 - 0: COLON@419..421 ":" [] [Whitespace(" ")] - 1: TS_INDEXED_ACCESS_TYPE@421..438 - 0: TS_REFERENCE_TYPE@421..422 - 0: JS_REFERENCE_IDENTIFIER@421..422 - 0: IDENT@421..422 "a" [] [] - 1: (empty) - 1: L_BRACK@422..423 "[" [] [] - 2: TS_PARENTHESIZED_TYPE@423..437 - 0: L_PAREN@423..424 "(" [] [] - 1: TS_BOGUS_TYPE@424..436 - 0: INFER_KW@424..430 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@430..436 - 0: IDENT@430..436 "string" [] [] - 2: R_PAREN@436..437 ")" [] [] - 3: R_BRACK@437..438 "]" [] [] - 2: (empty) - 1: (empty) - 4: EOF@438..439 "" [Newline("\n")] [] --- -ts_infer_type_not_allowed.ts:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 1 │ type WithSelectors = S extends { getState: () => infer T } - > 2 │ ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } - │ ^^^^^^^^^^^^^^^^^ - 3 │ : never; - 4 │ type TV1 = `${infer X}`; - --- -ts_infer_type_not_allowed.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 2 │ ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } - 3 │ : never; - > 4 │ type TV1 = `${infer X}`; - │ ^^^^^^^ - 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; - 6 │ type A = {a: infer T} - --- -ts_infer_type_not_allowed.ts:5:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 3 │ : never; - 4 │ type TV1 = `${infer X}`; - > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; - │ ^^^^^^^ - 6 │ type A = {a: infer T} - 7 │ type A = () => infer T; - --- -ts_infer_type_not_allowed.ts:5:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 3 │ : never; - 4 │ type TV1 = `${infer X}`; - > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; - │ ^^^^^^^ - 6 │ type A = {a: infer T} - 7 │ type A = () => infer T; - --- -ts_infer_type_not_allowed.ts:5:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 3 │ : never; - 4 │ type TV1 = `${infer X}`; - > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; - │ ^^^^^^^ - 6 │ type A = {a: infer T} - 7 │ type A = () => infer T; - --- -ts_infer_type_not_allowed.ts:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 4 │ type TV1 = `${infer X}`; - 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; - > 6 │ type A = {a: infer T} - │ ^^^^^^^ - 7 │ type A = () => infer T; - 8 │ let s: (infer string)[] = symbol(); - --- -ts_infer_type_not_allowed.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; - 6 │ type A = {a: infer T} - > 7 │ type A = () => infer T; - │ ^^^^^^^ - 8 │ let s: (infer string)[] = symbol(); - 9 │ let s: unique (infer string); - --- -ts_infer_type_not_allowed.ts:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 6 │ type A = {a: infer T} - 7 │ type A = () => infer T; - > 8 │ let s: (infer string)[] = symbol(); - │ ^^^^^^^^^^^^ - 9 │ let s: unique (infer string); - 10 │ let s: [number, ...infer string] - --- -ts_infer_type_not_allowed.ts:9:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 7 │ type A = () => infer T; - 8 │ let s: (infer string)[] = symbol(); - > 9 │ let s: unique (infer string); - │ ^^^^^^^^^^^^ - 10 │ let s: [number, ...infer string] - 11 │ let s: [(infer string)?] - --- -ts_infer_type_not_allowed.ts:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 8 │ let s: (infer string)[] = symbol(); - 9 │ let s: unique (infer string); - > 10 │ let s: [number, ...infer string] - │ ^^^^^^^^^^^^ - 11 │ let s: [(infer string)?] - 12 │ let s: (infer string)[a] - --- -ts_infer_type_not_allowed.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 9 │ let s: unique (infer string); - 10 │ let s: [number, ...infer string] - > 11 │ let s: [(infer string)?] - │ ^^^^^^^^^^^^ - 12 │ let s: (infer string)[a] - 13 │ let s: a[(infer string)] - --- -ts_infer_type_not_allowed.ts:12:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 10 │ let s: [number, ...infer string] - 11 │ let s: [(infer string)?] - > 12 │ let s: (infer string)[a] - │ ^^^^^^^^^^^^ - 13 │ let s: a[(infer string)] - 14 │ - --- -ts_infer_type_not_allowed.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - - 11 │ let s: [(infer string)?] - 12 │ let s: (infer string)[a] - > 13 │ let s: a[(infer string)] - │ ^^^^^^^^^^^^ - 14 │ - --- -type WithSelectors = S extends { getState: () => infer T } - ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } - : never; -type TV1 = `${infer X}`; -type T61 = (infer A) extends infer B ? infer C : infer D; -type A = {a: infer T} -type A = () => infer T; -let s: (infer string)[] = symbol(); -let s: unique (infer string); -let s: [number, ...infer string] -let s: [(infer string)?] -let s: (infer string)[a] -let s: a[(infer string)] diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.rast b/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.rast deleted file mode 100644 index d04ee0e60cf2..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.rast +++ /dev/null @@ -1,289 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..1 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1..2 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2..3 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@3..4 ">" [] [], - }, - }, - operator_token: DOT@4..5 "." [] [], - member: JsName { - value_token: IDENT@5..6 "c" [] [], - }, - }, - semicolon_token: SEMICOLON@6..7 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..9 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@9..10 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@10..11 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@11..12 ">" [] [], - }, - }, - operator_token: QUESTIONDOT@12..14 "?." [] [], - member: JsName { - value_token: IDENT@14..15 "c" [] [], - }, - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: TsInstantiationExpression { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..18 "a" [Newline("\n")] [], - }, - }, - operator_token: QUESTIONDOT@18..20 "?." [] [], - member: JsName { - value_token: IDENT@20..21 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@21..22 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@22..23 "c" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@23..24 ">" [] [], - }, - }, - operator_token: DOT@24..25 "." [] [], - member: JsName { - value_token: IDENT@25..26 "d" [] [], - }, - }, - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsStaticMemberExpression { - object: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..29 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@29..30 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@30..31 "a" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@31..32 ">" [] [], - }, - }, - operator_token: DOT@32..33 "." [] [], - member: JsName { - value_token: IDENT@33..34 "g" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@34..35 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - ], - eof_token: EOF@38..39 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..39 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..38 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JS_STATIC_MEMBER_EXPRESSION@0..6 - 0: TS_INSTANTIATION_EXPRESSION@0..4 - 0: JS_IDENTIFIER_EXPRESSION@0..1 - 0: JS_REFERENCE_IDENTIFIER@0..1 - 0: IDENT@0..1 "f" [] [] - 1: TS_TYPE_ARGUMENTS@1..4 - 0: L_ANGLE@1..2 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@2..3 - 0: TS_REFERENCE_TYPE@2..3 - 0: JS_REFERENCE_IDENTIFIER@2..3 - 0: IDENT@2..3 "b" [] [] - 1: (empty) - 2: R_ANGLE@3..4 ">" [] [] - 1: DOT@4..5 "." [] [] - 2: JS_NAME@5..6 - 0: IDENT@5..6 "c" [] [] - 1: SEMICOLON@6..7 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@7..16 - 0: JS_STATIC_MEMBER_EXPRESSION@7..15 - 0: TS_INSTANTIATION_EXPRESSION@7..12 - 0: JS_IDENTIFIER_EXPRESSION@7..9 - 0: JS_REFERENCE_IDENTIFIER@7..9 - 0: IDENT@7..9 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@9..12 - 0: L_ANGLE@9..10 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@10..11 - 0: TS_REFERENCE_TYPE@10..11 - 0: JS_REFERENCE_IDENTIFIER@10..11 - 0: IDENT@10..11 "b" [] [] - 1: (empty) - 2: R_ANGLE@11..12 ">" [] [] - 1: QUESTIONDOT@12..14 "?." [] [] - 2: JS_NAME@14..15 - 0: IDENT@14..15 "c" [] [] - 1: SEMICOLON@15..16 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@16..27 - 0: JS_STATIC_MEMBER_EXPRESSION@16..26 - 0: TS_INSTANTIATION_EXPRESSION@16..24 - 0: JS_STATIC_MEMBER_EXPRESSION@16..21 - 0: JS_IDENTIFIER_EXPRESSION@16..18 - 0: JS_REFERENCE_IDENTIFIER@16..18 - 0: IDENT@16..18 "a" [Newline("\n")] [] - 1: QUESTIONDOT@18..20 "?." [] [] - 2: JS_NAME@20..21 - 0: IDENT@20..21 "f" [] [] - 1: TS_TYPE_ARGUMENTS@21..24 - 0: L_ANGLE@21..22 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@22..23 - 0: TS_REFERENCE_TYPE@22..23 - 0: JS_REFERENCE_IDENTIFIER@22..23 - 0: IDENT@22..23 "c" [] [] - 1: (empty) - 2: R_ANGLE@23..24 ">" [] [] - 1: DOT@24..25 "." [] [] - 2: JS_NAME@25..26 - 0: IDENT@25..26 "d" [] [] - 1: SEMICOLON@26..27 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@27..38 - 0: TS_INSTANTIATION_EXPRESSION@27..37 - 0: JS_STATIC_MEMBER_EXPRESSION@27..34 - 0: TS_INSTANTIATION_EXPRESSION@27..32 - 0: JS_IDENTIFIER_EXPRESSION@27..29 - 0: JS_REFERENCE_IDENTIFIER@27..29 - 0: IDENT@27..29 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@29..32 - 0: L_ANGLE@29..30 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@30..31 - 0: TS_REFERENCE_TYPE@30..31 - 0: JS_REFERENCE_IDENTIFIER@30..31 - 0: IDENT@30..31 "a" [] [] - 1: (empty) - 2: R_ANGLE@31..32 ">" [] [] - 1: DOT@32..33 "." [] [] - 2: JS_NAME@33..34 - 0: IDENT@33..34 "g" [] [] - 1: TS_TYPE_ARGUMENTS@34..37 - 0: L_ANGLE@34..35 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@35..36 - 0: TS_REFERENCE_TYPE@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "b" [] [] - 1: (empty) - 2: R_ANGLE@36..37 ">" [] [] - 1: SEMICOLON@37..38 ";" [] [] - 4: EOF@38..39 "" [Newline("\n")] [] --- -ts_instantiation_expression_property_access.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An instantiation expression cannot be followed by a property access. - - > 1 │ f.c; - │ ^^^^ - 2 │ f?.c; - 3 │ a?.f.d; - - i You can either wrap the instantiation expression in parentheses, or delete the type arguments. - --- -ts_instantiation_expression_property_access.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An instantiation expression cannot be followed by a property access. - - 1 │ f.c; - > 2 │ f?.c; - │ ^^^^ - 3 │ a?.f.d; - 4 │ f.g; - - i You can either wrap the instantiation expression in parentheses, or delete the type arguments. - --- -ts_instantiation_expression_property_access.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An instantiation expression cannot be followed by a property access. - - 1 │ f.c; - 2 │ f?.c; - > 3 │ a?.f.d; - │ ^^^^^^^ - 4 │ f.g; - 5 │ - - i You can either wrap the instantiation expression in parentheses, or delete the type arguments. - --- -ts_instantiation_expression_property_access.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An instantiation expression cannot be followed by a property access. - - 2 │ f?.c; - 3 │ a?.f.d; - > 4 │ f.g; - │ ^^^^ - 5 │ - - i You can either wrap the instantiation expression in parentheses, or delete the type arguments. - --- -f.c; -f?.c; -a?.f.d; -f.g; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast b/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast deleted file mode 100644 index b0ff4b61f0cf..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast +++ /dev/null @@ -1,1697 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..9 "a8" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@9..11 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..12 "f" [] [], - }, - }, - operator_token: L_ANGLE@12..13 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..19 "number" [] [], - }, - }, - }, - operator_token: R_ANGLE@19..20 ">" [] [], - right: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@20..21 "<" [] [], - ty: TsNumberType { - number_token: NUMBER_KW@21..27 "number" [] [], - }, - r_angle_token: R_ANGLE@27..28 ">" [] [], - expression: missing (required), - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@28..59 ";" [] [Whitespace(" "), Comments("// Relational operato ...")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@59..66 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@66..69 "b1" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@69..71 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@71..72 "f" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@72..74 "?." [] [], - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@74..75 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@75..81 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@81..82 ">" [] [], - }, - arguments: missing (required), - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@82..107 ";" [] [Whitespace(" "), Comments("// Error, `(` expected")], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@107..109 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@109..110 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@110..111 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@111..113 ">" [] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@113..114 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBogusType { - items: [ - JsBogus { - items: [ - L_ANGLE@114..116 "<" [] [Whitespace(" ")], - JsBogus { - items: [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@116..117 "f" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - TsTypeParameterModifierList [], - ], - }, - ], - }, - TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@117..118 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@118..119 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@119..120 ">" [] [], - }, - parameters: missing (required), - fat_arrow_token: missing (required), - return_type: missing (required), - }, - ], - }, - ], - r_angle_token: missing (required), - }, - }, - semicolon_token: SEMICOLON@120..121 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@121..123 "f" [Newline("\n")] [], - }, - }, - TsTypeArguments { - l_angle_token: L_ANGLE@123..124 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@124..125 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@125..127 ">" [] [Whitespace(" ")], - }, - ], - }, - operator_token: EQ@127..129 "=" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@129..130 "g" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@130..131 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@131..132 "K" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@132..133 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@133..134 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@134..136 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@136..137 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..138 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@138..140 ">" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: missing (required), - operator_token: SHR@140..143 ">>" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@143..144 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@144..145 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@145..146 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@146..147 ">" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@147..148 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@148..150 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@150..151 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@151..152 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@152..154 ">" [] [Whitespace(" ")], - right: missing (required), - }, - operator_token: GTEQ@154..157 ">=" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@157..158 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@158..159 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@159..160 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@160..161 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@161..162 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@162..164 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@164..165 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@165..166 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@166..168 ">" [] [Whitespace(" ")], - right: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@168..170 "<" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@170..171 "f" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@171..172 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@172..173 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@173..174 ">" [] [], - }, - }, - r_angle_token: missing (required), - expression: missing (required), - }, - }, - semicolon_token: SEMICOLON@174..175 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@175..177 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@177..178 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@178..179 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@179..181 ">" [] [Whitespace(" ")], - right: missing (required), - }, - operator_token: R_ANGLE@181..183 ">" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@183..184 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@184..185 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@185..186 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@186..187 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@187..188 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@188..190 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@190..191 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@191..192 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@192..194 ">" [] [Whitespace(" ")], - right: missing (required), - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@194..200 "import" [] [], - import_clause: missing (required), - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@200..201 "<" [] [], - ty: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@201..202 "1" [] [], - }, - r_angle_token: R_ANGLE@202..203 ">" [] [], - expression: missing (required), - }, - semicolon_token: SEMICOLON@203..204 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@204..206 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@206..207 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@207..208 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@208..210 ">" [] [Whitespace(" ")], - right: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@210..215 "yield" [] [], - ], - }, - ], - }, - }, - semicolon_token: SEMICOLON@215..216 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@216..218 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@218..219 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@219..220 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@220..222 ">" [] [Whitespace(" ")], - right: JsPreUpdateExpression { - operator_token: PLUS2@222..224 "++" [] [], - operand: missing (required), - }, - }, - semicolon_token: SEMICOLON@224..225 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@225..227 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@227..228 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@228..229 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@229..231 ">" [] [Whitespace(" ")], - right: JsPreUpdateExpression { - operator_token: MINUS2@231..233 "--" [] [], - operand: missing (required), - }, - }, - semicolon_token: SEMICOLON@233..234 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@234..236 "f" [Newline("\n")] [], - }, - }, - operator_token: L_ANGLE@236..237 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@237..238 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@238..240 ">" [] [Whitespace(" ")], - right: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@240..245 "/= 1;" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@245..247 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@247..248 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@248..249 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@249..251 ">" [] [Whitespace(" ")], - }, - }, - operator_token: LTEQ@251..254 "<=" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@254..255 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@255..256 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@256..257 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@257..258 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@258..259 ";" [] [], - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@259..262 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@262..263 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@263..264 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@264..265 ">" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@265..267 "[" [Newline("\n")] [], - member: missing (required), - r_brack_token: R_BRACK@267..268 "]" [] [], - }, - semicolon_token: SEMICOLON@268..269 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@269..271 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@271..272 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@272..273 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@273..274 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@274..278 "as" [Newline("\n")] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@278..279 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@279..280 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@280..281 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@281..283 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@283..284 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@284..285 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@285..286 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@286..297 "satisfies" [Newline("\n")] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@297..298 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@298..299 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@299..300 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@300..307 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@307..310 "C5" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@310..311 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@311..326 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@326..337 "specialFoo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@337..339 "=" [] [Whitespace(" ")], - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@339..340 "f" [] [], - }, - }, - operator_token: L_ANGLE@340..341 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@341..347 "string" [] [], - }, - }, - }, - R_ANGLE@347..349 ">" [] [Whitespace(" ")], - JsBogusExpression { - items: [ - HASH@349..350 "#" [] [], - IDENT@350..354 "bar" [] [Whitespace(" ")], - ], - }, - ], - }, - operator_token: EQ@354..356 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@356..359 "123" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@359..361 "}" [Newline("\n")] [], - }, - JsForInStatement { - for_token: FOR_KW@361..366 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@366..367 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: CONST_KW@367..373 "const" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@373..375 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@375..377 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@377..378 "b" [] [], - }, - }, - operator_token: DOT@378..379 "." [] [], - member: JsName { - value_token: IDENT@379..383 "test" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@383..384 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@384..390 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@390..392 ">" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - in_token: IN_KW@392..395 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@395..396 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@396..397 "]" [] [], - }, - r_paren_token: R_PAREN@397..399 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@399..400 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@400..401 "}" [] [], - }, - }, - ], - eof_token: EOF@401..402 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..402 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..401 - 0: JS_VARIABLE_STATEMENT@0..59 - 0: JS_VARIABLE_DECLARATION@0..28 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..28 - 0: JS_VARIABLE_DECLARATOR@6..28 - 0: JS_IDENTIFIER_BINDING@6..9 - 0: IDENT@6..9 "a8" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@9..28 - 0: EQ@9..11 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@11..28 - 0: JS_BINARY_EXPRESSION@11..19 - 0: JS_IDENTIFIER_EXPRESSION@11..12 - 0: JS_REFERENCE_IDENTIFIER@11..12 - 0: IDENT@11..12 "f" [] [] - 1: L_ANGLE@12..13 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@13..19 - 0: JS_REFERENCE_IDENTIFIER@13..19 - 0: IDENT@13..19 "number" [] [] - 1: R_ANGLE@19..20 ">" [] [] - 2: TS_TYPE_ASSERTION_EXPRESSION@20..28 - 0: L_ANGLE@20..21 "<" [] [] - 1: TS_NUMBER_TYPE@21..27 - 0: NUMBER_KW@21..27 "number" [] [] - 2: R_ANGLE@27..28 ">" [] [] - 3: (empty) - 1: SEMICOLON@28..59 ";" [] [Whitespace(" "), Comments("// Relational operato ...")] - 1: JS_VARIABLE_STATEMENT@59..107 - 0: JS_VARIABLE_DECLARATION@59..82 - 0: (empty) - 1: CONST_KW@59..66 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@66..82 - 0: JS_VARIABLE_DECLARATOR@66..82 - 0: JS_IDENTIFIER_BINDING@66..69 - 0: IDENT@66..69 "b1" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@69..82 - 0: EQ@69..71 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@71..82 - 0: JS_IDENTIFIER_EXPRESSION@71..72 - 0: JS_REFERENCE_IDENTIFIER@71..72 - 0: IDENT@71..72 "f" [] [] - 1: QUESTIONDOT@72..74 "?." [] [] - 2: TS_TYPE_ARGUMENTS@74..82 - 0: L_ANGLE@74..75 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@75..81 - 0: TS_NUMBER_TYPE@75..81 - 0: NUMBER_KW@75..81 "number" [] [] - 2: R_ANGLE@81..82 ">" [] [] - 3: (empty) - 1: SEMICOLON@82..107 ";" [] [Whitespace(" "), Comments("// Error, `(` expected")] - 2: JS_EXPRESSION_STATEMENT@107..121 - 0: TS_INSTANTIATION_EXPRESSION@107..120 - 0: TS_INSTANTIATION_EXPRESSION@107..113 - 0: JS_IDENTIFIER_EXPRESSION@107..109 - 0: JS_REFERENCE_IDENTIFIER@107..109 - 0: IDENT@107..109 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@109..113 - 0: L_ANGLE@109..110 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@110..111 - 0: TS_REFERENCE_TYPE@110..111 - 0: JS_REFERENCE_IDENTIFIER@110..111 - 0: IDENT@110..111 "T" [] [] - 1: (empty) - 2: R_ANGLE@111..113 ">" [] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@113..120 - 0: L_ANGLE@113..114 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@114..120 - 0: TS_BOGUS_TYPE@114..120 - 0: JS_BOGUS@114..117 - 0: L_ANGLE@114..116 "<" [] [Whitespace(" ")] - 1: JS_BOGUS@116..117 - 0: TS_TYPE_PARAMETER@116..117 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@116..116 - 1: TS_TYPE_PARAMETER_NAME@116..117 - 0: IDENT@116..117 "f" [] [] - 2: (empty) - 3: (empty) - 1: TS_TYPE_PARAMETER_MODIFIER_LIST@117..117 - 1: TS_FUNCTION_TYPE@117..120 - 0: TS_TYPE_PARAMETERS@117..120 - 0: L_ANGLE@117..118 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@118..119 - 0: TS_TYPE_PARAMETER@118..119 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@118..118 - 1: TS_TYPE_PARAMETER_NAME@118..119 - 0: IDENT@118..119 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@119..120 ">" [] [] - 1: (empty) - 2: (empty) - 3: (empty) - 2: (empty) - 1: SEMICOLON@120..121 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@121..134 - 0: JS_ASSIGNMENT_EXPRESSION@121..133 - 0: JS_BOGUS_ASSIGNMENT@121..127 - 0: JS_IDENTIFIER_EXPRESSION@121..123 - 0: JS_REFERENCE_IDENTIFIER@121..123 - 0: IDENT@121..123 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@123..127 - 0: L_ANGLE@123..124 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@124..125 - 0: TS_REFERENCE_TYPE@124..125 - 0: JS_REFERENCE_IDENTIFIER@124..125 - 0: IDENT@124..125 "T" [] [] - 1: (empty) - 2: R_ANGLE@125..127 ">" [] [Whitespace(" ")] - 1: EQ@127..129 "=" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@129..133 - 0: JS_IDENTIFIER_EXPRESSION@129..130 - 0: JS_REFERENCE_IDENTIFIER@129..130 - 0: IDENT@129..130 "g" [] [] - 1: TS_TYPE_ARGUMENTS@130..133 - 0: L_ANGLE@130..131 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@131..132 - 0: TS_REFERENCE_TYPE@131..132 - 0: JS_REFERENCE_IDENTIFIER@131..132 - 0: IDENT@131..132 "K" [] [] - 1: (empty) - 2: R_ANGLE@132..133 ">" [] [] - 1: SEMICOLON@133..134 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@134..148 - 0: JS_BINARY_EXPRESSION@134..147 - 0: JS_BINARY_EXPRESSION@134..138 - 0: JS_IDENTIFIER_EXPRESSION@134..136 - 0: JS_REFERENCE_IDENTIFIER@134..136 - 0: IDENT@134..136 "f" [Newline("\n")] [] - 1: L_ANGLE@136..137 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@137..138 - 0: JS_REFERENCE_IDENTIFIER@137..138 - 0: IDENT@137..138 "T" [] [] - 1: R_ANGLE@138..140 ">" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@140..147 - 0: (empty) - 1: SHR@140..143 ">>" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@143..147 - 0: JS_IDENTIFIER_EXPRESSION@143..144 - 0: JS_REFERENCE_IDENTIFIER@143..144 - 0: IDENT@143..144 "f" [] [] - 1: TS_TYPE_ARGUMENTS@144..147 - 0: L_ANGLE@144..145 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@145..146 - 0: TS_REFERENCE_TYPE@145..146 - 0: JS_REFERENCE_IDENTIFIER@145..146 - 0: IDENT@145..146 "T" [] [] - 1: (empty) - 2: R_ANGLE@146..147 ">" [] [] - 1: SEMICOLON@147..148 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@148..162 - 0: JS_BINARY_EXPRESSION@148..161 - 0: JS_BINARY_EXPRESSION@148..154 - 0: JS_BINARY_EXPRESSION@148..152 - 0: JS_IDENTIFIER_EXPRESSION@148..150 - 0: JS_REFERENCE_IDENTIFIER@148..150 - 0: IDENT@148..150 "f" [Newline("\n")] [] - 1: L_ANGLE@150..151 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@151..152 - 0: JS_REFERENCE_IDENTIFIER@151..152 - 0: IDENT@151..152 "T" [] [] - 1: R_ANGLE@152..154 ">" [] [Whitespace(" ")] - 2: (empty) - 1: GTEQ@154..157 ">=" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@157..161 - 0: JS_IDENTIFIER_EXPRESSION@157..158 - 0: JS_REFERENCE_IDENTIFIER@157..158 - 0: IDENT@157..158 "f" [] [] - 1: TS_TYPE_ARGUMENTS@158..161 - 0: L_ANGLE@158..159 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@159..160 - 0: TS_REFERENCE_TYPE@159..160 - 0: JS_REFERENCE_IDENTIFIER@159..160 - 0: IDENT@159..160 "T" [] [] - 1: (empty) - 2: R_ANGLE@160..161 ">" [] [] - 1: SEMICOLON@161..162 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@162..175 - 0: JS_BINARY_EXPRESSION@162..174 - 0: JS_BINARY_EXPRESSION@162..166 - 0: JS_IDENTIFIER_EXPRESSION@162..164 - 0: JS_REFERENCE_IDENTIFIER@162..164 - 0: IDENT@162..164 "f" [Newline("\n")] [] - 1: L_ANGLE@164..165 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@165..166 - 0: JS_REFERENCE_IDENTIFIER@165..166 - 0: IDENT@165..166 "T" [] [] - 1: R_ANGLE@166..168 ">" [] [Whitespace(" ")] - 2: TS_TYPE_ASSERTION_EXPRESSION@168..174 - 0: L_ANGLE@168..170 "<" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@170..174 - 0: JS_REFERENCE_IDENTIFIER@170..171 - 0: IDENT@170..171 "f" [] [] - 1: TS_TYPE_ARGUMENTS@171..174 - 0: L_ANGLE@171..172 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@172..173 - 0: TS_REFERENCE_TYPE@172..173 - 0: JS_REFERENCE_IDENTIFIER@172..173 - 0: IDENT@172..173 "T" [] [] - 1: (empty) - 2: R_ANGLE@173..174 ">" [] [] - 2: (empty) - 3: (empty) - 1: SEMICOLON@174..175 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@175..188 - 0: JS_BINARY_EXPRESSION@175..187 - 0: JS_BINARY_EXPRESSION@175..181 - 0: JS_BINARY_EXPRESSION@175..179 - 0: JS_IDENTIFIER_EXPRESSION@175..177 - 0: JS_REFERENCE_IDENTIFIER@175..177 - 0: IDENT@175..177 "f" [Newline("\n")] [] - 1: L_ANGLE@177..178 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@178..179 - 0: JS_REFERENCE_IDENTIFIER@178..179 - 0: IDENT@178..179 "T" [] [] - 1: R_ANGLE@179..181 ">" [] [Whitespace(" ")] - 2: (empty) - 1: R_ANGLE@181..183 ">" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@183..187 - 0: JS_IDENTIFIER_EXPRESSION@183..184 - 0: JS_REFERENCE_IDENTIFIER@183..184 - 0: IDENT@183..184 "f" [] [] - 1: TS_TYPE_ARGUMENTS@184..187 - 0: L_ANGLE@184..185 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@185..186 - 0: TS_REFERENCE_TYPE@185..186 - 0: JS_REFERENCE_IDENTIFIER@185..186 - 0: IDENT@185..186 "T" [] [] - 1: (empty) - 2: R_ANGLE@186..187 ">" [] [] - 1: SEMICOLON@187..188 ";" [] [] - 8: JS_EXPRESSION_STATEMENT@188..194 - 0: JS_BINARY_EXPRESSION@188..194 - 0: JS_BINARY_EXPRESSION@188..192 - 0: JS_IDENTIFIER_EXPRESSION@188..190 - 0: JS_REFERENCE_IDENTIFIER@188..190 - 0: IDENT@188..190 "f" [Newline("\n")] [] - 1: L_ANGLE@190..191 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@191..192 - 0: JS_REFERENCE_IDENTIFIER@191..192 - 0: IDENT@191..192 "T" [] [] - 1: R_ANGLE@192..194 ">" [] [Whitespace(" ")] - 2: (empty) - 1: (empty) - 9: JS_IMPORT@194..200 - 0: IMPORT_KW@194..200 "import" [] [] - 1: (empty) - 2: (empty) - 10: JS_EXPRESSION_STATEMENT@200..204 - 0: TS_TYPE_ASSERTION_EXPRESSION@200..203 - 0: L_ANGLE@200..201 "<" [] [] - 1: TS_NUMBER_LITERAL_TYPE@201..202 - 0: (empty) - 1: JS_NUMBER_LITERAL@201..202 "1" [] [] - 2: R_ANGLE@202..203 ">" [] [] - 3: (empty) - 1: SEMICOLON@203..204 ";" [] [] - 11: JS_EXPRESSION_STATEMENT@204..216 - 0: JS_BINARY_EXPRESSION@204..215 - 0: JS_BINARY_EXPRESSION@204..208 - 0: JS_IDENTIFIER_EXPRESSION@204..206 - 0: JS_REFERENCE_IDENTIFIER@204..206 - 0: IDENT@204..206 "f" [Newline("\n")] [] - 1: L_ANGLE@206..207 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@207..208 - 0: JS_REFERENCE_IDENTIFIER@207..208 - 0: IDENT@207..208 "T" [] [] - 1: R_ANGLE@208..210 ">" [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@210..215 - 0: JS_BOGUS@210..215 - 0: IDENT@210..215 "yield" [] [] - 1: SEMICOLON@215..216 ";" [] [] - 12: JS_EXPRESSION_STATEMENT@216..225 - 0: JS_BINARY_EXPRESSION@216..224 - 0: JS_BINARY_EXPRESSION@216..220 - 0: JS_IDENTIFIER_EXPRESSION@216..218 - 0: JS_REFERENCE_IDENTIFIER@216..218 - 0: IDENT@216..218 "f" [Newline("\n")] [] - 1: L_ANGLE@218..219 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@219..220 - 0: JS_REFERENCE_IDENTIFIER@219..220 - 0: IDENT@219..220 "T" [] [] - 1: R_ANGLE@220..222 ">" [] [Whitespace(" ")] - 2: JS_PRE_UPDATE_EXPRESSION@222..224 - 0: PLUS2@222..224 "++" [] [] - 1: (empty) - 1: SEMICOLON@224..225 ";" [] [] - 13: JS_EXPRESSION_STATEMENT@225..234 - 0: JS_BINARY_EXPRESSION@225..233 - 0: JS_BINARY_EXPRESSION@225..229 - 0: JS_IDENTIFIER_EXPRESSION@225..227 - 0: JS_REFERENCE_IDENTIFIER@225..227 - 0: IDENT@225..227 "f" [Newline("\n")] [] - 1: L_ANGLE@227..228 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@228..229 - 0: JS_REFERENCE_IDENTIFIER@228..229 - 0: IDENT@228..229 "T" [] [] - 1: R_ANGLE@229..231 ">" [] [Whitespace(" ")] - 2: JS_PRE_UPDATE_EXPRESSION@231..233 - 0: MINUS2@231..233 "--" [] [] - 1: (empty) - 1: SEMICOLON@233..234 ";" [] [] - 14: JS_EXPRESSION_STATEMENT@234..245 - 0: JS_BINARY_EXPRESSION@234..245 - 0: JS_BINARY_EXPRESSION@234..238 - 0: JS_IDENTIFIER_EXPRESSION@234..236 - 0: JS_REFERENCE_IDENTIFIER@234..236 - 0: IDENT@234..236 "f" [Newline("\n")] [] - 1: L_ANGLE@236..237 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@237..238 - 0: JS_REFERENCE_IDENTIFIER@237..238 - 0: IDENT@237..238 "T" [] [] - 1: R_ANGLE@238..240 ">" [] [Whitespace(" ")] - 2: JS_REGEX_LITERAL_EXPRESSION@240..245 - 0: JS_REGEX_LITERAL@240..245 "/= 1;" [] [] - 1: (empty) - 15: JS_EXPRESSION_STATEMENT@245..259 - 0: JS_BINARY_EXPRESSION@245..258 - 0: TS_INSTANTIATION_EXPRESSION@245..251 - 0: JS_IDENTIFIER_EXPRESSION@245..247 - 0: JS_REFERENCE_IDENTIFIER@245..247 - 0: IDENT@245..247 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@247..251 - 0: L_ANGLE@247..248 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@248..249 - 0: TS_REFERENCE_TYPE@248..249 - 0: JS_REFERENCE_IDENTIFIER@248..249 - 0: IDENT@248..249 "T" [] [] - 1: (empty) - 2: R_ANGLE@249..251 ">" [] [Whitespace(" ")] - 1: LTEQ@251..254 "<=" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@254..258 - 0: JS_IDENTIFIER_EXPRESSION@254..255 - 0: JS_REFERENCE_IDENTIFIER@254..255 - 0: IDENT@254..255 "f" [] [] - 1: TS_TYPE_ARGUMENTS@255..258 - 0: L_ANGLE@255..256 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@256..257 - 0: TS_REFERENCE_TYPE@256..257 - 0: JS_REFERENCE_IDENTIFIER@256..257 - 0: IDENT@256..257 "T" [] [] - 1: (empty) - 2: R_ANGLE@257..258 ">" [] [] - 1: SEMICOLON@258..259 ";" [] [] - 16: JS_EXPRESSION_STATEMENT@259..269 - 0: JS_COMPUTED_MEMBER_EXPRESSION@259..268 - 0: TS_INSTANTIATION_EXPRESSION@259..265 - 0: JS_IDENTIFIER_EXPRESSION@259..262 - 0: JS_REFERENCE_IDENTIFIER@259..262 - 0: IDENT@259..262 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@262..265 - 0: L_ANGLE@262..263 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@263..264 - 0: TS_REFERENCE_TYPE@263..264 - 0: JS_REFERENCE_IDENTIFIER@263..264 - 0: IDENT@263..264 "T" [] [] - 1: (empty) - 2: R_ANGLE@264..265 ">" [] [] - 1: (empty) - 2: L_BRACK@265..267 "[" [Newline("\n")] [] - 3: (empty) - 4: R_BRACK@267..268 "]" [] [] - 1: SEMICOLON@268..269 ";" [] [] - 17: JS_EXPRESSION_STATEMENT@269..274 - 0: TS_INSTANTIATION_EXPRESSION@269..274 - 0: JS_IDENTIFIER_EXPRESSION@269..271 - 0: JS_REFERENCE_IDENTIFIER@269..271 - 0: IDENT@269..271 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@271..274 - 0: L_ANGLE@271..272 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@272..273 - 0: TS_REFERENCE_TYPE@272..273 - 0: JS_REFERENCE_IDENTIFIER@272..273 - 0: IDENT@272..273 "T" [] [] - 1: (empty) - 2: R_ANGLE@273..274 ">" [] [] - 1: (empty) - 18: JS_EXPRESSION_STATEMENT@274..278 - 0: JS_IDENTIFIER_EXPRESSION@274..278 - 0: JS_REFERENCE_IDENTIFIER@274..278 - 0: IDENT@274..278 "as" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 19: JS_BLOCK_STATEMENT@278..280 - 0: L_CURLY@278..279 "{" [] [] - 1: JS_STATEMENT_LIST@279..279 - 2: R_CURLY@279..280 "}" [] [] - 20: JS_EMPTY_STATEMENT@280..281 - 0: SEMICOLON@280..281 ";" [] [] - 21: JS_EXPRESSION_STATEMENT@281..286 - 0: TS_INSTANTIATION_EXPRESSION@281..286 - 0: JS_IDENTIFIER_EXPRESSION@281..283 - 0: JS_REFERENCE_IDENTIFIER@281..283 - 0: IDENT@281..283 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@283..286 - 0: L_ANGLE@283..284 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@284..285 - 0: TS_REFERENCE_TYPE@284..285 - 0: JS_REFERENCE_IDENTIFIER@284..285 - 0: IDENT@284..285 "T" [] [] - 1: (empty) - 2: R_ANGLE@285..286 ">" [] [] - 1: (empty) - 22: JS_EXPRESSION_STATEMENT@286..297 - 0: JS_IDENTIFIER_EXPRESSION@286..297 - 0: JS_REFERENCE_IDENTIFIER@286..297 - 0: IDENT@286..297 "satisfies" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 23: JS_BLOCK_STATEMENT@297..299 - 0: L_CURLY@297..298 "{" [] [] - 1: JS_STATEMENT_LIST@298..298 - 2: R_CURLY@298..299 "}" [] [] - 24: JS_EMPTY_STATEMENT@299..300 - 0: SEMICOLON@299..300 ";" [] [] - 25: JS_CLASS_DECLARATION@300..361 - 0: JS_DECORATOR_LIST@300..300 - 1: (empty) - 2: CLASS_KW@300..307 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@307..310 - 0: IDENT@307..310 "C5" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@310..311 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@311..359 - 0: JS_PROPERTY_CLASS_MEMBER@311..359 - 0: JS_PROPERTY_MODIFIER_LIST@311..326 - 0: TS_ACCESSIBILITY_MODIFIER@311..326 - 0: PROTECTED_KW@311..326 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@326..337 - 0: IDENT@326..337 "specialFoo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@337..359 - 0: EQ@337..339 "=" [] [Whitespace(" ")] - 1: JS_ASSIGNMENT_EXPRESSION@339..359 - 0: JS_BOGUS_ASSIGNMENT@339..354 - 0: JS_BINARY_EXPRESSION@339..347 - 0: JS_IDENTIFIER_EXPRESSION@339..340 - 0: JS_REFERENCE_IDENTIFIER@339..340 - 0: IDENT@339..340 "f" [] [] - 1: L_ANGLE@340..341 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@341..347 - 0: JS_REFERENCE_IDENTIFIER@341..347 - 0: IDENT@341..347 "string" [] [] - 1: R_ANGLE@347..349 ">" [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@349..354 - 0: HASH@349..350 "#" [] [] - 1: IDENT@350..354 "bar" [] [Whitespace(" ")] - 1: EQ@354..356 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@356..359 - 0: JS_NUMBER_LITERAL@356..359 "123" [] [] - 4: (empty) - 9: R_CURLY@359..361 "}" [Newline("\n")] [] - 26: JS_FOR_IN_STATEMENT@361..401 - 0: FOR_KW@361..366 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@366..367 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@367..392 - 0: (empty) - 1: CONST_KW@367..373 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@373..392 - 0: JS_IDENTIFIER_BINDING@373..375 - 0: IDENT@373..375 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@375..392 - 0: EQ@375..377 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@377..392 - 0: JS_STATIC_MEMBER_EXPRESSION@377..383 - 0: JS_IDENTIFIER_EXPRESSION@377..378 - 0: JS_REFERENCE_IDENTIFIER@377..378 - 0: IDENT@377..378 "b" [] [] - 1: DOT@378..379 "." [] [] - 2: JS_NAME@379..383 - 0: IDENT@379..383 "test" [] [] - 1: TS_TYPE_ARGUMENTS@383..392 - 0: L_ANGLE@383..384 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@384..390 - 0: TS_STRING_TYPE@384..390 - 0: STRING_KW@384..390 "string" [] [] - 2: R_ANGLE@390..392 ">" [] [Whitespace(" ")] - 3: IN_KW@392..395 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@395..397 - 0: L_BRACK@395..396 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@396..396 - 2: R_BRACK@396..397 "]" [] [] - 5: R_PAREN@397..399 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@399..401 - 0: L_CURLY@399..400 "{" [] [] - 1: JS_STATEMENT_LIST@400..400 - 2: R_CURLY@400..401 "}" [] [] - 4: EOF@401..402 "" [Newline("\n")] [] --- -ts_instantiation_expressions_1.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ';'. - - > 1 │ const a8 = f; // Relational operator error - │ ^ - 2 │ const b1 = f?.; // Error, `(` expected - 3 │ f << f; - - i Expected an expression here. - - > 1 │ const a8 = f; // Relational operator error - │ ^ - 2 │ const b1 = f?.; // Error, `(` expected - 3 │ f << f; - --- -ts_instantiation_expressions_1.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `;` - - 1 │ const a8 = f; // Relational operator error - > 2 │ const b1 = f?.; // Error, `(` expected - │ ^ - 3 │ f << f; - 4 │ f = g; - - i Remove ; - --- -ts_instantiation_expressions_1.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `<` - - 1 │ const a8 = f; // Relational operator error - 2 │ const b1 = f?.; // Error, `(` expected - > 3 │ f << f; - │ ^ - 4 │ f = g; - 5 │ f >> f; - - i Remove < - --- -ts_instantiation_expressions_1.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a parenthesis '(' but instead found ';'. - - 1 │ const a8 = f; // Relational operator error - 2 │ const b1 = f?.; // Error, `(` expected - > 3 │ f << f; - │ ^ - 4 │ f = g; - 5 │ f >> f; - - i Expected a parenthesis '(' here. - - 1 │ const a8 = f; // Relational operator error - 2 │ const b1 = f?.; // Error, `(` expected - > 3 │ f << f; - │ ^ - 4 │ f = g; - 5 │ f >> f; - --- -ts_instantiation_expressions_1.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `f` - - 2 │ const b1 = f?.; // Error, `(` expected - 3 │ f << f; - > 4 │ f = g; - │ ^^^^ - 5 │ f >> f; - 6 │ f >= f; - - i This expression cannot be assigned to - --- -ts_instantiation_expressions_1.ts:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression for the left hand side of the `>>` operator. - - 3 │ f << f; - 4 │ f = g; - > 5 │ f >> f; - │ ^^ - 6 │ f >= f; - 7 │ f < f; - - i This operator requires a left hand side value - --- -ts_instantiation_expressions_1.ts:6:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '>='. - - 4 │ f = g; - 5 │ f >> f; - > 6 │ f >= f; - │ ^^ - 7 │ f < f; - 8 │ f > f; - - i Expected an expression here. - - 4 │ f = g; - 5 │ f >> f; - > 6 │ f >= f; - │ ^^ - 7 │ f < f; - 8 │ f > f; - --- -ts_instantiation_expressions_1.ts:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `>` but instead found `;` - - 5 │ f >> f; - 6 │ f >= f; - > 7 │ f < f; - │ ^ - 8 │ f > f; - 9 │ f import<1>; - - i Remove ; - --- -ts_instantiation_expressions_1.ts:8:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '>'. - - 6 │ f >= f; - 7 │ f < f; - > 8 │ f > f; - │ ^ - 9 │ f import<1>; - 10 │ f yield; - - i Expected an expression here. - - 6 │ f >= f; - 7 │ f < f; - > 8 │ f > f; - │ ^ - 9 │ f import<1>; - 10 │ f yield; - --- -ts_instantiation_expressions_1.ts:9:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found 'import'. - - 7 │ f < f; - 8 │ f > f; - > 9 │ f import<1>; - │ ^^^^^^ - 10 │ f yield; - 11 │ f ++; - - i Expected an expression here. - - 7 │ f < f; - 8 │ f > f; - > 9 │ f import<1>; - │ ^^^^^^ - 10 │ f yield; - 11 │ f ++; - --- -ts_instantiation_expressions_1.ts:9:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a default import, a namespace import, or a named import but instead found '<'. - - 7 │ f < f; - 8 │ f > f; - > 9 │ f import<1>; - │ ^ - 10 │ f yield; - 11 │ f ++; - - i Expected a default import, a namespace import, or a named import here. - - 7 │ f < f; - 8 │ f > f; - > 9 │ f import<1>; - │ ^ - 10 │ f yield; - 11 │ f ++; - --- -ts_instantiation_expressions_1.ts:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ';'. - - 7 │ f < f; - 8 │ f > f; - > 9 │ f import<1>; - │ ^ - 10 │ f yield; - 11 │ f ++; - - i Expected an expression here. - - 7 │ f < f; - 8 │ f > f; - > 9 │ f import<1>; - │ ^ - 10 │ f yield; - 11 │ f ++; - --- -ts_instantiation_expressions_1.ts:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - 8 │ f > f; - 9 │ f import<1>; - > 10 │ f yield; - │ ^^^^^ - 11 │ f ++; - 12 │ f --; - --- -ts_instantiation_expressions_1.ts:11:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or a member expression but instead found ';'. - - 9 │ f import<1>; - 10 │ f yield; - > 11 │ f ++; - │ ^ - 12 │ f --; - 13 │ f /= 1; - - i Expected an identifier, or a member expression here. - - 9 │ f import<1>; - 10 │ f yield; - > 11 │ f ++; - │ ^ - 12 │ f --; - 13 │ f /= 1; - --- -ts_instantiation_expressions_1.ts:12:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or a member expression but instead found ';'. - - 10 │ f yield; - 11 │ f ++; - > 12 │ f --; - │ ^ - 13 │ f /= 1; - 14 │ f <= f; - - i Expected an identifier, or a member expression here. - - 10 │ f yield; - 11 │ f ++; - > 12 │ f --; - │ ^ - 13 │ f /= 1; - 14 │ f <= f; - --- -ts_instantiation_expressions_1.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated regex literal - - 11 │ f ++; - 12 │ f --; - > 13 │ f /= 1; - │ - 14 │ f <= f; - 15 │ f - - i ...but the line ends here - - 11 │ f ++; - 12 │ f --; - > 13 │ f /= 1; - │ - 14 │ f <= f; - 15 │ f - - i a regex literal starts there... - - 11 │ f ++; - 12 │ f --; - > 13 │ f /= 1; - │ ^ - 14 │ f <= f; - 15 │ f - --- -ts_instantiation_expressions_1.ts:16:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found ']'. - - 14 │ f <= f; - 15 │ f - > 16 │ []; - │ ^ - 17 │ f - 18 │ as {}; - - i Expected an expression here. - - 14 │ f <= f; - 15 │ f - > 16 │ []; - │ ^ - 17 │ f - 18 │ as {}; - --- -ts_instantiation_expressions_1.ts:18:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 16 │ []; - 17 │ f - > 18 │ as {}; - │ ^ - 19 │ f - 20 │ satisfies {}; - - i An explicit or implicit semicolon is expected here... - - 16 │ []; - 17 │ f - > 18 │ as {}; - │ ^ - 19 │ f - 20 │ satisfies {}; - - i ...Which is required to end this statement - - 16 │ []; - 17 │ f - > 18 │ as {}; - │ ^^^^ - 19 │ f - 20 │ satisfies {}; - --- -ts_instantiation_expressions_1.ts:20:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 18 │ as {}; - 19 │ f - > 20 │ satisfies {}; - │ ^ - 21 │ class C5 { - 22 │ protected specialFoo = f #bar = 123 - - i An explicit or implicit semicolon is expected here... - - 18 │ as {}; - 19 │ f - > 20 │ satisfies {}; - │ ^ - 21 │ class C5 { - 22 │ protected specialFoo = f #bar = 123 - - i ...Which is required to end this statement - - 18 │ as {}; - 19 │ f - > 20 │ satisfies {}; - │ ^^^^^^^^^^^ - 21 │ class C5 { - 22 │ protected specialFoo = f #bar = 123 - --- -ts_instantiation_expressions_1.ts:22:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Private names are only allowed on the left side of a 'in' expression - - 20 │ satisfies {}; - 21 │ class C5 { - > 22 │ protected specialFoo = f #bar = 123 - │ ^^^^ - 23 │ } - 24 │ for (const a = b.test in []) {} - --- -ts_instantiation_expressions_1.ts:22:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `f #bar` - - 20 │ satisfies {}; - 21 │ class C5 { - > 22 │ protected specialFoo = f #bar = 123 - │ ^^^^^^^^^^^^^^ - 23 │ } - 24 │ for (const a = b.test in []) {} - - i This expression cannot be assigned to - --- -ts_instantiation_expressions_1.ts:24:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `for..in` statement declarators cannot have an initializer expression - - 22 │ protected specialFoo = f #bar = 123 - 23 │ } - > 24 │ for (const a = b.test in []) {} - │ ^^^^^^^^^^^^^^^^ - 25 │ - --- -const a8 = f; // Relational operator error -const b1 = f?.; // Error, `(` expected -f << f; -f = g; -f >> f; -f >= f; -f < f; -f > f; -f import<1>; -f yield; -f ++; -f --; -f /= 1; -f <= f; -f -[]; -f -as {}; -f -satisfies {}; -class C5 { - protected specialFoo = f #bar = 123 -} -for (const a = b.test in []) {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast b/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast deleted file mode 100644 index 78febb2a784d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast +++ /dev/null @@ -1,251 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@12..13 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@13..14 "}" [] [], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@25..27 "B" [] [Whitespace(" ")], - }, - TsImplementsClause { - implements_token: IMPLEMENTS_KW@27..38 "implements" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@38..40 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - L_CURLY@40..41 "{" [] [], - TsTypeMemberList [], - R_CURLY@41..42 "}" [] [], - ], - }, - JsBogusStatement { - items: [ - INTERFACE_KW@42..53 "interface" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@53..55 "C" [] [Whitespace(" ")], - }, - TsExtendsClause { - extends_token: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@63..65 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - TsExtendsClause { - extends_token: EXTENDS_KW@65..73 "extends" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@73..75 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - L_CURLY@75..76 "{" [] [], - TsTypeMemberList [], - R_CURLY@76..77 "}" [] [], - ], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@77..88 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@88..90 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: TsExtendsClause { - extends_token: EXTENDS_KW@90..98 "extends" [] [Whitespace(" ")], - types: TsTypeList [], - }, - l_curly_token: L_CURLY@98..99 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@99..100 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@100..111 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@111..113 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: TsExtendsClause { - extends_token: EXTENDS_KW@113..121 "extends" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@121..122 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@122..124 "," [] [Whitespace(" ")], - missing element, - ], - }, - l_curly_token: L_CURLY@124..125 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - ], - eof_token: EOF@126..127 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..127 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..126 - 0: TS_INTERFACE_DECLARATION@0..14 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@12..13 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@13..13 - 6: R_CURLY@13..14 "}" [] [] - 1: JS_BOGUS_STATEMENT@14..42 - 0: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "B" [] [Whitespace(" ")] - 2: TS_IMPLEMENTS_CLAUSE@27..40 - 0: IMPLEMENTS_KW@27..38 "implements" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@38..40 - 0: TS_REFERENCE_TYPE@38..40 - 0: JS_REFERENCE_IDENTIFIER@38..40 - 0: IDENT@38..40 "A" [] [Whitespace(" ")] - 1: (empty) - 3: L_CURLY@40..41 "{" [] [] - 4: TS_TYPE_MEMBER_LIST@41..41 - 5: R_CURLY@41..42 "}" [] [] - 2: JS_BOGUS_STATEMENT@42..77 - 0: INTERFACE_KW@42..53 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@53..55 - 0: IDENT@53..55 "C" [] [Whitespace(" ")] - 2: TS_EXTENDS_CLAUSE@55..65 - 0: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@63..65 - 0: TS_REFERENCE_TYPE@63..65 - 0: JS_REFERENCE_IDENTIFIER@63..65 - 0: IDENT@63..65 "A" [] [Whitespace(" ")] - 1: (empty) - 3: TS_EXTENDS_CLAUSE@65..75 - 0: EXTENDS_KW@65..73 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@73..75 - 0: TS_REFERENCE_TYPE@73..75 - 0: JS_REFERENCE_IDENTIFIER@73..75 - 0: IDENT@73..75 "B" [] [Whitespace(" ")] - 1: (empty) - 4: L_CURLY@75..76 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@76..76 - 6: R_CURLY@76..77 "}" [] [] - 3: TS_INTERFACE_DECLARATION@77..100 - 0: INTERFACE_KW@77..88 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@88..90 - 0: IDENT@88..90 "D" [] [Whitespace(" ")] - 2: (empty) - 3: TS_EXTENDS_CLAUSE@90..98 - 0: EXTENDS_KW@90..98 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@98..98 - 4: L_CURLY@98..99 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@99..99 - 6: R_CURLY@99..100 "}" [] [] - 4: TS_INTERFACE_DECLARATION@100..126 - 0: INTERFACE_KW@100..111 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@111..113 - 0: IDENT@111..113 "E" [] [Whitespace(" ")] - 2: (empty) - 3: TS_EXTENDS_CLAUSE@113..124 - 0: EXTENDS_KW@113..121 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@121..124 - 0: TS_REFERENCE_TYPE@121..122 - 0: JS_REFERENCE_IDENTIFIER@121..122 - 0: IDENT@121..122 "A" [] [] - 1: (empty) - 1: COMMA@122..124 "," [] [Whitespace(" ")] - 2: (empty) - 4: L_CURLY@124..125 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@125..125 - 6: R_CURLY@125..126 "}" [] [] - 4: EOF@126..127 "" [Newline("\n")] [] --- -ts_interface_heritage_clause_error.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Interface declaration cannot have 'implements' clause. - - 1 │ interface A {} - > 2 │ interface B implements A {} - │ ^^^^^^^^^^^^ - 3 │ interface C extends A extends B {} - 4 │ interface D extends {} - --- -ts_interface_heritage_clause_error.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'extends' clause already seen. - - 1 │ interface A {} - 2 │ interface B implements A {} - > 3 │ interface C extends A extends B {} - │ ^^^^^^^^^ - 4 │ interface D extends {} - 5 │ interface E extends A, {} - - i first 'extends' clause - - 1 │ interface A {} - 2 │ interface B implements A {} - > 3 │ interface C extends A extends B {} - │ ^^^^^^^^^ - 4 │ interface D extends {} - 5 │ interface E extends A, {} - --- -ts_interface_heritage_clause_error.ts:4:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'extends' list cannot be empty. - - 2 │ interface B implements A {} - 3 │ interface C extends A extends B {} - > 4 │ interface D extends {} - │ - 5 │ interface E extends A, {} - 6 │ - --- -ts_interface_heritage_clause_error.ts:5:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Trailing comma not allowed. - - 3 │ interface C extends A extends B {} - 4 │ interface D extends {} - > 5 │ interface E extends A, {} - │ ^ - 6 │ - --- -interface A {} -interface B implements A {} -interface C extends A extends B {} -interface D extends {} -interface E extends A, {} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast b/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast deleted file mode 100644 index 16f5aaca1630..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast +++ /dev/null @@ -1,446 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..20 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@20..21 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@21..25 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@25..30 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - JsLiteralMemberName { - value: IDENT@30..41 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@41..42 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@44..45 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@45..46 "}" [] [], - }, - ], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - JsDecorator { - at_token: AT@46..50 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@50..55 "test" [] [Whitespace(" ")], - }, - }, - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@55..63 "declare" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@63..67 "prop" [] [], - }, - property_annotation: missing (optional), - semicolon_token: SEMICOLON@67..68 ";" [] [], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@68..72 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@72..77 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - JsLiteralMemberName { - value: IDENT@77..83 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@83..84 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@84..85 ")" [] [], - }, - SEMICOLON@85..86 ";" [] [], - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - JsDecorator { - at_token: AT@86..90 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@90..95 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - L_BRACK@95..96 "[" [] [], - TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@96..101 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@101..103 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@103..109 "string" [] [], - }, - }, - }, - R_BRACK@109..110 "]" [] [], - TsTypeAnnotation { - colon_token: COLON@110..112 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@112..118 "string" [] [], - }, - }, - SEMICOLON@118..119 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@119..123 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@123..128 "test" [] [Whitespace(" ")], - }, - }, - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@128..137 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@137..144 "method2" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@144..145 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@145..146 ")" [] [], - }, - SEMICOLON@146..147 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@147..151 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@151..156 "test" [] [Whitespace(" ")], - }, - }, - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")], - }, - ], - GET_KW@165..169 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@169..175 "getter" [] [], - }, - L_PAREN@175..176 "(" [] [], - R_PAREN@176..177 ")" [] [], - SEMICOLON@177..178 ";" [] [], - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsDecorator { - at_token: AT@178..182 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@182..187 "test" [] [Whitespace(" ")], - }, - }, - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@187..196 "abstract" [] [Whitespace(" ")], - }, - ], - SET_KW@196..200 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@200..206 "setter" [] [], - }, - L_PAREN@206..207 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@207..210 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - R_PAREN@210..211 ")" [] [], - SEMICOLON@211..212 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@212..214 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@214..215 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..215 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..214 - 0: JS_CLASS_DECLARATION@0..214 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..20 - 0: IDENT@15..20 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@20..21 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@21..212 - 0: JS_BOGUS_MEMBER@21..46 - 0: JS_BOGUS@21..30 - 0: JS_DECORATOR@21..30 - 0: AT@21..25 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@25..30 - 0: JS_REFERENCE_IDENTIFIER@25..30 - 0: IDENT@25..30 "test" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@30..41 - 0: IDENT@30..41 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@41..44 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@42..42 - 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@44..46 - 0: L_CURLY@44..45 "{" [] [] - 1: JS_DIRECTIVE_LIST@45..45 - 2: JS_STATEMENT_LIST@45..45 - 3: R_CURLY@45..46 "}" [] [] - 1: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@46..68 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@46..63 - 0: JS_DECORATOR@46..55 - 0: AT@46..50 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@50..55 - 0: JS_REFERENCE_IDENTIFIER@50..55 - 0: IDENT@50..55 "test" [] [Whitespace(" ")] - 1: TS_DECLARE_MODIFIER@55..63 - 0: DECLARE_KW@55..63 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@63..67 - 0: IDENT@63..67 "prop" [] [] - 2: (empty) - 3: SEMICOLON@67..68 ";" [] [] - 2: JS_BOGUS_MEMBER@68..86 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@68..77 - 0: JS_DECORATOR@68..77 - 0: AT@68..72 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@72..77 - 0: JS_REFERENCE_IDENTIFIER@72..77 - 0: IDENT@72..77 "test" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@77..83 - 0: IDENT@77..83 "method" [] [] - 2: JS_PARAMETERS@83..85 - 0: L_PAREN@83..84 "(" [] [] - 1: JS_PARAMETER_LIST@84..84 - 2: R_PAREN@84..85 ")" [] [] - 3: SEMICOLON@85..86 ";" [] [] - 3: JS_BOGUS_MEMBER@86..119 - 0: JS_BOGUS@86..95 - 0: JS_DECORATOR@86..95 - 0: AT@86..90 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@90..95 - 0: JS_REFERENCE_IDENTIFIER@90..95 - 0: IDENT@90..95 "test" [] [Whitespace(" ")] - 1: L_BRACK@95..96 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@96..109 - 0: JS_IDENTIFIER_BINDING@96..101 - 0: IDENT@96..101 "index" [] [] - 1: TS_TYPE_ANNOTATION@101..109 - 0: COLON@101..103 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@103..109 - 0: STRING_KW@103..109 "string" [] [] - 3: R_BRACK@109..110 "]" [] [] - 4: TS_TYPE_ANNOTATION@110..118 - 0: COLON@110..112 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@112..118 - 0: STRING_KW@112..118 "string" [] [] - 5: SEMICOLON@118..119 ";" [] [] - 4: JS_BOGUS_MEMBER@119..147 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@119..137 - 0: JS_DECORATOR@119..128 - 0: AT@119..123 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@123..128 - 0: JS_REFERENCE_IDENTIFIER@123..128 - 0: IDENT@123..128 "test" [] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@128..137 - 0: ABSTRACT_KW@128..137 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@137..144 - 0: IDENT@137..144 "method2" [] [] - 2: JS_PARAMETERS@144..146 - 0: L_PAREN@144..145 "(" [] [] - 1: JS_PARAMETER_LIST@145..145 - 2: R_PAREN@145..146 ")" [] [] - 3: SEMICOLON@146..147 ";" [] [] - 5: JS_BOGUS_MEMBER@147..178 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@147..165 - 0: JS_DECORATOR@147..156 - 0: AT@147..151 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@151..156 - 0: JS_REFERENCE_IDENTIFIER@151..156 - 0: IDENT@151..156 "test" [] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@156..165 - 0: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")] - 1: GET_KW@165..169 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@169..175 - 0: IDENT@169..175 "getter" [] [] - 3: L_PAREN@175..176 "(" [] [] - 4: R_PAREN@176..177 ")" [] [] - 5: SEMICOLON@177..178 ";" [] [] - 6: JS_BOGUS_MEMBER@178..212 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@178..196 - 0: JS_DECORATOR@178..187 - 0: AT@178..182 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@182..187 - 0: JS_REFERENCE_IDENTIFIER@182..187 - 0: IDENT@182..187 "test" [] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@187..196 - 0: ABSTRACT_KW@187..196 "abstract" [] [Whitespace(" ")] - 1: SET_KW@196..200 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@200..206 - 0: IDENT@200..206 "setter" [] [] - 3: L_PAREN@206..207 "(" [] [] - 4: JS_FORMAL_PARAMETER@207..210 - 0: JS_DECORATOR_LIST@207..207 - 1: JS_IDENTIFIER_BINDING@207..210 - 0: IDENT@207..210 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: R_PAREN@210..211 ")" [] [] - 6: SEMICOLON@211..212 ";" [] [] - 9: R_CURLY@212..214 "}" [Newline("\n")] [] - 4: EOF@214..215 "" [Newline("\n")] [] --- -ts_invalid_decorated_class_members.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 1 │ abstract class Test { - > 2 │ @test constructor() {} - │ ^^^^^ - 3 │ @test declare prop; - 4 │ @test method(); - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_invalid_decorated_class_members.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 2 │ @test constructor() {} - 3 │ @test declare prop; - > 4 │ @test method(); - │ ^^^^^ - 5 │ @test [index: string]: string; - 6 │ @test abstract method2(); - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_invalid_decorated_class_members.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 3 │ @test declare prop; - 4 │ @test method(); - > 5 │ @test [index: string]: string; - │ ^^^^^ - 6 │ @test abstract method2(); - 7 │ @test abstract get getter(); - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_invalid_decorated_class_members.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 4 │ @test method(); - 5 │ @test [index: string]: string; - > 6 │ @test abstract method2(); - │ ^^^^^ - 7 │ @test abstract get getter(); - 8 │ @test abstract set setter(val); - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_invalid_decorated_class_members.ts:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 5 │ @test [index: string]: string; - 6 │ @test abstract method2(); - > 7 │ @test abstract get getter(); - │ ^^^^^ - 8 │ @test abstract set setter(val); - 9 │ } - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -ts_invalid_decorated_class_members.ts:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Decorators are not valid here. - - 6 │ @test abstract method2(); - 7 │ @test abstract get getter(); - > 8 │ @test abstract set setter(val); - │ ^^^^^ - 9 │ } - 10 │ - - i Decorators are only valid on class declarations, class expressions, and class methods. - --- -abstract class Test { - @test constructor() {} - @test declare prop; - @test method(); - @test [index: string]: string; - @test abstract method2(); - @test abstract get getter(); - @test abstract set setter(val); -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast b/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast deleted file mode 100644 index 5312913a79a8..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast +++ /dev/null @@ -1,233 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@29..30 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - body: missing (required), - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@32..38 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: missing (required), - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@41..45 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@45..49 "test" [] [], - }, - l_paren_token: L_PAREN@49..50 "(" [] [], - r_paren_token: R_PAREN@50..51 ")" [] [], - return_type: missing (optional), - body: missing (required), - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@51..61 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@61..65 "test" [] [], - }, - l_paren_token: L_PAREN@65..66 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@66..71 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@71..72 ")" [] [], - body: missing (required), - }, - ], - r_curly_token: R_CURLY@72..74 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..74 - 0: JS_CLASS_DECLARATION@0..74 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..72 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@12..32 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@12..12 - 1: JS_LITERAL_MEMBER_NAME@12..29 - 0: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@29..32 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@30..30 - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 3: (empty) - 1: JS_METHOD_CLASS_MEMBER@32..41 - 0: JS_METHOD_MODIFIER_LIST@32..32 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@32..38 - 0: IDENT@32..38 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@38..41 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..39 - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 7: (empty) - 8: (empty) - 2: JS_GETTER_CLASS_MEMBER@41..51 - 0: JS_METHOD_MODIFIER_LIST@41..41 - 1: GET_KW@41..45 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@45..49 - 0: IDENT@45..49 "test" [] [] - 3: L_PAREN@49..50 "(" [] [] - 4: R_PAREN@50..51 ")" [] [] - 5: (empty) - 6: (empty) - 3: JS_SETTER_CLASS_MEMBER@51..72 - 0: JS_METHOD_MODIFIER_LIST@51..51 - 1: SET_KW@51..61 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@61..65 - 0: IDENT@61..65 "test" [] [] - 3: L_PAREN@65..66 "(" [] [] - 4: JS_FORMAL_PARAMETER@66..71 - 0: JS_DECORATOR_LIST@66..66 - 1: JS_IDENTIFIER_BINDING@66..71 - 0: IDENT@66..71 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@71..72 ")" [] [] - 7: (empty) - 9: R_CURLY@72..74 "}" [Newline("\n")] [] - 4: EOF@74..75 "" [Newline("\n")] [] --- -ts_method_members_with_missing_body.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found 'method'. - - 1 │ class Test { - > 2 │ constructor() method() get test() - │ ^^^^^^ - 3 │ set test(value) - 4 │ } - - i Expected a class method body here. - - 1 │ class Test { - > 2 │ constructor() method() get test() - │ ^^^^^^ - 3 │ set test(value) - 4 │ } - --- -ts_method_members_with_missing_body.ts:2:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found 'get'. - - 1 │ class Test { - > 2 │ constructor() method() get test() - │ ^^^ - 3 │ set test(value) - 4 │ } - - i Expected a class method body here. - - 1 │ class Test { - > 2 │ constructor() method() get test() - │ ^^^ - 3 │ set test(value) - 4 │ } - --- -ts_method_members_with_missing_body.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found 'set'. - - 1 │ class Test { - 2 │ constructor() method() get test() - > 3 │ set test(value) - │ ^^^ - 4 │ } - 5 │ - - i Expected a class method body here. - - 1 │ class Test { - 2 │ constructor() method() get test() - > 3 │ set test(value) - │ ^^^ - 4 │ } - 5 │ - --- -ts_method_members_with_missing_body.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class method body but instead found '}'. - - 2 │ constructor() method() get test() - 3 │ set test(value) - > 4 │ } - │ ^ - 5 │ - - i Expected a class method body here. - - 2 │ constructor() method() get test() - 3 │ set test(value) - > 4 │ } - │ ^ - 5 │ - --- -class Test { - constructor() method() get test() - set test(value) -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.rast b/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.rast deleted file mode 100644 index d97bae12d462..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.rast +++ /dev/null @@ -1,341 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..2 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@8..9 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@9..10 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@11..17 "maybeA" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@17..19 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@19..22 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@22..23 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@25..32 "maybeA" [] [Whitespace(" ")], - }, - is_token: IS_KW@32..35 "is" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@35..37 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@37..39 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@39..46 "return" [] [Whitespace(" ")], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@46..51 "true" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@51..52 "}" [] [], - }, - }, - COMMA@52..53 "," [] [], - JsMethodObjectMember { - async_token: ASYNC_KW@53..64 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: STAR@64..65 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@65..67 "id" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@67..68 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@68..69 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@69..70 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@70..75 "param" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@75..77 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@77..84 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@84..85 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@85..86 "R" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@86..87 ">" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@87..88 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@88..90 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@90..111 "AsyncIterableIterator" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@111..112 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@112..113 "R" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@113..115 ">" [] [Whitespace(" ")], - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@115..117 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@117..123 "yield" [] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: missing (optional), - expression: JsAwaitExpression { - await_token: AWAIT_KW@123..129 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@129..135 "param" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@135..136 "}" [] [], - }, - }, - COMMA@136..137 "," [] [], - ], - r_curly_token: R_CURLY@137..139 "}" [Newline("\n")] [], - }, - r_paren_token: R_PAREN@139..140 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@140..141 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..141 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..140 - 0: JS_EXPRESSION_STATEMENT@0..140 - 0: JS_PARENTHESIZED_EXPRESSION@0..140 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..139 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@2..137 - 0: JS_METHOD_OBJECT_MEMBER@2..52 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@2..8 - 0: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [] - 3: TS_TYPE_PARAMETERS@8..10 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@9..9 - 2: R_ANGLE@9..10 ">" [] [] - 4: JS_PARAMETERS@10..23 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..22 - 0: JS_FORMAL_PARAMETER@11..22 - 0: JS_DECORATOR_LIST@11..11 - 1: JS_IDENTIFIER_BINDING@11..17 - 0: IDENT@11..17 "maybeA" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@17..22 - 0: COLON@17..19 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@19..22 - 0: ANY_KW@19..22 "any" [] [] - 4: (empty) - 2: R_PAREN@22..23 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@23..37 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@25..37 - 0: JS_REFERENCE_IDENTIFIER@25..32 - 0: IDENT@25..32 "maybeA" [] [Whitespace(" ")] - 1: IS_KW@32..35 "is" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@35..37 - 0: JS_REFERENCE_IDENTIFIER@35..37 - 0: IDENT@35..37 "A" [] [Whitespace(" ")] - 1: (empty) - 6: JS_FUNCTION_BODY@37..52 - 0: L_CURLY@37..39 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@39..39 - 2: JS_STATEMENT_LIST@39..51 - 0: JS_RETURN_STATEMENT@39..51 - 0: RETURN_KW@39..46 "return" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@46..51 - 0: TRUE_KW@46..51 "true" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@51..52 "}" [] [] - 1: COMMA@52..53 "," [] [] - 2: JS_METHOD_OBJECT_MEMBER@53..136 - 0: ASYNC_KW@53..64 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: STAR@64..65 "*" [] [] - 2: JS_LITERAL_MEMBER_NAME@65..67 - 0: IDENT@65..67 "id" [] [] - 3: TS_TYPE_PARAMETERS@67..69 - 0: L_ANGLE@67..68 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@68..68 - 2: R_ANGLE@68..69 ">" [] [] - 4: JS_PARAMETERS@69..88 - 0: L_PAREN@69..70 "(" [] [] - 1: JS_PARAMETER_LIST@70..87 - 0: JS_FORMAL_PARAMETER@70..87 - 0: JS_DECORATOR_LIST@70..70 - 1: JS_IDENTIFIER_BINDING@70..75 - 0: IDENT@70..75 "param" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@75..87 - 0: COLON@75..77 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@77..87 - 0: JS_REFERENCE_IDENTIFIER@77..84 - 0: IDENT@77..84 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@84..87 - 0: L_ANGLE@84..85 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@85..86 - 0: TS_REFERENCE_TYPE@85..86 - 0: JS_REFERENCE_IDENTIFIER@85..86 - 0: IDENT@85..86 "R" [] [] - 1: (empty) - 2: R_ANGLE@86..87 ">" [] [] - 4: (empty) - 2: R_PAREN@87..88 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@88..115 - 0: COLON@88..90 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@90..115 - 0: JS_REFERENCE_IDENTIFIER@90..111 - 0: IDENT@90..111 "AsyncIterableIterator" [] [] - 1: TS_TYPE_ARGUMENTS@111..115 - 0: L_ANGLE@111..112 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@112..113 - 0: TS_REFERENCE_TYPE@112..113 - 0: JS_REFERENCE_IDENTIFIER@112..113 - 0: IDENT@112..113 "R" [] [] - 1: (empty) - 2: R_ANGLE@113..115 ">" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@115..136 - 0: L_CURLY@115..117 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@117..117 - 2: JS_STATEMENT_LIST@117..135 - 0: JS_EXPRESSION_STATEMENT@117..135 - 0: JS_YIELD_EXPRESSION@117..135 - 0: YIELD_KW@117..123 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@123..135 - 0: (empty) - 1: JS_AWAIT_EXPRESSION@123..135 - 0: AWAIT_KW@123..129 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@129..135 - 0: JS_REFERENCE_IDENTIFIER@129..135 - 0: IDENT@129..135 "param" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@135..136 "}" [] [] - 3: COMMA@136..137 "," [] [] - 2: R_CURLY@137..139 "}" [Newline("\n")] [] - 2: R_PAREN@139..140 ")" [] [] - 1: (empty) - 4: EOF@140..141 "" [Newline("\n")] [] --- -ts_method_object_member_body_error.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ ({ - > 2 │ x<>(maybeA: any): maybeA is A { return true }, - │ ^ - 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, - 4 │ }) - - i Expected a type parameter here. - - 1 │ ({ - > 2 │ x<>(maybeA: any): maybeA is A { return true }, - │ ^ - 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, - 4 │ }) - --- -ts_method_object_member_body_error.ts:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ ({ - 2 │ x<>(maybeA: any): maybeA is A { return true }, - > 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, - │ ^ - 4 │ }) - 5 │ - - i Expected a type parameter here. - - 1 │ ({ - 2 │ x<>(maybeA: any): maybeA is A { return true }, - > 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, - │ ^ - 4 │ }) - 5 │ - --- -({ - x<>(maybeA: any): maybeA is A { return true }, - async *id<>(param: Promise): AsyncIterableIterator { yield await param }, -}) diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.rast b/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.rast deleted file mode 100644 index ec2b4402eb51..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.rast +++ /dev/null @@ -1,262 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - STAR@18..20 "*" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@20..26 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@26..27 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@27..28 ")" [] [], - }, - SEMICOLON@28..30 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@31..41 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@41..47 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@47..49 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@49..51 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@51..60 "abstract" [] [Whitespace(" ")], - }, - ], - STAR@60..62 "*" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@62..68 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@68..69 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@69..70 ")" [] [], - }, - SEMICOLON@70..72 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@72..73 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@73..80 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@80..82 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@82..83 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - STAR@83..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@91..99 "overload" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@99..100 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@100..101 ")" [] [], - }, - SEMICOLON@101..102 ";" [] [], - ], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: STAR@102..110 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@110..118 "overload" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@118..119 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@119..121 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@121..122 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@122..123 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@123..125 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@125..126 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..126 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..125 - 0: TS_DECLARE_STATEMENT@0..31 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..31 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..30 - 0: JS_BOGUS_MEMBER@18..30 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@18..18 - 1: STAR@18..20 "*" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@20..26 - 0: IDENT@20..26 "method" [] [] - 3: JS_PARAMETERS@26..28 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_PARAMETER_LIST@27..27 - 2: R_PAREN@27..28 ")" [] [] - 4: SEMICOLON@28..30 ";" [] [Whitespace(" ")] - 9: R_CURLY@30..31 "}" [] [] - 1: JS_CLASS_DECLARATION@31..73 - 0: JS_DECORATOR_LIST@31..31 - 1: ABSTRACT_KW@31..41 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@41..47 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@47..49 - 0: IDENT@47..49 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@49..51 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@51..72 - 0: JS_BOGUS_MEMBER@51..72 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@51..60 - 0: TS_ABSTRACT_MODIFIER@51..60 - 0: ABSTRACT_KW@51..60 "abstract" [] [Whitespace(" ")] - 1: STAR@60..62 "*" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@62..68 - 0: IDENT@62..68 "method" [] [] - 3: JS_PARAMETERS@68..70 - 0: L_PAREN@68..69 "(" [] [] - 1: JS_PARAMETER_LIST@69..69 - 2: R_PAREN@69..70 ")" [] [] - 4: SEMICOLON@70..72 ";" [] [Whitespace(" ")] - 9: R_CURLY@72..73 "}" [] [] - 2: JS_CLASS_DECLARATION@73..125 - 0: JS_DECORATOR_LIST@73..73 - 1: (empty) - 2: CLASS_KW@73..80 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@80..82 - 0: IDENT@80..82 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@82..83 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@83..123 - 0: JS_BOGUS_MEMBER@83..102 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@83..83 - 1: STAR@83..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@91..99 - 0: IDENT@91..99 "overload" [] [] - 3: JS_PARAMETERS@99..101 - 0: L_PAREN@99..100 "(" [] [] - 1: JS_PARAMETER_LIST@100..100 - 2: R_PAREN@100..101 ")" [] [] - 4: SEMICOLON@101..102 ";" [] [] - 1: JS_METHOD_CLASS_MEMBER@102..123 - 0: JS_METHOD_MODIFIER_LIST@102..102 - 1: (empty) - 2: STAR@102..110 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@110..118 - 0: IDENT@110..118 "overload" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@118..121 - 0: L_PAREN@118..119 "(" [] [] - 1: JS_PARAMETER_LIST@119..119 - 2: R_PAREN@119..121 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@121..123 - 0: L_CURLY@121..122 "{" [] [] - 1: JS_DIRECTIVE_LIST@122..122 - 2: JS_STATEMENT_LIST@122..122 - 3: R_CURLY@122..123 "}" [] [] - 9: R_CURLY@123..125 "}" [Newline("\n")] [] - 4: EOF@125..126 "" [Newline("\n")] [] --- -ts_method_signature_generator.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A method signature cannot be declared as a generator. - - > 1 │ declare class A { * method(); } - │ ^^^^^^^^^^^ - 2 │ abstract class B { abstract * method(); } - 3 │ class C { - --- -ts_method_signature_generator.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A method signature cannot be declared as a generator. - - 1 │ declare class A { * method(); } - > 2 │ abstract class B { abstract * method(); } - │ ^^^^^^^^^^^^^^^^^^^^ - 3 │ class C { - 4 │ * overload(); - --- -ts_method_signature_generator.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A method signature cannot be declared as a generator. - - 2 │ abstract class B { abstract * method(); } - 3 │ class C { - > 4 │ * overload(); - │ ^^^^^^^^^^^^^ - 5 │ * overload() {} - 6 │ } - --- -declare class A { * method(); } -abstract class B { abstract * method(); } -class C { - * overload(); - * overload() {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_module_err.rast b/crates/biome_js_parser/test_data/inline/err/ts_module_err.rast deleted file mode 100644 index f02e2287347c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_module_err.rast +++ /dev/null @@ -1,113 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - body: missing (required), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@16..33 ";" [] [Whitespace(" "), Comments("// missing body")], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@33..42 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@42..49 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@49..53 "\"a\"" [] [Whitespace(" ")], - }, - body: missing (optional), - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@53..61 "declare" [] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@61..68 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@68..71 "\"b\"" [] [], - }, - body: TsEmptyExternalModuleDeclarationBody { - semicolon_token: SEMICOLON@71..88 ";" [] [Whitespace(" "), Comments("// missing semi")], - }, - }, - }, - ], - eof_token: EOF@88..89 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..89 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..88 - 0: TS_DECLARE_STATEMENT@0..16 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..16 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 2: (empty) - 1: JS_EMPTY_STATEMENT@16..33 - 0: SEMICOLON@16..33 ";" [] [Whitespace(" "), Comments("// missing body")] - 2: TS_DECLARE_STATEMENT@33..53 - 0: DECLARE_KW@33..42 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@42..53 - 0: MODULE_KW@42..49 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@49..53 - 0: JS_STRING_LITERAL@49..53 "\"a\"" [] [Whitespace(" ")] - 2: (empty) - 3: TS_DECLARE_STATEMENT@53..88 - 0: DECLARE_KW@53..61 "declare" [] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@61..88 - 0: MODULE_KW@61..68 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@68..71 - 0: JS_STRING_LITERAL@68..71 "\"b\"" [] [] - 2: TS_EMPTY_EXTERNAL_MODULE_DECLARATION_BODY@71..88 - 0: SEMICOLON@71..88 ";" [] [Whitespace(" "), Comments("// missing semi")] - 4: EOF@88..89 "" [Newline("\n")] [] --- -ts_module_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `{` but instead found `;` - - > 1 │ declare module a; // missing body - │ ^ - 2 │ declare module "a" declare module "b"; // missing semi - 3 │ - - i Remove ; - --- -ts_module_err.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ declare module a; // missing body - > 2 │ declare module "a" declare module "b"; // missing semi - │ ^^^^^^^ - 3 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ declare module a; // missing body - > 2 │ declare module "a" declare module "b"; // missing semi - │ ^^^^^^^ - 3 │ - - i ...Which is required to end this statement - - 1 │ declare module a; // missing body - > 2 │ declare module "a" declare module "b"; // missing semi - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 │ - --- -declare module a; // missing body -declare module "a" declare module "b"; // missing semi diff --git a/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast b/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast deleted file mode 100644 index d7651765879b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast +++ /dev/null @@ -1,298 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@9..17 "default" [] [Whitespace(" ")], - }, - as_token: missing (required), - local_name: missing (required), - }, - ], - r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@19..24 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@24..31 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@40..42 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: TYPE_KW@42..47 "type" [] [Whitespace(" ")], - name: JsLiteralExportName { - value: IDENT@47..55 "default" [] [Whitespace(" ")], - }, - as_token: missing (required), - local_name: missing (required), - }, - ], - r_curly_token: R_CURLY@55..57 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@57..62 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@62..69 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: JS_STRING_LITERAL@80..95 "\"literal-name\"" [] [Whitespace(" ")], - }, - as_token: missing (required), - local_name: missing (required), - }, - ], - r_curly_token: R_CURLY@95..97 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@97..102 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@102..109 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@109..110 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@110..118 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: TYPE_KW@120..125 "type" [] [Whitespace(" ")], - name: JsLiteralExportName { - value: JS_STRING_LITERAL@125..140 "\"literal-name\"" [] [Whitespace(" ")], - }, - as_token: missing (required), - local_name: missing (required), - }, - ], - r_curly_token: R_CURLY@140..142 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@142..147 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@147..154 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@154..155 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@155..163 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@163..164 "{" [] [], - specifiers: JsNamedImportSpecifierList [], - r_curly_token: missing (required), - }, - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@164..165 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..165 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..164 - 0: JS_IMPORT@0..32 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@7..31 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@7..19 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..17 - 0: JS_NAMED_IMPORT_SPECIFIER@9..17 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@9..17 - 0: IDENT@9..17 "default" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] - 2: FROM_KW@19..24 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@24..31 - 0: JS_STRING_LITERAL@24..31 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@31..32 ";" [] [] - 1: JS_IMPORT@32..70 - 0: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@40..69 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@40..57 - 0: L_CURLY@40..42 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@42..55 - 0: JS_NAMED_IMPORT_SPECIFIER@42..55 - 0: TYPE_KW@42..47 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@47..55 - 0: IDENT@47..55 "default" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@55..57 "}" [] [Whitespace(" ")] - 2: FROM_KW@57..62 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@62..69 - 0: JS_STRING_LITERAL@62..69 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@69..70 ";" [] [] - 2: JS_IMPORT@70..110 - 0: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@78..109 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@78..97 - 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@80..95 - 0: JS_NAMED_IMPORT_SPECIFIER@80..95 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@80..95 - 0: JS_STRING_LITERAL@80..95 "\"literal-name\"" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@95..97 "}" [] [Whitespace(" ")] - 2: FROM_KW@97..102 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@102..109 - 0: JS_STRING_LITERAL@102..109 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@109..110 ";" [] [] - 3: JS_IMPORT@110..155 - 0: IMPORT_KW@110..118 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@118..154 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@118..142 - 0: L_CURLY@118..120 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@120..140 - 0: JS_NAMED_IMPORT_SPECIFIER@120..140 - 0: TYPE_KW@120..125 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@125..140 - 0: JS_STRING_LITERAL@125..140 "\"literal-name\"" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 2: R_CURLY@140..142 "}" [] [Whitespace(" ")] - 2: FROM_KW@142..147 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@147..154 - 0: JS_STRING_LITERAL@147..154 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@154..155 ";" [] [] - 4: JS_IMPORT@155..164 - 0: IMPORT_KW@155..163 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@163..164 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@163..164 - 0: L_CURLY@163..164 "{" [] [] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@164..164 - 2: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 2: (empty) - 4: EOF@164..165 "" [Newline("\n")] [] --- -ts_named_import_specifier_error.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `}` - - > 1 │ import { default } from "./mod"; - │ ^ - 2 │ import { type default } from "./mod"; - 3 │ import { "literal-name" } from "./mod"; - - i Remove } - --- -ts_named_import_specifier_error.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `}` - - 1 │ import { default } from "./mod"; - > 2 │ import { type default } from "./mod"; - │ ^ - 3 │ import { "literal-name" } from "./mod"; - 4 │ import { type "literal-name" } from "./mod"; - - i Remove } - --- -ts_named_import_specifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `}` - - 1 │ import { default } from "./mod"; - 2 │ import { type default } from "./mod"; - > 3 │ import { "literal-name" } from "./mod"; - │ ^ - 4 │ import { type "literal-name" } from "./mod"; - 5 │ import { - - i Remove } - --- -ts_named_import_specifier_error.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `as` but instead found `}` - - 2 │ import { type default } from "./mod"; - 3 │ import { "literal-name" } from "./mod"; - > 4 │ import { type "literal-name" } from "./mod"; - │ ^ - 5 │ import { - 6 │ - - i Remove } - --- -ts_named_import_specifier_error.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead the file ends - - 4 │ import { type "literal-name" } from "./mod"; - 5 │ import { - > 6 │ - │ - - i the file ends here - - 4 │ import { type "literal-name" } from "./mod"; - 5 │ import { - > 6 │ - │ - --- -import { default } from "./mod"; -import { type default } from "./mod"; -import { "literal-name" } from "./mod"; -import { type "literal-name" } from "./mod"; -import { diff --git a/crates/biome_js_parser/test_data/inline/err/ts_new_operator.rast b/crates/biome_js_parser/test_data/inline/err/ts_new_operator.rast deleted file mode 100644 index ba02ecd44d52..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_new_operator.rast +++ /dev/null @@ -1,94 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNewExpression { - new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..5 "A" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - operator_token: L_ANGLE@5..6 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@6..10 "test" [] [], - }, - }, - }, - operator_token: R_ANGLE@10..11 ">" [] [], - right: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@11..12 "<" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@12..16 "test" [] [], - }, - type_arguments: missing (optional), - }, - r_angle_token: R_ANGLE@16..17 ">" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@17..18 "(" [] [], - expression: missing (required), - r_paren_token: R_PAREN@18..19 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: JS_EXPRESSION_STATEMENT@0..20 - 0: JS_BINARY_EXPRESSION@0..19 - 0: JS_BINARY_EXPRESSION@0..10 - 0: JS_NEW_EXPRESSION@0..5 - 0: NEW_KW@0..4 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@4..5 - 0: JS_REFERENCE_IDENTIFIER@4..5 - 0: IDENT@4..5 "A" [] [] - 2: (empty) - 3: (empty) - 1: L_ANGLE@5..6 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@6..10 - 0: JS_REFERENCE_IDENTIFIER@6..10 - 0: IDENT@6..10 "test" [] [] - 1: R_ANGLE@10..11 ">" [] [] - 2: TS_TYPE_ASSERTION_EXPRESSION@11..19 - 0: L_ANGLE@11..12 "<" [] [] - 1: TS_REFERENCE_TYPE@12..16 - 0: JS_REFERENCE_IDENTIFIER@12..16 - 0: IDENT@12..16 "test" [] [] - 1: (empty) - 2: R_ANGLE@16..17 ">" [] [] - 3: JS_PARENTHESIZED_EXPRESSION@17..19 - 0: L_PAREN@17..18 "(" [] [] - 1: (empty) - 2: R_PAREN@18..19 ")" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 4: EOF@20..21 "" [Newline("\n")] [] --- -ts_new_operator.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Parenthesized expression didnt contain anything - - > 1 │ new A(); - │ ^ - 2 │ - - i Expected an expression here - --- -new A(); diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast b/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast deleted file mode 100644 index 499350f11960..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast +++ /dev/null @@ -1,216 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - GET_KW@3..7 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@7..8 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@8..9 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@9..10 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - L_PAREN@11..12 "(" [] [], - R_PAREN@12..13 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - r_paren_token: R_PAREN@21..22 ")" [] [], - }, - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@23..25 "(" [Newline("\n")] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - GET_KW@27..31 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@31..32 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@32..33 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@33..34 ">" [] [], - }, - L_PAREN@34..35 "(" [] [], - R_PAREN@35..36 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@36..38 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@38..40 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@40..41 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@41..43 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - r_paren_token: R_PAREN@44..45 ")" [] [], - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - ], - eof_token: EOF@46..47 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_EXPRESSION_STATEMENT@0..23 - 0: JS_PARENTHESIZED_EXPRESSION@0..22 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..21 - 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@3..20 - 0: JS_BOGUS_MEMBER@3..20 - 0: GET_KW@3..7 "get" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@7..8 - 0: IDENT@7..8 "a" [] [] - 2: TS_TYPE_PARAMETERS@8..11 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@9..10 - 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 - 1: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@10..11 ">" [] [] - 3: L_PAREN@11..12 "(" [] [] - 4: R_PAREN@12..13 ")" [] [] - 5: TS_TYPE_ANNOTATION@13..17 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@15..17 - 0: JS_REFERENCE_IDENTIFIER@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 1: (empty) - 6: JS_FUNCTION_BODY@17..20 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..18 - 3: R_CURLY@18..20 "}" [] [Whitespace(" ")] - 2: R_CURLY@20..21 "}" [] [] - 2: R_PAREN@21..22 ")" [] [] - 1: SEMICOLON@22..23 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@23..46 - 0: JS_PARENTHESIZED_EXPRESSION@23..45 - 0: L_PAREN@23..25 "(" [Newline("\n")] [] - 1: JS_OBJECT_EXPRESSION@25..44 - 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@27..43 - 0: JS_BOGUS_MEMBER@27..43 - 0: GET_KW@27..31 "get" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@31..32 - 0: IDENT@31..32 "a" [] [] - 2: TS_TYPE_PARAMETERS@32..34 - 0: L_ANGLE@32..33 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@33..33 - 2: R_ANGLE@33..34 ">" [] [] - 3: L_PAREN@34..35 "(" [] [] - 4: R_PAREN@35..36 ")" [] [] - 5: TS_TYPE_ANNOTATION@36..40 - 0: COLON@36..38 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@38..40 - 0: JS_REFERENCE_IDENTIFIER@38..40 - 0: IDENT@38..40 "A" [] [Whitespace(" ")] - 1: (empty) - 6: JS_FUNCTION_BODY@40..43 - 0: L_CURLY@40..41 "{" [] [] - 1: JS_DIRECTIVE_LIST@41..41 - 2: JS_STATEMENT_LIST@41..41 - 3: R_CURLY@41..43 "}" [] [Whitespace(" ")] - 2: R_CURLY@43..44 "}" [] [] - 2: R_PAREN@44..45 ")" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 4: EOF@46..47 "" [Newline("\n")] [] --- -ts_object_getter_type_parameters.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - > 1 │ ({ get a(): A {} }); - │ ^^^ - 2 │ ({ get a<>(): A {} }); - 3 │ - --- -ts_object_getter_type_parameters.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ ({ get a(): A {} }); - > 2 │ ({ get a<>(): A {} }); - │ ^ - 3 │ - - i Expected a type parameter here. - - 1 │ ({ get a(): A {} }); - > 2 │ ({ get a<>(): A {} }); - │ ^ - 3 │ - --- -ts_object_getter_type_parameters.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - 1 │ ({ get a(): A {} }); - > 2 │ ({ get a<>(): A {} }); - │ ^^ - 3 │ - --- -({ get a(): A {} }); -({ get a<>(): A {} }); diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast b/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast deleted file mode 100644 index 322d9e1ec846..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast +++ /dev/null @@ -1,109 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - SET_KW@3..7 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@7..8 "a" [] [], - }, - L_PAREN@8..9 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@9..14 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@14..16 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@16..22 "string" [] [], - }, - }, - initializer: missing (optional), - }, - R_PAREN@22..23 ")" [] [], - TsReturnTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@25..30 "void" [] [Whitespace(" ")], - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@30..31 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - r_paren_token: R_PAREN@34..35 ")" [] [], - }, - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - ], - eof_token: EOF@36..37 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..37 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..36 - 0: JS_EXPRESSION_STATEMENT@0..36 - 0: JS_PARENTHESIZED_EXPRESSION@0..35 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..34 - 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@3..33 - 0: JS_BOGUS_MEMBER@3..33 - 0: SET_KW@3..7 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@7..8 - 0: IDENT@7..8 "a" [] [] - 2: L_PAREN@8..9 "(" [] [] - 3: JS_FORMAL_PARAMETER@9..22 - 0: JS_DECORATOR_LIST@9..9 - 1: JS_IDENTIFIER_BINDING@9..14 - 0: IDENT@9..14 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@14..22 - 0: COLON@14..16 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@16..22 - 0: STRING_KW@16..22 "string" [] [] - 4: (empty) - 4: R_PAREN@22..23 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@23..30 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@25..30 - 0: VOID_KW@25..30 "void" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@30..33 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_DIRECTIVE_LIST@31..31 - 2: JS_STATEMENT_LIST@31..31 - 3: R_CURLY@31..33 "}" [] [Whitespace(" ")] - 2: R_CURLY@33..34 "}" [] [] - 2: R_PAREN@34..35 ")" [] [] - 1: SEMICOLON@35..36 ";" [] [] - 4: EOF@36..37 "" [Newline("\n")] [] --- -ts_object_setter_return_type.ts:1:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A 'set' accessor cannot have a return type annotation. - - > 1 │ ({ set a(value: string): void {} }); - │ ^^^^^^ - 2 │ - --- -({ set a(value: string): void {} }); diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast b/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast deleted file mode 100644 index 1ef6ff7efd74..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast +++ /dev/null @@ -1,244 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - SET_KW@3..7 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@7..8 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@8..9 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@9..10 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - L_PAREN@11..12 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@12..17 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@17..19 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@19..20 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - R_PAREN@20..22 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..25 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@28..30 "(" [Newline("\n")] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@30..32 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - SET_KW@32..36 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@36..37 "a" [] [], - }, - TsTypeParameters { - l_angle_token: L_ANGLE@37..38 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@38..39 ">" [] [], - }, - L_PAREN@39..40 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@40..45 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@45..47 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@47..48 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - R_PAREN@48..50 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@50..51 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@51..53 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@53..54 "}" [] [], - }, - r_paren_token: R_PAREN@54..55 ")" [] [], - }, - semicolon_token: SEMICOLON@55..56 ";" [] [], - }, - ], - eof_token: EOF@56..57 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..57 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..56 - 0: JS_EXPRESSION_STATEMENT@0..28 - 0: JS_PARENTHESIZED_EXPRESSION@0..27 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..26 - 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@3..25 - 0: JS_BOGUS_MEMBER@3..25 - 0: SET_KW@3..7 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@7..8 - 0: IDENT@7..8 "a" [] [] - 2: TS_TYPE_PARAMETERS@8..11 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@9..10 - 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 - 1: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@10..11 ">" [] [] - 3: L_PAREN@11..12 "(" [] [] - 4: JS_FORMAL_PARAMETER@12..20 - 0: JS_DECORATOR_LIST@12..12 - 1: JS_IDENTIFIER_BINDING@12..17 - 0: IDENT@12..17 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@17..20 - 0: COLON@17..19 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@19..20 - 0: JS_REFERENCE_IDENTIFIER@19..20 - 0: IDENT@19..20 "A" [] [] - 1: (empty) - 4: (empty) - 5: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@22..25 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..23 - 3: R_CURLY@23..25 "}" [] [Whitespace(" ")] - 2: R_CURLY@25..26 "}" [] [] - 2: R_PAREN@26..27 ")" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@28..56 - 0: JS_PARENTHESIZED_EXPRESSION@28..55 - 0: L_PAREN@28..30 "(" [Newline("\n")] [] - 1: JS_OBJECT_EXPRESSION@30..54 - 0: L_CURLY@30..32 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@32..53 - 0: JS_BOGUS_MEMBER@32..53 - 0: SET_KW@32..36 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@36..37 - 0: IDENT@36..37 "a" [] [] - 2: TS_TYPE_PARAMETERS@37..39 - 0: L_ANGLE@37..38 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@38..38 - 2: R_ANGLE@38..39 ">" [] [] - 3: L_PAREN@39..40 "(" [] [] - 4: JS_FORMAL_PARAMETER@40..48 - 0: JS_DECORATOR_LIST@40..40 - 1: JS_IDENTIFIER_BINDING@40..45 - 0: IDENT@40..45 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@45..48 - 0: COLON@45..47 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@47..48 - 0: JS_REFERENCE_IDENTIFIER@47..48 - 0: IDENT@47..48 "A" [] [] - 1: (empty) - 4: (empty) - 5: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@50..53 - 0: L_CURLY@50..51 "{" [] [] - 1: JS_DIRECTIVE_LIST@51..51 - 2: JS_STATEMENT_LIST@51..51 - 3: R_CURLY@51..53 "}" [] [Whitespace(" ")] - 2: R_CURLY@53..54 "}" [] [] - 2: R_PAREN@54..55 ")" [] [] - 1: SEMICOLON@55..56 ";" [] [] - 4: EOF@56..57 "" [Newline("\n")] [] --- -ts_object_setter_type_parameters.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - > 1 │ ({ set a(value: A) {} }); - │ ^^^ - 2 │ ({ set a<>(value: A) {} }); - 3 │ - --- -ts_object_setter_type_parameters.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found '>'. - - 1 │ ({ set a(value: A) {} }); - > 2 │ ({ set a<>(value: A) {} }); - │ ^ - 3 │ - - i Expected a type parameter here. - - 1 │ ({ set a(value: A) {} }); - > 2 │ ({ set a<>(value: A) {} }); - │ ^ - 3 │ - --- -ts_object_setter_type_parameters.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × An accessor cannot have type parameters. - - 1 │ ({ set a(value: A) {} }); - > 2 │ ({ set a<>(value: A) {} }); - │ ^^ - 3 │ - --- -({ set a(value: A) {} }); -({ set a<>(value: A) {} }); diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast b/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast deleted file mode 100644 index ae8d309db339..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast +++ /dev/null @@ -1,151 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [], - name: JsLiteralMemberName { - value: IDENT@18..23 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@23..25 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@25..31 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@31..33 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@41..43 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@45..53 "declare" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@53..58 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@58..60 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@60..66 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@66..68 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@68..69 "}" [] [], - }, - ], - eof_token: EOF@69..70 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..70 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..69 - 0: TS_DECLARE_STATEMENT@0..34 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..34 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..33 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@18..33 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..18 - 1: JS_LITERAL_MEMBER_NAME@18..23 - 0: IDENT@18..23 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@23..31 - 0: EQ@23..25 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@25..31 - 0: JS_STRING_LITERAL@25..31 "\"test\"" [] [] - 4: SEMICOLON@31..33 ";" [] [Whitespace(" ")] - 9: R_CURLY@33..34 "}" [] [] - 1: JS_CLASS_DECLARATION@34..69 - 0: JS_DECORATOR_LIST@34..34 - 1: (empty) - 2: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@41..43 - 0: IDENT@41..43 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@43..45 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@45..68 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@45..68 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@45..53 - 0: TS_DECLARE_MODIFIER@45..53 - 0: DECLARE_KW@45..53 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@53..58 - 0: IDENT@53..58 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@58..66 - 0: EQ@58..60 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@60..66 - 0: JS_STRING_LITERAL@60..66 "\"test\"" [] [] - 4: SEMICOLON@66..68 ";" [] [Whitespace(" ")] - 9: R_CURLY@68..69 "}" [] [] - 4: EOF@69..70 "" [Newline("\n")] [] --- -ts_property_initializer_ambient_context.ts:1:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In ambient contexts, properties with initializers need to be readonly. - - > 1 │ declare class A { prop = "test"; } - │ ^^^^^^^^ - 2 │ class B { declare prop = "test"; } - 3 │ - --- -ts_property_initializer_ambient_context.ts:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × In ambient contexts, properties with initializers need to be readonly. - - 1 │ declare class A { prop = "test"; } - > 2 │ class B { declare prop = "test"; } - │ ^^^^^^^^ - 3 │ - --- -declare class A { prop = "test"; } -class B { declare prop = "test"; } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast b/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast deleted file mode 100644 index fb5aeaf779c0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast +++ /dev/null @@ -1,199 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..21 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsBogusParameter { - items: [ - JsDecoratorList [], - JsObjectBindingPattern { - l_curly_token: L_CURLY@30..32 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@32..33 "x" [] [], - }, - init: missing (optional), - }, - COMMA@33..35 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@35..37 "y" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - ], - }, - }, - COMMA@38..40 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@40..50 "protected" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsBogusParameter { - items: [ - JsDecoratorList [], - JsArrayBindingPattern { - l_brack_token: L_BRACK@50..51 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@51..52 "a" [] [], - }, - init: missing (optional), - }, - COMMA@52..54 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@54..55 "b" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@55..56 "]" [] [], - }, - ], - }, - }, - ], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@61..62 "}" [] [], - }, - ], - eof_token: EOF@62..63 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..63 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..62 - 0: JS_CLASS_DECLARATION@0..62 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..61 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..61 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..21 - 0: IDENT@10..21 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@21..58 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..56 - 0: TS_PROPERTY_PARAMETER@22..38 - 0: JS_DECORATOR_LIST@22..22 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..30 - 0: TS_ACCESSIBILITY_MODIFIER@22..30 - 0: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")] - 2: JS_BOGUS_PARAMETER@30..38 - 0: JS_DECORATOR_LIST@30..30 - 1: JS_OBJECT_BINDING_PATTERN@30..38 - 0: L_CURLY@30..32 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@32..37 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@32..33 - 0: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "x" [] [] - 1: (empty) - 1: COMMA@33..35 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@35..37 - 0: JS_IDENTIFIER_BINDING@35..37 - 0: IDENT@35..37 "y" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@37..38 "}" [] [] - 1: COMMA@38..40 "," [] [Whitespace(" ")] - 2: TS_PROPERTY_PARAMETER@40..56 - 0: JS_DECORATOR_LIST@40..40 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@40..50 - 0: TS_ACCESSIBILITY_MODIFIER@40..50 - 0: PROTECTED_KW@40..50 "protected" [] [Whitespace(" ")] - 2: JS_BOGUS_PARAMETER@50..56 - 0: JS_DECORATOR_LIST@50..50 - 1: JS_ARRAY_BINDING_PATTERN@50..56 - 0: L_BRACK@50..51 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@51..55 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@51..52 - 0: JS_IDENTIFIER_BINDING@51..52 - 0: IDENT@51..52 "a" [] [] - 1: (empty) - 1: COMMA@52..54 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@54..55 - 0: JS_IDENTIFIER_BINDING@54..55 - 0: IDENT@54..55 "b" [] [] - 1: (empty) - 2: R_BRACK@55..56 "]" [] [] - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@58..61 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] - 9: R_CURLY@61..62 "}" [] [] - 4: EOF@62..63 "" [Newline("\n")] [] --- -ts_property_parameter_pattern.ts:1:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A parameter property may not be declared using a binding pattern. - - > 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } - │ ^^^^^^^^ - 2 │ - --- -ts_property_parameter_pattern.ts:1:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A parameter property may not be declared using a binding pattern. - - > 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } - │ ^^^^^^ - 2 │ - --- -class A { constructor(private { x, y }, protected [a, b]) {} } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast b/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast deleted file mode 100644 index 9c035e746d6c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast +++ /dev/null @@ -1,287 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsReadonlyModifier { - modifier_token: READONLY_KW@12..24 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@24..35 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@35..36 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@36..38 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@38..39 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsReadonlyModifier { - modifier_token: READONLY_KW@40..52 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@52..58 "method" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@58..59 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@61..62 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsReadonlyModifier { - modifier_token: READONLY_KW@63..75 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - GET_KW@75..79 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@79..83 "test" [] [], - }, - L_PAREN@83..84 "(" [] [], - R_PAREN@84..86 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@86..88 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@88..95 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@95..98 "\"a\"" [] [], - }, - semicolon_token: SEMICOLON@98..100 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@100..101 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - JsBogus { - items: [ - TsReadonlyModifier { - modifier_token: READONLY_KW@101..113 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - SET_KW@113..117 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@117..121 "test" [] [], - }, - L_PAREN@121..122 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@122..127 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@127..129 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@129..135 "string" [] [], - }, - }, - initializer: missing (optional), - }, - R_PAREN@135..137 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@137..138 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@138..139 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@139..141 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@141..142 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..142 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..141 - 0: JS_CLASS_DECLARATION@0..141 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..139 - 0: JS_BOGUS_MEMBER@12..40 - 0: JS_BOGUS@12..24 - 0: TS_READONLY_MODIFIER@12..24 - 0: READONLY_KW@12..24 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@24..35 - 0: IDENT@24..35 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@35..38 - 0: L_PAREN@35..36 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@36..36 - 2: R_PAREN@36..38 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@38..40 - 0: L_CURLY@38..39 "{" [] [] - 1: JS_DIRECTIVE_LIST@39..39 - 2: JS_STATEMENT_LIST@39..39 - 3: R_CURLY@39..40 "}" [] [] - 1: JS_BOGUS_MEMBER@40..63 - 0: JS_BOGUS@40..52 - 0: TS_READONLY_MODIFIER@40..52 - 0: READONLY_KW@40..52 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@52..58 - 0: IDENT@52..58 "method" [] [] - 2: JS_PARAMETERS@58..61 - 0: L_PAREN@58..59 "(" [] [] - 1: JS_PARAMETER_LIST@59..59 - 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@61..63 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_DIRECTIVE_LIST@62..62 - 2: JS_STATEMENT_LIST@62..62 - 3: R_CURLY@62..63 "}" [] [] - 2: JS_BOGUS_MEMBER@63..101 - 0: JS_BOGUS@63..75 - 0: TS_READONLY_MODIFIER@63..75 - 0: READONLY_KW@63..75 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@75..79 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@79..83 - 0: IDENT@79..83 "test" [] [] - 3: L_PAREN@83..84 "(" [] [] - 4: R_PAREN@84..86 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@86..101 - 0: L_CURLY@86..88 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@88..88 - 2: JS_STATEMENT_LIST@88..100 - 0: JS_RETURN_STATEMENT@88..100 - 0: RETURN_KW@88..95 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@95..98 - 0: JS_STRING_LITERAL@95..98 "\"a\"" [] [] - 2: SEMICOLON@98..100 ";" [] [Whitespace(" ")] - 3: R_CURLY@100..101 "}" [] [] - 3: JS_BOGUS_MEMBER@101..139 - 0: JS_BOGUS@101..113 - 0: TS_READONLY_MODIFIER@101..113 - 0: READONLY_KW@101..113 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@113..117 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@117..121 - 0: IDENT@117..121 "test" [] [] - 3: L_PAREN@121..122 "(" [] [] - 4: JS_FORMAL_PARAMETER@122..135 - 0: JS_DECORATOR_LIST@122..122 - 1: JS_IDENTIFIER_BINDING@122..127 - 0: IDENT@122..127 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@127..135 - 0: COLON@127..129 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@129..135 - 0: STRING_KW@129..135 "string" [] [] - 4: (empty) - 5: R_PAREN@135..137 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@137..139 - 0: L_CURLY@137..138 "{" [] [] - 1: JS_DIRECTIVE_LIST@138..138 - 2: JS_STATEMENT_LIST@138..138 - 3: R_CURLY@138..139 "}" [] [] - 9: R_CURLY@139..141 "}" [Newline("\n")] [] - 4: EOF@141..142 "" [Newline("\n")] [] --- -ts_readonly_modifier_non_class_or_indexer.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'readonly' cannot appear on a constructor declaration. - - 1 │ class Test { - > 2 │ readonly constructor() {} - │ ^^^^^^^^ - 3 │ readonly method() {} - 4 │ readonly get test() { return "a"; } - --- -ts_readonly_modifier_non_class_or_indexer.ts:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Readonly can only appear on a property declaration or index signature. - - 1 │ class Test { - 2 │ readonly constructor() {} - > 3 │ readonly method() {} - │ ^^^^^^^^ - 4 │ readonly get test() { return "a"; } - 5 │ readonly set test(value: string) {} - --- -ts_readonly_modifier_non_class_or_indexer.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Readonly can only appear on a property declaration or index signature. - - 2 │ readonly constructor() {} - 3 │ readonly method() {} - > 4 │ readonly get test() { return "a"; } - │ ^^^^^^^^ - 5 │ readonly set test(value: string) {} - 6 │ } - --- -ts_readonly_modifier_non_class_or_indexer.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Readonly can only appear on a property declaration or index signature. - - 3 │ readonly method() {} - 4 │ readonly get test() { return "a"; } - > 5 │ readonly set test(value: string) {} - │ ^^^^^^^^ - 6 │ } - 7 │ - --- -class Test { - readonly constructor() {} - readonly method() {} - readonly get test() { return "a"; } - readonly set test(value: string) {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast b/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast deleted file mode 100644 index 0b296f16646c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast +++ /dev/null @@ -1,151 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@7..10 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@14..24 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@24..31 "string" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@31..33 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@33..41 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], - assignment: TsSatisfiesAssignment { - assignment: JsBogusAssignment { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "a" [] [], - }, - }, - JsCallArguments { - l_paren_token: L_PAREN@45..46 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - }, - ], - }, - satisfies_token: SATISFIES_KW@48..58 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@58..64 "string" [] [], - }, - }, - r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@66..68 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@68..76 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@76..77 ";" [] [], - }, - ], - eof_token: EOF@77..78 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..78 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..77 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_TYPE_ANNOTATION@5..10 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@7..10 - 0: ANY_KW@7..10 "any" [] [] - 2: (empty) - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@11..42 - 0: JS_ASSIGNMENT_EXPRESSION@11..41 - 0: TS_SATISFIES_ASSIGNMENT@11..31 - 0: JS_IDENTIFIER_ASSIGNMENT@11..14 - 0: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")] - 1: SATISFIES_KW@14..24 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@24..31 - 0: STRING_KW@24..31 "string" [] [Whitespace(" ")] - 1: EQ@31..33 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@33..41 - 0: JS_STRING_LITERAL@33..41 "\"string\"" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@42..77 - 0: JS_ASSIGNMENT_EXPRESSION@42..76 - 0: JS_PARENTHESIZED_ASSIGNMENT@42..66 - 0: L_PAREN@42..44 "(" [Newline("\n")] [] - 1: TS_SATISFIES_ASSIGNMENT@44..64 - 0: JS_BOGUS_ASSIGNMENT@44..48 - 0: JS_IDENTIFIER_EXPRESSION@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "a" [] [] - 1: JS_CALL_ARGUMENTS@45..48 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@46..46 - 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 1: SATISFIES_KW@48..58 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@58..64 - 0: STRING_KW@58..64 "string" [] [] - 2: R_PAREN@64..66 ")" [] [Whitespace(" ")] - 1: EQ@66..68 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@68..76 - 0: JS_STRING_LITERAL@68..76 "\"string\"" [] [] - 1: SEMICOLON@76..77 ";" [] [] - 4: EOF@77..78 "" [Newline("\n")] [] --- -ts_satisfies_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `a()` - - 1 │ let a: any; - 2 │ a satisfies string = "string"; - > 3 │ (a() satisfies string) = "string"; - │ ^^^ - 4 │ - - i This expression cannot be assigned to - --- -let a: any; -a satisfies string = "string"; -(a() satisfies string) = "string"; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.rast b/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.rast deleted file mode 100644 index 8dc2c2202013..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.rast +++ /dev/null @@ -1,75 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@8..16 "\"hello\"" [] [Whitespace(" ")], - }, - SATISFIES_KW@16..26 "satisfies" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@26..32 "string" [] [], - }, - ], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - ], - eof_token: EOF@33..34 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..34 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..33 - 0: JS_VARIABLE_STATEMENT@0..33 - 0: JS_VARIABLE_DECLARATION@0..32 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..32 - 0: JS_VARIABLE_DECLARATOR@4..32 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..32 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@8..32 - 0: JS_STRING_LITERAL_EXPRESSION@8..16 - 0: JS_STRING_LITERAL@8..16 "\"hello\"" [] [Whitespace(" ")] - 1: SATISFIES_KW@16..26 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@26..32 - 0: STRING_KW@26..32 "string" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 4: EOF@33..34 "" [Newline("\n")] [] --- -ts_satisfies_expression.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'satisfies' expression are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. - - > 1 │ let x = "hello" satisfies string; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ - 2 │ - - i TypeScript only syntax - --- -let x = "hello" satisfies string; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast b/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast deleted file mode 100644 index 0eb9d98674ad..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast +++ /dev/null @@ -1,120 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - SET_KW@12..21 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@21..22 "a" [] [], - }, - L_PAREN@22..23 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@23..28 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@30..36 "string" [] [], - }, - }, - initializer: missing (optional), - }, - R_PAREN@36..37 ")" [] [], - TsReturnTypeAnnotation { - colon_token: COLON@37..39 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@39..44 "void" [] [Whitespace(" ")], - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@44..45 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@45..46 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@46..48 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@48..49 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..49 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..48 - 0: JS_CLASS_DECLARATION@0..48 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..46 - 0: JS_BOGUS_MEMBER@12..46 - 0: JS_METHOD_MODIFIER_LIST@12..12 - 1: SET_KW@12..21 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@21..22 - 0: IDENT@21..22 "a" [] [] - 3: L_PAREN@22..23 "(" [] [] - 4: JS_FORMAL_PARAMETER@23..36 - 0: JS_DECORATOR_LIST@23..23 - 1: JS_IDENTIFIER_BINDING@23..28 - 0: IDENT@23..28 "value" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@28..36 - 0: COLON@28..30 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@30..36 - 0: STRING_KW@30..36 "string" [] [] - 4: (empty) - 5: R_PAREN@36..37 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@37..44 - 0: COLON@37..39 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@39..44 - 0: VOID_KW@39..44 "void" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@44..46 - 0: L_CURLY@44..45 "{" [] [] - 1: JS_DIRECTIVE_LIST@45..45 - 2: JS_STATEMENT_LIST@45..45 - 3: R_CURLY@45..46 "}" [] [] - 9: R_CURLY@46..48 "}" [Newline("\n")] [] - 4: EOF@48..49 "" [Newline("\n")] [] --- -ts_setter_return_type_annotation.ts:2:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A 'set' accessor cannot have a return type annotation. - - 1 │ class Test { - > 2 │ set a(value: string): void {} - │ ^^^^^^ - 3 │ } - 4 │ - --- -class Test { - set a(value: string): void {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast b/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast deleted file mode 100644 index 70bae5cefe81..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast +++ /dev/null @@ -1,116 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsDecorator { - at_token: AT@11..15 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..19 "dec" [] [Whitespace(" ")], - }, - }, - }, - STATIC_KW@19..26 "static" [] [Whitespace(" ")], - L_CURLY@26..27 "{" [] [], - JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsThisExpression { - this_token: THIS_KW@27..36 "this" [Newline("\n"), Whitespace(" ")] [], - }, - dot_token: DOT@36..37 "." [] [], - member: JsName { - value_token: IDENT@37..39 "a" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@39..41 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@41..47 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - ], - R_CURLY@48..52 "}" [Newline("\n"), Whitespace(" ")] [], - ], - }, - ], - r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_CLASS_DECLARATION@0..54 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..52 - 0: JS_BOGUS_MEMBER@11..52 - 0: JS_DECORATOR@11..19 - 0: AT@11..15 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@15..19 - 0: JS_REFERENCE_IDENTIFIER@15..19 - 0: IDENT@15..19 "dec" [] [Whitespace(" ")] - 1: STATIC_KW@19..26 "static" [] [Whitespace(" ")] - 2: L_CURLY@26..27 "{" [] [] - 3: JS_STATEMENT_LIST@27..48 - 0: JS_EXPRESSION_STATEMENT@27..48 - 0: JS_ASSIGNMENT_EXPRESSION@27..47 - 0: JS_STATIC_MEMBER_ASSIGNMENT@27..39 - 0: JS_THIS_EXPRESSION@27..36 - 0: THIS_KW@27..36 "this" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@36..37 "." [] [] - 2: JS_NAME@37..39 - 0: IDENT@37..39 "a" [] [Whitespace(" ")] - 1: EQ@39..41 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@41..47 - 0: JS_STRING_LITERAL@41..47 "\"test\"" [] [] - 1: SEMICOLON@47..48 ";" [] [] - 4: R_CURLY@48..52 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@52..54 "}" [Newline("\n")] [] - 4: EOF@54..55 "" [Newline("\n")] [] --- -ts_static_initialization_block_member_with_decorators.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Static class blocks cannot have any modifier. - - 1 │ class Foo { - > 2 │ @dec static { - │ ^^^^ - 3 │ this.a = "test"; - 4 │ } - --- -class Foo { - @dec static { - this.a = "test"; - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.rast b/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.rast deleted file mode 100644 index c9e4fc2c3f32..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.rast +++ /dev/null @@ -1,204 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsStringLiteralType { - literal_token: JS_STRING_LITERAL@9..12 "\"a\"" [] [], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@13..19 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@19..21 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@21..23 "=" [] [Whitespace(" ")], - ty: TsStringLiteralType { - literal_token: JS_STRING_LITERAL@23..26 "\"b\"" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@26..32 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@32..34 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@34..36 "=" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - BACKTICK@36..37 "`" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - DOLLAR_CURLY@37..39 "${" [] [], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@39..41 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - JsBogus { - items: [ - IDENT@41..42 "B" [] [], - ], - }, - R_CURLY@42..43 "}" [] [], - ], - }, - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@43..46 "bcd" [] [], - }, - ], - }, - BACKTICK@46..47 "`" [] [], - ], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@47..53 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@53..55 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@55..57 "=" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - BACKTICK@57..58 "`" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - DOLLAR_CURLY@58..60 "${" [] [], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@60..62 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - JsBogus { - items: [ - IDENT@62..63 "B" [] [], - ], - }, - ], - }, - ], - }, - BACKTICK@63..64 "`" [] [], - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: TS_TYPE_ALIAS_DECLARATION@0..13 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_STRING_LITERAL_TYPE@9..12 - 0: JS_STRING_LITERAL@9..12 "\"a\"" [] [] - 5: SEMICOLON@12..13 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@13..26 - 0: TYPE_KW@13..19 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@19..21 - 0: IDENT@19..21 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@21..23 "=" [] [Whitespace(" ")] - 4: TS_STRING_LITERAL_TYPE@23..26 - 0: JS_STRING_LITERAL@23..26 "\"b\"" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@26..47 - 0: TYPE_KW@26..32 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@32..34 - 0: IDENT@32..34 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@34..36 "=" [] [Whitespace(" ")] - 4: TS_BOGUS_TYPE@36..47 - 0: BACKTICK@36..37 "`" [] [] - 1: JS_BOGUS@37..46 - 0: JS_BOGUS@37..43 - 0: DOLLAR_CURLY@37..39 "${" [] [] - 1: TS_REFERENCE_TYPE@39..41 - 0: JS_REFERENCE_IDENTIFIER@39..41 - 0: IDENT@39..41 "A" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BOGUS@41..42 - 0: IDENT@41..42 "B" [] [] - 3: R_CURLY@42..43 "}" [] [] - 1: TS_TEMPLATE_CHUNK_ELEMENT@43..46 - 0: TEMPLATE_CHUNK@43..46 "bcd" [] [] - 2: BACKTICK@46..47 "`" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@47..64 - 0: TYPE_KW@47..53 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@53..55 - 0: IDENT@53..55 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@55..57 "=" [] [Whitespace(" ")] - 4: TS_BOGUS_TYPE@57..64 - 0: BACKTICK@57..58 "`" [] [] - 1: JS_BOGUS@58..63 - 0: JS_BOGUS@58..63 - 0: DOLLAR_CURLY@58..60 "${" [] [] - 1: TS_REFERENCE_TYPE@60..62 - 0: JS_REFERENCE_IDENTIFIER@60..62 - 0: IDENT@60..62 "A" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BOGUS@62..63 - 0: IDENT@62..63 "B" [] [] - 2: BACKTICK@63..64 "`" [] [] - 5: (empty) - 4: EOF@64..65 "" [Newline("\n")] [] --- -ts_template_literal_error.ts:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead found `B` - - 1 │ type A = "a"; - 2 │ type B = "b" - > 3 │ type C = `${A B}bcd` - │ ^ - 4 │ type D = `${A B` - 5 │ - - i Remove B - --- -ts_template_literal_error.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead found `B` - - 2 │ type B = "b" - 3 │ type C = `${A B}bcd` - > 4 │ type D = `${A B` - │ ^ - 5 │ - - i Remove B - --- -type A = "a"; -type B = "b" -type C = `${A B}bcd` -type D = `${A B` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast b/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast deleted file mode 100644 index d06b8b3b096c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast +++ /dev/null @@ -1,84 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - L_BRACK@9..11 "[" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - DOT3@11..14 "..." [] [], - JsName { - value_token: IDENT@14..18 "name" [] [], - }, - QUESTION@18..19 "?" [] [], - COLON@19..21 ":" [] [Whitespace(" ")], - TsArrayType { - element_type: TsStringType { - string_token: STRING_KW@21..27 "string" [] [], - }, - l_brack_token: L_BRACK@27..28 "[" [] [], - r_brack_token: R_BRACK@28..30 "]" [] [Whitespace(" ")], - }, - ], - }, - ], - }, - R_BRACK@30..31 "]" [] [], - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@31..32 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..32 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..31 - 0: TS_TYPE_ALIAS_DECLARATION@0..31 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_BOGUS_TYPE@9..31 - 0: L_BRACK@9..11 "[" [] [Whitespace(" ")] - 1: JS_BOGUS@11..30 - 0: JS_BOGUS@11..30 - 0: DOT3@11..14 "..." [] [] - 1: JS_NAME@14..18 - 0: IDENT@14..18 "name" [] [] - 2: QUESTION@18..19 "?" [] [] - 3: COLON@19..21 ":" [] [Whitespace(" ")] - 4: TS_ARRAY_TYPE@21..30 - 0: TS_STRING_TYPE@21..27 - 0: STRING_KW@21..27 "string" [] [] - 1: L_BRACK@27..28 "[" [] [] - 2: R_BRACK@28..30 "]" [] [Whitespace(" ")] - 2: R_BRACK@30..31 "]" [] [] - 5: (empty) - 4: EOF@31..32 "" [Newline("\n")] [] --- -ts_tuple_type_cannot_be_optional_and_rest.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × A tuple member cannot be both optional and rest. - - > 1 │ type A = [ ...name?: string[] ] - │ ^^^^^^^^^^^^^^^^^^ - 2 │ - --- -type A = [ ...name?: string[] ] diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast deleted file mode 100644 index d97ce2d23f5e..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@9..10 "[" [] [], - elements: TsTupleTypeElementList [ - TsStringType { - string_token: STRING_KW@10..16 "string" [] [], - }, - COMMA@16..17 "," [] [], - ], - r_brack_token: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: TS_TYPE_ALIAS_DECLARATION@0..17 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@9..17 - 0: L_BRACK@9..10 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@10..17 - 0: TS_STRING_TYPE@10..16 - 0: STRING_KW@10..16 "string" [] [] - 1: COMMA@16..17 "," [] [] - 2: (empty) - 5: (empty) - 4: EOF@17..18 "" [Newline("\n")] [] --- -ts_tuple_type_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type but instead found the end of the file. - - 1 │ type A = [string, - > 2 │ - │ - - i Expected a type here. - - 1 │ type A = [string, - > 2 │ - │ - --- -type A = [string, diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast b/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast deleted file mode 100644 index aff9905e9423..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast +++ /dev/null @@ -1,120 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - TYPE_KW@0..5 "type" [] [Whitespace(" ")], - JsBogus { - items: [ - IDENT@5..15 "undefined" [] [Whitespace(" ")], - ], - }, - EQ@15..17 "=" [] [Whitespace(" ")], - TsAnyType { - any_token: ANY_KW@17..20 "any" [] [], - }, - SEMICOLON@20..21 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - IDENT@27..31 "any" [] [Whitespace(" ")], - ], - }, - EQ@31..33 "=" [] [Whitespace(" ")], - TsAnyType { - any_token: ANY_KW@33..36 "any" [] [], - }, - SEMICOLON@36..37 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], - JsBogus { - items: [ - IDENT@43..50 "string" [] [Whitespace(" ")], - ], - }, - EQ@50..52 "=" [] [Whitespace(" ")], - TsAnyType { - any_token: ANY_KW@52..55 "any" [] [], - }, - SEMICOLON@55..56 ";" [] [], - ], - }, - ], - eof_token: EOF@56..57 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..57 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..56 - 0: JS_BOGUS_STATEMENT@0..21 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: JS_BOGUS@5..15 - 0: IDENT@5..15 "undefined" [] [Whitespace(" ")] - 2: EQ@15..17 "=" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@17..20 - 0: ANY_KW@17..20 "any" [] [] - 4: SEMICOLON@20..21 ";" [] [] - 1: JS_BOGUS_STATEMENT@21..37 - 0: TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@27..31 - 0: IDENT@27..31 "any" [] [Whitespace(" ")] - 2: EQ@31..33 "=" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@33..36 - 0: ANY_KW@33..36 "any" [] [] - 4: SEMICOLON@36..37 ";" [] [] - 2: JS_BOGUS_STATEMENT@37..56 - 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS@43..50 - 0: IDENT@43..50 "string" [] [Whitespace(" ")] - 2: EQ@50..52 "=" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@52..55 - 0: ANY_KW@52..55 "any" [] [] - 4: SEMICOLON@55..56 ";" [] [] - 4: EOF@56..57 "" [Newline("\n")] [] --- -ts_type_alias_cannot_be_reserved_word.ts:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type alias cannot be undefined - - > 1 │ type undefined = any; - │ ^^^^^^^^^ - 2 │ type any = any; - 3 │ type string = any; - --- -ts_type_alias_cannot_be_reserved_word.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type alias cannot be any - - 1 │ type undefined = any; - > 2 │ type any = any; - │ ^^^ - 3 │ type string = any; - 4 │ - --- -ts_type_alias_cannot_be_reserved_word.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Type alias cannot be string - - 1 │ type undefined = any; - 2 │ type any = any; - > 3 │ type string = any; - │ ^^^^^^ - 4 │ - --- -type undefined = any; -type any = any; -type string = any; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast b/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast deleted file mode 100644 index b8df3b80c280..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..10 "test2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@10..12 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNewExpression { - new_token: NEW_KW@12..16 "new" [] [Whitespace(" ")], - callee: missing (required), - type_arguments: missing (optional), - arguments: missing (optional), - }, - operator_token: L_ANGLE@16..17 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..20 "any" [] [], - }, - }, - }, - operator_token: R_ANGLE@20..21 ">" [] [], - right: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..26 "Test2" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@26..27 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@27..28 ")" [] [], - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_VARIABLE_STATEMENT@0..29 - 0: JS_VARIABLE_DECLARATION@0..28 - 0: (empty) - 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..28 - 0: JS_VARIABLE_DECLARATOR@4..28 - 0: JS_IDENTIFIER_BINDING@4..10 - 0: IDENT@4..10 "test2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@10..28 - 0: EQ@10..12 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@12..28 - 0: JS_BINARY_EXPRESSION@12..20 - 0: JS_NEW_EXPRESSION@12..16 - 0: NEW_KW@12..16 "new" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 1: L_ANGLE@16..17 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@17..20 - 0: JS_REFERENCE_IDENTIFIER@17..20 - 0: IDENT@17..20 "any" [] [] - 1: R_ANGLE@20..21 ">" [] [] - 2: JS_CALL_EXPRESSION@21..28 - 0: JS_IDENTIFIER_EXPRESSION@21..26 - 0: JS_REFERENCE_IDENTIFIER@21..26 - 0: IDENT@21..26 "Test2" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@26..28 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@27..27 - 2: R_PAREN@27..28 ")" [] [] - 1: SEMICOLON@28..29 ";" [] [] - 4: EOF@29..30 "" [Newline("\n")] [] --- -ts_type_assertions_not_valid_at_new_expr.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found '<'. - - > 1 │ var test2 = new Test2(); - │ ^ - 2 │ - - i Expected an expression here. - - > 1 │ var test2 = new Test2(); - │ ^ - 2 │ - --- -var test2 = new Test2(); diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast deleted file mode 100644 index 338a3fe60152..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast +++ /dev/null @@ -1,72 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..6 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@6..7 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@7..8 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: missing (required), - }, - eq_token: missing (required), - ty: missing (required), - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@8..9 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..9 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..8 - 0: TS_TYPE_ALIAS_DECLARATION@0..8 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..6 - 0: IDENT@5..6 "A" [] [] - 2: TS_TYPE_PARAMETERS@6..8 - 0: L_ANGLE@6..7 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@7..8 - 0: TS_TYPE_PARAMETER@7..8 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 - 1: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "T" [] [] - 2: (empty) - 3: (empty) - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 4: EOF@8..9 "" [Newline("\n")] [] --- -ts_type_parameters_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `>` but instead the file ends - - 1 │ type A 2 │ - │ - - i the file ends here - - 1 │ type A 2 │ - │ - --- -type A 1 │ import type A, { B, C } from './a'; - │ ^^^^^^^^^^^^^^^^ - 2 │ - --- -import type A, { B, C } from './a'; diff --git a/crates/biome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast b/crates/biome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast deleted file mode 100644 index d4cad4ccb8b6..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast +++ /dev/null @@ -1,60 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsDefiniteVariableAnnotation { - excl_token: BANG@5..6 "!" [] [], - type_annotation: missing (required), - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@6..7 ";" [] [], - }, - ], - eof_token: EOF@7..8 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..8 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..7 - 0: JS_VARIABLE_STATEMENT@0..7 - 0: JS_VARIABLE_DECLARATION@0..6 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..6 - 0: JS_VARIABLE_DECLARATOR@4..6 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_DEFINITE_VARIABLE_ANNOTATION@5..6 - 0: BANG@5..6 "!" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@6..7 ";" [] [] - 4: EOF@7..8 "" [Newline("\n")] [] --- -ts_variable_annotation_err.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `:` but instead found `;` - - > 1 │ let a!; - │ ^ - 2 │ - - i Remove ; - --- -let a!; diff --git a/crates/biome_js_parser/test_data/inline/err/type_arguments_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/type_arguments_incomplete.rast deleted file mode 100644 index 828d00bb860f..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/type_arguments_incomplete.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "func" [] [], - }, - }, - operator_token: L_ANGLE@4..5 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@5..6 "T" [] [], - }, - }, - }, - comma_token: COMMA@6..7 "," [] [], - right: missing (required), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@7..8 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..8 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..7 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JS_SEQUENCE_EXPRESSION@0..7 - 0: JS_BINARY_EXPRESSION@0..6 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "func" [] [] - 1: L_ANGLE@4..5 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@5..6 - 0: JS_REFERENCE_IDENTIFIER@5..6 - 0: IDENT@5..6 "T" [] [] - 1: COMMA@6..7 "," [] [] - 2: (empty) - 1: (empty) - 4: EOF@7..8 "" [Newline("\n")] [] --- -type_arguments_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression but instead found the end of the file. - - 1 │ func 2 │ - │ - - i Expected an expression here. - - 1 │ func 2 │ - │ - --- -func" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@33..34 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@36..37 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - ], - }, - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@38..46 "export" [Newline("\n")] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@46..55 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@55..58 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@58..59 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@59..63 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@63..64 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@64..65 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@65..66 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@68..69 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@69..70 "}" [] [], - }, - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@70..78 "export" [Newline("\n")] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@78..87 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@87..91 "foo1" [] [], - }, - JsBogus { - items: [ - L_ANGLE@91..92 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@92..95 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@95..96 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@96..97 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@97..98 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@100..101 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@101..102 "}" [] [], - }, - ], - }, - ], - }, - JsBogusStatement { - items: [ - JsDecoratorList [], - EXPORT_KW@102..110 "export" [Newline("\n")] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@110..119 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@119..123 "foo2" [] [], - }, - JsBogus { - items: [ - L_ANGLE@123..124 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@124..128 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@128..129 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@129..130 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@130..131 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@131..133 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@133..134 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@134..135 "}" [] [], - }, - ], - }, - ], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@140..143 "foo" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@143..145 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@145..148 "Foo" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@148..149 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@149..152 "in" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - missing separator, - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@152..153 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@153..154 ">" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@159..162 "foo" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@162..164 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@164..167 "Foo" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@167..168 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@168..172 "out" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - missing separator, - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@172..173 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@173..174 ">" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - DECLARE_KW@174..183 "declare" [Newline("\n")] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@183..192 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@192..195 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@195..196 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@196..199 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@199..200 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@200..201 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@201..202 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@202..203 ")" [] [], - }, - ], - }, - ], - }, - JsBogusStatement { - items: [ - DECLARE_KW@203..212 "declare" [Newline("\n")] [Whitespace(" ")], - JsBogusStatement { - items: [ - FUNCTION_KW@212..221 "function" [] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@221..224 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@224..225 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@225..229 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@229..230 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@230..231 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@231..232 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@232..233 ")" [] [], - }, - ], - }, - ], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@242..246 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@246..249 "foo" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@249..251 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@251..254 "Foo" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@254..255 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@255..258 "in" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - missing separator, - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@258..259 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@259..260 ">" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@269..273 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@273..276 "foo" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@276..278 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@278..281 "Foo" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@281..282 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@282..286 "out" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - missing separator, - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@286..287 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@287..288 ">" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@288..293 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@293..295 "=" [] [Whitespace(" ")], - right: JsBogusExpression { - items: [ - FUNCTION_KW@295..304 "function" [] [Whitespace(" ")], - JsBogus { - items: [ - L_ANGLE@304..305 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@305..308 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@308..309 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@309..310 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@310..311 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@311..313 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@313..314 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@314..315 "}" [] [], - }, - ], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@315..320 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@320..322 "=" [] [Whitespace(" ")], - right: JsBogusExpression { - items: [ - FUNCTION_KW@322..331 "function" [] [Whitespace(" ")], - JsBogus { - items: [ - L_ANGLE@331..332 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@332..336 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@336..337 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@337..338 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@338..339 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@339..341 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@341..342 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@342..343 "}" [] [], - }, - ], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@343..350 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@350..354 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@354..356 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@356..359 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@359..360 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@360..363 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@363..364 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@364..365 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@365..366 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@366..367 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@367..369 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@369..371 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@371..372 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@372..374 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@374..375 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@375..382 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@382..386 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@386..388 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsMethodModifierList [], - JsLiteralMemberName { - value: IDENT@388..391 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@391..392 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@392..396 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@396..397 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@397..398 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@398..399 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@399..400 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@400..402 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@402..404 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@404..405 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@405..407 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@407..408 "}" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@408..413 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@413..415 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@415..417 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - JsLiteralMemberName { - value: IDENT@417..420 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@420..421 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@421..424 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@424..425 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@425..426 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@426..427 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@427..428 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@428..430 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@430..432 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@432..433 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@433..435 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@435..436 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@436..437 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@437..442 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@442..444 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@444..446 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsBogusMember { - items: [ - JsLiteralMemberName { - value: IDENT@446..449 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@449..450 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@450..454 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@454..455 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@455..456 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@456..457 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@457..458 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@458..460 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@460..462 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@462..463 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@463..465 "}" [] [Whitespace(" ")], - }, - ], - }, - ], - r_curly_token: R_CURLY@465..466 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@466..467 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_ANGLE@467..469 "<" [Newline("\n")] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@469..472 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@472..473 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@473..474 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@474..475 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@475..477 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@477..480 "=>" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@480..481 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@481..482 "}" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@482..483 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_ANGLE@483..485 "<" [Newline("\n")] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@485..489 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@489..490 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@490..491 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@491..492 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@492..494 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@494..497 "=>" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@497..498 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@498..499 "}" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@499..500 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_ANGLE@500..502 "<" [Newline("\n")] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@502..505 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@505..506 "T" [] [], - }, - ], - }, - COMMA@506..508 "," [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@508..512 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@512..513 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@513..514 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@514..515 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@515..517 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@517..520 "=>" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@520..521 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@521..522 "}" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@522..523 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@528..529 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@529..531 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - JsBogus { - items: [ - L_ANGLE@531..532 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@532..535 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@535..536 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@536..537 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@537..538 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@538..540 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@540..543 "=>" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@543..544 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@544..545 "}" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@545..546 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@551..552 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@552..554 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - JsBogus { - items: [ - L_ANGLE@554..555 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@555..559 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@559..560 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@560..561 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@561..562 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@562..564 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@564..567 "=>" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@567..568 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@568..569 "}" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@569..570 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@575..576 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@576..578 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - JsBogus { - items: [ - L_ANGLE@578..579 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@579..582 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@582..583 "T" [] [], - }, - ], - }, - COMMA@583..585 "," [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@585..589 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@589..590 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@590..591 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@591..592 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@592..594 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@594..597 "=>" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@597..598 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@598..599 "}" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@599..600 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@605..606 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@606..608 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - NEW_KW@608..612 "new" [] [Whitespace(" ")], - JsBogus { - items: [ - L_ANGLE@612..613 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@613..616 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@616..617 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@617..618 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@618..619 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@619..621 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@621..624 "=>" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@624..625 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@625..626 "}" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@626..627 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@632..633 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@633..635 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - NEW_KW@635..639 "new" [] [Whitespace(" ")], - JsBogus { - items: [ - L_ANGLE@639..640 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@640..644 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@644..645 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@645..646 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@646..647 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@647..649 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@649..652 "=>" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@652..653 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@653..654 "}" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@654..655 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@660..661 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@661..663 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - NEW_KW@663..667 "new" [] [Whitespace(" ")], - JsBogus { - items: [ - L_ANGLE@667..668 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@668..671 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@671..672 "T" [] [], - }, - ], - }, - COMMA@672..674 "," [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@674..678 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@678..679 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@679..680 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@680..681 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@681..683 ")" [] [Whitespace(" ")], - }, - FAT_ARROW@683..686 "=>" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@686..687 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@687..688 "}" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@688..689 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@694..695 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@695..697 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - L_CURLY@697..699 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsLiteralMemberName { - value: IDENT@699..700 "y" [] [], - }, - JsBogus { - items: [ - L_ANGLE@700..701 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@701..704 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@704..705 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@705..706 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@706..707 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@707..708 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@708..710 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@710..714 "any" [] [Whitespace(" ")], - }, - }, - ], - }, - ], - }, - R_CURLY@714..715 "}" [] [], - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@715..716 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@721..722 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@722..724 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - L_CURLY@724..726 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsLiteralMemberName { - value: IDENT@726..727 "y" [] [], - }, - JsBogus { - items: [ - L_ANGLE@727..728 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@728..732 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@732..733 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@733..734 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@734..735 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@735..736 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@736..738 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@738..742 "any" [] [Whitespace(" ")], - }, - }, - ], - }, - ], - }, - R_CURLY@742..743 "}" [] [], - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@743..744 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@749..750 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@750..752 ":" [] [Whitespace(" ")], - ty: TsBogusType { - items: [ - L_CURLY@752..754 "{" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsLiteralMemberName { - value: IDENT@754..755 "y" [] [], - }, - JsBogus { - items: [ - L_ANGLE@755..756 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@756..759 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@759..760 "T" [] [], - }, - ], - }, - COMMA@760..762 "," [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@762..766 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@766..767 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@767..768 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@768..769 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@769..770 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@770..772 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@772..776 "any" [] [Whitespace(" ")], - }, - }, - ], - }, - ], - }, - R_CURLY@776..777 "}" [] [], - ], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@777..778 ";" [] [], - }, - JsBogusStatement { - items: [ - TYPE_KW@778..784 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@784..787 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@787..788 "<" [] [], - JsBogus { - items: [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@788..789 "i" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - TsTypeParameterModifierList [], - TsBogusType { - items: [ - ERROR_TOKEN@789..790 "\\" [] [], - ], - }, - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@790..797 "\\u006E" [] [Whitespace(" ")], - }, - constraint: missing (optional), - default: missing (optional), - }, - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@797..798 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - }, - R_ANGLE@798..800 ">" [] [Whitespace(" ")], - ], - }, - EQ@800..802 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@802..803 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@803..804 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@804..810 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@810..813 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@813..814 "<" [] [], - JsBogus { - items: [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@814..816 "ou" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - TsTypeParameterModifierList [], - TsBogusType { - items: [ - ERROR_TOKEN@816..817 "\\" [] [], - ], - }, - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@817..824 "\\u0074" [] [Whitespace(" ")], - }, - constraint: missing (optional), - default: missing (optional), - }, - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@824..825 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - }, - R_ANGLE@825..827 ">" [] [Whitespace(" ")], - ], - }, - EQ@827..829 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@829..830 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@830..831 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@831..837 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@837..840 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@840..841 "<" [] [], - JsBogus { - items: [ - TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@841..844 "in" [] [Whitespace(" ")], - }, - ], - TsBogusType { - items: [ - IN_KW@844..846 "in" [] [], - ], - }, - ], - }, - R_ANGLE@846..848 ">" [] [Whitespace(" ")], - ], - }, - EQ@848..850 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@850..851 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@851..852 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@852..858 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@858..861 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@861..862 "<" [] [], - JsBogus { - items: [ - TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@862..866 "out" [] [Whitespace(" ")], - }, - ], - TsBogusType { - items: [ - IN_KW@866..868 "in" [] [], - ], - }, - ], - }, - R_ANGLE@868..870 ">" [] [Whitespace(" ")], - ], - }, - EQ@870..872 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@872..873 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@873..874 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@874..880 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@880..883 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@883..884 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - TsOutModifier { - modifier_token: OUT_KW@884..888 "out" [] [Whitespace(" ")], - }, - IN_KW@888..891 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@891..892 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@892..894 ">" [] [Whitespace(" ")], - ], - }, - EQ@894..896 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@896..897 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@897..898 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@898..904 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@904..907 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@907..908 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - TsTypeParameterModifierList [], - JsBogus { - items: [ - IDENT@908..915 "public" [] [Whitespace(" ")], - ], - }, - ], - }, - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@915..916 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - }, - R_ANGLE@916..918 ">" [] [Whitespace(" ")], - ], - }, - EQ@918..920 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@920..921 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@921..922 "}" [] [], - }, - ], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@922..928 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@928..931 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@931..932 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@932..937 "innn" [] [Whitespace(" ")], - }, - constraint: missing (optional), - default: missing (optional), - }, - missing separator, - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@937..938 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@938..940 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@940..942 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@942..943 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@943..944 "}" [] [], - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - TYPE_KW@944..950 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@950..953 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@953..954 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - TsInModifier { - modifier_token: IN_KW@954..957 "in" [] [Whitespace(" ")], - }, - TsOutModifier { - modifier_token: OUT_KW@957..961 "out" [] [Whitespace(" ")], - }, - IN_KW@961..964 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@964..965 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@965..967 ">" [] [Whitespace(" ")], - ], - }, - EQ@967..969 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@969..970 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@970..971 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@971..977 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@977..980 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@980..981 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - TsInModifier { - modifier_token: IN_KW@981..984 "in" [] [Whitespace(" ")], - }, - TsOutModifier { - modifier_token: OUT_KW@984..988 "out" [] [Whitespace(" ")], - }, - OUT_KW@988..992 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@992..993 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@993..995 ">" [] [Whitespace(" ")], - ], - }, - EQ@995..997 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@997..998 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@998..999 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - FUNCTION_KW@999..1009 "function" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@1009..1012 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@1012..1013 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - IN_KW@1013..1016 "in" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@1016..1017 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@1017..1018 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@1018..1019 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1019..1021 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@1021..1022 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1022..1023 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - FUNCTION_KW@1023..1033 "function" [Newline("\n")] [Whitespace(" ")], - JsIdentifierBinding { - name_token: IDENT@1033..1036 "foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@1036..1037 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - OUT_KW@1037..1041 "out" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@1041..1042 "T" [] [], - }, - ], - }, - ], - }, - R_ANGLE@1042..1043 ">" [] [], - ], - }, - JsParameters { - l_paren_token: L_PAREN@1043..1044 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1044..1046 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@1046..1047 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1047..1048 "}" [] [], - }, - ], - }, - JsBogusStatement { - items: [ - TYPE_KW@1048..1054 "type" [Newline("\n")] [Whitespace(" ")], - TsIdentifierBinding { - name_token: IDENT@1054..1057 "Foo" [] [], - }, - JsBogus { - items: [ - L_ANGLE@1057..1058 "<" [] [], - JsBogus { - items: [ - JsBogus { - items: [ - JsBogus { - items: [ - CONST_KW@1058..1064 "const" [] [Whitespace(" ")], - ], - }, - TsTypeParameterName { - ident_token: IDENT@1064..1065 "U" [] [], - }, - ], - }, - ], - }, - R_ANGLE@1065..1067 ">" [] [Whitespace(" ")], - ], - }, - EQ@1067..1069 "=" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@1069..1070 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@1070..1071 "}" [] [], - }, - SEMICOLON@1071..1072 ";" [] [], - ], - }, - ], - eof_token: EOF@1072..1073 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..1073 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..1072 - 0: JS_BOGUS_STATEMENT@0..38 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_BOGUS@7..38 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_BOGUS@15..38 - 0: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@24..27 - 0: IDENT@24..27 "foo" [] [] - 2: JS_BOGUS@27..33 - 0: L_ANGLE@27..28 "<" [] [] - 1: JS_BOGUS@28..32 - 0: JS_BOGUS@28..32 - 0: JS_BOGUS@28..31 - 0: IN_KW@28..31 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@31..32 - 0: IDENT@31..32 "T" [] [] - 2: R_ANGLE@32..33 ">" [] [] - 3: JS_PARAMETERS@33..36 - 0: L_PAREN@33..34 "(" [] [] - 1: JS_PARAMETER_LIST@34..34 - 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@36..38 - 0: L_CURLY@36..37 "{" [] [] - 1: JS_DIRECTIVE_LIST@37..37 - 2: JS_STATEMENT_LIST@37..37 - 3: R_CURLY@37..38 "}" [] [] - 1: JS_BOGUS_STATEMENT@38..70 - 0: JS_DECORATOR_LIST@38..38 - 1: EXPORT_KW@38..46 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@46..70 - 0: FUNCTION_KW@46..55 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@55..58 - 0: IDENT@55..58 "foo" [] [] - 2: JS_BOGUS@58..65 - 0: L_ANGLE@58..59 "<" [] [] - 1: JS_BOGUS@59..64 - 0: JS_BOGUS@59..64 - 0: JS_BOGUS@59..63 - 0: OUT_KW@59..63 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@63..64 - 0: IDENT@63..64 "T" [] [] - 2: R_ANGLE@64..65 ">" [] [] - 3: JS_PARAMETERS@65..68 - 0: L_PAREN@65..66 "(" [] [] - 1: JS_PARAMETER_LIST@66..66 - 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@68..70 - 0: L_CURLY@68..69 "{" [] [] - 1: JS_DIRECTIVE_LIST@69..69 - 2: JS_STATEMENT_LIST@69..69 - 3: R_CURLY@69..70 "}" [] [] - 2: JS_BOGUS_STATEMENT@70..102 - 0: JS_DECORATOR_LIST@70..70 - 1: EXPORT_KW@70..78 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@78..102 - 0: FUNCTION_KW@78..87 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@87..91 - 0: IDENT@87..91 "foo1" [] [] - 2: JS_BOGUS@91..97 - 0: L_ANGLE@91..92 "<" [] [] - 1: JS_BOGUS@92..96 - 0: JS_BOGUS@92..96 - 0: JS_BOGUS@92..95 - 0: IN_KW@92..95 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@95..96 - 0: IDENT@95..96 "T" [] [] - 2: R_ANGLE@96..97 ">" [] [] - 3: JS_PARAMETERS@97..100 - 0: L_PAREN@97..98 "(" [] [] - 1: JS_PARAMETER_LIST@98..98 - 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@100..102 - 0: L_CURLY@100..101 "{" [] [] - 1: JS_DIRECTIVE_LIST@101..101 - 2: JS_STATEMENT_LIST@101..101 - 3: R_CURLY@101..102 "}" [] [] - 3: JS_BOGUS_STATEMENT@102..135 - 0: JS_DECORATOR_LIST@102..102 - 1: EXPORT_KW@102..110 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_BOGUS_STATEMENT@110..135 - 0: FUNCTION_KW@110..119 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@119..123 - 0: IDENT@119..123 "foo2" [] [] - 2: JS_BOGUS@123..130 - 0: L_ANGLE@123..124 "<" [] [] - 1: JS_BOGUS@124..129 - 0: JS_BOGUS@124..129 - 0: JS_BOGUS@124..128 - 0: OUT_KW@124..128 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@128..129 - 0: IDENT@128..129 "T" [] [] - 2: R_ANGLE@129..130 ">" [] [] - 3: JS_PARAMETERS@130..133 - 0: L_PAREN@130..131 "(" [] [] - 1: JS_PARAMETER_LIST@131..131 - 2: R_PAREN@131..133 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@133..135 - 0: L_CURLY@133..134 "{" [] [] - 1: JS_DIRECTIVE_LIST@134..134 - 2: JS_STATEMENT_LIST@134..134 - 3: R_CURLY@134..135 "}" [] [] - 4: JS_VARIABLE_STATEMENT@135..154 - 0: JS_VARIABLE_DECLARATION@135..154 - 0: (empty) - 1: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@140..154 - 0: JS_VARIABLE_DECLARATOR@140..154 - 0: JS_IDENTIFIER_BINDING@140..143 - 0: IDENT@140..143 "foo" [] [] - 1: TS_TYPE_ANNOTATION@143..154 - 0: COLON@143..145 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@145..154 - 0: JS_REFERENCE_IDENTIFIER@145..148 - 0: IDENT@145..148 "Foo" [] [] - 1: TS_TYPE_ARGUMENTS@148..154 - 0: L_ANGLE@148..149 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@149..153 - 0: TS_REFERENCE_TYPE@149..152 - 0: JS_REFERENCE_IDENTIFIER@149..152 - 0: IDENT@149..152 "in" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: TS_REFERENCE_TYPE@152..153 - 0: JS_REFERENCE_IDENTIFIER@152..153 - 0: IDENT@152..153 "T" [] [] - 1: (empty) - 2: R_ANGLE@153..154 ">" [] [] - 2: (empty) - 1: (empty) - 5: JS_VARIABLE_STATEMENT@154..174 - 0: JS_VARIABLE_DECLARATION@154..174 - 0: (empty) - 1: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@159..174 - 0: JS_VARIABLE_DECLARATOR@159..174 - 0: JS_IDENTIFIER_BINDING@159..162 - 0: IDENT@159..162 "foo" [] [] - 1: TS_TYPE_ANNOTATION@162..174 - 0: COLON@162..164 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@164..174 - 0: JS_REFERENCE_IDENTIFIER@164..167 - 0: IDENT@164..167 "Foo" [] [] - 1: TS_TYPE_ARGUMENTS@167..174 - 0: L_ANGLE@167..168 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@168..173 - 0: TS_REFERENCE_TYPE@168..172 - 0: JS_REFERENCE_IDENTIFIER@168..172 - 0: IDENT@168..172 "out" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: TS_REFERENCE_TYPE@172..173 - 0: JS_REFERENCE_IDENTIFIER@172..173 - 0: IDENT@172..173 "T" [] [] - 1: (empty) - 2: R_ANGLE@173..174 ">" [] [] - 2: (empty) - 1: (empty) - 6: JS_BOGUS_STATEMENT@174..203 - 0: DECLARE_KW@174..183 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@183..203 - 0: FUNCTION_KW@183..192 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@192..195 - 0: IDENT@192..195 "foo" [] [] - 2: JS_BOGUS@195..201 - 0: L_ANGLE@195..196 "<" [] [] - 1: JS_BOGUS@196..200 - 0: JS_BOGUS@196..200 - 0: JS_BOGUS@196..199 - 0: IN_KW@196..199 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@199..200 - 0: IDENT@199..200 "T" [] [] - 2: R_ANGLE@200..201 ">" [] [] - 3: JS_PARAMETERS@201..203 - 0: L_PAREN@201..202 "(" [] [] - 1: JS_PARAMETER_LIST@202..202 - 2: R_PAREN@202..203 ")" [] [] - 7: JS_BOGUS_STATEMENT@203..233 - 0: DECLARE_KW@203..212 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS_STATEMENT@212..233 - 0: FUNCTION_KW@212..221 "function" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@221..224 - 0: IDENT@221..224 "foo" [] [] - 2: JS_BOGUS@224..231 - 0: L_ANGLE@224..225 "<" [] [] - 1: JS_BOGUS@225..230 - 0: JS_BOGUS@225..230 - 0: JS_BOGUS@225..229 - 0: OUT_KW@225..229 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@229..230 - 0: IDENT@229..230 "T" [] [] - 2: R_ANGLE@230..231 ">" [] [] - 3: JS_PARAMETERS@231..233 - 0: L_PAREN@231..232 "(" [] [] - 1: JS_PARAMETER_LIST@232..232 - 2: R_PAREN@232..233 ")" [] [] - 8: TS_DECLARE_STATEMENT@233..260 - 0: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@242..260 - 0: JS_VARIABLE_DECLARATION@242..260 - 0: (empty) - 1: LET_KW@242..246 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@246..260 - 0: JS_VARIABLE_DECLARATOR@246..260 - 0: JS_IDENTIFIER_BINDING@246..249 - 0: IDENT@246..249 "foo" [] [] - 1: TS_TYPE_ANNOTATION@249..260 - 0: COLON@249..251 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@251..260 - 0: JS_REFERENCE_IDENTIFIER@251..254 - 0: IDENT@251..254 "Foo" [] [] - 1: TS_TYPE_ARGUMENTS@254..260 - 0: L_ANGLE@254..255 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@255..259 - 0: TS_REFERENCE_TYPE@255..258 - 0: JS_REFERENCE_IDENTIFIER@255..258 - 0: IDENT@255..258 "in" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: TS_REFERENCE_TYPE@258..259 - 0: JS_REFERENCE_IDENTIFIER@258..259 - 0: IDENT@258..259 "T" [] [] - 1: (empty) - 2: R_ANGLE@259..260 ">" [] [] - 2: (empty) - 1: (empty) - 9: TS_DECLARE_STATEMENT@260..288 - 0: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@269..288 - 0: JS_VARIABLE_DECLARATION@269..288 - 0: (empty) - 1: LET_KW@269..273 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@273..288 - 0: JS_VARIABLE_DECLARATOR@273..288 - 0: JS_IDENTIFIER_BINDING@273..276 - 0: IDENT@273..276 "foo" [] [] - 1: TS_TYPE_ANNOTATION@276..288 - 0: COLON@276..278 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@278..288 - 0: JS_REFERENCE_IDENTIFIER@278..281 - 0: IDENT@278..281 "Foo" [] [] - 1: TS_TYPE_ARGUMENTS@281..288 - 0: L_ANGLE@281..282 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@282..287 - 0: TS_REFERENCE_TYPE@282..286 - 0: JS_REFERENCE_IDENTIFIER@282..286 - 0: IDENT@282..286 "out" [] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 2: TS_REFERENCE_TYPE@286..287 - 0: JS_REFERENCE_IDENTIFIER@286..287 - 0: IDENT@286..287 "T" [] [] - 1: (empty) - 2: R_ANGLE@287..288 ">" [] [] - 2: (empty) - 1: (empty) - 10: JS_EXPRESSION_STATEMENT@288..315 - 0: JS_ASSIGNMENT_EXPRESSION@288..315 - 0: JS_IDENTIFIER_ASSIGNMENT@288..293 - 0: IDENT@288..293 "foo" [Newline("\n")] [Whitespace(" ")] - 1: EQ@293..295 "=" [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@295..315 - 0: FUNCTION_KW@295..304 "function" [] [Whitespace(" ")] - 1: JS_BOGUS@304..310 - 0: L_ANGLE@304..305 "<" [] [] - 1: JS_BOGUS@305..309 - 0: JS_BOGUS@305..309 - 0: JS_BOGUS@305..308 - 0: IN_KW@305..308 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@308..309 - 0: IDENT@308..309 "T" [] [] - 2: R_ANGLE@309..310 ">" [] [] - 2: JS_PARAMETERS@310..313 - 0: L_PAREN@310..311 "(" [] [] - 1: JS_PARAMETER_LIST@311..311 - 2: R_PAREN@311..313 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@313..315 - 0: L_CURLY@313..314 "{" [] [] - 1: JS_DIRECTIVE_LIST@314..314 - 2: JS_STATEMENT_LIST@314..314 - 3: R_CURLY@314..315 "}" [] [] - 1: (empty) - 11: JS_EXPRESSION_STATEMENT@315..343 - 0: JS_ASSIGNMENT_EXPRESSION@315..343 - 0: JS_IDENTIFIER_ASSIGNMENT@315..320 - 0: IDENT@315..320 "foo" [Newline("\n")] [Whitespace(" ")] - 1: EQ@320..322 "=" [] [Whitespace(" ")] - 2: JS_BOGUS_EXPRESSION@322..343 - 0: FUNCTION_KW@322..331 "function" [] [Whitespace(" ")] - 1: JS_BOGUS@331..338 - 0: L_ANGLE@331..332 "<" [] [] - 1: JS_BOGUS@332..337 - 0: JS_BOGUS@332..337 - 0: JS_BOGUS@332..336 - 0: OUT_KW@332..336 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@336..337 - 0: IDENT@336..337 "T" [] [] - 2: R_ANGLE@337..338 ">" [] [] - 2: JS_PARAMETERS@338..341 - 0: L_PAREN@338..339 "(" [] [] - 1: JS_PARAMETER_LIST@339..339 - 2: R_PAREN@339..341 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@341..343 - 0: L_CURLY@341..342 "{" [] [] - 1: JS_DIRECTIVE_LIST@342..342 - 2: JS_STATEMENT_LIST@342..342 - 3: R_CURLY@342..343 "}" [] [] - 1: (empty) - 12: JS_CLASS_DECLARATION@343..375 - 0: JS_DECORATOR_LIST@343..343 - 1: (empty) - 2: CLASS_KW@343..350 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@350..354 - 0: IDENT@350..354 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@354..356 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@356..374 - 0: JS_BOGUS_MEMBER@356..374 - 0: JS_METHOD_MODIFIER_LIST@356..356 - 1: JS_LITERAL_MEMBER_NAME@356..359 - 0: IDENT@356..359 "foo" [] [] - 2: JS_BOGUS@359..365 - 0: L_ANGLE@359..360 "<" [] [] - 1: JS_BOGUS@360..364 - 0: JS_BOGUS@360..364 - 0: JS_BOGUS@360..363 - 0: IN_KW@360..363 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@363..364 - 0: IDENT@363..364 "T" [] [] - 2: R_ANGLE@364..365 ">" [] [] - 3: JS_PARAMETERS@365..367 - 0: L_PAREN@365..366 "(" [] [] - 1: JS_PARAMETER_LIST@366..366 - 2: R_PAREN@366..367 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@367..371 - 0: COLON@367..369 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@369..371 - 0: JS_REFERENCE_IDENTIFIER@369..371 - 0: IDENT@369..371 "T" [] [Whitespace(" ")] - 1: (empty) - 5: JS_FUNCTION_BODY@371..374 - 0: L_CURLY@371..372 "{" [] [] - 1: JS_DIRECTIVE_LIST@372..372 - 2: JS_STATEMENT_LIST@372..372 - 3: R_CURLY@372..374 "}" [] [Whitespace(" ")] - 9: R_CURLY@374..375 "}" [] [] - 13: JS_CLASS_DECLARATION@375..408 - 0: JS_DECORATOR_LIST@375..375 - 1: (empty) - 2: CLASS_KW@375..382 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@382..386 - 0: IDENT@382..386 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@386..388 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@388..407 - 0: JS_BOGUS_MEMBER@388..407 - 0: JS_METHOD_MODIFIER_LIST@388..388 - 1: JS_LITERAL_MEMBER_NAME@388..391 - 0: IDENT@388..391 "foo" [] [] - 2: JS_BOGUS@391..398 - 0: L_ANGLE@391..392 "<" [] [] - 1: JS_BOGUS@392..397 - 0: JS_BOGUS@392..397 - 0: JS_BOGUS@392..396 - 0: OUT_KW@392..396 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@396..397 - 0: IDENT@396..397 "T" [] [] - 2: R_ANGLE@397..398 ">" [] [] - 3: JS_PARAMETERS@398..400 - 0: L_PAREN@398..399 "(" [] [] - 1: JS_PARAMETER_LIST@399..399 - 2: R_PAREN@399..400 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@400..404 - 0: COLON@400..402 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@402..404 - 0: JS_REFERENCE_IDENTIFIER@402..404 - 0: IDENT@402..404 "T" [] [Whitespace(" ")] - 1: (empty) - 5: JS_FUNCTION_BODY@404..407 - 0: L_CURLY@404..405 "{" [] [] - 1: JS_DIRECTIVE_LIST@405..405 - 2: JS_STATEMENT_LIST@405..405 - 3: R_CURLY@405..407 "}" [] [Whitespace(" ")] - 9: R_CURLY@407..408 "}" [] [] - 14: JS_EXPRESSION_STATEMENT@408..437 - 0: JS_ASSIGNMENT_EXPRESSION@408..436 - 0: JS_IDENTIFIER_ASSIGNMENT@408..413 - 0: IDENT@408..413 "foo" [Newline("\n")] [Whitespace(" ")] - 1: EQ@413..415 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@415..436 - 0: L_CURLY@415..417 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@417..435 - 0: JS_BOGUS_MEMBER@417..435 - 0: JS_LITERAL_MEMBER_NAME@417..420 - 0: IDENT@417..420 "foo" [] [] - 1: JS_BOGUS@420..426 - 0: L_ANGLE@420..421 "<" [] [] - 1: JS_BOGUS@421..425 - 0: JS_BOGUS@421..425 - 0: JS_BOGUS@421..424 - 0: IN_KW@421..424 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@424..425 - 0: IDENT@424..425 "T" [] [] - 2: R_ANGLE@425..426 ">" [] [] - 2: JS_PARAMETERS@426..428 - 0: L_PAREN@426..427 "(" [] [] - 1: JS_PARAMETER_LIST@427..427 - 2: R_PAREN@427..428 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@428..432 - 0: COLON@428..430 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@430..432 - 0: JS_REFERENCE_IDENTIFIER@430..432 - 0: IDENT@430..432 "T" [] [Whitespace(" ")] - 1: (empty) - 4: JS_FUNCTION_BODY@432..435 - 0: L_CURLY@432..433 "{" [] [] - 1: JS_DIRECTIVE_LIST@433..433 - 2: JS_STATEMENT_LIST@433..433 - 3: R_CURLY@433..435 "}" [] [Whitespace(" ")] - 2: R_CURLY@435..436 "}" [] [] - 1: SEMICOLON@436..437 ";" [] [] - 15: JS_EXPRESSION_STATEMENT@437..467 - 0: JS_ASSIGNMENT_EXPRESSION@437..466 - 0: JS_IDENTIFIER_ASSIGNMENT@437..442 - 0: IDENT@437..442 "foo" [Newline("\n")] [Whitespace(" ")] - 1: EQ@442..444 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@444..466 - 0: L_CURLY@444..446 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@446..465 - 0: JS_BOGUS_MEMBER@446..465 - 0: JS_LITERAL_MEMBER_NAME@446..449 - 0: IDENT@446..449 "foo" [] [] - 1: JS_BOGUS@449..456 - 0: L_ANGLE@449..450 "<" [] [] - 1: JS_BOGUS@450..455 - 0: JS_BOGUS@450..455 - 0: JS_BOGUS@450..454 - 0: OUT_KW@450..454 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@454..455 - 0: IDENT@454..455 "T" [] [] - 2: R_ANGLE@455..456 ">" [] [] - 2: JS_PARAMETERS@456..458 - 0: L_PAREN@456..457 "(" [] [] - 1: JS_PARAMETER_LIST@457..457 - 2: R_PAREN@457..458 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@458..462 - 0: COLON@458..460 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@460..462 - 0: JS_REFERENCE_IDENTIFIER@460..462 - 0: IDENT@460..462 "T" [] [Whitespace(" ")] - 1: (empty) - 4: JS_FUNCTION_BODY@462..465 - 0: L_CURLY@462..463 "{" [] [] - 1: JS_DIRECTIVE_LIST@463..463 - 2: JS_STATEMENT_LIST@463..463 - 3: R_CURLY@463..465 "}" [] [Whitespace(" ")] - 2: R_CURLY@465..466 "}" [] [] - 1: SEMICOLON@466..467 ";" [] [] - 16: JS_EXPRESSION_STATEMENT@467..483 - 0: JS_BOGUS_EXPRESSION@467..482 - 0: JS_BOGUS@467..474 - 0: L_ANGLE@467..469 "<" [Newline("\n")] [] - 1: JS_BOGUS@469..473 - 0: JS_BOGUS@469..473 - 0: JS_BOGUS@469..472 - 0: IN_KW@469..472 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@472..473 - 0: IDENT@472..473 "T" [] [] - 2: R_ANGLE@473..474 ">" [] [] - 1: JS_PARAMETERS@474..477 - 0: L_PAREN@474..475 "(" [] [] - 1: JS_PARAMETER_LIST@475..475 - 2: R_PAREN@475..477 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@477..480 "=>" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@480..482 - 0: L_CURLY@480..481 "{" [] [] - 1: JS_DIRECTIVE_LIST@481..481 - 2: JS_STATEMENT_LIST@481..481 - 3: R_CURLY@481..482 "}" [] [] - 1: SEMICOLON@482..483 ";" [] [] - 17: JS_EXPRESSION_STATEMENT@483..500 - 0: JS_BOGUS_EXPRESSION@483..499 - 0: JS_BOGUS@483..491 - 0: L_ANGLE@483..485 "<" [Newline("\n")] [] - 1: JS_BOGUS@485..490 - 0: JS_BOGUS@485..490 - 0: JS_BOGUS@485..489 - 0: OUT_KW@485..489 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@489..490 - 0: IDENT@489..490 "T" [] [] - 2: R_ANGLE@490..491 ">" [] [] - 1: JS_PARAMETERS@491..494 - 0: L_PAREN@491..492 "(" [] [] - 1: JS_PARAMETER_LIST@492..492 - 2: R_PAREN@492..494 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@494..497 "=>" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@497..499 - 0: L_CURLY@497..498 "{" [] [] - 1: JS_DIRECTIVE_LIST@498..498 - 2: JS_STATEMENT_LIST@498..498 - 3: R_CURLY@498..499 "}" [] [] - 1: SEMICOLON@499..500 ";" [] [] - 18: JS_EXPRESSION_STATEMENT@500..523 - 0: JS_BOGUS_EXPRESSION@500..522 - 0: JS_BOGUS@500..514 - 0: L_ANGLE@500..502 "<" [Newline("\n")] [] - 1: JS_BOGUS@502..513 - 0: JS_BOGUS@502..506 - 0: JS_BOGUS@502..505 - 0: IN_KW@502..505 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@505..506 - 0: IDENT@505..506 "T" [] [] - 1: COMMA@506..508 "," [] [Whitespace(" ")] - 2: JS_BOGUS@508..513 - 0: JS_BOGUS@508..512 - 0: OUT_KW@508..512 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@512..513 - 0: IDENT@512..513 "T" [] [] - 2: R_ANGLE@513..514 ">" [] [] - 1: JS_PARAMETERS@514..517 - 0: L_PAREN@514..515 "(" [] [] - 1: JS_PARAMETER_LIST@515..515 - 2: R_PAREN@515..517 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@517..520 "=>" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@520..522 - 0: L_CURLY@520..521 "{" [] [] - 1: JS_DIRECTIVE_LIST@521..521 - 2: JS_STATEMENT_LIST@521..521 - 3: R_CURLY@521..522 "}" [] [] - 1: SEMICOLON@522..523 ";" [] [] - 19: JS_VARIABLE_STATEMENT@523..546 - 0: JS_VARIABLE_DECLARATION@523..545 - 0: (empty) - 1: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@528..545 - 0: JS_VARIABLE_DECLARATOR@528..545 - 0: JS_IDENTIFIER_BINDING@528..529 - 0: IDENT@528..529 "x" [] [] - 1: TS_TYPE_ANNOTATION@529..545 - 0: COLON@529..531 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@531..545 - 0: JS_BOGUS@531..537 - 0: L_ANGLE@531..532 "<" [] [] - 1: JS_BOGUS@532..536 - 0: JS_BOGUS@532..536 - 0: JS_BOGUS@532..535 - 0: IN_KW@532..535 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@535..536 - 0: IDENT@535..536 "T" [] [] - 2: R_ANGLE@536..537 ">" [] [] - 1: JS_PARAMETERS@537..540 - 0: L_PAREN@537..538 "(" [] [] - 1: JS_PARAMETER_LIST@538..538 - 2: R_PAREN@538..540 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@540..543 "=>" [] [Whitespace(" ")] - 3: TS_OBJECT_TYPE@543..545 - 0: L_CURLY@543..544 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@544..544 - 2: R_CURLY@544..545 "}" [] [] - 2: (empty) - 1: SEMICOLON@545..546 ";" [] [] - 20: JS_VARIABLE_STATEMENT@546..570 - 0: JS_VARIABLE_DECLARATION@546..569 - 0: (empty) - 1: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@551..569 - 0: JS_VARIABLE_DECLARATOR@551..569 - 0: JS_IDENTIFIER_BINDING@551..552 - 0: IDENT@551..552 "x" [] [] - 1: TS_TYPE_ANNOTATION@552..569 - 0: COLON@552..554 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@554..569 - 0: JS_BOGUS@554..561 - 0: L_ANGLE@554..555 "<" [] [] - 1: JS_BOGUS@555..560 - 0: JS_BOGUS@555..560 - 0: JS_BOGUS@555..559 - 0: OUT_KW@555..559 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@559..560 - 0: IDENT@559..560 "T" [] [] - 2: R_ANGLE@560..561 ">" [] [] - 1: JS_PARAMETERS@561..564 - 0: L_PAREN@561..562 "(" [] [] - 1: JS_PARAMETER_LIST@562..562 - 2: R_PAREN@562..564 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@564..567 "=>" [] [Whitespace(" ")] - 3: TS_OBJECT_TYPE@567..569 - 0: L_CURLY@567..568 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@568..568 - 2: R_CURLY@568..569 "}" [] [] - 2: (empty) - 1: SEMICOLON@569..570 ";" [] [] - 21: JS_VARIABLE_STATEMENT@570..600 - 0: JS_VARIABLE_DECLARATION@570..599 - 0: (empty) - 1: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@575..599 - 0: JS_VARIABLE_DECLARATOR@575..599 - 0: JS_IDENTIFIER_BINDING@575..576 - 0: IDENT@575..576 "x" [] [] - 1: TS_TYPE_ANNOTATION@576..599 - 0: COLON@576..578 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@578..599 - 0: JS_BOGUS@578..591 - 0: L_ANGLE@578..579 "<" [] [] - 1: JS_BOGUS@579..590 - 0: JS_BOGUS@579..583 - 0: JS_BOGUS@579..582 - 0: IN_KW@579..582 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@582..583 - 0: IDENT@582..583 "T" [] [] - 1: COMMA@583..585 "," [] [Whitespace(" ")] - 2: JS_BOGUS@585..590 - 0: JS_BOGUS@585..589 - 0: OUT_KW@585..589 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@589..590 - 0: IDENT@589..590 "T" [] [] - 2: R_ANGLE@590..591 ">" [] [] - 1: JS_PARAMETERS@591..594 - 0: L_PAREN@591..592 "(" [] [] - 1: JS_PARAMETER_LIST@592..592 - 2: R_PAREN@592..594 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@594..597 "=>" [] [Whitespace(" ")] - 3: TS_OBJECT_TYPE@597..599 - 0: L_CURLY@597..598 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@598..598 - 2: R_CURLY@598..599 "}" [] [] - 2: (empty) - 1: SEMICOLON@599..600 ";" [] [] - 22: JS_VARIABLE_STATEMENT@600..627 - 0: JS_VARIABLE_DECLARATION@600..626 - 0: (empty) - 1: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@605..626 - 0: JS_VARIABLE_DECLARATOR@605..626 - 0: JS_IDENTIFIER_BINDING@605..606 - 0: IDENT@605..606 "x" [] [] - 1: TS_TYPE_ANNOTATION@606..626 - 0: COLON@606..608 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@608..626 - 0: NEW_KW@608..612 "new" [] [Whitespace(" ")] - 1: JS_BOGUS@612..618 - 0: L_ANGLE@612..613 "<" [] [] - 1: JS_BOGUS@613..617 - 0: JS_BOGUS@613..617 - 0: JS_BOGUS@613..616 - 0: IN_KW@613..616 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@616..617 - 0: IDENT@616..617 "T" [] [] - 2: R_ANGLE@617..618 ">" [] [] - 2: JS_PARAMETERS@618..621 - 0: L_PAREN@618..619 "(" [] [] - 1: JS_PARAMETER_LIST@619..619 - 2: R_PAREN@619..621 ")" [] [Whitespace(" ")] - 3: FAT_ARROW@621..624 "=>" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@624..626 - 0: L_CURLY@624..625 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@625..625 - 2: R_CURLY@625..626 "}" [] [] - 2: (empty) - 1: SEMICOLON@626..627 ";" [] [] - 23: JS_VARIABLE_STATEMENT@627..655 - 0: JS_VARIABLE_DECLARATION@627..654 - 0: (empty) - 1: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@632..654 - 0: JS_VARIABLE_DECLARATOR@632..654 - 0: JS_IDENTIFIER_BINDING@632..633 - 0: IDENT@632..633 "x" [] [] - 1: TS_TYPE_ANNOTATION@633..654 - 0: COLON@633..635 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@635..654 - 0: NEW_KW@635..639 "new" [] [Whitespace(" ")] - 1: JS_BOGUS@639..646 - 0: L_ANGLE@639..640 "<" [] [] - 1: JS_BOGUS@640..645 - 0: JS_BOGUS@640..645 - 0: JS_BOGUS@640..644 - 0: OUT_KW@640..644 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@644..645 - 0: IDENT@644..645 "T" [] [] - 2: R_ANGLE@645..646 ">" [] [] - 2: JS_PARAMETERS@646..649 - 0: L_PAREN@646..647 "(" [] [] - 1: JS_PARAMETER_LIST@647..647 - 2: R_PAREN@647..649 ")" [] [Whitespace(" ")] - 3: FAT_ARROW@649..652 "=>" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@652..654 - 0: L_CURLY@652..653 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@653..653 - 2: R_CURLY@653..654 "}" [] [] - 2: (empty) - 1: SEMICOLON@654..655 ";" [] [] - 24: JS_VARIABLE_STATEMENT@655..689 - 0: JS_VARIABLE_DECLARATION@655..688 - 0: (empty) - 1: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@660..688 - 0: JS_VARIABLE_DECLARATOR@660..688 - 0: JS_IDENTIFIER_BINDING@660..661 - 0: IDENT@660..661 "x" [] [] - 1: TS_TYPE_ANNOTATION@661..688 - 0: COLON@661..663 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@663..688 - 0: NEW_KW@663..667 "new" [] [Whitespace(" ")] - 1: JS_BOGUS@667..680 - 0: L_ANGLE@667..668 "<" [] [] - 1: JS_BOGUS@668..679 - 0: JS_BOGUS@668..672 - 0: JS_BOGUS@668..671 - 0: IN_KW@668..671 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@671..672 - 0: IDENT@671..672 "T" [] [] - 1: COMMA@672..674 "," [] [Whitespace(" ")] - 2: JS_BOGUS@674..679 - 0: JS_BOGUS@674..678 - 0: OUT_KW@674..678 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@678..679 - 0: IDENT@678..679 "T" [] [] - 2: R_ANGLE@679..680 ">" [] [] - 2: JS_PARAMETERS@680..683 - 0: L_PAREN@680..681 "(" [] [] - 1: JS_PARAMETER_LIST@681..681 - 2: R_PAREN@681..683 ")" [] [Whitespace(" ")] - 3: FAT_ARROW@683..686 "=>" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@686..688 - 0: L_CURLY@686..687 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@687..687 - 2: R_CURLY@687..688 "}" [] [] - 2: (empty) - 1: SEMICOLON@688..689 ";" [] [] - 25: JS_VARIABLE_STATEMENT@689..716 - 0: JS_VARIABLE_DECLARATION@689..715 - 0: (empty) - 1: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@694..715 - 0: JS_VARIABLE_DECLARATOR@694..715 - 0: JS_IDENTIFIER_BINDING@694..695 - 0: IDENT@694..695 "x" [] [] - 1: TS_TYPE_ANNOTATION@695..715 - 0: COLON@695..697 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@697..715 - 0: L_CURLY@697..699 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@699..714 - 0: JS_BOGUS@699..714 - 0: JS_LITERAL_MEMBER_NAME@699..700 - 0: IDENT@699..700 "y" [] [] - 1: JS_BOGUS@700..706 - 0: L_ANGLE@700..701 "<" [] [] - 1: JS_BOGUS@701..705 - 0: JS_BOGUS@701..705 - 0: JS_BOGUS@701..704 - 0: IN_KW@701..704 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@704..705 - 0: IDENT@704..705 "T" [] [] - 2: R_ANGLE@705..706 ">" [] [] - 2: JS_PARAMETERS@706..708 - 0: L_PAREN@706..707 "(" [] [] - 1: JS_PARAMETER_LIST@707..707 - 2: R_PAREN@707..708 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@708..714 - 0: COLON@708..710 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@710..714 - 0: ANY_KW@710..714 "any" [] [Whitespace(" ")] - 2: R_CURLY@714..715 "}" [] [] - 2: (empty) - 1: SEMICOLON@715..716 ";" [] [] - 26: JS_VARIABLE_STATEMENT@716..744 - 0: JS_VARIABLE_DECLARATION@716..743 - 0: (empty) - 1: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@721..743 - 0: JS_VARIABLE_DECLARATOR@721..743 - 0: JS_IDENTIFIER_BINDING@721..722 - 0: IDENT@721..722 "x" [] [] - 1: TS_TYPE_ANNOTATION@722..743 - 0: COLON@722..724 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@724..743 - 0: L_CURLY@724..726 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@726..742 - 0: JS_BOGUS@726..742 - 0: JS_LITERAL_MEMBER_NAME@726..727 - 0: IDENT@726..727 "y" [] [] - 1: JS_BOGUS@727..734 - 0: L_ANGLE@727..728 "<" [] [] - 1: JS_BOGUS@728..733 - 0: JS_BOGUS@728..733 - 0: JS_BOGUS@728..732 - 0: OUT_KW@728..732 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@732..733 - 0: IDENT@732..733 "T" [] [] - 2: R_ANGLE@733..734 ">" [] [] - 2: JS_PARAMETERS@734..736 - 0: L_PAREN@734..735 "(" [] [] - 1: JS_PARAMETER_LIST@735..735 - 2: R_PAREN@735..736 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@736..742 - 0: COLON@736..738 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@738..742 - 0: ANY_KW@738..742 "any" [] [Whitespace(" ")] - 2: R_CURLY@742..743 "}" [] [] - 2: (empty) - 1: SEMICOLON@743..744 ";" [] [] - 27: JS_VARIABLE_STATEMENT@744..778 - 0: JS_VARIABLE_DECLARATION@744..777 - 0: (empty) - 1: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@749..777 - 0: JS_VARIABLE_DECLARATOR@749..777 - 0: JS_IDENTIFIER_BINDING@749..750 - 0: IDENT@749..750 "x" [] [] - 1: TS_TYPE_ANNOTATION@750..777 - 0: COLON@750..752 ":" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@752..777 - 0: L_CURLY@752..754 "{" [] [Whitespace(" ")] - 1: JS_BOGUS@754..776 - 0: JS_BOGUS@754..776 - 0: JS_LITERAL_MEMBER_NAME@754..755 - 0: IDENT@754..755 "y" [] [] - 1: JS_BOGUS@755..768 - 0: L_ANGLE@755..756 "<" [] [] - 1: JS_BOGUS@756..767 - 0: JS_BOGUS@756..760 - 0: JS_BOGUS@756..759 - 0: IN_KW@756..759 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@759..760 - 0: IDENT@759..760 "T" [] [] - 1: COMMA@760..762 "," [] [Whitespace(" ")] - 2: JS_BOGUS@762..767 - 0: JS_BOGUS@762..766 - 0: OUT_KW@762..766 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@766..767 - 0: IDENT@766..767 "T" [] [] - 2: R_ANGLE@767..768 ">" [] [] - 2: JS_PARAMETERS@768..770 - 0: L_PAREN@768..769 "(" [] [] - 1: JS_PARAMETER_LIST@769..769 - 2: R_PAREN@769..770 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@770..776 - 0: COLON@770..772 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@772..776 - 0: ANY_KW@772..776 "any" [] [Whitespace(" ")] - 2: R_CURLY@776..777 "}" [] [] - 2: (empty) - 1: SEMICOLON@777..778 ";" [] [] - 28: JS_BOGUS_STATEMENT@778..804 - 0: TYPE_KW@778..784 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@784..787 - 0: IDENT@784..787 "Foo" [] [] - 2: JS_BOGUS@787..800 - 0: L_ANGLE@787..788 "<" [] [] - 1: JS_BOGUS@788..798 - 0: TS_TYPE_PARAMETER@788..789 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@788..788 - 1: TS_TYPE_PARAMETER_NAME@788..789 - 0: IDENT@788..789 "i" [] [] - 2: (empty) - 3: (empty) - 1: TS_TYPE_PARAMETER_MODIFIER_LIST@789..789 - 2: TS_BOGUS_TYPE@789..790 - 0: ERROR_TOKEN@789..790 "\\" [] [] - 3: TS_TYPE_PARAMETER@790..797 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@790..790 - 1: TS_TYPE_PARAMETER_NAME@790..797 - 0: IDENT@790..797 "\\u006E" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: TS_TYPE_PARAMETER@797..798 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@797..797 - 1: TS_TYPE_PARAMETER_NAME@797..798 - 0: IDENT@797..798 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@798..800 ">" [] [Whitespace(" ")] - 3: EQ@800..802 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@802..804 - 0: L_CURLY@802..803 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@803..803 - 2: R_CURLY@803..804 "}" [] [] - 29: JS_BOGUS_STATEMENT@804..831 - 0: TYPE_KW@804..810 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@810..813 - 0: IDENT@810..813 "Foo" [] [] - 2: JS_BOGUS@813..827 - 0: L_ANGLE@813..814 "<" [] [] - 1: JS_BOGUS@814..825 - 0: TS_TYPE_PARAMETER@814..816 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@814..814 - 1: TS_TYPE_PARAMETER_NAME@814..816 - 0: IDENT@814..816 "ou" [] [] - 2: (empty) - 3: (empty) - 1: TS_TYPE_PARAMETER_MODIFIER_LIST@816..816 - 2: TS_BOGUS_TYPE@816..817 - 0: ERROR_TOKEN@816..817 "\\" [] [] - 3: TS_TYPE_PARAMETER@817..824 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@817..817 - 1: TS_TYPE_PARAMETER_NAME@817..824 - 0: IDENT@817..824 "\\u0074" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: TS_TYPE_PARAMETER@824..825 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@824..824 - 1: TS_TYPE_PARAMETER_NAME@824..825 - 0: IDENT@824..825 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@825..827 ">" [] [Whitespace(" ")] - 3: EQ@827..829 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@829..831 - 0: L_CURLY@829..830 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@830..830 - 2: R_CURLY@830..831 "}" [] [] - 30: JS_BOGUS_STATEMENT@831..852 - 0: TYPE_KW@831..837 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@837..840 - 0: IDENT@837..840 "Foo" [] [] - 2: JS_BOGUS@840..848 - 0: L_ANGLE@840..841 "<" [] [] - 1: JS_BOGUS@841..846 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@841..844 - 0: TS_IN_MODIFIER@841..844 - 0: IN_KW@841..844 "in" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@844..846 - 0: IN_KW@844..846 "in" [] [] - 2: R_ANGLE@846..848 ">" [] [Whitespace(" ")] - 3: EQ@848..850 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@850..852 - 0: L_CURLY@850..851 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@851..851 - 2: R_CURLY@851..852 "}" [] [] - 31: JS_BOGUS_STATEMENT@852..874 - 0: TYPE_KW@852..858 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@858..861 - 0: IDENT@858..861 "Foo" [] [] - 2: JS_BOGUS@861..870 - 0: L_ANGLE@861..862 "<" [] [] - 1: JS_BOGUS@862..868 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@862..866 - 0: TS_OUT_MODIFIER@862..866 - 0: OUT_KW@862..866 "out" [] [Whitespace(" ")] - 1: TS_BOGUS_TYPE@866..868 - 0: IN_KW@866..868 "in" [] [] - 2: R_ANGLE@868..870 ">" [] [Whitespace(" ")] - 3: EQ@870..872 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@872..874 - 0: L_CURLY@872..873 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@873..873 - 2: R_CURLY@873..874 "}" [] [] - 32: JS_BOGUS_STATEMENT@874..898 - 0: TYPE_KW@874..880 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@880..883 - 0: IDENT@880..883 "Foo" [] [] - 2: JS_BOGUS@883..894 - 0: L_ANGLE@883..884 "<" [] [] - 1: JS_BOGUS@884..892 - 0: JS_BOGUS@884..892 - 0: JS_BOGUS@884..891 - 0: TS_OUT_MODIFIER@884..888 - 0: OUT_KW@884..888 "out" [] [Whitespace(" ")] - 1: IN_KW@888..891 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@891..892 - 0: IDENT@891..892 "T" [] [] - 2: R_ANGLE@892..894 ">" [] [Whitespace(" ")] - 3: EQ@894..896 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@896..898 - 0: L_CURLY@896..897 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@897..897 - 2: R_CURLY@897..898 "}" [] [] - 33: JS_BOGUS_STATEMENT@898..922 - 0: TYPE_KW@898..904 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@904..907 - 0: IDENT@904..907 "Foo" [] [] - 2: JS_BOGUS@907..918 - 0: L_ANGLE@907..908 "<" [] [] - 1: JS_BOGUS@908..916 - 0: JS_BOGUS@908..915 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@908..908 - 1: JS_BOGUS@908..915 - 0: IDENT@908..915 "public" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER@915..916 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@915..915 - 1: TS_TYPE_PARAMETER_NAME@915..916 - 0: IDENT@915..916 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@916..918 ">" [] [Whitespace(" ")] - 3: EQ@918..920 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@920..922 - 0: L_CURLY@920..921 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@921..921 - 2: R_CURLY@921..922 "}" [] [] - 34: TS_TYPE_ALIAS_DECLARATION@922..944 - 0: TYPE_KW@922..928 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@928..931 - 0: IDENT@928..931 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@931..940 - 0: L_ANGLE@931..932 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@932..938 - 0: TS_TYPE_PARAMETER@932..937 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@932..932 - 1: TS_TYPE_PARAMETER_NAME@932..937 - 0: IDENT@932..937 "innn" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 1: (empty) - 2: TS_TYPE_PARAMETER@937..938 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@937..937 - 1: TS_TYPE_PARAMETER_NAME@937..938 - 0: IDENT@937..938 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@938..940 ">" [] [Whitespace(" ")] - 3: EQ@940..942 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@942..944 - 0: L_CURLY@942..943 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@943..943 - 2: R_CURLY@943..944 "}" [] [] - 5: (empty) - 35: JS_BOGUS_STATEMENT@944..971 - 0: TYPE_KW@944..950 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@950..953 - 0: IDENT@950..953 "Foo" [] [] - 2: JS_BOGUS@953..967 - 0: L_ANGLE@953..954 "<" [] [] - 1: JS_BOGUS@954..965 - 0: JS_BOGUS@954..965 - 0: JS_BOGUS@954..964 - 0: TS_IN_MODIFIER@954..957 - 0: IN_KW@954..957 "in" [] [Whitespace(" ")] - 1: TS_OUT_MODIFIER@957..961 - 0: OUT_KW@957..961 "out" [] [Whitespace(" ")] - 2: IN_KW@961..964 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@964..965 - 0: IDENT@964..965 "T" [] [] - 2: R_ANGLE@965..967 ">" [] [Whitespace(" ")] - 3: EQ@967..969 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@969..971 - 0: L_CURLY@969..970 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@970..970 - 2: R_CURLY@970..971 "}" [] [] - 36: JS_BOGUS_STATEMENT@971..999 - 0: TYPE_KW@971..977 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@977..980 - 0: IDENT@977..980 "Foo" [] [] - 2: JS_BOGUS@980..995 - 0: L_ANGLE@980..981 "<" [] [] - 1: JS_BOGUS@981..993 - 0: JS_BOGUS@981..993 - 0: JS_BOGUS@981..992 - 0: TS_IN_MODIFIER@981..984 - 0: IN_KW@981..984 "in" [] [Whitespace(" ")] - 1: TS_OUT_MODIFIER@984..988 - 0: OUT_KW@984..988 "out" [] [Whitespace(" ")] - 2: OUT_KW@988..992 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@992..993 - 0: IDENT@992..993 "T" [] [] - 2: R_ANGLE@993..995 ">" [] [Whitespace(" ")] - 3: EQ@995..997 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@997..999 - 0: L_CURLY@997..998 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@998..998 - 2: R_CURLY@998..999 "}" [] [] - 37: JS_BOGUS_STATEMENT@999..1023 - 0: FUNCTION_KW@999..1009 "function" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@1009..1012 - 0: IDENT@1009..1012 "foo" [] [] - 2: JS_BOGUS@1012..1018 - 0: L_ANGLE@1012..1013 "<" [] [] - 1: JS_BOGUS@1013..1017 - 0: JS_BOGUS@1013..1017 - 0: JS_BOGUS@1013..1016 - 0: IN_KW@1013..1016 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1016..1017 - 0: IDENT@1016..1017 "T" [] [] - 2: R_ANGLE@1017..1018 ">" [] [] - 3: JS_PARAMETERS@1018..1021 - 0: L_PAREN@1018..1019 "(" [] [] - 1: JS_PARAMETER_LIST@1019..1019 - 2: R_PAREN@1019..1021 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@1021..1023 - 0: L_CURLY@1021..1022 "{" [] [] - 1: JS_DIRECTIVE_LIST@1022..1022 - 2: JS_STATEMENT_LIST@1022..1022 - 3: R_CURLY@1022..1023 "}" [] [] - 38: JS_BOGUS_STATEMENT@1023..1048 - 0: FUNCTION_KW@1023..1033 "function" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@1033..1036 - 0: IDENT@1033..1036 "foo" [] [] - 2: JS_BOGUS@1036..1043 - 0: L_ANGLE@1036..1037 "<" [] [] - 1: JS_BOGUS@1037..1042 - 0: JS_BOGUS@1037..1042 - 0: JS_BOGUS@1037..1041 - 0: OUT_KW@1037..1041 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1041..1042 - 0: IDENT@1041..1042 "T" [] [] - 2: R_ANGLE@1042..1043 ">" [] [] - 3: JS_PARAMETERS@1043..1046 - 0: L_PAREN@1043..1044 "(" [] [] - 1: JS_PARAMETER_LIST@1044..1044 - 2: R_PAREN@1044..1046 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@1046..1048 - 0: L_CURLY@1046..1047 "{" [] [] - 1: JS_DIRECTIVE_LIST@1047..1047 - 2: JS_STATEMENT_LIST@1047..1047 - 3: R_CURLY@1047..1048 "}" [] [] - 39: JS_BOGUS_STATEMENT@1048..1072 - 0: TYPE_KW@1048..1054 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1054..1057 - 0: IDENT@1054..1057 "Foo" [] [] - 2: JS_BOGUS@1057..1067 - 0: L_ANGLE@1057..1058 "<" [] [] - 1: JS_BOGUS@1058..1065 - 0: JS_BOGUS@1058..1065 - 0: JS_BOGUS@1058..1064 - 0: CONST_KW@1058..1064 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1064..1065 - 0: IDENT@1064..1065 "U" [] [] - 2: R_ANGLE@1065..1067 ">" [] [Whitespace(" ")] - 3: EQ@1067..1069 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@1069..1071 - 0: L_CURLY@1069..1070 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@1070..1070 - 2: R_CURLY@1070..1071 "}" [] [] - 5: SEMICOLON@1071..1072 ";" [] [] - 4: EOF@1072..1073 "" [Newline("\n")] [] --- -type_parameter_modifier.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - > 1 │ export default function foo() {} - │ ^^ - 2 │ export function foo() {} - 3 │ export function foo1() {} - --- -type_parameter_modifier.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 1 │ export default function foo() {} - > 2 │ export function foo() {} - │ ^^^ - 3 │ export function foo1() {} - 4 │ export function foo2() {} - --- -type_parameter_modifier.ts:3:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 1 │ export default function foo() {} - 2 │ export function foo() {} - > 3 │ export function foo1() {} - │ ^^ - 4 │ export function foo2() {} - 5 │ let foo: Foo - --- -type_parameter_modifier.ts:4:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 2 │ export function foo() {} - 3 │ export function foo1() {} - > 4 │ export function foo2() {} - │ ^^^ - 5 │ let foo: Foo - 6 │ let foo: Foo - --- -type_parameter_modifier.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 3 │ export function foo1() {} - 4 │ export function foo2() {} - > 5 │ let foo: Foo - │ ^ - 6 │ let foo: Foo - 7 │ declare function foo() - - i Remove T - --- -type_parameter_modifier.ts:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 4 │ export function foo2() {} - 5 │ let foo: Foo - > 6 │ let foo: Foo - │ ^ - 7 │ declare function foo() - 8 │ declare function foo() - - i Remove T - --- -type_parameter_modifier.ts:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 5 │ let foo: Foo - 6 │ let foo: Foo - > 7 │ declare function foo() - │ ^^ - 8 │ declare function foo() - 9 │ declare let foo: Foo - --- -type_parameter_modifier.ts:8:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 6 │ let foo: Foo - 7 │ declare function foo() - > 8 │ declare function foo() - │ ^^^ - 9 │ declare let foo: Foo - 10 │ declare let foo: Foo - --- -type_parameter_modifier.ts:9:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 7 │ declare function foo() - 8 │ declare function foo() - > 9 │ declare let foo: Foo - │ ^ - 10 │ declare let foo: Foo - 11 │ foo = function () {} - - i Remove T - --- -type_parameter_modifier.ts:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 8 │ declare function foo() - 9 │ declare let foo: Foo - > 10 │ declare let foo: Foo - │ ^ - 11 │ foo = function () {} - 12 │ foo = function () {} - - i Remove T - --- -type_parameter_modifier.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 9 │ declare let foo: Foo - 10 │ declare let foo: Foo - > 11 │ foo = function () {} - │ ^^ - 12 │ foo = function () {} - 13 │ class Foo { foo(): T {} } - --- -type_parameter_modifier.ts:12:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 10 │ declare let foo: Foo - 11 │ foo = function () {} - > 12 │ foo = function () {} - │ ^^^ - 13 │ class Foo { foo(): T {} } - 14 │ class Foo { foo(): T {} } - --- -type_parameter_modifier.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 11 │ foo = function () {} - 12 │ foo = function () {} - > 13 │ class Foo { foo(): T {} } - │ ^^ - 14 │ class Foo { foo(): T {} } - 15 │ foo = { foo(): T {} }; - --- -type_parameter_modifier.ts:14:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 12 │ foo = function () {} - 13 │ class Foo { foo(): T {} } - > 14 │ class Foo { foo(): T {} } - │ ^^^ - 15 │ foo = { foo(): T {} }; - 16 │ foo = { foo(): T {} }; - --- -type_parameter_modifier.ts:15:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 13 │ class Foo { foo(): T {} } - 14 │ class Foo { foo(): T {} } - > 15 │ foo = { foo(): T {} }; - │ ^^ - 16 │ foo = { foo(): T {} }; - 17 │ () => {}; - --- -type_parameter_modifier.ts:16:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 14 │ class Foo { foo(): T {} } - 15 │ foo = { foo(): T {} }; - > 16 │ foo = { foo(): T {} }; - │ ^^^ - 17 │ () => {}; - 18 │ () => {}; - --- -type_parameter_modifier.ts:17:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 15 │ foo = { foo(): T {} }; - 16 │ foo = { foo(): T {} }; - > 17 │ () => {}; - │ ^^ - 18 │ () => {}; - 19 │ () => {}; - --- -type_parameter_modifier.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 16 │ foo = { foo(): T {} }; - 17 │ () => {}; - > 18 │ () => {}; - │ ^^^ - 19 │ () => {}; - 20 │ let x: () => {}; - --- -type_parameter_modifier.ts:19:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 17 │ () => {}; - 18 │ () => {}; - > 19 │ () => {}; - │ ^^ - 20 │ let x: () => {}; - 21 │ let x: () => {}; - --- -type_parameter_modifier.ts:19:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 17 │ () => {}; - 18 │ () => {}; - > 19 │ () => {}; - │ ^^^ - 20 │ let x: () => {}; - 21 │ let x: () => {}; - --- -type_parameter_modifier.ts:20:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 18 │ () => {}; - 19 │ () => {}; - > 20 │ let x: () => {}; - │ ^^ - 21 │ let x: () => {}; - 22 │ let x: () => {}; - --- -type_parameter_modifier.ts:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 19 │ () => {}; - 20 │ let x: () => {}; - > 21 │ let x: () => {}; - │ ^^^ - 22 │ let x: () => {}; - 23 │ let x: new () => {}; - --- -type_parameter_modifier.ts:22:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 20 │ let x: () => {}; - 21 │ let x: () => {}; - > 22 │ let x: () => {}; - │ ^^ - 23 │ let x: new () => {}; - 24 │ let x: new () => {}; - --- -type_parameter_modifier.ts:22:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 20 │ let x: () => {}; - 21 │ let x: () => {}; - > 22 │ let x: () => {}; - │ ^^^ - 23 │ let x: new () => {}; - 24 │ let x: new () => {}; - --- -type_parameter_modifier.ts:23:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 21 │ let x: () => {}; - 22 │ let x: () => {}; - > 23 │ let x: new () => {}; - │ ^^ - 24 │ let x: new () => {}; - 25 │ let x: new () => {}; - --- -type_parameter_modifier.ts:24:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 22 │ let x: () => {}; - 23 │ let x: new () => {}; - > 24 │ let x: new () => {}; - │ ^^^ - 25 │ let x: new () => {}; - 26 │ let x: { y(): any }; - --- -type_parameter_modifier.ts:25:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 23 │ let x: new () => {}; - 24 │ let x: new () => {}; - > 25 │ let x: new () => {}; - │ ^^ - 26 │ let x: { y(): any }; - 27 │ let x: { y(): any }; - --- -type_parameter_modifier.ts:25:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 23 │ let x: new () => {}; - 24 │ let x: new () => {}; - > 25 │ let x: new () => {}; - │ ^^^ - 26 │ let x: { y(): any }; - 27 │ let x: { y(): any }; - --- -type_parameter_modifier.ts:26:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 24 │ let x: new () => {}; - 25 │ let x: new () => {}; - > 26 │ let x: { y(): any }; - │ ^^ - 27 │ let x: { y(): any }; - 28 │ let x: { y(): any }; - --- -type_parameter_modifier.ts:27:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 25 │ let x: new () => {}; - 26 │ let x: { y(): any }; - > 27 │ let x: { y(): any }; - │ ^^^ - 28 │ let x: { y(): any }; - 29 │ type Foo = {} - --- -type_parameter_modifier.ts:28:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 26 │ let x: { y(): any }; - 27 │ let x: { y(): any }; - > 28 │ let x: { y(): any }; - │ ^^ - 29 │ type Foo = {} - 30 │ type Foo = {} - --- -type_parameter_modifier.ts:28:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 26 │ let x: { y(): any }; - 27 │ let x: { y(): any }; - > 28 │ let x: { y(): any }; - │ ^^^ - 29 │ type Foo = {} - 30 │ type Foo = {} - --- -type_parameter_modifier.ts:29:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unexpected token `\` - - 27 │ let x: { y(): any }; - 28 │ let x: { y(): any }; - > 29 │ type Foo = {} - │ ^ - 30 │ type Foo = {} - 31 │ type Foo = {} - --- -type_parameter_modifier.ts:29:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `\u006E` - - 27 │ let x: { y(): any }; - 28 │ let x: { y(): any }; - > 29 │ type Foo = {} - │ ^^^^^^ - 30 │ type Foo = {} - 31 │ type Foo = {} - - i Remove \u006E - --- -type_parameter_modifier.ts:29:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 27 │ let x: { y(): any }; - 28 │ let x: { y(): any }; - > 29 │ type Foo = {} - │ ^ - 30 │ type Foo = {} - 31 │ type Foo = {} - - i Remove T - --- -type_parameter_modifier.ts:30:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unexpected token `\` - - 28 │ let x: { y(): any }; - 29 │ type Foo = {} - > 30 │ type Foo = {} - │ ^ - 31 │ type Foo = {} - 32 │ type Foo = {} - --- -type_parameter_modifier.ts:30:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `\u0074` - - 28 │ let x: { y(): any }; - 29 │ type Foo = {} - > 30 │ type Foo = {} - │ ^^^^^^ - 31 │ type Foo = {} - 32 │ type Foo = {} - - i Remove \u0074 - --- -type_parameter_modifier.ts:30:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 28 │ let x: { y(): any }; - 29 │ type Foo = {} - > 30 │ type Foo = {} - │ ^ - 31 │ type Foo = {} - 32 │ type Foo = {} - - i Remove T - --- -type_parameter_modifier.ts:31:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found 'in'. - - 29 │ type Foo = {} - 30 │ type Foo = {} - > 31 │ type Foo = {} - │ ^^ - 32 │ type Foo = {} - 33 │ type Foo = {} - - i Expected a type parameter here. - - 29 │ type Foo = {} - 30 │ type Foo = {} - > 31 │ type Foo = {} - │ ^^ - 32 │ type Foo = {} - 33 │ type Foo = {} - --- -type_parameter_modifier.ts:32:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a type parameter but instead found 'in'. - - 30 │ type Foo = {} - 31 │ type Foo = {} - > 32 │ type Foo = {} - │ ^^ - 33 │ type Foo = {} - 34 │ type Foo = {} - - i Expected a type parameter here. - - 30 │ type Foo = {} - 31 │ type Foo = {} - > 32 │ type Foo = {} - │ ^^ - 33 │ type Foo = {} - 34 │ type Foo = {} - --- -type_parameter_modifier.ts:33:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' must precede 'out' - - 31 │ type Foo = {} - 32 │ type Foo = {} - > 33 │ type Foo = {} - │ ^^ - 34 │ type Foo = {} - 35 │ type Foo = {} - - i move this modifier - - 31 │ type Foo = {} - 32 │ type Foo = {} - > 33 │ type Foo = {} - │ ^^ - 34 │ type Foo = {} - 35 │ type Foo = {} - - i before this modifier - - 31 │ type Foo = {} - 32 │ type Foo = {} - > 33 │ type Foo = {} - │ ^^^ - 34 │ type Foo = {} - 35 │ type Foo = {} - --- -type_parameter_modifier.ts:34:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `public` as an identifier in strict mode - - 32 │ type Foo = {} - 33 │ type Foo = {} - > 34 │ type Foo = {} - │ ^^^^^^ - 35 │ type Foo = {} - 36 │ type Foo = {} - --- -type_parameter_modifier.ts:34:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 32 │ type Foo = {} - 33 │ type Foo = {} - > 34 │ type Foo = {} - │ ^ - 35 │ type Foo = {} - 36 │ type Foo = {} - - i Remove T - --- -type_parameter_modifier.ts:35:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 33 │ type Foo = {} - 34 │ type Foo = {} - > 35 │ type Foo = {} - │ ^ - 36 │ type Foo = {} - 37 │ type Foo = {} - - i Remove T - --- -type_parameter_modifier.ts:36:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' already seen - - 34 │ type Foo = {} - 35 │ type Foo = {} - > 36 │ type Foo = {} - │ ^^ - 37 │ type Foo = {} - 38 │ function foo() {} - - i duplicate modifier - - 34 │ type Foo = {} - 35 │ type Foo = {} - > 36 │ type Foo = {} - │ ^^ - 37 │ type Foo = {} - 38 │ function foo() {} - - i first seen here - - 34 │ type Foo = {} - 35 │ type Foo = {} - > 36 │ type Foo = {} - │ ^^ - 37 │ type Foo = {} - 38 │ function foo() {} - --- -type_parameter_modifier.ts:37:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' already seen - - 35 │ type Foo = {} - 36 │ type Foo = {} - > 37 │ type Foo = {} - │ ^^^ - 38 │ function foo() {} - 39 │ function foo() {} - - i duplicate modifier - - 35 │ type Foo = {} - 36 │ type Foo = {} - > 37 │ type Foo = {} - │ ^^^ - 38 │ function foo() {} - 39 │ function foo() {} - - i first seen here - - 35 │ type Foo = {} - 36 │ type Foo = {} - > 37 │ type Foo = {} - │ ^^^ - 38 │ function foo() {} - 39 │ function foo() {} - --- -type_parameter_modifier.ts:38:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'in' modifier can only appear on a type parameter of a class, interface or type alias. - - 36 │ type Foo = {} - 37 │ type Foo = {} - > 38 │ function foo() {} - │ ^^ - 39 │ function foo() {} - 40 │ type Foo = {}; - --- -type_parameter_modifier.ts:39:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'out' modifier can only appear on a type parameter of a class, interface or type alias. - - 37 │ type Foo = {} - 38 │ function foo() {} - > 39 │ function foo() {} - │ ^^^ - 40 │ type Foo = {}; - 41 │ - --- -type_parameter_modifier.ts:40:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'const' modifier can only appear on a type parameter of a function, method or class. - - 38 │ function foo() {} - 39 │ function foo() {} - > 40 │ type Foo = {}; - │ ^^^^^ - 41 │ - --- -export default function foo() {} -export function foo() {} -export function foo1() {} -export function foo2() {} -let foo: Foo -let foo: Foo -declare function foo() -declare function foo() -declare let foo: Foo -declare let foo: Foo -foo = function () {} -foo = function () {} -class Foo { foo(): T {} } -class Foo { foo(): T {} } -foo = { foo(): T {} }; -foo = { foo(): T {} }; -() => {}; -() => {}; -() => {}; -let x: () => {}; -let x: () => {}; -let x: () => {}; -let x: new () => {}; -let x: new () => {}; -let x: new () => {}; -let x: { y(): any }; -let x: { y(): any }; -let x: { y(): any }; -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -function foo() {} -function foo() {} -type Foo = {}; diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast deleted file mode 100644 index 9d6b0272ad61..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast +++ /dev/null @@ -1,335 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..31 "AbstractMembers" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@31..32 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@32..46 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@46..57 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@57..58 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@60..62 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@63..77 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@77..84 "display" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@84..85 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@85..86 ")" [] [], - }, - TsReturnTypeAnnotation { - colon_token: COLON@86..88 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@88..93 "void" [] [Whitespace(" ")], - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@95..96 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@96..110 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - GET_KW@110..114 "get" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@114..121 "my_name" [] [], - }, - L_PAREN@121..122 "(" [] [], - R_PAREN@122..124 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@124..126 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@126..127 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@127..141 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - SET_KW@141..145 "set" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@145..152 "my_name" [] [], - }, - L_PAREN@152..153 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@153..157 "name" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - R_PAREN@157..159 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@159..161 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@161..162 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@162..176 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@176..177 "#" [] [], - id_token: IDENT@177..189 "private_name" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@189..190 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@190..192 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@192..194 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@194..195 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@195..197 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@197..198 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..198 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..197 - 0: JS_CLASS_DECLARATION@0..197 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..31 - 0: IDENT@15..31 "AbstractMembers" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@31..32 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@32..195 - 0: JS_BOGUS_MEMBER@32..63 - 0: JS_BOGUS@32..46 - 0: TS_ABSTRACT_MODIFIER@32..46 - 0: ABSTRACT_KW@32..46 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@46..57 - 0: IDENT@46..57 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@57..60 - 0: L_PAREN@57..58 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@58..58 - 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@60..63 - 0: L_CURLY@60..62 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@62..62 - 2: JS_STATEMENT_LIST@62..62 - 3: R_CURLY@62..63 "}" [] [] - 1: JS_BOGUS_MEMBER@63..96 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@63..77 - 0: TS_ABSTRACT_MODIFIER@63..77 - 0: ABSTRACT_KW@63..77 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@77..84 - 0: IDENT@77..84 "display" [] [] - 2: JS_PARAMETERS@84..86 - 0: L_PAREN@84..85 "(" [] [] - 1: JS_PARAMETER_LIST@85..85 - 2: R_PAREN@85..86 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@86..93 - 0: COLON@86..88 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@88..93 - 0: VOID_KW@88..93 "void" [] [Whitespace(" ")] - 4: JS_FUNCTION_BODY@93..96 - 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@95..95 - 2: JS_STATEMENT_LIST@95..95 - 3: R_CURLY@95..96 "}" [] [] - 2: JS_BOGUS_MEMBER@96..127 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@96..110 - 0: TS_ABSTRACT_MODIFIER@96..110 - 0: ABSTRACT_KW@96..110 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@110..114 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@114..121 - 0: IDENT@114..121 "my_name" [] [] - 3: L_PAREN@121..122 "(" [] [] - 4: R_PAREN@122..124 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@124..127 - 0: L_CURLY@124..126 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@126..126 - 2: JS_STATEMENT_LIST@126..126 - 3: R_CURLY@126..127 "}" [] [] - 3: JS_BOGUS_MEMBER@127..162 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@127..141 - 0: TS_ABSTRACT_MODIFIER@127..141 - 0: ABSTRACT_KW@127..141 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@141..145 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@145..152 - 0: IDENT@145..152 "my_name" [] [] - 3: L_PAREN@152..153 "(" [] [] - 4: JS_FORMAL_PARAMETER@153..157 - 0: JS_DECORATOR_LIST@153..153 - 1: JS_IDENTIFIER_BINDING@153..157 - 0: IDENT@153..157 "name" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: R_PAREN@157..159 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@159..162 - 0: L_CURLY@159..161 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@161..161 - 2: JS_STATEMENT_LIST@161..161 - 3: R_CURLY@161..162 "}" [] [] - 4: JS_BOGUS_MEMBER@162..195 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@162..176 - 0: TS_ABSTRACT_MODIFIER@162..176 - 0: ABSTRACT_KW@162..176 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@176..189 - 0: HASH@176..177 "#" [] [] - 1: IDENT@177..189 "private_name" [] [] - 2: JS_PARAMETERS@189..192 - 0: L_PAREN@189..190 "(" [] [] - 1: JS_PARAMETER_LIST@190..190 - 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@192..195 - 0: L_CURLY@192..194 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@194..194 - 2: JS_STATEMENT_LIST@194..194 - 3: R_CURLY@194..195 "}" [] [] - 9: R_CURLY@195..197 "}" [Newline("\n")] [] - 4: EOF@197..198 "" [Newline("\n")] [] --- -typescript_abstract_class_member_should_not_have_body.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' cannot appear on a constructor declaration. - - 1 │ abstract class AbstractMembers { - > 2 │ abstract constructor() { } - │ ^^^^^^^^ - 3 │ abstract display(): void { } - 4 │ abstract get my_name() { } - --- -typescript_abstract_class_member_should_not_have_body.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × abstract members should not have a body - - 1 │ abstract class AbstractMembers { - 2 │ abstract constructor() { } - > 3 │ abstract display(): void { } - │ ^^^ - 4 │ abstract get my_name() { } - 5 │ abstract set my_name(name) { } - --- -typescript_abstract_class_member_should_not_have_body.ts:4:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × abstract members should not have a body - - 2 │ abstract constructor() { } - 3 │ abstract display(): void { } - > 4 │ abstract get my_name() { } - │ ^^^ - 5 │ abstract set my_name(name) { } - 6 │ abstract #private_name() { } - --- -typescript_abstract_class_member_should_not_have_body.ts:5:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × abstract members should not have a body - - 3 │ abstract display(): void { } - 4 │ abstract get my_name() { } - > 5 │ abstract set my_name(name) { } - │ ^^^ - 6 │ abstract #private_name() { } - 7 │ } - --- -typescript_abstract_class_member_should_not_have_body.ts:6:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × abstract members should not have a body - - 4 │ abstract get my_name() { } - 5 │ abstract set my_name(name) { } - > 6 │ abstract #private_name() { } - │ ^^^ - 7 │ } - 8 │ - --- -typescript_abstract_class_member_should_not_have_body.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' modifier cannot be used with a private identifier'. - - 4 │ abstract get my_name() { } - 5 │ abstract set my_name(name) { } - > 6 │ abstract #private_name() { } - │ ^^^^^^^^ - 7 │ } - 8 │ - --- -abstract class AbstractMembers { - abstract constructor() { } - abstract display(): void { } - abstract get my_name() { } - abstract set my_name(name) { } - abstract #private_name() { } -} diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast deleted file mode 100644 index 41d11ee629b3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsPropertySignatureModifierList [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@19..28 "accessor" [] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@28..37 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@37..40 "foo" [] [], - }, - TsTypeAnnotation { - colon_token: COLON@40..42 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@42..48 "number" [] [], - }, - }, - SEMICOLON@48..50 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - ], - eof_token: EOF@51..52 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..52 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..51 - 0: JS_CLASS_DECLARATION@0..51 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@19..50 - 0: JS_BOGUS_MEMBER@19..50 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@19..37 - 0: JS_ACCESSOR_MODIFIER@19..28 - 0: ACCESSOR_KW@19..28 "accessor" [] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@28..37 - 0: ABSTRACT_KW@28..37 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@37..40 - 0: IDENT@37..40 "foo" [] [] - 2: TS_TYPE_ANNOTATION@40..48 - 0: COLON@40..42 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@42..48 - 0: NUMBER_KW@42..48 "number" [] [] - 3: SEMICOLON@48..50 ";" [] [Whitespace(" ")] - 9: R_CURLY@50..51 "}" [] [] - 4: EOF@51..52 "" [Newline("\n")] [] --- -typescript_abstract_classes_abstract_accessor_precedence.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' must precede 'accessor' - - > 1 │ abstract class A { accessor abstract foo: number; } - │ ^^^^^^^^ - 2 │ - - i move this modifier - - > 1 │ abstract class A { accessor abstract foo: number; } - │ ^^^^^^^^ - 2 │ - - i before this modifier - - > 1 │ abstract class A { accessor abstract foo: number; } - │ ^^^^^^^^ - 2 │ - --- -abstract class A { accessor abstract foo: number; } diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast deleted file mode 100644 index 9bc827809816..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast +++ /dev/null @@ -1,54 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: missing (required), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@15..16 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - ], - eof_token: EOF@18..19 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..19 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..18 - 0: JS_CLASS_DECLARATION@0..17 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@15..16 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@16..16 - 9: R_CURLY@16..17 "}" [] [] - 1: JS_EMPTY_STATEMENT@17..18 - 0: SEMICOLON@17..18 ";" [] [] - 4: EOF@18..19 "" [Newline("\n")] [] --- -typescript_abstract_classes_incomplete.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × class declarations must have a name - - > 1 │ abstract class {}; - │ ^^^^^^ - 2 │ - --- -abstract class {}; diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast deleted file mode 100644 index d3f6822477e4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast +++ /dev/null @@ -1,81 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], - }, - ASYNC_KW@28..34 "async" [] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@34..35 "a" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@35..36 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@36..37 ")" [] [], - }, - SEMICOLON@37..39 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: JS_CLASS_DECLARATION@0..40 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@19..39 - 0: JS_BOGUS_MEMBER@19..39 - 0: TS_ABSTRACT_MODIFIER@19..28 - 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] - 1: ASYNC_KW@28..34 "async" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@34..35 - 0: IDENT@34..35 "a" [] [] - 3: JS_PARAMETERS@35..37 - 0: L_PAREN@35..36 "(" [] [] - 1: JS_PARAMETER_LIST@36..36 - 2: R_PAREN@36..37 ")" [] [] - 4: SEMICOLON@37..39 ";" [] [Whitespace(" ")] - 9: R_CURLY@39..40 "}" [] [] - 4: EOF@40..41 "" [Newline("\n")] [] --- -typescript_abstract_classes_invalid_abstract_async_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × async members cannot be abstract - - > 1 │ abstract class B { abstract async a(); } - │ ^^^^^^^^ - 2 │ - --- -abstract class B { abstract async a(); } diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast deleted file mode 100644 index fec8fe143f3c..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast +++ /dev/null @@ -1,89 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsBogus { - items: [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], - }, - ], - }, - JsLiteralMemberName { - value: IDENT@28..39 "constructor" [] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@39..40 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@40..41 ")" [] [], - }, - SEMICOLON@41..42 ";" [] [], - ], - }, - ], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: JS_CLASS_DECLARATION@0..43 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@19..42 - 0: JS_BOGUS_MEMBER@19..42 - 0: JS_BOGUS@19..28 - 0: TS_ABSTRACT_MODIFIER@19..28 - 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@28..39 - 0: IDENT@28..39 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@39..41 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@40..40 - 2: R_PAREN@40..41 ")" [] [] - 3: SEMICOLON@41..42 ";" [] [] - 9: R_CURLY@42..43 "}" [] [] - 1: JS_EMPTY_STATEMENT@43..44 - 0: SEMICOLON@43..44 ";" [] [] - 4: EOF@44..45 "" [Newline("\n")] [] --- -typescript_abstract_classes_invalid_abstract_constructor.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' cannot appear on a constructor declaration. - - > 1 │ abstract class A { abstract constructor();}; - │ ^^^^^^^^ - 2 │ - --- -abstract class A { abstract constructor();}; diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast deleted file mode 100644 index 40ecfbcf77b8..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast +++ /dev/null @@ -1,89 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@28..29 "#" [] [], - id_token: IDENT@29..33 "name" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@33..34 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@34..35 ")" [] [], - }, - SEMICOLON@35..37 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_CLASS_DECLARATION@0..38 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@19..37 - 0: JS_BOGUS_MEMBER@19..37 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@19..28 - 0: TS_ABSTRACT_MODIFIER@19..28 - 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@28..33 - 0: HASH@28..29 "#" [] [] - 1: IDENT@29..33 "name" [] [] - 2: JS_PARAMETERS@33..35 - 0: L_PAREN@33..34 "(" [] [] - 1: JS_PARAMETER_LIST@34..34 - 2: R_PAREN@34..35 ")" [] [] - 3: SEMICOLON@35..37 ";" [] [Whitespace(" ")] - 9: R_CURLY@37..38 "}" [] [] - 1: JS_EMPTY_STATEMENT@38..39 - 0: SEMICOLON@38..39 ";" [] [] - 4: EOF@39..40 "" [Newline("\n")] [] --- -typescript_abstract_classes_invalid_abstract_private_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' modifier cannot be used with a private identifier'. - - > 1 │ abstract class A { abstract #name(); }; - │ ^^^^^^^^ - 2 │ - --- -abstract class A { abstract #name(); }; diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast b/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast deleted file mode 100644 index ebfb756525e3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast +++ /dev/null @@ -1,188 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@28..35 "static" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@35..38 "fn1" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@39..40 ")" [] [], - }, - SEMICOLON@40..42 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@43..53 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@53..59 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@59..61 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@61..63 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - TsMethodSignatureModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@63..70 "static" [] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@70..79 "abstract" [] [Whitespace(" ")], - }, - ], - JsLiteralMemberName { - value: IDENT@79..82 "fn1" [] [], - }, - JsParameters { - l_paren_token: L_PAREN@82..83 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@83..84 ")" [] [], - }, - SEMICOLON@84..86 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@86..87 "}" [] [], - }, - ], - eof_token: EOF@87..88 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..88 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..87 - 0: JS_CLASS_DECLARATION@0..43 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@19..42 - 0: JS_BOGUS_MEMBER@19..42 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@19..35 - 0: TS_ABSTRACT_MODIFIER@19..28 - 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@28..35 - 0: STATIC_KW@28..35 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@35..38 - 0: IDENT@35..38 "fn1" [] [] - 2: JS_PARAMETERS@38..40 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..39 - 2: R_PAREN@39..40 ")" [] [] - 3: SEMICOLON@40..42 ";" [] [Whitespace(" ")] - 9: R_CURLY@42..43 "}" [] [] - 1: JS_CLASS_DECLARATION@43..87 - 0: JS_DECORATOR_LIST@43..43 - 1: ABSTRACT_KW@43..53 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@53..59 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@59..61 - 0: IDENT@59..61 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@61..63 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@63..86 - 0: JS_BOGUS_MEMBER@63..86 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@63..79 - 0: JS_STATIC_MODIFIER@63..70 - 0: STATIC_KW@63..70 "static" [] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@70..79 - 0: ABSTRACT_KW@70..79 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@79..82 - 0: IDENT@79..82 "fn1" [] [] - 2: JS_PARAMETERS@82..84 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_PARAMETER_LIST@83..83 - 2: R_PAREN@83..84 ")" [] [] - 3: SEMICOLON@84..86 ";" [] [Whitespace(" ")] - 9: R_CURLY@86..87 "}" [] [] - 4: EOF@87..88 "" [Newline("\n")] [] --- -typescript_abstract_classes_invalid_static_abstract_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' cannot be used with 'static' modifier. - - > 1 │ abstract class A { abstract static fn1(); } - │ ^^^^^^^^ - 2 │ abstract class B { static abstract fn1(); } - 3 │ - - i 'abstract' modifier - - > 1 │ abstract class A { abstract static fn1(); } - │ ^^^^^^^^ - 2 │ abstract class B { static abstract fn1(); } - 3 │ - - i 'static' modifier - - > 1 │ abstract class A { abstract static fn1(); } - │ ^^^^^^ - 2 │ abstract class B { static abstract fn1(); } - 3 │ - --- -typescript_abstract_classes_invalid_static_abstract_member.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × 'abstract' cannot be used with 'static' modifier. - - 1 │ abstract class A { abstract static fn1(); } - > 2 │ abstract class B { static abstract fn1(); } - │ ^^^^^^^^ - 3 │ - - i 'abstract' modifier - - 1 │ abstract class A { abstract static fn1(); } - > 2 │ abstract class B { static abstract fn1(); } - │ ^^^^^^^^ - 3 │ - - i 'static' modifier - - 1 │ abstract class A { abstract static fn1(); } - > 2 │ abstract class B { static abstract fn1(); } - │ ^^^^^^ - 3 │ - --- -abstract class A { abstract static fn1(); } -abstract class B { static abstract fn1(); } diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast b/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast deleted file mode 100644 index 20f5c64dc224..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast +++ /dev/null @@ -1,142 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@10..18 "private" [] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@18..19 "#" [] [], - id_token: IDENT@19..23 "name" [] [], - }, - SEMICOLON@23..25 ";" [] [Whitespace(" ")], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@25..35 "protected" [] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@35..36 "#" [] [], - id_token: IDENT@36..41 "other" [] [], - }, - SEMICOLON@41..43 ";" [] [Whitespace(" ")], - ], - }, - JsBogusMember { - items: [ - JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@43..50 "public" [] [Whitespace(" ")], - }, - ], - JsPrivateClassMemberName { - hash_token: HASH@50..51 "#" [] [], - id_token: IDENT@51..54 "baz" [] [], - }, - SEMICOLON@54..56 ";" [] [Whitespace(" ")], - ], - }, - ], - r_curly_token: R_CURLY@56..57 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@57..58 ";" [] [], - }, - ], - eof_token: EOF@58..59 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..59 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..58 - 0: JS_CLASS_DECLARATION@0..57 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..56 - 0: JS_BOGUS_MEMBER@10..25 - 0: JS_PROPERTY_MODIFIER_LIST@10..18 - 0: TS_ACCESSIBILITY_MODIFIER@10..18 - 0: PRIVATE_KW@10..18 "private" [] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@18..23 - 0: HASH@18..19 "#" [] [] - 1: IDENT@19..23 "name" [] [] - 2: SEMICOLON@23..25 ";" [] [Whitespace(" ")] - 1: JS_BOGUS_MEMBER@25..43 - 0: JS_PROPERTY_MODIFIER_LIST@25..35 - 0: TS_ACCESSIBILITY_MODIFIER@25..35 - 0: PROTECTED_KW@25..35 "protected" [] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@35..41 - 0: HASH@35..36 "#" [] [] - 1: IDENT@36..41 "other" [] [] - 2: SEMICOLON@41..43 ";" [] [Whitespace(" ")] - 2: JS_BOGUS_MEMBER@43..56 - 0: JS_PROPERTY_MODIFIER_LIST@43..50 - 0: TS_ACCESSIBILITY_MODIFIER@43..50 - 0: PUBLIC_KW@43..50 "public" [] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@50..54 - 0: HASH@50..51 "#" [] [] - 1: IDENT@51..54 "baz" [] [] - 2: SEMICOLON@54..56 ";" [] [Whitespace(" ")] - 9: R_CURLY@56..57 "}" [] [] - 1: JS_EMPTY_STATEMENT@57..58 - 0: SEMICOLON@57..58 ";" [] [] - 4: EOF@58..59 "" [Newline("\n")] [] --- -typescript_classes_invalid_accessibility_modifier_private_member.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━ - - × An accessibility modifier cannot be used with a private identifier. - - > 1 │ class A { private #name; protected #other; public #baz; }; - │ ^^^^^^^ - 2 │ - --- -typescript_classes_invalid_accessibility_modifier_private_member.ts:1:26 parse ━━━━━━━━━━━━━━━━━━━━━ - - × An accessibility modifier cannot be used with a private identifier. - - > 1 │ class A { private #name; protected #other; public #baz; }; - │ ^^^^^^^^^ - 2 │ - --- -typescript_classes_invalid_accessibility_modifier_private_member.ts:1:44 parse ━━━━━━━━━━━━━━━━━━━━━ - - × An accessibility modifier cannot be used with a private identifier. - - > 1 │ class A { private #name; protected #other; public #baz; }; - │ ^^^^^^ - 2 │ - --- -class A { private #name; protected #other; public #baz; }; diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast deleted file mode 100644 index 7069b0b29817..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast +++ /dev/null @@ -1,50 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@7..8 "{" [] [], - members: TsEnumMemberList [], - r_curly_token: missing (required), - }, - ], - eof_token: EOF@8..9 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..9 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..8 - 0: TS_ENUM_DECLARATION@0..8 - 0: (empty) - 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 3: L_CURLY@7..8 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@8..8 - 5: (empty) - 4: EOF@8..9 "" [Newline("\n")] [] --- -typescript_enum_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `}` but instead the file ends - - 1 │ enum A { - > 2 │ - │ - - i the file ends here - - 1 │ enum A { - > 2 │ - │ - --- -enum A { diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast b/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast deleted file mode 100644 index 4d18261007b8..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast +++ /dev/null @@ -1,531 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..19 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@19..20 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@39..40 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - JsLiteralMemberName { - value: IDENT@41..50 "name" [Newline("\n"), Whitespace(" ")] [], - }, - JsParameters { - l_paren_token: L_PAREN@50..51 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@53..54 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - GET_KW@55..64 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@64..68 "test" [] [], - }, - L_PAREN@68..69 "(" [] [], - R_PAREN@69..70 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@70..72 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@72..79 "string" [] [Whitespace(" ")], - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@79..81 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@81..88 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@88..90 "\"\"" [] [], - }, - semicolon_token: SEMICOLON@90..92 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - SET_KW@93..102 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@102..106 "test" [] [], - }, - L_PAREN@106..107 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@107..108 "v" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - R_PAREN@108..110 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@110..111 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@111..112 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@112..114 "}" [Newline("\n")] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@114..123 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@123..133 "namespace" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@133..135 "n" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@135..136 "{" [] [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@136..148 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@148..153 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@153..154 "{" [] [], - members: JsClassMemberList [ - JsBogusMember { - items: [ - JsConstructorModifierList [], - JsLiteralMemberName { - value: IDENT@154..175 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - JsConstructorParameters { - l_paren_token: L_PAREN@175..176 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@176..178 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@178..179 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@179..180 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - JsLiteralMemberName { - value: IDENT@180..194 "name" [Newline("\n"), Whitespace(" ")] [], - }, - JsParameters { - l_paren_token: L_PAREN@194..195 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@195..197 ")" [] [Whitespace(" ")], - }, - JsFunctionBody { - l_curly_token: L_CURLY@197..198 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@198..199 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - GET_KW@199..213 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@213..217 "test" [] [], - }, - L_PAREN@217..218 "(" [] [], - R_PAREN@218..219 ")" [] [], - TsTypeAnnotation { - colon_token: COLON@219..221 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@221..228 "string" [] [Whitespace(" ")], - }, - }, - JsFunctionBody { - l_curly_token: L_CURLY@228..230 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@230..237 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@237..239 "\"\"" [] [], - }, - semicolon_token: SEMICOLON@239..241 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@241..242 "}" [] [], - }, - ], - }, - JsBogusMember { - items: [ - TsMethodSignatureModifierList [], - SET_KW@242..256 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - JsLiteralMemberName { - value: IDENT@256..260 "test" [] [], - }, - L_PAREN@260..261 "(" [] [], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@261..262 "v" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - R_PAREN@262..264 ")" [] [Whitespace(" ")], - JsFunctionBody { - l_curly_token: L_CURLY@264..265 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@265..266 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@266..273 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_curly_token: R_CURLY@273..275 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@275..276 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..276 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..275 - 0: TS_DECLARE_STATEMENT@0..114 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..114 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..19 - 0: IDENT@14..19 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@19..20 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@20..112 - 0: JS_BOGUS_MEMBER@20..41 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..36 - 0: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@36..39 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@37..37 - 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@39..41 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..40 - 3: R_CURLY@40..41 "}" [] [] - 1: JS_BOGUS_MEMBER@41..55 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@41..41 - 1: JS_LITERAL_MEMBER_NAME@41..50 - 0: IDENT@41..50 "name" [Newline("\n"), Whitespace(" ")] [] - 2: JS_PARAMETERS@50..53 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_PARAMETER_LIST@51..51 - 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@53..55 - 0: L_CURLY@53..54 "{" [] [] - 1: JS_DIRECTIVE_LIST@54..54 - 2: JS_STATEMENT_LIST@54..54 - 3: R_CURLY@54..55 "}" [] [] - 2: JS_BOGUS_MEMBER@55..93 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@55..55 - 1: GET_KW@55..64 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@64..68 - 0: IDENT@64..68 "test" [] [] - 3: L_PAREN@68..69 "(" [] [] - 4: R_PAREN@69..70 ")" [] [] - 5: TS_TYPE_ANNOTATION@70..79 - 0: COLON@70..72 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@72..79 - 0: STRING_KW@72..79 "string" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@79..93 - 0: L_CURLY@79..81 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@81..81 - 2: JS_STATEMENT_LIST@81..92 - 0: JS_RETURN_STATEMENT@81..92 - 0: RETURN_KW@81..88 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@88..90 - 0: JS_STRING_LITERAL@88..90 "\"\"" [] [] - 2: SEMICOLON@90..92 ";" [] [Whitespace(" ")] - 3: R_CURLY@92..93 "}" [] [] - 3: JS_BOGUS_MEMBER@93..112 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@93..93 - 1: SET_KW@93..102 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@102..106 - 0: IDENT@102..106 "test" [] [] - 3: L_PAREN@106..107 "(" [] [] - 4: JS_FORMAL_PARAMETER@107..108 - 0: JS_DECORATOR_LIST@107..107 - 1: JS_IDENTIFIER_BINDING@107..108 - 0: IDENT@107..108 "v" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: R_PAREN@108..110 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@110..112 - 0: L_CURLY@110..111 "{" [] [] - 1: JS_DIRECTIVE_LIST@111..111 - 2: JS_STATEMENT_LIST@111..111 - 3: R_CURLY@111..112 "}" [] [] - 9: R_CURLY@112..114 "}" [Newline("\n")] [] - 1: TS_DECLARE_STATEMENT@114..275 - 0: DECLARE_KW@114..123 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@123..275 - 0: NAMESPACE_KW@123..133 "namespace" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@133..135 - 0: IDENT@133..135 "n" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@135..275 - 0: L_CURLY@135..136 "{" [] [] - 1: JS_MODULE_ITEM_LIST@136..273 - 0: JS_CLASS_DECLARATION@136..273 - 0: JS_DECORATOR_LIST@136..136 - 1: (empty) - 2: CLASS_KW@136..148 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@148..153 - 0: IDENT@148..153 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@153..154 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@154..266 - 0: JS_BOGUS_MEMBER@154..180 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@154..154 - 1: JS_LITERAL_MEMBER_NAME@154..175 - 0: IDENT@154..175 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@175..178 - 0: L_PAREN@175..176 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@176..176 - 2: R_PAREN@176..178 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@178..180 - 0: L_CURLY@178..179 "{" [] [] - 1: JS_DIRECTIVE_LIST@179..179 - 2: JS_STATEMENT_LIST@179..179 - 3: R_CURLY@179..180 "}" [] [] - 1: JS_BOGUS_MEMBER@180..199 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@180..180 - 1: JS_LITERAL_MEMBER_NAME@180..194 - 0: IDENT@180..194 "name" [Newline("\n"), Whitespace(" ")] [] - 2: JS_PARAMETERS@194..197 - 0: L_PAREN@194..195 "(" [] [] - 1: JS_PARAMETER_LIST@195..195 - 2: R_PAREN@195..197 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@197..199 - 0: L_CURLY@197..198 "{" [] [] - 1: JS_DIRECTIVE_LIST@198..198 - 2: JS_STATEMENT_LIST@198..198 - 3: R_CURLY@198..199 "}" [] [] - 2: JS_BOGUS_MEMBER@199..242 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@199..199 - 1: GET_KW@199..213 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@213..217 - 0: IDENT@213..217 "test" [] [] - 3: L_PAREN@217..218 "(" [] [] - 4: R_PAREN@218..219 ")" [] [] - 5: TS_TYPE_ANNOTATION@219..228 - 0: COLON@219..221 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@221..228 - 0: STRING_KW@221..228 "string" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@228..242 - 0: L_CURLY@228..230 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@230..230 - 2: JS_STATEMENT_LIST@230..241 - 0: JS_RETURN_STATEMENT@230..241 - 0: RETURN_KW@230..237 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@237..239 - 0: JS_STRING_LITERAL@237..239 "\"\"" [] [] - 2: SEMICOLON@239..241 ";" [] [Whitespace(" ")] - 3: R_CURLY@241..242 "}" [] [] - 3: JS_BOGUS_MEMBER@242..266 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@242..242 - 1: SET_KW@242..256 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@256..260 - 0: IDENT@256..260 "test" [] [] - 3: L_PAREN@260..261 "(" [] [] - 4: JS_FORMAL_PARAMETER@261..262 - 0: JS_DECORATOR_LIST@261..261 - 1: JS_IDENTIFIER_BINDING@261..262 - 0: IDENT@261..262 "v" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: R_PAREN@262..264 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@264..266 - 0: L_CURLY@264..265 "{" [] [] - 1: JS_DIRECTIVE_LIST@265..265 - 2: JS_STATEMENT_LIST@265..265 - 3: R_CURLY@265..266 "}" [] [] - 9: R_CURLY@266..273 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@273..275 "}" [Newline("\n")] [] - 4: EOF@275..276 "" [Newline("\n")] [] --- -typescript_members_with_body_in_ambient_context_should_err.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 1 │ declare class Test { - > 2 │ constructor() {} - │ ^^ - 3 │ name() {} - 4 │ get test(): string { return ""; } - --- -typescript_members_with_body_in_ambient_context_should_err.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 1 │ declare class Test { - 2 │ constructor() {} - > 3 │ name() {} - │ ^^ - 4 │ get test(): string { return ""; } - 5 │ set test(v) {} - --- -typescript_members_with_body_in_ambient_context_should_err.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 2 │ constructor() {} - 3 │ name() {} - > 4 │ get test(): string { return ""; } - │ ^^^^^^^^^^^^^^ - 5 │ set test(v) {} - 6 │ } - --- -typescript_members_with_body_in_ambient_context_should_err.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 3 │ name() {} - 4 │ get test(): string { return ""; } - > 5 │ set test(v) {} - │ ^^ - 6 │ } - 7 │ declare namespace n { - --- -typescript_members_with_body_in_ambient_context_should_err.ts:9:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 7 │ declare namespace n { - 8 │ class Test { - > 9 │ constructor() {} - │ ^^ - 10 │ name() {} - 11 │ get test(): string { return ""; } - --- -typescript_members_with_body_in_ambient_context_should_err.ts:10:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 8 │ class Test { - 9 │ constructor() {} - > 10 │ name() {} - │ ^^ - 11 │ get test(): string { return ""; } - 12 │ set test(v) {} - --- -typescript_members_with_body_in_ambient_context_should_err.ts:11:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 9 │ constructor() {} - 10 │ name() {} - > 11 │ get test(): string { return ""; } - │ ^^^^^^^^^^^^^^ - 12 │ set test(v) {} - 13 │ } - --- -typescript_members_with_body_in_ambient_context_should_err.ts:12:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × members inside ambient contexts should not have a body - - 10 │ name() {} - 11 │ get test(): string { return ""; } - > 12 │ set test(v) {} - │ ^^ - 13 │ } - 14 │ } - --- -declare class Test { - constructor() {} - name() {} - get test(): string { return ""; } - set test(v) {} -} -declare namespace n { - class Test { - constructor() {} - name() {} - get test(): string { return ""; } - set test(v) {} - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete.rast b/crates/biome_js_parser/test_data/inline/err/unary_delete.rast deleted file mode 100644 index 82b924bff478..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/unary_delete.rast +++ /dev/null @@ -1,251 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@0..7 "delete" [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..12 "ident" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@13..21 "delete" [Newline("\n")] [Whitespace(" ")], - JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "obj" [] [], - }, - }, - operator_token: DOT@24..25 "." [] [], - member: JsPrivateName { - hash_token: HASH@25..26 "#" [] [], - value_token: IDENT@26..32 "member" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")], - JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..45 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@45..46 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@46..47 ")" [] [], - }, - }, - operator_token: DOT@47..48 "." [] [], - member: JsPrivateName { - hash_token: HASH@48..49 "#" [] [], - value_token: IDENT@49..55 "member" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@55..56 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@56..64 "delete" [Newline("\n")] [Whitespace(" ")], - JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@64..67 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@67..69 "?." [] [], - member: JsPrivateName { - hash_token: HASH@69..70 "#" [] [], - value_token: IDENT@70..76 "member" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@76..77 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@77..85 "delete" [Newline("\n")] [Whitespace(" ")], - JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@85..88 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@88..90 "?." [] [], - member: JsName { - value_token: IDENT@90..95 "inner" [] [], - }, - }, - operator_token: DOT@95..96 "." [] [], - member: JsPrivateName { - hash_token: HASH@96..97 "#" [] [], - value_token: IDENT@97..103 "member" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - ], - eof_token: EOF@104..105 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..105 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..104 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_BOGUS_EXPRESSION@0..12 - 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@7..12 - 0: JS_REFERENCE_IDENTIFIER@7..12 - 0: IDENT@7..12 "ident" [] [] - 1: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@13..33 - 0: JS_BOGUS_EXPRESSION@13..32 - 0: DELETE_KW@13..21 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@21..32 - 0: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "obj" [] [] - 1: DOT@24..25 "." [] [] - 2: JS_PRIVATE_NAME@25..32 - 0: HASH@25..26 "#" [] [] - 1: IDENT@26..32 "member" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..56 - 0: JS_BOGUS_EXPRESSION@33..55 - 0: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@41..55 - 0: JS_CALL_EXPRESSION@41..47 - 0: JS_IDENTIFIER_EXPRESSION@41..45 - 0: JS_REFERENCE_IDENTIFIER@41..45 - 0: IDENT@41..45 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@45..47 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@46..46 - 2: R_PAREN@46..47 ")" [] [] - 1: DOT@47..48 "." [] [] - 2: JS_PRIVATE_NAME@48..55 - 0: HASH@48..49 "#" [] [] - 1: IDENT@49..55 "member" [] [] - 1: SEMICOLON@55..56 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@56..77 - 0: JS_BOGUS_EXPRESSION@56..76 - 0: DELETE_KW@56..64 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@64..76 - 0: JS_IDENTIFIER_EXPRESSION@64..67 - 0: JS_REFERENCE_IDENTIFIER@64..67 - 0: IDENT@64..67 "obj" [] [] - 1: QUESTIONDOT@67..69 "?." [] [] - 2: JS_PRIVATE_NAME@69..76 - 0: HASH@69..70 "#" [] [] - 1: IDENT@70..76 "member" [] [] - 1: SEMICOLON@76..77 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@77..104 - 0: JS_BOGUS_EXPRESSION@77..103 - 0: DELETE_KW@77..85 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@85..103 - 0: JS_STATIC_MEMBER_EXPRESSION@85..95 - 0: JS_IDENTIFIER_EXPRESSION@85..88 - 0: JS_REFERENCE_IDENTIFIER@85..88 - 0: IDENT@85..88 "obj" [] [] - 1: QUESTIONDOT@88..90 "?." [] [] - 2: JS_NAME@90..95 - 0: IDENT@90..95 "inner" [] [] - 1: DOT@95..96 "." [] [] - 2: JS_PRIVATE_NAME@96..103 - 0: HASH@96..97 "#" [] [] - 1: IDENT@97..103 "member" [] [] - 1: SEMICOLON@103..104 ";" [] [] - 4: EOF@104..105 "" [Newline("\n")] [] --- -unary_delete.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a single identifier - - > 1 │ delete ident; - │ ^^^^^ - 2 │ delete obj.#member; - 3 │ delete func().#member; - --- -unary_delete.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 1 │ delete ident; - > 2 │ delete obj.#member; - │ ^^^^^^^^^^^ - 3 │ delete func().#member; - 4 │ delete obj?.#member; - --- -unary_delete.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 1 │ delete ident; - 2 │ delete obj.#member; - > 3 │ delete func().#member; - │ ^^^^^^^^^^^^^^ - 4 │ delete obj?.#member; - 5 │ delete obj?.inner.#member; - --- -unary_delete.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 2 │ delete obj.#member; - 3 │ delete func().#member; - > 4 │ delete obj?.#member; - │ ^^^^^^^^^^^^ - 5 │ delete obj?.inner.#member; - 6 │ - --- -unary_delete.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 3 │ delete func().#member; - 4 │ delete obj?.#member; - > 5 │ delete obj?.inner.#member; - │ ^^^^^^^^^^^^^^^^^^ - 6 │ - --- -delete ident; -delete obj.#member; -delete func().#member; -delete obj?.#member; -delete obj?.inner.#member; diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast b/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast deleted file mode 100644 index ba659845801b..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast +++ /dev/null @@ -1,471 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@0..7 "delete" [] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@7..8 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..13 "ident" [] [], - }, - }, - r_paren_token: R_PAREN@13..14 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@23..24 "(" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@24..25 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@25..30 "ident" [] [], - }, - }, - r_paren_token: R_PAREN@30..31 ")" [] [], - }, - r_paren_token: R_PAREN@31..32 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@41..42 "(" [] [], - expression: JsSequenceExpression { - left: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..45 "obj" [] [], - }, - }, - operator_token: DOT@45..46 "." [] [], - member: JsName { - value_token: IDENT@46..49 "key" [] [], - }, - }, - comma_token: COMMA@49..51 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@51..56 "ident" [] [], - }, - }, - }, - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@57..58 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@58..66 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@66..67 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@67..70 "obj" [] [], - }, - }, - operator_token: DOT@70..71 "." [] [], - member: JsPrivateName { - hash_token: HASH@71..72 "#" [] [], - value_token: IDENT@72..78 "member" [] [], - }, - }, - r_paren_token: R_PAREN@78..79 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@79..80 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@80..88 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@88..89 "(" [] [], - expression: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@89..93 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@93..94 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@94..95 ")" [] [], - }, - }, - operator_token: DOT@95..96 "." [] [], - member: JsPrivateName { - hash_token: HASH@96..97 "#" [] [], - value_token: IDENT@97..103 "member" [] [], - }, - }, - r_paren_token: R_PAREN@103..104 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@104..105 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@105..113 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@113..114 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@114..117 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@117..119 "?." [] [], - member: JsPrivateName { - hash_token: HASH@119..120 "#" [] [], - value_token: IDENT@120..126 "member" [] [], - }, - }, - r_paren_token: R_PAREN@126..127 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@127..128 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@128..136 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@136..137 "(" [] [], - expression: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..140 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@140..142 "?." [] [], - member: JsName { - value_token: IDENT@142..147 "inner" [] [], - }, - }, - operator_token: DOT@147..148 "." [] [], - member: JsPrivateName { - hash_token: HASH@148..149 "#" [] [], - value_token: IDENT@149..155 "member" [] [], - }, - }, - r_paren_token: R_PAREN@155..156 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@156..157 ";" [] [], - }, - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - DELETE_KW@157..165 "delete" [Newline("\n")] [Whitespace(" ")], - JsParenthesizedExpression { - l_paren_token: L_PAREN@165..166 "(" [] [], - expression: JsSequenceExpression { - left: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@166..169 "obj" [] [], - }, - }, - operator_token: DOT@169..170 "." [] [], - member: JsName { - value_token: IDENT@170..173 "key" [] [], - }, - }, - comma_token: COMMA@173..175 "," [] [Whitespace(" ")], - right: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@175..178 "obj" [] [], - }, - }, - operator_token: DOT@178..179 "." [] [], - member: JsPrivateName { - hash_token: HASH@179..180 "#" [] [], - value_token: IDENT@180..183 "key" [] [], - }, - }, - }, - r_paren_token: R_PAREN@183..184 ")" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@184..185 ";" [] [], - }, - ], - eof_token: EOF@185..186 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..186 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..185 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JS_BOGUS_EXPRESSION@0..14 - 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@7..14 - 0: L_PAREN@7..8 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@8..13 - 0: JS_REFERENCE_IDENTIFIER@8..13 - 0: IDENT@8..13 "ident" [] [] - 2: R_PAREN@13..14 ")" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@15..33 - 0: JS_BOGUS_EXPRESSION@15..32 - 0: DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@23..32 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@24..31 - 0: L_PAREN@24..25 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@25..30 - 0: JS_REFERENCE_IDENTIFIER@25..30 - 0: IDENT@25..30 "ident" [] [] - 2: R_PAREN@30..31 ")" [] [] - 2: R_PAREN@31..32 ")" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..58 - 0: JS_BOGUS_EXPRESSION@33..57 - 0: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@41..57 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@42..56 - 0: JS_STATIC_MEMBER_EXPRESSION@42..49 - 0: JS_IDENTIFIER_EXPRESSION@42..45 - 0: JS_REFERENCE_IDENTIFIER@42..45 - 0: IDENT@42..45 "obj" [] [] - 1: DOT@45..46 "." [] [] - 2: JS_NAME@46..49 - 0: IDENT@46..49 "key" [] [] - 1: COMMA@49..51 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@51..56 - 0: JS_REFERENCE_IDENTIFIER@51..56 - 0: IDENT@51..56 "ident" [] [] - 2: R_PAREN@56..57 ")" [] [] - 1: SEMICOLON@57..58 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@58..80 - 0: JS_BOGUS_EXPRESSION@58..79 - 0: DELETE_KW@58..66 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@66..79 - 0: L_PAREN@66..67 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@67..78 - 0: JS_IDENTIFIER_EXPRESSION@67..70 - 0: JS_REFERENCE_IDENTIFIER@67..70 - 0: IDENT@67..70 "obj" [] [] - 1: DOT@70..71 "." [] [] - 2: JS_PRIVATE_NAME@71..78 - 0: HASH@71..72 "#" [] [] - 1: IDENT@72..78 "member" [] [] - 2: R_PAREN@78..79 ")" [] [] - 1: SEMICOLON@79..80 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@80..105 - 0: JS_BOGUS_EXPRESSION@80..104 - 0: DELETE_KW@80..88 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@88..104 - 0: L_PAREN@88..89 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@89..103 - 0: JS_CALL_EXPRESSION@89..95 - 0: JS_IDENTIFIER_EXPRESSION@89..93 - 0: JS_REFERENCE_IDENTIFIER@89..93 - 0: IDENT@89..93 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@93..95 - 0: L_PAREN@93..94 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@94..94 - 2: R_PAREN@94..95 ")" [] [] - 1: DOT@95..96 "." [] [] - 2: JS_PRIVATE_NAME@96..103 - 0: HASH@96..97 "#" [] [] - 1: IDENT@97..103 "member" [] [] - 2: R_PAREN@103..104 ")" [] [] - 1: SEMICOLON@104..105 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@105..128 - 0: JS_BOGUS_EXPRESSION@105..127 - 0: DELETE_KW@105..113 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@113..127 - 0: L_PAREN@113..114 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@114..126 - 0: JS_IDENTIFIER_EXPRESSION@114..117 - 0: JS_REFERENCE_IDENTIFIER@114..117 - 0: IDENT@114..117 "obj" [] [] - 1: QUESTIONDOT@117..119 "?." [] [] - 2: JS_PRIVATE_NAME@119..126 - 0: HASH@119..120 "#" [] [] - 1: IDENT@120..126 "member" [] [] - 2: R_PAREN@126..127 ")" [] [] - 1: SEMICOLON@127..128 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@128..157 - 0: JS_BOGUS_EXPRESSION@128..156 - 0: DELETE_KW@128..136 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@136..156 - 0: L_PAREN@136..137 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@137..155 - 0: JS_STATIC_MEMBER_EXPRESSION@137..147 - 0: JS_IDENTIFIER_EXPRESSION@137..140 - 0: JS_REFERENCE_IDENTIFIER@137..140 - 0: IDENT@137..140 "obj" [] [] - 1: QUESTIONDOT@140..142 "?." [] [] - 2: JS_NAME@142..147 - 0: IDENT@142..147 "inner" [] [] - 1: DOT@147..148 "." [] [] - 2: JS_PRIVATE_NAME@148..155 - 0: HASH@148..149 "#" [] [] - 1: IDENT@149..155 "member" [] [] - 2: R_PAREN@155..156 ")" [] [] - 1: SEMICOLON@156..157 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@157..185 - 0: JS_BOGUS_EXPRESSION@157..184 - 0: DELETE_KW@157..165 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@165..184 - 0: L_PAREN@165..166 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@166..183 - 0: JS_STATIC_MEMBER_EXPRESSION@166..173 - 0: JS_IDENTIFIER_EXPRESSION@166..169 - 0: JS_REFERENCE_IDENTIFIER@166..169 - 0: IDENT@166..169 "obj" [] [] - 1: DOT@169..170 "." [] [] - 2: JS_NAME@170..173 - 0: IDENT@170..173 "key" [] [] - 1: COMMA@173..175 "," [] [Whitespace(" ")] - 2: JS_STATIC_MEMBER_EXPRESSION@175..183 - 0: JS_IDENTIFIER_EXPRESSION@175..178 - 0: JS_REFERENCE_IDENTIFIER@175..178 - 0: IDENT@175..178 "obj" [] [] - 1: DOT@178..179 "." [] [] - 2: JS_PRIVATE_NAME@179..183 - 0: HASH@179..180 "#" [] [] - 1: IDENT@180..183 "key" [] [] - 2: R_PAREN@183..184 ")" [] [] - 1: SEMICOLON@184..185 ";" [] [] - 4: EOF@185..186 "" [Newline("\n")] [] --- -unary_delete_parenthesized.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a single identifier - - > 1 │ delete (ident); - │ ^^^^^ - 2 │ delete ((ident)); - 3 │ delete (obj.key, ident); - --- -unary_delete_parenthesized.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a single identifier - - 1 │ delete (ident); - > 2 │ delete ((ident)); - │ ^^^^^ - 3 │ delete (obj.key, ident); - 4 │ delete (obj.#member); - --- -unary_delete_parenthesized.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a single identifier - - 1 │ delete (ident); - 2 │ delete ((ident)); - > 3 │ delete (obj.key, ident); - │ ^^^^^ - 4 │ delete (obj.#member); - 5 │ delete (func().#member); - --- -unary_delete_parenthesized.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 2 │ delete ((ident)); - 3 │ delete (obj.key, ident); - > 4 │ delete (obj.#member); - │ ^^^^^^^^^^^ - 5 │ delete (func().#member); - 6 │ delete (obj?.#member); - --- -unary_delete_parenthesized.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 3 │ delete (obj.key, ident); - 4 │ delete (obj.#member); - > 5 │ delete (func().#member); - │ ^^^^^^^^^^^^^^ - 6 │ delete (obj?.#member); - 7 │ delete (obj?.inner.#member); - --- -unary_delete_parenthesized.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 4 │ delete (obj.#member); - 5 │ delete (func().#member); - > 6 │ delete (obj?.#member); - │ ^^^^^^^^^^^^ - 7 │ delete (obj?.inner.#member); - 8 │ delete (obj.key, obj.#key); - --- -unary_delete_parenthesized.js:7:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 5 │ delete (func().#member); - 6 │ delete (obj?.#member); - > 7 │ delete (obj?.inner.#member); - │ ^^^^^^^^^^^^^^^^^^ - 8 │ delete (obj.key, obj.#key); - 9 │ - --- -unary_delete_parenthesized.js:8:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × the target for a delete operator cannot be a private member - - 6 │ delete (obj?.#member); - 7 │ delete (obj?.inner.#member); - > 8 │ delete (obj.key, obj.#key); - │ ^^^^^^^^ - 9 │ - --- -delete (ident); -delete ((ident)); -delete (obj.key, ident); -delete (obj.#member); -delete (func().#member); -delete (obj?.#member); -delete (obj?.inner.#member); -delete (obj.key, obj.#key); diff --git a/crates/biome_js_parser/test_data/inline/err/unary_expr.rast b/crates/biome_js_parser/test_data/inline/err/unary_expr.rast deleted file mode 100644 index 0fb04f6234db..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/unary_expr.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsPreUpdateExpression { - operator_token: PLUS2@0..3 "++" [] [Whitespace(" ")], - operand: missing (required), - }, - semicolon_token: SEMICOLON@3..4 ";" [] [], - }, - JsExpressionStatement { - expression: JsPreUpdateExpression { - operator_token: MINUS2@4..8 "--" [Newline("\n")] [Whitespace(" ")], - operand: missing (required), - }, - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: MINUS@9..11 "-" [Newline("\n")] [], - argument: missing (required), - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - ], - eof_token: EOF@12..13 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..13 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..12 - 0: JS_EXPRESSION_STATEMENT@0..4 - 0: JS_PRE_UPDATE_EXPRESSION@0..3 - 0: PLUS2@0..3 "++" [] [Whitespace(" ")] - 1: (empty) - 1: SEMICOLON@3..4 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@4..9 - 0: JS_PRE_UPDATE_EXPRESSION@4..8 - 0: MINUS2@4..8 "--" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 1: SEMICOLON@8..9 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@9..12 - 0: JS_UNARY_EXPRESSION@9..11 - 0: MINUS@9..11 "-" [Newline("\n")] [] - 1: (empty) - 1: SEMICOLON@11..12 ";" [] [] - 4: EOF@12..13 "" [Newline("\n")] [] --- -unary_expr.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or a member expression but instead found ';'. - - > 1 │ ++ ; - │ ^ - 2 │ -- ; - 3 │ -; - - i Expected an identifier, or a member expression here. - - > 1 │ ++ ; - │ ^ - 2 │ -- ; - 3 │ -; - --- -unary_expr.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, or a member expression but instead found ';'. - - 1 │ ++ ; - > 2 │ -- ; - │ ^ - 3 │ -; - 4 │ - - i Expected an identifier, or a member expression here. - - 1 │ ++ ; - > 2 │ -- ; - │ ^ - 3 │ -; - 4 │ - --- -++ ; --- ; --; diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_string.rast b/crates/biome_js_parser/test_data/inline/err/unterminated_string.rast deleted file mode 100644 index 7771a7192ff1..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/unterminated_string.rast +++ /dev/null @@ -1,163 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..8 "f" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], - body: JsParenthesizedExpression { - l_paren_token: L_PAREN@16..17 "(" [] [], - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - L_ANGLE@17..23 "<" [Newline("\n"), Whitespace(" ")] [], - JsxName { - value_token: JSX_IDENT@23..26 "div" [] [], - }, - JsBogus { - items: [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@26..70 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" [Newline("\n"), Whitespace(" ")] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@70..71 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@71..118 "\"a'\n bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=\"" [] [], - }, - }, - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@118..119 "b" [] [], - }, - initializer: missing (optional), - }, - JsBogus { - items: [ - ERROR_TOKEN@119..120 "\"" [] [], - ], - }, - ], - }, - SLASH@120..126 "/" [Newline("\n"), Whitespace(" ")] [], - R_ANGLE@126..127 ">" [] [], - ], - }, - ], - }, - r_paren_token: R_PAREN@127..131 ")" [Newline("\n"), Whitespace(" ")] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@131..132 ";" [] [], - }, - ], - eof_token: EOF@132..132 "" [] [], -} - -0: JS_MODULE@0..132 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..132 - 0: JS_VARIABLE_STATEMENT@0..132 - 0: JS_VARIABLE_DECLARATION@0..131 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..131 - 0: JS_VARIABLE_DECLARATOR@6..131 - 0: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "f" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..131 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@10..131 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] - 5: JS_PARENTHESIZED_EXPRESSION@16..131 - 0: L_PAREN@16..17 "(" [] [] - 1: JS_BOGUS_EXPRESSION@17..127 - 0: JS_BOGUS@17..127 - 0: L_ANGLE@17..23 "<" [Newline("\n"), Whitespace(" ")] [] - 1: JSX_NAME@23..26 - 0: JSX_IDENT@23..26 "div" [] [] - 2: JS_BOGUS@26..120 - 0: JSX_ATTRIBUTE@26..118 - 0: JSX_NAME@26..70 - 0: JSX_IDENT@26..70 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" [Newline("\n"), Whitespace(" ")] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@70..118 - 0: EQ@70..71 "=" [] [] - 1: JSX_STRING@71..118 - 0: JSX_STRING_LITERAL@71..118 "\"a'\n bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=\"" [] [] - 1: JSX_ATTRIBUTE@118..119 - 0: JSX_NAME@118..119 - 0: JSX_IDENT@118..119 "b" [] [] - 1: (empty) - 2: JS_BOGUS@119..120 - 0: ERROR_TOKEN@119..120 "\"" [] [] - 3: SLASH@120..126 "/" [Newline("\n"), Whitespace(" ")] [] - 4: R_ANGLE@126..127 ">" [] [] - 2: R_PAREN@127..131 ")" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@131..132 ";" [] [] - 4: EOF@132..132 "" [] [] --- -unterminated_string.jsx:4:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × unterminated string literal - - 2 │
- 6 │ ); - - i - - 2 │
- 6 │ ); - - i The closing quote must be on the same line. - --- -const f = () => ( -
- ); \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast b/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast deleted file mode 100644 index 5104047b1c82..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsBogus { - items: [ - LET_KW@0..4 "let" [] [Whitespace(" ")], - JsBogus { - items: [ - JsBogus { - items: [ - JsIdentifierBinding { - name_token: IDENT@4..6 "s" [] [Whitespace(" ")], - }, - JsBogus { - items: [ - EQ@6..8 "=" [] [Whitespace(" ")], - JsBogus { - items: [ - ERROR_TOKEN@8..16 "\"\\u{200\"" [] [], - ], - }, - ], - }, - ], - }, - ], - }, - ], - }, - SEMICOLON@16..17 ";" [] [], - ], - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: JS_BOGUS_STATEMENT@0..17 - 0: JS_BOGUS@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_BOGUS@4..16 - 0: JS_BOGUS@4..16 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "s" [] [Whitespace(" ")] - 1: JS_BOGUS@6..16 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_BOGUS@8..16 - 0: ERROR_TOKEN@8..16 "\"\\u{200\"" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 4: EOF@17..18 "" [Newline("\n")] [] --- -unterminated_unicode_codepoint.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected hex digits for a unicode code point escape, but encountered an invalid character - - > 1 │ let s = "\u{200"; - │ ^ - 2 │ - --- -let s = "\u{200"; diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast b/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast deleted file mode 100644 index 3021960adfa3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast +++ /dev/null @@ -1,142 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForInStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: USING_KW@5..11 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@11..13 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - in_token: IN_KW@13..16 "in" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "y" [] [], - }, - }, - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@19..20 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsForInStatement { - for_token: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@27..28 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: AWAIT_KW@28..34 "await" [] [Whitespace(" ")], - kind_token: USING_KW@34..40 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@40..42 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - in_token: IN_KW@42..45 "in" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..46 "y" [] [], - }, - }, - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@48..49 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@49..50 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - ], - eof_token: EOF@51..52 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..52 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..51 - 0: JS_FOR_IN_STATEMENT@0..21 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@5..13 - 0: (empty) - 1: USING_KW@5..11 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@11..13 - 0: JS_IDENTIFIER_BINDING@11..13 - 0: IDENT@11..13 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: IN_KW@13..16 "in" [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "y" [] [] - 5: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@19..21 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_STATEMENT_LIST@20..20 - 2: R_CURLY@20..21 "}" [] [] - 1: JS_EMPTY_STATEMENT@21..22 - 0: SEMICOLON@21..22 ";" [] [] - 2: JS_FOR_IN_STATEMENT@22..50 - 0: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@27..28 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@28..42 - 0: AWAIT_KW@28..34 "await" [] [Whitespace(" ")] - 1: USING_KW@34..40 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@40..42 - 0: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: IN_KW@42..45 "in" [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@45..46 - 0: JS_REFERENCE_IDENTIFIER@45..46 - 0: IDENT@45..46 "y" [] [] - 5: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@48..50 - 0: L_CURLY@48..49 "{" [] [] - 1: JS_STATEMENT_LIST@49..49 - 2: R_CURLY@49..50 "}" [] [] - 3: JS_EMPTY_STATEMENT@50..51 - 0: SEMICOLON@50..51 ";" [] [] - 4: EOF@51..52 "" [Newline("\n")] [] --- -using_declaration_not_allowed_in_for_in_statement.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × The left-hand side of a 'for...in' statement cannot be a 'using' declaration - - > 1 │ for (using x in y) {}; - │ ^ - 2 │ for (await using x in y) {}; - 3 │ - --- -using_declaration_not_allowed_in_for_in_statement.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × The left-hand side of a 'for...in' statement cannot be a 'using' declaration - - 1 │ for (using x in y) {}; - > 2 │ for (await using x in y) {}; - │ ^ - 3 │ - --- -for (using x in y) {}; -for (await using x in y) {}; diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.rast b/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.rast deleted file mode 100644 index 402913d30174..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.rast +++ /dev/null @@ -1,649 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@0..6 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..7 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@7..8 ";" [] [], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..15 "using" [Newline("\n")] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@15..16 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "b" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@17..18 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@19..26 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@26..28 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..31 "d" [] [], - }, - }, - }, - }, - COMMA@31..33 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@33..34 "e" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@35..43 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: missing (required), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@43..49 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@49..51 "m" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@51..53 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..54 "n" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@54..55 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: AWAIT_KW@55..62 "await" [Newline("\n")] [Whitespace(" ")], - kind: USING_KW@62..68 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@68..69 "f" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: AWAIT_KW@70..77 "await" [Newline("\n")] [Whitespace(" ")], - kind: USING_KW@77..83 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@83..85 "g" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@85..87 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@87..88 "h" [] [], - }, - }, - }, - }, - COMMA@88..90 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@90..91 "j" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@91..92 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsBogusAssignment { - items: [ - AWAIT_KW@92..99 "await" [Newline("\n")] [Whitespace(" ")], - JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@99..105 "using" [] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@105..106 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@106..107 "o" [] [], - }, - }, - r_brack_token: R_BRACK@107..109 "]" [] [Whitespace(" ")], - }, - ], - }, - operator_token: EQ@109..111 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@111..112 "p" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@112..113 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@113..121 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: missing (required), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: AWAIT_KW@121..127 "await" [] [Whitespace(" ")], - kind: USING_KW@127..133 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@133..135 "q" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@135..137 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..138 "r" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@138..139 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")], - argument: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@146..150 "let" [] [Whitespace(" ")], - ], - }, - ], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@150..151 "s" [] [], - }, - }, - semicolon_token: SEMICOLON@151..152 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@152..159 "await" [Newline("\n")] [Whitespace(" ")], - argument: missing (required), - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@159..165 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@165..167 "t" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@167..169 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@169..170 "1" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@170..171 ";" [] [], - }, - ], - eof_token: EOF@171..172 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..172 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..171 - 0: JS_VARIABLE_STATEMENT@0..8 - 0: JS_VARIABLE_DECLARATION@0..7 - 0: (empty) - 1: USING_KW@0..6 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..7 - 0: JS_VARIABLE_DECLARATOR@6..7 - 0: JS_IDENTIFIER_BINDING@6..7 - 0: IDENT@6..7 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@7..8 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@8..15 - 0: JS_IDENTIFIER_EXPRESSION@8..15 - 0: JS_REFERENCE_IDENTIFIER@8..15 - 0: IDENT@8..15 "using" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_BLOCK_STATEMENT@15..18 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_STATEMENT_LIST@16..17 - 0: JS_EXPRESSION_STATEMENT@16..17 - 0: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "b" [] [] - 1: (empty) - 2: R_CURLY@17..18 "}" [] [] - 3: JS_EMPTY_STATEMENT@18..19 - 0: SEMICOLON@18..19 ";" [] [] - 4: JS_VARIABLE_STATEMENT@19..35 - 0: JS_VARIABLE_DECLARATION@19..34 - 0: (empty) - 1: USING_KW@19..26 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@26..34 - 0: JS_VARIABLE_DECLARATOR@26..31 - 0: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@28..31 - 0: EQ@28..30 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@30..31 - 0: JS_REFERENCE_IDENTIFIER@30..31 - 0: IDENT@30..31 "d" [] [] - 1: COMMA@31..33 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@33..34 - 0: JS_IDENTIFIER_BINDING@33..34 - 0: IDENT@33..34 "e" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@34..35 ";" [] [] - 5: JS_EXPORT@35..43 - 0: JS_DECORATOR_LIST@35..35 - 1: EXPORT_KW@35..43 "export" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 6: JS_VARIABLE_STATEMENT@43..55 - 0: JS_VARIABLE_DECLARATION@43..54 - 0: (empty) - 1: USING_KW@43..49 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@49..54 - 0: JS_VARIABLE_DECLARATOR@49..54 - 0: JS_IDENTIFIER_BINDING@49..51 - 0: IDENT@49..51 "m" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@51..54 - 0: EQ@51..53 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@53..54 - 0: JS_REFERENCE_IDENTIFIER@53..54 - 0: IDENT@53..54 "n" [] [] - 1: SEMICOLON@54..55 ";" [] [] - 7: JS_VARIABLE_STATEMENT@55..70 - 0: JS_VARIABLE_DECLARATION@55..69 - 0: AWAIT_KW@55..62 "await" [Newline("\n")] [Whitespace(" ")] - 1: USING_KW@62..68 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@68..69 - 0: JS_VARIABLE_DECLARATOR@68..69 - 0: JS_IDENTIFIER_BINDING@68..69 - 0: IDENT@68..69 "f" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@69..70 ";" [] [] - 8: JS_VARIABLE_STATEMENT@70..92 - 0: JS_VARIABLE_DECLARATION@70..91 - 0: AWAIT_KW@70..77 "await" [Newline("\n")] [Whitespace(" ")] - 1: USING_KW@77..83 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@83..91 - 0: JS_VARIABLE_DECLARATOR@83..88 - 0: JS_IDENTIFIER_BINDING@83..85 - 0: IDENT@83..85 "g" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@85..88 - 0: EQ@85..87 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@87..88 - 0: JS_REFERENCE_IDENTIFIER@87..88 - 0: IDENT@87..88 "h" [] [] - 1: COMMA@88..90 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@90..91 - 0: JS_IDENTIFIER_BINDING@90..91 - 0: IDENT@90..91 "j" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@91..92 ";" [] [] - 9: JS_EXPRESSION_STATEMENT@92..113 - 0: JS_ASSIGNMENT_EXPRESSION@92..112 - 0: JS_BOGUS_ASSIGNMENT@92..109 - 0: AWAIT_KW@92..99 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@99..109 - 0: JS_IDENTIFIER_EXPRESSION@99..105 - 0: JS_REFERENCE_IDENTIFIER@99..105 - 0: IDENT@99..105 "using" [] [Whitespace(" ")] - 1: (empty) - 2: L_BRACK@105..106 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@106..107 - 0: JS_REFERENCE_IDENTIFIER@106..107 - 0: IDENT@106..107 "o" [] [] - 4: R_BRACK@107..109 "]" [] [Whitespace(" ")] - 1: EQ@109..111 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@111..112 - 0: JS_REFERENCE_IDENTIFIER@111..112 - 0: IDENT@111..112 "p" [] [] - 1: SEMICOLON@112..113 ";" [] [] - 10: JS_EXPORT@113..121 - 0: JS_DECORATOR_LIST@113..113 - 1: EXPORT_KW@113..121 "export" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 11: JS_VARIABLE_STATEMENT@121..139 - 0: JS_VARIABLE_DECLARATION@121..138 - 0: AWAIT_KW@121..127 "await" [] [Whitespace(" ")] - 1: USING_KW@127..133 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@133..138 - 0: JS_VARIABLE_DECLARATOR@133..138 - 0: JS_IDENTIFIER_BINDING@133..135 - 0: IDENT@133..135 "q" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@135..138 - 0: EQ@135..137 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@137..138 - 0: JS_REFERENCE_IDENTIFIER@137..138 - 0: IDENT@137..138 "r" [] [] - 1: SEMICOLON@138..139 ";" [] [] - 12: JS_EXPRESSION_STATEMENT@139..150 - 0: JS_AWAIT_EXPRESSION@139..150 - 0: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@146..150 - 0: JS_BOGUS@146..150 - 0: IDENT@146..150 "let" [] [Whitespace(" ")] - 1: (empty) - 13: JS_EXPRESSION_STATEMENT@150..152 - 0: JS_IDENTIFIER_EXPRESSION@150..151 - 0: JS_REFERENCE_IDENTIFIER@150..151 - 0: IDENT@150..151 "s" [] [] - 1: SEMICOLON@151..152 ";" [] [] - 14: JS_EXPRESSION_STATEMENT@152..159 - 0: JS_AWAIT_EXPRESSION@152..159 - 0: AWAIT_KW@152..159 "await" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 1: (empty) - 15: JS_VARIABLE_STATEMENT@159..171 - 0: JS_VARIABLE_DECLARATION@159..170 - 0: (empty) - 1: CONST_KW@159..165 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@165..170 - 0: JS_VARIABLE_DECLARATOR@165..170 - 0: JS_IDENTIFIER_BINDING@165..167 - 0: IDENT@165..167 "t" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@167..170 - 0: EQ@167..169 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@169..170 - 0: JS_NUMBER_LITERAL@169..170 "1" [] [] - 1: SEMICOLON@170..171 ";" [] [] - 4: EOF@171..172 "" [Newline("\n")] [] --- -using_declaration_statement_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - > 1 │ using a; - │ ^ - 2 │ using {b}; - 3 │ using c = d, e; - - i This variable needs to be initialized. - --- -using_declaration_statement_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ using a; - > 2 │ using {b}; - │ ^ - 3 │ using c = d, e; - 4 │ export using m = n; - - i An explicit or implicit semicolon is expected here... - - 1 │ using a; - > 2 │ using {b}; - │ ^ - 3 │ using c = d, e; - 4 │ export using m = n; - - i ...Which is required to end this statement - - 1 │ using a; - > 2 │ using {b}; - │ ^^^^^^^ - 3 │ using c = d, e; - 4 │ export using m = n; - --- -using_declaration_statement_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - 1 │ using a; - 2 │ using {b}; - > 3 │ using c = d, e; - │ ^ - 4 │ export using m = n; - 5 │ await using f; - - i This variable needs to be initialized. - --- -using_declaration_statement_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found 'using'. - - 2 │ using {b}; - 3 │ using c = d, e; - > 4 │ export using m = n; - │ ^^^^^ - 5 │ await using f; - 6 │ await using g = h, j; - - i Expected a class, a function, or a variable declaration here. - - 2 │ using {b}; - 3 │ using c = d, e; - > 4 │ export using m = n; - │ ^^^^^ - 5 │ await using f; - 6 │ await using g = h, j; - --- -using_declaration_statement_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - 3 │ using c = d, e; - 4 │ export using m = n; - > 5 │ await using f; - │ ^ - 6 │ await using g = h, j; - 7 │ await using [o] = p; - - i This variable needs to be initialized. - --- -using_declaration_statement_err.js:6:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Using declarations must have an initialized value. - - 4 │ export using m = n; - 5 │ await using f; - > 6 │ await using g = h, j; - │ ^ - 7 │ await using [o] = p; - 8 │ export await using q = r; - - i This variable needs to be initialized. - --- -using_declaration_statement_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Invalid assignment to `await using [o]` - - 5 │ await using f; - 6 │ await using g = h, j; - > 7 │ await using [o] = p; - │ ^^^^^^^^^^^^^^^ - 8 │ export await using q = r; - 9 │ await let s; - - i This expression cannot be assigned to - --- -using_declaration_statement_err.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a class, a function, or a variable declaration but instead found 'await'. - - 6 │ await using g = h, j; - 7 │ await using [o] = p; - > 8 │ export await using q = r; - │ ^^^^^ - 9 │ await let s; - 10 │ await const t = 1; - - i Expected a class, a function, or a variable declaration here. - - 6 │ await using g = h, j; - 7 │ await using [o] = p; - > 8 │ export await using q = r; - │ ^^^^^ - 9 │ await let s; - 10 │ await const t = 1; - --- -using_declaration_statement_err.js:9:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `let` as an identifier in strict mode - - 7 │ await using [o] = p; - 8 │ export await using q = r; - > 9 │ await let s; - │ ^^^ - 10 │ await const t = 1; - 11 │ - --- -using_declaration_statement_err.js:9:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 7 │ await using [o] = p; - 8 │ export await using q = r; - > 9 │ await let s; - │ ^ - 10 │ await const t = 1; - 11 │ - - i An explicit or implicit semicolon is expected here... - - 7 │ await using [o] = p; - 8 │ export await using q = r; - > 9 │ await let s; - │ ^ - 10 │ await const t = 1; - 11 │ - - i ...Which is required to end this statement - - 7 │ await using [o] = p; - 8 │ export await using q = r; - > 9 │ await let s; - │ ^^^^^^^^^^^ - 10 │ await const t = 1; - 11 │ - --- -using_declaration_statement_err.js:10:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an unary expression but instead found 'const'. - - 8 │ export await using q = r; - 9 │ await let s; - > 10 │ await const t = 1; - │ ^^^^^ - 11 │ - - i Expected an unary expression here. - - 8 │ export await using q = r; - 9 │ await let s; - > 10 │ await const t = 1; - │ ^^^^^ - 11 │ - --- -using a; -using {b}; -using c = d, e; -export using m = n; -await using f; -await using g = h, j; -await using [o] = p; -export await using q = r; -await let s; -await const t = 1; diff --git a/crates/biome_js_parser/test_data/inline/err/var_decl_err.rast b/crates/biome_js_parser/test_data/inline/err/var_decl_err.rast deleted file mode 100644 index 50b441f03e8d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/var_decl_err.rast +++ /dev/null @@ -1,161 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..7 "=" [] [], - expression: missing (required), - }, - }, - ], - }, - semicolon_token: SEMICOLON@7..8 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@8..15 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@15..17 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@17..19 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@19..21 "5" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@21..25 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@25..27 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@27..29 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@29..30 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - ], - eof_token: EOF@31..32 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..32 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..31 - 0: JS_VARIABLE_STATEMENT@0..8 - 0: JS_VARIABLE_DECLARATION@0..7 - 0: (empty) - 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..7 - 0: JS_VARIABLE_DECLARATOR@4..7 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..7 - 0: EQ@6..7 "=" [] [] - 1: (empty) - 1: SEMICOLON@7..8 ";" [] [] - 1: JS_VARIABLE_STATEMENT@8..21 - 0: JS_VARIABLE_DECLARATION@8..21 - 0: (empty) - 1: CONST_KW@8..15 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@15..21 - 0: JS_VARIABLE_DECLARATOR@15..21 - 0: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@17..21 - 0: EQ@17..19 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@19..21 - 0: JS_NUMBER_LITERAL@19..21 "5" [] [Whitespace(" ")] - 1: (empty) - 2: JS_VARIABLE_STATEMENT@21..31 - 0: JS_VARIABLE_DECLARATION@21..30 - 0: (empty) - 1: LET_KW@21..25 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@25..30 - 0: JS_VARIABLE_DECLARATOR@25..30 - 0: JS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@27..30 - 0: EQ@27..29 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@29..30 - 0: JS_NUMBER_LITERAL@29..30 "5" [] [] - 1: SEMICOLON@30..31 ";" [] [] - 4: EOF@31..32 "" [Newline("\n")] [] --- -var_decl_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an expression, or an assignment but instead found ';'. - - > 1 │ var a =; - │ ^ - 2 │ const b = 5 let c = 5; - 3 │ - - i Expected an expression, or an assignment here. - - > 1 │ var a =; - │ ^ - 2 │ const b = 5 let c = 5; - 3 │ - --- -var_decl_err.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a semicolon or an implicit semicolon after a statement, but found none - - 1 │ var a =; - > 2 │ const b = 5 let c = 5; - │ ^^^ - 3 │ - - i An explicit or implicit semicolon is expected here... - - 1 │ var a =; - > 2 │ const b = 5 let c = 5; - │ ^^^ - 3 │ - - i ...Which is required to end this statement - - 1 │ var a =; - > 2 │ const b = 5 let c = 5; - │ ^^^^^^^^^^^^ - 3 │ - --- -var a =; -const b = 5 let c = 5; diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast b/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast deleted file mode 100644 index f6d6a95b5547..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast +++ /dev/null @@ -1,349 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@5..7 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@9..11 "b" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@13..15 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@17..18 "a" [] [], - }, - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - value: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@20..23 "10" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@31..33 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@33..35 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@35..36 "1" [] [], - }, - }, - }, - COMMA@36..38 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@40..42 "d" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@44..46 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@48..49 "a" [] [], - }, - colon_token: COLON@49..51 ":" [] [Whitespace(" ")], - value: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@51..54 "10" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@62..63 "e" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@69..70 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@70..71 "f" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@71..72 "]" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@72..73 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@82..84 "g" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@84..85 "}" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@85..86 ";" [] [], - }, - ], - eof_token: EOF@86..87 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..87 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..86 - 0: JS_VARIABLE_STATEMENT@0..24 - 0: JS_VARIABLE_DECLARATION@0..24 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..24 - 0: JS_VARIABLE_DECLARATOR@4..5 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@5..7 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@7..24 - 0: JS_OBJECT_BINDING_PATTERN@7..13 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@9..11 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@9..11 - 0: JS_IDENTIFIER_BINDING@9..11 - 0: IDENT@9..11 "b" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@13..24 - 0: EQ@13..15 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@15..24 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@17..23 - 0: JS_PROPERTY_OBJECT_MEMBER@17..23 - 0: JS_LITERAL_MEMBER_NAME@17..18 - 0: IDENT@17..18 "a" [] [] - 1: COLON@18..20 ":" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@20..23 - 0: JS_NUMBER_LITERAL@20..23 "10" [] [Whitespace(" ")] - 2: R_CURLY@23..24 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@24..55 - 0: JS_VARIABLE_DECLARATION@24..55 - 0: (empty) - 1: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@31..55 - 0: JS_VARIABLE_DECLARATOR@31..36 - 0: JS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@33..36 - 0: EQ@33..35 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@35..36 - 0: JS_NUMBER_LITERAL@35..36 "1" [] [] - 1: COMMA@36..38 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@38..55 - 0: JS_OBJECT_BINDING_PATTERN@38..44 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@40..42 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@40..42 - 0: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "d" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@42..44 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@44..55 - 0: EQ@44..46 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@46..55 - 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@48..54 - 0: JS_PROPERTY_OBJECT_MEMBER@48..54 - 0: JS_LITERAL_MEMBER_NAME@48..49 - 0: IDENT@48..49 "a" [] [] - 1: COLON@49..51 ":" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@51..54 - 0: JS_NUMBER_LITERAL@51..54 "10" [] [Whitespace(" ")] - 2: R_CURLY@54..55 "}" [] [] - 1: (empty) - 2: JS_VARIABLE_STATEMENT@55..64 - 0: JS_VARIABLE_DECLARATION@55..63 - 0: (empty) - 1: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@62..63 - 0: JS_VARIABLE_DECLARATOR@62..63 - 0: JS_IDENTIFIER_BINDING@62..63 - 0: IDENT@62..63 "e" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@63..64 ";" [] [] - 3: JS_VARIABLE_STATEMENT@64..73 - 0: JS_VARIABLE_DECLARATION@64..72 - 0: (empty) - 1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@69..72 - 0: JS_VARIABLE_DECLARATOR@69..72 - 0: JS_ARRAY_BINDING_PATTERN@69..72 - 0: L_BRACK@69..70 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@70..71 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@70..71 - 0: JS_IDENTIFIER_BINDING@70..71 - 0: IDENT@70..71 "f" [] [] - 1: (empty) - 2: R_BRACK@71..72 "]" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@72..73 ";" [] [] - 4: JS_VARIABLE_STATEMENT@73..86 - 0: JS_VARIABLE_DECLARATION@73..85 - 0: (empty) - 1: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@80..85 - 0: JS_VARIABLE_DECLARATOR@80..85 - 0: JS_OBJECT_BINDING_PATTERN@80..85 - 0: L_CURLY@80..82 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@82..84 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@82..84 - 0: JS_IDENTIFIER_BINDING@82..84 - 0: IDENT@82..84 "g" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@84..85 "}" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@85..86 ";" [] [] - 4: EOF@86..87 "" [Newline("\n")] [] --- -variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Const declarations must have an initialized value. - - 1 │ let a, { b } = { a: 10 } - 2 │ const c = 1, { d } = { a: 10 } - > 3 │ const e; - │ ^ - 4 │ let [f]; - 5 │ const { g }; - - i This variable needs to be initialized. - --- -variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Object and Array patterns require initializers. - - 2 │ const c = 1, { d } = { a: 10 } - 3 │ const e; - > 4 │ let [f]; - │ ^^^ - 5 │ const { g }; - 6 │ - - i This pattern is declared, but it is not given an initialized value. - --- -variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Object and Array patterns require initializers. - - 3 │ const e; - 4 │ let [f]; - > 5 │ const { g }; - │ ^^^^^ - 6 │ - - i This pattern is declared, but it is not given an initialized value. - --- -let a, { b } = { a: 10 } -const c = 1, { d } = { a: 10 } -const e; -let [f]; -const { g }; diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast b/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast deleted file mode 100644 index 76aecae0c680..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast +++ /dev/null @@ -1,86 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBogusStatement { - items: [ - JsBogus { - items: [ - CONST_KW@0..5 "const" [] [], - JsBogus { - items: [], - }, - ], - }, - SEMICOLON@5..6 ";" [] [], - ], - }, - JsBogusStatement { - items: [ - JsBogus { - items: [ - CONST_KW@6..12 "const" [Newline("\n")] [], - JsBogus { - items: [], - }, - ], - }, - ], - }, - ], - eof_token: EOF@12..13 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..13 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..12 - 0: JS_BOGUS_STATEMENT@0..6 - 0: JS_BOGUS@0..5 - 0: CONST_KW@0..5 "const" [] [] - 1: JS_BOGUS@5..5 - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_BOGUS_STATEMENT@6..12 - 0: JS_BOGUS@6..12 - 0: CONST_KW@6..12 "const" [Newline("\n")] [] - 1: JS_BOGUS@12..12 - 4: EOF@12..13 "" [Newline("\n")] [] --- -variable_declarator_list_empty.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found ';'. - - > 1 │ const; - │ ^ - 2 │ const - 3 │ - - i Expected an identifier, an array pattern, or an object pattern here. - - > 1 │ const; - │ ^ - 2 │ const - 3 │ - --- -variable_declarator_list_empty.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found the end of the file. - - 1 │ const; - 2 │ const - > 3 │ - │ - - i Expected an identifier, an array pattern, or an object pattern here. - - 1 │ const; - 2 │ const - > 3 │ - │ - --- -const; -const diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast b/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast deleted file mode 100644 index a20e74c9b0be..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast +++ /dev/null @@ -1,71 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..8 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@10..11 "1" [] [], - }, - }, - }, - COMMA@11..12 "," [] [], - missing element, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@12..13 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..13 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..12 - 0: JS_VARIABLE_STATEMENT@0..12 - 0: JS_VARIABLE_DECLARATION@0..12 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..12 - 0: JS_VARIABLE_DECLARATOR@6..11 - 0: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..11 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@10..11 - 0: JS_NUMBER_LITERAL@10..11 "1" [] [] - 1: COMMA@11..12 "," [] [] - 2: (empty) - 1: (empty) - 4: EOF@12..13 "" [Newline("\n")] [] --- -variable_declarator_list_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected an identifier, an array pattern, or an object pattern but instead found the end of the file. - - 1 │ const a = 1, - > 2 │ - │ - - i Expected an identifier, an array pattern, or an object pattern here. - - 1 │ const a = 1, - > 2 │ - │ - --- -const a = 1, diff --git a/crates/biome_js_parser/test_data/inline/err/while_stmt_err.rast b/crates/biome_js_parser/test_data/inline/err/while_stmt_err.rast deleted file mode 100644 index 296823ef27af..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/while_stmt_err.rast +++ /dev/null @@ -1,192 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsWhileStatement { - while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], - l_paren_token: missing (required), - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@6..11 "true" [] [Whitespace(" ")], - }, - r_paren_token: missing (required), - body: JsBlockStatement { - l_curly_token: L_CURLY@11..12 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@12..13 "}" [] [], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@13..20 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - test: missing (required), - r_paren_token: missing (required), - body: JsBlockStatement { - l_curly_token: L_CURLY@20..21 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@22..29 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@29..30 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@30..35 "true" [] [Whitespace(" ")], - }, - r_paren_token: missing (required), - body: JsBlockStatement { - l_curly_token: L_CURLY@35..36 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@37..44 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: missing (required), - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@44..48 "true" [] [], - }, - r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], - body: missing (required), - }, - JsBogusStatement { - items: [ - R_CURLY@50..51 "}" [] [], - ], - }, - ], - eof_token: EOF@51..52 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..52 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..51 - 0: JS_WHILE_STATEMENT@0..13 - 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BOOLEAN_LITERAL_EXPRESSION@6..11 - 0: TRUE_KW@6..11 "true" [] [Whitespace(" ")] - 3: (empty) - 4: JS_BLOCK_STATEMENT@11..13 - 0: L_CURLY@11..12 "{" [] [] - 1: JS_STATEMENT_LIST@12..12 - 2: R_CURLY@12..13 "}" [] [] - 1: JS_WHILE_STATEMENT@13..22 - 0: WHILE_KW@13..20 "while" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: (empty) - 4: JS_BLOCK_STATEMENT@20..22 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_STATEMENT_LIST@21..21 - 2: R_CURLY@21..22 "}" [] [] - 2: JS_WHILE_STATEMENT@22..37 - 0: WHILE_KW@22..29 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@29..30 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@30..35 - 0: TRUE_KW@30..35 "true" [] [Whitespace(" ")] - 3: (empty) - 4: JS_BLOCK_STATEMENT@35..37 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_STATEMENT_LIST@36..36 - 2: R_CURLY@36..37 "}" [] [] - 3: JS_WHILE_STATEMENT@37..50 - 0: WHILE_KW@37..44 "while" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_BOOLEAN_LITERAL_EXPRESSION@44..48 - 0: TRUE_KW@44..48 "true" [] [] - 3: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 4: (empty) - 4: JS_BOGUS_STATEMENT@50..51 - 0: R_CURLY@50..51 "}" [] [] - 4: EOF@51..52 "" [Newline("\n")] [] --- -while_stmt_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `true` - - > 1 │ while true {} - │ ^^^^ - 2 │ while {} - 3 │ while (true {} - - i Remove true - --- -while_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `{` - - > 1 │ while true {} - │ ^ - 2 │ while {} - 3 │ while (true {} - - i Remove { - --- -while_stmt_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `{` - - 1 │ while true {} - > 2 │ while {} - │ ^ - 3 │ while (true {} - 4 │ while true) } - - i Remove { - --- -while_stmt_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `)` but instead found `{` - - 1 │ while true {} - 2 │ while {} - > 3 │ while (true {} - │ ^ - 4 │ while true) } - 5 │ - - i Remove { - --- -while_stmt_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `(` but instead found `true` - - 2 │ while {} - 3 │ while (true {} - > 4 │ while true) } - │ ^^^^ - 5 │ - - i Remove true - --- -while_stmt_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Expected a statement but instead found '}'. - - 2 │ while {} - 3 │ while (true {} - > 4 │ while true) } - │ ^ - 5 │ - - i Expected a statement here. - - 2 │ while {} - 3 │ while (true {} - > 4 │ while true) } - │ ^ - 5 │ - --- -while true {} -while {} -while (true {} -while true) } diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.rast b/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.rast deleted file mode 100644 index 2edcbc367553..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.rast +++ /dev/null @@ -1,48 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@0..6 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@6..8 "10" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_EXPRESSION_STATEMENT@0..9 - 0: JS_BOGUS_EXPRESSION@0..8 - 0: YIELD_KW@0..6 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@6..8 - 0: (empty) - 1: JS_NUMBER_LITERAL_EXPRESSION@6..8 - 0: JS_NUMBER_LITERAL@6..8 "10" [] [] - 1: SEMICOLON@8..9 ";" [] [] - 4: EOF@9..10 "" [Newline("\n")] [] --- -yield_at_top_level_module.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - > 1 │ yield 10; - │ ^^^^^ - 2 │ - --- -yield 10; diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.rast b/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.rast deleted file mode 100644 index d58b96ce7cfa..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.rast +++ /dev/null @@ -1,50 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@16..18 "10" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - ], - eof_token: EOF@19..20 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..20 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..19 - 0: JS_EXPRESSION_STATEMENT@0..19 - 0: JS_BOGUS_EXPRESSION@0..18 - 0: YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@16..18 - 0: (empty) - 1: JS_NUMBER_LITERAL_EXPRESSION@16..18 - 0: JS_NUMBER_LITERAL@16..18 "10" [] [] - 1: SEMICOLON@18..19 ";" [] [] - 4: EOF@19..20 "" [Newline("\n")] [] --- -yield_at_top_level_script.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 1 │ // SCRIPT - > 2 │ yield 10; - │ ^^^^^ - 3 │ - --- -// SCRIPT -yield 10; diff --git a/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast b/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast deleted file mode 100644 index 74eba4688b08..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast +++ /dev/null @@ -1,188 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..8 "function" [] [], - star_token: STAR@8..10 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@10..14 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@14..15 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@15..17 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@17..19 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - YIELD_KW@19..25 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@25..31 "\"test\"" [] [], - }, - }, - ], - }, - }, - }, - ], - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@33..34 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@35..45 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@45..50 "test2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@50..51 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@51..53 "a" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@53..55 "=" [] [Whitespace(" ")], - expression: JsBogusExpression { - items: [ - YIELD_KW@55..61 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@61..67 "\"test\"" [] [], - }, - }, - ], - }, - }, - }, - ], - r_paren_token: R_PAREN@67..69 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@69..70 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@70..71 "}" [] [], - }, - }, - ], - eof_token: EOF@71..72 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..72 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..71 - 0: JS_FUNCTION_DECLARATION@0..35 - 0: (empty) - 1: FUNCTION_KW@0..8 "function" [] [] - 2: STAR@8..10 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@10..14 - 0: IDENT@10..14 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@14..33 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_PARAMETER_LIST@15..31 - 0: JS_FORMAL_PARAMETER@15..31 - 0: JS_DECORATOR_LIST@15..15 - 1: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@17..31 - 0: EQ@17..19 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@19..31 - 0: YIELD_KW@19..25 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@25..31 - 0: (empty) - 1: JS_STRING_LITERAL_EXPRESSION@25..31 - 0: JS_STRING_LITERAL@25..31 "\"test\"" [] [] - 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@33..35 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_DIRECTIVE_LIST@34..34 - 2: JS_STATEMENT_LIST@34..34 - 3: R_CURLY@34..35 "}" [] [] - 1: JS_FUNCTION_DECLARATION@35..71 - 0: (empty) - 1: FUNCTION_KW@35..45 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@45..50 - 0: IDENT@45..50 "test2" [] [] - 4: (empty) - 5: JS_PARAMETERS@50..69 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_PARAMETER_LIST@51..67 - 0: JS_FORMAL_PARAMETER@51..67 - 0: JS_DECORATOR_LIST@51..51 - 1: JS_IDENTIFIER_BINDING@51..53 - 0: IDENT@51..53 "a" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@53..67 - 0: EQ@53..55 "=" [] [Whitespace(" ")] - 1: JS_BOGUS_EXPRESSION@55..67 - 0: YIELD_KW@55..61 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@61..67 - 0: (empty) - 1: JS_STRING_LITERAL_EXPRESSION@61..67 - 0: JS_STRING_LITERAL@61..67 "\"test\"" [] [] - 2: R_PAREN@67..69 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@69..71 - 0: L_CURLY@69..70 "{" [] [] - 1: JS_DIRECTIVE_LIST@70..70 - 2: JS_STATEMENT_LIST@70..70 - 3: R_CURLY@70..71 "}" [] [] - 4: EOF@71..72 "" [Newline("\n")] [] --- -yield_expr_in_parameter_initializer.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - > 1 │ function* test(a = yield "test") {} - │ ^^^^^ - 2 │ function test2(a = yield "test") {} - 3 │ - --- -yield_expr_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 1 │ function* test(a = yield "test") {} - > 2 │ function test2(a = yield "test") {} - │ ^^^^^ - 3 │ - --- -function* test(a = yield "test") {} -function test2(a = yield "test") {} diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.rast b/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.rast deleted file mode 100644 index 9a8084111015..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.rast +++ /dev/null @@ -1,163 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@17..23 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..26 "bar" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@39..42 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@42..43 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@47..53 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@53..55 "10" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - }, - ], - eof_token: EOF@58..59 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..59 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..58 - 0: JS_FUNCTION_DECLARATION@0..29 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..29 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..28 - 0: JS_EXPRESSION_STATEMENT@17..28 - 0: JS_BOGUS_EXPRESSION@17..26 - 0: YIELD_KW@17..23 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@23..26 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@23..26 - 0: JS_REFERENCE_IDENTIFIER@23..26 - 0: IDENT@23..26 "bar" [] [] - 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] - 3: R_CURLY@28..29 "}" [] [] - 1: JS_FUNCTION_DECLARATION@29..58 - 0: (empty) - 1: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@39..42 - 0: IDENT@39..42 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@42..45 - 0: L_PAREN@42..43 "(" [] [] - 1: JS_PARAMETER_LIST@43..43 - 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@45..58 - 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@47..47 - 2: JS_STATEMENT_LIST@47..57 - 0: JS_EXPRESSION_STATEMENT@47..57 - 0: JS_BOGUS_EXPRESSION@47..55 - 0: YIELD_KW@47..53 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@53..55 - 0: (empty) - 1: JS_NUMBER_LITERAL_EXPRESSION@53..55 - 0: JS_NUMBER_LITERAL@53..55 "10" [] [] - 1: SEMICOLON@55..57 ";" [] [Whitespace(" ")] - 3: R_CURLY@57..58 "}" [] [] - 4: EOF@58..59 "" [Newline("\n")] [] --- -yield_in_non_generator_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - > 1 │ function foo() { yield bar; } - │ ^^^^^ - 2 │ function foo() { yield 10; } - 3 │ - --- -yield_in_non_generator_function.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 1 │ function foo() { yield bar; } - > 2 │ function foo() { yield 10; } - │ ^^^^^ - 3 │ - --- -function foo() { yield bar; } -function foo() { yield 10; } diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.rast b/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.rast deleted file mode 100644 index 89d7056b2832..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.rast +++ /dev/null @@ -1,240 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@17..22 "yield" [] [], - ], - }, - ], - }, - semicolon_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@24..25 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@25..35 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@35..38 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@43..49 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..52 "foo" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@52..54 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@55..65 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@65..68 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@68..69 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBogusExpression { - items: [ - JsBogus { - items: [ - IDENT@73..79 "yield" [] [Whitespace(" ")], - ], - }, - ], - }, - operator_token: STAR@79..80 "*" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@80..83 "foo" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@83..85 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@85..86 "}" [] [], - }, - }, - ], - eof_token: EOF@86..87 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..87 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..86 - 0: JS_FUNCTION_DECLARATION@0..25 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..25 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..24 - 0: JS_EXPRESSION_STATEMENT@17..24 - 0: JS_BOGUS_EXPRESSION@17..22 - 0: JS_BOGUS@17..22 - 0: IDENT@17..22 "yield" [] [] - 1: SEMICOLON@22..24 ";" [] [Whitespace(" ")] - 3: R_CURLY@24..25 "}" [] [] - 1: JS_FUNCTION_DECLARATION@25..55 - 0: (empty) - 1: FUNCTION_KW@25..35 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@35..38 - 0: IDENT@35..38 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@38..41 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..39 - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@41..55 - 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@43..43 - 2: JS_STATEMENT_LIST@43..54 - 0: JS_EXPRESSION_STATEMENT@43..54 - 0: JS_BOGUS_EXPRESSION@43..52 - 0: YIELD_KW@43..49 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@49..52 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@49..52 - 0: JS_REFERENCE_IDENTIFIER@49..52 - 0: IDENT@49..52 "foo" [] [] - 1: SEMICOLON@52..54 ";" [] [Whitespace(" ")] - 3: R_CURLY@54..55 "}" [] [] - 2: JS_FUNCTION_DECLARATION@55..86 - 0: (empty) - 1: FUNCTION_KW@55..65 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@65..68 - 0: IDENT@65..68 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@68..71 - 0: L_PAREN@68..69 "(" [] [] - 1: JS_PARAMETER_LIST@69..69 - 2: R_PAREN@69..71 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@71..86 - 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@73..73 - 2: JS_STATEMENT_LIST@73..85 - 0: JS_EXPRESSION_STATEMENT@73..85 - 0: JS_BINARY_EXPRESSION@73..83 - 0: JS_BOGUS_EXPRESSION@73..79 - 0: JS_BOGUS@73..79 - 0: IDENT@73..79 "yield" [] [Whitespace(" ")] - 1: STAR@79..80 "*" [] [] - 2: JS_IDENTIFIER_EXPRESSION@80..83 - 0: JS_REFERENCE_IDENTIFIER@80..83 - 0: IDENT@80..83 "foo" [] [] - 1: SEMICOLON@83..85 ";" [] [Whitespace(" ")] - 3: R_CURLY@85..86 "}" [] [] - 4: EOF@86..87 "" [Newline("\n")] [] --- -yield_in_non_generator_function_module.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - > 1 │ function foo() { yield; } - │ ^^^^^ - 2 │ function foo() { yield foo; } - 3 │ function foo() { yield *foo; } - --- -yield_in_non_generator_function_module.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 1 │ function foo() { yield; } - > 2 │ function foo() { yield foo; } - │ ^^^^^ - 3 │ function foo() { yield *foo; } - 4 │ - --- -yield_in_non_generator_function_module.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Illegal use of reserved keyword `yield` as an identifier in strict mode - - 1 │ function foo() { yield; } - 2 │ function foo() { yield foo; } - > 3 │ function foo() { yield *foo; } - │ ^^^^^ - 4 │ - --- -function foo() { yield; } -function foo() { yield foo; } -function foo() { yield *foo; } diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.rast b/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.rast deleted file mode 100644 index 5688ecca46e3..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.rast +++ /dev/null @@ -1,166 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..22 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@27..33 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..36 "bar" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@36..38 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@49..52 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@52..53 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBogusExpression { - items: [ - YIELD_KW@57..63 "yield" [] [Whitespace(" ")], - JsYieldArgument { - star_token: missing (optional), - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@63..65 "10" [] [], - }, - }, - ], - }, - semicolon_token: SEMICOLON@65..67 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@67..68 "}" [] [], - }, - }, - ], - eof_token: EOF@68..69 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..69 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..68 - 0: JS_FUNCTION_DECLARATION@0..39 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..22 - 0: IDENT@19..22 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@22..25 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_PARAMETER_LIST@23..23 - 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@25..39 - 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..38 - 0: JS_EXPRESSION_STATEMENT@27..38 - 0: JS_BOGUS_EXPRESSION@27..36 - 0: YIELD_KW@27..33 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@33..36 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@33..36 - 0: JS_REFERENCE_IDENTIFIER@33..36 - 0: IDENT@33..36 "bar" [] [] - 1: SEMICOLON@36..38 ";" [] [Whitespace(" ")] - 3: R_CURLY@38..39 "}" [] [] - 1: JS_FUNCTION_DECLARATION@39..68 - 0: (empty) - 1: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@49..52 - 0: IDENT@49..52 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@52..55 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_PARAMETER_LIST@53..53 - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@55..68 - 0: L_CURLY@55..57 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..67 - 0: JS_EXPRESSION_STATEMENT@57..67 - 0: JS_BOGUS_EXPRESSION@57..65 - 0: YIELD_KW@57..63 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@63..65 - 0: (empty) - 1: JS_NUMBER_LITERAL_EXPRESSION@63..65 - 0: JS_NUMBER_LITERAL@63..65 "10" [] [] - 1: SEMICOLON@65..67 ";" [] [Whitespace(" ")] - 3: R_CURLY@67..68 "}" [] [] - 4: EOF@68..69 "" [Newline("\n")] [] --- -yield_in_non_generator_function_script.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 1 │ // SCRIPT - > 2 │ function foo() { yield bar; } - │ ^^^^^ - 3 │ function foo() { yield 10; } - 4 │ - --- -yield_in_non_generator_function_script.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × `yield` is only allowed within generator functions. - - 1 │ // SCRIPT - 2 │ function foo() { yield bar; } - > 3 │ function foo() { yield 10; } - │ ^^^^^ - 4 │ - --- -// SCRIPT -function foo() { yield bar; } -function foo() { yield 10; } diff --git a/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.rast b/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.rast deleted file mode 100644 index 328c37e9074a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.rast +++ /dev/null @@ -1,80 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@11..14 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@14..23 "arguments" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@25..28 "any" [] [], - }, - l_brack_token: L_BRACK@28..29 "[" [] [], - r_brack_token: R_BRACK@29..30 "]" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@30..31 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@31..33 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@33..37 "void" [] [], - }, - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - ], - eof_token: EOF@38..39 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..39 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..38 - 0: TS_DECLARE_FUNCTION_DECLARATION@0..38 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 3: (empty) - 4: JS_PARAMETERS@10..31 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..30 - 0: JS_REST_PARAMETER@11..30 - 0: JS_DECORATOR_LIST@11..11 - 1: DOT3@11..14 "..." [] [] - 2: JS_IDENTIFIER_BINDING@14..23 - 0: IDENT@14..23 "arguments" [] [] - 3: TS_TYPE_ANNOTATION@23..30 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@25..30 - 0: TS_ANY_TYPE@25..28 - 0: ANY_KW@25..28 "any" [] [] - 1: L_BRACK@28..29 "[" [] [] - 2: R_BRACK@29..30 "]" [] [] - 2: R_PAREN@30..31 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@31..37 - 0: COLON@31..33 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@33..37 - 0: VOID_KW@33..37 "void" [] [] - 6: SEMICOLON@37..38 ";" [] [] - 4: EOF@38..39 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.rast b/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.rast deleted file mode 100644 index 38b5b072a9aa..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.rast +++ /dev/null @@ -1,297 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@0..1 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@1..4 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@4..6 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@6..9 "bar" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@9..11 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@11..13 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..16 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@17..19 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayHole, - COMMA@19..20 "," [] [], - JsArrayHole, - COMMA@20..21 "," [] [], - JsArrayHole, - COMMA@21..22 "," [] [], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@22..23 "b" [] [], - }, - init: missing (optional), - }, - COMMA@23..24 "," [] [], - JsArrayHole, - COMMA@24..25 "," [] [], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@25..26 "c" [] [], - }, - init: missing (optional), - }, - COMMA@26..27 "," [] [], - ], - r_brack_token: R_BRACK@27..29 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@29..31 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..34 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@35..37 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@37..39 "a" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@39..41 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@41..47 "\"test\"" [] [], - }, - }, - }, - COMMA@47..49 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsStaticMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..50 "a" [] [], - }, - }, - dot_token: DOT@50..51 "." [] [], - member: JsName { - value_token: IDENT@51..52 "b" [] [], - }, - }, - init: missing (optional), - }, - COMMA@52..54 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsStaticMemberAssignment { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@54..58 "call" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@58..59 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@59..60 ")" [] [], - }, - }, - dot_token: DOT@60..61 "." [] [], - member: JsName { - value_token: IDENT@61..62 "b" [] [], - }, - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@62..64 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@64..66 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@66..69 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@70..72 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsParenthesizedAssignment { - l_paren_token: L_PAREN@72..73 "(" [] [], - assignment: JsParenthesizedAssignment { - l_paren_token: L_PAREN@73..74 "(" [] [], - assignment: JsIdentifierAssignment { - name_token: IDENT@74..75 "a" [] [], - }, - r_paren_token: R_PAREN@75..76 ")" [] [], - }, - r_paren_token: R_PAREN@76..77 ")" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@77..79 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@79..81 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@81..84 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@84..85 ";" [] [], - }, - ], - eof_token: EOF@85..86 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..86 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..85 - 0: JS_EXPRESSION_STATEMENT@0..17 - 0: JS_ASSIGNMENT_EXPRESSION@0..16 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@0..11 - 0: L_BRACK@0..1 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@1..9 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@1..4 - 0: JS_IDENTIFIER_ASSIGNMENT@1..4 - 0: IDENT@1..4 "foo" [] [] - 1: (empty) - 1: COMMA@4..6 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@6..9 - 0: JS_IDENTIFIER_ASSIGNMENT@6..9 - 0: IDENT@6..9 "bar" [] [] - 1: (empty) - 2: R_BRACK@9..11 "]" [] [Whitespace(" ")] - 1: EQ@11..13 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@13..16 - 0: JS_REFERENCE_IDENTIFIER@13..16 - 0: IDENT@13..16 "baz" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@17..35 - 0: JS_ASSIGNMENT_EXPRESSION@17..34 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@17..29 - 0: L_BRACK@17..19 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@19..27 - 0: JS_ARRAY_HOLE@19..19 - 1: COMMA@19..20 "," [] [] - 2: JS_ARRAY_HOLE@20..20 - 3: COMMA@20..21 "," [] [] - 4: JS_ARRAY_HOLE@21..21 - 5: COMMA@21..22 "," [] [] - 6: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@22..23 - 0: JS_IDENTIFIER_ASSIGNMENT@22..23 - 0: IDENT@22..23 "b" [] [] - 1: (empty) - 7: COMMA@23..24 "," [] [] - 8: JS_ARRAY_HOLE@24..24 - 9: COMMA@24..25 "," [] [] - 10: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@25..26 - 0: JS_IDENTIFIER_ASSIGNMENT@25..26 - 0: IDENT@25..26 "c" [] [] - 1: (empty) - 11: COMMA@26..27 "," [] [] - 2: R_BRACK@27..29 "]" [] [Whitespace(" ")] - 1: EQ@29..31 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@31..34 - 0: JS_REFERENCE_IDENTIFIER@31..34 - 0: IDENT@31..34 "baz" [] [] - 1: SEMICOLON@34..35 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@35..70 - 0: JS_ASSIGNMENT_EXPRESSION@35..69 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@35..64 - 0: L_BRACK@35..37 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@37..62 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@37..47 - 0: JS_IDENTIFIER_ASSIGNMENT@37..39 - 0: IDENT@37..39 "a" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@39..47 - 0: EQ@39..41 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@41..47 - 0: JS_STRING_LITERAL@41..47 "\"test\"" [] [] - 1: COMMA@47..49 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@49..52 - 0: JS_STATIC_MEMBER_ASSIGNMENT@49..52 - 0: JS_IDENTIFIER_EXPRESSION@49..50 - 0: JS_REFERENCE_IDENTIFIER@49..50 - 0: IDENT@49..50 "a" [] [] - 1: DOT@50..51 "." [] [] - 2: JS_NAME@51..52 - 0: IDENT@51..52 "b" [] [] - 1: (empty) - 3: COMMA@52..54 "," [] [Whitespace(" ")] - 4: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@54..62 - 0: JS_STATIC_MEMBER_ASSIGNMENT@54..62 - 0: JS_CALL_EXPRESSION@54..60 - 0: JS_IDENTIFIER_EXPRESSION@54..58 - 0: JS_REFERENCE_IDENTIFIER@54..58 - 0: IDENT@54..58 "call" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@58..60 - 0: L_PAREN@58..59 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@59..59 - 2: R_PAREN@59..60 ")" [] [] - 1: DOT@60..61 "." [] [] - 2: JS_NAME@61..62 - 0: IDENT@61..62 "b" [] [] - 1: (empty) - 2: R_BRACK@62..64 "]" [] [Whitespace(" ")] - 1: EQ@64..66 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@66..69 - 0: JS_REFERENCE_IDENTIFIER@66..69 - 0: IDENT@66..69 "baz" [] [] - 1: SEMICOLON@69..70 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@70..85 - 0: JS_ASSIGNMENT_EXPRESSION@70..84 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@70..79 - 0: L_BRACK@70..72 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@72..77 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@72..77 - 0: JS_PARENTHESIZED_ASSIGNMENT@72..77 - 0: L_PAREN@72..73 "(" [] [] - 1: JS_PARENTHESIZED_ASSIGNMENT@73..76 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@74..75 - 0: IDENT@74..75 "a" [] [] - 2: R_PAREN@75..76 ")" [] [] - 2: R_PAREN@76..77 ")" [] [] - 1: (empty) - 2: R_BRACK@77..79 "]" [] [Whitespace(" ")] - 1: EQ@79..81 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@81..84 - 0: JS_REFERENCE_IDENTIFIER@81..84 - 0: IDENT@81..84 "baz" [] [] - 1: SEMICOLON@84..85 ";" [] [] - 4: EOF@85..86 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.rast b/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.rast deleted file mode 100644 index a1cacd14c8c9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.rast +++ /dev/null @@ -1,465 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@1..3 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@3..6 "..." [] [], - pattern: JsIdentifierAssignment { - name_token: IDENT@6..11 "abcd" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@11..13 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@13..15 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "a" [] [], - }, - }, - }, - r_paren_token: R_PAREN@16..17 ")" [] [], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@20..22 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@22..25 "..." [] [], - pattern: JsParenthesizedAssignment { - l_paren_token: L_PAREN@25..26 "(" [] [], - assignment: JsIdentifierAssignment { - name_token: IDENT@26..30 "abcd" [] [], - }, - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@32..34 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@34..36 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@36..37 "a" [] [], - }, - }, - }, - r_paren_token: R_PAREN@37..38 ")" [] [], - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@39..41 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@41..43 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@43..46 "..." [] [], - pattern: JsStaticMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..47 "m" [] [], - }, - }, - dot_token: DOT@47..48 "." [] [], - member: JsName { - value_token: IDENT@48..53 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - r_brack_token: R_BRACK@53..55 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@55..57 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..58 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@58..59 ")" [] [], - }, - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@60..62 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@62..64 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@64..67 "..." [] [], - pattern: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@67..68 "m" [] [], - }, - }, - l_brack_token: L_BRACK@68..69 "[" [] [], - member: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@69..73 "call" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@73..74 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@74..75 ")" [] [], - }, - }, - r_brack_token: R_BRACK@75..77 "]" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@77..79 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@79..81 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@81..82 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@84..86 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@86..88 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@88..91 "..." [] [], - pattern: JsStaticMemberAssignment { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@91..94 "any" [] [], - }, - }, - operator_token: DOT@94..95 "." [] [], - member: JsName { - value_token: IDENT@95..105 "expression" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@105..106 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@106..107 ")" [] [], - }, - }, - dot_token: DOT@107..108 "." [] [], - member: JsName { - value_token: IDENT@108..110 "b" [] [Whitespace(" ")], - }, - }, - }, - ], - r_brack_token: R_BRACK@110..112 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@112..114 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@114..115 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@115..116 ")" [] [], - }, - semicolon_token: SEMICOLON@116..117 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@117..119 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@119..121 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@121..124 "..." [] [], - pattern: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@124..125 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@125..126 "x" [] [], - }, - init: missing (optional), - }, - COMMA@126..128 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@128..129 "y" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@129..131 "]" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@131..133 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@133..135 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@135..136 "b" [] [], - }, - }, - }, - r_paren_token: R_PAREN@136..137 ")" [] [], - }, - semicolon_token: SEMICOLON@137..138 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@138..140 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@140..142 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@142..145 "..." [] [], - pattern: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@145..147 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@147..150 "..." [] [], - pattern: JsIdentifierAssignment { - name_token: IDENT@150..152 "a" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@152..154 "]" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@154..156 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@156..158 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@158..159 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@159..160 ")" [] [], - }, - semicolon_token: SEMICOLON@160..161 ";" [] [], - }, - ], - eof_token: EOF@161..162 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..162 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..161 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JS_PARENTHESIZED_EXPRESSION@0..17 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..16 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@1..13 - 0: L_BRACK@1..3 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@3..11 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@3..11 - 0: DOT3@3..6 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@6..11 - 0: IDENT@6..11 "abcd" [] [Whitespace(" ")] - 2: R_BRACK@11..13 "]" [] [Whitespace(" ")] - 1: EQ@13..15 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "a" [] [] - 2: R_PAREN@16..17 ")" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@18..39 - 0: JS_PARENTHESIZED_EXPRESSION@18..38 - 0: L_PAREN@18..20 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@20..37 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@20..34 - 0: L_BRACK@20..22 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@22..32 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@22..32 - 0: DOT3@22..25 "..." [] [] - 1: JS_PARENTHESIZED_ASSIGNMENT@25..32 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@26..30 - 0: IDENT@26..30 "abcd" [] [] - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 2: R_BRACK@32..34 "]" [] [Whitespace(" ")] - 1: EQ@34..36 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@36..37 - 0: JS_REFERENCE_IDENTIFIER@36..37 - 0: IDENT@36..37 "a" [] [] - 2: R_PAREN@37..38 ")" [] [] - 1: SEMICOLON@38..39 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@39..60 - 0: JS_PARENTHESIZED_EXPRESSION@39..59 - 0: L_PAREN@39..41 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@41..58 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@41..55 - 0: L_BRACK@41..43 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@43..53 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@43..53 - 0: DOT3@43..46 "..." [] [] - 1: JS_STATIC_MEMBER_ASSIGNMENT@46..53 - 0: JS_IDENTIFIER_EXPRESSION@46..47 - 0: JS_REFERENCE_IDENTIFIER@46..47 - 0: IDENT@46..47 "m" [] [] - 1: DOT@47..48 "." [] [] - 2: JS_NAME@48..53 - 0: IDENT@48..53 "test" [] [Whitespace(" ")] - 2: R_BRACK@53..55 "]" [] [Whitespace(" ")] - 1: EQ@55..57 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@57..58 - 0: JS_REFERENCE_IDENTIFIER@57..58 - 0: IDENT@57..58 "c" [] [] - 2: R_PAREN@58..59 ")" [] [] - 1: SEMICOLON@59..60 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@60..84 - 0: JS_PARENTHESIZED_EXPRESSION@60..83 - 0: L_PAREN@60..62 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@62..82 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@62..79 - 0: L_BRACK@62..64 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@64..77 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@64..77 - 0: DOT3@64..67 "..." [] [] - 1: JS_COMPUTED_MEMBER_ASSIGNMENT@67..77 - 0: JS_IDENTIFIER_EXPRESSION@67..68 - 0: JS_REFERENCE_IDENTIFIER@67..68 - 0: IDENT@67..68 "m" [] [] - 1: L_BRACK@68..69 "[" [] [] - 2: JS_CALL_EXPRESSION@69..75 - 0: JS_IDENTIFIER_EXPRESSION@69..73 - 0: JS_REFERENCE_IDENTIFIER@69..73 - 0: IDENT@69..73 "call" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@73..75 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@74..74 - 2: R_PAREN@74..75 ")" [] [] - 3: R_BRACK@75..77 "]" [] [Whitespace(" ")] - 2: R_BRACK@77..79 "]" [] [Whitespace(" ")] - 1: EQ@79..81 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@81..82 - 0: JS_REFERENCE_IDENTIFIER@81..82 - 0: IDENT@81..82 "c" [] [] - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@84..117 - 0: JS_PARENTHESIZED_EXPRESSION@84..116 - 0: L_PAREN@84..86 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@86..115 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@86..112 - 0: L_BRACK@86..88 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@88..110 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@88..110 - 0: DOT3@88..91 "..." [] [] - 1: JS_STATIC_MEMBER_ASSIGNMENT@91..110 - 0: JS_CALL_EXPRESSION@91..107 - 0: JS_STATIC_MEMBER_EXPRESSION@91..105 - 0: JS_IDENTIFIER_EXPRESSION@91..94 - 0: JS_REFERENCE_IDENTIFIER@91..94 - 0: IDENT@91..94 "any" [] [] - 1: DOT@94..95 "." [] [] - 2: JS_NAME@95..105 - 0: IDENT@95..105 "expression" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@105..107 - 0: L_PAREN@105..106 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@106..106 - 2: R_PAREN@106..107 ")" [] [] - 1: DOT@107..108 "." [] [] - 2: JS_NAME@108..110 - 0: IDENT@108..110 "b" [] [Whitespace(" ")] - 2: R_BRACK@110..112 "]" [] [Whitespace(" ")] - 1: EQ@112..114 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@114..115 - 0: JS_REFERENCE_IDENTIFIER@114..115 - 0: IDENT@114..115 "c" [] [] - 2: R_PAREN@115..116 ")" [] [] - 1: SEMICOLON@116..117 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@117..138 - 0: JS_PARENTHESIZED_EXPRESSION@117..137 - 0: L_PAREN@117..119 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@119..136 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@119..133 - 0: L_BRACK@119..121 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@121..131 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@121..131 - 0: DOT3@121..124 "..." [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN@124..131 - 0: L_BRACK@124..125 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@125..129 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@125..126 - 0: JS_IDENTIFIER_ASSIGNMENT@125..126 - 0: IDENT@125..126 "x" [] [] - 1: (empty) - 1: COMMA@126..128 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@128..129 - 0: JS_IDENTIFIER_ASSIGNMENT@128..129 - 0: IDENT@128..129 "y" [] [] - 1: (empty) - 2: R_BRACK@129..131 "]" [] [Whitespace(" ")] - 2: R_BRACK@131..133 "]" [] [Whitespace(" ")] - 1: EQ@133..135 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@135..136 - 0: JS_REFERENCE_IDENTIFIER@135..136 - 0: IDENT@135..136 "b" [] [] - 2: R_PAREN@136..137 ")" [] [] - 1: SEMICOLON@137..138 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@138..161 - 0: JS_PARENTHESIZED_EXPRESSION@138..160 - 0: L_PAREN@138..140 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@140..159 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@140..156 - 0: L_BRACK@140..142 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@142..154 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@142..154 - 0: DOT3@142..145 "..." [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN@145..154 - 0: L_BRACK@145..147 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@147..152 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@147..152 - 0: DOT3@147..150 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@150..152 - 0: IDENT@150..152 "a" [] [Whitespace(" ")] - 2: R_BRACK@152..154 "]" [] [Whitespace(" ")] - 2: R_BRACK@154..156 "]" [] [Whitespace(" ")] - 1: EQ@156..158 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@158..159 - 0: JS_REFERENCE_IDENTIFIER@158..159 - 0: IDENT@158..159 "c" [] [] - 2: R_PAREN@159..160 ")" [] [] - 1: SEMICOLON@160..161 ";" [] [] - 4: EOF@161..162 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding.rast b/crates/biome_js_parser/test_data/inline/ok/array_binding.rast deleted file mode 100644 index 1abd4a84308c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_binding.rast +++ /dev/null @@ -1,441 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@8..11 "\"b\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@12..17 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@17..18 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@18..19 "c" [] [], - }, - init: missing (optional), - }, - COMMA@19..21 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@21..22 "b" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@22..24 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@26..27 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@27..28 "1" [] [], - }, - COMMA@28..30 "," [] [Whitespace(" ")], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@30..31 "2" [] [], - }, - ], - r_brack_token: R_BRACK@31..32 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@38..39 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@39..40 "d" [] [], - }, - init: missing (optional), - }, - COMMA@40..42 "," [] [Whitespace(" ")], - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@42..45 "..." [] [], - pattern: JsIdentifierBinding { - name_token: IDENT@45..49 "abcd" [] [], - }, - }, - ], - r_brack_token: R_BRACK@49..51 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@51..53 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@53..54 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@54..55 "1" [] [], - }, - ], - r_brack_token: R_BRACK@55..56 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@56..57 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@57..62 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@62..63 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@63..65 "e" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@65..67 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@67..76 "\"default\"" [] [], - }, - }, - }, - COMMA@76..78 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@78..79 "x" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@79..81 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@81..83 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@83..84 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@84..85 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@85..90 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@90..91 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayHole, - COMMA@91..93 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@93..94 "f" [] [], - }, - init: missing (optional), - }, - COMMA@94..96 "," [] [Whitespace(" ")], - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@96..99 "..." [] [], - pattern: JsIdentifierBinding { - name_token: IDENT@99..103 "rest" [] [], - }, - }, - ], - r_brack_token: R_BRACK@103..105 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@105..107 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@107..108 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@108..109 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@109..114 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@114..115 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsArrayBindingPattern { - l_brack_token: L_BRACK@115..116 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@116..119 "..." [] [], - pattern: JsIdentifierBinding { - name_token: IDENT@119..124 "rest2" [] [], - }, - }, - ], - r_brack_token: R_BRACK@124..125 "]" [] [], - }, - init: missing (optional), - }, - COMMA@125..127 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsObjectBindingPattern { - l_curly_token: L_CURLY@127..129 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@129..131 "g" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@131..132 "}" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@132..134 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@134..136 "=" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@136..137 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@137..138 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@138..139 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..139 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..138 - 0: JS_VARIABLE_STATEMENT@0..12 - 0: JS_VARIABLE_DECLARATION@0..11 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..11 - 0: JS_VARIABLE_DECLARATOR@4..11 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..11 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@8..11 - 0: JS_STRING_LITERAL@8..11 "\"b\"" [] [] - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_VARIABLE_STATEMENT@12..33 - 0: JS_VARIABLE_DECLARATION@12..32 - 0: (empty) - 1: LET_KW@12..17 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@17..32 - 0: JS_VARIABLE_DECLARATOR@17..32 - 0: JS_ARRAY_BINDING_PATTERN@17..24 - 0: L_BRACK@17..18 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@18..22 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@18..19 - 0: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "c" [] [] - 1: (empty) - 1: COMMA@19..21 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@21..22 - 0: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "b" [] [] - 1: (empty) - 2: R_BRACK@22..24 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@24..32 - 0: EQ@24..26 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@26..32 - 0: L_BRACK@26..27 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@27..31 - 0: JS_NUMBER_LITERAL_EXPRESSION@27..28 - 0: JS_NUMBER_LITERAL@27..28 "1" [] [] - 1: COMMA@28..30 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@30..31 - 0: JS_NUMBER_LITERAL@30..31 "2" [] [] - 2: R_BRACK@31..32 "]" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_VARIABLE_STATEMENT@33..57 - 0: JS_VARIABLE_DECLARATION@33..56 - 0: (empty) - 1: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@38..56 - 0: JS_VARIABLE_DECLARATOR@38..56 - 0: JS_ARRAY_BINDING_PATTERN@38..51 - 0: L_BRACK@38..39 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@39..49 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@39..40 - 0: JS_IDENTIFIER_BINDING@39..40 - 0: IDENT@39..40 "d" [] [] - 1: (empty) - 1: COMMA@40..42 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@42..49 - 0: DOT3@42..45 "..." [] [] - 1: JS_IDENTIFIER_BINDING@45..49 - 0: IDENT@45..49 "abcd" [] [] - 2: R_BRACK@49..51 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@51..56 - 0: EQ@51..53 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@53..56 - 0: L_BRACK@53..54 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@54..55 - 0: JS_NUMBER_LITERAL_EXPRESSION@54..55 - 0: JS_NUMBER_LITERAL@54..55 "1" [] [] - 2: R_BRACK@55..56 "]" [] [] - 1: SEMICOLON@56..57 ";" [] [] - 3: JS_VARIABLE_STATEMENT@57..85 - 0: JS_VARIABLE_DECLARATION@57..85 - 0: (empty) - 1: LET_KW@57..62 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@62..85 - 0: JS_VARIABLE_DECLARATOR@62..85 - 0: JS_ARRAY_BINDING_PATTERN@62..81 - 0: L_BRACK@62..63 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@63..79 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@63..76 - 0: JS_IDENTIFIER_BINDING@63..65 - 0: IDENT@63..65 "e" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@65..76 - 0: EQ@65..67 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@67..76 - 0: JS_STRING_LITERAL@67..76 "\"default\"" [] [] - 1: COMMA@76..78 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@78..79 - 0: JS_IDENTIFIER_BINDING@78..79 - 0: IDENT@78..79 "x" [] [] - 1: (empty) - 2: R_BRACK@79..81 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@81..85 - 0: EQ@81..83 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@83..85 - 0: L_BRACK@83..84 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@84..84 - 2: R_BRACK@84..85 "]" [] [] - 1: (empty) - 4: JS_VARIABLE_STATEMENT@85..109 - 0: JS_VARIABLE_DECLARATION@85..109 - 0: (empty) - 1: LET_KW@85..90 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@90..109 - 0: JS_VARIABLE_DECLARATOR@90..109 - 0: JS_ARRAY_BINDING_PATTERN@90..105 - 0: L_BRACK@90..91 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@91..103 - 0: JS_ARRAY_HOLE@91..91 - 1: COMMA@91..93 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@93..94 - 0: JS_IDENTIFIER_BINDING@93..94 - 0: IDENT@93..94 "f" [] [] - 1: (empty) - 3: COMMA@94..96 "," [] [Whitespace(" ")] - 4: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@96..103 - 0: DOT3@96..99 "..." [] [] - 1: JS_IDENTIFIER_BINDING@99..103 - 0: IDENT@99..103 "rest" [] [] - 2: R_BRACK@103..105 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@105..109 - 0: EQ@105..107 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@107..109 - 0: L_BRACK@107..108 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@108..108 - 2: R_BRACK@108..109 "]" [] [] - 1: (empty) - 5: JS_VARIABLE_STATEMENT@109..138 - 0: JS_VARIABLE_DECLARATION@109..138 - 0: (empty) - 1: LET_KW@109..114 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@114..138 - 0: JS_VARIABLE_DECLARATOR@114..138 - 0: JS_ARRAY_BINDING_PATTERN@114..134 - 0: L_BRACK@114..115 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@115..132 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@115..125 - 0: JS_ARRAY_BINDING_PATTERN@115..125 - 0: L_BRACK@115..116 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@116..124 - 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@116..124 - 0: DOT3@116..119 "..." [] [] - 1: JS_IDENTIFIER_BINDING@119..124 - 0: IDENT@119..124 "rest2" [] [] - 2: R_BRACK@124..125 "]" [] [] - 1: (empty) - 1: COMMA@125..127 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@127..132 - 0: JS_OBJECT_BINDING_PATTERN@127..132 - 0: L_CURLY@127..129 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@129..131 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@129..131 - 0: JS_IDENTIFIER_BINDING@129..131 - 0: IDENT@129..131 "g" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@131..132 "}" [] [] - 1: (empty) - 2: R_BRACK@132..134 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@134..138 - 0: EQ@134..136 "=" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@136..138 - 0: L_BRACK@136..137 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@137..137 - 2: R_BRACK@137..138 "]" [] [] - 1: (empty) - 4: EOF@138..139 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.rast b/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.rast deleted file mode 100644 index eea296ff1379..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.rast +++ /dev/null @@ -1,216 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@4..6 "[" [] [Whitespace(" ")], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@6..9 "..." [] [], - pattern: JsIdentifierBinding { - name_token: IDENT@9..14 "abcd" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@14..16 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@16..18 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..19 "a" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@25..27 "[" [] [Whitespace(" ")], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@27..30 "..." [] [], - pattern: JsArrayBindingPattern { - l_brack_token: L_BRACK@30..31 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@31..32 "x" [] [], - }, - init: missing (optional), - }, - COMMA@32..34 "," [] [Whitespace(" ")], - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@34..35 "y" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@35..37 "]" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@37..39 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@39..41 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..42 "b" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsArrayBindingPattern { - l_brack_token: L_BRACK@48..50 "[" [] [Whitespace(" ")], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@50..53 "..." [] [], - pattern: JsArrayBindingPattern { - l_brack_token: L_BRACK@53..55 "[" [] [Whitespace(" ")], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@55..58 "..." [] [], - pattern: JsIdentifierBinding { - name_token: IDENT@58..60 "a" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@60..62 "]" [] [Whitespace(" ")], - }, - }, - ], - r_brack_token: R_BRACK@62..64 "]" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@64..66 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@66..67 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@67..68 ";" [] [], - }, - ], - eof_token: EOF@68..69 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..69 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..68 - 0: JS_VARIABLE_STATEMENT@0..20 - 0: JS_VARIABLE_DECLARATION@0..19 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..19 - 0: JS_VARIABLE_DECLARATOR@4..19 - 0: JS_ARRAY_BINDING_PATTERN@4..16 - 0: L_BRACK@4..6 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@6..14 - 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@6..14 - 0: DOT3@6..9 "..." [] [] - 1: JS_IDENTIFIER_BINDING@9..14 - 0: IDENT@9..14 "abcd" [] [Whitespace(" ")] - 2: R_BRACK@14..16 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@16..19 - 0: EQ@16..18 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@18..19 - 0: JS_REFERENCE_IDENTIFIER@18..19 - 0: IDENT@18..19 "a" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 1: JS_VARIABLE_STATEMENT@20..43 - 0: JS_VARIABLE_DECLARATION@20..42 - 0: (empty) - 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@25..42 - 0: JS_VARIABLE_DECLARATOR@25..42 - 0: JS_ARRAY_BINDING_PATTERN@25..39 - 0: L_BRACK@25..27 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@27..37 - 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@27..37 - 0: DOT3@27..30 "..." [] [] - 1: JS_ARRAY_BINDING_PATTERN@30..37 - 0: L_BRACK@30..31 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@31..35 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@31..32 - 0: JS_IDENTIFIER_BINDING@31..32 - 0: IDENT@31..32 "x" [] [] - 1: (empty) - 1: COMMA@32..34 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@34..35 - 0: JS_IDENTIFIER_BINDING@34..35 - 0: IDENT@34..35 "y" [] [] - 1: (empty) - 2: R_BRACK@35..37 "]" [] [Whitespace(" ")] - 2: R_BRACK@37..39 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@39..42 - 0: EQ@39..41 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@41..42 - 0: JS_REFERENCE_IDENTIFIER@41..42 - 0: IDENT@41..42 "b" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 2: JS_VARIABLE_STATEMENT@43..68 - 0: JS_VARIABLE_DECLARATION@43..67 - 0: (empty) - 1: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@48..67 - 0: JS_VARIABLE_DECLARATOR@48..67 - 0: JS_ARRAY_BINDING_PATTERN@48..64 - 0: L_BRACK@48..50 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@50..62 - 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@50..62 - 0: DOT3@50..53 "..." [] [] - 1: JS_ARRAY_BINDING_PATTERN@53..62 - 0: L_BRACK@53..55 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@55..60 - 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@55..60 - 0: DOT3@55..58 "..." [] [] - 1: JS_IDENTIFIER_BINDING@58..60 - 0: IDENT@58..60 "a" [] [Whitespace(" ")] - 2: R_BRACK@60..62 "]" [] [Whitespace(" ")] - 2: R_BRACK@62..64 "]" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@64..67 - 0: EQ@64..66 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@66..67 - 0: JS_REFERENCE_IDENTIFIER@66..67 - 0: IDENT@66..67 "c" [] [] - 1: SEMICOLON@67..68 ";" [] [] - 4: EOF@68..69 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.rast b/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.rast deleted file mode 100644 index 07175c3290f1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.rast +++ /dev/null @@ -1,70 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..3 "for" [] [], - l_paren_token: L_PAREN@3..4 "(" [] [], - initializer: JsArrayExpression { - l_brack_token: L_BRACK@4..5 "[" [] [], - elements: JsArrayElementList [ - JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@5..9 "\"a\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@9..12 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@12..13 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@13..14 "}" [] [], - }, - }, - ], - r_brack_token: R_BRACK@14..15 "]" [] [], - }, - first_semi_token: SEMICOLON@15..16 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@16..17 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@19..20 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_FOR_STATEMENT@0..21 - 0: FOR_KW@0..3 "for" [] [] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_ARRAY_EXPRESSION@4..15 - 0: L_BRACK@4..5 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@5..14 - 0: JS_IN_EXPRESSION@5..14 - 0: JS_STRING_LITERAL_EXPRESSION@5..9 - 0: JS_STRING_LITERAL@5..9 "\"a\"" [] [Whitespace(" ")] - 1: IN_KW@9..12 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@12..14 - 0: L_CURLY@12..13 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@13..13 - 2: R_CURLY@13..14 "}" [] [] - 2: R_BRACK@14..15 "]" [] [] - 3: SEMICOLON@15..16 ";" [] [] - 4: (empty) - 5: SEMICOLON@16..17 ";" [] [] - 6: (empty) - 7: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@19..21 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_STATEMENT_LIST@20..20 - 2: R_CURLY@20..21 "}" [] [] - 4: EOF@21..22 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_expr.rast b/crates/biome_js_parser/test_data/inline/ok/array_expr.rast deleted file mode 100644 index daeb474ae86a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_expr.rast +++ /dev/null @@ -1,223 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@0..1 "[" [] [], - elements: JsArrayElementList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..4 "foo" [] [], - }, - }, - COMMA@4..6 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@6..9 "bar" [] [], - }, - }, - ], - r_brack_token: R_BRACK@9..10 "]" [] [], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@11..13 "[" [Newline("\n")] [], - elements: JsArrayElementList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..16 "foo" [] [], - }, - }, - ], - r_brack_token: R_BRACK@16..17 "]" [] [], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@18..20 "[" [Newline("\n")] [], - elements: JsArrayElementList [ - JsArrayHole, - COMMA@20..21 "," [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "foo" [] [], - }, - }, - ], - r_brack_token: R_BRACK@24..25 "]" [] [], - }, - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@26..28 "[" [Newline("\n")] [], - elements: JsArrayElementList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..31 "foo" [] [], - }, - }, - COMMA@31..32 "," [] [], - ], - r_brack_token: R_BRACK@32..33 "]" [] [], - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@34..36 "[" [Newline("\n")] [], - elements: JsArrayElementList [ - JsArrayHole, - COMMA@36..37 "," [] [], - JsArrayHole, - COMMA@37..38 "," [] [], - JsArrayHole, - COMMA@38..39 "," [] [], - JsArrayHole, - COMMA@39..40 "," [] [], - JsArrayHole, - COMMA@40..41 "," [] [], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..44 "foo" [] [], - }, - }, - COMMA@44..45 "," [] [], - JsArrayHole, - COMMA@45..46 "," [] [], - JsArrayHole, - COMMA@46..47 "," [] [], - JsArrayHole, - COMMA@47..48 "," [] [], - ], - r_brack_token: R_BRACK@48..49 "]" [] [], - }, - semicolon_token: SEMICOLON@49..50 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@50..52 "[" [Newline("\n")] [], - elements: JsArrayElementList [ - JsSpread { - dotdotdot_token: DOT3@52..55 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..56 "a" [] [], - }, - }, - }, - COMMA@56..58 "," [] [Whitespace(" ")], - JsSpread { - dotdotdot_token: DOT3@58..61 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@61..62 "b" [] [], - }, - }, - }, - ], - r_brack_token: R_BRACK@62..63 "]" [] [], - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: JS_EXPRESSION_STATEMENT@0..11 - 0: JS_ARRAY_EXPRESSION@0..10 - 0: L_BRACK@0..1 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@1..9 - 0: JS_IDENTIFIER_EXPRESSION@1..4 - 0: JS_REFERENCE_IDENTIFIER@1..4 - 0: IDENT@1..4 "foo" [] [] - 1: COMMA@4..6 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@6..9 - 0: JS_REFERENCE_IDENTIFIER@6..9 - 0: IDENT@6..9 "bar" [] [] - 2: R_BRACK@9..10 "]" [] [] - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@11..18 - 0: JS_ARRAY_EXPRESSION@11..17 - 0: L_BRACK@11..13 "[" [Newline("\n")] [] - 1: JS_ARRAY_ELEMENT_LIST@13..16 - 0: JS_IDENTIFIER_EXPRESSION@13..16 - 0: JS_REFERENCE_IDENTIFIER@13..16 - 0: IDENT@13..16 "foo" [] [] - 2: R_BRACK@16..17 "]" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@18..26 - 0: JS_ARRAY_EXPRESSION@18..25 - 0: L_BRACK@18..20 "[" [Newline("\n")] [] - 1: JS_ARRAY_ELEMENT_LIST@20..24 - 0: JS_ARRAY_HOLE@20..20 - 1: COMMA@20..21 "," [] [] - 2: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "foo" [] [] - 2: R_BRACK@24..25 "]" [] [] - 1: SEMICOLON@25..26 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@26..34 - 0: JS_ARRAY_EXPRESSION@26..33 - 0: L_BRACK@26..28 "[" [Newline("\n")] [] - 1: JS_ARRAY_ELEMENT_LIST@28..32 - 0: JS_IDENTIFIER_EXPRESSION@28..31 - 0: JS_REFERENCE_IDENTIFIER@28..31 - 0: IDENT@28..31 "foo" [] [] - 1: COMMA@31..32 "," [] [] - 2: R_BRACK@32..33 "]" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@34..50 - 0: JS_ARRAY_EXPRESSION@34..49 - 0: L_BRACK@34..36 "[" [Newline("\n")] [] - 1: JS_ARRAY_ELEMENT_LIST@36..48 - 0: JS_ARRAY_HOLE@36..36 - 1: COMMA@36..37 "," [] [] - 2: JS_ARRAY_HOLE@37..37 - 3: COMMA@37..38 "," [] [] - 4: JS_ARRAY_HOLE@38..38 - 5: COMMA@38..39 "," [] [] - 6: JS_ARRAY_HOLE@39..39 - 7: COMMA@39..40 "," [] [] - 8: JS_ARRAY_HOLE@40..40 - 9: COMMA@40..41 "," [] [] - 10: JS_IDENTIFIER_EXPRESSION@41..44 - 0: JS_REFERENCE_IDENTIFIER@41..44 - 0: IDENT@41..44 "foo" [] [] - 11: COMMA@44..45 "," [] [] - 12: JS_ARRAY_HOLE@45..45 - 13: COMMA@45..46 "," [] [] - 14: JS_ARRAY_HOLE@46..46 - 15: COMMA@46..47 "," [] [] - 16: JS_ARRAY_HOLE@47..47 - 17: COMMA@47..48 "," [] [] - 2: R_BRACK@48..49 "]" [] [] - 1: SEMICOLON@49..50 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@50..64 - 0: JS_ARRAY_EXPRESSION@50..63 - 0: L_BRACK@50..52 "[" [Newline("\n")] [] - 1: JS_ARRAY_ELEMENT_LIST@52..62 - 0: JS_SPREAD@52..56 - 0: DOT3@52..55 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@55..56 - 0: JS_REFERENCE_IDENTIFIER@55..56 - 0: IDENT@55..56 "a" [] [] - 1: COMMA@56..58 "," [] [Whitespace(" ")] - 2: JS_SPREAD@58..62 - 0: DOT3@58..61 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@61..62 - 0: JS_REFERENCE_IDENTIFIER@61..62 - 0: IDENT@61..62 "b" [] [] - 2: R_BRACK@62..63 "]" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: EOF@64..65 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.rast b/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.rast deleted file mode 100644 index f73a79270b76..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.rast +++ /dev/null @@ -1,443 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@0..1 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsStaticMemberAssignment { - object: JsObjectExpression { - l_curly_token: L_CURLY@1..2 "{" [] [], - members: JsObjectMemberList [ - JsGetterObjectMember { - get_token: GET_KW@2..9 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@9..10 "y" [] [], - }, - l_paren_token: L_PAREN@10..11 "(" [] [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsThrowStatement { - throw_token: THROW_KW@14..25 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsNewExpression { - new_token: NEW_KW@25..29 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@29..41 "Test262Error" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@41..42 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@42..80 "'The property should not be accessed.'" [] [], - }, - ], - r_paren_token: R_PAREN@80..81 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@81..82 ";" [] [], - }, - ], - r_curly_token: R_CURLY@82..86 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@86..87 "," [] [], - JsSetterObjectMember { - set_token: SET_KW@87..94 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@94..95 "y" [] [], - }, - l_paren_token: L_PAREN@95..96 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@96..99 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@101..102 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@102..116 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - operator_token: EQ@116..118 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@118..121 "val" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@121..122 ";" [] [], - }, - ], - r_curly_token: R_CURLY@122..126 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@126..128 "}" [Newline("\n")] [], - }, - dot_token: DOT@128..129 "." [] [], - member: JsName { - value_token: IDENT@129..131 "y" [] [Whitespace(" ")], - }, - }, - init: JsInitializerClause { - eq_token: EQ@131..133 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@133..135 "42" [] [], - }, - }, - }, - ], - r_brack_token: R_BRACK@135..137 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@137..139 "=" [] [Whitespace(" ")], - right: JsArrayExpression { - l_brack_token: L_BRACK@139..140 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@140..142 "23" [] [], - }, - ], - r_brack_token: R_BRACK@142..143 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@143..144 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@144..146 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@146..148 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@148..149 "x" [] [], - }, - colon_token: COLON@149..151 ":" [] [Whitespace(" ")], - pattern: JsStaticMemberAssignment { - object: JsObjectExpression { - l_curly_token: L_CURLY@151..152 "{" [] [], - members: JsObjectMemberList [ - JsGetterObjectMember { - get_token: GET_KW@152..159 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@159..160 "y" [] [], - }, - l_paren_token: L_PAREN@160..161 "(" [] [], - r_paren_token: R_PAREN@161..163 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@163..164 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsThrowStatement { - throw_token: THROW_KW@164..175 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsNewExpression { - new_token: NEW_KW@175..179 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@179..191 "Test262Error" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@191..192 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@192..230 "'The property should not be accessed.'" [] [], - }, - ], - r_paren_token: R_PAREN@230..231 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@231..232 ";" [] [], - }, - ], - r_curly_token: R_CURLY@232..236 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@236..237 "," [] [], - JsSetterObjectMember { - set_token: SET_KW@237..244 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@244..245 "y" [] [], - }, - l_paren_token: L_PAREN@245..246 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@246..249 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@249..251 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@251..252 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@252..266 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - operator_token: EQ@266..268 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@268..271 "val" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@271..272 ";" [] [], - }, - ], - r_curly_token: R_CURLY@272..276 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@276..278 "}" [Newline("\n")] [], - }, - dot_token: DOT@278..279 "." [] [], - member: JsName { - value_token: IDENT@279..281 "y" [] [Whitespace(" ")], - }, - }, - init: JsInitializerClause { - eq_token: EQ@281..283 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@283..286 "42" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@286..288 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@288..290 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@290..292 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@292..293 "x" [] [], - }, - colon_token: COLON@293..295 ":" [] [Whitespace(" ")], - value: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@295..298 "23" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@298..299 "}" [] [], - }, - }, - r_paren_token: R_PAREN@299..300 ")" [] [], - }, - semicolon_token: SEMICOLON@300..301 ";" [] [], - }, - ], - eof_token: EOF@301..302 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..302 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..301 - 0: JS_EXPRESSION_STATEMENT@0..144 - 0: JS_ASSIGNMENT_EXPRESSION@0..143 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@0..137 - 0: L_BRACK@0..1 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@1..135 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@1..135 - 0: JS_STATIC_MEMBER_ASSIGNMENT@1..131 - 0: JS_OBJECT_EXPRESSION@1..128 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@2..126 - 0: JS_GETTER_OBJECT_MEMBER@2..86 - 0: GET_KW@2..9 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@9..10 - 0: IDENT@9..10 "y" [] [] - 2: L_PAREN@10..11 "(" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@13..86 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..82 - 0: JS_THROW_STATEMENT@14..82 - 0: THROW_KW@14..25 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@25..81 - 0: NEW_KW@25..29 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@29..41 - 0: JS_REFERENCE_IDENTIFIER@29..41 - 0: IDENT@29..41 "Test262Error" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@41..81 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@42..80 - 0: JS_STRING_LITERAL_EXPRESSION@42..80 - 0: JS_STRING_LITERAL@42..80 "'The property should not be accessed.'" [] [] - 2: R_PAREN@80..81 ")" [] [] - 2: SEMICOLON@81..82 ";" [] [] - 3: R_CURLY@82..86 "}" [Newline("\n"), Whitespace(" ")] [] - 1: COMMA@86..87 "," [] [] - 2: JS_SETTER_OBJECT_MEMBER@87..126 - 0: SET_KW@87..94 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@94..95 - 0: IDENT@94..95 "y" [] [] - 2: L_PAREN@95..96 "(" [] [] - 3: JS_FORMAL_PARAMETER@96..99 - 0: JS_DECORATOR_LIST@96..96 - 1: JS_IDENTIFIER_BINDING@96..99 - 0: IDENT@96..99 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@99..101 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@101..126 - 0: L_CURLY@101..102 "{" [] [] - 1: JS_DIRECTIVE_LIST@102..102 - 2: JS_STATEMENT_LIST@102..122 - 0: JS_EXPRESSION_STATEMENT@102..122 - 0: JS_ASSIGNMENT_EXPRESSION@102..121 - 0: JS_IDENTIFIER_ASSIGNMENT@102..116 - 0: IDENT@102..116 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: EQ@116..118 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@118..121 - 0: JS_REFERENCE_IDENTIFIER@118..121 - 0: IDENT@118..121 "val" [] [] - 1: SEMICOLON@121..122 ";" [] [] - 3: R_CURLY@122..126 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@126..128 "}" [Newline("\n")] [] - 1: DOT@128..129 "." [] [] - 2: JS_NAME@129..131 - 0: IDENT@129..131 "y" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@131..135 - 0: EQ@131..133 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@133..135 - 0: JS_NUMBER_LITERAL@133..135 "42" [] [] - 2: R_BRACK@135..137 "]" [] [Whitespace(" ")] - 1: EQ@137..139 "=" [] [Whitespace(" ")] - 2: JS_ARRAY_EXPRESSION@139..143 - 0: L_BRACK@139..140 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@140..142 - 0: JS_NUMBER_LITERAL_EXPRESSION@140..142 - 0: JS_NUMBER_LITERAL@140..142 "23" [] [] - 2: R_BRACK@142..143 "]" [] [] - 1: SEMICOLON@143..144 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@144..301 - 0: JS_PARENTHESIZED_EXPRESSION@144..300 - 0: L_PAREN@144..146 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@146..299 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@146..288 - 0: L_CURLY@146..148 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@148..286 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@148..286 - 0: JS_LITERAL_MEMBER_NAME@148..149 - 0: IDENT@148..149 "x" [] [] - 1: COLON@149..151 ":" [] [Whitespace(" ")] - 2: JS_STATIC_MEMBER_ASSIGNMENT@151..281 - 0: JS_OBJECT_EXPRESSION@151..278 - 0: L_CURLY@151..152 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@152..276 - 0: JS_GETTER_OBJECT_MEMBER@152..236 - 0: GET_KW@152..159 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@159..160 - 0: IDENT@159..160 "y" [] [] - 2: L_PAREN@160..161 "(" [] [] - 3: R_PAREN@161..163 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@163..236 - 0: L_CURLY@163..164 "{" [] [] - 1: JS_DIRECTIVE_LIST@164..164 - 2: JS_STATEMENT_LIST@164..232 - 0: JS_THROW_STATEMENT@164..232 - 0: THROW_KW@164..175 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@175..231 - 0: NEW_KW@175..179 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@179..191 - 0: JS_REFERENCE_IDENTIFIER@179..191 - 0: IDENT@179..191 "Test262Error" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@191..231 - 0: L_PAREN@191..192 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@192..230 - 0: JS_STRING_LITERAL_EXPRESSION@192..230 - 0: JS_STRING_LITERAL@192..230 "'The property should not be accessed.'" [] [] - 2: R_PAREN@230..231 ")" [] [] - 2: SEMICOLON@231..232 ";" [] [] - 3: R_CURLY@232..236 "}" [Newline("\n"), Whitespace(" ")] [] - 1: COMMA@236..237 "," [] [] - 2: JS_SETTER_OBJECT_MEMBER@237..276 - 0: SET_KW@237..244 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@244..245 - 0: IDENT@244..245 "y" [] [] - 2: L_PAREN@245..246 "(" [] [] - 3: JS_FORMAL_PARAMETER@246..249 - 0: JS_DECORATOR_LIST@246..246 - 1: JS_IDENTIFIER_BINDING@246..249 - 0: IDENT@246..249 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@249..251 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@251..276 - 0: L_CURLY@251..252 "{" [] [] - 1: JS_DIRECTIVE_LIST@252..252 - 2: JS_STATEMENT_LIST@252..272 - 0: JS_EXPRESSION_STATEMENT@252..272 - 0: JS_ASSIGNMENT_EXPRESSION@252..271 - 0: JS_IDENTIFIER_ASSIGNMENT@252..266 - 0: IDENT@252..266 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: EQ@266..268 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@268..271 - 0: JS_REFERENCE_IDENTIFIER@268..271 - 0: IDENT@268..271 "val" [] [] - 1: SEMICOLON@271..272 ";" [] [] - 3: R_CURLY@272..276 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@276..278 "}" [Newline("\n")] [] - 1: DOT@278..279 "." [] [] - 2: JS_NAME@279..281 - 0: IDENT@279..281 "y" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@281..286 - 0: EQ@281..283 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@283..286 - 0: JS_NUMBER_LITERAL@283..286 "42" [] [Whitespace(" ")] - 2: R_CURLY@286..288 "}" [] [Whitespace(" ")] - 1: EQ@288..290 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@290..299 - 0: L_CURLY@290..292 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@292..298 - 0: JS_PROPERTY_OBJECT_MEMBER@292..298 - 0: JS_LITERAL_MEMBER_NAME@292..293 - 0: IDENT@292..293 "x" [] [] - 1: COLON@293..295 ":" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@295..298 - 0: JS_NUMBER_LITERAL@295..298 "23" [] [Whitespace(" ")] - 2: R_CURLY@298..299 "}" [] [] - 2: R_PAREN@299..300 ")" [] [] - 1: SEMICOLON@300..301 ";" [] [] - 4: EOF@301..302 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.rast b/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.rast deleted file mode 100644 index 9c370a772485..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.rast +++ /dev/null @@ -1,77 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..2 "a" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2..4 "?" [] [Whitespace(" ")], - consequent: JsParenthesizedExpression { - l_paren_token: L_PAREN@4..5 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@5..6 "b" [] [], - }, - }, - r_paren_token: R_PAREN@6..8 ")" [] [Whitespace(" ")], - }, - colon_token: COLON@8..10 ":" [] [Whitespace(" ")], - alternate: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@10..12 "a" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - ], - eof_token: EOF@18..19 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..19 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..18 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JS_CONDITIONAL_EXPRESSION@0..17 - 0: JS_IDENTIFIER_EXPRESSION@0..2 - 0: JS_REFERENCE_IDENTIFIER@0..2 - 0: IDENT@0..2 "a" [] [Whitespace(" ")] - 1: QUESTION@2..4 "?" [] [Whitespace(" ")] - 2: JS_PARENTHESIZED_EXPRESSION@4..8 - 0: L_PAREN@4..5 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@5..6 - 0: JS_REFERENCE_IDENTIFIER@5..6 - 0: IDENT@5..6 "b" [] [] - 2: R_PAREN@6..8 ")" [] [Whitespace(" ")] - 3: COLON@8..10 ":" [] [Whitespace(" ")] - 4: JS_ARROW_FUNCTION_EXPRESSION@10..17 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "a" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@15..17 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..16 - 3: R_CURLY@16..17 "}" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 4: EOF@18..19 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.rast b/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.rast deleted file mode 100644 index 3783bc797f31..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.rast +++ /dev/null @@ -1,143 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@0..14 "foo" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@19..26 "yield" [Newline("\n")] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@29..30 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@31..38 "await" [Newline("\n")] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@38..41 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@41..42 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@43..48 "baz" [Newline("\n")] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@48..50 "=>" [] [], - body: JsFunctionBody { - l_curly_token: L_CURLY@50..52 "{" [Newline("\n")] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@53..54 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..54 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..53 - 0: JS_EXPRESSION_STATEMENT@0..19 - 0: JS_ARROW_FUNCTION_EXPRESSION@0..19 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@0..14 - 0: IDENT@0..14 "foo" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@17..19 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..18 - 3: R_CURLY@18..19 "}" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@19..31 - 0: JS_ARROW_FUNCTION_EXPRESSION@19..31 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@19..26 - 0: IDENT@19..26 "yield" [Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@29..31 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_DIRECTIVE_LIST@30..30 - 2: JS_STATEMENT_LIST@30..30 - 3: R_CURLY@30..31 "}" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@31..43 - 0: JS_ARROW_FUNCTION_EXPRESSION@31..43 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@31..38 - 0: IDENT@31..38 "await" [Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@38..41 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@41..43 - 0: L_CURLY@41..42 "{" [] [] - 1: JS_DIRECTIVE_LIST@42..42 - 2: JS_STATEMENT_LIST@42..42 - 3: R_CURLY@42..43 "}" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@43..53 - 0: JS_ARROW_FUNCTION_EXPRESSION@43..53 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@43..48 - 0: IDENT@43..48 "baz" [Newline("\n")] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@48..50 "=>" [] [] - 5: JS_FUNCTION_BODY@50..53 - 0: L_CURLY@50..52 "{" [Newline("\n")] [] - 1: JS_DIRECTIVE_LIST@52..52 - 2: JS_STATEMENT_LIST@52..52 - 3: R_CURLY@52..53 "}" [] [] - 1: (empty) - 4: EOF@53..54 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.rast b/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.rast deleted file mode 100644 index 3e48b38eb5a6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.rast +++ /dev/null @@ -1,182 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@9..23 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@27..33 "(" [Newline("\n"), Whitespace(" ")] [], - items: JsParameterList [], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@40..45 "super" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@45..46 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@49..50 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@50..56 "(" [Newline("\n"), Whitespace(" ")] [], - items: JsParameterList [], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")], - body: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@61..66 "super" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@66..67 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@67..68 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@68..69 ";" [] [], - }, - ], - r_curly_token: R_CURLY@69..72 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@72..74 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..74 - 0: JS_CLASS_DECLARATION@0..74 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..72 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..72 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..23 - 0: IDENT@9..23 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@26..72 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..69 - 0: JS_EXPRESSION_STATEMENT@27..50 - 0: JS_ARROW_FUNCTION_EXPRESSION@27..49 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@27..35 - 0: L_PAREN@27..33 "(" [Newline("\n"), Whitespace(" ")] [] - 1: JS_PARAMETER_LIST@33..33 - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@38..49 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..48 - 0: JS_EXPRESSION_STATEMENT@40..48 - 0: JS_CALL_EXPRESSION@40..48 - 0: JS_SUPER_EXPRESSION@40..45 - 0: SUPER_KW@40..45 "super" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@45..48 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@46..46 - 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@48..49 "}" [] [] - 1: SEMICOLON@49..50 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@50..69 - 0: JS_ARROW_FUNCTION_EXPRESSION@50..68 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@50..58 - 0: L_PAREN@50..56 "(" [Newline("\n"), Whitespace(" ")] [] - 1: JS_PARAMETER_LIST@56..56 - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")] - 5: JS_CALL_EXPRESSION@61..68 - 0: JS_SUPER_EXPRESSION@61..66 - 0: SUPER_KW@61..66 "super" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@66..68 - 0: L_PAREN@66..67 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@67..67 - 2: R_PAREN@67..68 ")" [] [] - 1: SEMICOLON@68..69 ";" [] [] - 3: R_CURLY@69..72 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@72..74 "}" [Newline("\n")] [] - 4: EOF@74..75 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.rast b/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.rast deleted file mode 100644 index 27d23a3e645f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.rast +++ /dev/null @@ -1,118 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "eval" [] [], - }, - }, - dot_token: DOT@4..5 "." [] [], - member: JsName { - value_token: IDENT@5..9 "foo" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@9..11 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@11..13 "10" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..23 "arguments" [Newline("\n")] [], - }, - }, - l_brack_token: L_BRACK@23..24 "[" [] [], - member: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@24..25 "1" [] [], - }, - r_brack_token: R_BRACK@25..27 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@27..29 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@29..34 "\"baz\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@34..39 "eval" [Newline("\n")] [], - }, - }, - l_brack_token: L_BRACK@39..40 "[" [] [], - member: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@40..41 "2" [] [], - }, - r_brack_token: R_BRACK@41..43 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@43..45 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@45..64 "\"Chungking Express\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_ASSIGNMENT_EXPRESSION@0..13 - 0: JS_STATIC_MEMBER_ASSIGNMENT@0..9 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "eval" [] [] - 1: DOT@4..5 "." [] [] - 2: JS_NAME@5..9 - 0: IDENT@5..9 "foo" [] [Whitespace(" ")] - 1: EQ@9..11 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@11..13 - 0: JS_NUMBER_LITERAL@11..13 "10" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@13..34 - 0: JS_ASSIGNMENT_EXPRESSION@13..34 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@13..27 - 0: JS_IDENTIFIER_EXPRESSION@13..23 - 0: JS_REFERENCE_IDENTIFIER@13..23 - 0: IDENT@13..23 "arguments" [Newline("\n")] [] - 1: L_BRACK@23..24 "[" [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@24..25 - 0: JS_NUMBER_LITERAL@24..25 "1" [] [] - 3: R_BRACK@25..27 "]" [] [Whitespace(" ")] - 1: EQ@27..29 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@29..34 - 0: JS_STRING_LITERAL@29..34 "\"baz\"" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@34..64 - 0: JS_ASSIGNMENT_EXPRESSION@34..64 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@34..43 - 0: JS_IDENTIFIER_EXPRESSION@34..39 - 0: JS_REFERENCE_IDENTIFIER@34..39 - 0: IDENT@34..39 "eval" [Newline("\n")] [] - 1: L_BRACK@39..40 "[" [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@40..41 - 0: JS_NUMBER_LITERAL@40..41 "2" [] [] - 3: R_BRACK@41..43 "]" [] [Whitespace(" ")] - 1: EQ@43..45 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@45..64 - 0: JS_STRING_LITERAL@45..64 "\"Chungking Express\"" [] [] - 1: (empty) - 4: EOF@64..65 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_expr.rast b/crates/biome_js_parser/test_data/inline/ok/assign_expr.rast deleted file mode 100644 index 347859d74841..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/assign_expr.rast +++ /dev/null @@ -1,456 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@0..4 "foo" [] [Whitespace(" ")], - }, - operator_token: PLUSEQ@4..7 "+=" [] [Whitespace(" ")], - right: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@7..11 "bar" [] [Whitespace(" ")], - }, - operator_token: EQ@11..13 "=" [] [Whitespace(" ")], - right: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@13..15 "b" [] [Whitespace(" ")], - }, - operator_token: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@19..20 "3" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@21..26 "foo" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: MINUSEQ@26..29 "-=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@29..32 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@33..35 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@35..39 "foo" [] [Whitespace(" ")], - }, - operator_token: EQ@39..41 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..44 "bar" [] [], - }, - }, - }, - r_paren_token: R_PAREN@44..45 ")" [] [], - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@46..48 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@48..51 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@51..53 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@53..56 "bar" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@56..58 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@58..60 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@60..63 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@64..66 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@66..69 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@69..71 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@71..75 "bar" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@75..77 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@77..86 "\"default\"" [] [], - }, - }, - }, - COMMA@86..88 "," [] [Whitespace(" ")], - JsArrayAssignmentPatternRestElement { - dotdotdot_token: DOT3@88..91 "..." [] [], - pattern: JsIdentifierAssignment { - name_token: IDENT@91..95 "rest" [] [], - }, - }, - ], - r_brack_token: R_BRACK@95..97 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@97..99 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@99..102 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@102..103 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@103..105 "[" [Newline("\n")] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayHole, - COMMA@105..106 "," [] [], - JsArrayHole, - COMMA@106..107 "," [] [], - JsArrayHole, - COMMA@107..108 "," [] [], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@108..111 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@111..112 "," [] [], - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@112..115 "bar" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@115..117 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@117..119 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@119..122 "baz" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@122..123 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@123..125 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@125..127 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@127..130 "bar" [] [], - }, - init: missing (optional), - }, - COMMA@130..132 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@132..136 "baz" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@136..138 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@138..140 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@140..141 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@141..142 "}" [] [], - }, - }, - r_paren_token: R_PAREN@142..143 ")" [] [], - }, - semicolon_token: SEMICOLON@143..144 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@144..146 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@146..148 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@148..151 "bar" [] [], - }, - colon_token: COLON@151..153 ":" [] [Whitespace(" ")], - pattern: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@153..154 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@154..158 "baz" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@158..160 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@160..165 "\"baz\"" [] [], - }, - }, - }, - ], - r_brack_token: R_BRACK@165..166 "]" [] [], - }, - init: missing (optional), - }, - COMMA@166..168 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@168..172 "foo" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@172..174 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@174..179 "\"foo\"" [] [], - }, - }, - }, - COMMA@179..181 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@181..184 "..." [] [], - target: JsIdentifierAssignment { - name_token: IDENT@184..189 "rest" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@189..191 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@191..193 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@193..194 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@194..195 "}" [] [], - }, - }, - r_paren_token: R_PAREN@195..196 ")" [] [], - }, - semicolon_token: SEMICOLON@196..197 ";" [] [], - }, - ], - eof_token: EOF@197..198 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..198 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..197 - 0: JS_EXPRESSION_STATEMENT@0..21 - 0: JS_ASSIGNMENT_EXPRESSION@0..20 - 0: JS_IDENTIFIER_ASSIGNMENT@0..4 - 0: IDENT@0..4 "foo" [] [Whitespace(" ")] - 1: PLUSEQ@4..7 "+=" [] [Whitespace(" ")] - 2: JS_ASSIGNMENT_EXPRESSION@7..20 - 0: JS_IDENTIFIER_ASSIGNMENT@7..11 - 0: IDENT@7..11 "bar" [] [Whitespace(" ")] - 1: EQ@11..13 "=" [] [Whitespace(" ")] - 2: JS_ASSIGNMENT_EXPRESSION@13..20 - 0: JS_IDENTIFIER_ASSIGNMENT@13..15 - 0: IDENT@13..15 "b" [] [Whitespace(" ")] - 1: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@19..20 - 0: JS_NUMBER_LITERAL@19..20 "3" [] [] - 1: SEMICOLON@20..21 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@21..33 - 0: JS_ASSIGNMENT_EXPRESSION@21..32 - 0: JS_IDENTIFIER_ASSIGNMENT@21..26 - 0: IDENT@21..26 "foo" [Newline("\n")] [Whitespace(" ")] - 1: MINUSEQ@26..29 "-=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@29..32 - 0: JS_REFERENCE_IDENTIFIER@29..32 - 0: IDENT@29..32 "bar" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..46 - 0: JS_PARENTHESIZED_EXPRESSION@33..45 - 0: L_PAREN@33..35 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@35..44 - 0: JS_IDENTIFIER_ASSIGNMENT@35..39 - 0: IDENT@35..39 "foo" [] [Whitespace(" ")] - 1: EQ@39..41 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@41..44 - 0: JS_REFERENCE_IDENTIFIER@41..44 - 0: IDENT@41..44 "bar" [] [] - 2: R_PAREN@44..45 ")" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@46..64 - 0: JS_ASSIGNMENT_EXPRESSION@46..63 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@46..58 - 0: L_BRACK@46..48 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@48..56 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@48..51 - 0: JS_IDENTIFIER_ASSIGNMENT@48..51 - 0: IDENT@48..51 "foo" [] [] - 1: (empty) - 1: COMMA@51..53 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@53..56 - 0: JS_IDENTIFIER_ASSIGNMENT@53..56 - 0: IDENT@53..56 "bar" [] [] - 1: (empty) - 2: R_BRACK@56..58 "]" [] [Whitespace(" ")] - 1: EQ@58..60 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@60..63 - 0: JS_REFERENCE_IDENTIFIER@60..63 - 0: IDENT@60..63 "baz" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@64..103 - 0: JS_ASSIGNMENT_EXPRESSION@64..102 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@64..97 - 0: L_BRACK@64..66 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@66..95 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@66..69 - 0: JS_IDENTIFIER_ASSIGNMENT@66..69 - 0: IDENT@66..69 "foo" [] [] - 1: (empty) - 1: COMMA@69..71 "," [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@71..86 - 0: JS_IDENTIFIER_ASSIGNMENT@71..75 - 0: IDENT@71..75 "bar" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@75..86 - 0: EQ@75..77 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@77..86 - 0: JS_STRING_LITERAL@77..86 "\"default\"" [] [] - 3: COMMA@86..88 "," [] [Whitespace(" ")] - 4: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@88..95 - 0: DOT3@88..91 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@91..95 - 0: IDENT@91..95 "rest" [] [] - 2: R_BRACK@95..97 "]" [] [Whitespace(" ")] - 1: EQ@97..99 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@99..102 - 0: JS_REFERENCE_IDENTIFIER@99..102 - 0: IDENT@99..102 "baz" [] [] - 1: SEMICOLON@102..103 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@103..123 - 0: JS_ASSIGNMENT_EXPRESSION@103..122 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@103..117 - 0: L_BRACK@103..105 "[" [Newline("\n")] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@105..115 - 0: JS_ARRAY_HOLE@105..105 - 1: COMMA@105..106 "," [] [] - 2: JS_ARRAY_HOLE@106..106 - 3: COMMA@106..107 "," [] [] - 4: JS_ARRAY_HOLE@107..107 - 5: COMMA@107..108 "," [] [] - 6: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@108..111 - 0: JS_IDENTIFIER_ASSIGNMENT@108..111 - 0: IDENT@108..111 "foo" [] [] - 1: (empty) - 7: COMMA@111..112 "," [] [] - 8: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@112..115 - 0: JS_IDENTIFIER_ASSIGNMENT@112..115 - 0: IDENT@112..115 "bar" [] [] - 1: (empty) - 2: R_BRACK@115..117 "]" [] [Whitespace(" ")] - 1: EQ@117..119 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@119..122 - 0: JS_REFERENCE_IDENTIFIER@119..122 - 0: IDENT@119..122 "baz" [] [] - 1: SEMICOLON@122..123 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@123..144 - 0: JS_PARENTHESIZED_EXPRESSION@123..143 - 0: L_PAREN@123..125 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@125..142 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@125..138 - 0: L_CURLY@125..127 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@127..136 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@127..130 - 0: JS_IDENTIFIER_ASSIGNMENT@127..130 - 0: IDENT@127..130 "bar" [] [] - 1: (empty) - 1: COMMA@130..132 "," [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@132..136 - 0: JS_IDENTIFIER_ASSIGNMENT@132..136 - 0: IDENT@132..136 "baz" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@136..138 "}" [] [Whitespace(" ")] - 1: EQ@138..140 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@140..142 - 0: L_CURLY@140..141 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@141..141 - 2: R_CURLY@141..142 "}" [] [] - 2: R_PAREN@142..143 ")" [] [] - 1: SEMICOLON@143..144 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@144..197 - 0: JS_PARENTHESIZED_EXPRESSION@144..196 - 0: L_PAREN@144..146 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@146..195 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@146..191 - 0: L_CURLY@146..148 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@148..189 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@148..166 - 0: JS_LITERAL_MEMBER_NAME@148..151 - 0: IDENT@148..151 "bar" [] [] - 1: COLON@151..153 ":" [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN@153..166 - 0: L_BRACK@153..154 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@154..165 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@154..165 - 0: JS_IDENTIFIER_ASSIGNMENT@154..158 - 0: IDENT@154..158 "baz" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@158..165 - 0: EQ@158..160 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@160..165 - 0: JS_STRING_LITERAL@160..165 "\"baz\"" [] [] - 2: R_BRACK@165..166 "]" [] [] - 3: (empty) - 1: COMMA@166..168 "," [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@168..179 - 0: JS_IDENTIFIER_ASSIGNMENT@168..172 - 0: IDENT@168..172 "foo" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@172..179 - 0: EQ@172..174 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@174..179 - 0: JS_STRING_LITERAL@174..179 "\"foo\"" [] [] - 3: COMMA@179..181 "," [] [Whitespace(" ")] - 4: JS_OBJECT_ASSIGNMENT_PATTERN_REST@181..189 - 0: DOT3@181..184 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@184..189 - 0: IDENT@184..189 "rest" [] [Whitespace(" ")] - 2: R_CURLY@189..191 "}" [] [Whitespace(" ")] - 1: EQ@191..193 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@193..195 - 0: L_CURLY@193..194 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@194..194 - 2: R_CURLY@194..195 "}" [] [] - 2: R_PAREN@195..196 ")" [] [] - 1: SEMICOLON@196..197 ";" [] [] - 4: EOF@197..198 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast b/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast deleted file mode 100644 index 56f3e55091d7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast +++ /dev/null @@ -1,110 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForOfStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@5..7 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@7..13 "arrow" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@13..15 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@15..16 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@21..22 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@22..24 "}" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], - }, - of_token: OF_KW@26..29 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@29..30 "[" [] [], - elements: JsArrayElementList [ - JsObjectExpression { - l_curly_token: L_CURLY@30..31 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - ], - r_brack_token: R_BRACK@32..33 "]" [] [], - }, - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@35..36 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - }, - ], - eof_token: EOF@37..38 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..38 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..37 - 0: JS_FOR_OF_STATEMENT@0..37 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@4..5 "(" [] [] - 3: JS_OBJECT_ASSIGNMENT_PATTERN@5..26 - 0: L_CURLY@5..7 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@7..24 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@7..24 - 0: JS_IDENTIFIER_ASSIGNMENT@7..13 - 0: IDENT@7..13 "arrow" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@13..24 - 0: EQ@13..15 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@15..24 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@15..18 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_PARAMETER_LIST@16..16 - 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@21..24 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_DIRECTIVE_LIST@22..22 - 2: JS_STATEMENT_LIST@22..22 - 3: R_CURLY@22..24 "}" [] [Whitespace(" ")] - 2: R_CURLY@24..26 "}" [] [Whitespace(" ")] - 4: OF_KW@26..29 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@29..33 - 0: L_BRACK@29..30 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@30..32 - 0: JS_OBJECT_EXPRESSION@30..32 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@31..31 - 2: R_CURLY@31..32 "}" [] [] - 2: R_BRACK@32..33 "]" [] [] - 6: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@35..37 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_STATEMENT_LIST@36..36 - 2: R_CURLY@36..37 "}" [] [] - 4: EOF@37..38 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_target.rast b/crates/biome_js_parser/test_data/inline/ok/assignment_target.rast deleted file mode 100644 index 41bce70fcb30..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/assignment_target.rast +++ /dev/null @@ -1,379 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@0..4 "foo" [] [Whitespace(" ")], - }, - operator_token: PLUSEQ@4..7 "+=" [] [Whitespace(" ")], - right: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@7..11 "bar" [] [Whitespace(" ")], - }, - operator_token: EQ@11..13 "=" [] [Whitespace(" ")], - right: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@13..15 "b" [] [Whitespace(" ")], - }, - operator_token: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@19..20 "3" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..23 "a" [Newline("\n")] [], - }, - }, - dot_token: DOT@23..24 "." [] [], - member: JsName { - value_token: IDENT@24..28 "foo" [] [Whitespace(" ")], - }, - }, - operator_token: MINUSEQ@28..31 "-=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..34 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@35..37 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@37..41 "foo" [] [Whitespace(" ")], - }, - operator_token: EQ@41..43 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..46 "bar" [] [], - }, - }, - }, - r_paren_token: R_PAREN@46..47 ")" [] [], - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@48..50 "(" [Newline("\n")] [], - assignment: JsParenthesizedAssignment { - l_paren_token: L_PAREN@50..51 "(" [] [], - assignment: JsParenthesizedAssignment { - l_paren_token: L_PAREN@51..52 "(" [] [], - assignment: JsIdentifierAssignment { - name_token: IDENT@52..55 "foo" [] [], - }, - r_paren_token: R_PAREN@55..56 ")" [] [], - }, - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@59..61 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@61..64 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@64..65 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@65..67 "a" [Newline("\n")] [], - }, - }, - l_brack_token: L_BRACK@67..68 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@68..74 "\"test\"" [] [], - }, - r_brack_token: R_BRACK@74..76 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@76..78 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..81 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@81..82 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@82..84 "a" [Newline("\n")] [], - }, - }, - operator_token: DOT@84..85 "." [] [], - member: JsName { - value_token: IDENT@85..89 "call" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@89..90 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@90..91 ")" [] [], - }, - }, - operator_token: DOT@91..92 "." [] [], - member: JsName { - value_token: IDENT@92..97 "chain" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@97..98 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@98..99 ")" [] [], - }, - }, - dot_token: DOT@99..100 "." [] [], - member: JsName { - value_token: IDENT@100..107 "member" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@107..109 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@109..110 "x" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@110..111 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsPreUpdateExpression { - operator_token: PLUS2@111..114 "++" [Newline("\n")] [], - operand: JsIdentifierAssignment { - name_token: IDENT@114..120 "count" [] [Whitespace(" ")], - }, - }, - operator_token: EQ3@120..124 "===" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@124..125 "3" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@125..127 "a" [Newline("\n")] [], - }, - }, - l_brack_token: L_BRACK@127..128 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@128..131 "'b'" [] [], - }, - r_brack_token: R_BRACK@131..133 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@133..135 "=" [] [Whitespace(" ")], - right: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@135..136 "c" [] [], - }, - }, - l_brack_token: L_BRACK@136..137 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..138 "d" [] [], - }, - }, - r_brack_token: R_BRACK@138..140 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@140..142 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@142..148 "\"test\"" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@148..149 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..149 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..148 - 0: JS_EXPRESSION_STATEMENT@0..21 - 0: JS_ASSIGNMENT_EXPRESSION@0..20 - 0: JS_IDENTIFIER_ASSIGNMENT@0..4 - 0: IDENT@0..4 "foo" [] [Whitespace(" ")] - 1: PLUSEQ@4..7 "+=" [] [Whitespace(" ")] - 2: JS_ASSIGNMENT_EXPRESSION@7..20 - 0: JS_IDENTIFIER_ASSIGNMENT@7..11 - 0: IDENT@7..11 "bar" [] [Whitespace(" ")] - 1: EQ@11..13 "=" [] [Whitespace(" ")] - 2: JS_ASSIGNMENT_EXPRESSION@13..20 - 0: JS_IDENTIFIER_ASSIGNMENT@13..15 - 0: IDENT@13..15 "b" [] [Whitespace(" ")] - 1: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@19..20 - 0: JS_NUMBER_LITERAL@19..20 "3" [] [] - 1: SEMICOLON@20..21 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@21..35 - 0: JS_ASSIGNMENT_EXPRESSION@21..34 - 0: JS_STATIC_MEMBER_ASSIGNMENT@21..28 - 0: JS_IDENTIFIER_EXPRESSION@21..23 - 0: JS_REFERENCE_IDENTIFIER@21..23 - 0: IDENT@21..23 "a" [Newline("\n")] [] - 1: DOT@23..24 "." [] [] - 2: JS_NAME@24..28 - 0: IDENT@24..28 "foo" [] [Whitespace(" ")] - 1: MINUSEQ@28..31 "-=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@31..34 - 0: JS_REFERENCE_IDENTIFIER@31..34 - 0: IDENT@31..34 "bar" [] [] - 1: SEMICOLON@34..35 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@35..48 - 0: JS_PARENTHESIZED_EXPRESSION@35..47 - 0: L_PAREN@35..37 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@37..46 - 0: JS_IDENTIFIER_ASSIGNMENT@37..41 - 0: IDENT@37..41 "foo" [] [Whitespace(" ")] - 1: EQ@41..43 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@43..46 - 0: JS_REFERENCE_IDENTIFIER@43..46 - 0: IDENT@43..46 "bar" [] [] - 2: R_PAREN@46..47 ")" [] [] - 1: SEMICOLON@47..48 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@48..65 - 0: JS_ASSIGNMENT_EXPRESSION@48..64 - 0: JS_PARENTHESIZED_ASSIGNMENT@48..59 - 0: L_PAREN@48..50 "(" [Newline("\n")] [] - 1: JS_PARENTHESIZED_ASSIGNMENT@50..57 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_PARENTHESIZED_ASSIGNMENT@51..56 - 0: L_PAREN@51..52 "(" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@52..55 - 0: IDENT@52..55 "foo" [] [] - 2: R_PAREN@55..56 ")" [] [] - 2: R_PAREN@56..57 ")" [] [] - 2: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 1: EQ@59..61 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@61..64 - 0: JS_REFERENCE_IDENTIFIER@61..64 - 0: IDENT@61..64 "bar" [] [] - 1: SEMICOLON@64..65 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@65..82 - 0: JS_ASSIGNMENT_EXPRESSION@65..81 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@65..76 - 0: JS_IDENTIFIER_EXPRESSION@65..67 - 0: JS_REFERENCE_IDENTIFIER@65..67 - 0: IDENT@65..67 "a" [Newline("\n")] [] - 1: L_BRACK@67..68 "[" [] [] - 2: JS_STRING_LITERAL_EXPRESSION@68..74 - 0: JS_STRING_LITERAL@68..74 "\"test\"" [] [] - 3: R_BRACK@74..76 "]" [] [Whitespace(" ")] - 1: EQ@76..78 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@78..81 - 0: JS_REFERENCE_IDENTIFIER@78..81 - 0: IDENT@78..81 "bar" [] [] - 1: SEMICOLON@81..82 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@82..111 - 0: JS_ASSIGNMENT_EXPRESSION@82..110 - 0: JS_STATIC_MEMBER_ASSIGNMENT@82..107 - 0: JS_CALL_EXPRESSION@82..99 - 0: JS_STATIC_MEMBER_EXPRESSION@82..97 - 0: JS_CALL_EXPRESSION@82..91 - 0: JS_STATIC_MEMBER_EXPRESSION@82..89 - 0: JS_IDENTIFIER_EXPRESSION@82..84 - 0: JS_REFERENCE_IDENTIFIER@82..84 - 0: IDENT@82..84 "a" [Newline("\n")] [] - 1: DOT@84..85 "." [] [] - 2: JS_NAME@85..89 - 0: IDENT@85..89 "call" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@89..91 - 0: L_PAREN@89..90 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@90..90 - 2: R_PAREN@90..91 ")" [] [] - 1: DOT@91..92 "." [] [] - 2: JS_NAME@92..97 - 0: IDENT@92..97 "chain" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@97..99 - 0: L_PAREN@97..98 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@98..98 - 2: R_PAREN@98..99 ")" [] [] - 1: DOT@99..100 "." [] [] - 2: JS_NAME@100..107 - 0: IDENT@100..107 "member" [] [Whitespace(" ")] - 1: EQ@107..109 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@109..110 - 0: JS_REFERENCE_IDENTIFIER@109..110 - 0: IDENT@109..110 "x" [] [] - 1: SEMICOLON@110..111 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@111..125 - 0: JS_BINARY_EXPRESSION@111..125 - 0: JS_PRE_UPDATE_EXPRESSION@111..120 - 0: PLUS2@111..114 "++" [Newline("\n")] [] - 1: JS_IDENTIFIER_ASSIGNMENT@114..120 - 0: IDENT@114..120 "count" [] [Whitespace(" ")] - 1: EQ3@120..124 "===" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@124..125 - 0: JS_NUMBER_LITERAL@124..125 "3" [] [] - 1: (empty) - 7: JS_EXPRESSION_STATEMENT@125..148 - 0: JS_ASSIGNMENT_EXPRESSION@125..148 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@125..133 - 0: JS_IDENTIFIER_EXPRESSION@125..127 - 0: JS_REFERENCE_IDENTIFIER@125..127 - 0: IDENT@125..127 "a" [Newline("\n")] [] - 1: L_BRACK@127..128 "[" [] [] - 2: JS_STRING_LITERAL_EXPRESSION@128..131 - 0: JS_STRING_LITERAL@128..131 "'b'" [] [] - 3: R_BRACK@131..133 "]" [] [Whitespace(" ")] - 1: EQ@133..135 "=" [] [Whitespace(" ")] - 2: JS_ASSIGNMENT_EXPRESSION@135..148 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@135..140 - 0: JS_IDENTIFIER_EXPRESSION@135..136 - 0: JS_REFERENCE_IDENTIFIER@135..136 - 0: IDENT@135..136 "c" [] [] - 1: L_BRACK@136..137 "[" [] [] - 2: JS_IDENTIFIER_EXPRESSION@137..138 - 0: JS_REFERENCE_IDENTIFIER@137..138 - 0: IDENT@137..138 "d" [] [] - 3: R_BRACK@138..140 "]" [] [Whitespace(" ")] - 1: EQ@140..142 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@142..148 - 0: JS_STRING_LITERAL@142..148 "\"test\"" [] [] - 1: (empty) - 4: EOF@148..149 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.rast b/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.rast deleted file mode 100644 index 2bb2555a6048..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.rast +++ /dev/null @@ -1,234 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@8..14 "async" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@14..18 "foo" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@21..22 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@28..30 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@30..32 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@32..38 "async" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@39..42 "bar" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@47..48 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@49..56 "async" [Newline("\n")] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@56..57 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@57..60 "foo" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@60..62 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@62..65 "bar" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@65..67 "," [] [Whitespace(" ")], - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@67..70 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@70..73 "baz" [] [], - }, - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@73..75 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@75..78 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..81 "foo" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@81..82 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..82 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..81 - 0: JS_VARIABLE_STATEMENT@0..23 - 0: JS_VARIABLE_DECLARATION@0..23 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..23 - 0: JS_VARIABLE_DECLARATOR@4..23 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..23 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@8..23 - 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_BINDING@14..18 - 0: IDENT@14..18 "foo" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@21..23 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_DIRECTIVE_LIST@22..22 - 2: JS_STATEMENT_LIST@22..22 - 3: R_CURLY@22..23 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@23..49 - 0: JS_VARIABLE_DECLARATION@23..49 - 0: (empty) - 1: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@28..49 - 0: JS_VARIABLE_DECLARATOR@28..49 - 0: JS_IDENTIFIER_BINDING@28..30 - 0: IDENT@28..30 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@30..49 - 0: EQ@30..32 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@32..49 - 0: ASYNC_KW@32..38 "async" [] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@38..44 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..42 - 0: JS_FORMAL_PARAMETER@39..42 - 0: JS_DECORATOR_LIST@39..39 - 1: JS_IDENTIFIER_BINDING@39..42 - 0: IDENT@39..42 "bar" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@47..49 - 0: L_CURLY@47..48 "{" [] [] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..48 - 3: R_CURLY@48..49 "}" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@49..81 - 0: JS_ARROW_FUNCTION_EXPRESSION@49..81 - 0: ASYNC_KW@49..56 "async" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@56..75 - 0: L_PAREN@56..57 "(" [] [] - 1: JS_PARAMETER_LIST@57..73 - 0: JS_FORMAL_PARAMETER@57..60 - 0: JS_DECORATOR_LIST@57..57 - 1: JS_IDENTIFIER_BINDING@57..60 - 0: IDENT@57..60 "foo" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@60..62 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@62..65 - 0: JS_DECORATOR_LIST@62..62 - 1: JS_IDENTIFIER_BINDING@62..65 - 0: IDENT@62..65 "bar" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@65..67 "," [] [Whitespace(" ")] - 4: JS_REST_PARAMETER@67..73 - 0: JS_DECORATOR_LIST@67..67 - 1: DOT3@67..70 "..." [] [] - 2: JS_IDENTIFIER_BINDING@70..73 - 0: IDENT@70..73 "baz" [] [] - 3: (empty) - 2: R_PAREN@73..75 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@75..78 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@78..81 - 0: JS_REFERENCE_IDENTIFIER@78..81 - 0: IDENT@78..81 "foo" [] [] - 1: (empty) - 4: EOF@81..82 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.rast deleted file mode 100644 index 4458f99537e6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.rast +++ /dev/null @@ -1,63 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..5 "async" [] [], - }, - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - body: JsForOfStatement { - for_token: FOR_KW@7..10 "for" [] [], - await_token: missing (optional), - l_paren_token: L_PAREN@10..11 "(" [] [], - initializer: JsIdentifierAssignment { - name_token: IDENT@11..13 "a" [] [Whitespace(" ")], - }, - of_token: OF_KW@13..16 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "b" [] [], - }, - }, - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - body: JsContinueStatement { - continue_token: CONTINUE_KW@19..28 "continue" [] [Whitespace(" ")], - label: JsLabel { - value_token: IDENT@28..33 "async" [] [], - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - }, - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_LABELED_STATEMENT@0..34 - 0: JS_LABEL@0..5 - 0: IDENT@0..5 "async" [] [] - 1: COLON@5..7 ":" [] [Whitespace(" ")] - 2: JS_FOR_OF_STATEMENT@7..34 - 0: FOR_KW@7..10 "for" [] [] - 1: (empty) - 2: L_PAREN@10..11 "(" [] [] - 3: JS_IDENTIFIER_ASSIGNMENT@11..13 - 0: IDENT@11..13 "a" [] [Whitespace(" ")] - 4: OF_KW@13..16 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "b" [] [] - 6: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 7: JS_CONTINUE_STATEMENT@19..34 - 0: CONTINUE_KW@19..28 "continue" [] [Whitespace(" ")] - 1: JS_LABEL@28..33 - 0: IDENT@28..33 "async" [] [] - 2: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/async_function_expr.rast b/crates/biome_js_parser/test_data/inline/ok/async_function_expr.rast deleted file mode 100644 index f663be43b0de..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/async_function_expr.rast +++ /dev/null @@ -1,148 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: ASYNC_KW@8..14 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@14..22 "function" [] [], - star_token: missing (optional), - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@33..35 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@35..37 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: ASYNC_KW@37..43 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@43..52 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@52..55 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@55..56 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - ], - eof_token: EOF@61..62 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..62 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..61 - 0: JS_VARIABLE_STATEMENT@0..28 - 0: JS_VARIABLE_DECLARATION@0..27 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..27 - 0: JS_VARIABLE_DECLARATOR@4..27 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..27 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@8..27 - 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@14..22 "function" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@22..25 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_PARAMETER_LIST@23..23 - 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..26 - 3: R_CURLY@26..27 "}" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_VARIABLE_STATEMENT@28..61 - 0: JS_VARIABLE_DECLARATION@28..60 - 0: (empty) - 1: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@33..60 - 0: JS_VARIABLE_DECLARATOR@33..60 - 0: JS_IDENTIFIER_BINDING@33..35 - 0: IDENT@33..35 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@35..60 - 0: EQ@35..37 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@37..60 - 0: ASYNC_KW@37..43 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@43..52 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@52..55 - 0: IDENT@52..55 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@55..58 - 0: L_PAREN@55..56 "(" [] [] - 1: JS_PARAMETER_LIST@56..56 - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@58..60 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..60 "}" [] [] - 1: SEMICOLON@60..61 ";" [] [] - 4: EOF@61..62 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/async_ident.rast b/crates/biome_js_parser/test_data/inline/ok/async_ident.rast deleted file mode 100644 index 43293d9c1213..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/async_ident.rast +++ /dev/null @@ -1,53 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..13 "async" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - ], - eof_token: EOF@14..15 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..15 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..14 - 0: JS_VARIABLE_STATEMENT@0..14 - 0: JS_VARIABLE_DECLARATION@0..13 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..13 - 0: JS_VARIABLE_DECLARATOR@4..13 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..13 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@8..13 - 0: JS_REFERENCE_IDENTIFIER@8..13 - 0: IDENT@8..13 "async" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 4: EOF@14..15 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/async_method.rast b/crates/biome_js_parser/test_data/inline/ok/async_method.rast deleted file mode 100644 index a54dbbc30b66..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/async_method.rast +++ /dev/null @@ -1,122 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@11..19 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@19..22 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@27..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: STAR@35..36 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@36..39 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@39..40 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@42..43 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@46..47 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_CLASS_DECLARATION@0..46 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..44 - 0: JS_METHOD_CLASS_MEMBER@11..27 - 0: JS_METHOD_MODIFIER_LIST@11..11 - 1: ASYNC_KW@11..19 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@19..22 - 0: IDENT@19..22 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@22..25 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_PARAMETER_LIST@23..23 - 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..26 - 3: R_CURLY@26..27 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@27..44 - 0: JS_METHOD_MODIFIER_LIST@27..27 - 1: ASYNC_KW@27..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: STAR@35..36 "*" [] [] - 3: JS_LITERAL_MEMBER_NAME@36..39 - 0: IDENT@36..39 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@39..42 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_PARAMETER_LIST@40..40 - 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@42..44 - 0: L_CURLY@42..43 "{" [] [] - 1: JS_DIRECTIVE_LIST@43..43 - 2: JS_STATEMENT_LIST@43..43 - 3: R_CURLY@43..44 "}" [] [] - 9: R_CURLY@44..46 "}" [Newline("\n")] [] - 4: EOF@46..47 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/await_expression.rast b/crates/biome_js_parser/test_data/inline/ok/await_expression.rast deleted file mode 100644 index 6bc51ace81d3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/await_expression.rast +++ /dev/null @@ -1,248 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@15..19 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@19..20 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@23..32 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..37 "inner" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@37..38 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@38..39 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@39..40 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsAwaitExpression { - await_token: AWAIT_KW@40..49 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@49..50 "(" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@50..55 "inner" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@55..56 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - }, - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@59..61 "+" [] [Whitespace(" ")], - right: JsAwaitExpression { - await_token: AWAIT_KW@61..67 "await" [] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@67..72 "inner" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@72..73 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@73..74 ")" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@74..75 ";" [] [], - }, - ], - r_curly_token: R_CURLY@75..77 "}" [Newline("\n")] [], - }, - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@93..98 "inner" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@98..99 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@101..102 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@102..112 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@112..113 "4" [] [], - }, - semicolon_token: SEMICOLON@113..114 ";" [] [], - }, - ], - r_curly_token: R_CURLY@114..116 "}" [Newline("\n")] [], - }, - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@123..127 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@127..128 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@128..129 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@129..130 ";" [] [], - }, - ], - eof_token: EOF@130..131 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..131 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..130 - 0: JS_FUNCTION_DECLARATION@0..77 - 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@15..19 - 0: IDENT@15..19 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@19..22 - 0: L_PAREN@19..20 "(" [] [] - 1: JS_PARAMETER_LIST@20..20 - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@22..77 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..75 - 0: JS_EXPRESSION_STATEMENT@23..40 - 0: JS_AWAIT_EXPRESSION@23..39 - 0: AWAIT_KW@23..32 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@32..39 - 0: JS_IDENTIFIER_EXPRESSION@32..37 - 0: JS_REFERENCE_IDENTIFIER@32..37 - 0: IDENT@32..37 "inner" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@37..39 - 0: L_PAREN@37..38 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@38..38 - 2: R_PAREN@38..39 ")" [] [] - 1: SEMICOLON@39..40 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@40..75 - 0: JS_BINARY_EXPRESSION@40..74 - 0: JS_AWAIT_EXPRESSION@40..59 - 0: AWAIT_KW@40..49 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@49..59 - 0: L_PAREN@49..50 "(" [] [] - 1: JS_CALL_EXPRESSION@50..57 - 0: JS_IDENTIFIER_EXPRESSION@50..55 - 0: JS_REFERENCE_IDENTIFIER@50..55 - 0: IDENT@50..55 "inner" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@55..57 - 0: L_PAREN@55..56 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@56..56 - 2: R_PAREN@56..57 ")" [] [] - 2: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 1: PLUS@59..61 "+" [] [Whitespace(" ")] - 2: JS_AWAIT_EXPRESSION@61..74 - 0: AWAIT_KW@61..67 "await" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@67..74 - 0: JS_IDENTIFIER_EXPRESSION@67..72 - 0: JS_REFERENCE_IDENTIFIER@67..72 - 0: IDENT@67..72 "inner" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@72..74 - 0: L_PAREN@72..73 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@73..73 - 2: R_PAREN@73..74 ")" [] [] - 1: SEMICOLON@74..75 ";" [] [] - 3: R_CURLY@75..77 "}" [Newline("\n")] [] - 1: JS_FUNCTION_DECLARATION@77..116 - 0: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@93..98 - 0: IDENT@93..98 "inner" [] [] - 4: (empty) - 5: JS_PARAMETERS@98..101 - 0: L_PAREN@98..99 "(" [] [] - 1: JS_PARAMETER_LIST@99..99 - 2: R_PAREN@99..101 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@101..116 - 0: L_CURLY@101..102 "{" [] [] - 1: JS_DIRECTIVE_LIST@102..102 - 2: JS_STATEMENT_LIST@102..114 - 0: JS_RETURN_STATEMENT@102..114 - 0: RETURN_KW@102..112 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@112..113 - 0: JS_NUMBER_LITERAL@112..113 "4" [] [] - 2: SEMICOLON@113..114 ";" [] [] - 3: R_CURLY@114..116 "}" [Newline("\n")] [] - 2: JS_EXPRESSION_STATEMENT@116..130 - 0: JS_AWAIT_EXPRESSION@116..129 - 0: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@123..129 - 0: JS_IDENTIFIER_EXPRESSION@123..127 - 0: JS_REFERENCE_IDENTIFIER@123..127 - 0: IDENT@123..127 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@127..129 - 0: L_PAREN@127..128 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@128..128 - 2: R_PAREN@128..129 ")" [] [] - 1: SEMICOLON@129..130 ";" [] [] - 4: EOF@130..131 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.rast b/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.rast deleted file mode 100644 index 0a3e988672bb..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.rast +++ /dev/null @@ -1,55 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..19 "await" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@19..21 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@21..24 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - }, - ], - eof_token: EOF@25..26 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..26 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..25 - 0: TS_DECLARE_STATEMENT@0..25 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@8..25 - 0: JS_VARIABLE_DECLARATION@8..24 - 0: (empty) - 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..24 - 0: JS_VARIABLE_DECLARATOR@14..24 - 0: JS_IDENTIFIER_BINDING@14..19 - 0: IDENT@14..19 "await" [] [] - 1: TS_TYPE_ANNOTATION@19..24 - 0: COLON@19..21 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@21..24 - 0: ANY_KW@21..24 "any" [] [] - 2: (empty) - 1: SEMICOLON@24..25 ";" [] [] - 4: EOF@25..26 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/binary_expressions.rast b/crates/biome_js_parser/test_data/inline/ok/binary_expressions.rast deleted file mode 100644 index a8f24cf8c689..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/binary_expressions.rast +++ /dev/null @@ -1,506 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..2 "5" [] [Whitespace(" ")], - }, - operator_token: STAR@2..4 "*" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@4..5 "5" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@5..8 "6" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: STAR2@8..11 "**" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@11..13 "6" [] [Whitespace(" ")], - }, - operator_token: STAR2@13..16 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@16..17 "7" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@17..20 "1" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: PLUS@20..22 "+" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@22..24 "2" [] [Whitespace(" ")], - }, - operator_token: STAR@24..26 "*" [] [Whitespace(" ")], - right: JsCallExpression { - callee: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@26..27 "3" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@27..29 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@29..31 "1" [] [Whitespace(" ")], - }, - operator_token: PLUS@31..33 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@33..34 "2" [] [], - }, - }, - ], - r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], - }, - }, - }, - operator_token: STAR@36..38 "*" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@38..39 "3" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@39..42 "1" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: SLASH@42..44 "/" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@44..45 "2" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsInExpression { - property: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@45..49 "74" [Newline("\n")] [Whitespace(" ")], - }, - in_token: IN_KW@49..52 "in" [] [Whitespace(" ")], - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@52..55 "foo" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsInstanceofExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..60 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - instanceof_token: INSTANCEOF_KW@60..71 "instanceof" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@71..76 "Array" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@76..81 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: QUESTION2@81..84 "??" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..87 "bar" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@87..90 "a" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: SHR@90..93 ">>" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@93..94 "b" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@94..97 "a" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: USHR@97..101 ">>>" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@101..102 "b" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@102..105 "1" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: PLUS@105..107 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@107..109 "1" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@109..111 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@111..113 "1" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@113..115 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@115..116 "1" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@116..119 "5" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: PLUS@119..121 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@121..123 "6" [] [Whitespace(" ")], - }, - }, - operator_token: MINUS@123..125 "-" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@125..127 "1" [] [Whitespace(" ")], - }, - operator_token: STAR@127..129 "*" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@129..131 "2" [] [Whitespace(" ")], - }, - }, - operator_token: SLASH@131..133 "/" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@133..135 "1" [] [Whitespace(" ")], - }, - operator_token: STAR2@135..138 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@138..139 "6" [] [], - }, - }, - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@146..151 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@151..153 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@153..154 "#" [] [], - id_token: IDENT@154..158 "name" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@158..160 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@160..164 "test" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@164..165 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@165..167 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@167..169 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsBooleanLiteralExpression { - value_token: TRUE_KW@169..174 "true" [] [Whitespace(" ")], - }, - operator_token: AMP2@174..177 "&&" [] [Whitespace(" ")], - right: JsInExpression { - property: JsPrivateName { - hash_token: HASH@177..178 "#" [] [], - value_token: IDENT@178..183 "name" [] [Whitespace(" ")], - }, - in_token: IN_KW@183..186 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@186..187 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@187..189 "}" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@189..191 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@191..192 "}" [] [], - }, - ], - eof_token: EOF@192..193 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..193 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..192 - 0: JS_EXPRESSION_STATEMENT@0..5 - 0: JS_BINARY_EXPRESSION@0..5 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 - 0: JS_NUMBER_LITERAL@0..2 "5" [] [Whitespace(" ")] - 1: STAR@2..4 "*" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@4..5 - 0: JS_NUMBER_LITERAL@4..5 "5" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@5..17 - 0: JS_BINARY_EXPRESSION@5..17 - 0: JS_NUMBER_LITERAL_EXPRESSION@5..8 - 0: JS_NUMBER_LITERAL@5..8 "6" [Newline("\n")] [Whitespace(" ")] - 1: STAR2@8..11 "**" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@11..17 - 0: JS_NUMBER_LITERAL_EXPRESSION@11..13 - 0: JS_NUMBER_LITERAL@11..13 "6" [] [Whitespace(" ")] - 1: STAR2@13..16 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@16..17 - 0: JS_NUMBER_LITERAL@16..17 "7" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@17..39 - 0: JS_BINARY_EXPRESSION@17..39 - 0: JS_NUMBER_LITERAL_EXPRESSION@17..20 - 0: JS_NUMBER_LITERAL@17..20 "1" [Newline("\n")] [Whitespace(" ")] - 1: PLUS@20..22 "+" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@22..39 - 0: JS_BINARY_EXPRESSION@22..36 - 0: JS_NUMBER_LITERAL_EXPRESSION@22..24 - 0: JS_NUMBER_LITERAL@22..24 "2" [] [Whitespace(" ")] - 1: STAR@24..26 "*" [] [Whitespace(" ")] - 2: JS_CALL_EXPRESSION@26..36 - 0: JS_NUMBER_LITERAL_EXPRESSION@26..27 - 0: JS_NUMBER_LITERAL@26..27 "3" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@27..36 - 0: L_PAREN@27..29 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@29..34 - 0: JS_BINARY_EXPRESSION@29..34 - 0: JS_NUMBER_LITERAL_EXPRESSION@29..31 - 0: JS_NUMBER_LITERAL@29..31 "1" [] [Whitespace(" ")] - 1: PLUS@31..33 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@33..34 - 0: JS_NUMBER_LITERAL@33..34 "2" [] [] - 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] - 1: STAR@36..38 "*" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@38..39 - 0: JS_NUMBER_LITERAL@38..39 "3" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@39..45 - 0: JS_BINARY_EXPRESSION@39..45 - 0: JS_NUMBER_LITERAL_EXPRESSION@39..42 - 0: JS_NUMBER_LITERAL@39..42 "1" [Newline("\n")] [Whitespace(" ")] - 1: SLASH@42..44 "/" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@44..45 - 0: JS_NUMBER_LITERAL@44..45 "2" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@45..55 - 0: JS_IN_EXPRESSION@45..55 - 0: JS_NUMBER_LITERAL_EXPRESSION@45..49 - 0: JS_NUMBER_LITERAL@45..49 "74" [Newline("\n")] [Whitespace(" ")] - 1: IN_KW@49..52 "in" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@52..55 - 0: JS_REFERENCE_IDENTIFIER@52..55 - 0: IDENT@52..55 "foo" [] [] - 1: (empty) - 5: JS_EXPRESSION_STATEMENT@55..76 - 0: JS_INSTANCEOF_EXPRESSION@55..76 - 0: JS_IDENTIFIER_EXPRESSION@55..60 - 0: JS_REFERENCE_IDENTIFIER@55..60 - 0: IDENT@55..60 "foo" [Newline("\n")] [Whitespace(" ")] - 1: INSTANCEOF_KW@60..71 "instanceof" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@71..76 - 0: JS_REFERENCE_IDENTIFIER@71..76 - 0: IDENT@71..76 "Array" [] [] - 1: (empty) - 6: JS_EXPRESSION_STATEMENT@76..87 - 0: JS_LOGICAL_EXPRESSION@76..87 - 0: JS_IDENTIFIER_EXPRESSION@76..81 - 0: JS_REFERENCE_IDENTIFIER@76..81 - 0: IDENT@76..81 "foo" [Newline("\n")] [Whitespace(" ")] - 1: QUESTION2@81..84 "??" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@84..87 - 0: JS_REFERENCE_IDENTIFIER@84..87 - 0: IDENT@84..87 "bar" [] [] - 1: (empty) - 7: JS_EXPRESSION_STATEMENT@87..94 - 0: JS_BINARY_EXPRESSION@87..94 - 0: JS_IDENTIFIER_EXPRESSION@87..90 - 0: JS_REFERENCE_IDENTIFIER@87..90 - 0: IDENT@87..90 "a" [Newline("\n")] [Whitespace(" ")] - 1: SHR@90..93 ">>" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@93..94 - 0: JS_REFERENCE_IDENTIFIER@93..94 - 0: IDENT@93..94 "b" [] [] - 1: (empty) - 8: JS_EXPRESSION_STATEMENT@94..102 - 0: JS_BINARY_EXPRESSION@94..102 - 0: JS_IDENTIFIER_EXPRESSION@94..97 - 0: JS_REFERENCE_IDENTIFIER@94..97 - 0: IDENT@94..97 "a" [Newline("\n")] [Whitespace(" ")] - 1: USHR@97..101 ">>>" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@101..102 - 0: JS_REFERENCE_IDENTIFIER@101..102 - 0: IDENT@101..102 "b" [] [] - 1: (empty) - 9: JS_EXPRESSION_STATEMENT@102..116 - 0: JS_BINARY_EXPRESSION@102..116 - 0: JS_BINARY_EXPRESSION@102..113 - 0: JS_BINARY_EXPRESSION@102..109 - 0: JS_NUMBER_LITERAL_EXPRESSION@102..105 - 0: JS_NUMBER_LITERAL@102..105 "1" [Newline("\n")] [Whitespace(" ")] - 1: PLUS@105..107 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@107..109 - 0: JS_NUMBER_LITERAL@107..109 "1" [] [Whitespace(" ")] - 1: PLUS@109..111 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@111..113 - 0: JS_NUMBER_LITERAL@111..113 "1" [] [Whitespace(" ")] - 1: PLUS@113..115 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@115..116 - 0: JS_NUMBER_LITERAL@115..116 "1" [] [] - 1: (empty) - 10: JS_EXPRESSION_STATEMENT@116..139 - 0: JS_BINARY_EXPRESSION@116..139 - 0: JS_BINARY_EXPRESSION@116..123 - 0: JS_NUMBER_LITERAL_EXPRESSION@116..119 - 0: JS_NUMBER_LITERAL@116..119 "5" [Newline("\n")] [Whitespace(" ")] - 1: PLUS@119..121 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@121..123 - 0: JS_NUMBER_LITERAL@121..123 "6" [] [Whitespace(" ")] - 1: MINUS@123..125 "-" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@125..139 - 0: JS_BINARY_EXPRESSION@125..131 - 0: JS_NUMBER_LITERAL_EXPRESSION@125..127 - 0: JS_NUMBER_LITERAL@125..127 "1" [] [Whitespace(" ")] - 1: STAR@127..129 "*" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@129..131 - 0: JS_NUMBER_LITERAL@129..131 "2" [] [Whitespace(" ")] - 1: SLASH@131..133 "/" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@133..139 - 0: JS_NUMBER_LITERAL_EXPRESSION@133..135 - 0: JS_NUMBER_LITERAL@133..135 "1" [] [Whitespace(" ")] - 1: STAR2@135..138 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@138..139 - 0: JS_NUMBER_LITERAL@138..139 "6" [] [] - 1: (empty) - 11: JS_CLASS_DECLARATION@139..192 - 0: JS_DECORATOR_LIST@139..139 - 1: (empty) - 2: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@146..151 - 0: IDENT@146..151 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@151..153 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@153..191 - 0: JS_PROPERTY_CLASS_MEMBER@153..160 - 0: JS_PROPERTY_MODIFIER_LIST@153..153 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@153..158 - 0: HASH@153..154 "#" [] [] - 1: IDENT@154..158 "name" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@158..160 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@160..191 - 0: JS_METHOD_MODIFIER_LIST@160..160 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@160..164 - 0: IDENT@160..164 "test" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@164..167 - 0: L_PAREN@164..165 "(" [] [] - 1: JS_PARAMETER_LIST@165..165 - 2: R_PAREN@165..167 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@167..191 - 0: L_CURLY@167..169 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@169..169 - 2: JS_STATEMENT_LIST@169..189 - 0: JS_EXPRESSION_STATEMENT@169..189 - 0: JS_LOGICAL_EXPRESSION@169..189 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@169..174 - 0: TRUE_KW@169..174 "true" [] [Whitespace(" ")] - 1: AMP2@174..177 "&&" [] [Whitespace(" ")] - 2: JS_IN_EXPRESSION@177..189 - 0: JS_PRIVATE_NAME@177..183 - 0: HASH@177..178 "#" [] [] - 1: IDENT@178..183 "name" [] [Whitespace(" ")] - 1: IN_KW@183..186 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@186..189 - 0: L_CURLY@186..187 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@187..187 - 2: R_CURLY@187..189 "}" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@189..191 "}" [] [Whitespace(" ")] - 9: R_CURLY@191..192 "}" [] [] - 4: EOF@192..193 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/block_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/block_stmt.rast deleted file mode 100644 index c8aa77a796ff..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/block_stmt.rast +++ /dev/null @@ -1,96 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsBlockStatement { - l_curly_token: L_CURLY@0..1 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1..2 "}" [] [], - }, - JsBlockStatement { - l_curly_token: L_CURLY@2..4 "{" [Newline("\n")] [], - statements: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@4..5 "{" [] [], - statements: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@5..6 "{" [] [], - statements: JsStatementList [ - JsBlockStatement { - l_curly_token: L_CURLY@6..7 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@7..8 "}" [] [], - }, - ], - r_curly_token: R_CURLY@8..9 "}" [] [], - }, - ], - r_curly_token: R_CURLY@9..10 "}" [] [], - }, - ], - r_curly_token: R_CURLY@10..11 "}" [] [], - }, - JsBlockStatement { - l_curly_token: L_CURLY@11..14 "{" [Newline("\n")] [Whitespace(" ")], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@14..18 "foo" [] [Whitespace(" ")], - }, - operator_token: EQ@18..20 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..23 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@23..25 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - ], - eof_token: EOF@26..27 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..27 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..26 - 0: JS_BLOCK_STATEMENT@0..2 - 0: L_CURLY@0..1 "{" [] [] - 1: JS_STATEMENT_LIST@1..1 - 2: R_CURLY@1..2 "}" [] [] - 1: JS_BLOCK_STATEMENT@2..11 - 0: L_CURLY@2..4 "{" [Newline("\n")] [] - 1: JS_STATEMENT_LIST@4..10 - 0: JS_BLOCK_STATEMENT@4..10 - 0: L_CURLY@4..5 "{" [] [] - 1: JS_STATEMENT_LIST@5..9 - 0: JS_BLOCK_STATEMENT@5..9 - 0: L_CURLY@5..6 "{" [] [] - 1: JS_STATEMENT_LIST@6..8 - 0: JS_BLOCK_STATEMENT@6..8 - 0: L_CURLY@6..7 "{" [] [] - 1: JS_STATEMENT_LIST@7..7 - 2: R_CURLY@7..8 "}" [] [] - 2: R_CURLY@8..9 "}" [] [] - 2: R_CURLY@9..10 "}" [] [] - 2: R_CURLY@10..11 "}" [] [] - 2: JS_BLOCK_STATEMENT@11..26 - 0: L_CURLY@11..14 "{" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@14..25 - 0: JS_EXPRESSION_STATEMENT@14..25 - 0: JS_ASSIGNMENT_EXPRESSION@14..23 - 0: JS_IDENTIFIER_ASSIGNMENT@14..18 - 0: IDENT@14..18 "foo" [] [Whitespace(" ")] - 1: EQ@18..20 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@20..23 - 0: JS_REFERENCE_IDENTIFIER@20..23 - 0: IDENT@20..23 "bar" [] [] - 1: SEMICOLON@23..25 ";" [] [Whitespace(" ")] - 2: R_CURLY@25..26 "}" [] [] - 4: EOF@26..27 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/bom_character.rast b/crates/biome_js_parser/test_data/inline/ok/bom_character.rast deleted file mode 100644 index 5ec15b9e72b1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/bom_character.rast +++ /dev/null @@ -1,53 +0,0 @@ -JsModule { - bom_token: UNICODE_BOM@0..3 "\u{feff}" [] [], - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@3..12 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@12..16 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@16..18 "(" [] [Whitespace(" ")], - items: JsParameterList [], - r_paren_token: R_PAREN@18..20 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@20..21 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - ], - eof_token: EOF@22..22 "" [] [], -} - -0: JS_MODULE@0..22 - 0: UNICODE_BOM@0..3 "\u{feff}" [] [] - 1: (empty) - 2: JS_DIRECTIVE_LIST@3..3 - 3: JS_MODULE_ITEM_LIST@3..22 - 0: JS_FUNCTION_DECLARATION@3..22 - 0: (empty) - 1: FUNCTION_KW@3..12 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@12..16 - 0: IDENT@12..16 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: JS_PARAMETERS@16..20 - 0: L_PAREN@16..18 "(" [] [Whitespace(" ")] - 1: JS_PARAMETER_LIST@18..18 - 2: R_PAREN@18..20 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@20..22 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_DIRECTIVE_LIST@21..21 - 2: JS_STATEMENT_LIST@21..21 - 3: R_CURLY@21..22 "}" [] [] - 4: EOF@22..22 "" [] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/break_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/break_stmt.rast deleted file mode 100644 index cd20c58bc99f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/break_stmt.rast +++ /dev/null @@ -1,126 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsWhileStatement { - while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@6..7 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@7..11 "true" [] [], - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@13..14 "{" [] [], - statements: JsStatementList [ - JsBreakStatement { - break_token: BREAK_KW@14..22 "break" [Newline("\n"), Whitespace(" ")] [], - label: missing (optional), - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@23..29 "foo" [Newline("\n"), Whitespace(" ")] [], - }, - colon_token: COLON@29..31 ":" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@31..32 "{" [] [], - statements: JsStatementList [ - JsBreakStatement { - break_token: BREAK_KW@32..42 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - label: JsLabel { - value_token: IDENT@42..45 "foo" [] [], - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - ], - r_curly_token: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], - }, - }, - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@52..56 "out" [Newline("\n")] [], - }, - colon_token: COLON@56..58 ":" [] [Whitespace(" ")], - body: JsWhileStatement { - while_token: WHILE_KW@58..64 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@64..65 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@65..69 "true" [] [], - }, - r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@71..72 "{" [] [], - statements: JsStatementList [ - JsBreakStatement { - break_token: BREAK_KW@72..81 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - label: JsLabel { - value_token: IDENT@81..84 "out" [] [], - }, - semicolon_token: SEMICOLON@84..85 ";" [] [], - }, - ], - r_curly_token: R_CURLY@85..87 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@87..88 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..88 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..87 - 0: JS_WHILE_STATEMENT@0..52 - 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] - 1: L_PAREN@6..7 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11 - 0: TRUE_KW@7..11 "true" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@13..52 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_STATEMENT_LIST@14..50 - 0: JS_BREAK_STATEMENT@14..23 - 0: BREAK_KW@14..22 "break" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: SEMICOLON@22..23 ";" [] [] - 1: JS_LABELED_STATEMENT@23..50 - 0: JS_LABEL@23..29 - 0: IDENT@23..29 "foo" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@29..31 ":" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@31..50 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_STATEMENT_LIST@32..46 - 0: JS_BREAK_STATEMENT@32..46 - 0: BREAK_KW@32..42 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LABEL@42..45 - 0: IDENT@42..45 "foo" [] [] - 2: SEMICOLON@45..46 ";" [] [] - 2: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@50..52 "}" [Newline("\n")] [] - 1: JS_LABELED_STATEMENT@52..87 - 0: JS_LABEL@52..56 - 0: IDENT@52..56 "out" [Newline("\n")] [] - 1: COLON@56..58 ":" [] [Whitespace(" ")] - 2: JS_WHILE_STATEMENT@58..87 - 0: WHILE_KW@58..64 "while" [] [Whitespace(" ")] - 1: L_PAREN@64..65 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@65..69 - 0: TRUE_KW@65..69 "true" [] [] - 3: R_PAREN@69..71 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@71..87 - 0: L_CURLY@71..72 "{" [] [] - 1: JS_STATEMENT_LIST@72..85 - 0: JS_BREAK_STATEMENT@72..85 - 0: BREAK_KW@72..81 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LABEL@81..84 - 0: IDENT@81..84 "out" [] [] - 2: SEMICOLON@84..85 ";" [] [] - 2: R_CURLY@85..87 "}" [Newline("\n")] [] - 4: EOF@87..88 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.rast b/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.rast deleted file mode 100644 index 944b1b64708a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.rast +++ /dev/null @@ -1,77 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsModuleDeclaration { - module_or_namespace: MODULE_KW@0..52 "module" [Comments("// https://github.com ..."), Newline("\n")] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@52..59 "number" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@59..60 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - TsModuleDeclaration { - module_or_namespace: MODULE_KW@61..69 "module" [Newline("\n")] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@69..76 "string" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@76..77 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@77..78 "}" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@78..87 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@87..94 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@94..100 "never" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@100..101 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@101..102 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@102..103 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..103 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..102 - 0: TS_MODULE_DECLARATION@0..61 - 0: MODULE_KW@0..52 "module" [Comments("// https://github.com ..."), Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@52..59 - 0: IDENT@52..59 "number" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@59..61 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_MODULE_ITEM_LIST@60..60 - 2: R_CURLY@60..61 "}" [] [] - 1: TS_MODULE_DECLARATION@61..78 - 0: MODULE_KW@61..69 "module" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@69..76 - 0: IDENT@69..76 "string" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@76..78 - 0: L_CURLY@76..77 "{" [] [] - 1: JS_MODULE_ITEM_LIST@77..77 - 2: R_CURLY@77..78 "}" [] [] - 2: TS_DECLARE_STATEMENT@78..102 - 0: DECLARE_KW@78..87 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@87..102 - 0: MODULE_KW@87..94 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@94..100 - 0: IDENT@94..100 "never" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@100..102 - 0: L_CURLY@100..101 "{" [] [] - 1: JS_MODULE_ITEM_LIST@101..101 - 2: R_CURLY@101..102 "}" [] [] - 4: EOF@102..103 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/call_arguments.rast b/crates/biome_js_parser/test_data/inline/ok/call_arguments.rast deleted file mode 100644 index 4f65c8840cbd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/call_arguments.rast +++ /dev/null @@ -1,373 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@13..16 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@16..20 "args" [] [], - }, - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@29..30 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@32..33 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@33..35 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@35..36 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@36..38 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@38..39 "d" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@39..40 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..44 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@44..45 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..46 "a" [] [], - }, - }, - ], - r_paren_token: R_PAREN@46..47 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@48..52 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@52..53 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..54 "a" [] [], - }, - }, - COMMA@54..56 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..57 "b" [] [], - }, - }, - COMMA@57..58 "," [] [], - ], - r_paren_token: R_PAREN@58..59 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@60..64 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@64..65 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@65..66 "a" [] [], - }, - }, - COMMA@66..68 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@68..69 "b" [] [], - }, - }, - COMMA@69..71 "," [] [Whitespace(" ")], - JsSpread { - dotdotdot_token: DOT3@71..74 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..75 "c" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@75..76 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@76..77 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@77..81 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@81..82 "(" [] [], - args: JsCallArgumentList [ - JsSpread { - dotdotdot_token: DOT3@82..85 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@85..86 "a" [] [], - }, - }, - }, - COMMA@86..88 "," [] [Whitespace(" ")], - JsSpread { - dotdotdot_token: DOT3@88..91 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@91..92 "b" [] [], - }, - }, - }, - COMMA@92..94 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@94..95 "c" [] [], - }, - }, - COMMA@95..97 "," [] [Whitespace(" ")], - JsSpread { - dotdotdot_token: DOT3@97..100 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@100..101 "d" [] [], - }, - }, - }, - COMMA@101..102 "," [] [], - ], - r_paren_token: R_PAREN@102..103 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - ], - eof_token: EOF@104..105 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..105 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..104 - 0: JS_FUNCTION_DECLARATION@0..24 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..22 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..20 - 0: JS_REST_PARAMETER@13..20 - 0: JS_DECORATOR_LIST@13..13 - 1: DOT3@13..16 "..." [] [] - 2: JS_IDENTIFIER_BINDING@16..20 - 0: IDENT@16..20 "args" [] [] - 3: (empty) - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@22..24 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..23 - 3: R_CURLY@23..24 "}" [] [] - 1: JS_VARIABLE_STATEMENT@24..40 - 0: JS_VARIABLE_DECLARATION@24..39 - 0: (empty) - 1: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@29..39 - 0: JS_VARIABLE_DECLARATOR@29..30 - 0: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@30..32 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@32..33 - 0: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "b" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@33..35 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@35..36 - 0: JS_IDENTIFIER_BINDING@35..36 - 0: IDENT@35..36 "c" [] [] - 1: (empty) - 2: (empty) - 5: COMMA@36..38 "," [] [Whitespace(" ")] - 6: JS_VARIABLE_DECLARATOR@38..39 - 0: JS_IDENTIFIER_BINDING@38..39 - 0: IDENT@38..39 "d" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@39..40 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@40..48 - 0: JS_CALL_EXPRESSION@40..47 - 0: JS_IDENTIFIER_EXPRESSION@40..44 - 0: JS_REFERENCE_IDENTIFIER@40..44 - 0: IDENT@40..44 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@45..46 - 0: JS_IDENTIFIER_EXPRESSION@45..46 - 0: JS_REFERENCE_IDENTIFIER@45..46 - 0: IDENT@45..46 "a" [] [] - 2: R_PAREN@46..47 ")" [] [] - 1: SEMICOLON@47..48 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@48..60 - 0: JS_CALL_EXPRESSION@48..59 - 0: JS_IDENTIFIER_EXPRESSION@48..52 - 0: JS_REFERENCE_IDENTIFIER@48..52 - 0: IDENT@48..52 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@52..59 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@53..58 - 0: JS_IDENTIFIER_EXPRESSION@53..54 - 0: JS_REFERENCE_IDENTIFIER@53..54 - 0: IDENT@53..54 "a" [] [] - 1: COMMA@54..56 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@56..57 - 0: JS_REFERENCE_IDENTIFIER@56..57 - 0: IDENT@56..57 "b" [] [] - 3: COMMA@57..58 "," [] [] - 2: R_PAREN@58..59 ")" [] [] - 1: SEMICOLON@59..60 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@60..77 - 0: JS_CALL_EXPRESSION@60..76 - 0: JS_IDENTIFIER_EXPRESSION@60..64 - 0: JS_REFERENCE_IDENTIFIER@60..64 - 0: IDENT@60..64 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@64..76 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@65..75 - 0: JS_IDENTIFIER_EXPRESSION@65..66 - 0: JS_REFERENCE_IDENTIFIER@65..66 - 0: IDENT@65..66 "a" [] [] - 1: COMMA@66..68 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@68..69 - 0: JS_REFERENCE_IDENTIFIER@68..69 - 0: IDENT@68..69 "b" [] [] - 3: COMMA@69..71 "," [] [Whitespace(" ")] - 4: JS_SPREAD@71..75 - 0: DOT3@71..74 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@74..75 - 0: JS_REFERENCE_IDENTIFIER@74..75 - 0: IDENT@74..75 "c" [] [] - 2: R_PAREN@75..76 ")" [] [] - 1: SEMICOLON@76..77 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@77..104 - 0: JS_CALL_EXPRESSION@77..103 - 0: JS_IDENTIFIER_EXPRESSION@77..81 - 0: JS_REFERENCE_IDENTIFIER@77..81 - 0: IDENT@77..81 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@81..103 - 0: L_PAREN@81..82 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@82..102 - 0: JS_SPREAD@82..86 - 0: DOT3@82..85 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@85..86 - 0: JS_REFERENCE_IDENTIFIER@85..86 - 0: IDENT@85..86 "a" [] [] - 1: COMMA@86..88 "," [] [Whitespace(" ")] - 2: JS_SPREAD@88..92 - 0: DOT3@88..91 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@91..92 - 0: JS_REFERENCE_IDENTIFIER@91..92 - 0: IDENT@91..92 "b" [] [] - 3: COMMA@92..94 "," [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@94..95 - 0: JS_REFERENCE_IDENTIFIER@94..95 - 0: IDENT@94..95 "c" [] [] - 5: COMMA@95..97 "," [] [Whitespace(" ")] - 6: JS_SPREAD@97..101 - 0: DOT3@97..100 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@100..101 - 0: JS_REFERENCE_IDENTIFIER@100..101 - 0: IDENT@100..101 "d" [] [] - 7: COMMA@101..102 "," [] [] - 2: R_PAREN@102..103 ")" [] [] - 1: SEMICOLON@103..104 ";" [] [] - 4: EOF@104..105 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.rast b/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.rast deleted file mode 100644 index 98d951b886b4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.rast +++ /dev/null @@ -1,108 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@16..24 "function" [] [], - star_token: STAR@24..26 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@26..30 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@30..31 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@33..34 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@43..45 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@45..46 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@56..58 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@58..63 "await" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - ], - r_curly_token: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_curly_token: R_CURLY@68..70 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@70..71 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..71 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..70 - 0: JS_FUNCTION_DECLARATION@0..70 - 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@16..24 "function" [] [] - 2: STAR@24..26 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@26..30 - 0: IDENT@26..30 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@30..33 - 0: L_PAREN@30..31 "(" [] [] - 1: JS_PARAMETER_LIST@31..31 - 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@33..70 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_DIRECTIVE_LIST@34..34 - 2: JS_STATEMENT_LIST@34..68 - 0: JS_CLASS_DECLARATION@34..68 - 0: JS_DECORATOR_LIST@34..34 - 1: (empty) - 2: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@45..46 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@46..64 - 0: JS_PROPERTY_CLASS_MEMBER@46..64 - 0: JS_PROPERTY_MODIFIER_LIST@46..46 - 1: JS_LITERAL_MEMBER_NAME@46..56 - 0: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@56..63 - 0: EQ@56..58 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@58..63 - 0: JS_REFERENCE_IDENTIFIER@58..63 - 0: IDENT@58..63 "await" [] [] - 4: SEMICOLON@63..64 ";" [] [] - 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] - 3: R_CURLY@68..70 "}" [Newline("\n")] [] - 4: EOF@70..71 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.rast b/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.rast deleted file mode 100644 index de969550a078..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.rast +++ /dev/null @@ -1,440 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..13 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@13..17 "name" [] [], - }, - property_annotation: TsDefinitePropertyAnnotation { - excl_token: BANG@17..18 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@20..26 "string" [] [], - }, - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@28..33 "other" [] [], - }, - property_annotation: TsDefinitePropertyAnnotation { - excl_token: BANG@33..34 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@36..43 "string" [] [Whitespace(" ")], - }, - }, - }, - value: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@51..55 "Sub" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@63..68 "Base" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@68..69 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@69..82 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@82..83 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@83..91 "private" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@91..95 "priv" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@95..97 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@97..103 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - COMMA@103..105 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@105..115 "protected" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@115..119 "prot" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@119..121 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@121..127 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - COMMA@127..129 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@129..136 "public" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@136..139 "pub" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@139..141 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@141..147 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - COMMA@147..149 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsOverrideModifier { - modifier_token: OVERRIDE_KW@149..158 "override" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@158..162 "name" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@162..164 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@164..170 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - COMMA@170..172 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@181..185 "read" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@185..187 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@187..193 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - COMMA@193..195 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@195..205 "protected" [] [Whitespace(" ")], - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@205..214 "override" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@214..223 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@223..228 "other" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@228..230 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@230..236 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@236..238 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@238..239 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@239..250 "super" [Newline("\n"), Whitespace(" ")] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@250..251 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@251..252 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@252..253 ";" [] [], - }, - ], - r_curly_token: R_CURLY@253..256 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@256..258 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@258..259 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..259 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..258 - 0: JS_CLASS_DECLARATION@0..44 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Base" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..13 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@13..43 - 0: JS_PROPERTY_CLASS_MEMBER@13..28 - 0: JS_PROPERTY_MODIFIER_LIST@13..13 - 1: JS_LITERAL_MEMBER_NAME@13..17 - 0: IDENT@13..17 "name" [] [] - 2: TS_DEFINITE_PROPERTY_ANNOTATION@17..26 - 0: BANG@17..18 "!" [] [] - 1: TS_TYPE_ANNOTATION@18..26 - 0: COLON@18..20 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@20..26 - 0: STRING_KW@20..26 "string" [] [] - 3: (empty) - 4: SEMICOLON@26..28 ";" [] [Whitespace(" ")] - 1: JS_PROPERTY_CLASS_MEMBER@28..43 - 0: JS_PROPERTY_MODIFIER_LIST@28..28 - 1: JS_LITERAL_MEMBER_NAME@28..33 - 0: IDENT@28..33 "other" [] [] - 2: TS_DEFINITE_PROPERTY_ANNOTATION@33..43 - 0: BANG@33..34 "!" [] [] - 1: TS_TYPE_ANNOTATION@34..43 - 0: COLON@34..36 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@36..43 - 0: STRING_KW@36..43 "string" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 9: R_CURLY@43..44 "}" [] [] - 1: JS_CLASS_DECLARATION@44..258 - 0: JS_DECORATOR_LIST@44..44 - 1: (empty) - 2: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@51..55 - 0: IDENT@51..55 "Sub" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@55..68 - 0: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@63..68 - 0: JS_REFERENCE_IDENTIFIER@63..68 - 0: IDENT@63..68 "Base" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@68..69 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@69..256 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@69..256 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@69..69 - 1: JS_LITERAL_MEMBER_NAME@69..82 - 0: IDENT@69..82 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@82..238 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@83..236 - 0: TS_PROPERTY_PARAMETER@83..103 - 0: JS_DECORATOR_LIST@83..83 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@83..91 - 0: TS_ACCESSIBILITY_MODIFIER@83..91 - 0: PRIVATE_KW@83..91 "private" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@91..103 - 0: JS_DECORATOR_LIST@91..91 - 1: JS_IDENTIFIER_BINDING@91..95 - 0: IDENT@91..95 "priv" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@95..103 - 0: COLON@95..97 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@97..103 - 0: STRING_KW@97..103 "string" [] [] - 4: (empty) - 1: COMMA@103..105 "," [] [Whitespace(" ")] - 2: TS_PROPERTY_PARAMETER@105..127 - 0: JS_DECORATOR_LIST@105..105 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@105..115 - 0: TS_ACCESSIBILITY_MODIFIER@105..115 - 0: PROTECTED_KW@105..115 "protected" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@115..127 - 0: JS_DECORATOR_LIST@115..115 - 1: JS_IDENTIFIER_BINDING@115..119 - 0: IDENT@115..119 "prot" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@119..127 - 0: COLON@119..121 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@121..127 - 0: STRING_KW@121..127 "string" [] [] - 4: (empty) - 3: COMMA@127..129 "," [] [Whitespace(" ")] - 4: TS_PROPERTY_PARAMETER@129..147 - 0: JS_DECORATOR_LIST@129..129 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@129..136 - 0: TS_ACCESSIBILITY_MODIFIER@129..136 - 0: PUBLIC_KW@129..136 "public" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@136..147 - 0: JS_DECORATOR_LIST@136..136 - 1: JS_IDENTIFIER_BINDING@136..139 - 0: IDENT@136..139 "pub" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@139..147 - 0: COLON@139..141 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@141..147 - 0: STRING_KW@141..147 "string" [] [] - 4: (empty) - 5: COMMA@147..149 "," [] [Whitespace(" ")] - 6: TS_PROPERTY_PARAMETER@149..170 - 0: JS_DECORATOR_LIST@149..149 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@149..158 - 0: TS_OVERRIDE_MODIFIER@149..158 - 0: OVERRIDE_KW@149..158 "override" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@158..170 - 0: JS_DECORATOR_LIST@158..158 - 1: JS_IDENTIFIER_BINDING@158..162 - 0: IDENT@158..162 "name" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@162..170 - 0: COLON@162..164 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@164..170 - 0: STRING_KW@164..170 "string" [] [] - 4: (empty) - 7: COMMA@170..172 "," [] [Whitespace(" ")] - 8: TS_PROPERTY_PARAMETER@172..193 - 0: JS_DECORATOR_LIST@172..172 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@172..181 - 0: TS_READONLY_MODIFIER@172..181 - 0: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@181..193 - 0: JS_DECORATOR_LIST@181..181 - 1: JS_IDENTIFIER_BINDING@181..185 - 0: IDENT@181..185 "read" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@185..193 - 0: COLON@185..187 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@187..193 - 0: STRING_KW@187..193 "string" [] [] - 4: (empty) - 9: COMMA@193..195 "," [] [Whitespace(" ")] - 10: TS_PROPERTY_PARAMETER@195..236 - 0: JS_DECORATOR_LIST@195..195 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@195..223 - 0: TS_ACCESSIBILITY_MODIFIER@195..205 - 0: PROTECTED_KW@195..205 "protected" [] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@205..214 - 0: OVERRIDE_KW@205..214 "override" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@214..223 - 0: READONLY_KW@214..223 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@223..236 - 0: JS_DECORATOR_LIST@223..223 - 1: JS_IDENTIFIER_BINDING@223..228 - 0: IDENT@223..228 "other" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@228..236 - 0: COLON@228..230 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@230..236 - 0: STRING_KW@230..236 "string" [] [] - 4: (empty) - 2: R_PAREN@236..238 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@238..256 - 0: L_CURLY@238..239 "{" [] [] - 1: JS_DIRECTIVE_LIST@239..239 - 2: JS_STATEMENT_LIST@239..253 - 0: JS_EXPRESSION_STATEMENT@239..253 - 0: JS_CALL_EXPRESSION@239..252 - 0: JS_SUPER_EXPRESSION@239..250 - 0: SUPER_KW@239..250 "super" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@250..252 - 0: L_PAREN@250..251 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@251..251 - 2: R_PAREN@251..252 ")" [] [] - 1: SEMICOLON@252..253 ";" [] [] - 3: R_CURLY@253..256 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@256..258 "}" [Newline("\n")] [] - 4: EOF@258..259 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/class_declaration.rast deleted file mode 100644 index a6a5223eecff..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_declaration.rast +++ /dev/null @@ -1,129 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@11..12 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@12..19 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@19..23 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@23..31 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..35 "bar" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@35..36 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@44..48 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@48..56 "extends" [] [Whitespace(" ")], - super_class: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..59 "foo" [] [], - }, - }, - operator_token: DOT@59..60 "." [] [], - member: JsName { - value_token: IDENT@60..64 "bar" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@64..65 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@65..66 "}" [] [], - }, - ], - eof_token: EOF@66..67 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..67 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..66 - 0: JS_CLASS_DECLARATION@0..12 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..11 - 9: R_CURLY@11..12 "}" [] [] - 1: JS_CLASS_DECLARATION@12..37 - 0: JS_DECORATOR_LIST@12..12 - 1: (empty) - 2: CLASS_KW@12..19 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@19..23 - 0: IDENT@19..23 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@23..35 - 0: EXTENDS_KW@23..31 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@31..35 - 0: JS_REFERENCE_IDENTIFIER@31..35 - 0: IDENT@31..35 "bar" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@35..36 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@36..36 - 9: R_CURLY@36..37 "}" [] [] - 2: JS_CLASS_DECLARATION@37..66 - 0: JS_DECORATOR_LIST@37..37 - 1: (empty) - 2: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@44..48 - 0: IDENT@44..48 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@48..64 - 0: EXTENDS_KW@48..56 "extends" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@56..64 - 0: JS_IDENTIFIER_EXPRESSION@56..59 - 0: JS_REFERENCE_IDENTIFIER@56..59 - 0: IDENT@56..59 "foo" [] [] - 1: DOT@59..60 "." [] [] - 2: JS_NAME@60..64 - 0: IDENT@60..64 "bar" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@64..65 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@65..65 - 9: R_CURLY@65..66 "}" [] [] - 4: EOF@66..67 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declare.rast b/crates/biome_js_parser/test_data/inline/ok/class_declare.rast deleted file mode 100644 index e13384788e09..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_declare.rast +++ /dev/null @@ -1,136 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@10..17 "declare" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@17..18 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@18..20 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@20..21 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@21..23 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@31..33 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@35..43 "declare" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@43..45 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..49 "foo" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@49..50 "}" [] [], - }, - ], - eof_token: EOF@50..51 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..51 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..50 - 0: JS_CLASS_DECLARATION@0..24 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..23 - 0: JS_METHOD_CLASS_MEMBER@10..23 - 0: JS_METHOD_MODIFIER_LIST@10..10 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@10..17 - 0: IDENT@10..17 "declare" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@17..20 - 0: L_PAREN@17..18 "(" [] [] - 1: JS_PARAMETER_LIST@18..18 - 2: R_PAREN@18..20 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@20..23 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_DIRECTIVE_LIST@21..21 - 2: JS_STATEMENT_LIST@21..21 - 3: R_CURLY@21..23 "}" [] [Whitespace(" ")] - 9: R_CURLY@23..24 "}" [] [] - 1: JS_CLASS_DECLARATION@24..50 - 0: JS_DECORATOR_LIST@24..24 - 1: (empty) - 2: CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@33..35 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@35..49 - 0: JS_PROPERTY_CLASS_MEMBER@35..49 - 0: JS_PROPERTY_MODIFIER_LIST@35..35 - 1: JS_LITERAL_MEMBER_NAME@35..43 - 0: IDENT@35..43 "declare" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@43..49 - 0: EQ@43..45 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@45..49 - 0: JS_REFERENCE_IDENTIFIER@45..49 - 0: IDENT@45..49 "foo" [] [Whitespace(" ")] - 4: (empty) - 9: R_CURLY@49..50 "}" [] [] - 4: EOF@50..51 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_decorator.rast b/crates/biome_js_parser/test_data/inline/ok/class_decorator.rast deleted file mode 100644 index 4475d5474dac..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_decorator.rast +++ /dev/null @@ -1,55 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@17..21 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_CLASS_DECLARATION@0..24 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: (empty) - 2: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@17..21 - 0: IDENT@17..21 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@21..23 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@23..23 - 9: R_CURLY@23..24 "}" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_empty_element.rast b/crates/biome_js_parser/test_data/inline/ok/class_empty_element.rast deleted file mode 100644 index 1d2c395cd9ea..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_empty_element.rast +++ /dev/null @@ -1,141 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..12 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsEmptyClassMember { - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@23..27 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@27..30 "foo" [] [], - }, - l_paren_token: L_PAREN@30..31 "(" [] [], - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@33..34 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - ], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: JS_CLASS_DECLARATION@0..40 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..12 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@12..39 - 0: JS_EMPTY_CLASS_MEMBER@12..13 - 0: SEMICOLON@12..13 ";" [] [] - 1: JS_EMPTY_CLASS_MEMBER@13..14 - 0: SEMICOLON@13..14 ";" [] [] - 2: JS_EMPTY_CLASS_MEMBER@14..15 - 0: SEMICOLON@14..15 ";" [] [] - 3: JS_EMPTY_CLASS_MEMBER@15..16 - 0: SEMICOLON@15..16 ";" [] [] - 4: JS_EMPTY_CLASS_MEMBER@16..17 - 0: SEMICOLON@16..17 ";" [] [] - 5: JS_EMPTY_CLASS_MEMBER@17..18 - 0: SEMICOLON@17..18 ";" [] [] - 6: JS_EMPTY_CLASS_MEMBER@18..19 - 0: SEMICOLON@18..19 ";" [] [] - 7: JS_EMPTY_CLASS_MEMBER@19..20 - 0: SEMICOLON@19..20 ";" [] [] - 8: JS_EMPTY_CLASS_MEMBER@20..21 - 0: SEMICOLON@20..21 ";" [] [] - 9: JS_EMPTY_CLASS_MEMBER@21..23 - 0: SEMICOLON@21..23 ";" [] [Whitespace(" ")] - 10: JS_GETTER_CLASS_MEMBER@23..35 - 0: JS_METHOD_MODIFIER_LIST@23..23 - 1: GET_KW@23..27 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@27..30 - 0: IDENT@27..30 "foo" [] [] - 3: L_PAREN@30..31 "(" [] [] - 4: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@33..35 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_DIRECTIVE_LIST@34..34 - 2: JS_STATEMENT_LIST@34..34 - 3: R_CURLY@34..35 "}" [] [] - 11: JS_EMPTY_CLASS_MEMBER@35..36 - 0: SEMICOLON@35..36 ";" [] [] - 12: JS_EMPTY_CLASS_MEMBER@36..37 - 0: SEMICOLON@36..37 ";" [] [] - 13: JS_EMPTY_CLASS_MEMBER@37..38 - 0: SEMICOLON@37..38 ";" [] [] - 14: JS_EMPTY_CLASS_MEMBER@38..39 - 0: SEMICOLON@38..39 ";" [] [] - 9: R_CURLY@39..40 "}" [] [] - 4: EOF@40..41 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_expr.rast b/crates/biome_js_parser/test_data/inline/ok/class_expr.rast deleted file mode 100644 index a4243de306e2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_expr.rast +++ /dev/null @@ -1,194 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@15..16 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@22..24 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@32..36 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@36..37 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@37..50 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@50..51 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@53..54 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@55..57 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..61 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@61..62 "[" [] [], - member: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@62..68 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@68..69 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@69..70 "}" [] [], - }, - r_brack_token: R_BRACK@70..71 "]" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@71..72 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..72 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..71 - 0: JS_VARIABLE_STATEMENT@0..17 - 0: JS_VARIABLE_DECLARATION@0..16 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..16 - 0: JS_VARIABLE_DECLARATOR@4..16 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..16 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@8..16 - 0: JS_DECORATOR_LIST@8..8 - 1: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@14..15 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@15..15 - 8: R_CURLY@15..16 "}" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 1: JS_VARIABLE_STATEMENT@17..57 - 0: JS_VARIABLE_DECLARATION@17..57 - 0: (empty) - 1: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@22..57 - 0: JS_VARIABLE_DECLARATOR@22..57 - 0: JS_IDENTIFIER_BINDING@22..24 - 0: IDENT@22..24 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@24..57 - 0: EQ@24..26 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@26..57 - 0: JS_DECORATOR_LIST@26..26 - 1: CLASS_KW@26..32 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@32..36 - 0: IDENT@32..36 "foo" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@36..37 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@37..55 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@37..55 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@37..37 - 1: JS_LITERAL_MEMBER_NAME@37..50 - 0: IDENT@37..50 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@50..53 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@51..51 - 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@53..55 - 0: L_CURLY@53..54 "{" [] [] - 1: JS_DIRECTIVE_LIST@54..54 - 2: JS_STATEMENT_LIST@54..54 - 3: R_CURLY@54..55 "}" [] [] - 8: R_CURLY@55..57 "}" [Newline("\n")] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@57..71 - 0: JS_COMPUTED_MEMBER_EXPRESSION@57..71 - 0: JS_IDENTIFIER_EXPRESSION@57..61 - 0: JS_REFERENCE_IDENTIFIER@57..61 - 0: IDENT@57..61 "foo" [Newline("\n")] [] - 1: (empty) - 2: L_BRACK@61..62 "[" [] [] - 3: JS_CLASS_EXPRESSION@62..70 - 0: JS_DECORATOR_LIST@62..62 - 1: CLASS_KW@62..68 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@68..69 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@69..69 - 8: R_CURLY@69..70 "}" [] [] - 4: R_BRACK@70..71 "]" [] [] - 1: (empty) - 4: EOF@71..72 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.rast b/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.rast deleted file mode 100644 index dda605103332..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.rast +++ /dev/null @@ -1,198 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@10..16 "public" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@16..17 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@19..20 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..22 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@23..30 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@30..32 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@32..34 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@34..41 "static" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@41..50 "protected" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@50..51 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@53..54 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@54..56 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@56..57 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@64..66 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@68..75 "static" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@75..76 "}" [] [], - }, - ], - eof_token: EOF@76..77 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..77 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..76 - 0: JS_CLASS_DECLARATION@0..23 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..22 - 0: JS_METHOD_CLASS_MEMBER@10..22 - 0: JS_METHOD_MODIFIER_LIST@10..10 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@10..16 - 0: IDENT@10..16 "public" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@16..19 - 0: L_PAREN@16..17 "(" [] [] - 1: JS_PARAMETER_LIST@17..17 - 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@19..22 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_DIRECTIVE_LIST@20..20 - 2: JS_STATEMENT_LIST@20..20 - 3: R_CURLY@20..22 "}" [] [Whitespace(" ")] - 9: R_CURLY@22..23 "}" [] [] - 1: JS_CLASS_DECLARATION@23..57 - 0: JS_DECORATOR_LIST@23..23 - 1: (empty) - 2: CLASS_KW@23..30 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@30..32 - 0: IDENT@30..32 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@32..34 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@34..56 - 0: JS_METHOD_CLASS_MEMBER@34..56 - 0: JS_METHOD_MODIFIER_LIST@34..41 - 0: JS_STATIC_MODIFIER@34..41 - 0: STATIC_KW@34..41 "static" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@41..50 - 0: IDENT@41..50 "protected" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@50..53 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_PARAMETER_LIST@51..51 - 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@53..56 - 0: L_CURLY@53..54 "{" [] [] - 1: JS_DIRECTIVE_LIST@54..54 - 2: JS_STATEMENT_LIST@54..54 - 3: R_CURLY@54..56 "}" [] [Whitespace(" ")] - 9: R_CURLY@56..57 "}" [] [] - 2: JS_CLASS_DECLARATION@57..76 - 0: JS_DECORATOR_LIST@57..57 - 1: (empty) - 2: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@64..66 - 0: IDENT@64..66 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@66..68 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@68..75 - 0: JS_PROPERTY_CLASS_MEMBER@68..75 - 0: JS_PROPERTY_MODIFIER_LIST@68..68 - 1: JS_LITERAL_MEMBER_NAME@68..75 - 0: IDENT@68..75 "static" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 9: R_CURLY@75..76 "}" [] [] - 4: EOF@76..77 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.rast b/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.rast deleted file mode 100644 index 92199912d9fa..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.rast +++ /dev/null @@ -1,88 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace(" ")] [], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@18..24 "foo" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@24..25 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@27..28 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@29..31 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@31..32 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..32 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..31 - 0: JS_CLASS_DECLARATION@0..31 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..29 - 0: JS_METHOD_CLASS_MEMBER@9..29 - 0: JS_METHOD_MODIFIER_LIST@9..18 - 0: JS_STATIC_MODIFIER@9..18 - 0: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@18..24 - 0: IDENT@18..24 "foo" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@24..27 - 0: L_PAREN@24..25 "(" [] [] - 1: JS_PARAMETER_LIST@25..25 - 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@27..29 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..28 - 3: R_CURLY@28..29 "}" [] [] - 9: R_CURLY@29..31 "}" [Newline("\n")] [] - 4: EOF@31..32 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.rast b/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.rast deleted file mode 100644 index 24f5cb0325d2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.rast +++ /dev/null @@ -1,41 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..15 "abstract" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@15..16 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: JS_CLASS_DECLARATION@0..17 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..15 - 0: IDENT@6..15 "abstract" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@15..16 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@16..16 - 9: R_CURLY@16..17 "}" [] [] - 4: EOF@17..18 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.rast b/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.rast deleted file mode 100644 index 69ee6cbf1f31..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.rast +++ /dev/null @@ -1,88 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@10..17 "static" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@17..28 "constructor" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@31..32 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@32..34 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: JS_CLASS_DECLARATION@0..35 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..34 - 0: JS_METHOD_CLASS_MEMBER@10..34 - 0: JS_METHOD_MODIFIER_LIST@10..17 - 0: JS_STATIC_MODIFIER@10..17 - 0: STATIC_KW@10..17 "static" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@17..28 - 0: IDENT@17..28 "constructor" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@28..31 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..29 - 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@31..34 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_DIRECTIVE_LIST@32..32 - 2: JS_STATEMENT_LIST@32..32 - 3: R_CURLY@32..34 "}" [] [Whitespace(" ")] - 9: R_CURLY@34..35 "}" [] [] - 4: EOF@35..36 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.rast b/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.rast deleted file mode 100644 index 0c3f31cc9986..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.rast +++ /dev/null @@ -1,186 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@3..4 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..7 "bar" [] [], - }, - }, - r_brack_token: R_BRACK@7..8 "]" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..12 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@12..13 "[" [] [], - member: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..15 "5" [] [Whitespace(" ")], - }, - operator_token: PLUS@15..17 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@17..18 "5" [] [], - }, - }, - r_brack_token: R_BRACK@18..19 "]" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@19..23 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@23..24 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@24..29 "\"bar\"" [] [], - }, - r_brack_token: R_BRACK@29..30 "]" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..34 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@34..35 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..38 "bar" [] [], - }, - }, - r_brack_token: R_BRACK@38..39 "]" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@39..40 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..43 "baz" [] [], - }, - }, - r_brack_token: R_BRACK@43..44 "]" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..48 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: QUESTIONDOT@48..50 "?." [] [], - l_brack_token: L_BRACK@50..51 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@51..54 "bar" [] [], - }, - }, - r_brack_token: R_BRACK@54..55 "]" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@55..56 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..56 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..55 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_COMPUTED_MEMBER_EXPRESSION@0..8 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: (empty) - 2: L_BRACK@3..4 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@4..7 - 0: JS_REFERENCE_IDENTIFIER@4..7 - 0: IDENT@4..7 "bar" [] [] - 4: R_BRACK@7..8 "]" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@8..19 - 0: JS_COMPUTED_MEMBER_EXPRESSION@8..19 - 0: JS_IDENTIFIER_EXPRESSION@8..12 - 0: JS_REFERENCE_IDENTIFIER@8..12 - 0: IDENT@8..12 "foo" [Newline("\n")] [] - 1: (empty) - 2: L_BRACK@12..13 "[" [] [] - 3: JS_BINARY_EXPRESSION@13..18 - 0: JS_NUMBER_LITERAL_EXPRESSION@13..15 - 0: JS_NUMBER_LITERAL@13..15 "5" [] [Whitespace(" ")] - 1: PLUS@15..17 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@17..18 - 0: JS_NUMBER_LITERAL@17..18 "5" [] [] - 4: R_BRACK@18..19 "]" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@19..30 - 0: JS_COMPUTED_MEMBER_EXPRESSION@19..30 - 0: JS_IDENTIFIER_EXPRESSION@19..23 - 0: JS_REFERENCE_IDENTIFIER@19..23 - 0: IDENT@19..23 "foo" [Newline("\n")] [] - 1: (empty) - 2: L_BRACK@23..24 "[" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@24..29 - 0: JS_STRING_LITERAL@24..29 "\"bar\"" [] [] - 4: R_BRACK@29..30 "]" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@30..44 - 0: JS_COMPUTED_MEMBER_EXPRESSION@30..44 - 0: JS_COMPUTED_MEMBER_EXPRESSION@30..39 - 0: JS_IDENTIFIER_EXPRESSION@30..34 - 0: JS_REFERENCE_IDENTIFIER@30..34 - 0: IDENT@30..34 "foo" [Newline("\n")] [] - 1: (empty) - 2: L_BRACK@34..35 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@35..38 - 0: JS_REFERENCE_IDENTIFIER@35..38 - 0: IDENT@35..38 "bar" [] [] - 4: R_BRACK@38..39 "]" [] [] - 1: (empty) - 2: L_BRACK@39..40 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@40..43 - 0: JS_REFERENCE_IDENTIFIER@40..43 - 0: IDENT@40..43 "baz" [] [] - 4: R_BRACK@43..44 "]" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@44..55 - 0: JS_COMPUTED_MEMBER_EXPRESSION@44..55 - 0: JS_IDENTIFIER_EXPRESSION@44..48 - 0: JS_REFERENCE_IDENTIFIER@44..48 - 0: IDENT@44..48 "foo" [Newline("\n")] [] - 1: QUESTIONDOT@48..50 "?." [] [] - 2: L_BRACK@50..51 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@51..54 - 0: JS_REFERENCE_IDENTIFIER@51..54 - 0: IDENT@51..54 "bar" [] [] - 4: R_BRACK@54..55 "]" [] [] - 1: (empty) - 4: EOF@55..56 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_in.rast b/crates/biome_js_parser/test_data/inline/ok/computed_member_in.rast deleted file mode 100644 index 9a9c5ceb4fce..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/computed_member_in.rast +++ /dev/null @@ -1,78 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsComputedMemberExpression { - object: JsObjectExpression { - l_curly_token: L_CURLY@5..6 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@6..7 "}" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@7..8 "[" [] [], - member: JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@8..12 "\"x\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@12..15 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@15..16 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - r_brack_token: R_BRACK@17..18 "]" [] [], - }, - first_semi_token: SEMICOLON@18..19 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@19..20 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@22..23 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_FOR_STATEMENT@0..24 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_COMPUTED_MEMBER_EXPRESSION@5..18 - 0: JS_OBJECT_EXPRESSION@5..7 - 0: L_CURLY@5..6 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@6..6 - 2: R_CURLY@6..7 "}" [] [] - 1: (empty) - 2: L_BRACK@7..8 "[" [] [] - 3: JS_IN_EXPRESSION@8..17 - 0: JS_STRING_LITERAL_EXPRESSION@8..12 - 0: JS_STRING_LITERAL@8..12 "\"x\"" [] [Whitespace(" ")] - 1: IN_KW@12..15 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@15..17 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@16..16 - 2: R_CURLY@16..17 "}" [] [] - 4: R_BRACK@17..18 "]" [] [] - 3: SEMICOLON@18..19 ";" [] [] - 4: (empty) - 5: SEMICOLON@19..20 ";" [] [] - 6: (empty) - 7: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@22..24 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_STATEMENT_LIST@23..23 - 2: R_CURLY@23..24 "}" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.rast b/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.rast deleted file mode 100644 index 4ccfda0f76ef..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.rast +++ /dev/null @@ -1,87 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsObjectExpression { - l_curly_token: L_CURLY@5..6 "{" [] [], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsComputedMemberName { - l_brack_token: L_BRACK@6..7 "[" [] [], - expression: JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@11..14 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@15..16 "}" [] [], - }, - }, - r_brack_token: R_BRACK@16..17 "]" [] [], - }, - colon_token: COLON@17..19 ":" [] [Whitespace(" ")], - value: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@19..20 "3" [] [], - }, - }, - ], - r_curly_token: R_CURLY@20..22 "}" [] [Whitespace(" ")], - }, - first_semi_token: SEMICOLON@22..23 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@23..24 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@26..27 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_FOR_STATEMENT@0..28 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_OBJECT_EXPRESSION@5..22 - 0: L_CURLY@5..6 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@6..20 - 0: JS_PROPERTY_OBJECT_MEMBER@6..20 - 0: JS_COMPUTED_MEMBER_NAME@6..17 - 0: L_BRACK@6..7 "[" [] [] - 1: JS_IN_EXPRESSION@7..16 - 0: JS_STRING_LITERAL_EXPRESSION@7..11 - 0: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")] - 1: IN_KW@11..14 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@14..16 - 0: L_CURLY@14..15 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@15..15 - 2: R_CURLY@15..16 "}" [] [] - 2: R_BRACK@16..17 "]" [] [] - 1: COLON@17..19 ":" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@19..20 - 0: JS_NUMBER_LITERAL@19..20 "3" [] [] - 2: R_CURLY@20..22 "}" [] [Whitespace(" ")] - 3: SEMICOLON@22..23 ";" [] [] - 4: (empty) - 5: SEMICOLON@23..24 ";" [] [] - 6: (empty) - 7: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@26..28 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_STATEMENT_LIST@27..27 - 2: R_CURLY@27..28 "}" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/conditional_expr.rast b/crates/biome_js_parser/test_data/inline/ok/conditional_expr.rast deleted file mode 100644 index 6074facf03b1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/conditional_expr.rast +++ /dev/null @@ -1,110 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@4..6 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@6..10 "bar" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@10..12 ":" [] [Whitespace(" ")], - alternate: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..15 "baz" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..20 "foo" [Newline("\n")] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@20..22 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@22..26 "bar" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@26..28 ":" [] [Whitespace(" ")], - alternate: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..32 "baz" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@32..34 "?" [] [Whitespace(" ")], - consequent: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@34..38 "bar" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - alternate: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..43 "baz" [] [], - }, - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@43..44 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..44 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..43 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JS_CONDITIONAL_EXPRESSION@0..15 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "foo" [] [Whitespace(" ")] - 1: QUESTION@4..6 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@6..10 - 0: JS_REFERENCE_IDENTIFIER@6..10 - 0: IDENT@6..10 "bar" [] [Whitespace(" ")] - 3: COLON@10..12 ":" [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@12..15 - 0: JS_REFERENCE_IDENTIFIER@12..15 - 0: IDENT@12..15 "baz" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@15..43 - 0: JS_CONDITIONAL_EXPRESSION@15..43 - 0: JS_IDENTIFIER_EXPRESSION@15..20 - 0: JS_REFERENCE_IDENTIFIER@15..20 - 0: IDENT@15..20 "foo" [Newline("\n")] [Whitespace(" ")] - 1: QUESTION@20..22 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@22..26 - 0: JS_REFERENCE_IDENTIFIER@22..26 - 0: IDENT@22..26 "bar" [] [Whitespace(" ")] - 3: COLON@26..28 ":" [] [Whitespace(" ")] - 4: JS_CONDITIONAL_EXPRESSION@28..43 - 0: JS_IDENTIFIER_EXPRESSION@28..32 - 0: JS_REFERENCE_IDENTIFIER@28..32 - 0: IDENT@28..32 "baz" [] [Whitespace(" ")] - 1: QUESTION@32..34 "?" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@34..38 - 0: JS_REFERENCE_IDENTIFIER@34..38 - 0: IDENT@34..38 "bar" [] [Whitespace(" ")] - 3: COLON@38..40 ":" [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@40..43 - 0: JS_REFERENCE_IDENTIFIER@40..43 - 0: IDENT@40..43 "baz" [] [] - 1: (empty) - 4: EOF@43..44 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.rast deleted file mode 100644 index a30a54e70828..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.rast +++ /dev/null @@ -1,231 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@11..25 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@25..26 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@26..27 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@29..30 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsThisExpression { - this_token: THIS_KW@30..39 "this" [Newline("\n"), Whitespace(" ")] [], - }, - dot_token: DOT@39..40 "." [] [], - member: JsName { - value_token: IDENT@40..42 "a" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@42..44 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "a" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - ], - r_curly_token: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@52..59 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@59..63 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@63..64 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@64..80 "\"constructor\"" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@80..81 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@81..82 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@84..85 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsThisExpression { - this_token: THIS_KW@85..94 "this" [Newline("\n"), Whitespace(" ")] [], - }, - dot_token: DOT@94..95 "." [] [], - member: JsName { - value_token: IDENT@95..97 "b" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@97..99 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@99..100 "b" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@100..101 ";" [] [], - }, - ], - r_curly_token: R_CURLY@101..105 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@105..107 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@107..108 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..108 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..107 - 0: JS_CLASS_DECLARATION@0..52 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..50 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@11..50 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@11..11 - 1: JS_LITERAL_MEMBER_NAME@11..25 - 0: IDENT@11..25 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@25..29 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@26..27 - 0: JS_FORMAL_PARAMETER@26..27 - 0: JS_DECORATOR_LIST@26..26 - 1: JS_IDENTIFIER_BINDING@26..27 - 0: IDENT@26..27 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@27..29 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@29..50 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_DIRECTIVE_LIST@30..30 - 2: JS_STATEMENT_LIST@30..46 - 0: JS_EXPRESSION_STATEMENT@30..46 - 0: JS_ASSIGNMENT_EXPRESSION@30..45 - 0: JS_STATIC_MEMBER_ASSIGNMENT@30..42 - 0: JS_THIS_EXPRESSION@30..39 - 0: THIS_KW@30..39 "this" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@39..40 "." [] [] - 2: JS_NAME@40..42 - 0: IDENT@40..42 "a" [] [Whitespace(" ")] - 1: EQ@42..44 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "a" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 3: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@50..52 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@52..107 - 0: JS_DECORATOR_LIST@52..52 - 1: (empty) - 2: CLASS_KW@52..59 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@59..63 - 0: IDENT@59..63 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@63..64 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@64..105 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@64..105 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@64..64 - 1: JS_LITERAL_MEMBER_NAME@64..80 - 0: JS_STRING_LITERAL@64..80 "\"constructor\"" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@80..84 - 0: L_PAREN@80..81 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@81..82 - 0: JS_FORMAL_PARAMETER@81..82 - 0: JS_DECORATOR_LIST@81..81 - 1: JS_IDENTIFIER_BINDING@81..82 - 0: IDENT@81..82 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@84..105 - 0: L_CURLY@84..85 "{" [] [] - 1: JS_DIRECTIVE_LIST@85..85 - 2: JS_STATEMENT_LIST@85..101 - 0: JS_EXPRESSION_STATEMENT@85..101 - 0: JS_ASSIGNMENT_EXPRESSION@85..100 - 0: JS_STATIC_MEMBER_ASSIGNMENT@85..97 - 0: JS_THIS_EXPRESSION@85..94 - 0: THIS_KW@85..94 "this" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@94..95 "." [] [] - 2: JS_NAME@95..97 - 0: IDENT@95..97 "b" [] [Whitespace(" ")] - 1: EQ@97..99 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@99..100 - 0: JS_REFERENCE_IDENTIFIER@99..100 - 0: IDENT@99..100 "b" [] [] - 1: SEMICOLON@100..101 ";" [] [] - 3: R_CURLY@101..105 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@105..107 "}" [Newline("\n")] [] - 4: EOF@107..108 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/continue_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/continue_stmt.rast deleted file mode 100644 index c85e11e69d92..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/continue_stmt.rast +++ /dev/null @@ -1,103 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..5 "outer" [] [], - }, - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - body: JsWhileStatement { - while_token: WHILE_KW@7..12 "while" [] [], - l_paren_token: L_PAREN@12..13 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@13..17 "true" [] [], - }, - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@19..20 "{" [] [], - statements: JsStatementList [ - JsWhileStatement { - while_token: WHILE_KW@20..27 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@27..28 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@28..32 "true" [] [], - }, - r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@34..35 "{" [] [], - statements: JsStatementList [ - JsContinueStatement { - continue_token: CONTINUE_KW@35..46 "continue" [Newline("\n"), Whitespace(" ")] [], - label: missing (optional), - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsContinueStatement { - continue_token: CONTINUE_KW@47..61 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - label: JsLabel { - value_token: IDENT@61..66 "outer" [] [], - }, - semicolon_token: SEMICOLON@66..67 ";" [] [], - }, - ], - r_curly_token: R_CURLY@67..72 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - JsContinueStatement { - continue_token: CONTINUE_KW@72..83 "continue" [Newline("\n"), Whitespace(" ")] [], - label: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@83..85 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@85..86 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..86 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..85 - 0: JS_LABELED_STATEMENT@0..85 - 0: JS_LABEL@0..5 - 0: IDENT@0..5 "outer" [] [] - 1: COLON@5..7 ":" [] [Whitespace(" ")] - 2: JS_WHILE_STATEMENT@7..85 - 0: WHILE_KW@7..12 "while" [] [] - 1: L_PAREN@12..13 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@13..17 - 0: TRUE_KW@13..17 "true" [] [] - 3: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@19..85 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_STATEMENT_LIST@20..83 - 0: JS_WHILE_STATEMENT@20..72 - 0: WHILE_KW@20..27 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@27..28 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@28..32 - 0: TRUE_KW@28..32 "true" [] [] - 3: R_PAREN@32..34 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@34..72 - 0: L_CURLY@34..35 "{" [] [] - 1: JS_STATEMENT_LIST@35..67 - 0: JS_CONTINUE_STATEMENT@35..47 - 0: CONTINUE_KW@35..46 "continue" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: SEMICOLON@46..47 ";" [] [] - 1: JS_CONTINUE_STATEMENT@47..67 - 0: CONTINUE_KW@47..61 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LABEL@61..66 - 0: IDENT@61..66 "outer" [] [] - 2: SEMICOLON@66..67 ";" [] [] - 2: R_CURLY@67..72 "}" [Newline("\n"), Whitespace(" ")] [] - 1: JS_CONTINUE_STATEMENT@72..83 - 0: CONTINUE_KW@72..83 "continue" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 2: R_CURLY@83..85 "}" [Newline("\n")] [] - 4: EOF@85..86 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.rast deleted file mode 100644 index e4cb474f5422..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.rast +++ /dev/null @@ -1,22 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsDebuggerStatement { - debugger_token: DEBUGGER_KW@0..8 "debugger" [] [], - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - ], - eof_token: EOF@9..10 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..10 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..9 - 0: JS_DEBUGGER_STATEMENT@0..9 - 0: DEBUGGER_KW@0..8 "debugger" [] [] - 1: SEMICOLON@8..9 ";" [] [] - 4: EOF@9..10 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator.rast b/crates/biome_js_parser/test_data/inline/ok/decorator.rast deleted file mode 100644 index 4262058e5678..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator.rast +++ /dev/null @@ -1,1325 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..25 "let" [Comments("// class expressions"), Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@25..27 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@27..29 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@29..30 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..40 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - class_token: CLASS_KW@40..46 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@46..47 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@47..48 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@48..49 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@54..56 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@56..58 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@58..59 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..69 "decorator" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@69..70 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@70..87 "functionDecorator" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@87..88 "(" [] [], - args: JsCallArgumentList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@88..89 "1" [] [], - }, - COMMA@89..90 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@90..91 "2" [] [], - }, - COMMA@91..92 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@92..93 "3" [] [], - }, - ], - r_paren_token: R_PAREN@93..95 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - class_token: CLASS_KW@95..101 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@101..102 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@102..103 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@104..109 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@109..111 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@111..113 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@113..114 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@114..120 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@120..121 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@121..128 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - class_token: CLASS_KW@128..134 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@134..138 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@138..139 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@139..140 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@140..164 "@" [Newline("\n"), Comments("// class declarations"), Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@164..174 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@174..180 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@180..184 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@184..185 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@185..186 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@186..187 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@187..189 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@189..199 "decorator" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@199..200 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@200..217 "functionDecorator" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@217..218 "(" [] [], - args: JsCallArgumentList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@218..219 "1" [] [], - }, - COMMA@219..220 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@220..221 "2" [] [], - }, - COMMA@221..222 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@222..223 "3" [] [], - }, - ], - r_paren_token: R_PAREN@223..225 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@225..231 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@231..235 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@235..236 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@236..237 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@237..238 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@238..240 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@240..246 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@246..247 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@247..254 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@254..260 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@260..264 "Baz" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@264..265 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@265..266 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@266..299 "@" [Newline("\n"), Comments("// abstract class dec ..."), Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@299..309 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@309..318 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@318..324 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@324..328 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@328..329 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@329..330 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@330..331 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@331..333 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@333..343 "decorator" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@343..344 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@344..361 "functionDecorator" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@361..362 "(" [] [], - args: JsCallArgumentList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@362..363 "1" [] [], - }, - COMMA@363..364 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@364..365 "2" [] [], - }, - COMMA@365..366 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@366..367 "3" [] [], - }, - ], - r_paren_token: R_PAREN@367..369 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@369..378 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@378..384 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@384..388 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@388..389 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@389..390 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@390..391 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@391..393 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@393..399 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@399..400 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@400..407 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@407..416 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@416..422 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@422..426 "Baz" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@426..427 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@427..428 "}" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@428..467 "export" [Newline("\n"), Comments("// exported class dec ..."), Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@467..468 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@468..478 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@478..484 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@484..488 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@488..489 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@489..490 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@490..491 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@491..499 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@499..500 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@500..510 "decorator" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@510..511 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@511..528 "functionDecorator" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@528..529 "(" [] [], - args: JsCallArgumentList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@529..530 "1" [] [], - }, - COMMA@530..531 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@531..532 "2" [] [], - }, - COMMA@532..533 "," [] [], - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@533..534 "3" [] [], - }, - ], - r_paren_token: R_PAREN@534..536 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@536..542 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@542..546 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@546..547 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@547..548 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@548..549 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@549..557 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@557..558 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@558..564 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@564..565 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@565..572 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@572..578 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@578..582 "Baz" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@582..583 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@583..584 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@584..586 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@586..595 "decorator" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@595..603 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@603..609 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@609..613 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@613..615 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@615..616 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@616..618 "@" [Newline("\n")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@618..623 "first" [] [], - }, - }, - operator_token: DOT@623..624 "." [] [], - member: JsName { - value_token: IDENT@624..630 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@630..631 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@631..638 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@638..639 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@639..640 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@640..641 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@641..643 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@643..646 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@646..655 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@655..656 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@656..657 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@657..658 ")" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@658..666 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@666..672 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@672..676 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@676..677 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@677..678 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@678..680 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@680..686 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@686..694 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@694..695 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@695..701 "after" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@701..707 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@707..711 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@711..713 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@713..714 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@714..716 "@" [Newline("\n")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@716..722 "before" [] [], - }, - }, - operator_token: DOT@722..723 "." [] [], - member: JsName { - value_token: IDENT@723..729 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@729..730 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@730..737 "before" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@737..738 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@738..739 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@739..740 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@740..742 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@742..745 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@745..754 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@754..755 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@755..756 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@756..757 ")" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@757..765 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@765..766 "@" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@766..771 "after" [] [], - }, - }, - operator_token: DOT@771..772 "." [] [], - member: JsName { - value_token: IDENT@772..778 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@778..779 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@779..785 "after" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@785..786 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@786..787 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@787..788 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@788..790 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@790..793 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@793..802 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@802..803 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@803..804 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@804..806 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@806..812 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@812..816 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@816..817 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@817..818 "}" [] [], - }, - }, - ], - eof_token: EOF@818..819 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..819 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..818 - 0: JS_VARIABLE_STATEMENT@0..49 - 0: JS_VARIABLE_DECLARATION@0..48 - 0: (empty) - 1: LET_KW@0..25 "let" [Comments("// class expressions"), Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@25..48 - 0: JS_VARIABLE_DECLARATOR@25..48 - 0: JS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@27..48 - 0: EQ@27..29 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@29..48 - 0: JS_DECORATOR_LIST@29..40 - 0: JS_DECORATOR@29..40 - 0: AT@29..30 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@30..40 - 0: JS_REFERENCE_IDENTIFIER@30..40 - 0: IDENT@30..40 "decorator" [] [Whitespace(" ")] - 1: CLASS_KW@40..46 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@46..47 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@47..47 - 8: R_CURLY@47..48 "}" [] [] - 1: SEMICOLON@48..49 ";" [] [] - 1: JS_VARIABLE_STATEMENT@49..104 - 0: JS_VARIABLE_DECLARATION@49..103 - 0: (empty) - 1: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@54..103 - 0: JS_VARIABLE_DECLARATOR@54..103 - 0: JS_IDENTIFIER_BINDING@54..56 - 0: IDENT@54..56 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@56..103 - 0: EQ@56..58 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@58..103 - 0: JS_DECORATOR_LIST@58..95 - 0: JS_DECORATOR@58..69 - 0: AT@58..59 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@59..69 - 0: JS_REFERENCE_IDENTIFIER@59..69 - 0: IDENT@59..69 "decorator" [] [Whitespace(" ")] - 1: JS_DECORATOR@69..95 - 0: AT@69..70 "@" [] [] - 1: JS_CALL_EXPRESSION@70..95 - 0: JS_IDENTIFIER_EXPRESSION@70..87 - 0: JS_REFERENCE_IDENTIFIER@70..87 - 0: IDENT@70..87 "functionDecorator" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@87..95 - 0: L_PAREN@87..88 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@88..93 - 0: JS_NUMBER_LITERAL_EXPRESSION@88..89 - 0: JS_NUMBER_LITERAL@88..89 "1" [] [] - 1: COMMA@89..90 "," [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@90..91 - 0: JS_NUMBER_LITERAL@90..91 "2" [] [] - 3: COMMA@91..92 "," [] [] - 4: JS_NUMBER_LITERAL_EXPRESSION@92..93 - 0: JS_NUMBER_LITERAL@92..93 "3" [] [] - 2: R_PAREN@93..95 ")" [] [Whitespace(" ")] - 1: CLASS_KW@95..101 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@101..102 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@102..102 - 8: R_CURLY@102..103 "}" [] [] - 1: SEMICOLON@103..104 ";" [] [] - 2: JS_VARIABLE_STATEMENT@104..140 - 0: JS_VARIABLE_DECLARATION@104..140 - 0: (empty) - 1: LET_KW@104..109 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@109..140 - 0: JS_VARIABLE_DECLARATOR@109..140 - 0: JS_IDENTIFIER_BINDING@109..111 - 0: IDENT@109..111 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@111..140 - 0: EQ@111..113 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@113..140 - 0: JS_DECORATOR_LIST@113..128 - 0: JS_DECORATOR@113..120 - 0: AT@113..114 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@114..120 - 0: JS_REFERENCE_IDENTIFIER@114..120 - 0: IDENT@114..120 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@120..128 - 0: AT@120..121 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@121..128 - 0: JS_REFERENCE_IDENTIFIER@121..128 - 0: IDENT@121..128 "second" [] [Whitespace(" ")] - 1: CLASS_KW@128..134 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@134..138 - 0: IDENT@134..138 "Foo" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@138..139 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@139..139 - 8: R_CURLY@139..140 "}" [] [] - 1: (empty) - 3: JS_CLASS_DECLARATION@140..186 - 0: JS_DECORATOR_LIST@140..174 - 0: JS_DECORATOR@140..174 - 0: AT@140..164 "@" [Newline("\n"), Comments("// class declarations"), Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@164..174 - 0: JS_REFERENCE_IDENTIFIER@164..174 - 0: IDENT@164..174 "decorator" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@174..180 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@180..184 - 0: IDENT@180..184 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@184..185 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@185..185 - 9: R_CURLY@185..186 "}" [] [] - 4: JS_EMPTY_STATEMENT@186..187 - 0: SEMICOLON@186..187 ";" [] [] - 5: JS_CLASS_DECLARATION@187..237 - 0: JS_DECORATOR_LIST@187..225 - 0: JS_DECORATOR@187..199 - 0: AT@187..189 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@189..199 - 0: JS_REFERENCE_IDENTIFIER@189..199 - 0: IDENT@189..199 "decorator" [] [Whitespace(" ")] - 1: JS_DECORATOR@199..225 - 0: AT@199..200 "@" [] [] - 1: JS_CALL_EXPRESSION@200..225 - 0: JS_IDENTIFIER_EXPRESSION@200..217 - 0: JS_REFERENCE_IDENTIFIER@200..217 - 0: IDENT@200..217 "functionDecorator" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@217..225 - 0: L_PAREN@217..218 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@218..223 - 0: JS_NUMBER_LITERAL_EXPRESSION@218..219 - 0: JS_NUMBER_LITERAL@218..219 "1" [] [] - 1: COMMA@219..220 "," [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@220..221 - 0: JS_NUMBER_LITERAL@220..221 "2" [] [] - 3: COMMA@221..222 "," [] [] - 4: JS_NUMBER_LITERAL_EXPRESSION@222..223 - 0: JS_NUMBER_LITERAL@222..223 "3" [] [] - 2: R_PAREN@223..225 ")" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@225..231 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@231..235 - 0: IDENT@231..235 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@235..236 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@236..236 - 9: R_CURLY@236..237 "}" [] [] - 6: JS_EMPTY_STATEMENT@237..238 - 0: SEMICOLON@237..238 ";" [] [] - 7: JS_CLASS_DECLARATION@238..266 - 0: JS_DECORATOR_LIST@238..254 - 0: JS_DECORATOR@238..246 - 0: AT@238..240 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@240..246 - 0: JS_REFERENCE_IDENTIFIER@240..246 - 0: IDENT@240..246 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@246..254 - 0: AT@246..247 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@247..254 - 0: JS_REFERENCE_IDENTIFIER@247..254 - 0: IDENT@247..254 "second" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@254..260 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@260..264 - 0: IDENT@260..264 "Baz" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@264..265 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@265..265 - 9: R_CURLY@265..266 "}" [] [] - 8: JS_CLASS_DECLARATION@266..330 - 0: JS_DECORATOR_LIST@266..309 - 0: JS_DECORATOR@266..309 - 0: AT@266..299 "@" [Newline("\n"), Comments("// abstract class dec ..."), Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@299..309 - 0: JS_REFERENCE_IDENTIFIER@299..309 - 0: IDENT@299..309 "decorator" [] [Whitespace(" ")] - 1: ABSTRACT_KW@309..318 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@318..324 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@324..328 - 0: IDENT@324..328 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@328..329 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@329..329 - 9: R_CURLY@329..330 "}" [] [] - 9: JS_EMPTY_STATEMENT@330..331 - 0: SEMICOLON@330..331 ";" [] [] - 10: JS_CLASS_DECLARATION@331..390 - 0: JS_DECORATOR_LIST@331..369 - 0: JS_DECORATOR@331..343 - 0: AT@331..333 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@333..343 - 0: JS_REFERENCE_IDENTIFIER@333..343 - 0: IDENT@333..343 "decorator" [] [Whitespace(" ")] - 1: JS_DECORATOR@343..369 - 0: AT@343..344 "@" [] [] - 1: JS_CALL_EXPRESSION@344..369 - 0: JS_IDENTIFIER_EXPRESSION@344..361 - 0: JS_REFERENCE_IDENTIFIER@344..361 - 0: IDENT@344..361 "functionDecorator" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@361..369 - 0: L_PAREN@361..362 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@362..367 - 0: JS_NUMBER_LITERAL_EXPRESSION@362..363 - 0: JS_NUMBER_LITERAL@362..363 "1" [] [] - 1: COMMA@363..364 "," [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@364..365 - 0: JS_NUMBER_LITERAL@364..365 "2" [] [] - 3: COMMA@365..366 "," [] [] - 4: JS_NUMBER_LITERAL_EXPRESSION@366..367 - 0: JS_NUMBER_LITERAL@366..367 "3" [] [] - 2: R_PAREN@367..369 ")" [] [Whitespace(" ")] - 1: ABSTRACT_KW@369..378 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@378..384 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@384..388 - 0: IDENT@384..388 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@388..389 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@389..389 - 9: R_CURLY@389..390 "}" [] [] - 11: JS_EMPTY_STATEMENT@390..391 - 0: SEMICOLON@390..391 ";" [] [] - 12: JS_CLASS_DECLARATION@391..428 - 0: JS_DECORATOR_LIST@391..407 - 0: JS_DECORATOR@391..399 - 0: AT@391..393 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@393..399 - 0: JS_REFERENCE_IDENTIFIER@393..399 - 0: IDENT@393..399 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@399..407 - 0: AT@399..400 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@400..407 - 0: JS_REFERENCE_IDENTIFIER@400..407 - 0: IDENT@400..407 "second" [] [Whitespace(" ")] - 1: ABSTRACT_KW@407..416 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@416..422 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@422..426 - 0: IDENT@422..426 "Baz" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@426..427 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@427..427 - 9: R_CURLY@427..428 "}" [] [] - 13: JS_EXPORT@428..490 - 0: JS_DECORATOR_LIST@428..428 - 1: EXPORT_KW@428..467 "export" [Newline("\n"), Comments("// exported class dec ..."), Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@467..490 - 0: JS_DECORATOR_LIST@467..478 - 0: JS_DECORATOR@467..478 - 0: AT@467..468 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@468..478 - 0: JS_REFERENCE_IDENTIFIER@468..478 - 0: IDENT@468..478 "decorator" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@478..484 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@484..488 - 0: IDENT@484..488 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@488..489 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@489..489 - 9: R_CURLY@489..490 "}" [] [] - 14: JS_EMPTY_STATEMENT@490..491 - 0: SEMICOLON@490..491 ";" [] [] - 15: JS_EXPORT@491..548 - 0: JS_DECORATOR_LIST@491..491 - 1: EXPORT_KW@491..499 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@499..548 - 0: JS_DECORATOR_LIST@499..536 - 0: JS_DECORATOR@499..510 - 0: AT@499..500 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@500..510 - 0: JS_REFERENCE_IDENTIFIER@500..510 - 0: IDENT@500..510 "decorator" [] [Whitespace(" ")] - 1: JS_DECORATOR@510..536 - 0: AT@510..511 "@" [] [] - 1: JS_CALL_EXPRESSION@511..536 - 0: JS_IDENTIFIER_EXPRESSION@511..528 - 0: JS_REFERENCE_IDENTIFIER@511..528 - 0: IDENT@511..528 "functionDecorator" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@528..536 - 0: L_PAREN@528..529 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@529..534 - 0: JS_NUMBER_LITERAL_EXPRESSION@529..530 - 0: JS_NUMBER_LITERAL@529..530 "1" [] [] - 1: COMMA@530..531 "," [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@531..532 - 0: JS_NUMBER_LITERAL@531..532 "2" [] [] - 3: COMMA@532..533 "," [] [] - 4: JS_NUMBER_LITERAL_EXPRESSION@533..534 - 0: JS_NUMBER_LITERAL@533..534 "3" [] [] - 2: R_PAREN@534..536 ")" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@536..542 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@542..546 - 0: IDENT@542..546 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@546..547 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@547..547 - 9: R_CURLY@547..548 "}" [] [] - 16: JS_EMPTY_STATEMENT@548..549 - 0: SEMICOLON@548..549 ";" [] [] - 17: JS_EXPORT@549..584 - 0: JS_DECORATOR_LIST@549..549 - 1: EXPORT_KW@549..557 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@557..584 - 0: JS_DECORATOR_LIST@557..572 - 0: JS_DECORATOR@557..564 - 0: AT@557..558 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@558..564 - 0: JS_REFERENCE_IDENTIFIER@558..564 - 0: IDENT@558..564 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@564..572 - 0: AT@564..565 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@565..572 - 0: JS_REFERENCE_IDENTIFIER@565..572 - 0: IDENT@565..572 "second" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@572..578 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@578..582 - 0: IDENT@578..582 "Baz" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@582..583 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@583..583 - 9: R_CURLY@583..584 "}" [] [] - 18: JS_EXPORT@584..616 - 0: JS_DECORATOR_LIST@584..595 - 0: JS_DECORATOR@584..595 - 0: AT@584..586 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@586..595 - 0: JS_REFERENCE_IDENTIFIER@586..595 - 0: IDENT@586..595 "decorator" [] [] - 1: EXPORT_KW@595..603 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@603..616 - 0: JS_DECORATOR_LIST@603..603 - 1: (empty) - 2: CLASS_KW@603..609 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@609..613 - 0: IDENT@609..613 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@613..615 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@615..615 - 9: R_CURLY@615..616 "}" [] [] - 19: JS_EXPORT@616..678 - 0: JS_DECORATOR_LIST@616..658 - 0: JS_DECORATOR@616..630 - 0: AT@616..618 "@" [Newline("\n")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@618..630 - 0: JS_IDENTIFIER_EXPRESSION@618..623 - 0: JS_REFERENCE_IDENTIFIER@618..623 - 0: IDENT@618..623 "first" [] [] - 1: DOT@623..624 "." [] [] - 2: JS_NAME@624..630 - 0: IDENT@624..630 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@630..638 - 0: AT@630..631 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@631..638 - 0: JS_REFERENCE_IDENTIFIER@631..638 - 0: IDENT@631..638 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@638..658 - 0: AT@638..639 "@" [] [] - 1: JS_CALL_EXPRESSION@639..658 - 0: JS_PARENTHESIZED_EXPRESSION@639..656 - 0: L_PAREN@639..640 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@640..655 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@640..643 - 0: L_PAREN@640..641 "(" [] [] - 1: JS_PARAMETER_LIST@641..641 - 2: R_PAREN@641..643 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@643..646 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@646..655 - 0: JS_REFERENCE_IDENTIFIER@646..655 - 0: IDENT@646..655 "decorator" [] [] - 2: R_PAREN@655..656 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@656..658 - 0: L_PAREN@656..657 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@657..657 - 2: R_PAREN@657..658 ")" [] [] - 1: EXPORT_KW@658..666 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@666..678 - 0: JS_DECORATOR_LIST@666..666 - 1: (empty) - 2: CLASS_KW@666..672 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@672..676 - 0: IDENT@672..676 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@676..677 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@677..677 - 9: R_CURLY@677..678 "}" [] [] - 20: JS_EXPORT@678..714 - 0: JS_DECORATOR_LIST@678..686 - 0: JS_DECORATOR@678..686 - 0: AT@678..680 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@680..686 - 0: JS_REFERENCE_IDENTIFIER@680..686 - 0: IDENT@680..686 "before" [] [] - 1: EXPORT_KW@686..694 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@694..714 - 0: JS_DECORATOR_LIST@694..701 - 0: JS_DECORATOR@694..701 - 0: AT@694..695 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@695..701 - 0: JS_REFERENCE_IDENTIFIER@695..701 - 0: IDENT@695..701 "after" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@701..707 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@707..711 - 0: IDENT@707..711 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@711..713 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@713..713 - 9: R_CURLY@713..714 "}" [] [] - 21: JS_EXPORT@714..818 - 0: JS_DECORATOR_LIST@714..757 - 0: JS_DECORATOR@714..729 - 0: AT@714..716 "@" [Newline("\n")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@716..729 - 0: JS_IDENTIFIER_EXPRESSION@716..722 - 0: JS_REFERENCE_IDENTIFIER@716..722 - 0: IDENT@716..722 "before" [] [] - 1: DOT@722..723 "." [] [] - 2: JS_NAME@723..729 - 0: IDENT@723..729 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@729..737 - 0: AT@729..730 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@730..737 - 0: JS_REFERENCE_IDENTIFIER@730..737 - 0: IDENT@730..737 "before" [] [Whitespace(" ")] - 2: JS_DECORATOR@737..757 - 0: AT@737..738 "@" [] [] - 1: JS_CALL_EXPRESSION@738..757 - 0: JS_PARENTHESIZED_EXPRESSION@738..755 - 0: L_PAREN@738..739 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@739..754 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@739..742 - 0: L_PAREN@739..740 "(" [] [] - 1: JS_PARAMETER_LIST@740..740 - 2: R_PAREN@740..742 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@742..745 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@745..754 - 0: JS_REFERENCE_IDENTIFIER@745..754 - 0: IDENT@745..754 "decorator" [] [] - 2: R_PAREN@754..755 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@755..757 - 0: L_PAREN@755..756 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@756..756 - 2: R_PAREN@756..757 ")" [] [] - 1: EXPORT_KW@757..765 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@765..818 - 0: JS_DECORATOR_LIST@765..806 - 0: JS_DECORATOR@765..778 - 0: AT@765..766 "@" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@766..778 - 0: JS_IDENTIFIER_EXPRESSION@766..771 - 0: JS_REFERENCE_IDENTIFIER@766..771 - 0: IDENT@766..771 "after" [] [] - 1: DOT@771..772 "." [] [] - 2: JS_NAME@772..778 - 0: IDENT@772..778 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@778..785 - 0: AT@778..779 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@779..785 - 0: JS_REFERENCE_IDENTIFIER@779..785 - 0: IDENT@779..785 "after" [] [Whitespace(" ")] - 2: JS_DECORATOR@785..806 - 0: AT@785..786 "@" [] [] - 1: JS_CALL_EXPRESSION@786..806 - 0: JS_PARENTHESIZED_EXPRESSION@786..803 - 0: L_PAREN@786..787 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@787..802 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@787..790 - 0: L_PAREN@787..788 "(" [] [] - 1: JS_PARAMETER_LIST@788..788 - 2: R_PAREN@788..790 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@790..793 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@793..802 - 0: JS_REFERENCE_IDENTIFIER@793..802 - 0: IDENT@793..802 "decorator" [] [] - 2: R_PAREN@802..803 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@803..806 - 0: L_PAREN@803..804 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@804..804 - 2: R_PAREN@804..806 ")" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@806..812 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@812..816 - 0: IDENT@812..816 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@816..817 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@817..817 - 9: R_CURLY@817..818 "}" [] [] - 4: EOF@818..819 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.rast deleted file mode 100644 index d64c5e0fb37c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.rast +++ /dev/null @@ -1,213 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..33 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@33..42 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@42..48 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@48..50 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@50..51 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@51..52 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@52..59 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..64 "first" [] [], - }, - }, - operator_token: DOT@64..65 "." [] [], - member: JsName { - value_token: IDENT@65..71 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@71..72 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@72..79 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@79..80 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@80..81 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@81..82 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@87..96 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@96..97 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@97..98 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@98..99 ")" [] [], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@99..114 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - class_token: CLASS_KW@114..120 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@120..124 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@124..125 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - ], - r_curly_token: R_CURLY@126..128 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@128..129 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..129 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..128 - 0: JS_FUNCTION_DECLARATION@0..128 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..128 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..126 - 0: JS_CLASS_DECLARATION@16..52 - 0: JS_DECORATOR_LIST@16..33 - 0: JS_DECORATOR@16..33 - 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@23..33 - 0: JS_REFERENCE_IDENTIFIER@23..33 - 0: IDENT@23..33 "decorator" [] [Whitespace(" ")] - 1: ABSTRACT_KW@33..42 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@42..48 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@48..50 - 0: IDENT@48..50 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@50..51 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@51..51 - 9: R_CURLY@51..52 "}" [] [] - 1: JS_CLASS_DECLARATION@52..126 - 0: JS_DECORATOR_LIST@52..99 - 0: JS_DECORATOR@52..71 - 0: AT@52..59 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@59..71 - 0: JS_IDENTIFIER_EXPRESSION@59..64 - 0: JS_REFERENCE_IDENTIFIER@59..64 - 0: IDENT@59..64 "first" [] [] - 1: DOT@64..65 "." [] [] - 2: JS_NAME@65..71 - 0: IDENT@65..71 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@71..79 - 0: AT@71..72 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@72..79 - 0: JS_REFERENCE_IDENTIFIER@72..79 - 0: IDENT@72..79 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@79..99 - 0: AT@79..80 "@" [] [] - 1: JS_CALL_EXPRESSION@80..99 - 0: JS_PARENTHESIZED_EXPRESSION@80..97 - 0: L_PAREN@80..81 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@81..96 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@81..84 - 0: L_PAREN@81..82 "(" [] [] - 1: JS_PARAMETER_LIST@82..82 - 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@87..96 - 0: JS_REFERENCE_IDENTIFIER@87..96 - 0: IDENT@87..96 "decorator" [] [] - 2: R_PAREN@96..97 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@97..99 - 0: L_PAREN@97..98 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@98..98 - 2: R_PAREN@98..99 ")" [] [] - 1: ABSTRACT_KW@99..114 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: CLASS_KW@114..120 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@120..124 - 0: IDENT@120..124 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@124..125 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@125..125 - 9: R_CURLY@125..126 "}" [] [] - 3: R_CURLY@126..128 "}" [Newline("\n")] [] - 4: EOF@128..129 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast deleted file mode 100644 index adc94c1db19f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast +++ /dev/null @@ -1,174 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..11 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@11..20 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@20..26 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@26..28 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@28..29 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@30..32 "@" [Newline("\n")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..37 "first" [] [], - }, - }, - operator_token: DOT@37..38 "." [] [], - member: JsName { - value_token: IDENT@38..44 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@44..45 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..52 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@52..53 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@53..54 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@54..55 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@55..57 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@57..60 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@60..69 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@69..70 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@70..71 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@71..72 ")" [] [], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@72..82 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@82..88 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@88..92 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@92..93 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@93..94 "}" [] [], - }, - ], - eof_token: EOF@94..95 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..95 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..94 - 0: JS_CLASS_DECLARATION@0..30 - 0: JS_DECORATOR_LIST@0..11 - 0: JS_DECORATOR@0..11 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..11 - 0: JS_REFERENCE_IDENTIFIER@1..11 - 0: IDENT@1..11 "decorator" [] [Whitespace(" ")] - 1: ABSTRACT_KW@11..20 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@20..26 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@28..29 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@29..29 - 9: R_CURLY@29..30 "}" [] [] - 1: JS_CLASS_DECLARATION@30..94 - 0: JS_DECORATOR_LIST@30..72 - 0: JS_DECORATOR@30..44 - 0: AT@30..32 "@" [Newline("\n")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@32..44 - 0: JS_IDENTIFIER_EXPRESSION@32..37 - 0: JS_REFERENCE_IDENTIFIER@32..37 - 0: IDENT@32..37 "first" [] [] - 1: DOT@37..38 "." [] [] - 2: JS_NAME@38..44 - 0: IDENT@38..44 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@44..52 - 0: AT@44..45 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@45..52 - 0: JS_REFERENCE_IDENTIFIER@45..52 - 0: IDENT@45..52 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@52..72 - 0: AT@52..53 "@" [] [] - 1: JS_CALL_EXPRESSION@53..72 - 0: JS_PARENTHESIZED_EXPRESSION@53..70 - 0: L_PAREN@53..54 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@54..69 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@54..57 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_PARAMETER_LIST@55..55 - 2: R_PAREN@55..57 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@57..60 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@60..69 - 0: JS_REFERENCE_IDENTIFIER@60..69 - 0: IDENT@60..69 "decorator" [] [] - 2: R_PAREN@69..70 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@70..72 - 0: L_PAREN@70..71 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@71..71 - 2: R_PAREN@71..72 ")" [] [] - 1: ABSTRACT_KW@72..82 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@82..88 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@88..92 - 0: IDENT@88..92 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@92..93 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@93..93 - 9: R_CURLY@93..94 "}" [] [] - 4: EOF@94..95 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast deleted file mode 100644 index 2f1a448a6a8b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@26..35 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@35..41 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@41..45 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@47..48 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@48..49 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..49 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..48 - 0: JS_EXPORT@0..48 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..48 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@26..48 - 0: JS_DECORATOR_LIST@26..26 - 1: ABSTRACT_KW@26..35 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@35..41 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@41..45 - 0: IDENT@41..45 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@45..47 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@47..47 - 9: R_CURLY@47..48 "}" [] [] - 2: (empty) - 4: EOF@48..49 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.rast deleted file mode 100644 index d13e8676a6bf..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.rast +++ /dev/null @@ -1,213 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..32 "decorator" [] [], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@32..44 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@44..48 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@51..58 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@58..63 "first" [] [], - }, - }, - operator_token: DOT@63..64 "." [] [], - member: JsName { - value_token: IDENT@64..70 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@70..71 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@71..78 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@78..79 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@79..80 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@80..81 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@83..86 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@86..95 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@95..96 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@96..97 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@97..98 ")" [] [], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@98..110 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@110..114 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@114..115 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@115..116 "}" [] [], - }, - ], - r_curly_token: R_CURLY@116..118 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@118..119 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..119 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..118 - 0: JS_FUNCTION_DECLARATION@0..118 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..118 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..116 - 0: JS_CLASS_DECLARATION@16..51 - 0: JS_DECORATOR_LIST@16..32 - 0: JS_DECORATOR@16..32 - 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@23..32 - 0: JS_REFERENCE_IDENTIFIER@23..32 - 0: IDENT@23..32 "decorator" [] [] - 1: (empty) - 2: CLASS_KW@32..44 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@44..48 - 0: IDENT@44..48 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@48..50 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@50..50 - 9: R_CURLY@50..51 "}" [] [] - 1: JS_CLASS_DECLARATION@51..116 - 0: JS_DECORATOR_LIST@51..98 - 0: JS_DECORATOR@51..70 - 0: AT@51..58 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@58..70 - 0: JS_IDENTIFIER_EXPRESSION@58..63 - 0: JS_REFERENCE_IDENTIFIER@58..63 - 0: IDENT@58..63 "first" [] [] - 1: DOT@63..64 "." [] [] - 2: JS_NAME@64..70 - 0: IDENT@64..70 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@70..78 - 0: AT@70..71 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@71..78 - 0: JS_REFERENCE_IDENTIFIER@71..78 - 0: IDENT@71..78 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@78..98 - 0: AT@78..79 "@" [] [] - 1: JS_CALL_EXPRESSION@79..98 - 0: JS_PARENTHESIZED_EXPRESSION@79..96 - 0: L_PAREN@79..80 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@80..95 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@80..83 - 0: L_PAREN@80..81 "(" [] [] - 1: JS_PARAMETER_LIST@81..81 - 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@83..86 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@86..95 - 0: JS_REFERENCE_IDENTIFIER@86..95 - 0: IDENT@86..95 "decorator" [] [] - 2: R_PAREN@95..96 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@96..98 - 0: L_PAREN@96..97 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@97..97 - 2: R_PAREN@97..98 ")" [] [] - 1: (empty) - 2: CLASS_KW@98..110 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@110..114 - 0: IDENT@110..114 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@114..115 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@115..115 - 9: R_CURLY@115..116 "}" [] [] - 3: R_CURLY@116..118 "}" [Newline("\n")] [] - 4: EOF@118..119 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.rast deleted file mode 100644 index 13986e270a8d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.rast +++ /dev/null @@ -1,174 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@17..21 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@24..26 "@" [Newline("\n")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "first" [] [], - }, - }, - operator_token: DOT@31..32 "." [] [], - member: JsName { - value_token: IDENT@32..38 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@38..39 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@39..46 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@46..47 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@47..48 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@48..49 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@54..63 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@63..64 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@64..65 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@65..66 ")" [] [], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@66..73 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@73..77 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@77..78 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@78..79 "}" [] [], - }, - ], - eof_token: EOF@79..80 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..80 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..79 - 0: JS_CLASS_DECLARATION@0..24 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: (empty) - 2: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@17..21 - 0: IDENT@17..21 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@21..23 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@23..23 - 9: R_CURLY@23..24 "}" [] [] - 1: JS_CLASS_DECLARATION@24..79 - 0: JS_DECORATOR_LIST@24..66 - 0: JS_DECORATOR@24..38 - 0: AT@24..26 "@" [Newline("\n")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@26..38 - 0: JS_IDENTIFIER_EXPRESSION@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "first" [] [] - 1: DOT@31..32 "." [] [] - 2: JS_NAME@32..38 - 0: IDENT@32..38 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@38..46 - 0: AT@38..39 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@39..46 - 0: JS_REFERENCE_IDENTIFIER@39..46 - 0: IDENT@39..46 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@46..66 - 0: AT@46..47 "@" [] [] - 1: JS_CALL_EXPRESSION@47..66 - 0: JS_PARENTHESIZED_EXPRESSION@47..64 - 0: L_PAREN@47..48 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@48..63 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@48..51 - 0: L_PAREN@48..49 "(" [] [] - 1: JS_PARAMETER_LIST@49..49 - 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@54..63 - 0: JS_REFERENCE_IDENTIFIER@54..63 - 0: IDENT@54..63 "decorator" [] [] - 2: R_PAREN@63..64 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@64..66 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@65..65 - 2: R_PAREN@65..66 ")" [] [] - 1: (empty) - 2: CLASS_KW@66..73 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@73..77 - 0: IDENT@73..77 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@77..78 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@78..78 - 9: R_CURLY@78..79 "}" [] [] - 4: EOF@79..80 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.rast deleted file mode 100644 index 8e11b44e3399..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@32..36 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@36..38 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_EXPORT@0..39 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..39 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@26..39 - 0: JS_DECORATOR_LIST@26..26 - 1: (empty) - 2: CLASS_KW@26..32 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@32..36 - 0: IDENT@32..36 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@36..38 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@38..38 - 9: R_CURLY@38..39 "}" [] [] - 2: (empty) - 4: EOF@39..40 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.rast deleted file mode 100644 index fe860496e74a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.rast +++ /dev/null @@ -1,2858 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@11..27 "@" [Newline("\n"), Comments("// properties"), Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..31 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - name: JsLiteralMemberName { - value: IDENT@31..35 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@35..37 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@37..38 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@39..41 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..45 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@45..46 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@46..47 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@47..53 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..56 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@58..59 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..62 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@62..63 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - name: JsLiteralMemberName { - value: IDENT@65..69 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@69..71 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@71..72 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@72..73 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@73..75 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@75..79 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@79..86 "public" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@86..90 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@90..92 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@92..93 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@93..94 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@94..96 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@96..100 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@100..101 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@101..102 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@102..108 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@108..111 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@111..113 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@113..114 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@114..117 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@117..118 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@118..120 ")" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@120..127 "public" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@127..131 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@131..133 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@133..134 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@134..135 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@135..137 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..141 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@141..148 "static" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@148..152 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@152..154 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@154..155 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@155..156 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@156..158 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@158..162 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@162..163 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@163..164 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@164..170 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@170..173 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@173..175 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@175..176 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@176..179 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@179..180 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@180..182 ")" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@182..189 "static" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@189..193 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@193..195 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@195..196 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@196..197 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@197..199 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@199..203 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@203..212 "accessor" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@212..216 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@216..218 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@218..219 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@219..220 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@220..222 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@222..226 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@226..227 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@227..228 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@228..234 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@234..237 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@237..239 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@239..240 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@240..243 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@243..244 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@244..246 ")" [] [Whitespace(" ")], - }, - }, - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@246..255 "accessor" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@255..259 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@259..261 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@261..262 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@262..263 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@263..265 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@265..269 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@269..278 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@278..282 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@282..284 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@284..285 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@285..286 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@286..288 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@288..292 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@292..293 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@293..294 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@294..300 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@300..303 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@303..305 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@305..306 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@306..309 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@309..310 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@310..312 ")" [] [Whitespace(" ")], - }, - }, - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@312..321 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@321..325 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@325..327 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@327..328 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@328..329 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@329..331 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@331..335 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@335..344 "override" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@344..348 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@348..350 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@350..351 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@351..352 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@352..354 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@354..358 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@358..359 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@359..360 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@360..366 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@366..369 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@369..371 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@371..372 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@372..375 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@375..376 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@376..378 ")" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@378..387 "override" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@387..391 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@391..393 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@393..394 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@394..395 ";" [] [], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@395..408 "@" [Newline("\n"), Comments("// methods"), Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@408..412 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@412..415 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@415..416 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@416..418 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@418..419 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@419..420 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@420..422 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@422..426 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@426..427 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@427..428 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@428..434 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@434..437 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@437..439 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@439..440 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@440..443 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@443..444 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@444..446 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@446..449 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@449..450 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@450..452 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@452..453 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@453..454 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@454..456 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@456..460 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@460..467 "public" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@467..470 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@470..471 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@471..473 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@473..474 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@474..475 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@475..477 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@477..481 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@481..482 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@482..483 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@483..489 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@489..492 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@492..494 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@494..495 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@495..498 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@498..499 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@499..501 ")" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@501..508 "public" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@508..511 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@511..512 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@512..514 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@514..515 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@515..516 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@516..518 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@518..522 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@522..529 "static" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@529..532 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@532..533 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@533..535 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@535..536 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@536..537 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@537..539 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@539..543 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@543..544 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@544..545 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@545..551 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@551..554 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@554..556 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@556..557 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@557..560 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@560..561 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@561..563 ")" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@563..570 "static" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@570..573 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@573..574 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@574..576 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@576..577 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@577..578 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@578..580 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@580..584 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@584..593 "override" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@593..596 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@596..597 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@597..599 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@599..600 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@600..601 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@601..603 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@603..607 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@607..608 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@608..609 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@609..615 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@615..618 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@618..620 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@620..621 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@621..624 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@624..625 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@625..627 ")" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@627..636 "override" [] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@636..639 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@639..640 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@640..642 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@642..643 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@643..644 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@644..657 "@" [Newline("\n"), Comments("// getters"), Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@657..661 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - get_token: GET_KW@661..665 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@665..668 "foo" [] [], - }, - l_paren_token: L_PAREN@668..669 "(" [] [], - r_paren_token: R_PAREN@669..671 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@671..672 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@672..673 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@673..675 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@675..679 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@679..680 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@680..681 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@681..687 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@687..690 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@690..692 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@692..693 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@693..696 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@696..697 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@697..699 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - get_token: GET_KW@699..703 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@703..706 "foo" [] [], - }, - l_paren_token: L_PAREN@706..707 "(" [] [], - r_paren_token: R_PAREN@707..709 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@709..710 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@710..711 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@711..713 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@713..717 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@717..724 "public" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@724..728 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@728..731 "foo" [] [], - }, - l_paren_token: L_PAREN@731..732 "(" [] [], - r_paren_token: R_PAREN@732..734 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@734..735 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@735..736 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@736..738 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@738..742 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@742..743 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@743..744 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@744..750 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@750..753 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@753..755 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@755..756 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@756..759 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@759..760 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@760..762 ")" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@762..769 "public" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@769..773 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@773..776 "foo" [] [], - }, - l_paren_token: L_PAREN@776..777 "(" [] [], - r_paren_token: R_PAREN@777..779 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@779..780 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@780..781 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@781..783 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@783..787 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@787..794 "static" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@794..798 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@798..801 "foo" [] [], - }, - l_paren_token: L_PAREN@801..802 "(" [] [], - r_paren_token: R_PAREN@802..804 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@804..805 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@805..806 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@806..808 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@808..812 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@812..813 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@813..814 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@814..820 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@820..823 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@823..825 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@825..826 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@826..829 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@829..830 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@830..832 ")" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@832..839 "static" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@839..843 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@843..846 "foo" [] [], - }, - l_paren_token: L_PAREN@846..847 "(" [] [], - r_paren_token: R_PAREN@847..849 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@849..850 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@850..851 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@851..853 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@853..857 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@857..866 "override" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@866..870 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@870..873 "foo" [] [], - }, - l_paren_token: L_PAREN@873..874 "(" [] [], - r_paren_token: R_PAREN@874..876 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@876..877 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@877..878 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@878..880 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@880..884 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@884..885 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@885..886 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@886..892 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@892..895 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@895..897 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@897..898 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@898..901 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@901..902 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@902..904 ")" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@904..913 "override" [] [Whitespace(" ")], - }, - ], - get_token: GET_KW@913..917 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@917..920 "foo" [] [], - }, - l_paren_token: L_PAREN@920..921 "(" [] [], - r_paren_token: R_PAREN@921..923 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@923..924 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@924..925 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@925..938 "@" [Newline("\n"), Comments("// setters"), Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@938..942 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - set_token: SET_KW@942..946 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@946..949 "foo" [] [], - }, - l_paren_token: L_PAREN@949..950 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@950..953 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@953..955 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@955..956 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@956..957 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@957..959 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@959..963 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@963..964 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@964..965 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@965..971 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@971..974 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@974..976 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@976..977 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@977..980 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@980..981 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@981..983 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - set_token: SET_KW@983..987 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@987..990 "foo" [] [], - }, - l_paren_token: L_PAREN@990..991 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@991..994 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@994..996 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@996..997 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@997..998 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@998..1000 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1000..1004 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@1004..1011 "public" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@1011..1015 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@1015..1018 "foo" [] [], - }, - l_paren_token: L_PAREN@1018..1019 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1019..1022 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@1022..1024 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@1024..1025 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1025..1026 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@1026..1028 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1028..1032 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@1032..1033 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@1033..1034 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@1034..1040 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1040..1043 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@1043..1045 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@1045..1046 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1046..1049 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@1049..1050 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@1050..1052 ")" [] [Whitespace(" ")], - }, - }, - }, - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@1052..1059 "public" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@1059..1063 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@1063..1066 "foo" [] [], - }, - l_paren_token: L_PAREN@1066..1067 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1067..1070 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@1070..1072 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@1072..1073 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1073..1074 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@1074..1076 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1076..1080 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@1080..1087 "static" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@1087..1091 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@1091..1094 "foo" [] [], - }, - l_paren_token: L_PAREN@1094..1095 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1095..1098 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@1098..1100 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@1100..1101 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1101..1102 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@1102..1104 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1104..1108 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@1108..1109 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@1109..1110 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@1110..1116 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1116..1119 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@1119..1121 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@1121..1122 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1122..1125 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@1125..1126 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@1126..1128 ")" [] [Whitespace(" ")], - }, - }, - }, - JsStaticModifier { - modifier_token: STATIC_KW@1128..1135 "static" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@1135..1139 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@1139..1142 "foo" [] [], - }, - l_paren_token: L_PAREN@1142..1143 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1143..1146 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@1146..1148 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@1148..1149 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1149..1150 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@1150..1152 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1152..1156 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@1156..1165 "override" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@1165..1169 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@1169..1172 "foo" [] [], - }, - l_paren_token: L_PAREN@1172..1173 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1173..1176 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@1176..1178 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@1178..1179 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1179..1180 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@1180..1182 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1182..1186 "dec" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@1186..1187 "@" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@1187..1188 "(" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@1188..1194 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1194..1197 "dec" [] [], - }, - }, - }, - r_paren_token: R_PAREN@1197..1199 ")" [] [Whitespace(" ")], - }, - }, - JsDecorator { - at_token: AT@1199..1200 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1200..1203 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@1203..1204 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@1204..1206 ")" [] [Whitespace(" ")], - }, - }, - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@1206..1215 "override" [] [Whitespace(" ")], - }, - ], - set_token: SET_KW@1215..1219 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@1219..1222 "foo" [] [], - }, - l_paren_token: L_PAREN@1222..1223 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1223..1226 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@1226..1228 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@1228..1229 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1229..1230 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@1230..1232 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@1232..1233 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..1233 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..1232 - 0: JS_CLASS_DECLARATION@0..1232 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..1230 - 0: JS_PROPERTY_CLASS_MEMBER@11..39 - 0: JS_PROPERTY_MODIFIER_LIST@11..31 - 0: JS_DECORATOR@11..31 - 0: AT@11..27 "@" [Newline("\n"), Comments("// properties"), Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@27..31 - 0: JS_REFERENCE_IDENTIFIER@27..31 - 0: IDENT@27..31 "dec" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@31..35 - 0: IDENT@31..35 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@35..38 - 0: EQ@35..37 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@37..38 - 0: JS_NUMBER_LITERAL@37..38 "2" [] [] - 4: SEMICOLON@38..39 ";" [] [] - 1: JS_PROPERTY_CLASS_MEMBER@39..73 - 0: JS_PROPERTY_MODIFIER_LIST@39..65 - 0: JS_DECORATOR@39..45 - 0: AT@39..41 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@41..45 - 0: JS_REFERENCE_IDENTIFIER@41..45 - 0: IDENT@41..45 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@45..58 - 0: AT@45..46 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@46..58 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_AWAIT_EXPRESSION@47..56 - 0: AWAIT_KW@47..53 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@53..56 - 0: JS_REFERENCE_IDENTIFIER@53..56 - 0: IDENT@53..56 "dec" [] [] - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@58..65 - 0: AT@58..59 "@" [] [] - 1: JS_CALL_EXPRESSION@59..65 - 0: JS_IDENTIFIER_EXPRESSION@59..62 - 0: JS_REFERENCE_IDENTIFIER@59..62 - 0: IDENT@59..62 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@62..65 - 0: L_PAREN@62..63 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@63..63 - 2: R_PAREN@63..65 ")" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@65..69 - 0: IDENT@65..69 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@69..72 - 0: EQ@69..71 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@71..72 - 0: JS_NUMBER_LITERAL@71..72 "2" [] [] - 4: SEMICOLON@72..73 ";" [] [] - 2: JS_PROPERTY_CLASS_MEMBER@73..94 - 0: JS_PROPERTY_MODIFIER_LIST@73..86 - 0: JS_DECORATOR@73..79 - 0: AT@73..75 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@75..79 - 0: JS_REFERENCE_IDENTIFIER@75..79 - 0: IDENT@75..79 "dec" [] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@79..86 - 0: PUBLIC_KW@79..86 "public" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@86..90 - 0: IDENT@86..90 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@90..93 - 0: EQ@90..92 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@92..93 - 0: JS_NUMBER_LITERAL@92..93 "1" [] [] - 4: SEMICOLON@93..94 ";" [] [] - 3: JS_PROPERTY_CLASS_MEMBER@94..135 - 0: JS_PROPERTY_MODIFIER_LIST@94..127 - 0: JS_DECORATOR@94..100 - 0: AT@94..96 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@96..100 - 0: JS_REFERENCE_IDENTIFIER@96..100 - 0: IDENT@96..100 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@100..113 - 0: AT@100..101 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@101..113 - 0: L_PAREN@101..102 "(" [] [] - 1: JS_AWAIT_EXPRESSION@102..111 - 0: AWAIT_KW@102..108 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@108..111 - 0: JS_REFERENCE_IDENTIFIER@108..111 - 0: IDENT@108..111 "dec" [] [] - 2: R_PAREN@111..113 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@113..120 - 0: AT@113..114 "@" [] [] - 1: JS_CALL_EXPRESSION@114..120 - 0: JS_IDENTIFIER_EXPRESSION@114..117 - 0: JS_REFERENCE_IDENTIFIER@114..117 - 0: IDENT@114..117 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@117..120 - 0: L_PAREN@117..118 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@118..118 - 2: R_PAREN@118..120 ")" [] [Whitespace(" ")] - 3: TS_ACCESSIBILITY_MODIFIER@120..127 - 0: PUBLIC_KW@120..127 "public" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@127..131 - 0: IDENT@127..131 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@131..134 - 0: EQ@131..133 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@133..134 - 0: JS_NUMBER_LITERAL@133..134 "1" [] [] - 4: SEMICOLON@134..135 ";" [] [] - 4: JS_PROPERTY_CLASS_MEMBER@135..156 - 0: JS_PROPERTY_MODIFIER_LIST@135..148 - 0: JS_DECORATOR@135..141 - 0: AT@135..137 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@137..141 - 0: JS_REFERENCE_IDENTIFIER@137..141 - 0: IDENT@137..141 "dec" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@141..148 - 0: STATIC_KW@141..148 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@148..152 - 0: IDENT@148..152 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@152..155 - 0: EQ@152..154 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@154..155 - 0: JS_NUMBER_LITERAL@154..155 "2" [] [] - 4: SEMICOLON@155..156 ";" [] [] - 5: JS_PROPERTY_CLASS_MEMBER@156..197 - 0: JS_PROPERTY_MODIFIER_LIST@156..189 - 0: JS_DECORATOR@156..162 - 0: AT@156..158 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@158..162 - 0: JS_REFERENCE_IDENTIFIER@158..162 - 0: IDENT@158..162 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@162..175 - 0: AT@162..163 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@163..175 - 0: L_PAREN@163..164 "(" [] [] - 1: JS_AWAIT_EXPRESSION@164..173 - 0: AWAIT_KW@164..170 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@170..173 - 0: JS_REFERENCE_IDENTIFIER@170..173 - 0: IDENT@170..173 "dec" [] [] - 2: R_PAREN@173..175 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@175..182 - 0: AT@175..176 "@" [] [] - 1: JS_CALL_EXPRESSION@176..182 - 0: JS_IDENTIFIER_EXPRESSION@176..179 - 0: JS_REFERENCE_IDENTIFIER@176..179 - 0: IDENT@176..179 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@179..182 - 0: L_PAREN@179..180 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@180..180 - 2: R_PAREN@180..182 ")" [] [Whitespace(" ")] - 3: JS_STATIC_MODIFIER@182..189 - 0: STATIC_KW@182..189 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@189..193 - 0: IDENT@189..193 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@193..196 - 0: EQ@193..195 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@195..196 - 0: JS_NUMBER_LITERAL@195..196 "2" [] [] - 4: SEMICOLON@196..197 ";" [] [] - 6: JS_PROPERTY_CLASS_MEMBER@197..220 - 0: JS_PROPERTY_MODIFIER_LIST@197..212 - 0: JS_DECORATOR@197..203 - 0: AT@197..199 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@199..203 - 0: JS_REFERENCE_IDENTIFIER@199..203 - 0: IDENT@199..203 "dec" [] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@203..212 - 0: ACCESSOR_KW@203..212 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@212..216 - 0: IDENT@212..216 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@216..219 - 0: EQ@216..218 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@218..219 - 0: JS_NUMBER_LITERAL@218..219 "2" [] [] - 4: SEMICOLON@219..220 ";" [] [] - 7: JS_PROPERTY_CLASS_MEMBER@220..263 - 0: JS_PROPERTY_MODIFIER_LIST@220..255 - 0: JS_DECORATOR@220..226 - 0: AT@220..222 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@222..226 - 0: JS_REFERENCE_IDENTIFIER@222..226 - 0: IDENT@222..226 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@226..239 - 0: AT@226..227 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@227..239 - 0: L_PAREN@227..228 "(" [] [] - 1: JS_AWAIT_EXPRESSION@228..237 - 0: AWAIT_KW@228..234 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@234..237 - 0: JS_REFERENCE_IDENTIFIER@234..237 - 0: IDENT@234..237 "dec" [] [] - 2: R_PAREN@237..239 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@239..246 - 0: AT@239..240 "@" [] [] - 1: JS_CALL_EXPRESSION@240..246 - 0: JS_IDENTIFIER_EXPRESSION@240..243 - 0: JS_REFERENCE_IDENTIFIER@240..243 - 0: IDENT@240..243 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@243..246 - 0: L_PAREN@243..244 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@244..244 - 2: R_PAREN@244..246 ")" [] [Whitespace(" ")] - 3: JS_ACCESSOR_MODIFIER@246..255 - 0: ACCESSOR_KW@246..255 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@255..259 - 0: IDENT@255..259 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@259..262 - 0: EQ@259..261 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@261..262 - 0: JS_NUMBER_LITERAL@261..262 "2" [] [] - 4: SEMICOLON@262..263 ";" [] [] - 8: JS_PROPERTY_CLASS_MEMBER@263..286 - 0: JS_PROPERTY_MODIFIER_LIST@263..278 - 0: JS_DECORATOR@263..269 - 0: AT@263..265 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@265..269 - 0: JS_REFERENCE_IDENTIFIER@265..269 - 0: IDENT@265..269 "dec" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@269..278 - 0: READONLY_KW@269..278 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@278..282 - 0: IDENT@278..282 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@282..285 - 0: EQ@282..284 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@284..285 - 0: JS_NUMBER_LITERAL@284..285 "2" [] [] - 4: SEMICOLON@285..286 ";" [] [] - 9: JS_PROPERTY_CLASS_MEMBER@286..329 - 0: JS_PROPERTY_MODIFIER_LIST@286..321 - 0: JS_DECORATOR@286..292 - 0: AT@286..288 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@288..292 - 0: JS_REFERENCE_IDENTIFIER@288..292 - 0: IDENT@288..292 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@292..305 - 0: AT@292..293 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@293..305 - 0: L_PAREN@293..294 "(" [] [] - 1: JS_AWAIT_EXPRESSION@294..303 - 0: AWAIT_KW@294..300 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@300..303 - 0: JS_REFERENCE_IDENTIFIER@300..303 - 0: IDENT@300..303 "dec" [] [] - 2: R_PAREN@303..305 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@305..312 - 0: AT@305..306 "@" [] [] - 1: JS_CALL_EXPRESSION@306..312 - 0: JS_IDENTIFIER_EXPRESSION@306..309 - 0: JS_REFERENCE_IDENTIFIER@306..309 - 0: IDENT@306..309 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@309..312 - 0: L_PAREN@309..310 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@310..310 - 2: R_PAREN@310..312 ")" [] [Whitespace(" ")] - 3: TS_READONLY_MODIFIER@312..321 - 0: READONLY_KW@312..321 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@321..325 - 0: IDENT@321..325 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@325..328 - 0: EQ@325..327 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@327..328 - 0: JS_NUMBER_LITERAL@327..328 "2" [] [] - 4: SEMICOLON@328..329 ";" [] [] - 10: JS_PROPERTY_CLASS_MEMBER@329..352 - 0: JS_PROPERTY_MODIFIER_LIST@329..344 - 0: JS_DECORATOR@329..335 - 0: AT@329..331 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@331..335 - 0: JS_REFERENCE_IDENTIFIER@331..335 - 0: IDENT@331..335 "dec" [] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@335..344 - 0: OVERRIDE_KW@335..344 "override" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@344..348 - 0: IDENT@344..348 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@348..351 - 0: EQ@348..350 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@350..351 - 0: JS_NUMBER_LITERAL@350..351 "2" [] [] - 4: SEMICOLON@351..352 ";" [] [] - 11: JS_PROPERTY_CLASS_MEMBER@352..395 - 0: JS_PROPERTY_MODIFIER_LIST@352..387 - 0: JS_DECORATOR@352..358 - 0: AT@352..354 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@354..358 - 0: JS_REFERENCE_IDENTIFIER@354..358 - 0: IDENT@354..358 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@358..371 - 0: AT@358..359 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@359..371 - 0: L_PAREN@359..360 "(" [] [] - 1: JS_AWAIT_EXPRESSION@360..369 - 0: AWAIT_KW@360..366 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@366..369 - 0: JS_REFERENCE_IDENTIFIER@366..369 - 0: IDENT@366..369 "dec" [] [] - 2: R_PAREN@369..371 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@371..378 - 0: AT@371..372 "@" [] [] - 1: JS_CALL_EXPRESSION@372..378 - 0: JS_IDENTIFIER_EXPRESSION@372..375 - 0: JS_REFERENCE_IDENTIFIER@372..375 - 0: IDENT@372..375 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@375..378 - 0: L_PAREN@375..376 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@376..376 - 2: R_PAREN@376..378 ")" [] [Whitespace(" ")] - 3: TS_OVERRIDE_MODIFIER@378..387 - 0: OVERRIDE_KW@378..387 "override" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@387..391 - 0: IDENT@387..391 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@391..394 - 0: EQ@391..393 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@393..394 - 0: JS_NUMBER_LITERAL@393..394 "2" [] [] - 4: SEMICOLON@394..395 ";" [] [] - 12: JS_METHOD_CLASS_MEMBER@395..420 - 0: JS_METHOD_MODIFIER_LIST@395..412 - 0: JS_DECORATOR@395..412 - 0: AT@395..408 "@" [Newline("\n"), Comments("// methods"), Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@408..412 - 0: JS_REFERENCE_IDENTIFIER@408..412 - 0: IDENT@408..412 "dec" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@412..415 - 0: IDENT@412..415 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@415..418 - 0: L_PAREN@415..416 "(" [] [] - 1: JS_PARAMETER_LIST@416..416 - 2: R_PAREN@416..418 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@418..420 - 0: L_CURLY@418..419 "{" [] [] - 1: JS_DIRECTIVE_LIST@419..419 - 2: JS_STATEMENT_LIST@419..419 - 3: R_CURLY@419..420 "}" [] [] - 13: JS_METHOD_CLASS_MEMBER@420..454 - 0: JS_METHOD_MODIFIER_LIST@420..446 - 0: JS_DECORATOR@420..426 - 0: AT@420..422 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@422..426 - 0: JS_REFERENCE_IDENTIFIER@422..426 - 0: IDENT@422..426 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@426..439 - 0: AT@426..427 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@427..439 - 0: L_PAREN@427..428 "(" [] [] - 1: JS_AWAIT_EXPRESSION@428..437 - 0: AWAIT_KW@428..434 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@434..437 - 0: JS_REFERENCE_IDENTIFIER@434..437 - 0: IDENT@434..437 "dec" [] [] - 2: R_PAREN@437..439 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@439..446 - 0: AT@439..440 "@" [] [] - 1: JS_CALL_EXPRESSION@440..446 - 0: JS_IDENTIFIER_EXPRESSION@440..443 - 0: JS_REFERENCE_IDENTIFIER@440..443 - 0: IDENT@440..443 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@443..446 - 0: L_PAREN@443..444 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@444..444 - 2: R_PAREN@444..446 ")" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@446..449 - 0: IDENT@446..449 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@449..452 - 0: L_PAREN@449..450 "(" [] [] - 1: JS_PARAMETER_LIST@450..450 - 2: R_PAREN@450..452 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@452..454 - 0: L_CURLY@452..453 "{" [] [] - 1: JS_DIRECTIVE_LIST@453..453 - 2: JS_STATEMENT_LIST@453..453 - 3: R_CURLY@453..454 "}" [] [] - 14: JS_METHOD_CLASS_MEMBER@454..475 - 0: JS_METHOD_MODIFIER_LIST@454..467 - 0: JS_DECORATOR@454..460 - 0: AT@454..456 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@456..460 - 0: JS_REFERENCE_IDENTIFIER@456..460 - 0: IDENT@456..460 "dec" [] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@460..467 - 0: PUBLIC_KW@460..467 "public" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@467..470 - 0: IDENT@467..470 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@470..473 - 0: L_PAREN@470..471 "(" [] [] - 1: JS_PARAMETER_LIST@471..471 - 2: R_PAREN@471..473 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@473..475 - 0: L_CURLY@473..474 "{" [] [] - 1: JS_DIRECTIVE_LIST@474..474 - 2: JS_STATEMENT_LIST@474..474 - 3: R_CURLY@474..475 "}" [] [] - 15: JS_METHOD_CLASS_MEMBER@475..516 - 0: JS_METHOD_MODIFIER_LIST@475..508 - 0: JS_DECORATOR@475..481 - 0: AT@475..477 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@477..481 - 0: JS_REFERENCE_IDENTIFIER@477..481 - 0: IDENT@477..481 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@481..494 - 0: AT@481..482 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@482..494 - 0: L_PAREN@482..483 "(" [] [] - 1: JS_AWAIT_EXPRESSION@483..492 - 0: AWAIT_KW@483..489 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@489..492 - 0: JS_REFERENCE_IDENTIFIER@489..492 - 0: IDENT@489..492 "dec" [] [] - 2: R_PAREN@492..494 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@494..501 - 0: AT@494..495 "@" [] [] - 1: JS_CALL_EXPRESSION@495..501 - 0: JS_IDENTIFIER_EXPRESSION@495..498 - 0: JS_REFERENCE_IDENTIFIER@495..498 - 0: IDENT@495..498 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@498..501 - 0: L_PAREN@498..499 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@499..499 - 2: R_PAREN@499..501 ")" [] [Whitespace(" ")] - 3: TS_ACCESSIBILITY_MODIFIER@501..508 - 0: PUBLIC_KW@501..508 "public" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@508..511 - 0: IDENT@508..511 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@511..514 - 0: L_PAREN@511..512 "(" [] [] - 1: JS_PARAMETER_LIST@512..512 - 2: R_PAREN@512..514 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@514..516 - 0: L_CURLY@514..515 "{" [] [] - 1: JS_DIRECTIVE_LIST@515..515 - 2: JS_STATEMENT_LIST@515..515 - 3: R_CURLY@515..516 "}" [] [] - 16: JS_METHOD_CLASS_MEMBER@516..537 - 0: JS_METHOD_MODIFIER_LIST@516..529 - 0: JS_DECORATOR@516..522 - 0: AT@516..518 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@518..522 - 0: JS_REFERENCE_IDENTIFIER@518..522 - 0: IDENT@518..522 "dec" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@522..529 - 0: STATIC_KW@522..529 "static" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@529..532 - 0: IDENT@529..532 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@532..535 - 0: L_PAREN@532..533 "(" [] [] - 1: JS_PARAMETER_LIST@533..533 - 2: R_PAREN@533..535 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@535..537 - 0: L_CURLY@535..536 "{" [] [] - 1: JS_DIRECTIVE_LIST@536..536 - 2: JS_STATEMENT_LIST@536..536 - 3: R_CURLY@536..537 "}" [] [] - 17: JS_METHOD_CLASS_MEMBER@537..578 - 0: JS_METHOD_MODIFIER_LIST@537..570 - 0: JS_DECORATOR@537..543 - 0: AT@537..539 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@539..543 - 0: JS_REFERENCE_IDENTIFIER@539..543 - 0: IDENT@539..543 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@543..556 - 0: AT@543..544 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@544..556 - 0: L_PAREN@544..545 "(" [] [] - 1: JS_AWAIT_EXPRESSION@545..554 - 0: AWAIT_KW@545..551 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@551..554 - 0: JS_REFERENCE_IDENTIFIER@551..554 - 0: IDENT@551..554 "dec" [] [] - 2: R_PAREN@554..556 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@556..563 - 0: AT@556..557 "@" [] [] - 1: JS_CALL_EXPRESSION@557..563 - 0: JS_IDENTIFIER_EXPRESSION@557..560 - 0: JS_REFERENCE_IDENTIFIER@557..560 - 0: IDENT@557..560 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@560..563 - 0: L_PAREN@560..561 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@561..561 - 2: R_PAREN@561..563 ")" [] [Whitespace(" ")] - 3: JS_STATIC_MODIFIER@563..570 - 0: STATIC_KW@563..570 "static" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@570..573 - 0: IDENT@570..573 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@573..576 - 0: L_PAREN@573..574 "(" [] [] - 1: JS_PARAMETER_LIST@574..574 - 2: R_PAREN@574..576 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@576..578 - 0: L_CURLY@576..577 "{" [] [] - 1: JS_DIRECTIVE_LIST@577..577 - 2: JS_STATEMENT_LIST@577..577 - 3: R_CURLY@577..578 "}" [] [] - 18: JS_METHOD_CLASS_MEMBER@578..601 - 0: JS_METHOD_MODIFIER_LIST@578..593 - 0: JS_DECORATOR@578..584 - 0: AT@578..580 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@580..584 - 0: JS_REFERENCE_IDENTIFIER@580..584 - 0: IDENT@580..584 "dec" [] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@584..593 - 0: OVERRIDE_KW@584..593 "override" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@593..596 - 0: IDENT@593..596 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@596..599 - 0: L_PAREN@596..597 "(" [] [] - 1: JS_PARAMETER_LIST@597..597 - 2: R_PAREN@597..599 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@599..601 - 0: L_CURLY@599..600 "{" [] [] - 1: JS_DIRECTIVE_LIST@600..600 - 2: JS_STATEMENT_LIST@600..600 - 3: R_CURLY@600..601 "}" [] [] - 19: JS_METHOD_CLASS_MEMBER@601..644 - 0: JS_METHOD_MODIFIER_LIST@601..636 - 0: JS_DECORATOR@601..607 - 0: AT@601..603 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@603..607 - 0: JS_REFERENCE_IDENTIFIER@603..607 - 0: IDENT@603..607 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@607..620 - 0: AT@607..608 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@608..620 - 0: L_PAREN@608..609 "(" [] [] - 1: JS_AWAIT_EXPRESSION@609..618 - 0: AWAIT_KW@609..615 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@615..618 - 0: JS_REFERENCE_IDENTIFIER@615..618 - 0: IDENT@615..618 "dec" [] [] - 2: R_PAREN@618..620 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@620..627 - 0: AT@620..621 "@" [] [] - 1: JS_CALL_EXPRESSION@621..627 - 0: JS_IDENTIFIER_EXPRESSION@621..624 - 0: JS_REFERENCE_IDENTIFIER@621..624 - 0: IDENT@621..624 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@624..627 - 0: L_PAREN@624..625 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@625..625 - 2: R_PAREN@625..627 ")" [] [Whitespace(" ")] - 3: TS_OVERRIDE_MODIFIER@627..636 - 0: OVERRIDE_KW@627..636 "override" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@636..639 - 0: IDENT@636..639 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@639..642 - 0: L_PAREN@639..640 "(" [] [] - 1: JS_PARAMETER_LIST@640..640 - 2: R_PAREN@640..642 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@642..644 - 0: L_CURLY@642..643 "{" [] [] - 1: JS_DIRECTIVE_LIST@643..643 - 2: JS_STATEMENT_LIST@643..643 - 3: R_CURLY@643..644 "}" [] [] - 20: JS_GETTER_CLASS_MEMBER@644..673 - 0: JS_METHOD_MODIFIER_LIST@644..661 - 0: JS_DECORATOR@644..661 - 0: AT@644..657 "@" [Newline("\n"), Comments("// getters"), Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@657..661 - 0: JS_REFERENCE_IDENTIFIER@657..661 - 0: IDENT@657..661 "dec" [] [Whitespace(" ")] - 1: GET_KW@661..665 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@665..668 - 0: IDENT@665..668 "foo" [] [] - 3: L_PAREN@668..669 "(" [] [] - 4: R_PAREN@669..671 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@671..673 - 0: L_CURLY@671..672 "{" [] [] - 1: JS_DIRECTIVE_LIST@672..672 - 2: JS_STATEMENT_LIST@672..672 - 3: R_CURLY@672..673 "}" [] [] - 21: JS_GETTER_CLASS_MEMBER@673..711 - 0: JS_METHOD_MODIFIER_LIST@673..699 - 0: JS_DECORATOR@673..679 - 0: AT@673..675 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@675..679 - 0: JS_REFERENCE_IDENTIFIER@675..679 - 0: IDENT@675..679 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@679..692 - 0: AT@679..680 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@680..692 - 0: L_PAREN@680..681 "(" [] [] - 1: JS_AWAIT_EXPRESSION@681..690 - 0: AWAIT_KW@681..687 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@687..690 - 0: JS_REFERENCE_IDENTIFIER@687..690 - 0: IDENT@687..690 "dec" [] [] - 2: R_PAREN@690..692 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@692..699 - 0: AT@692..693 "@" [] [] - 1: JS_CALL_EXPRESSION@693..699 - 0: JS_IDENTIFIER_EXPRESSION@693..696 - 0: JS_REFERENCE_IDENTIFIER@693..696 - 0: IDENT@693..696 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@696..699 - 0: L_PAREN@696..697 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@697..697 - 2: R_PAREN@697..699 ")" [] [Whitespace(" ")] - 1: GET_KW@699..703 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@703..706 - 0: IDENT@703..706 "foo" [] [] - 3: L_PAREN@706..707 "(" [] [] - 4: R_PAREN@707..709 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@709..711 - 0: L_CURLY@709..710 "{" [] [] - 1: JS_DIRECTIVE_LIST@710..710 - 2: JS_STATEMENT_LIST@710..710 - 3: R_CURLY@710..711 "}" [] [] - 22: JS_GETTER_CLASS_MEMBER@711..736 - 0: JS_METHOD_MODIFIER_LIST@711..724 - 0: JS_DECORATOR@711..717 - 0: AT@711..713 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@713..717 - 0: JS_REFERENCE_IDENTIFIER@713..717 - 0: IDENT@713..717 "dec" [] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@717..724 - 0: PUBLIC_KW@717..724 "public" [] [Whitespace(" ")] - 1: GET_KW@724..728 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@728..731 - 0: IDENT@728..731 "foo" [] [] - 3: L_PAREN@731..732 "(" [] [] - 4: R_PAREN@732..734 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@734..736 - 0: L_CURLY@734..735 "{" [] [] - 1: JS_DIRECTIVE_LIST@735..735 - 2: JS_STATEMENT_LIST@735..735 - 3: R_CURLY@735..736 "}" [] [] - 23: JS_GETTER_CLASS_MEMBER@736..781 - 0: JS_METHOD_MODIFIER_LIST@736..769 - 0: JS_DECORATOR@736..742 - 0: AT@736..738 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@738..742 - 0: JS_REFERENCE_IDENTIFIER@738..742 - 0: IDENT@738..742 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@742..755 - 0: AT@742..743 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@743..755 - 0: L_PAREN@743..744 "(" [] [] - 1: JS_AWAIT_EXPRESSION@744..753 - 0: AWAIT_KW@744..750 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@750..753 - 0: JS_REFERENCE_IDENTIFIER@750..753 - 0: IDENT@750..753 "dec" [] [] - 2: R_PAREN@753..755 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@755..762 - 0: AT@755..756 "@" [] [] - 1: JS_CALL_EXPRESSION@756..762 - 0: JS_IDENTIFIER_EXPRESSION@756..759 - 0: JS_REFERENCE_IDENTIFIER@756..759 - 0: IDENT@756..759 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@759..762 - 0: L_PAREN@759..760 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@760..760 - 2: R_PAREN@760..762 ")" [] [Whitespace(" ")] - 3: TS_ACCESSIBILITY_MODIFIER@762..769 - 0: PUBLIC_KW@762..769 "public" [] [Whitespace(" ")] - 1: GET_KW@769..773 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@773..776 - 0: IDENT@773..776 "foo" [] [] - 3: L_PAREN@776..777 "(" [] [] - 4: R_PAREN@777..779 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@779..781 - 0: L_CURLY@779..780 "{" [] [] - 1: JS_DIRECTIVE_LIST@780..780 - 2: JS_STATEMENT_LIST@780..780 - 3: R_CURLY@780..781 "}" [] [] - 24: JS_GETTER_CLASS_MEMBER@781..806 - 0: JS_METHOD_MODIFIER_LIST@781..794 - 0: JS_DECORATOR@781..787 - 0: AT@781..783 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@783..787 - 0: JS_REFERENCE_IDENTIFIER@783..787 - 0: IDENT@783..787 "dec" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@787..794 - 0: STATIC_KW@787..794 "static" [] [Whitespace(" ")] - 1: GET_KW@794..798 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@798..801 - 0: IDENT@798..801 "foo" [] [] - 3: L_PAREN@801..802 "(" [] [] - 4: R_PAREN@802..804 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@804..806 - 0: L_CURLY@804..805 "{" [] [] - 1: JS_DIRECTIVE_LIST@805..805 - 2: JS_STATEMENT_LIST@805..805 - 3: R_CURLY@805..806 "}" [] [] - 25: JS_GETTER_CLASS_MEMBER@806..851 - 0: JS_METHOD_MODIFIER_LIST@806..839 - 0: JS_DECORATOR@806..812 - 0: AT@806..808 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@808..812 - 0: JS_REFERENCE_IDENTIFIER@808..812 - 0: IDENT@808..812 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@812..825 - 0: AT@812..813 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@813..825 - 0: L_PAREN@813..814 "(" [] [] - 1: JS_AWAIT_EXPRESSION@814..823 - 0: AWAIT_KW@814..820 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@820..823 - 0: JS_REFERENCE_IDENTIFIER@820..823 - 0: IDENT@820..823 "dec" [] [] - 2: R_PAREN@823..825 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@825..832 - 0: AT@825..826 "@" [] [] - 1: JS_CALL_EXPRESSION@826..832 - 0: JS_IDENTIFIER_EXPRESSION@826..829 - 0: JS_REFERENCE_IDENTIFIER@826..829 - 0: IDENT@826..829 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@829..832 - 0: L_PAREN@829..830 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@830..830 - 2: R_PAREN@830..832 ")" [] [Whitespace(" ")] - 3: JS_STATIC_MODIFIER@832..839 - 0: STATIC_KW@832..839 "static" [] [Whitespace(" ")] - 1: GET_KW@839..843 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@843..846 - 0: IDENT@843..846 "foo" [] [] - 3: L_PAREN@846..847 "(" [] [] - 4: R_PAREN@847..849 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@849..851 - 0: L_CURLY@849..850 "{" [] [] - 1: JS_DIRECTIVE_LIST@850..850 - 2: JS_STATEMENT_LIST@850..850 - 3: R_CURLY@850..851 "}" [] [] - 26: JS_GETTER_CLASS_MEMBER@851..878 - 0: JS_METHOD_MODIFIER_LIST@851..866 - 0: JS_DECORATOR@851..857 - 0: AT@851..853 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@853..857 - 0: JS_REFERENCE_IDENTIFIER@853..857 - 0: IDENT@853..857 "dec" [] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@857..866 - 0: OVERRIDE_KW@857..866 "override" [] [Whitespace(" ")] - 1: GET_KW@866..870 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@870..873 - 0: IDENT@870..873 "foo" [] [] - 3: L_PAREN@873..874 "(" [] [] - 4: R_PAREN@874..876 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@876..878 - 0: L_CURLY@876..877 "{" [] [] - 1: JS_DIRECTIVE_LIST@877..877 - 2: JS_STATEMENT_LIST@877..877 - 3: R_CURLY@877..878 "}" [] [] - 27: JS_GETTER_CLASS_MEMBER@878..925 - 0: JS_METHOD_MODIFIER_LIST@878..913 - 0: JS_DECORATOR@878..884 - 0: AT@878..880 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@880..884 - 0: JS_REFERENCE_IDENTIFIER@880..884 - 0: IDENT@880..884 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@884..897 - 0: AT@884..885 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@885..897 - 0: L_PAREN@885..886 "(" [] [] - 1: JS_AWAIT_EXPRESSION@886..895 - 0: AWAIT_KW@886..892 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@892..895 - 0: JS_REFERENCE_IDENTIFIER@892..895 - 0: IDENT@892..895 "dec" [] [] - 2: R_PAREN@895..897 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@897..904 - 0: AT@897..898 "@" [] [] - 1: JS_CALL_EXPRESSION@898..904 - 0: JS_IDENTIFIER_EXPRESSION@898..901 - 0: JS_REFERENCE_IDENTIFIER@898..901 - 0: IDENT@898..901 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@901..904 - 0: L_PAREN@901..902 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@902..902 - 2: R_PAREN@902..904 ")" [] [Whitespace(" ")] - 3: TS_OVERRIDE_MODIFIER@904..913 - 0: OVERRIDE_KW@904..913 "override" [] [Whitespace(" ")] - 1: GET_KW@913..917 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@917..920 - 0: IDENT@917..920 "foo" [] [] - 3: L_PAREN@920..921 "(" [] [] - 4: R_PAREN@921..923 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@923..925 - 0: L_CURLY@923..924 "{" [] [] - 1: JS_DIRECTIVE_LIST@924..924 - 2: JS_STATEMENT_LIST@924..924 - 3: R_CURLY@924..925 "}" [] [] - 28: JS_SETTER_CLASS_MEMBER@925..957 - 0: JS_METHOD_MODIFIER_LIST@925..942 - 0: JS_DECORATOR@925..942 - 0: AT@925..938 "@" [Newline("\n"), Comments("// setters"), Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@938..942 - 0: JS_REFERENCE_IDENTIFIER@938..942 - 0: IDENT@938..942 "dec" [] [Whitespace(" ")] - 1: SET_KW@942..946 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@946..949 - 0: IDENT@946..949 "foo" [] [] - 3: L_PAREN@949..950 "(" [] [] - 4: JS_FORMAL_PARAMETER@950..953 - 0: JS_DECORATOR_LIST@950..950 - 1: JS_IDENTIFIER_BINDING@950..953 - 0: IDENT@950..953 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@953..955 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@955..957 - 0: L_CURLY@955..956 "{" [] [] - 1: JS_DIRECTIVE_LIST@956..956 - 2: JS_STATEMENT_LIST@956..956 - 3: R_CURLY@956..957 "}" [] [] - 29: JS_SETTER_CLASS_MEMBER@957..998 - 0: JS_METHOD_MODIFIER_LIST@957..983 - 0: JS_DECORATOR@957..963 - 0: AT@957..959 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@959..963 - 0: JS_REFERENCE_IDENTIFIER@959..963 - 0: IDENT@959..963 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@963..976 - 0: AT@963..964 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@964..976 - 0: L_PAREN@964..965 "(" [] [] - 1: JS_AWAIT_EXPRESSION@965..974 - 0: AWAIT_KW@965..971 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@971..974 - 0: JS_REFERENCE_IDENTIFIER@971..974 - 0: IDENT@971..974 "dec" [] [] - 2: R_PAREN@974..976 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@976..983 - 0: AT@976..977 "@" [] [] - 1: JS_CALL_EXPRESSION@977..983 - 0: JS_IDENTIFIER_EXPRESSION@977..980 - 0: JS_REFERENCE_IDENTIFIER@977..980 - 0: IDENT@977..980 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@980..983 - 0: L_PAREN@980..981 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@981..981 - 2: R_PAREN@981..983 ")" [] [Whitespace(" ")] - 1: SET_KW@983..987 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@987..990 - 0: IDENT@987..990 "foo" [] [] - 3: L_PAREN@990..991 "(" [] [] - 4: JS_FORMAL_PARAMETER@991..994 - 0: JS_DECORATOR_LIST@991..991 - 1: JS_IDENTIFIER_BINDING@991..994 - 0: IDENT@991..994 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@994..996 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@996..998 - 0: L_CURLY@996..997 "{" [] [] - 1: JS_DIRECTIVE_LIST@997..997 - 2: JS_STATEMENT_LIST@997..997 - 3: R_CURLY@997..998 "}" [] [] - 30: JS_SETTER_CLASS_MEMBER@998..1026 - 0: JS_METHOD_MODIFIER_LIST@998..1011 - 0: JS_DECORATOR@998..1004 - 0: AT@998..1000 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@1000..1004 - 0: JS_REFERENCE_IDENTIFIER@1000..1004 - 0: IDENT@1000..1004 "dec" [] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@1004..1011 - 0: PUBLIC_KW@1004..1011 "public" [] [Whitespace(" ")] - 1: SET_KW@1011..1015 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@1015..1018 - 0: IDENT@1015..1018 "foo" [] [] - 3: L_PAREN@1018..1019 "(" [] [] - 4: JS_FORMAL_PARAMETER@1019..1022 - 0: JS_DECORATOR_LIST@1019..1019 - 1: JS_IDENTIFIER_BINDING@1019..1022 - 0: IDENT@1019..1022 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@1022..1024 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@1024..1026 - 0: L_CURLY@1024..1025 "{" [] [] - 1: JS_DIRECTIVE_LIST@1025..1025 - 2: JS_STATEMENT_LIST@1025..1025 - 3: R_CURLY@1025..1026 "}" [] [] - 31: JS_SETTER_CLASS_MEMBER@1026..1074 - 0: JS_METHOD_MODIFIER_LIST@1026..1059 - 0: JS_DECORATOR@1026..1032 - 0: AT@1026..1028 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@1028..1032 - 0: JS_REFERENCE_IDENTIFIER@1028..1032 - 0: IDENT@1028..1032 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@1032..1045 - 0: AT@1032..1033 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@1033..1045 - 0: L_PAREN@1033..1034 "(" [] [] - 1: JS_AWAIT_EXPRESSION@1034..1043 - 0: AWAIT_KW@1034..1040 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@1040..1043 - 0: JS_REFERENCE_IDENTIFIER@1040..1043 - 0: IDENT@1040..1043 "dec" [] [] - 2: R_PAREN@1043..1045 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@1045..1052 - 0: AT@1045..1046 "@" [] [] - 1: JS_CALL_EXPRESSION@1046..1052 - 0: JS_IDENTIFIER_EXPRESSION@1046..1049 - 0: JS_REFERENCE_IDENTIFIER@1046..1049 - 0: IDENT@1046..1049 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@1049..1052 - 0: L_PAREN@1049..1050 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@1050..1050 - 2: R_PAREN@1050..1052 ")" [] [Whitespace(" ")] - 3: TS_ACCESSIBILITY_MODIFIER@1052..1059 - 0: PUBLIC_KW@1052..1059 "public" [] [Whitespace(" ")] - 1: SET_KW@1059..1063 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@1063..1066 - 0: IDENT@1063..1066 "foo" [] [] - 3: L_PAREN@1066..1067 "(" [] [] - 4: JS_FORMAL_PARAMETER@1067..1070 - 0: JS_DECORATOR_LIST@1067..1067 - 1: JS_IDENTIFIER_BINDING@1067..1070 - 0: IDENT@1067..1070 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@1070..1072 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@1072..1074 - 0: L_CURLY@1072..1073 "{" [] [] - 1: JS_DIRECTIVE_LIST@1073..1073 - 2: JS_STATEMENT_LIST@1073..1073 - 3: R_CURLY@1073..1074 "}" [] [] - 32: JS_SETTER_CLASS_MEMBER@1074..1102 - 0: JS_METHOD_MODIFIER_LIST@1074..1087 - 0: JS_DECORATOR@1074..1080 - 0: AT@1074..1076 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@1076..1080 - 0: JS_REFERENCE_IDENTIFIER@1076..1080 - 0: IDENT@1076..1080 "dec" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@1080..1087 - 0: STATIC_KW@1080..1087 "static" [] [Whitespace(" ")] - 1: SET_KW@1087..1091 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@1091..1094 - 0: IDENT@1091..1094 "foo" [] [] - 3: L_PAREN@1094..1095 "(" [] [] - 4: JS_FORMAL_PARAMETER@1095..1098 - 0: JS_DECORATOR_LIST@1095..1095 - 1: JS_IDENTIFIER_BINDING@1095..1098 - 0: IDENT@1095..1098 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@1098..1100 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@1100..1102 - 0: L_CURLY@1100..1101 "{" [] [] - 1: JS_DIRECTIVE_LIST@1101..1101 - 2: JS_STATEMENT_LIST@1101..1101 - 3: R_CURLY@1101..1102 "}" [] [] - 33: JS_SETTER_CLASS_MEMBER@1102..1150 - 0: JS_METHOD_MODIFIER_LIST@1102..1135 - 0: JS_DECORATOR@1102..1108 - 0: AT@1102..1104 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@1104..1108 - 0: JS_REFERENCE_IDENTIFIER@1104..1108 - 0: IDENT@1104..1108 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@1108..1121 - 0: AT@1108..1109 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@1109..1121 - 0: L_PAREN@1109..1110 "(" [] [] - 1: JS_AWAIT_EXPRESSION@1110..1119 - 0: AWAIT_KW@1110..1116 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@1116..1119 - 0: JS_REFERENCE_IDENTIFIER@1116..1119 - 0: IDENT@1116..1119 "dec" [] [] - 2: R_PAREN@1119..1121 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@1121..1128 - 0: AT@1121..1122 "@" [] [] - 1: JS_CALL_EXPRESSION@1122..1128 - 0: JS_IDENTIFIER_EXPRESSION@1122..1125 - 0: JS_REFERENCE_IDENTIFIER@1122..1125 - 0: IDENT@1122..1125 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@1125..1128 - 0: L_PAREN@1125..1126 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@1126..1126 - 2: R_PAREN@1126..1128 ")" [] [Whitespace(" ")] - 3: JS_STATIC_MODIFIER@1128..1135 - 0: STATIC_KW@1128..1135 "static" [] [Whitespace(" ")] - 1: SET_KW@1135..1139 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@1139..1142 - 0: IDENT@1139..1142 "foo" [] [] - 3: L_PAREN@1142..1143 "(" [] [] - 4: JS_FORMAL_PARAMETER@1143..1146 - 0: JS_DECORATOR_LIST@1143..1143 - 1: JS_IDENTIFIER_BINDING@1143..1146 - 0: IDENT@1143..1146 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@1146..1148 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@1148..1150 - 0: L_CURLY@1148..1149 "{" [] [] - 1: JS_DIRECTIVE_LIST@1149..1149 - 2: JS_STATEMENT_LIST@1149..1149 - 3: R_CURLY@1149..1150 "}" [] [] - 34: JS_SETTER_CLASS_MEMBER@1150..1180 - 0: JS_METHOD_MODIFIER_LIST@1150..1165 - 0: JS_DECORATOR@1150..1156 - 0: AT@1150..1152 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@1152..1156 - 0: JS_REFERENCE_IDENTIFIER@1152..1156 - 0: IDENT@1152..1156 "dec" [] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@1156..1165 - 0: OVERRIDE_KW@1156..1165 "override" [] [Whitespace(" ")] - 1: SET_KW@1165..1169 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@1169..1172 - 0: IDENT@1169..1172 "foo" [] [] - 3: L_PAREN@1172..1173 "(" [] [] - 4: JS_FORMAL_PARAMETER@1173..1176 - 0: JS_DECORATOR_LIST@1173..1173 - 1: JS_IDENTIFIER_BINDING@1173..1176 - 0: IDENT@1173..1176 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@1176..1178 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@1178..1180 - 0: L_CURLY@1178..1179 "{" [] [] - 1: JS_DIRECTIVE_LIST@1179..1179 - 2: JS_STATEMENT_LIST@1179..1179 - 3: R_CURLY@1179..1180 "}" [] [] - 35: JS_SETTER_CLASS_MEMBER@1180..1230 - 0: JS_METHOD_MODIFIER_LIST@1180..1215 - 0: JS_DECORATOR@1180..1186 - 0: AT@1180..1182 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@1182..1186 - 0: JS_REFERENCE_IDENTIFIER@1182..1186 - 0: IDENT@1182..1186 "dec" [] [Whitespace(" ")] - 1: JS_DECORATOR@1186..1199 - 0: AT@1186..1187 "@" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@1187..1199 - 0: L_PAREN@1187..1188 "(" [] [] - 1: JS_AWAIT_EXPRESSION@1188..1197 - 0: AWAIT_KW@1188..1194 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@1194..1197 - 0: JS_REFERENCE_IDENTIFIER@1194..1197 - 0: IDENT@1194..1197 "dec" [] [] - 2: R_PAREN@1197..1199 ")" [] [Whitespace(" ")] - 2: JS_DECORATOR@1199..1206 - 0: AT@1199..1200 "@" [] [] - 1: JS_CALL_EXPRESSION@1200..1206 - 0: JS_IDENTIFIER_EXPRESSION@1200..1203 - 0: JS_REFERENCE_IDENTIFIER@1200..1203 - 0: IDENT@1200..1203 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@1203..1206 - 0: L_PAREN@1203..1204 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@1204..1204 - 2: R_PAREN@1204..1206 ")" [] [Whitespace(" ")] - 3: TS_OVERRIDE_MODIFIER@1206..1215 - 0: OVERRIDE_KW@1206..1215 "override" [] [Whitespace(" ")] - 1: SET_KW@1215..1219 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@1219..1222 - 0: IDENT@1219..1222 "foo" [] [] - 3: L_PAREN@1222..1223 "(" [] [] - 4: JS_FORMAL_PARAMETER@1223..1226 - 0: JS_DECORATOR_LIST@1223..1223 - 1: JS_IDENTIFIER_BINDING@1223..1226 - 0: IDENT@1223..1226 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@1226..1228 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@1228..1230 - 0: L_CURLY@1228..1229 "{" [] [] - 1: JS_DIRECTIVE_LIST@1229..1229 - 2: JS_STATEMENT_LIST@1229..1229 - 3: R_CURLY@1229..1230 "}" [] [] - 9: R_CURLY@1230..1232 "}" [Newline("\n")] [] - 4: EOF@1232..1233 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.rast deleted file mode 100644 index 3cb288224c31..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.rast +++ /dev/null @@ -1,158 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..19 "Qux" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@19..20 "{" [] [], - members: JsClassMemberList [ - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - JsDecorator { - at_token: AT@20..24 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..28 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@28..36 "declare" [] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@36..43 "static" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@43..46 "foo" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@46..48 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@48..54 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@54..55 ";" [] [], - }, - ], - r_curly_token: R_CURLY@55..57 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@64..68 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@68..69 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@69..74 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..78 "dec" [] [Whitespace(" ")], - }, - }, - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@78..87 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@87..91 "foo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@91..93 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@93..98 "'123'" [] [], - }, - }, - semicolon_token: SEMICOLON@98..99 ";" [] [], - }, - ], - r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@101..102 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..102 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..101 - 0: JS_CLASS_DECLARATION@0..57 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..19 - 0: IDENT@15..19 "Qux" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@19..20 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@20..55 - 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@20..55 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@20..43 - 0: JS_DECORATOR@20..28 - 0: AT@20..24 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@24..28 - 0: JS_REFERENCE_IDENTIFIER@24..28 - 0: IDENT@24..28 "dec" [] [Whitespace(" ")] - 1: TS_DECLARE_MODIFIER@28..36 - 0: DECLARE_KW@28..36 "declare" [] [Whitespace(" ")] - 2: JS_STATIC_MODIFIER@36..43 - 0: STATIC_KW@36..43 "static" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@43..46 - 0: IDENT@43..46 "foo" [] [] - 2: TS_TYPE_ANNOTATION@46..54 - 0: COLON@46..48 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@48..54 - 0: STRING_KW@48..54 "string" [] [] - 3: SEMICOLON@54..55 ";" [] [] - 9: R_CURLY@55..57 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@57..101 - 0: JS_DECORATOR_LIST@57..57 - 1: (empty) - 2: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@64..68 - 0: IDENT@64..68 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@68..69 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@69..99 - 0: JS_PROPERTY_CLASS_MEMBER@69..99 - 0: JS_PROPERTY_MODIFIER_LIST@69..87 - 0: JS_DECORATOR@69..78 - 0: AT@69..74 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@74..78 - 0: JS_REFERENCE_IDENTIFIER@74..78 - 0: IDENT@74..78 "dec" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@78..87 - 0: READONLY_KW@78..87 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@87..91 - 0: IDENT@87..91 "foo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@91..98 - 0: EQ@91..93 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@93..98 - 0: JS_STRING_LITERAL@93..98 "'123'" [] [] - 4: SEMICOLON@98..99 ";" [] [] - 9: R_CURLY@99..101 "}" [Newline("\n")] [] - 4: EOF@101..102 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.rast deleted file mode 100644 index 89b9acd32a36..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.rast +++ /dev/null @@ -1,163 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..5 "a" [] [], - }, - }, - r_paren_token: R_PAREN@5..7 ")" [] [Whitespace(" ")], - consequent: JsBlockStatement { - l_curly_token: L_CURLY@7..8 "{" [] [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@8..12 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..16 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@16..22 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@22..30 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@30..31 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - ], - r_curly_token: R_CURLY@32..34 "}" [Newline("\n")] [], - }, - else_clause: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@44..47 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@47..48 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@50..51 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@51..55 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..59 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@59..65 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@65..73 "MyClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@73..74 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@74..75 "}" [] [], - }, - ], - r_curly_token: R_CURLY@75..77 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@77..78 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..78 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..77 - 0: JS_IF_STATEMENT@0..34 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_IDENTIFIER_EXPRESSION@4..5 - 0: JS_REFERENCE_IDENTIFIER@4..5 - 0: IDENT@4..5 "a" [] [] - 3: R_PAREN@5..7 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@7..34 - 0: L_CURLY@7..8 "{" [] [] - 1: JS_STATEMENT_LIST@8..32 - 0: JS_CLASS_DECLARATION@8..32 - 0: JS_DECORATOR_LIST@8..16 - 0: JS_DECORATOR@8..16 - 0: AT@8..12 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@12..16 - 0: JS_REFERENCE_IDENTIFIER@12..16 - 0: IDENT@12..16 "dec" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@16..22 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@22..30 - 0: IDENT@22..30 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@30..31 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@31..31 - 9: R_CURLY@31..32 "}" [] [] - 2: R_CURLY@32..34 "}" [Newline("\n")] [] - 5: (empty) - 1: JS_FUNCTION_DECLARATION@34..77 - 0: (empty) - 1: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@44..47 - 0: IDENT@44..47 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@47..50 - 0: L_PAREN@47..48 "(" [] [] - 1: JS_PARAMETER_LIST@48..48 - 2: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@50..77 - 0: L_CURLY@50..51 "{" [] [] - 1: JS_DIRECTIVE_LIST@51..51 - 2: JS_STATEMENT_LIST@51..75 - 0: JS_CLASS_DECLARATION@51..75 - 0: JS_DECORATOR_LIST@51..59 - 0: JS_DECORATOR@51..59 - 0: AT@51..55 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@55..59 - 0: JS_REFERENCE_IDENTIFIER@55..59 - 0: IDENT@55..59 "dec" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@59..65 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@65..73 - 0: IDENT@65..73 "MyClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@73..74 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@74..74 - 9: R_CURLY@74..75 "}" [] [] - 3: R_CURLY@75..77 "}" [Newline("\n")] [] - 4: EOF@77..78 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.rast deleted file mode 100644 index 4515d542d5dd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.rast +++ /dev/null @@ -1,158 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@7..8 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..18 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@18..24 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@24..28 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@28..29 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@39..40 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..46 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@46..47 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@47..54 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@54..60 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@60..64 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@64..65 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@65..81 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@81..82 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@84..85 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@85..86 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@86..88 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@88..89 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..89 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..88 - 0: JS_EXPORT@0..30 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@7..30 - 0: JS_DECORATOR_LIST@7..18 - 0: JS_DECORATOR@7..18 - 0: AT@7..8 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@8..18 - 0: JS_REFERENCE_IDENTIFIER@8..18 - 0: IDENT@8..18 "decorator" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@18..24 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@24..28 - 0: IDENT@24..28 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@28..29 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@29..29 - 9: R_CURLY@29..30 "}" [] [] - 1: JS_EMPTY_STATEMENT@30..31 - 0: SEMICOLON@30..31 ";" [] [] - 2: JS_EXPORT@31..88 - 0: JS_DECORATOR_LIST@31..31 - 1: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@39..88 - 0: JS_DECORATOR_LIST@39..54 - 0: JS_DECORATOR@39..46 - 0: AT@39..40 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@40..46 - 0: JS_REFERENCE_IDENTIFIER@40..46 - 0: IDENT@40..46 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@46..54 - 0: AT@46..47 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@47..54 - 0: JS_REFERENCE_IDENTIFIER@47..54 - 0: IDENT@47..54 "second" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@54..60 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@60..64 - 0: IDENT@60..64 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@64..65 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@65..86 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@65..86 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@65..65 - 1: JS_LITERAL_MEMBER_NAME@65..81 - 0: IDENT@65..81 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@81..84 - 0: L_PAREN@81..82 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@82..82 - 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@84..86 - 0: L_CURLY@84..85 "{" [] [] - 1: JS_DIRECTIVE_LIST@85..85 - 2: JS_STATEMENT_LIST@85..85 - 3: R_CURLY@85..86 "}" [] [] - 9: R_CURLY@86..88 "}" [Newline("\n")] [] - 4: EOF@88..89 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.rast deleted file mode 100644 index bd8cfe5c423e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.rast +++ /dev/null @@ -1,216 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@25..26 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@26..27 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@55..56 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@56..57 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@75..81 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@81..82 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@82..83 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@83..84 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@84..85 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@93..101 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@101..111 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@111..112 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@112..113 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@113..114 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@115..123 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@123..131 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@131..141 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@141..142 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@142..143 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@143..144 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@144..145 ";" [] [], - }, - ], - eof_token: EOF@145..146 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..146 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..145 - 0: JS_EXPORT@0..28 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..28 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@15..28 - 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@26..27 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@27..27 - 6: R_CURLY@27..28 "}" [] [] - 2: (empty) - 1: JS_EMPTY_STATEMENT@28..29 - 0: SEMICOLON@28..29 ";" [] [] - 2: JS_EXPORT@29..58 - 0: JS_DECORATOR_LIST@29..29 - 1: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@37..58 - 0: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@45..58 - 0: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@55..56 - 0: IDENT@55..56 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@56..57 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@57..57 - 6: R_CURLY@57..58 "}" [] [] - 2: (empty) - 3: JS_EMPTY_STATEMENT@58..59 - 0: SEMICOLON@58..59 ";" [] [] - 4: JS_EXPORT@59..84 - 0: JS_DECORATOR_LIST@59..59 - 1: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@67..84 - 0: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@75..84 - 0: JS_DECORATOR_LIST@75..75 - 1: (empty) - 2: CLASS_KW@75..81 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@81..82 - 0: IDENT@81..82 "A" [] [] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@82..83 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@83..83 - 9: R_CURLY@83..84 "}" [] [] - 2: (empty) - 5: JS_EMPTY_STATEMENT@84..85 - 0: SEMICOLON@84..85 ";" [] [] - 6: JS_EXPORT@85..114 - 0: JS_DECORATOR_LIST@85..85 - 1: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@93..114 - 0: DEFAULT_KW@93..101 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@101..114 - 0: INTERFACE_KW@101..111 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@111..112 - 0: IDENT@111..112 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@112..113 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@113..113 - 6: R_CURLY@113..114 "}" [] [] - 2: (empty) - 7: JS_EMPTY_STATEMENT@114..115 - 0: SEMICOLON@114..115 ";" [] [] - 8: JS_EXPORT@115..144 - 0: JS_DECORATOR_LIST@115..115 - 1: EXPORT_KW@115..123 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@123..144 - 0: DEFAULT_KW@123..131 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@131..144 - 0: INTERFACE_KW@131..141 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@141..142 - 0: IDENT@141..142 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@142..143 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@143..143 - 6: R_CURLY@143..144 "}" [] [] - 2: (empty) - 9: JS_EMPTY_STATEMENT@144..145 - 0: SEMICOLON@144..145 ";" [] [] - 4: EOF@145..146 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.rast deleted file mode 100644 index f3bbf8a4a2d4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.rast +++ /dev/null @@ -1,215 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: TsDeclareFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@24..25 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@25..26 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@27..28 ":" [] [], - ty: TsVoidType { - void_token: VOID_KW@28..32 "void" [] [], - }, - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@41..49 "default" [] [Whitespace(" ")], - declaration: TsDeclareFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@49..58 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@58..59 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@59..60 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@60..61 "v" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@61..63 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@63..69 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@69..70 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@70..71 ":" [] [], - ty: TsVoidType { - void_token: VOID_KW@71..75 "void" [] [], - }, - }, - semicolon_token: SEMICOLON@75..76 ";" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@76..84 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@84..92 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@92..101 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@101..102 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@102..103 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@103..104 "v" [] [], - }, - question_mark_token: QUESTION@104..105 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@105..107 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@107..110 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@110..111 ")" [] [], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@111..112 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@112..114 "}" [Newline("\n")] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@114..115 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..115 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..114 - 0: JS_EXPORT@0..33 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..33 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..33 - 0: (empty) - 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "a" [] [] - 3: (empty) - 4: JS_PARAMETERS@25..27 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_PARAMETER_LIST@26..26 - 2: R_PAREN@26..27 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@27..32 - 0: COLON@27..28 ":" [] [] - 1: TS_VOID_TYPE@28..32 - 0: VOID_KW@28..32 "void" [] [] - 6: SEMICOLON@32..33 ";" [] [] - 2: (empty) - 1: JS_EXPORT@33..76 - 0: JS_DECORATOR_LIST@33..33 - 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@41..76 - 0: DEFAULT_KW@41..49 "default" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@49..76 - 0: (empty) - 1: FUNCTION_KW@49..58 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@58..59 - 0: IDENT@58..59 "a" [] [] - 3: (empty) - 4: JS_PARAMETERS@59..70 - 0: L_PAREN@59..60 "(" [] [] - 1: JS_PARAMETER_LIST@60..69 - 0: JS_FORMAL_PARAMETER@60..69 - 0: JS_DECORATOR_LIST@60..60 - 1: JS_IDENTIFIER_BINDING@60..61 - 0: IDENT@60..61 "v" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@61..69 - 0: COLON@61..63 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@63..69 - 0: NUMBER_KW@63..69 "number" [] [] - 4: (empty) - 2: R_PAREN@69..70 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@70..75 - 0: COLON@70..71 ":" [] [] - 1: TS_VOID_TYPE@71..75 - 0: VOID_KW@71..75 "void" [] [] - 6: SEMICOLON@75..76 ";" [] [] - 2: (empty) - 2: JS_EXPORT@76..114 - 0: JS_DECORATOR_LIST@76..76 - 1: EXPORT_KW@76..84 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@84..114 - 0: DEFAULT_KW@84..92 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@92..114 - 0: (empty) - 1: FUNCTION_KW@92..101 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@101..102 - 0: IDENT@101..102 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@102..111 - 0: L_PAREN@102..103 "(" [] [] - 1: JS_PARAMETER_LIST@103..110 - 0: JS_FORMAL_PARAMETER@103..110 - 0: JS_DECORATOR_LIST@103..103 - 1: JS_IDENTIFIER_BINDING@103..104 - 0: IDENT@103..104 "v" [] [] - 2: QUESTION@104..105 "?" [] [] - 3: TS_TYPE_ANNOTATION@105..110 - 0: COLON@105..107 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@107..110 - 0: ANY_KW@107..110 "any" [] [] - 4: (empty) - 2: R_PAREN@110..111 ")" [] [] - 6: (empty) - 7: JS_FUNCTION_BODY@111..114 - 0: L_CURLY@111..112 "{" [] [] - 1: JS_DIRECTIVE_LIST@112..112 - 2: JS_STATEMENT_LIST@112..112 - 3: R_CURLY@112..114 "}" [Newline("\n")] [] - 2: (empty) - 4: EOF@114..115 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.rast deleted file mode 100644 index 366dc1038abc..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.rast +++ /dev/null @@ -1,228 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@25..26 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@26..27 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@55..56 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@56..57 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@84..85 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@85..86 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@86..87 ")" [] [], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@87..88 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@88..89 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@89..90 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@106..116 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@116..117 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@117..118 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@118..119 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@119..120 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@120..128 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@128..136 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@136..146 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@146..147 "A" [] [], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@147..148 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@148..149 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@149..150 ";" [] [], - }, - ], - eof_token: EOF@150..151 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..151 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..150 - 0: JS_EXPORT@0..28 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..28 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@15..28 - 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@26..27 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@27..27 - 6: R_CURLY@27..28 "}" [] [] - 2: (empty) - 1: JS_EMPTY_STATEMENT@28..29 - 0: SEMICOLON@28..29 ";" [] [] - 2: JS_EXPORT@29..58 - 0: JS_DECORATOR_LIST@29..29 - 1: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@37..58 - 0: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@45..58 - 0: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@55..56 - 0: IDENT@55..56 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@56..57 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@57..57 - 6: R_CURLY@57..58 "}" [] [] - 2: (empty) - 3: JS_EMPTY_STATEMENT@58..59 - 0: SEMICOLON@58..59 ";" [] [] - 4: JS_EXPORT@59..89 - 0: JS_DECORATOR_LIST@59..59 - 1: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@67..89 - 0: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@75..89 - 0: (empty) - 1: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@84..85 - 0: IDENT@84..85 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@85..87 - 0: L_PAREN@85..86 "(" [] [] - 1: JS_PARAMETER_LIST@86..86 - 2: R_PAREN@86..87 ")" [] [] - 6: (empty) - 7: JS_FUNCTION_BODY@87..89 - 0: L_CURLY@87..88 "{" [] [] - 1: JS_DIRECTIVE_LIST@88..88 - 2: JS_STATEMENT_LIST@88..88 - 3: R_CURLY@88..89 "}" [] [] - 2: (empty) - 5: JS_EMPTY_STATEMENT@89..90 - 0: SEMICOLON@89..90 ";" [] [] - 6: JS_EXPORT@90..119 - 0: JS_DECORATOR_LIST@90..90 - 1: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@98..119 - 0: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@106..119 - 0: INTERFACE_KW@106..116 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@116..117 - 0: IDENT@116..117 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@117..118 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@118..118 - 6: R_CURLY@118..119 "}" [] [] - 2: (empty) - 7: JS_EMPTY_STATEMENT@119..120 - 0: SEMICOLON@119..120 ";" [] [] - 8: JS_EXPORT@120..149 - 0: JS_DECORATOR_LIST@120..120 - 1: EXPORT_KW@120..128 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@128..149 - 0: DEFAULT_KW@128..136 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@136..149 - 0: INTERFACE_KW@136..146 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@146..147 - 0: IDENT@146..147 "A" [] [] - 2: (empty) - 3: (empty) - 4: L_CURLY@147..148 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@148..148 - 6: R_CURLY@148..149 "}" [] [] - 2: (empty) - 9: JS_EMPTY_STATEMENT@149..150 - 0: SEMICOLON@149..150 ";" [] [] - 4: EOF@150..151 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.rast deleted file mode 100644 index 8e11b44e3399..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@32..36 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@36..38 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@38..39 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_EXPORT@0..39 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..39 - 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@26..39 - 0: JS_DECORATOR_LIST@26..26 - 1: (empty) - 2: CLASS_KW@26..32 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@32..36 - 0: IDENT@32..36 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@36..38 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@38..38 - 9: R_CURLY@38..39 "}" [] [] - 2: (empty) - 4: EOF@39..40 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.rast deleted file mode 100644 index 620463f65261..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.rast +++ /dev/null @@ -1,148 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..6 "first" [] [], - }, - }, - operator_token: DOT@6..7 "." [] [], - member: JsName { - value_token: IDENT@7..13 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@13..14 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..21 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@21..22 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@22..23 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@29..38 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@38..39 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@39..40 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@40..41 ")" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@57..63 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@63..67 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@67..68 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@68..69 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@69..70 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..70 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..69 - 0: JS_EXPORT@0..69 - 0: JS_DECORATOR_LIST@0..41 - 0: JS_DECORATOR@0..13 - 0: AT@0..1 "@" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@1..13 - 0: JS_IDENTIFIER_EXPRESSION@1..6 - 0: JS_REFERENCE_IDENTIFIER@1..6 - 0: IDENT@1..6 "first" [] [] - 1: DOT@6..7 "." [] [] - 2: JS_NAME@7..13 - 0: IDENT@7..13 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@13..21 - 0: AT@13..14 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@14..21 - 0: JS_REFERENCE_IDENTIFIER@14..21 - 0: IDENT@14..21 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@21..41 - 0: AT@21..22 "@" [] [] - 1: JS_CALL_EXPRESSION@22..41 - 0: JS_PARENTHESIZED_EXPRESSION@22..39 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@23..38 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@29..38 - 0: JS_REFERENCE_IDENTIFIER@29..38 - 0: IDENT@29..38 "decorator" [] [] - 2: R_PAREN@38..39 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@39..41 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@40..40 - 2: R_PAREN@40..41 ")" [] [] - 1: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@49..69 - 0: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@57..69 - 0: JS_DECORATOR_LIST@57..57 - 1: (empty) - 2: CLASS_KW@57..63 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@63..67 - 0: IDENT@63..67 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@67..68 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@68..68 - 9: R_CURLY@68..69 "}" [] [] - 2: (empty) - 4: EOF@69..70 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.rast deleted file mode 100644 index a7ff67aefe79..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.rast +++ /dev/null @@ -1,83 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..7 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@7..15 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@15..23 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@23..24 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..30 "after" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@30..36 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@36..40 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@40..42 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@43..44 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..44 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..43 - 0: JS_EXPORT@0..43 - 0: JS_DECORATOR_LIST@0..7 - 0: JS_DECORATOR@0..7 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..7 - 0: JS_REFERENCE_IDENTIFIER@1..7 - 0: IDENT@1..7 "before" [] [] - 1: EXPORT_KW@7..15 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@15..43 - 0: DEFAULT_KW@15..23 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@23..43 - 0: JS_DECORATOR_LIST@23..30 - 0: JS_DECORATOR@23..30 - 0: AT@23..24 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@24..30 - 0: JS_REFERENCE_IDENTIFIER@24..30 - 0: IDENT@24..30 "after" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@30..36 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@36..40 - 0: IDENT@36..40 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@40..42 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@42..42 - 9: R_CURLY@42..43 "}" [] [] - 2: (empty) - 4: EOF@43..44 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.rast deleted file mode 100644 index c1bf6012ac40..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..2 "@" [Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@2..8 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@25..34 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@34..40 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@40..44 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@46..47 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_EXPORT@0..47 - 0: JS_DECORATOR_LIST@0..8 - 0: JS_DECORATOR@0..8 - 0: AT@0..2 "@" [Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@2..8 - 0: JS_REFERENCE_IDENTIFIER@2..8 - 0: IDENT@2..8 "before" [] [] - 1: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@17..47 - 0: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@25..47 - 0: JS_DECORATOR_LIST@25..25 - 1: ABSTRACT_KW@25..34 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@34..40 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@40..44 - 0: IDENT@40..44 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@44..46 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@46..46 - 9: R_CURLY@46..47 "}" [] [] - 2: (empty) - 4: EOF@47..48 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.rast deleted file mode 100644 index 4b4fd1265043..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.rast +++ /dev/null @@ -1,83 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..2 "@" [Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@2..8 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@25..26 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..32 "after" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@32..41 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@41..47 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@47..51 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@51..53 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@53..54 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_EXPORT@0..54 - 0: JS_DECORATOR_LIST@0..8 - 0: JS_DECORATOR@0..8 - 0: AT@0..2 "@" [Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@2..8 - 0: JS_REFERENCE_IDENTIFIER@2..8 - 0: IDENT@2..8 "before" [] [] - 1: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@17..54 - 0: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@25..54 - 0: JS_DECORATOR_LIST@25..32 - 0: JS_DECORATOR@25..32 - 0: AT@25..26 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@26..32 - 0: JS_REFERENCE_IDENTIFIER@26..32 - 0: IDENT@26..32 "after" [] [Whitespace(" ")] - 1: ABSTRACT_KW@32..41 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@41..47 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@47..51 - 0: IDENT@47..51 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@51..53 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@53..53 - 9: R_CURLY@53..54 "}" [] [] - 2: (empty) - 4: EOF@54..55 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.rast deleted file mode 100644 index 0056b30e4c96..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.rast +++ /dev/null @@ -1,357 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..10 "decorator" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@18..24 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@24..28 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@31..33 "@" [Newline("\n")] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..38 "first" [] [], - }, - }, - operator_token: DOT@38..39 "." [] [], - member: JsName { - value_token: IDENT@39..45 "field" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@45..46 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..53 "second" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@53..54 "@" [] [], - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@54..55 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@55..56 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@61..70 "decorator" [] [], - }, - }, - }, - r_paren_token: R_PAREN@70..71 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@71..72 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@72..73 ")" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@73..81 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@81..87 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@87..91 "Bar" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@91..92 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@93..95 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@95..101 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@101..109 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@109..110 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@110..116 "after" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@116..122 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@122..126 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@126..128 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@128..129 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@129..132 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@132..138 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@138..147 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@147..156 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@156..162 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@162..166 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@166..168 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@168..169 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@169..172 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@172..178 "before" [] [], - }, - }, - }, - ], - export_token: EXPORT_KW@178..187 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@187..188 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@188..194 "after" [] [Whitespace(" ")], - }, - }, - }, - ], - abstract_token: ABSTRACT_KW@194..203 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@203..209 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@209..213 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@213..215 "{" [] [Whitespace(" ")], - members: JsClassMemberList [], - r_curly_token: R_CURLY@215..216 "}" [] [], - }, - }, - ], - eof_token: EOF@216..217 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..217 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..216 - 0: JS_EXPORT@0..31 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..10 - 0: JS_REFERENCE_IDENTIFIER@1..10 - 0: IDENT@1..10 "decorator" [] [] - 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@18..31 - 0: JS_DECORATOR_LIST@18..18 - 1: (empty) - 2: CLASS_KW@18..24 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@24..28 - 0: IDENT@24..28 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@28..30 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@30..30 - 9: R_CURLY@30..31 "}" [] [] - 1: JS_EXPORT@31..93 - 0: JS_DECORATOR_LIST@31..73 - 0: JS_DECORATOR@31..45 - 0: AT@31..33 "@" [Newline("\n")] [] - 1: JS_STATIC_MEMBER_EXPRESSION@33..45 - 0: JS_IDENTIFIER_EXPRESSION@33..38 - 0: JS_REFERENCE_IDENTIFIER@33..38 - 0: IDENT@33..38 "first" [] [] - 1: DOT@38..39 "." [] [] - 2: JS_NAME@39..45 - 0: IDENT@39..45 "field" [] [Whitespace(" ")] - 1: JS_DECORATOR@45..53 - 0: AT@45..46 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@46..53 - 0: JS_REFERENCE_IDENTIFIER@46..53 - 0: IDENT@46..53 "second" [] [Whitespace(" ")] - 2: JS_DECORATOR@53..73 - 0: AT@53..54 "@" [] [] - 1: JS_CALL_EXPRESSION@54..73 - 0: JS_PARENTHESIZED_EXPRESSION@54..71 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@55..70 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@55..58 - 0: L_PAREN@55..56 "(" [] [] - 1: JS_PARAMETER_LIST@56..56 - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@61..70 - 0: JS_REFERENCE_IDENTIFIER@61..70 - 0: IDENT@61..70 "decorator" [] [] - 2: R_PAREN@70..71 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@71..73 - 0: L_PAREN@71..72 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@72..72 - 2: R_PAREN@72..73 ")" [] [] - 1: EXPORT_KW@73..81 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@81..93 - 0: JS_DECORATOR_LIST@81..81 - 1: (empty) - 2: CLASS_KW@81..87 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@87..91 - 0: IDENT@87..91 "Bar" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@91..92 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@92..92 - 9: R_CURLY@92..93 "}" [] [] - 2: JS_EXPORT@93..129 - 0: JS_DECORATOR_LIST@93..101 - 0: JS_DECORATOR@93..101 - 0: AT@93..95 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@95..101 - 0: JS_REFERENCE_IDENTIFIER@95..101 - 0: IDENT@95..101 "before" [] [] - 1: EXPORT_KW@101..109 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@109..129 - 0: JS_DECORATOR_LIST@109..116 - 0: JS_DECORATOR@109..116 - 0: AT@109..110 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@110..116 - 0: JS_REFERENCE_IDENTIFIER@110..116 - 0: IDENT@110..116 "after" [] [Whitespace(" ")] - 1: (empty) - 2: CLASS_KW@116..122 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@122..126 - 0: IDENT@122..126 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@126..128 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@128..128 - 9: R_CURLY@128..129 "}" [] [] - 3: JS_EXPORT@129..169 - 0: JS_DECORATOR_LIST@129..138 - 0: JS_DECORATOR@129..138 - 0: AT@129..132 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@132..138 - 0: JS_REFERENCE_IDENTIFIER@132..138 - 0: IDENT@132..138 "before" [] [] - 1: EXPORT_KW@138..147 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@147..169 - 0: JS_DECORATOR_LIST@147..147 - 1: ABSTRACT_KW@147..156 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@156..162 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@162..166 - 0: IDENT@162..166 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@166..168 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@168..168 - 9: R_CURLY@168..169 "}" [] [] - 4: JS_EXPORT@169..216 - 0: JS_DECORATOR_LIST@169..178 - 0: JS_DECORATOR@169..178 - 0: AT@169..172 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@172..178 - 0: JS_REFERENCE_IDENTIFIER@172..178 - 0: IDENT@172..178 "before" [] [] - 1: EXPORT_KW@178..187 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@187..216 - 0: JS_DECORATOR_LIST@187..194 - 0: JS_DECORATOR@187..194 - 0: AT@187..188 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@188..194 - 0: JS_REFERENCE_IDENTIFIER@188..194 - 0: IDENT@188..194 "after" [] [Whitespace(" ")] - 1: ABSTRACT_KW@194..203 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@203..209 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@209..213 - 0: IDENT@209..213 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@213..215 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@215..215 - 9: R_CURLY@215..216 "}" [] [] - 4: EOF@216..217 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.rast b/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.rast deleted file mode 100644 index 2fb101b21396..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.rast +++ /dev/null @@ -1,192 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@8..9 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..19 "decorator" [] [Whitespace(" ")], - }, - }, - }, - ], - class_token: CLASS_KW@19..25 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@25..26 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@33..35 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@35..37 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@37..38 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..44 "first" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@44..45 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..52 "second" [] [Whitespace(" ")], - }, - }, - }, - ], - class_token: CLASS_KW@52..58 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@58..62 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@62..63 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@63..76 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@76..77 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@77..79 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@79..80 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@80..81 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@81..83 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@83..84 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..84 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..83 - 0: JS_VARIABLE_STATEMENT@0..28 - 0: JS_VARIABLE_DECLARATION@0..27 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..27 - 0: JS_VARIABLE_DECLARATOR@4..27 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..27 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@8..27 - 0: JS_DECORATOR_LIST@8..19 - 0: JS_DECORATOR@8..19 - 0: AT@8..9 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@9..19 - 0: JS_REFERENCE_IDENTIFIER@9..19 - 0: IDENT@9..19 "decorator" [] [Whitespace(" ")] - 1: CLASS_KW@19..25 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@25..26 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@26..26 - 8: R_CURLY@26..27 "}" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_VARIABLE_STATEMENT@28..83 - 0: JS_VARIABLE_DECLARATION@28..83 - 0: (empty) - 1: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@33..83 - 0: JS_VARIABLE_DECLARATOR@33..83 - 0: JS_IDENTIFIER_BINDING@33..35 - 0: IDENT@33..35 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@35..83 - 0: EQ@35..37 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@37..83 - 0: JS_DECORATOR_LIST@37..52 - 0: JS_DECORATOR@37..44 - 0: AT@37..38 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..44 - 0: JS_REFERENCE_IDENTIFIER@38..44 - 0: IDENT@38..44 "first" [] [Whitespace(" ")] - 1: JS_DECORATOR@44..52 - 0: AT@44..45 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@45..52 - 0: JS_REFERENCE_IDENTIFIER@45..52 - 0: IDENT@45..52 "second" [] [Whitespace(" ")] - 1: CLASS_KW@52..58 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@58..62 - 0: IDENT@58..62 "foo" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@62..63 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@63..81 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@63..81 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@63..63 - 1: JS_LITERAL_MEMBER_NAME@63..76 - 0: IDENT@63..76 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@76..79 - 0: L_PAREN@76..77 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@77..77 - 2: R_PAREN@77..79 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@79..81 - 0: L_CURLY@79..80 "{" [] [] - 1: JS_DIRECTIVE_LIST@80..80 - 2: JS_STATEMENT_LIST@80..80 - 3: R_CURLY@80..81 "}" [] [] - 8: R_CURLY@81..83 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@83..84 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast b/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast deleted file mode 100644 index 0b2908d0b3c0..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast +++ /dev/null @@ -1,128 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@6..8 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@8..13 "value" [] [], - }, - init: missing (optional), - }, - COMMA@13..15 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@15..17 "f" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@17..19 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@19..20 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@20..25 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..36 "value" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - ], - r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..44 "item" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: JS_VARIABLE_STATEMENT@0..44 - 0: JS_VARIABLE_DECLARATION@0..44 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..44 - 0: JS_VARIABLE_DECLARATOR@6..44 - 0: JS_OBJECT_BINDING_PATTERN@6..38 - 0: L_CURLY@6..8 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@8..36 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@8..13 - 0: JS_IDENTIFIER_BINDING@8..13 - 0: IDENT@8..13 "value" [] [] - 1: (empty) - 1: COMMA@13..15 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@15..36 - 0: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "f" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@17..36 - 0: EQ@17..19 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@19..36 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@19..27 - 0: L_PAREN@19..20 "(" [] [] - 1: JS_PARAMETER_LIST@20..25 - 0: JS_FORMAL_PARAMETER@20..25 - 0: JS_DECORATOR_LIST@20..20 - 1: JS_IDENTIFIER_BINDING@20..25 - 0: IDENT@20..25 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@30..36 - 0: JS_REFERENCE_IDENTIFIER@30..36 - 0: IDENT@30..36 "value" [] [Whitespace(" ")] - 2: R_CURLY@36..38 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@38..44 - 0: EQ@38..40 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@40..44 - 0: JS_REFERENCE_IDENTIFIER@40..44 - 0: IDENT@40..44 "item" [] [] - 1: (empty) - 4: EOF@44..45 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/directives.rast b/crates/biome_js_parser/test_data/inline/ok/directives.rast deleted file mode 100644 index 472e5c0d3bd2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/directives.rast +++ /dev/null @@ -1,421 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@0..19 "\"use new\"" [Comments("// SCRIPT"), Newline("\n")] [], - semicolon_token: missing (optional), - }, - ], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@24..26 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@26..28 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@28..30 "10" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@31..44 "\"use strict\"" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@44..64 ";" [] [Whitespace(" "), Comments("// not a directive")], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@64..74 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@74..78 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@78..79 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@79..81 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@81..82 "{" [] [], - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@82..97 "'use strict'" [Newline("\n"), Whitespace(" ")] [], - semicolon_token: SEMICOLON@97..98 ";" [] [], - }, - ], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@98..105 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@105..107 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@107..109 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@109..111 "10" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@112..127 "'use strict'" [Newline("\n"), Whitespace(" ")] [], - }, - semicolon_token: SEMICOLON@127..147 ";" [] [Whitespace(" "), Comments("// not a directive")], - }, - ], - r_curly_token: R_CURLY@147..149 "}" [Newline("\n")] [], - }, - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@149..151 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@151..160 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@160..161 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@161..163 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@163..164 "{" [] [], - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@164..179 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - semicolon_token: SEMICOLON@179..180 ";" [] [], - }, - ], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@180..195 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - }, - operator_token: DOT@195..201 "." [Newline("\n"), Whitespace(" ")] [], - member: JsName { - value_token: IDENT@201..207 "length" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@207..227 ";" [] [Whitespace(" "), Comments("// not a directive")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@227..234 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@234..236 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@236..238 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@238..240 "10" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@240..241 ";" [] [], - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@241..256 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - }, - semicolon_token: SEMICOLON@256..276 ";" [] [Whitespace(" "), Comments("// not a directive")], - }, - ], - r_curly_token: R_CURLY@276..278 "}" [Newline("\n")] [], - }, - }, - r_paren_token: R_PAREN@278..279 ")" [] [], - }, - semicolon_token: SEMICOLON@279..280 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@280..285 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@285..287 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@287..289 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@289..290 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@290..292 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@292..295 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@295..296 "{" [] [], - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@296..311 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - semicolon_token: SEMICOLON@311..312 ";" [] [], - }, - ], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@312..319 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@319..321 "e" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@321..323 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@323..325 "10" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@325..326 ";" [] [], - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@326..341 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - }, - semicolon_token: SEMICOLON@341..362 ";" [] [Whitespace(" "), Comments("// not a directive")], - }, - ], - r_curly_token: R_CURLY@362..364 "}" [Newline("\n")] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@364..366 "{" [Newline("\n")] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@366..381 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - }, - semicolon_token: SEMICOLON@381..401 ";" [] [Whitespace(" "), Comments("// not a directive")], - }, - ], - r_curly_token: R_CURLY@401..403 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@403..404 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..404 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..19 - 0: JS_DIRECTIVE@0..19 - 0: JS_STRING_LITERAL@0..19 "\"use new\"" [Comments("// SCRIPT"), Newline("\n")] [] - 1: (empty) - 3: JS_STATEMENT_LIST@19..403 - 0: JS_VARIABLE_STATEMENT@19..31 - 0: JS_VARIABLE_DECLARATION@19..30 - 0: (empty) - 1: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@24..30 - 0: JS_VARIABLE_DECLARATOR@24..30 - 0: JS_IDENTIFIER_BINDING@24..26 - 0: IDENT@24..26 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@26..30 - 0: EQ@26..28 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@28..30 - 0: JS_NUMBER_LITERAL@28..30 "10" [] [] - 1: SEMICOLON@30..31 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@31..64 - 0: JS_STRING_LITERAL_EXPRESSION@31..44 - 0: JS_STRING_LITERAL@31..44 "\"use strict\"" [Newline("\n")] [] - 1: SEMICOLON@44..64 ";" [] [Whitespace(" "), Comments("// not a directive")] - 2: JS_FUNCTION_DECLARATION@64..149 - 0: (empty) - 1: FUNCTION_KW@64..74 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@74..78 - 0: IDENT@74..78 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@78..81 - 0: L_PAREN@78..79 "(" [] [] - 1: JS_PARAMETER_LIST@79..79 - 2: R_PAREN@79..81 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@81..149 - 0: L_CURLY@81..82 "{" [] [] - 1: JS_DIRECTIVE_LIST@82..98 - 0: JS_DIRECTIVE@82..98 - 0: JS_STRING_LITERAL@82..97 "'use strict'" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@97..98 ";" [] [] - 2: JS_STATEMENT_LIST@98..147 - 0: JS_VARIABLE_STATEMENT@98..112 - 0: JS_VARIABLE_DECLARATION@98..111 - 0: (empty) - 1: LET_KW@98..105 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@105..111 - 0: JS_VARIABLE_DECLARATOR@105..111 - 0: JS_IDENTIFIER_BINDING@105..107 - 0: IDENT@105..107 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@107..111 - 0: EQ@107..109 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@109..111 - 0: JS_NUMBER_LITERAL@109..111 "10" [] [] - 1: SEMICOLON@111..112 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@112..147 - 0: JS_STRING_LITERAL_EXPRESSION@112..127 - 0: JS_STRING_LITERAL@112..127 "'use strict'" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@127..147 ";" [] [Whitespace(" "), Comments("// not a directive")] - 3: R_CURLY@147..149 "}" [Newline("\n")] [] - 3: JS_EXPRESSION_STATEMENT@149..280 - 0: JS_PARENTHESIZED_EXPRESSION@149..279 - 0: L_PAREN@149..151 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@151..278 - 0: (empty) - 1: FUNCTION_KW@151..160 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@160..163 - 0: L_PAREN@160..161 "(" [] [] - 1: JS_PARAMETER_LIST@161..161 - 2: R_PAREN@161..163 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@163..278 - 0: L_CURLY@163..164 "{" [] [] - 1: JS_DIRECTIVE_LIST@164..180 - 0: JS_DIRECTIVE@164..180 - 0: JS_STRING_LITERAL@164..179 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@179..180 ";" [] [] - 2: JS_STATEMENT_LIST@180..276 - 0: JS_EXPRESSION_STATEMENT@180..207 - 0: JS_STATIC_MEMBER_EXPRESSION@180..207 - 0: JS_STRING_LITERAL_EXPRESSION@180..195 - 0: JS_STRING_LITERAL@180..195 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@195..201 "." [Newline("\n"), Whitespace(" ")] [] - 2: JS_NAME@201..207 - 0: IDENT@201..207 "length" [] [] - 1: (empty) - 1: JS_EMPTY_STATEMENT@207..227 - 0: SEMICOLON@207..227 ";" [] [Whitespace(" "), Comments("// not a directive")] - 2: JS_VARIABLE_STATEMENT@227..241 - 0: JS_VARIABLE_DECLARATION@227..240 - 0: (empty) - 1: LET_KW@227..234 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@234..240 - 0: JS_VARIABLE_DECLARATOR@234..240 - 0: JS_IDENTIFIER_BINDING@234..236 - 0: IDENT@234..236 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@236..240 - 0: EQ@236..238 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@238..240 - 0: JS_NUMBER_LITERAL@238..240 "10" [] [] - 1: SEMICOLON@240..241 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@241..276 - 0: JS_STRING_LITERAL_EXPRESSION@241..256 - 0: JS_STRING_LITERAL@241..256 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@256..276 ";" [] [Whitespace(" "), Comments("// not a directive")] - 3: R_CURLY@276..278 "}" [Newline("\n")] [] - 2: R_PAREN@278..279 ")" [] [] - 1: SEMICOLON@279..280 ";" [] [] - 4: JS_VARIABLE_STATEMENT@280..364 - 0: JS_VARIABLE_DECLARATION@280..364 - 0: (empty) - 1: LET_KW@280..285 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@285..364 - 0: JS_VARIABLE_DECLARATOR@285..364 - 0: JS_IDENTIFIER_BINDING@285..287 - 0: IDENT@285..287 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@287..364 - 0: EQ@287..289 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@289..364 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@289..292 - 0: L_PAREN@289..290 "(" [] [] - 1: JS_PARAMETER_LIST@290..290 - 2: R_PAREN@290..292 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@292..295 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@295..364 - 0: L_CURLY@295..296 "{" [] [] - 1: JS_DIRECTIVE_LIST@296..312 - 0: JS_DIRECTIVE@296..312 - 0: JS_STRING_LITERAL@296..311 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@311..312 ";" [] [] - 2: JS_STATEMENT_LIST@312..362 - 0: JS_VARIABLE_STATEMENT@312..326 - 0: JS_VARIABLE_DECLARATION@312..325 - 0: (empty) - 1: LET_KW@312..319 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@319..325 - 0: JS_VARIABLE_DECLARATOR@319..325 - 0: JS_IDENTIFIER_BINDING@319..321 - 0: IDENT@319..321 "e" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@321..325 - 0: EQ@321..323 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@323..325 - 0: JS_NUMBER_LITERAL@323..325 "10" [] [] - 1: SEMICOLON@325..326 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@326..362 - 0: JS_STRING_LITERAL_EXPRESSION@326..341 - 0: JS_STRING_LITERAL@326..341 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@341..362 ";" [] [Whitespace(" "), Comments("// not a directive")] - 3: R_CURLY@362..364 "}" [Newline("\n")] [] - 1: (empty) - 5: JS_BLOCK_STATEMENT@364..403 - 0: L_CURLY@364..366 "{" [Newline("\n")] [] - 1: JS_STATEMENT_LIST@366..401 - 0: JS_EXPRESSION_STATEMENT@366..401 - 0: JS_STRING_LITERAL_EXPRESSION@366..381 - 0: JS_STRING_LITERAL@366..381 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@381..401 ";" [] [Whitespace(" "), Comments("// not a directive")] - 2: R_CURLY@401..403 "}" [Newline("\n")] [] - 4: EOF@403..404 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/directives_redundant.rast b/crates/biome_js_parser/test_data/inline/ok/directives_redundant.rast deleted file mode 100644 index 73e56746a9cf..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/directives_redundant.rast +++ /dev/null @@ -1,193 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..23 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@27..42 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - ], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@43..55 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@55..62 "inner_a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@62..63 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@65..66 "{" [] [], - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@66..83 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - ], - statements: JsStatementList [], - r_curly_token: R_CURLY@84..88 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@88..100 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@100..107 "inner_b" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@107..108 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@110..111 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@111..125 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@125..136 "inner_inner" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@136..137 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@137..139 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@139..140 "{" [] [], - directives: JsDirectiveList [ - JsDirective { - value_token: JS_STRING_LITERAL@140..159 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], - semicolon_token: SEMICOLON@159..160 ";" [] [], - }, - ], - statements: JsStatementList [], - r_curly_token: R_CURLY@160..166 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@166..170 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@170..172 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@172..173 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..173 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..172 - 0: JS_FUNCTION_DECLARATION@0..172 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..23 - 0: IDENT@19..23 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@26..172 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..43 - 0: JS_DIRECTIVE@27..43 - 0: JS_STRING_LITERAL@27..42 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@42..43 ";" [] [] - 2: JS_STATEMENT_LIST@43..170 - 0: JS_FUNCTION_DECLARATION@43..88 - 0: (empty) - 1: FUNCTION_KW@43..55 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@55..62 - 0: IDENT@55..62 "inner_a" [] [] - 4: (empty) - 5: JS_PARAMETERS@62..65 - 0: L_PAREN@62..63 "(" [] [] - 1: JS_PARAMETER_LIST@63..63 - 2: R_PAREN@63..65 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@65..88 - 0: L_CURLY@65..66 "{" [] [] - 1: JS_DIRECTIVE_LIST@66..84 - 0: JS_DIRECTIVE@66..84 - 0: JS_STRING_LITERAL@66..83 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@83..84 ";" [] [] - 2: JS_STATEMENT_LIST@84..84 - 3: R_CURLY@84..88 "}" [Newline("\n"), Whitespace(" ")] [] - 1: JS_FUNCTION_DECLARATION@88..170 - 0: (empty) - 1: FUNCTION_KW@88..100 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@100..107 - 0: IDENT@100..107 "inner_b" [] [] - 4: (empty) - 5: JS_PARAMETERS@107..110 - 0: L_PAREN@107..108 "(" [] [] - 1: JS_PARAMETER_LIST@108..108 - 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@110..170 - 0: L_CURLY@110..111 "{" [] [] - 1: JS_DIRECTIVE_LIST@111..111 - 2: JS_STATEMENT_LIST@111..166 - 0: JS_FUNCTION_DECLARATION@111..166 - 0: (empty) - 1: FUNCTION_KW@111..125 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@125..136 - 0: IDENT@125..136 "inner_inner" [] [] - 4: (empty) - 5: JS_PARAMETERS@136..139 - 0: L_PAREN@136..137 "(" [] [] - 1: JS_PARAMETER_LIST@137..137 - 2: R_PAREN@137..139 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@139..166 - 0: L_CURLY@139..140 "{" [] [] - 1: JS_DIRECTIVE_LIST@140..160 - 0: JS_DIRECTIVE@140..160 - 0: JS_STRING_LITERAL@140..159 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] - 1: SEMICOLON@159..160 ";" [] [] - 2: JS_STATEMENT_LIST@160..160 - 3: R_CURLY@160..166 "}" [Newline("\n"), Whitespace(" ")] [] - 3: R_CURLY@166..170 "}" [Newline("\n"), Whitespace(" ")] [] - 3: R_CURLY@170..172 "}" [Newline("\n")] [] - 4: EOF@172..173 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/do-while-asi.rast b/crates/biome_js_parser/test_data/inline/ok/do-while-asi.rast deleted file mode 100644 index 40497e22c229..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/do-while-asi.rast +++ /dev/null @@ -1,170 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsDoWhileStatement { - do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], - body: JsDoWhileStatement { - do_token: DO_KW@3..6 "do" [] [Whitespace(" ")], - body: JsDoWhileStatement { - do_token: DO_KW@6..9 "do" [] [Whitespace(" ")], - body: JsEmptyStatement { - semicolon_token: SEMICOLON@9..11 ";" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@11..17 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@17..18 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..19 "x" [] [], - }, - }, - r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], - semicolon_token: missing (optional), - }, - while_token: WHILE_KW@21..27 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@27..28 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..29 "x" [] [], - }, - }, - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - semicolon_token: missing (optional), - }, - while_token: WHILE_KW@31..37 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@37..38 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..39 "x" [] [], - }, - }, - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@41..43 "x" [] [Whitespace(" ")], - }, - operator_token: EQ@43..45 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@45..47 "39" [] [], - }, - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - JsDoWhileStatement { - do_token: DO_KW@48..52 "do" [Newline("\n")] [Whitespace(" ")], - body: JsDoWhileStatement { - do_token: DO_KW@52..55 "do" [] [Whitespace(" ")], - body: JsEmptyStatement { - semicolon_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@57..63 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@63..64 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@64..65 "x" [] [], - }, - }, - r_paren_token: R_PAREN@65..66 ")" [] [], - semicolon_token: SEMICOLON@66..68 ";" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@68..74 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@74..75 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@75..76 "x" [] [], - }, - }, - r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@78..80 "x" [] [Whitespace(" ")], - }, - operator_token: EQ@80..82 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@82..84 "39" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: JS_DO_WHILE_STATEMENT@0..41 - 0: DO_KW@0..3 "do" [] [Whitespace(" ")] - 1: JS_DO_WHILE_STATEMENT@3..31 - 0: DO_KW@3..6 "do" [] [Whitespace(" ")] - 1: JS_DO_WHILE_STATEMENT@6..21 - 0: DO_KW@6..9 "do" [] [Whitespace(" ")] - 1: JS_EMPTY_STATEMENT@9..11 - 0: SEMICOLON@9..11 ";" [] [Whitespace(" ")] - 2: WHILE_KW@11..17 "while" [] [Whitespace(" ")] - 3: L_PAREN@17..18 "(" [] [] - 4: JS_IDENTIFIER_EXPRESSION@18..19 - 0: JS_REFERENCE_IDENTIFIER@18..19 - 0: IDENT@18..19 "x" [] [] - 5: R_PAREN@19..21 ")" [] [Whitespace(" ")] - 6: (empty) - 2: WHILE_KW@21..27 "while" [] [Whitespace(" ")] - 3: L_PAREN@27..28 "(" [] [] - 4: JS_IDENTIFIER_EXPRESSION@28..29 - 0: JS_REFERENCE_IDENTIFIER@28..29 - 0: IDENT@28..29 "x" [] [] - 5: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 6: (empty) - 2: WHILE_KW@31..37 "while" [] [Whitespace(" ")] - 3: L_PAREN@37..38 "(" [] [] - 4: JS_IDENTIFIER_EXPRESSION@38..39 - 0: JS_REFERENCE_IDENTIFIER@38..39 - 0: IDENT@38..39 "x" [] [] - 5: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 6: (empty) - 1: JS_EXPRESSION_STATEMENT@41..48 - 0: JS_ASSIGNMENT_EXPRESSION@41..47 - 0: JS_IDENTIFIER_ASSIGNMENT@41..43 - 0: IDENT@41..43 "x" [] [Whitespace(" ")] - 1: EQ@43..45 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@45..47 - 0: JS_NUMBER_LITERAL@45..47 "39" [] [] - 1: SEMICOLON@47..48 ";" [] [] - 2: JS_DO_WHILE_STATEMENT@48..78 - 0: DO_KW@48..52 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_DO_WHILE_STATEMENT@52..68 - 0: DO_KW@52..55 "do" [] [Whitespace(" ")] - 1: JS_EMPTY_STATEMENT@55..57 - 0: SEMICOLON@55..57 ";" [] [Whitespace(" ")] - 2: WHILE_KW@57..63 "while" [] [Whitespace(" ")] - 3: L_PAREN@63..64 "(" [] [] - 4: JS_IDENTIFIER_EXPRESSION@64..65 - 0: JS_REFERENCE_IDENTIFIER@64..65 - 0: IDENT@64..65 "x" [] [] - 5: R_PAREN@65..66 ")" [] [] - 6: SEMICOLON@66..68 ";" [] [Whitespace(" ")] - 2: WHILE_KW@68..74 "while" [] [Whitespace(" ")] - 3: L_PAREN@74..75 "(" [] [] - 4: JS_IDENTIFIER_EXPRESSION@75..76 - 0: JS_REFERENCE_IDENTIFIER@75..76 - 0: IDENT@75..76 "x" [] [] - 5: R_PAREN@76..78 ")" [] [Whitespace(" ")] - 6: (empty) - 3: JS_EXPRESSION_STATEMENT@78..84 - 0: JS_ASSIGNMENT_EXPRESSION@78..84 - 0: JS_IDENTIFIER_ASSIGNMENT@78..80 - 0: IDENT@78..80 "x" [] [Whitespace(" ")] - 1: EQ@80..82 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@82..84 - 0: JS_NUMBER_LITERAL@82..84 "39" [] [] - 1: (empty) - 4: EOF@84..85 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_statement.rast b/crates/biome_js_parser/test_data/inline/ok/do_while_statement.rast deleted file mode 100644 index bf135af27ca9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/do_while_statement.rast +++ /dev/null @@ -1,291 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsDoWhileStatement { - do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@3..10 "console" [] [], - }, - }, - operator_token: DOT@10..11 "." [] [], - member: JsName { - value_token: IDENT@11..14 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@14..15 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@15..21 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@21..22 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@24..29 "while" [] [], - l_paren_token: L_PAREN@29..30 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@30..34 "true" [] [], - }, - r_paren_token: R_PAREN@34..35 ")" [] [], - semicolon_token: missing (optional), - }, - JsDoWhileStatement { - do_token: DO_KW@35..39 "do" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@39..40 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..50 "console" [Newline("\n"), Whitespace(" ")] [], - }, - }, - operator_token: DOT@50..51 "." [] [], - member: JsName { - value_token: IDENT@51..54 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@54..55 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@55..61 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@61..62 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@62..65 "}" [Newline("\n")] [Whitespace(" ")], - }, - while_token: WHILE_KW@65..71 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@71..72 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@72..76 "true" [] [], - }, - r_paren_token: R_PAREN@76..77 ")" [] [], - semicolon_token: SEMICOLON@77..78 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@78..83 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@83..85 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@85..87 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@87..88 "1" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@88..89 ";" [] [], - }, - JsDoWhileStatement { - do_token: DO_KW@89..92 "do" [Newline("\n")] [], - body: JsDoWhileStatement { - do_token: DO_KW@92..96 "do" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@96..97 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@97..102 "a" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - operator_token: EQ@102..104 "=" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@104..106 "a" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@106..108 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@108..109 "1" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@109..112 "}" [Newline("\n")] [Whitespace(" ")], - }, - while_token: WHILE_KW@112..117 "while" [] [], - l_paren_token: L_PAREN@117..118 "(" [] [], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@118..120 "a" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@120..122 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@122..123 "5" [] [], - }, - }, - r_paren_token: R_PAREN@123..124 ")" [] [], - semicolon_token: missing (optional), - }, - while_token: WHILE_KW@124..131 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@131..132 "(" [] [], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@132..134 "a" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@134..136 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@136..139 "100" [] [], - }, - }, - r_paren_token: R_PAREN@139..140 ")" [] [], - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@140..141 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..141 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..140 - 0: JS_DO_WHILE_STATEMENT@0..35 - 0: DO_KW@0..3 "do" [] [Whitespace(" ")] - 1: JS_EXPRESSION_STATEMENT@3..24 - 0: JS_CALL_EXPRESSION@3..22 - 0: JS_STATIC_MEMBER_EXPRESSION@3..14 - 0: JS_IDENTIFIER_EXPRESSION@3..10 - 0: JS_REFERENCE_IDENTIFIER@3..10 - 0: IDENT@3..10 "console" [] [] - 1: DOT@10..11 "." [] [] - 2: JS_NAME@11..14 - 0: IDENT@11..14 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@14..22 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@15..21 - 0: JS_STRING_LITERAL_EXPRESSION@15..21 - 0: JS_STRING_LITERAL@15..21 "\"test\"" [] [] - 2: R_PAREN@21..22 ")" [] [] - 1: SEMICOLON@22..24 ";" [] [Whitespace(" ")] - 2: WHILE_KW@24..29 "while" [] [] - 3: L_PAREN@29..30 "(" [] [] - 4: JS_BOOLEAN_LITERAL_EXPRESSION@30..34 - 0: TRUE_KW@30..34 "true" [] [] - 5: R_PAREN@34..35 ")" [] [] - 6: (empty) - 1: JS_DO_WHILE_STATEMENT@35..78 - 0: DO_KW@35..39 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@39..65 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_STATEMENT_LIST@40..62 - 0: JS_EXPRESSION_STATEMENT@40..62 - 0: JS_CALL_EXPRESSION@40..62 - 0: JS_STATIC_MEMBER_EXPRESSION@40..54 - 0: JS_IDENTIFIER_EXPRESSION@40..50 - 0: JS_REFERENCE_IDENTIFIER@40..50 - 0: IDENT@40..50 "console" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@50..51 "." [] [] - 2: JS_NAME@51..54 - 0: IDENT@51..54 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@54..62 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@55..61 - 0: JS_STRING_LITERAL_EXPRESSION@55..61 - 0: JS_STRING_LITERAL@55..61 "\"test\"" [] [] - 2: R_PAREN@61..62 ")" [] [] - 1: (empty) - 2: R_CURLY@62..65 "}" [Newline("\n")] [Whitespace(" ")] - 2: WHILE_KW@65..71 "while" [] [Whitespace(" ")] - 3: L_PAREN@71..72 "(" [] [] - 4: JS_BOOLEAN_LITERAL_EXPRESSION@72..76 - 0: TRUE_KW@72..76 "true" [] [] - 5: R_PAREN@76..77 ")" [] [] - 6: SEMICOLON@77..78 ";" [] [] - 2: JS_VARIABLE_STATEMENT@78..89 - 0: JS_VARIABLE_DECLARATION@78..88 - 0: (empty) - 1: LET_KW@78..83 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@83..88 - 0: JS_VARIABLE_DECLARATOR@83..88 - 0: JS_IDENTIFIER_BINDING@83..85 - 0: IDENT@83..85 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@85..88 - 0: EQ@85..87 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@87..88 - 0: JS_NUMBER_LITERAL@87..88 "1" [] [] - 1: SEMICOLON@88..89 ";" [] [] - 3: JS_DO_WHILE_STATEMENT@89..140 - 0: DO_KW@89..92 "do" [Newline("\n")] [] - 1: JS_DO_WHILE_STATEMENT@92..124 - 0: DO_KW@92..96 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@96..112 - 0: L_CURLY@96..97 "{" [] [] - 1: JS_STATEMENT_LIST@97..109 - 0: JS_EXPRESSION_STATEMENT@97..109 - 0: JS_ASSIGNMENT_EXPRESSION@97..109 - 0: JS_IDENTIFIER_ASSIGNMENT@97..102 - 0: IDENT@97..102 "a" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: EQ@102..104 "=" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@104..109 - 0: JS_IDENTIFIER_EXPRESSION@104..106 - 0: JS_REFERENCE_IDENTIFIER@104..106 - 0: IDENT@104..106 "a" [] [Whitespace(" ")] - 1: PLUS@106..108 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@108..109 - 0: JS_NUMBER_LITERAL@108..109 "1" [] [] - 1: (empty) - 2: R_CURLY@109..112 "}" [Newline("\n")] [Whitespace(" ")] - 2: WHILE_KW@112..117 "while" [] [] - 3: L_PAREN@117..118 "(" [] [] - 4: JS_BINARY_EXPRESSION@118..123 - 0: JS_IDENTIFIER_EXPRESSION@118..120 - 0: JS_REFERENCE_IDENTIFIER@118..120 - 0: IDENT@118..120 "a" [] [Whitespace(" ")] - 1: L_ANGLE@120..122 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@122..123 - 0: JS_NUMBER_LITERAL@122..123 "5" [] [] - 5: R_PAREN@123..124 ")" [] [] - 6: (empty) - 2: WHILE_KW@124..131 "while" [Newline("\n")] [Whitespace(" ")] - 3: L_PAREN@131..132 "(" [] [] - 4: JS_BINARY_EXPRESSION@132..139 - 0: JS_IDENTIFIER_EXPRESSION@132..134 - 0: JS_REFERENCE_IDENTIFIER@132..134 - 0: IDENT@132..134 "a" [] [Whitespace(" ")] - 1: L_ANGLE@134..136 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@136..139 - 0: JS_NUMBER_LITERAL@136..139 "100" [] [] - 5: R_PAREN@139..140 ")" [] [] - 6: (empty) - 4: EOF@140..141 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.rast deleted file mode 100644 index e0524efe6abf..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.rast +++ /dev/null @@ -1,144 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsDoWhileStatement { - do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@3..5 "{" [] [Whitespace(" ")], - statements: JsStatementList [], - r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@7..13 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@13..14 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@14..18 "true" [] [], - }, - r_paren_token: R_PAREN@18..19 ")" [] [], - semicolon_token: missing (optional), - }, - JsDoWhileStatement { - do_token: DO_KW@19..23 "do" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@23..25 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsThrowStatement { - throw_token: THROW_KW@25..31 "throw" [] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..36 "Error" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@36..37 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@37..42 "\"foo\"" [] [], - }, - ], - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@44..46 "}" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@46..52 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@52..53 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@53..57 "true" [] [], - }, - r_paren_token: R_PAREN@57..58 ")" [] [], - semicolon_token: missing (optional), - }, - JsDoWhileStatement { - do_token: DO_KW@58..62 "do" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@62..64 "{" [] [Whitespace(" ")], - statements: JsStatementList [ - JsBreakStatement { - break_token: BREAK_KW@64..69 "break" [] [], - label: missing (optional), - semicolon_token: SEMICOLON@69..71 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], - }, - while_token: WHILE_KW@73..79 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@79..80 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@80..84 "true" [] [], - }, - r_paren_token: R_PAREN@84..85 ")" [] [], - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@85..86 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..86 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..85 - 0: JS_DO_WHILE_STATEMENT@0..19 - 0: DO_KW@0..3 "do" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@3..7 - 0: L_CURLY@3..5 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@5..5 - 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] - 2: WHILE_KW@7..13 "while" [] [Whitespace(" ")] - 3: L_PAREN@13..14 "(" [] [] - 4: JS_BOOLEAN_LITERAL_EXPRESSION@14..18 - 0: TRUE_KW@14..18 "true" [] [] - 5: R_PAREN@18..19 ")" [] [] - 6: (empty) - 1: JS_DO_WHILE_STATEMENT@19..58 - 0: DO_KW@19..23 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@23..46 - 0: L_CURLY@23..25 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@25..44 - 0: JS_THROW_STATEMENT@25..44 - 0: THROW_KW@25..31 "throw" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@31..44 - 0: JS_IDENTIFIER_EXPRESSION@31..36 - 0: JS_REFERENCE_IDENTIFIER@31..36 - 0: IDENT@31..36 "Error" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@36..44 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@37..42 - 0: JS_STRING_LITERAL_EXPRESSION@37..42 - 0: JS_STRING_LITERAL@37..42 "\"foo\"" [] [] - 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 2: (empty) - 2: R_CURLY@44..46 "}" [] [Whitespace(" ")] - 2: WHILE_KW@46..52 "while" [] [Whitespace(" ")] - 3: L_PAREN@52..53 "(" [] [] - 4: JS_BOOLEAN_LITERAL_EXPRESSION@53..57 - 0: TRUE_KW@53..57 "true" [] [] - 5: R_PAREN@57..58 ")" [] [] - 6: (empty) - 2: JS_DO_WHILE_STATEMENT@58..85 - 0: DO_KW@58..62 "do" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@62..73 - 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@64..71 - 0: JS_BREAK_STATEMENT@64..71 - 0: BREAK_KW@64..69 "break" [] [] - 1: (empty) - 2: SEMICOLON@69..71 ";" [] [Whitespace(" ")] - 2: R_CURLY@71..73 "}" [] [Whitespace(" ")] - 2: WHILE_KW@73..79 "while" [] [Whitespace(" ")] - 3: L_PAREN@79..80 "(" [] [] - 4: JS_BOOLEAN_LITERAL_EXPRESSION@80..84 - 0: TRUE_KW@80..84 "true" [] [] - 5: R_PAREN@84..85 ")" [] [] - 6: (empty) - 4: EOF@85..86 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/empty_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/empty_stmt.rast deleted file mode 100644 index 34f08109009d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/empty_stmt.rast +++ /dev/null @@ -1,20 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsEmptyStatement { - semicolon_token: SEMICOLON@0..1 ";" [] [], - }, - ], - eof_token: EOF@1..2 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..2 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..1 - 0: JS_EMPTY_STATEMENT@0..1 - 0: SEMICOLON@0..1 ";" [] [] - 4: EOF@1..2 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.rast b/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.rast deleted file mode 100644 index ba4f192e8538..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.rast +++ /dev/null @@ -1,258 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsUnaryExpression { - operator_token: DELETE_KW@1..8 "delete" [] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..9 "a" [] [], - }, - }, - operator_token: DOT@9..10 "." [] [], - member: JsName { - value_token: IDENT@10..11 "b" [] [], - }, - }, - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@13..16 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@16..17 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], - expression: JsUnaryExpression { - operator_token: VOID_KW@20..25 "void" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@25..30 "ident" [] [], - }, - }, - }, - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@32..35 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@35..36 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@37..39 "(" [Newline("\n")] [], - expression: JsUnaryExpression { - operator_token: TYPEOF_KW@39..46 "typeof" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..51 "ident" [] [], - }, - }, - }, - r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@53..56 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@56..57 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@57..58 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@58..60 "(" [Newline("\n")] [], - expression: JsUnaryExpression { - operator_token: MINUS@60..61 "-" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@61..62 "3" [] [], - }, - }, - r_paren_token: R_PAREN@62..64 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@64..67 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@67..68 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@68..69 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@69..71 "(" [Newline("\n")] [], - expression: JsUnaryExpression { - operator_token: PLUS@71..72 "+" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@72..73 "3" [] [], - }, - }, - r_paren_token: R_PAREN@73..75 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@75..78 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@78..79 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@79..80 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@80..82 "(" [Newline("\n")] [], - expression: JsUnaryExpression { - operator_token: TILDE@82..83 "~" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@83..84 "3" [] [], - }, - }, - r_paren_token: R_PAREN@84..86 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@86..89 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@89..90 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@90..91 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@91..93 "(" [Newline("\n")] [], - expression: JsUnaryExpression { - operator_token: BANG@93..94 "!" [] [], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@94..98 "true" [] [], - }, - }, - r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], - }, - operator_token: STAR2@100..103 "**" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@103..104 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@104..105 ";" [] [], - }, - ], - eof_token: EOF@105..106 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..106 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..105 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JS_BINARY_EXPRESSION@0..17 - 0: JS_PARENTHESIZED_EXPRESSION@0..13 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_UNARY_EXPRESSION@1..11 - 0: DELETE_KW@1..8 "delete" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@8..11 - 0: JS_IDENTIFIER_EXPRESSION@8..9 - 0: JS_REFERENCE_IDENTIFIER@8..9 - 0: IDENT@8..9 "a" [] [] - 1: DOT@9..10 "." [] [] - 2: JS_NAME@10..11 - 0: IDENT@10..11 "b" [] [] - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 1: STAR2@13..16 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@16..17 - 0: JS_NUMBER_LITERAL@16..17 "2" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@18..37 - 0: JS_BINARY_EXPRESSION@18..36 - 0: JS_PARENTHESIZED_EXPRESSION@18..32 - 0: L_PAREN@18..20 "(" [Newline("\n")] [] - 1: JS_UNARY_EXPRESSION@20..30 - 0: VOID_KW@20..25 "void" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@25..30 - 0: JS_REFERENCE_IDENTIFIER@25..30 - 0: IDENT@25..30 "ident" [] [] - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 1: STAR2@32..35 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@35..36 - 0: JS_NUMBER_LITERAL@35..36 "2" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@37..58 - 0: JS_BINARY_EXPRESSION@37..57 - 0: JS_PARENTHESIZED_EXPRESSION@37..53 - 0: L_PAREN@37..39 "(" [Newline("\n")] [] - 1: JS_UNARY_EXPRESSION@39..51 - 0: TYPEOF_KW@39..46 "typeof" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@46..51 - 0: JS_REFERENCE_IDENTIFIER@46..51 - 0: IDENT@46..51 "ident" [] [] - 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] - 1: STAR2@53..56 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@56..57 - 0: JS_NUMBER_LITERAL@56..57 "2" [] [] - 1: SEMICOLON@57..58 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@58..69 - 0: JS_BINARY_EXPRESSION@58..68 - 0: JS_PARENTHESIZED_EXPRESSION@58..64 - 0: L_PAREN@58..60 "(" [Newline("\n")] [] - 1: JS_UNARY_EXPRESSION@60..62 - 0: MINUS@60..61 "-" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@61..62 - 0: JS_NUMBER_LITERAL@61..62 "3" [] [] - 2: R_PAREN@62..64 ")" [] [Whitespace(" ")] - 1: STAR2@64..67 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@67..68 - 0: JS_NUMBER_LITERAL@67..68 "2" [] [] - 1: SEMICOLON@68..69 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@69..80 - 0: JS_BINARY_EXPRESSION@69..79 - 0: JS_PARENTHESIZED_EXPRESSION@69..75 - 0: L_PAREN@69..71 "(" [Newline("\n")] [] - 1: JS_UNARY_EXPRESSION@71..73 - 0: PLUS@71..72 "+" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@72..73 - 0: JS_NUMBER_LITERAL@72..73 "3" [] [] - 2: R_PAREN@73..75 ")" [] [Whitespace(" ")] - 1: STAR2@75..78 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@78..79 - 0: JS_NUMBER_LITERAL@78..79 "2" [] [] - 1: SEMICOLON@79..80 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@80..91 - 0: JS_BINARY_EXPRESSION@80..90 - 0: JS_PARENTHESIZED_EXPRESSION@80..86 - 0: L_PAREN@80..82 "(" [Newline("\n")] [] - 1: JS_UNARY_EXPRESSION@82..84 - 0: TILDE@82..83 "~" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@83..84 - 0: JS_NUMBER_LITERAL@83..84 "3" [] [] - 2: R_PAREN@84..86 ")" [] [Whitespace(" ")] - 1: STAR2@86..89 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@89..90 - 0: JS_NUMBER_LITERAL@89..90 "2" [] [] - 1: SEMICOLON@90..91 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@91..105 - 0: JS_BINARY_EXPRESSION@91..104 - 0: JS_PARENTHESIZED_EXPRESSION@91..100 - 0: L_PAREN@91..93 "(" [Newline("\n")] [] - 1: JS_UNARY_EXPRESSION@93..98 - 0: BANG@93..94 "!" [] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@94..98 - 0: TRUE_KW@94..98 "true" [] [] - 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] - 1: STAR2@100..103 "**" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@103..104 - 0: JS_NUMBER_LITERAL@103..104 "2" [] [] - 1: SEMICOLON@104..105 ";" [] [] - 4: EOF@105..106 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.rast deleted file mode 100644 index 0c25006cbb9e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.rast +++ /dev/null @@ -1,84 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@9..12 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@12..13 "}" [] [], - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@14..22 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@22..24 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@24..27 "as" [] [Whitespace(" ")], - }, - as_token: AS_KW@27..30 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@30..33 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_EXPORT@0..14 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@7..14 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..12 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@9..12 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@9..12 - 0: IDENT@9..12 "as" [] [Whitespace(" ")] - 3: R_CURLY@12..13 "}" [] [] - 4: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPORT@14..34 - 0: JS_DECORATOR_LIST@14..14 - 1: EXPORT_KW@14..22 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@22..34 - 0: (empty) - 1: L_CURLY@22..24 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@24..33 - 0: JS_EXPORT_NAMED_SPECIFIER@24..33 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@24..27 - 0: IDENT@24..27 "as" [] [Whitespace(" ")] - 2: AS_KW@27..30 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@30..33 - 0: IDENT@30..33 "as" [] [Whitespace(" ")] - 3: R_CURLY@33..34 "}" [] [] - 4: (empty) - 4: EOF@34..35 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_class_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_class_clause.rast deleted file mode 100644 index afd2d13584ea..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_class_clause.rast +++ /dev/null @@ -1,94 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@7..13 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@13..15 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@15..16 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@17..25 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@25..31 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@31..33 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..43 "B" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@43..44 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@44..45 "}" [] [], - }, - }, - ], - eof_token: EOF@45..46 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..46 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..45 - 0: JS_EXPORT@0..17 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@7..17 - 0: JS_DECORATOR_LIST@7..7 - 1: (empty) - 2: CLASS_KW@7..13 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@13..15 - 0: IDENT@13..15 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@15..16 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@16..16 - 9: R_CURLY@16..17 "}" [] [] - 1: JS_EXPORT@17..45 - 0: JS_DECORATOR_LIST@17..17 - 1: EXPORT_KW@17..25 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@25..45 - 0: JS_DECORATOR_LIST@25..25 - 1: (empty) - 2: CLASS_KW@25..31 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "A" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@33..43 - 0: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@41..43 - 0: JS_REFERENCE_IDENTIFIER@41..43 - 0: IDENT@41..43 "B" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@43..44 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@44..44 - 9: R_CURLY@44..45 "}" [] [] - 4: EOF@45..46 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.rast deleted file mode 100644 index 2e02810fe8f2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.rast +++ /dev/null @@ -1,52 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@15..21 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@21..22 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@22..23 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_EXPORT@0..23 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..23 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@15..23 - 0: JS_DECORATOR_LIST@15..15 - 1: (empty) - 2: CLASS_KW@15..21 "class" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@21..22 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@22..22 - 9: R_CURLY@22..23 "}" [] [] - 2: (empty) - 4: EOF@23..24 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.rast deleted file mode 100644 index a1c6b8c2765b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.rast +++ /dev/null @@ -1,37 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultExpressionClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "a" [] [], - }, - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: JS_EXPORT@0..17 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@7..17 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "a" [] [] - 2: SEMICOLON@16..17 ";" [] [] - 4: EOF@17..18 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.rast deleted file mode 100644 index c26f8a01b55f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.rast +++ /dev/null @@ -1,102 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@24..28 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@29..30 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@32..33 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@35..36 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@37..38 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..38 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..37 - 0: JS_EXPORT@0..37 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..37 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..37 - 0: (empty) - 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@24..28 - 0: IDENT@24..28 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@28..35 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..33 - 0: JS_FORMAL_PARAMETER@29..30 - 0: JS_DECORATOR_LIST@29..29 - 1: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@30..32 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@32..33 - 0: JS_DECORATOR_LIST@32..32 - 1: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@35..37 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_DIRECTIVE_LIST@36..36 - 2: JS_STATEMENT_LIST@36..36 - 3: R_CURLY@36..37 "}" [] [] - 2: (empty) - 4: EOF@37..38 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_from_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_from_clause.rast deleted file mode 100644 index befde8aadaad..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_from_clause.rast +++ /dev/null @@ -1,320 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..8 "{" [] [], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@8..21 "default" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@21..24 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@24..26 "a" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@26..28 "}" [] [Whitespace(" ")], - from_token: FROM_KW@28..33 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@33..36 "\"b\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@37..45 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@47..55 "default" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@55..58 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@58..60 "a" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@60..62 "}" [] [Whitespace(" ")], - from_token: FROM_KW@62..67 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@67..70 "\"b\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@70..71 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@71..79 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: STAR@79..81 "*" [] [Whitespace(" ")], - export_as: missing (optional), - from_token: FROM_KW@81..86 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@86..89 "\"a\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@89..90 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: STAR@98..100 "*" [] [Whitespace(" ")], - export_as: JsExportAsClause { - as_token: AS_KW@100..103 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@103..105 "c" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@105..110 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@110..113 "\"b\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@113..114 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@114..122 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: STAR@122..124 "*" [] [Whitespace(" ")], - export_as: JsExportAsClause { - as_token: AS_KW@124..127 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@127..135 "default" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@135..140 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@140..143 "\"b\"" [] [], - }, - assertion: missing (optional), - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@143..151 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: missing (optional), - star_token: STAR@151..153 "*" [] [Whitespace(" ")], - export_as: missing (optional), - from_token: FROM_KW@153..158 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@158..164 "\"mod\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@164..171 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@171..173 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@173..177 "type" [] [], - colon_token: COLON@177..179 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@179..186 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@186..187 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@187..195 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: TYPE_KW@195..200 "type" [] [Whitespace(" ")], - star_token: STAR@200..202 "*" [] [Whitespace(" ")], - export_as: missing (optional), - from_token: FROM_KW@202..207 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@207..214 "\"types\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@214..215 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@215..223 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportFromClause { - type_token: TYPE_KW@223..228 "type" [] [Whitespace(" ")], - star_token: STAR@228..230 "*" [] [Whitespace(" ")], - export_as: JsExportAsClause { - as_token: AS_KW@230..233 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@233..239 "types" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@239..244 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@244..251 "\"types\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@251..252 ";" [] [], - }, - }, - ], - eof_token: EOF@252..253 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..253 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..252 - 0: JS_EXPORT@0..37 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..37 - 0: (empty) - 1: L_CURLY@7..8 "{" [] [] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@8..26 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@8..26 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@8..21 - 0: IDENT@8..21 "default" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@21..26 - 0: AS_KW@21..24 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@24..26 - 0: IDENT@24..26 "a" [] [Whitespace(" ")] - 3: R_CURLY@26..28 "}" [] [Whitespace(" ")] - 4: FROM_KW@28..33 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@33..36 - 0: JS_STRING_LITERAL@33..36 "\"b\"" [] [] - 6: (empty) - 7: SEMICOLON@36..37 ";" [] [] - 1: JS_EXPORT@37..71 - 0: JS_DECORATOR_LIST@37..37 - 1: EXPORT_KW@37..45 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@45..71 - 0: (empty) - 1: L_CURLY@45..47 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@47..60 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@47..60 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@47..55 - 0: IDENT@47..55 "default" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@55..60 - 0: AS_KW@55..58 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@58..60 - 0: IDENT@58..60 "a" [] [Whitespace(" ")] - 3: R_CURLY@60..62 "}" [] [Whitespace(" ")] - 4: FROM_KW@62..67 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@67..70 - 0: JS_STRING_LITERAL@67..70 "\"b\"" [] [] - 6: (empty) - 7: SEMICOLON@70..71 ";" [] [] - 2: JS_EXPORT@71..90 - 0: JS_DECORATOR_LIST@71..71 - 1: EXPORT_KW@71..79 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@79..90 - 0: (empty) - 1: STAR@79..81 "*" [] [Whitespace(" ")] - 2: (empty) - 3: FROM_KW@81..86 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@86..89 - 0: JS_STRING_LITERAL@86..89 "\"a\"" [] [] - 5: (empty) - 6: SEMICOLON@89..90 ";" [] [] - 3: JS_EXPORT@90..114 - 0: JS_DECORATOR_LIST@90..90 - 1: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@98..114 - 0: (empty) - 1: STAR@98..100 "*" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@100..105 - 0: AS_KW@100..103 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@103..105 - 0: IDENT@103..105 "c" [] [Whitespace(" ")] - 3: FROM_KW@105..110 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@110..113 - 0: JS_STRING_LITERAL@110..113 "\"b\"" [] [] - 5: (empty) - 6: SEMICOLON@113..114 ";" [] [] - 4: JS_EXPORT@114..143 - 0: JS_DECORATOR_LIST@114..114 - 1: EXPORT_KW@114..122 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@122..143 - 0: (empty) - 1: STAR@122..124 "*" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@124..135 - 0: AS_KW@124..127 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@127..135 - 0: IDENT@127..135 "default" [] [Whitespace(" ")] - 3: FROM_KW@135..140 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@140..143 - 0: JS_STRING_LITERAL@140..143 "\"b\"" [] [] - 5: (empty) - 6: (empty) - 5: JS_EXPORT@143..187 - 0: JS_DECORATOR_LIST@143..143 - 1: EXPORT_KW@143..151 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@151..187 - 0: (empty) - 1: STAR@151..153 "*" [] [Whitespace(" ")] - 2: (empty) - 3: FROM_KW@153..158 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@158..164 - 0: JS_STRING_LITERAL@158..164 "\"mod\"" [] [Whitespace(" ")] - 5: JS_IMPORT_ASSERTION@164..187 - 0: ASSERT_KW@164..171 "assert" [] [Whitespace(" ")] - 1: L_CURLY@171..173 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@173..186 - 0: JS_IMPORT_ASSERTION_ENTRY@173..186 - 0: IDENT@173..177 "type" [] [] - 1: COLON@177..179 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@179..186 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@186..187 "}" [] [] - 6: (empty) - 6: JS_EXPORT@187..215 - 0: JS_DECORATOR_LIST@187..187 - 1: EXPORT_KW@187..195 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@195..215 - 0: TYPE_KW@195..200 "type" [] [Whitespace(" ")] - 1: STAR@200..202 "*" [] [Whitespace(" ")] - 2: (empty) - 3: FROM_KW@202..207 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@207..214 - 0: JS_STRING_LITERAL@207..214 "\"types\"" [] [] - 5: (empty) - 6: SEMICOLON@214..215 ";" [] [] - 7: JS_EXPORT@215..252 - 0: JS_DECORATOR_LIST@215..215 - 1: EXPORT_KW@215..223 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_FROM_CLAUSE@223..252 - 0: TYPE_KW@223..228 "type" [] [Whitespace(" ")] - 1: STAR@228..230 "*" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@230..239 - 0: AS_KW@230..233 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@233..239 - 0: IDENT@233..239 "types" [] [Whitespace(" ")] - 3: FROM_KW@239..244 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@244..251 - 0: JS_STRING_LITERAL@244..251 "\"types\"" [] [] - 5: (empty) - 6: SEMICOLON@251..252 ";" [] [] - 4: EOF@252..253 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_function_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_function_clause.rast deleted file mode 100644 index 7e204a47cab1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_function_clause.rast +++ /dev/null @@ -1,257 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@16..20 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@21..22 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..25 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@27..28 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@37..45 "function" [] [], - star_token: STAR@45..47 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@47..52 "test2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@52..53 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@53..54 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@54..56 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@56..57 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@59..60 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsFunctionDeclaration { - async_token: ASYNC_KW@69..75 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@84..89 "test3" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@89..90 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@90..91 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@91..93 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@93..94 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@94..96 "," [] [Whitespace(" ")], - ], - r_paren_token: R_PAREN@96..98 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@98..99 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@99..100 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@100..101 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..101 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..100 - 0: JS_EXPORT@0..29 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@7..29 - 0: (empty) - 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@16..20 - 0: IDENT@16..20 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@20..27 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..25 - 0: JS_FORMAL_PARAMETER@21..22 - 0: JS_DECORATOR_LIST@21..21 - 1: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@24..25 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@27..29 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..28 - 3: R_CURLY@28..29 "}" [] [] - 1: JS_EXPORT@29..61 - 0: JS_DECORATOR_LIST@29..29 - 1: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@37..61 - 0: (empty) - 1: FUNCTION_KW@37..45 "function" [] [] - 2: STAR@45..47 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@47..52 - 0: IDENT@47..52 "test2" [] [] - 4: (empty) - 5: JS_PARAMETERS@52..59 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_PARAMETER_LIST@53..57 - 0: JS_FORMAL_PARAMETER@53..54 - 0: JS_DECORATOR_LIST@53..53 - 1: JS_IDENTIFIER_BINDING@53..54 - 0: IDENT@53..54 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@54..56 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@56..57 - 0: JS_DECORATOR_LIST@56..56 - 1: JS_IDENTIFIER_BINDING@56..57 - 0: IDENT@56..57 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@59..61 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_DIRECTIVE_LIST@60..60 - 2: JS_STATEMENT_LIST@60..60 - 3: R_CURLY@60..61 "}" [] [] - 2: JS_EXPORT@61..100 - 0: JS_DECORATOR_LIST@61..61 - 1: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@69..100 - 0: ASYNC_KW@69..75 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@84..89 - 0: IDENT@84..89 "test3" [] [] - 4: (empty) - 5: JS_PARAMETERS@89..98 - 0: L_PAREN@89..90 "(" [] [] - 1: JS_PARAMETER_LIST@90..96 - 0: JS_FORMAL_PARAMETER@90..91 - 0: JS_DECORATOR_LIST@90..90 - 1: JS_IDENTIFIER_BINDING@90..91 - 0: IDENT@90..91 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@91..93 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@93..94 - 0: JS_DECORATOR_LIST@93..93 - 1: JS_IDENTIFIER_BINDING@93..94 - 0: IDENT@93..94 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@94..96 "," [] [Whitespace(" ")] - 2: R_PAREN@96..98 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@98..100 - 0: L_CURLY@98..99 "{" [] [] - 1: JS_DIRECTIVE_LIST@99..99 - 2: JS_STATEMENT_LIST@99..99 - 3: R_CURLY@99..100 "}" [] [] - 4: EOF@100..101 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_named_clause.rast deleted file mode 100644 index 91f6477d5a2d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_named_clause.rast +++ /dev/null @@ -1,153 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@9..11 "a" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@11..12 "}" [] [], - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@23..25 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@25..28 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@28..29 "z" [] [], - }, - }, - COMMA@29..31 "," [] [Whitespace(" ")], - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@31..33 "b" [] [Whitespace(" ")], - }, - as_token: AS_KW@33..36 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: JS_STRING_LITERAL@36..39 "\"y\"" [] [], - }, - }, - COMMA@39..41 "," [] [Whitespace(" ")], - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@41..43 "c" [] [Whitespace(" ")], - }, - as_token: AS_KW@43..46 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@46..54 "default" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@54..55 "}" [] [], - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@55..63 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@63..65 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@65..68 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@68..69 "}" [] [], - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - }, - ], - eof_token: EOF@70..71 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..71 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..70 - 0: JS_EXPORT@0..13 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@7..13 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..11 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@9..11 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@9..11 - 0: IDENT@9..11 "a" [] [Whitespace(" ")] - 3: R_CURLY@11..12 "}" [] [] - 4: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPORT@13..55 - 0: JS_DECORATOR_LIST@13..13 - 1: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@21..55 - 0: (empty) - 1: L_CURLY@21..23 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@23..54 - 0: JS_EXPORT_NAMED_SPECIFIER@23..29 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@23..25 - 0: IDENT@23..25 "a" [] [Whitespace(" ")] - 2: AS_KW@25..28 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@28..29 - 0: IDENT@28..29 "z" [] [] - 1: COMMA@29..31 "," [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER@31..39 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@31..33 - 0: IDENT@31..33 "b" [] [Whitespace(" ")] - 2: AS_KW@33..36 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@36..39 - 0: JS_STRING_LITERAL@36..39 "\"y\"" [] [] - 3: COMMA@39..41 "," [] [Whitespace(" ")] - 4: JS_EXPORT_NAMED_SPECIFIER@41..54 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@41..43 - 0: IDENT@41..43 "c" [] [Whitespace(" ")] - 2: AS_KW@43..46 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@46..54 - 0: IDENT@46..54 "default" [] [Whitespace(" ")] - 3: R_CURLY@54..55 "}" [] [] - 4: (empty) - 2: JS_EXPORT@55..70 - 0: JS_DECORATOR_LIST@55..55 - 1: EXPORT_KW@55..63 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@63..70 - 0: (empty) - 1: L_CURLY@63..65 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@65..68 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@65..68 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@65..68 - 0: IDENT@65..68 "as" [] [Whitespace(" ")] - 3: R_CURLY@68..69 "}" [] [] - 4: SEMICOLON@69..70 ";" [] [] - 4: EOF@70..71 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.rast deleted file mode 100644 index 531f700a45a9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.rast +++ /dev/null @@ -1,452 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@9..10 "a" [] [], - }, - export_as: missing (optional), - }, - COMMA@10..12 "," [] [Whitespace(" ")], - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@12..20 "default" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@20..22 "}" [] [Whitespace(" ")], - from_token: FROM_KW@22..27 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@27..32 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@43..45 "a" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@45..48 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@48..49 "z" [] [], - }, - }, - }, - COMMA@49..51 "," [] [Whitespace(" ")], - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@51..53 "b" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@53..56 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: JS_STRING_LITERAL@56..59 "\"y\"" [] [], - }, - }, - }, - COMMA@59..61 "," [] [Whitespace(" ")], - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@61..63 "c" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@63..66 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@66..74 "default" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@74..76 "}" [] [Whitespace(" ")], - from_token: FROM_KW@76..81 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@81..86 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@94..96 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@96..99 "as" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@99..101 "}" [] [Whitespace(" ")], - from_token: FROM_KW@101..106 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@106..111 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@112..120 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@120..122 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@122..130 "default" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@130..133 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: JS_STRING_LITERAL@133..137 "\"b\"" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@137..139 "}" [] [Whitespace(" ")], - from_token: FROM_KW@139..144 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@144..149 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@149..150 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@150..158 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@158..160 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: JS_STRING_LITERAL@160..164 "\"a\"" [] [Whitespace(" ")], - }, - export_as: JsExportAsClause { - as_token: AS_KW@164..167 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@167..169 "b" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@169..171 "}" [] [Whitespace(" ")], - from_token: FROM_KW@171..176 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@176..181 "\"mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@181..182 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@182..190 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@190..192 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@192..194 "a" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@194..196 "}" [] [Whitespace(" ")], - from_token: FROM_KW@196..201 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@201..207 "\"mod\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@207..214 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@214..216 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@216..220 "type" [] [], - colon_token: COLON@220..222 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@222..229 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@229..230 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@230..238 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@238..240 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: JS_STRING_LITERAL@240..244 "\"a\"" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@244..246 "}" [] [Whitespace(" ")], - from_token: FROM_KW@246..251 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@251..258 "\"./mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@258..259 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@259..267 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@267..268 "{" [] [], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: JS_STRING_LITERAL@268..277 "\"a\"" [Newline("\n"), Whitespace(" ")] [], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@277..280 "}" [Newline("\n")] [Whitespace(" ")], - from_token: FROM_KW@280..285 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@285..292 "\"./mod\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@292..293 ";" [] [], - }, - }, - ], - eof_token: EOF@293..294 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..294 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..293 - 0: JS_EXPORT@0..33 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..33 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@9..20 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@9..10 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@9..10 - 0: IDENT@9..10 "a" [] [] - 2: (empty) - 1: COMMA@10..12 "," [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER@12..20 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@12..20 - 0: IDENT@12..20 "default" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@20..22 "}" [] [Whitespace(" ")] - 4: FROM_KW@22..27 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@27..32 - 0: JS_STRING_LITERAL@27..32 "\"mod\"" [] [] - 6: (empty) - 7: SEMICOLON@32..33 ";" [] [] - 1: JS_EXPORT@33..86 - 0: JS_DECORATOR_LIST@33..33 - 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@41..86 - 0: (empty) - 1: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@43..74 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@43..49 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@43..45 - 0: IDENT@43..45 "a" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@45..49 - 0: AS_KW@45..48 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@48..49 - 0: IDENT@48..49 "z" [] [] - 1: COMMA@49..51 "," [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER@51..59 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@51..53 - 0: IDENT@51..53 "b" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@53..59 - 0: AS_KW@53..56 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@56..59 - 0: JS_STRING_LITERAL@56..59 "\"y\"" [] [] - 3: COMMA@59..61 "," [] [Whitespace(" ")] - 4: JS_EXPORT_NAMED_FROM_SPECIFIER@61..74 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@61..63 - 0: IDENT@61..63 "c" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@63..74 - 0: AS_KW@63..66 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@66..74 - 0: IDENT@66..74 "default" [] [Whitespace(" ")] - 3: R_CURLY@74..76 "}" [] [Whitespace(" ")] - 4: FROM_KW@76..81 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@81..86 - 0: JS_STRING_LITERAL@81..86 "\"mod\"" [] [] - 6: (empty) - 7: (empty) - 2: JS_EXPORT@86..112 - 0: JS_DECORATOR_LIST@86..86 - 1: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@94..112 - 0: (empty) - 1: L_CURLY@94..96 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@96..99 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@96..99 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@96..99 - 0: IDENT@96..99 "as" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@99..101 "}" [] [Whitespace(" ")] - 4: FROM_KW@101..106 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@106..111 - 0: JS_STRING_LITERAL@106..111 "\"mod\"" [] [] - 6: (empty) - 7: SEMICOLON@111..112 ";" [] [] - 3: JS_EXPORT@112..150 - 0: JS_DECORATOR_LIST@112..112 - 1: EXPORT_KW@112..120 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@120..150 - 0: (empty) - 1: L_CURLY@120..122 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@122..137 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@122..137 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@122..130 - 0: IDENT@122..130 "default" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@130..137 - 0: AS_KW@130..133 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@133..137 - 0: JS_STRING_LITERAL@133..137 "\"b\"" [] [Whitespace(" ")] - 3: R_CURLY@137..139 "}" [] [Whitespace(" ")] - 4: FROM_KW@139..144 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@144..149 - 0: JS_STRING_LITERAL@144..149 "\"mod\"" [] [] - 6: (empty) - 7: SEMICOLON@149..150 ";" [] [] - 4: JS_EXPORT@150..182 - 0: JS_DECORATOR_LIST@150..150 - 1: EXPORT_KW@150..158 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@158..182 - 0: (empty) - 1: L_CURLY@158..160 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@160..169 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@160..169 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@160..164 - 0: JS_STRING_LITERAL@160..164 "\"a\"" [] [Whitespace(" ")] - 2: JS_EXPORT_AS_CLAUSE@164..169 - 0: AS_KW@164..167 "as" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@167..169 - 0: IDENT@167..169 "b" [] [Whitespace(" ")] - 3: R_CURLY@169..171 "}" [] [Whitespace(" ")] - 4: FROM_KW@171..176 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@176..181 - 0: JS_STRING_LITERAL@176..181 "\"mod\"" [] [] - 6: (empty) - 7: SEMICOLON@181..182 ";" [] [] - 5: JS_EXPORT@182..230 - 0: JS_DECORATOR_LIST@182..182 - 1: EXPORT_KW@182..190 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@190..230 - 0: (empty) - 1: L_CURLY@190..192 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@192..194 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@192..194 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@192..194 - 0: IDENT@192..194 "a" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@194..196 "}" [] [Whitespace(" ")] - 4: FROM_KW@196..201 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@201..207 - 0: JS_STRING_LITERAL@201..207 "\"mod\"" [] [Whitespace(" ")] - 6: JS_IMPORT_ASSERTION@207..230 - 0: ASSERT_KW@207..214 "assert" [] [Whitespace(" ")] - 1: L_CURLY@214..216 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@216..229 - 0: JS_IMPORT_ASSERTION_ENTRY@216..229 - 0: IDENT@216..220 "type" [] [] - 1: COLON@220..222 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@222..229 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@229..230 "}" [] [] - 7: (empty) - 6: JS_EXPORT@230..259 - 0: JS_DECORATOR_LIST@230..230 - 1: EXPORT_KW@230..238 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@238..259 - 0: (empty) - 1: L_CURLY@238..240 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@240..244 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@240..244 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@240..244 - 0: JS_STRING_LITERAL@240..244 "\"a\"" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@244..246 "}" [] [Whitespace(" ")] - 4: FROM_KW@246..251 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@251..258 - 0: JS_STRING_LITERAL@251..258 "\"./mod\"" [] [] - 6: (empty) - 7: SEMICOLON@258..259 ";" [] [] - 7: JS_EXPORT@259..293 - 0: JS_DECORATOR_LIST@259..259 - 1: EXPORT_KW@259..267 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@267..293 - 0: (empty) - 1: L_CURLY@267..268 "{" [] [] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@268..277 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@268..277 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@268..277 - 0: JS_STRING_LITERAL@268..277 "\"a\"" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: R_CURLY@277..280 "}" [Newline("\n")] [Whitespace(" ")] - 4: FROM_KW@280..285 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@285..292 - 0: JS_STRING_LITERAL@285..292 "\"./mod\"" [] [] - 6: (empty) - 7: SEMICOLON@292..293 ";" [] [] - 4: EOF@293..294 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.rast b/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.rast deleted file mode 100644 index 9d0d28dbaf78..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.rast +++ /dev/null @@ -1,161 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@7..11 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@11..12 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@21..27 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@27..29 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@29..31 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@31..32 "3" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@41..45 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@45..46 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@46..48 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@48..49 "d" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@49..51 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@51..53 "e" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@53..55 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@55..56 "3" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@56..57 ";" [] [], - }, - }, - ], - eof_token: EOF@57..58 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..58 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..57 - 0: JS_EXPORT@0..13 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@7..13 - 0: JS_VARIABLE_DECLARATION@7..12 - 0: (empty) - 1: LET_KW@7..11 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@11..12 - 0: JS_VARIABLE_DECLARATOR@11..12 - 0: JS_IDENTIFIER_BINDING@11..12 - 0: IDENT@11..12 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPORT@13..33 - 0: JS_DECORATOR_LIST@13..13 - 1: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@21..33 - 0: JS_VARIABLE_DECLARATION@21..32 - 0: (empty) - 1: CONST_KW@21..27 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@27..32 - 0: JS_VARIABLE_DECLARATOR@27..32 - 0: JS_IDENTIFIER_BINDING@27..29 - 0: IDENT@27..29 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@29..32 - 0: EQ@29..31 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@31..32 - 0: JS_NUMBER_LITERAL@31..32 "3" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPORT@33..57 - 0: JS_DECORATOR_LIST@33..33 - 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATION_CLAUSE@41..57 - 0: JS_VARIABLE_DECLARATION@41..56 - 0: (empty) - 1: VAR_KW@41..45 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@45..56 - 0: JS_VARIABLE_DECLARATOR@45..46 - 0: JS_IDENTIFIER_BINDING@45..46 - 0: IDENT@45..46 "c" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@46..48 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@48..49 - 0: JS_IDENTIFIER_BINDING@48..49 - 0: IDENT@48..49 "d" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@49..51 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@51..56 - 0: JS_IDENTIFIER_BINDING@51..53 - 0: IDENT@51..53 "e" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@53..56 - 0: EQ@53..55 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@55..56 - 0: JS_NUMBER_LITERAL@55..56 "3" [] [] - 1: SEMICOLON@56..57 ";" [] [] - 4: EOF@57..58 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.rast deleted file mode 100644 index 1d664db1b197..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.rast +++ /dev/null @@ -1,119 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..9 "async" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@10..17 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@26..28 "fn" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@31..32 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsForOfStatement { - for_token: FOR_KW@32..39 "for" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - await_token: AWAIT_KW@39..45 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@45..46 "(" [] [], - initializer: JsIdentifierAssignment { - name_token: IDENT@46..52 "async" [] [Whitespace(" ")], - }, - of_token: OF_KW@52..55 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@55..56 "[" [] [], - elements: JsArrayElementList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@56..57 "7" [] [], - }, - ], - r_brack_token: R_BRACK@57..58 "]" [] [], - }, - r_paren_token: R_PAREN@58..59 ")" [] [], - body: JsEmptyStatement { - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - }, - ], - r_curly_token: R_CURLY@60..62 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@62..63 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..63 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..62 - 0: JS_VARIABLE_STATEMENT@0..10 - 0: JS_VARIABLE_DECLARATION@0..9 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..9 - 0: JS_VARIABLE_DECLARATOR@4..9 - 0: JS_IDENTIFIER_BINDING@4..9 - 0: IDENT@4..9 "async" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_FUNCTION_DECLARATION@10..62 - 0: ASYNC_KW@10..17 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "fn" [] [] - 4: (empty) - 5: JS_PARAMETERS@28..31 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..29 - 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@31..62 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_DIRECTIVE_LIST@32..32 - 2: JS_STATEMENT_LIST@32..60 - 0: JS_FOR_OF_STATEMENT@32..60 - 0: FOR_KW@32..39 "for" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: AWAIT_KW@39..45 "await" [] [Whitespace(" ")] - 2: L_PAREN@45..46 "(" [] [] - 3: JS_IDENTIFIER_ASSIGNMENT@46..52 - 0: IDENT@46..52 "async" [] [Whitespace(" ")] - 4: OF_KW@52..55 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@55..58 - 0: L_BRACK@55..56 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@56..57 - 0: JS_NUMBER_LITERAL_EXPRESSION@56..57 - 0: JS_NUMBER_LITERAL@56..57 "7" [] [] - 2: R_BRACK@57..58 "]" [] [] - 6: R_PAREN@58..59 ")" [] [] - 7: JS_EMPTY_STATEMENT@59..60 - 0: SEMICOLON@59..60 ";" [] [] - 3: R_CURLY@60..62 "}" [Newline("\n")] [] - 4: EOF@62..63 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast b/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast deleted file mode 100644 index ff8a3e9da69a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast +++ /dev/null @@ -1,71 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsForInStatement { - for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@14..15 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: VAR_KW@15..19 "var" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@19..21 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@21..23 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")], - }, - }, - }, - }, - in_token: IN_KW@25..28 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@28..29 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@29..30 "]" [] [], - }, - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@32..33 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..34 - 0: JS_FOR_IN_STATEMENT@0..34 - 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@14..15 "(" [] [] - 2: JS_FOR_VARIABLE_DECLARATION@15..25 - 0: (empty) - 1: VAR_KW@15..19 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@19..25 - 0: JS_IDENTIFIER_BINDING@19..21 - 0: IDENT@19..21 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@21..25 - 0: EQ@21..23 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@23..25 - 0: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")] - 3: IN_KW@25..28 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@28..30 - 0: L_BRACK@28..29 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@29..29 - 2: R_BRACK@29..30 "]" [] [] - 5: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@32..34 - 0: L_CURLY@32..33 "{" [] [] - 1: JS_STATEMENT_LIST@33..33 - 2: R_CURLY@33..34 "}" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/for_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/for_stmt.rast deleted file mode 100644 index 5b6457cdc726..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/for_stmt.rast +++ /dev/null @@ -1,439 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@5..9 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@9..11 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@11..13 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..14 "5" [] [], - }, - }, - }, - ], - }, - first_semi_token: SEMICOLON@14..16 ";" [] [Whitespace(" ")], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..18 "i" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@18..20 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@20..22 "10" [] [], - }, - }, - second_semi_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], - update: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@24..25 "i" [] [], - }, - operator_token: PLUS2@25..27 "++" [] [], - }, - r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@29..30 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@31..36 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@36..37 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@37..41 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@43..46 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@46..48 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@48..52 "bar" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@52..54 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@54..57 "of" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@57..58 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@58..59 "}" [] [], - }, - r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@61..62 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - }, - JsForInStatement { - for_token: FOR_KW@63..68 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@68..69 "(" [] [], - initializer: JsIdentifierAssignment { - name_token: IDENT@69..73 "foo" [] [Whitespace(" ")], - }, - in_token: IN_KW@73..76 "in" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@76..77 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@77..78 "}" [] [], - }, - r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@80..81 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@81..82 "}" [] [], - }, - }, - JsForStatement { - for_token: FOR_KW@82..87 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@87..88 "(" [] [], - initializer: missing (optional), - first_semi_token: SEMICOLON@88..89 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@89..90 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@90..92 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@92..93 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@93..94 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@94..99 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@99..100 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@100..104 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@104..108 "foo" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@108..111 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@111..112 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@112..113 "]" [] [], - }, - r_paren_token: R_PAREN@113..115 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@115..116 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@116..117 "}" [] [], - }, - }, - JsForStatement { - for_token: FOR_KW@117..122 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@122..123 "(" [] [], - initializer: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@123..127 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@127..129 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@129..131 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@131..132 "5" [] [], - }, - }, - }, - COMMA@132..134 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@134..136 "j" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@136..138 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@138..139 "6" [] [], - }, - }, - }, - ], - }, - first_semi_token: SEMICOLON@139..141 ";" [] [Whitespace(" ")], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@141..143 "i" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@143..145 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@145..146 "j" [] [], - }, - }, - }, - second_semi_token: SEMICOLON@146..148 ";" [] [Whitespace(" ")], - update: JsPreUpdateExpression { - operator_token: PLUS2@148..150 "++" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@150..151 "j" [] [], - }, - }, - r_paren_token: R_PAREN@151..153 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@153..154 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@154..155 "}" [] [], - }, - }, - JsForOfStatement { - for_token: FOR_KW@155..160 "for" [Newline("\n")] [Whitespace(" ")], - await_token: AWAIT_KW@160..166 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@166..167 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: LET_KW@167..171 "let" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@171..173 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@173..176 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@176..177 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@177..178 "]" [] [], - }, - r_paren_token: R_PAREN@178..180 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@180..181 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@181..182 "}" [] [], - }, - }, - ], - eof_token: EOF@182..183 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..183 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..182 - 0: JS_FOR_STATEMENT@0..31 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_VARIABLE_DECLARATION@5..14 - 0: (empty) - 1: LET_KW@5..9 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@9..14 - 0: JS_VARIABLE_DECLARATOR@9..14 - 0: JS_IDENTIFIER_BINDING@9..11 - 0: IDENT@9..11 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@11..14 - 0: EQ@11..13 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@13..14 - 0: JS_NUMBER_LITERAL@13..14 "5" [] [] - 3: SEMICOLON@14..16 ";" [] [Whitespace(" ")] - 4: JS_BINARY_EXPRESSION@16..22 - 0: JS_IDENTIFIER_EXPRESSION@16..18 - 0: JS_REFERENCE_IDENTIFIER@16..18 - 0: IDENT@16..18 "i" [] [Whitespace(" ")] - 1: L_ANGLE@18..20 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@20..22 - 0: JS_NUMBER_LITERAL@20..22 "10" [] [] - 5: SEMICOLON@22..24 ";" [] [Whitespace(" ")] - 6: JS_POST_UPDATE_EXPRESSION@24..27 - 0: JS_IDENTIFIER_ASSIGNMENT@24..25 - 0: IDENT@24..25 "i" [] [] - 1: PLUS2@25..27 "++" [] [] - 7: R_PAREN@27..29 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@29..31 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_STATEMENT_LIST@30..30 - 2: R_CURLY@30..31 "}" [] [] - 1: JS_FOR_OF_STATEMENT@31..63 - 0: FOR_KW@31..36 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@36..37 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@37..54 - 0: (empty) - 1: LET_KW@37..41 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@41..54 - 0: JS_OBJECT_BINDING_PATTERN@41..54 - 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@43..52 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@43..46 - 0: JS_IDENTIFIER_BINDING@43..46 - 0: IDENT@43..46 "foo" [] [] - 1: (empty) - 1: COMMA@46..48 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@48..52 - 0: JS_IDENTIFIER_BINDING@48..52 - 0: IDENT@48..52 "bar" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@52..54 "}" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@54..57 "of" [] [Whitespace(" ")] - 5: JS_OBJECT_EXPRESSION@57..59 - 0: L_CURLY@57..58 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@58..58 - 2: R_CURLY@58..59 "}" [] [] - 6: R_PAREN@59..61 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@61..63 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_STATEMENT_LIST@62..62 - 2: R_CURLY@62..63 "}" [] [] - 2: JS_FOR_IN_STATEMENT@63..82 - 0: FOR_KW@63..68 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@68..69 "(" [] [] - 2: JS_IDENTIFIER_ASSIGNMENT@69..73 - 0: IDENT@69..73 "foo" [] [Whitespace(" ")] - 3: IN_KW@73..76 "in" [] [Whitespace(" ")] - 4: JS_OBJECT_EXPRESSION@76..78 - 0: L_CURLY@76..77 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@77..77 - 2: R_CURLY@77..78 "}" [] [] - 5: R_PAREN@78..80 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@80..82 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_STATEMENT_LIST@81..81 - 2: R_CURLY@81..82 "}" [] [] - 3: JS_FOR_STATEMENT@82..94 - 0: FOR_KW@82..87 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@87..88 "(" [] [] - 2: (empty) - 3: SEMICOLON@88..89 ";" [] [] - 4: (empty) - 5: SEMICOLON@89..90 ";" [] [] - 6: (empty) - 7: R_PAREN@90..92 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@92..94 - 0: L_CURLY@92..93 "{" [] [] - 1: JS_STATEMENT_LIST@93..93 - 2: R_CURLY@93..94 "}" [] [] - 4: JS_FOR_OF_STATEMENT@94..117 - 0: FOR_KW@94..99 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@99..100 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@100..108 - 0: (empty) - 1: LET_KW@100..104 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@104..108 - 0: JS_IDENTIFIER_BINDING@104..108 - 0: IDENT@104..108 "foo" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@108..111 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@111..113 - 0: L_BRACK@111..112 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@112..112 - 2: R_BRACK@112..113 "]" [] [] - 6: R_PAREN@113..115 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@115..117 - 0: L_CURLY@115..116 "{" [] [] - 1: JS_STATEMENT_LIST@116..116 - 2: R_CURLY@116..117 "}" [] [] - 5: JS_FOR_STATEMENT@117..155 - 0: FOR_KW@117..122 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@122..123 "(" [] [] - 2: JS_VARIABLE_DECLARATION@123..139 - 0: (empty) - 1: LET_KW@123..127 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@127..139 - 0: JS_VARIABLE_DECLARATOR@127..132 - 0: JS_IDENTIFIER_BINDING@127..129 - 0: IDENT@127..129 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@129..132 - 0: EQ@129..131 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@131..132 - 0: JS_NUMBER_LITERAL@131..132 "5" [] [] - 1: COMMA@132..134 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@134..139 - 0: JS_IDENTIFIER_BINDING@134..136 - 0: IDENT@134..136 "j" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@136..139 - 0: EQ@136..138 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@138..139 - 0: JS_NUMBER_LITERAL@138..139 "6" [] [] - 3: SEMICOLON@139..141 ";" [] [Whitespace(" ")] - 4: JS_BINARY_EXPRESSION@141..146 - 0: JS_IDENTIFIER_EXPRESSION@141..143 - 0: JS_REFERENCE_IDENTIFIER@141..143 - 0: IDENT@141..143 "i" [] [Whitespace(" ")] - 1: L_ANGLE@143..145 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@145..146 - 0: JS_REFERENCE_IDENTIFIER@145..146 - 0: IDENT@145..146 "j" [] [] - 5: SEMICOLON@146..148 ";" [] [Whitespace(" ")] - 6: JS_PRE_UPDATE_EXPRESSION@148..151 - 0: PLUS2@148..150 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@150..151 - 0: IDENT@150..151 "j" [] [] - 7: R_PAREN@151..153 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@153..155 - 0: L_CURLY@153..154 "{" [] [] - 1: JS_STATEMENT_LIST@154..154 - 2: R_CURLY@154..155 "}" [] [] - 6: JS_FOR_OF_STATEMENT@155..182 - 0: FOR_KW@155..160 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@160..166 "await" [] [Whitespace(" ")] - 2: L_PAREN@166..167 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@167..173 - 0: (empty) - 1: LET_KW@167..171 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@171..173 - 0: JS_IDENTIFIER_BINDING@171..173 - 0: IDENT@171..173 "a" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@173..176 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@176..178 - 0: L_BRACK@176..177 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@177..177 - 2: R_BRACK@177..178 "]" [] [] - 6: R_PAREN@178..180 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@180..182 - 0: L_CURLY@180..181 "{" [] [] - 1: JS_STATEMENT_LIST@181..181 - 2: R_CURLY@181..182 "}" [] [] - 4: EOF@182..183 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.rast b/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.rast deleted file mode 100644 index ff6cf3030c0c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.rast +++ /dev/null @@ -1,73 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..3 "for" [] [], - l_paren_token: L_PAREN@3..4 "(" [] [], - initializer: JsParenthesizedExpression { - l_paren_token: L_PAREN@4..5 "(" [] [], - expression: JsSequenceExpression { - left: JsBooleanLiteralExpression { - value_token: TRUE_KW@5..9 "true" [] [], - }, - comma_token: COMMA@9..10 "," [] [], - right: JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@10..26 "\"selectionStart\"" [] [], - }, - in_token: IN_KW@26..29 "in" [] [Whitespace(" ")], - object: JsBooleanLiteralExpression { - value_token: TRUE_KW@29..33 "true" [] [], - }, - }, - }, - r_paren_token: R_PAREN@33..34 ")" [] [], - }, - first_semi_token: SEMICOLON@34..35 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@35..36 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@36..38 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@38..39 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - }, - ], - eof_token: EOF@40..41 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..41 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..40 - 0: JS_FOR_STATEMENT@0..40 - 0: FOR_KW@0..3 "for" [] [] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_PARENTHESIZED_EXPRESSION@4..34 - 0: L_PAREN@4..5 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@5..33 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@5..9 - 0: TRUE_KW@5..9 "true" [] [] - 1: COMMA@9..10 "," [] [] - 2: JS_IN_EXPRESSION@10..33 - 0: JS_STRING_LITERAL_EXPRESSION@10..26 - 0: JS_STRING_LITERAL@10..26 "\"selectionStart\"" [] [] - 1: IN_KW@26..29 "in" [] [Whitespace(" ")] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@29..33 - 0: TRUE_KW@29..33 "true" [] [] - 2: R_PAREN@33..34 ")" [] [] - 3: SEMICOLON@34..35 ";" [] [] - 4: (empty) - 5: SEMICOLON@35..36 ";" [] [] - 6: (empty) - 7: R_PAREN@36..38 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@38..40 - 0: L_CURLY@38..39 "{" [] [] - 1: JS_STATEMENT_LIST@39..39 - 2: R_CURLY@39..40 "}" [] [] - 4: EOF@40..41 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/function_decl.rast b/crates/biome_js_parser/test_data/inline/ok/function_decl.rast deleted file mode 100644 index 219cbc749011..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/function_decl.rast +++ /dev/null @@ -1,229 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..13 "foo1" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@16..17 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@17..18 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@18..28 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@28..29 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@29..33 "foo2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@33..34 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@36..37 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@38..45 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@45..54 "function" [] [Whitespace(" ")], - star_token: STAR@54..55 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@55..59 "foo3" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@59..60 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@60..62 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@62..63 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@63..64 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@64..71 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@71..80 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@80..84 "foo4" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@84..85 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@85..87 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@87..88 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@88..89 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@89..99 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@99..100 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@100..104 "foo5" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@104..105 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@105..107 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@107..108 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@108..117 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@117..120 "foo" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@120..121 ";" [] [], - }, - ], - r_curly_token: R_CURLY@121..123 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@123..124 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..124 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..123 - 0: JS_FUNCTION_DECLARATION@0..18 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..13 - 0: IDENT@9..13 "foo1" [] [] - 4: (empty) - 5: JS_PARAMETERS@13..16 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..14 - 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@16..18 - 0: L_CURLY@16..17 "{" [] [] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..17 - 3: R_CURLY@17..18 "}" [] [] - 1: JS_FUNCTION_DECLARATION@18..38 - 0: (empty) - 1: FUNCTION_KW@18..28 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@28..29 "*" [] [] - 3: JS_IDENTIFIER_BINDING@29..33 - 0: IDENT@29..33 "foo2" [] [] - 4: (empty) - 5: JS_PARAMETERS@33..36 - 0: L_PAREN@33..34 "(" [] [] - 1: JS_PARAMETER_LIST@34..34 - 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@36..38 - 0: L_CURLY@36..37 "{" [] [] - 1: JS_DIRECTIVE_LIST@37..37 - 2: JS_STATEMENT_LIST@37..37 - 3: R_CURLY@37..38 "}" [] [] - 2: JS_FUNCTION_DECLARATION@38..64 - 0: ASYNC_KW@38..45 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@45..54 "function" [] [Whitespace(" ")] - 2: STAR@54..55 "*" [] [] - 3: JS_IDENTIFIER_BINDING@55..59 - 0: IDENT@55..59 "foo3" [] [] - 4: (empty) - 5: JS_PARAMETERS@59..62 - 0: L_PAREN@59..60 "(" [] [] - 1: JS_PARAMETER_LIST@60..60 - 2: R_PAREN@60..62 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@62..64 - 0: L_CURLY@62..63 "{" [] [] - 1: JS_DIRECTIVE_LIST@63..63 - 2: JS_STATEMENT_LIST@63..63 - 3: R_CURLY@63..64 "}" [] [] - 3: JS_FUNCTION_DECLARATION@64..89 - 0: ASYNC_KW@64..71 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@71..80 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@80..84 - 0: IDENT@80..84 "foo4" [] [] - 4: (empty) - 5: JS_PARAMETERS@84..87 - 0: L_PAREN@84..85 "(" [] [] - 1: JS_PARAMETER_LIST@85..85 - 2: R_PAREN@85..87 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@87..89 - 0: L_CURLY@87..88 "{" [] [] - 1: JS_DIRECTIVE_LIST@88..88 - 2: JS_STATEMENT_LIST@88..88 - 3: R_CURLY@88..89 "}" [] [] - 4: JS_FUNCTION_DECLARATION@89..123 - 0: (empty) - 1: FUNCTION_KW@89..99 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@99..100 "*" [] [] - 3: JS_IDENTIFIER_BINDING@100..104 - 0: IDENT@100..104 "foo5" [] [] - 4: (empty) - 5: JS_PARAMETERS@104..107 - 0: L_PAREN@104..105 "(" [] [] - 1: JS_PARAMETER_LIST@105..105 - 2: R_PAREN@105..107 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@107..123 - 0: L_CURLY@107..108 "{" [] [] - 1: JS_DIRECTIVE_LIST@108..108 - 2: JS_STATEMENT_LIST@108..121 - 0: JS_EXPRESSION_STATEMENT@108..121 - 0: JS_YIELD_EXPRESSION@108..120 - 0: YIELD_KW@108..117 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@117..120 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@117..120 - 0: JS_REFERENCE_IDENTIFIER@117..120 - 0: IDENT@117..120 "foo" [] [] - 1: SEMICOLON@120..121 ";" [] [] - 3: R_CURLY@121..123 "}" [Newline("\n")] [] - 4: EOF@123..124 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.rast b/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.rast deleted file mode 100644 index 3457fbbc2a36..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.rast +++ /dev/null @@ -1,70 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..23 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..29 "await" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@31..32 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - }, - ], - eof_token: EOF@33..34 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..34 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..33 - 0: JS_FUNCTION_DECLARATION@0..33 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..23 - 0: IDENT@19..23 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@23..31 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..29 - 0: JS_FORMAL_PARAMETER@24..29 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..29 - 0: IDENT@24..29 "await" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@31..33 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_DIRECTIVE_LIST@32..32 - 2: JS_STATEMENT_LIST@32..32 - 3: R_CURLY@32..33 "}" [] [] - 4: EOF@33..34 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expr.rast b/crates/biome_js_parser/test_data/inline/ok/function_expr.rast deleted file mode 100644 index 7ce5077a67d4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/function_expr.rast +++ /dev/null @@ -1,148 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@8..16 "function" [] [], - star_token: missing (optional), - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@16..17 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@19..20 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@26..28 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@39..42 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@42..43 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@45..46 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@46..47 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_VARIABLE_STATEMENT@0..21 - 0: JS_VARIABLE_DECLARATION@0..21 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..21 - 0: JS_VARIABLE_DECLARATOR@4..21 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..21 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@8..21 - 0: (empty) - 1: FUNCTION_KW@8..16 "function" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@16..19 - 0: L_PAREN@16..17 "(" [] [] - 1: JS_PARAMETER_LIST@17..17 - 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@19..21 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_DIRECTIVE_LIST@20..20 - 2: JS_STATEMENT_LIST@20..20 - 3: R_CURLY@20..21 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@21..47 - 0: JS_VARIABLE_DECLARATION@21..47 - 0: (empty) - 1: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@26..47 - 0: JS_VARIABLE_DECLARATOR@26..47 - 0: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@28..47 - 0: EQ@28..30 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@30..47 - 0: (empty) - 1: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@39..42 - 0: IDENT@39..42 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@42..45 - 0: L_PAREN@42..43 "(" [] [] - 1: JS_PARAMETER_LIST@43..43 - 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@45..47 - 0: L_CURLY@45..46 "{" [] [] - 1: JS_DIRECTIVE_LIST@46..46 - 2: JS_STATEMENT_LIST@46..46 - 3: R_CURLY@46..47 "}" [] [] - 1: (empty) - 4: EOF@47..48 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expression_id.rast b/crates/biome_js_parser/test_data/inline/ok/function_expression_id.rast deleted file mode 100644 index f5db64bb13e5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/function_expression_id.rast +++ /dev/null @@ -1,215 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..11 "(" [Comments("// SCRIPT"), Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@11..20 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@20..25 "await" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@25..26 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - r_paren_token: R_PAREN@30..31 ")" [] [], - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@32..34 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@34..43 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@43..48 "yield" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@48..49 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@51..52 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - }, - r_paren_token: R_PAREN@53..54 ")" [] [], - }, - semicolon_token: SEMICOLON@54..55 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@55..57 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: ASYNC_KW@57..63 "async" [] [Whitespace(" ")], - function_token: FUNCTION_KW@63..72 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@72..77 "yield" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@77..78 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@80..81 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@81..82 "}" [] [], - }, - }, - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@84..86 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@86..94 "function" [] [], - star_token: STAR@94..96 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@96..101 "await" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@101..102 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@104..105 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@105..106 "}" [] [], - }, - }, - r_paren_token: R_PAREN@106..107 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@107..108 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..108 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..107 - 0: JS_EXPRESSION_STATEMENT@0..32 - 0: JS_PARENTHESIZED_EXPRESSION@0..31 - 0: L_PAREN@0..11 "(" [Comments("// SCRIPT"), Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@11..30 - 0: (empty) - 1: FUNCTION_KW@11..20 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@20..25 - 0: IDENT@20..25 "await" [] [] - 4: (empty) - 5: JS_PARAMETERS@25..28 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_PARAMETER_LIST@26..26 - 2: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..30 "}" [] [] - 2: R_PAREN@30..31 ")" [] [] - 1: SEMICOLON@31..32 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@32..55 - 0: JS_PARENTHESIZED_EXPRESSION@32..54 - 0: L_PAREN@32..34 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@34..53 - 0: (empty) - 1: FUNCTION_KW@34..43 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@43..48 - 0: IDENT@43..48 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@48..51 - 0: L_PAREN@48..49 "(" [] [] - 1: JS_PARAMETER_LIST@49..49 - 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@51..53 - 0: L_CURLY@51..52 "{" [] [] - 1: JS_DIRECTIVE_LIST@52..52 - 2: JS_STATEMENT_LIST@52..52 - 3: R_CURLY@52..53 "}" [] [] - 2: R_PAREN@53..54 ")" [] [] - 1: SEMICOLON@54..55 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@55..84 - 0: JS_PARENTHESIZED_EXPRESSION@55..83 - 0: L_PAREN@55..57 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@57..82 - 0: ASYNC_KW@57..63 "async" [] [Whitespace(" ")] - 1: FUNCTION_KW@63..72 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@72..77 - 0: IDENT@72..77 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@77..80 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_PARAMETER_LIST@78..78 - 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@80..82 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_DIRECTIVE_LIST@81..81 - 2: JS_STATEMENT_LIST@81..81 - 3: R_CURLY@81..82 "}" [] [] - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@84..107 - 0: JS_PARENTHESIZED_EXPRESSION@84..107 - 0: L_PAREN@84..86 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@86..106 - 0: (empty) - 1: FUNCTION_KW@86..94 "function" [] [] - 2: STAR@94..96 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@96..101 - 0: IDENT@96..101 "await" [] [] - 4: (empty) - 5: JS_PARAMETERS@101..104 - 0: L_PAREN@101..102 "(" [] [] - 1: JS_PARAMETER_LIST@102..102 - 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@104..106 - 0: L_CURLY@104..105 "{" [] [] - 1: JS_DIRECTIVE_LIST@105..105 - 2: JS_STATEMENT_LIST@105..105 - 3: R_CURLY@105..106 "}" [] [] - 2: R_PAREN@106..107 ")" [] [] - 1: (empty) - 4: EOF@107..108 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/function_id.rast b/crates/biome_js_parser/test_data/inline/ok/function_id.rast deleted file mode 100644 index 940a5612557c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/function_id.rast +++ /dev/null @@ -1,273 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..23 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@28..38 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@38..43 "await" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@43..44 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@44..48 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@50..51 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@51..52 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@52..59 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@59..68 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@68..73 "await" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@73..74 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@74..78 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@80..81 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@81..82 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@82..92 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@92..97 "yield" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@97..98 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@98..102 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@104..105 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@105..106 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@106..115 "function" [Newline("\n")] [], - star_token: STAR@115..117 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@117..122 "yield" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@122..123 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@123..127 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@129..130 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@130..131 "}" [] [], - }, - }, - ], - eof_token: EOF@131..132 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..132 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..131 - 0: JS_FUNCTION_DECLARATION@0..28 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..23 - 0: IDENT@19..23 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@26..28 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..27 - 3: R_CURLY@27..28 "}" [] [] - 1: JS_FUNCTION_DECLARATION@28..52 - 0: (empty) - 1: FUNCTION_KW@28..38 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@38..43 - 0: IDENT@38..43 "await" [] [] - 4: (empty) - 5: JS_PARAMETERS@43..50 - 0: L_PAREN@43..44 "(" [] [] - 1: JS_PARAMETER_LIST@44..48 - 0: JS_FORMAL_PARAMETER@44..48 - 0: JS_DECORATOR_LIST@44..44 - 1: JS_IDENTIFIER_BINDING@44..48 - 0: IDENT@44..48 "test" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@50..52 - 0: L_CURLY@50..51 "{" [] [] - 1: JS_DIRECTIVE_LIST@51..51 - 2: JS_STATEMENT_LIST@51..51 - 3: R_CURLY@51..52 "}" [] [] - 2: JS_FUNCTION_DECLARATION@52..82 - 0: ASYNC_KW@52..59 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@59..68 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@68..73 - 0: IDENT@68..73 "await" [] [] - 4: (empty) - 5: JS_PARAMETERS@73..80 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_PARAMETER_LIST@74..78 - 0: JS_FORMAL_PARAMETER@74..78 - 0: JS_DECORATOR_LIST@74..74 - 1: JS_IDENTIFIER_BINDING@74..78 - 0: IDENT@74..78 "test" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@80..82 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_DIRECTIVE_LIST@81..81 - 2: JS_STATEMENT_LIST@81..81 - 3: R_CURLY@81..82 "}" [] [] - 3: JS_FUNCTION_DECLARATION@82..106 - 0: (empty) - 1: FUNCTION_KW@82..92 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@92..97 - 0: IDENT@92..97 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@97..104 - 0: L_PAREN@97..98 "(" [] [] - 1: JS_PARAMETER_LIST@98..102 - 0: JS_FORMAL_PARAMETER@98..102 - 0: JS_DECORATOR_LIST@98..98 - 1: JS_IDENTIFIER_BINDING@98..102 - 0: IDENT@98..102 "test" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@104..106 - 0: L_CURLY@104..105 "{" [] [] - 1: JS_DIRECTIVE_LIST@105..105 - 2: JS_STATEMENT_LIST@105..105 - 3: R_CURLY@105..106 "}" [] [] - 4: JS_FUNCTION_DECLARATION@106..131 - 0: (empty) - 1: FUNCTION_KW@106..115 "function" [Newline("\n")] [] - 2: STAR@115..117 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@117..122 - 0: IDENT@117..122 "yield" [] [] - 4: (empty) - 5: JS_PARAMETERS@122..129 - 0: L_PAREN@122..123 "(" [] [] - 1: JS_PARAMETER_LIST@123..127 - 0: JS_FORMAL_PARAMETER@123..127 - 0: JS_DECORATOR_LIST@123..123 - 1: JS_IDENTIFIER_BINDING@123..127 - 0: IDENT@123..127 "test" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@129..131 - 0: L_CURLY@129..130 "{" [] [] - 1: JS_DIRECTIVE_LIST@130..130 - 2: JS_STATEMENT_LIST@130..130 - 3: R_CURLY@130..131 "}" [] [] - 4: EOF@131..132 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast b/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast deleted file mode 100644 index 6c59d0cc9d23..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast +++ /dev/null @@ -1,279 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [], - }, - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - body: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@27..28 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@31..32 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - }, - }, - JsIfStatement { - if_token: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@37..38 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@38..42 "true" [] [], - }, - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - consequent: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@44..53 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@53..54 "b" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@54..55 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@55..57 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@57..58 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@58..60 "}" [] [Whitespace(" ")], - }, - }, - else_clause: JsElseClause { - else_token: ELSE_KW@60..65 "else" [] [Whitespace(" ")], - alternate: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@65..74 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@74..75 "c" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@75..76 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@78..79 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@79..80 "}" [] [], - }, - }, - }, - }, - JsIfStatement { - if_token: IF_KW@80..84 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@84..85 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@85..89 "true" [] [], - }, - r_paren_token: R_PAREN@89..91 ")" [] [Whitespace(" ")], - consequent: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@91..100 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@100..101 "d" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@101..102 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@104..105 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@105..106 "}" [] [], - }, - }, - else_clause: missing (optional), - }, - JsIfStatement { - if_token: IF_KW@106..110 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@110..111 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@111..115 "true" [] [], - }, - r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], - consequent: JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@117..123 "\"test\"" [] [], - }, - semicolon_token: SEMICOLON@123..125 ";" [] [Whitespace(" ")], - }, - else_clause: JsElseClause { - else_token: ELSE_KW@125..130 "else" [] [Whitespace(" ")], - alternate: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@130..139 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@139..140 "e" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@140..141 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@141..143 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@143..144 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@144..145 "}" [] [], - }, - }, - }, - }, - ], - eof_token: EOF@145..146 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..146 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..145 - 0: JS_LABELED_STATEMENT@0..33 - 0: JS_LABEL@0..16 - 0: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [] - 1: COLON@16..18 ":" [] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@18..33 - 0: (empty) - 1: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@27..28 - 0: IDENT@27..28 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@28..31 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..29 - 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@31..33 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_DIRECTIVE_LIST@32..32 - 2: JS_STATEMENT_LIST@32..32 - 3: R_CURLY@32..33 "}" [] [] - 1: JS_IF_STATEMENT@33..80 - 0: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@37..38 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@38..42 - 0: TRUE_KW@38..42 "true" [] [] - 3: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_DECLARATION@44..60 - 0: (empty) - 1: FUNCTION_KW@44..53 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@53..54 - 0: IDENT@53..54 "b" [] [] - 4: (empty) - 5: JS_PARAMETERS@54..57 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_PARAMETER_LIST@55..55 - 2: R_PAREN@55..57 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@57..60 - 0: L_CURLY@57..58 "{" [] [] - 1: JS_DIRECTIVE_LIST@58..58 - 2: JS_STATEMENT_LIST@58..58 - 3: R_CURLY@58..60 "}" [] [Whitespace(" ")] - 5: JS_ELSE_CLAUSE@60..80 - 0: ELSE_KW@60..65 "else" [] [Whitespace(" ")] - 1: JS_FUNCTION_DECLARATION@65..80 - 0: (empty) - 1: FUNCTION_KW@65..74 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@74..75 - 0: IDENT@74..75 "c" [] [] - 4: (empty) - 5: JS_PARAMETERS@75..78 - 0: L_PAREN@75..76 "(" [] [] - 1: JS_PARAMETER_LIST@76..76 - 2: R_PAREN@76..78 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@78..80 - 0: L_CURLY@78..79 "{" [] [] - 1: JS_DIRECTIVE_LIST@79..79 - 2: JS_STATEMENT_LIST@79..79 - 3: R_CURLY@79..80 "}" [] [] - 2: JS_IF_STATEMENT@80..106 - 0: IF_KW@80..84 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@84..85 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@85..89 - 0: TRUE_KW@85..89 "true" [] [] - 3: R_PAREN@89..91 ")" [] [Whitespace(" ")] - 4: JS_FUNCTION_DECLARATION@91..106 - 0: (empty) - 1: FUNCTION_KW@91..100 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@100..101 - 0: IDENT@100..101 "d" [] [] - 4: (empty) - 5: JS_PARAMETERS@101..104 - 0: L_PAREN@101..102 "(" [] [] - 1: JS_PARAMETER_LIST@102..102 - 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@104..106 - 0: L_CURLY@104..105 "{" [] [] - 1: JS_DIRECTIVE_LIST@105..105 - 2: JS_STATEMENT_LIST@105..105 - 3: R_CURLY@105..106 "}" [] [] - 5: (empty) - 3: JS_IF_STATEMENT@106..145 - 0: IF_KW@106..110 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@110..111 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@111..115 - 0: TRUE_KW@111..115 "true" [] [] - 3: R_PAREN@115..117 ")" [] [Whitespace(" ")] - 4: JS_EXPRESSION_STATEMENT@117..125 - 0: JS_STRING_LITERAL_EXPRESSION@117..123 - 0: JS_STRING_LITERAL@117..123 "\"test\"" [] [] - 1: SEMICOLON@123..125 ";" [] [Whitespace(" ")] - 5: JS_ELSE_CLAUSE@125..145 - 0: ELSE_KW@125..130 "else" [] [Whitespace(" ")] - 1: JS_FUNCTION_DECLARATION@130..145 - 0: (empty) - 1: FUNCTION_KW@130..139 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@139..140 - 0: IDENT@139..140 "e" [] [] - 4: (empty) - 5: JS_PARAMETERS@140..143 - 0: L_PAREN@140..141 "(" [] [] - 1: JS_PARAMETER_LIST@141..141 - 2: R_PAREN@141..143 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@143..145 - 0: L_CURLY@143..144 "{" [] [] - 1: JS_DIRECTIVE_LIST@144..144 - 2: JS_STATEMENT_LIST@144..144 - 3: R_CURLY@144..145 "}" [] [] - 4: EOF@145..146 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/getter_class_member.rast deleted file mode 100644 index 3a75236aab31..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/getter_class_member.rast +++ /dev/null @@ -1,423 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..14 "Getters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsClassMemberList [ - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@22..25 "foo" [] [], - }, - l_paren_token: L_PAREN@25..26 "(" [] [], - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@28..29 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@30..37 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@37..43 "static" [] [], - }, - l_paren_token: L_PAREN@43..44 "(" [] [], - r_paren_token: R_PAREN@44..46 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@46..47 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@47..48 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@48..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - get_token: GET_KW@58..62 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@62..65 "bar" [] [], - }, - l_paren_token: L_PAREN@65..66 "(" [] [], - r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@68..69 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@69..70 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@70..77 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@77..82 "\"baz\"" [] [], - }, - l_paren_token: L_PAREN@82..83 "(" [] [], - r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@85..86 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@86..87 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@87..94 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@94..95 "[" [] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@95..99 "\"a\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@99..101 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@101..104 "\"b\"" [] [], - }, - }, - r_brack_token: R_BRACK@104..105 "]" [] [], - }, - l_paren_token: L_PAREN@105..106 "(" [] [], - r_paren_token: R_PAREN@106..108 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@108..109 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@109..110 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@110..117 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@117..118 "5" [] [], - }, - l_paren_token: L_PAREN@118..119 "(" [] [], - r_paren_token: R_PAREN@119..121 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@121..122 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@122..123 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [], - get_token: GET_KW@123..130 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsPrivateClassMemberName { - hash_token: HASH@130..131 "#" [] [], - id_token: IDENT@131..138 "private" [] [], - }, - l_paren_token: L_PAREN@138..139 "(" [] [], - r_paren_token: R_PAREN@139..141 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@141..142 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@142..143 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@143..145 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@152..163 "NotGetters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@163..164 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@164..170 "get" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@170..171 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@171..173 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@173..174 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@174..175 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@175..184 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@184..187 "get" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@187..188 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@188..190 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@190..191 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@191..192 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@192..202 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@202..205 "get" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@205..206 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@206..208 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@208..209 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@209..210 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@210..212 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@212..213 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..213 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..212 - 0: JS_CLASS_DECLARATION@0..145 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..14 - 0: IDENT@6..14 "Getters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@14..15 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@15..143 - 0: JS_GETTER_CLASS_MEMBER@15..30 - 0: JS_METHOD_MODIFIER_LIST@15..15 - 1: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@22..25 - 0: IDENT@22..25 "foo" [] [] - 3: L_PAREN@25..26 "(" [] [] - 4: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_DIRECTIVE_LIST@29..29 - 2: JS_STATEMENT_LIST@29..29 - 3: R_CURLY@29..30 "}" [] [] - 1: JS_GETTER_CLASS_MEMBER@30..48 - 0: JS_METHOD_MODIFIER_LIST@30..30 - 1: GET_KW@30..37 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@37..43 - 0: IDENT@37..43 "static" [] [] - 3: L_PAREN@43..44 "(" [] [] - 4: R_PAREN@44..46 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@46..48 - 0: L_CURLY@46..47 "{" [] [] - 1: JS_DIRECTIVE_LIST@47..47 - 2: JS_STATEMENT_LIST@47..47 - 3: R_CURLY@47..48 "}" [] [] - 2: JS_GETTER_CLASS_MEMBER@48..70 - 0: JS_METHOD_MODIFIER_LIST@48..58 - 0: JS_STATIC_MODIFIER@48..58 - 0: STATIC_KW@48..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@58..62 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@62..65 - 0: IDENT@62..65 "bar" [] [] - 3: L_PAREN@65..66 "(" [] [] - 4: R_PAREN@66..68 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@68..70 - 0: L_CURLY@68..69 "{" [] [] - 1: JS_DIRECTIVE_LIST@69..69 - 2: JS_STATEMENT_LIST@69..69 - 3: R_CURLY@69..70 "}" [] [] - 3: JS_GETTER_CLASS_MEMBER@70..87 - 0: JS_METHOD_MODIFIER_LIST@70..70 - 1: GET_KW@70..77 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@77..82 - 0: JS_STRING_LITERAL@77..82 "\"baz\"" [] [] - 3: L_PAREN@82..83 "(" [] [] - 4: R_PAREN@83..85 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@85..87 - 0: L_CURLY@85..86 "{" [] [] - 1: JS_DIRECTIVE_LIST@86..86 - 2: JS_STATEMENT_LIST@86..86 - 3: R_CURLY@86..87 "}" [] [] - 4: JS_GETTER_CLASS_MEMBER@87..110 - 0: JS_METHOD_MODIFIER_LIST@87..87 - 1: GET_KW@87..94 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_COMPUTED_MEMBER_NAME@94..105 - 0: L_BRACK@94..95 "[" [] [] - 1: JS_BINARY_EXPRESSION@95..104 - 0: JS_STRING_LITERAL_EXPRESSION@95..99 - 0: JS_STRING_LITERAL@95..99 "\"a\"" [] [Whitespace(" ")] - 1: PLUS@99..101 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@101..104 - 0: JS_STRING_LITERAL@101..104 "\"b\"" [] [] - 2: R_BRACK@104..105 "]" [] [] - 3: L_PAREN@105..106 "(" [] [] - 4: R_PAREN@106..108 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@108..110 - 0: L_CURLY@108..109 "{" [] [] - 1: JS_DIRECTIVE_LIST@109..109 - 2: JS_STATEMENT_LIST@109..109 - 3: R_CURLY@109..110 "}" [] [] - 5: JS_GETTER_CLASS_MEMBER@110..123 - 0: JS_METHOD_MODIFIER_LIST@110..110 - 1: GET_KW@110..117 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@117..118 - 0: JS_NUMBER_LITERAL@117..118 "5" [] [] - 3: L_PAREN@118..119 "(" [] [] - 4: R_PAREN@119..121 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@121..123 - 0: L_CURLY@121..122 "{" [] [] - 1: JS_DIRECTIVE_LIST@122..122 - 2: JS_STATEMENT_LIST@122..122 - 3: R_CURLY@122..123 "}" [] [] - 6: JS_GETTER_CLASS_MEMBER@123..143 - 0: JS_METHOD_MODIFIER_LIST@123..123 - 1: GET_KW@123..130 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_PRIVATE_CLASS_MEMBER_NAME@130..138 - 0: HASH@130..131 "#" [] [] - 1: IDENT@131..138 "private" [] [] - 3: L_PAREN@138..139 "(" [] [] - 4: R_PAREN@139..141 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@141..143 - 0: L_CURLY@141..142 "{" [] [] - 1: JS_DIRECTIVE_LIST@142..142 - 2: JS_STATEMENT_LIST@142..142 - 3: R_CURLY@142..143 "}" [] [] - 9: R_CURLY@143..145 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@145..212 - 0: JS_DECORATOR_LIST@145..145 - 1: (empty) - 2: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@152..163 - 0: IDENT@152..163 "NotGetters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@163..164 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@164..210 - 0: JS_METHOD_CLASS_MEMBER@164..175 - 0: JS_METHOD_MODIFIER_LIST@164..164 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@164..170 - 0: IDENT@164..170 "get" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@170..173 - 0: L_PAREN@170..171 "(" [] [] - 1: JS_PARAMETER_LIST@171..171 - 2: R_PAREN@171..173 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@173..175 - 0: L_CURLY@173..174 "{" [] [] - 1: JS_DIRECTIVE_LIST@174..174 - 2: JS_STATEMENT_LIST@174..174 - 3: R_CURLY@174..175 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@175..192 - 0: JS_METHOD_MODIFIER_LIST@175..175 - 1: ASYNC_KW@175..184 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@184..187 - 0: IDENT@184..187 "get" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@187..190 - 0: L_PAREN@187..188 "(" [] [] - 1: JS_PARAMETER_LIST@188..188 - 2: R_PAREN@188..190 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@190..192 - 0: L_CURLY@190..191 "{" [] [] - 1: JS_DIRECTIVE_LIST@191..191 - 2: JS_STATEMENT_LIST@191..191 - 3: R_CURLY@191..192 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@192..210 - 0: JS_METHOD_MODIFIER_LIST@192..202 - 0: JS_STATIC_MODIFIER@192..202 - 0: STATIC_KW@192..202 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@202..205 - 0: IDENT@202..205 "get" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@205..208 - 0: L_PAREN@205..206 "(" [] [] - 1: JS_PARAMETER_LIST@206..206 - 2: R_PAREN@206..208 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@208..210 - 0: L_CURLY@208..209 "{" [] [] - 1: JS_DIRECTIVE_LIST@209..209 - 2: JS_STATEMENT_LIST@209..209 - 3: R_CURLY@209..210 "}" [] [] - 9: R_CURLY@210..212 "}" [Newline("\n")] [] - 4: EOF@212..213 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_object_member.rast b/crates/biome_js_parser/test_data/inline/ok/getter_object_member.rast deleted file mode 100644 index be45c1fb332f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/getter_object_member.rast +++ /dev/null @@ -1,302 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsGetterObjectMember { - get_token: GET_KW@9..16 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@16..19 "foo" [] [], - }, - l_paren_token: L_PAREN@19..20 "(" [] [], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@23..35 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..38 "foo" [] [], - }, - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - ], - r_curly_token: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@43..44 "," [] [], - JsGetterObjectMember { - get_token: GET_KW@44..51 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@51..56 "\"bar\"" [] [], - }, - l_paren_token: L_PAREN@56..57 "(" [] [], - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@59..60 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@60..72 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@72..77 "\"bar\"" [] [], - }, - semicolon_token: SEMICOLON@77..78 ";" [] [], - }, - ], - r_curly_token: R_CURLY@78..82 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@82..83 "," [] [], - JsGetterObjectMember { - get_token: GET_KW@83..90 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@90..91 "[" [] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@91..95 "\"a\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@95..97 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@97..100 "\"b\"" [] [], - }, - }, - r_brack_token: R_BRACK@100..101 "]" [] [], - }, - l_paren_token: L_PAREN@101..102 "(" [] [], - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@104..105 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@105..117 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@117..121 "\"a\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@121..123 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@123..126 "\"b\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@126..130 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@130..131 "," [] [], - JsGetterObjectMember { - get_token: GET_KW@131..138 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@138..139 "5" [] [], - }, - l_paren_token: L_PAREN@139..140 "(" [] [], - r_paren_token: R_PAREN@140..142 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@142..143 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@143..155 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@155..156 "5" [] [], - }, - semicolon_token: SEMICOLON@156..157 ";" [] [], - }, - ], - r_curly_token: R_CURLY@157..161 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@161..162 "," [] [], - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@162..168 "get" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@168..169 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@169..171 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@171..172 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@172..183 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@183..218 "\"This is a method and not a getter\"" [] [], - }, - semicolon_token: SEMICOLON@218..219 ";" [] [], - }, - ], - r_curly_token: R_CURLY@219..223 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@223..225 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@225..226 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..226 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..225 - 0: JS_VARIABLE_STATEMENT@0..225 - 0: JS_VARIABLE_DECLARATION@0..225 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..225 - 0: JS_VARIABLE_DECLARATOR@4..225 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..225 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..225 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..223 - 0: JS_GETTER_OBJECT_MEMBER@9..43 - 0: GET_KW@9..16 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@16..19 - 0: IDENT@16..19 "foo" [] [] - 2: L_PAREN@19..20 "(" [] [] - 3: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@22..43 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..39 - 0: JS_RETURN_STATEMENT@23..39 - 0: RETURN_KW@23..35 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@35..38 - 0: JS_REFERENCE_IDENTIFIER@35..38 - 0: IDENT@35..38 "foo" [] [] - 2: SEMICOLON@38..39 ";" [] [] - 3: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [] - 1: COMMA@43..44 "," [] [] - 2: JS_GETTER_OBJECT_MEMBER@44..82 - 0: GET_KW@44..51 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@51..56 - 0: JS_STRING_LITERAL@51..56 "\"bar\"" [] [] - 2: L_PAREN@56..57 "(" [] [] - 3: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@59..82 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_DIRECTIVE_LIST@60..60 - 2: JS_STATEMENT_LIST@60..78 - 0: JS_RETURN_STATEMENT@60..78 - 0: RETURN_KW@60..72 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@72..77 - 0: JS_STRING_LITERAL@72..77 "\"bar\"" [] [] - 2: SEMICOLON@77..78 ";" [] [] - 3: R_CURLY@78..82 "}" [Newline("\n"), Whitespace(" ")] [] - 3: COMMA@82..83 "," [] [] - 4: JS_GETTER_OBJECT_MEMBER@83..130 - 0: GET_KW@83..90 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_NAME@90..101 - 0: L_BRACK@90..91 "[" [] [] - 1: JS_BINARY_EXPRESSION@91..100 - 0: JS_STRING_LITERAL_EXPRESSION@91..95 - 0: JS_STRING_LITERAL@91..95 "\"a\"" [] [Whitespace(" ")] - 1: PLUS@95..97 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@97..100 - 0: JS_STRING_LITERAL@97..100 "\"b\"" [] [] - 2: R_BRACK@100..101 "]" [] [] - 2: L_PAREN@101..102 "(" [] [] - 3: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@104..130 - 0: L_CURLY@104..105 "{" [] [] - 1: JS_DIRECTIVE_LIST@105..105 - 2: JS_STATEMENT_LIST@105..126 - 0: JS_RETURN_STATEMENT@105..126 - 0: RETURN_KW@105..117 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@117..126 - 0: JS_STRING_LITERAL_EXPRESSION@117..121 - 0: JS_STRING_LITERAL@117..121 "\"a\"" [] [Whitespace(" ")] - 1: PLUS@121..123 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@123..126 - 0: JS_STRING_LITERAL@123..126 "\"b\"" [] [] - 2: (empty) - 3: R_CURLY@126..130 "}" [Newline("\n"), Whitespace(" ")] [] - 5: COMMA@130..131 "," [] [] - 6: JS_GETTER_OBJECT_MEMBER@131..161 - 0: GET_KW@131..138 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@138..139 - 0: JS_NUMBER_LITERAL@138..139 "5" [] [] - 2: L_PAREN@139..140 "(" [] [] - 3: R_PAREN@140..142 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@142..161 - 0: L_CURLY@142..143 "{" [] [] - 1: JS_DIRECTIVE_LIST@143..143 - 2: JS_STATEMENT_LIST@143..157 - 0: JS_RETURN_STATEMENT@143..157 - 0: RETURN_KW@143..155 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@155..156 - 0: JS_NUMBER_LITERAL@155..156 "5" [] [] - 2: SEMICOLON@156..157 ";" [] [] - 3: R_CURLY@157..161 "}" [Newline("\n"), Whitespace(" ")] [] - 7: COMMA@161..162 "," [] [] - 8: JS_METHOD_OBJECT_MEMBER@162..223 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@162..168 - 0: IDENT@162..168 "get" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@168..171 - 0: L_PAREN@168..169 "(" [] [] - 1: JS_PARAMETER_LIST@169..169 - 2: R_PAREN@169..171 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@171..223 - 0: L_CURLY@171..172 "{" [] [] - 1: JS_DIRECTIVE_LIST@172..172 - 2: JS_STATEMENT_LIST@172..219 - 0: JS_RETURN_STATEMENT@172..219 - 0: RETURN_KW@172..183 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@183..218 - 0: JS_STRING_LITERAL@183..218 "\"This is a method and not a getter\"" [] [] - 2: SEMICOLON@218..219 ";" [] [] - 3: R_CURLY@219..223 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@223..225 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@225..226 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/grouping_expr.rast b/crates/biome_js_parser/test_data/inline/ok/grouping_expr.rast deleted file mode 100644 index 6a8f12240899..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/grouping_expr.rast +++ /dev/null @@ -1,67 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@1..2 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@2..5 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@5..6 ")" [] [], - }, - r_paren_token: R_PAREN@6..7 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@7..9 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..12 "foo" [] [], - }, - }, - ], - r_paren_token: R_PAREN@12..13 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_CALL_EXPRESSION@0..13 - 0: JS_PARENTHESIZED_EXPRESSION@0..7 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@1..6 - 0: L_PAREN@1..2 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@2..5 - 0: JS_REFERENCE_IDENTIFIER@2..5 - 0: IDENT@2..5 "foo" [] [] - 2: R_PAREN@5..6 ")" [] [] - 2: R_PAREN@6..7 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@7..13 - 0: L_PAREN@7..9 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@9..12 - 0: JS_IDENTIFIER_EXPRESSION@9..12 - 0: JS_REFERENCE_IDENTIFIER@9..12 - 0: IDENT@9..12 "foo" [] [] - 2: R_PAREN@12..13 ")" [] [] - 1: (empty) - 4: EOF@13..14 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast b/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast deleted file mode 100644 index 4cdb2eeec2da..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast +++ /dev/null @@ -1,58 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@10..14 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - else_clause: missing (optional), - }, - ], - eof_token: EOF@16..17 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..17 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..16 - 0: JS_IF_STATEMENT@0..16 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_VARIABLE_STATEMENT@10..16 - 0: JS_VARIABLE_DECLARATION@10..15 - 0: (empty) - 1: VAR_KW@10..14 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..15 - 0: JS_VARIABLE_DECLARATOR@14..15 - 0: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@15..16 ";" [] [] - 5: (empty) - 4: EOF@16..17 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier.rast b/crates/biome_js_parser/test_data/inline/ok/identifier.rast deleted file mode 100644 index b78d2340f82a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/identifier.rast +++ /dev/null @@ -1,63 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - semicolon_token: SEMICOLON@3..4 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@4..9 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@9..18 "accessor" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@18..20 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@20..21 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - ], - eof_token: EOF@22..23 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..23 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..22 - 0: JS_EXPRESSION_STATEMENT@0..4 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: SEMICOLON@3..4 ";" [] [] - 1: JS_VARIABLE_STATEMENT@4..22 - 0: JS_VARIABLE_DECLARATION@4..21 - 0: (empty) - 1: LET_KW@4..9 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@9..21 - 0: JS_VARIABLE_DECLARATOR@9..21 - 0: JS_IDENTIFIER_BINDING@9..18 - 0: IDENT@9..18 "accessor" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@18..21 - 0: EQ@18..20 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@20..21 - 0: JS_NUMBER_LITERAL@20..21 "5" [] [] - 1: SEMICOLON@21..22 ";" [] [] - 4: EOF@22..23 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.rast b/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.rast deleted file mode 100644 index 3e0b3b6a7190..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.rast +++ /dev/null @@ -1,54 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..20 "yield" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..27 "await" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..28 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_IDENTIFIER_EXPRESSION@0..13 - 0: JS_REFERENCE_IDENTIFIER@0..13 - 0: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..21 - 0: JS_IDENTIFIER_EXPRESSION@14..20 - 0: JS_REFERENCE_IDENTIFIER@14..20 - 0: IDENT@14..20 "yield" [Newline("\n")] [] - 1: SEMICOLON@20..21 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@21..28 - 0: JS_IDENTIFIER_EXPRESSION@21..27 - 0: JS_REFERENCE_IDENTIFIER@21..27 - 0: IDENT@21..27 "await" [Newline("\n")] [] - 1: SEMICOLON@27..28 ";" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_reference.rast b/crates/biome_js_parser/test_data/inline/ok/identifier_reference.rast deleted file mode 100644 index 3e0b3b6a7190..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/identifier_reference.rast +++ /dev/null @@ -1,54 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..20 "yield" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..27 "await" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..28 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JS_IDENTIFIER_EXPRESSION@0..13 - 0: JS_REFERENCE_IDENTIFIER@0..13 - 0: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..21 - 0: JS_IDENTIFIER_EXPRESSION@14..20 - 0: JS_REFERENCE_IDENTIFIER@14..20 - 0: IDENT@14..20 "yield" [Newline("\n")] [] - 1: SEMICOLON@20..21 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@21..28 - 0: JS_IDENTIFIER_EXPRESSION@21..27 - 0: JS_REFERENCE_IDENTIFIER@21..27 - 0: IDENT@21..27 "await" [Newline("\n")] [] - 1: SEMICOLON@27..28 ";" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/if_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/if_stmt.rast deleted file mode 100644 index 49613dc24a68..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/if_stmt.rast +++ /dev/null @@ -1,171 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsBlockStatement { - l_curly_token: L_CURLY@10..11 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], - }, - else_clause: JsElseClause { - else_token: ELSE_KW@13..18 "else" [] [Whitespace(" ")], - alternate: JsBlockStatement { - l_curly_token: L_CURLY@18..19 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@19..20 "}" [] [], - }, - }, - }, - JsIfStatement { - if_token: IF_KW@20..24 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@24..25 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@25..29 "true" [] [], - }, - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - consequent: JsBlockStatement { - l_curly_token: L_CURLY@31..32 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - else_clause: missing (optional), - }, - JsIfStatement { - if_token: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@37..38 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@38..42 "true" [] [], - }, - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - consequent: JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: FALSE_KW@44..49 "false" [] [], - }, - semicolon_token: missing (optional), - }, - else_clause: missing (optional), - }, - JsIfStatement { - if_token: IF_KW@49..53 "if" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@53..54 "(" [] [], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@54..57 "bar" [] [], - }, - }, - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - consequent: JsBlockStatement { - l_curly_token: L_CURLY@59..60 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@60..62 "}" [] [Whitespace(" ")], - }, - else_clause: JsElseClause { - else_token: ELSE_KW@62..67 "else" [] [Whitespace(" ")], - alternate: JsIfStatement { - if_token: IF_KW@67..70 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@70..71 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@71..75 "true" [] [], - }, - r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], - consequent: JsBlockStatement { - l_curly_token: L_CURLY@77..78 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@78..80 "}" [] [Whitespace(" ")], - }, - else_clause: JsElseClause { - else_token: ELSE_KW@80..85 "else" [] [Whitespace(" ")], - alternate: JsBlockStatement { - l_curly_token: L_CURLY@85..86 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@86..87 "}" [] [], - }, - }, - }, - }, - }, - ], - eof_token: EOF@87..88 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..88 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..87 - 0: JS_IF_STATEMENT@0..20 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@10..13 - 0: L_CURLY@10..11 "{" [] [] - 1: JS_STATEMENT_LIST@11..11 - 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] - 5: JS_ELSE_CLAUSE@13..20 - 0: ELSE_KW@13..18 "else" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@18..20 - 0: L_CURLY@18..19 "{" [] [] - 1: JS_STATEMENT_LIST@19..19 - 2: R_CURLY@19..20 "}" [] [] - 1: JS_IF_STATEMENT@20..33 - 0: IF_KW@20..24 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@24..25 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@25..29 - 0: TRUE_KW@25..29 "true" [] [] - 3: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@31..33 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_STATEMENT_LIST@32..32 - 2: R_CURLY@32..33 "}" [] [] - 5: (empty) - 2: JS_IF_STATEMENT@33..49 - 0: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@37..38 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@38..42 - 0: TRUE_KW@38..42 "true" [] [] - 3: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 4: JS_EXPRESSION_STATEMENT@44..49 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@44..49 - 0: FALSE_KW@44..49 "false" [] [] - 1: (empty) - 5: (empty) - 3: JS_IF_STATEMENT@49..87 - 0: IF_KW@49..53 "if" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@53..54 "(" [] [] - 2: JS_IDENTIFIER_EXPRESSION@54..57 - 0: JS_REFERENCE_IDENTIFIER@54..57 - 0: IDENT@54..57 "bar" [] [] - 3: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@59..62 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_STATEMENT_LIST@60..60 - 2: R_CURLY@60..62 "}" [] [Whitespace(" ")] - 5: JS_ELSE_CLAUSE@62..87 - 0: ELSE_KW@62..67 "else" [] [Whitespace(" ")] - 1: JS_IF_STATEMENT@67..87 - 0: IF_KW@67..70 "if" [] [Whitespace(" ")] - 1: L_PAREN@70..71 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@71..75 - 0: TRUE_KW@71..75 "true" [] [] - 3: R_PAREN@75..77 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@77..80 - 0: L_CURLY@77..78 "{" [] [] - 1: JS_STATEMENT_LIST@78..78 - 2: R_CURLY@78..80 "}" [] [Whitespace(" ")] - 5: JS_ELSE_CLAUSE@80..87 - 0: ELSE_KW@80..85 "else" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@85..87 - 0: L_CURLY@85..86 "{" [] [] - 1: JS_STATEMENT_LIST@86..86 - 2: R_CURLY@86..87 "}" [] [] - 4: EOF@87..88 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.rast deleted file mode 100644 index 5dc1a7efe871..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.rast +++ /dev/null @@ -1,63 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@9..12 "as" [] [Whitespace(" ")], - }, - as_token: AS_KW@12..15 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@15..18 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@20..25 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@25..31 "\"test\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - ], - eof_token: EOF@32..33 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..33 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..32 - 0: JS_IMPORT@0..32 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@7..31 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@7..20 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..18 - 0: JS_NAMED_IMPORT_SPECIFIER@9..18 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@9..12 - 0: IDENT@9..12 "as" [] [Whitespace(" ")] - 2: AS_KW@12..15 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..18 - 0: IDENT@15..18 "as" [] [Whitespace(" ")] - 2: R_CURLY@18..20 "}" [] [Whitespace(" ")] - 2: FROM_KW@20..25 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@25..31 - 0: JS_STRING_LITERAL@25..31 "\"test\"" [] [] - 4: (empty) - 2: SEMICOLON@31..32 ";" [] [] - 4: EOF@32..33 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.rast deleted file mode 100644 index abd11356bc90..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.rast +++ /dev/null @@ -1,56 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@9..12 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@12..14 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@14..19 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@19..25 "\"test\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - ], - eof_token: EOF@26..27 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..27 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..26 - 0: JS_IMPORT@0..26 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@7..25 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@7..14 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..12 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@9..12 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "as" [] [Whitespace(" ")] - 2: R_CURLY@12..14 "}" [] [Whitespace(" ")] - 2: FROM_KW@14..19 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@19..25 - 0: JS_STRING_LITERAL@19..25 "\"test\"" [] [] - 4: (empty) - 2: SEMICOLON@25..26 ";" [] [] - 4: EOF@26..27 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_assertion.rast b/crates/biome_js_parser/test_data/inline/ok/import_assertion.rast deleted file mode 100644 index 1a633c69035b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_assertion.rast +++ /dev/null @@ -1,290 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@11..18 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@20..24 "type" [] [], - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@34..42 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@42..48 "\"foo\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@48..55 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: JS_STRING_LITERAL@57..63 "\"type\"" [] [], - colon_token: COLON@63..65 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@65..72 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@72..73 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@73..74 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@74..82 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@82..86 "foo" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@86..91 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@91..102 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@102..109 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@109..111 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@111..115 "type" [] [], - colon_token: COLON@115..117 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@117..124 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@124..125 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@125..126 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@126..134 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@134..135 "{" [] [], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@135..139 "test" [] [], - }, - }, - ], - r_curly_token: R_CURLY@139..141 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@141..146 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@146..157 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@157..164 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@164..166 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@166..169 "for" [] [], - colon_token: COLON@169..171 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@171..177 "\"for\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@177..178 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@178..186 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@186..195 "foo_json" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@195..200 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@200..211 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@211..218 "assert" [] [Whitespace(" ")], - l_curly_token: L_CURLY@218..220 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@220..224 "type" [] [], - colon_token: COLON@224..226 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@226..232 "\"json\"" [] [], - }, - COMMA@232..234 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: IDENT@234..248 "hasOwnProperty" [] [], - colon_token: COLON@248..250 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@250..257 "\"true\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@257..258 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@258..259 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@259..267 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@267..271 "\"x\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: ASSERT_KW@271..277 "assert" [] [], - l_curly_token: L_CURLY@277..280 "{" [Newline("\n")] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@280..284 "type" [] [], - colon_token: COLON@284..286 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@286..293 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@293..294 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@294..295 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..295 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..294 - 0: JS_IMPORT@0..34 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@7..34 - 0: JS_MODULE_SOURCE@7..11 - 0: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@11..34 - 0: ASSERT_KW@11..18 "assert" [] [Whitespace(" ")] - 1: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@20..33 - 0: JS_IMPORT_ASSERTION_ENTRY@20..33 - 0: IDENT@20..24 "type" [] [] - 1: COLON@24..26 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@33..34 "}" [] [] - 2: (empty) - 1: JS_IMPORT@34..74 - 0: IMPORT_KW@34..42 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@42..73 - 0: JS_MODULE_SOURCE@42..48 - 0: JS_STRING_LITERAL@42..48 "\"foo\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@48..73 - 0: ASSERT_KW@48..55 "assert" [] [Whitespace(" ")] - 1: L_CURLY@55..57 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@57..72 - 0: JS_IMPORT_ASSERTION_ENTRY@57..72 - 0: JS_STRING_LITERAL@57..63 "\"type\"" [] [] - 1: COLON@63..65 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@65..72 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@72..73 "}" [] [] - 2: SEMICOLON@73..74 ";" [] [] - 2: JS_IMPORT@74..126 - 0: IMPORT_KW@74..82 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@82..125 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@82..86 - 0: JS_IDENTIFIER_BINDING@82..86 - 0: IDENT@82..86 "foo" [] [Whitespace(" ")] - 2: FROM_KW@86..91 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@91..102 - 0: JS_STRING_LITERAL@91..102 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@102..125 - 0: ASSERT_KW@102..109 "assert" [] [Whitespace(" ")] - 1: L_CURLY@109..111 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@111..124 - 0: JS_IMPORT_ASSERTION_ENTRY@111..124 - 0: IDENT@111..115 "type" [] [] - 1: COLON@115..117 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@117..124 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@124..125 "}" [] [] - 2: SEMICOLON@125..126 ";" [] [] - 3: JS_IMPORT@126..178 - 0: IMPORT_KW@126..134 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@134..178 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@134..141 - 0: L_CURLY@134..135 "{" [] [] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@135..139 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@135..139 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@135..139 - 0: IDENT@135..139 "test" [] [] - 2: R_CURLY@139..141 "}" [] [Whitespace(" ")] - 2: FROM_KW@141..146 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@146..157 - 0: JS_STRING_LITERAL@146..157 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@157..178 - 0: ASSERT_KW@157..164 "assert" [] [Whitespace(" ")] - 1: L_CURLY@164..166 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@166..177 - 0: JS_IMPORT_ASSERTION_ENTRY@166..177 - 0: IDENT@166..169 "for" [] [] - 1: COLON@169..171 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@171..177 "\"for\"" [] [Whitespace(" ")] - 3: R_CURLY@177..178 "}" [] [] - 2: (empty) - 4: JS_IMPORT@178..259 - 0: IMPORT_KW@178..186 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@186..258 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@186..195 - 0: JS_IDENTIFIER_BINDING@186..195 - 0: IDENT@186..195 "foo_json" [] [Whitespace(" ")] - 2: FROM_KW@195..200 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@200..211 - 0: JS_STRING_LITERAL@200..211 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@211..258 - 0: ASSERT_KW@211..218 "assert" [] [Whitespace(" ")] - 1: L_CURLY@218..220 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@220..257 - 0: JS_IMPORT_ASSERTION_ENTRY@220..232 - 0: IDENT@220..224 "type" [] [] - 1: COLON@224..226 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@226..232 "\"json\"" [] [] - 1: COMMA@232..234 "," [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY@234..257 - 0: IDENT@234..248 "hasOwnProperty" [] [] - 1: COLON@248..250 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@250..257 "\"true\"" [] [Whitespace(" ")] - 3: R_CURLY@257..258 "}" [] [] - 2: SEMICOLON@258..259 ";" [] [] - 5: JS_IMPORT@259..294 - 0: IMPORT_KW@259..267 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@267..294 - 0: JS_MODULE_SOURCE@267..271 - 0: JS_STRING_LITERAL@267..271 "\"x\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@271..294 - 0: ASSERT_KW@271..277 "assert" [] [] - 1: L_CURLY@277..280 "{" [Newline("\n")] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@280..293 - 0: JS_IMPORT_ASSERTION_ENTRY@280..293 - 0: IDENT@280..284 "type" [] [] - 1: COLON@284..286 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@286..293 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@293..294 "}" [] [] - 2: (empty) - 4: EOF@294..295 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_attribute.rast b/crates/biome_js_parser/test_data/inline/ok/import_attribute.rast deleted file mode 100644 index a8db8ee4574a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_attribute.rast +++ /dev/null @@ -1,290 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@11..16 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@18..22 "type" [] [], - colon_token: COLON@22..24 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@24..31 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@40..46 "\"foo\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@46..51 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@51..53 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: JS_STRING_LITERAL@53..59 "\"type\"" [] [], - colon_token: COLON@59..61 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@61..68 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@68..69 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@78..82 "foo" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@82..87 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@87..98 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@98..103 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@103..105 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@105..109 "type" [] [], - colon_token: COLON@109..111 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@118..119 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@119..120 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@128..129 "{" [] [], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@129..133 "test" [] [], - }, - }, - ], - r_curly_token: R_CURLY@133..135 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@135..140 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@140..151 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@151..156 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@156..158 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@158..161 "for" [] [], - colon_token: COLON@161..163 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@163..169 "\"for\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@169..170 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@170..178 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@178..187 "foo_json" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@187..192 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@192..203 "\"foo.json\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@203..208 "with" [] [Whitespace(" ")], - l_curly_token: L_CURLY@208..210 "{" [] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@210..214 "type" [] [], - colon_token: COLON@214..216 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@216..222 "\"json\"" [] [], - }, - COMMA@222..224 "," [] [Whitespace(" ")], - JsImportAssertionEntry { - key: IDENT@224..238 "hasOwnProperty" [] [], - colon_token: COLON@238..240 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@240..247 "\"true\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@247..248 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@248..249 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@249..257 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@257..261 "\"x\"" [] [Whitespace(" ")], - }, - assertion: JsImportAssertion { - assertion_kind: WITH_KW@261..265 "with" [] [], - l_curly_token: L_CURLY@265..268 "{" [Newline("\n")] [Whitespace(" ")], - assertions: JsImportAssertionEntryList [ - JsImportAssertionEntry { - key: IDENT@268..272 "type" [] [], - colon_token: COLON@272..274 ":" [] [Whitespace(" ")], - value_token: JS_STRING_LITERAL@274..281 "\"json\"" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@281..282 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@282..283 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..283 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..282 - 0: JS_IMPORT@0..32 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@7..32 - 0: JS_MODULE_SOURCE@7..11 - 0: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@11..32 - 0: WITH_KW@11..16 "with" [] [Whitespace(" ")] - 1: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@18..31 - 0: JS_IMPORT_ASSERTION_ENTRY@18..31 - 0: IDENT@18..22 "type" [] [] - 1: COLON@22..24 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@24..31 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@31..32 "}" [] [] - 2: (empty) - 1: JS_IMPORT@32..70 - 0: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@40..69 - 0: JS_MODULE_SOURCE@40..46 - 0: JS_STRING_LITERAL@40..46 "\"foo\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@46..69 - 0: WITH_KW@46..51 "with" [] [Whitespace(" ")] - 1: L_CURLY@51..53 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@53..68 - 0: JS_IMPORT_ASSERTION_ENTRY@53..68 - 0: JS_STRING_LITERAL@53..59 "\"type\"" [] [] - 1: COLON@59..61 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@61..68 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@68..69 "}" [] [] - 2: SEMICOLON@69..70 ";" [] [] - 2: JS_IMPORT@70..120 - 0: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@78..119 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@78..82 - 0: JS_IDENTIFIER_BINDING@78..82 - 0: IDENT@78..82 "foo" [] [Whitespace(" ")] - 2: FROM_KW@82..87 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@87..98 - 0: JS_STRING_LITERAL@87..98 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@98..119 - 0: WITH_KW@98..103 "with" [] [Whitespace(" ")] - 1: L_CURLY@103..105 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@105..118 - 0: JS_IMPORT_ASSERTION_ENTRY@105..118 - 0: IDENT@105..109 "type" [] [] - 1: COLON@109..111 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@118..119 "}" [] [] - 2: SEMICOLON@119..120 ";" [] [] - 3: JS_IMPORT@120..170 - 0: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@128..170 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@128..135 - 0: L_CURLY@128..129 "{" [] [] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@129..133 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@129..133 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@129..133 - 0: IDENT@129..133 "test" [] [] - 2: R_CURLY@133..135 "}" [] [Whitespace(" ")] - 2: FROM_KW@135..140 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@140..151 - 0: JS_STRING_LITERAL@140..151 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@151..170 - 0: WITH_KW@151..156 "with" [] [Whitespace(" ")] - 1: L_CURLY@156..158 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@158..169 - 0: JS_IMPORT_ASSERTION_ENTRY@158..169 - 0: IDENT@158..161 "for" [] [] - 1: COLON@161..163 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@163..169 "\"for\"" [] [Whitespace(" ")] - 3: R_CURLY@169..170 "}" [] [] - 2: (empty) - 4: JS_IMPORT@170..249 - 0: IMPORT_KW@170..178 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@178..248 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@178..187 - 0: JS_IDENTIFIER_BINDING@178..187 - 0: IDENT@178..187 "foo_json" [] [Whitespace(" ")] - 2: FROM_KW@187..192 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@192..203 - 0: JS_STRING_LITERAL@192..203 "\"foo.json\"" [] [Whitespace(" ")] - 4: JS_IMPORT_ASSERTION@203..248 - 0: WITH_KW@203..208 "with" [] [Whitespace(" ")] - 1: L_CURLY@208..210 "{" [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@210..247 - 0: JS_IMPORT_ASSERTION_ENTRY@210..222 - 0: IDENT@210..214 "type" [] [] - 1: COLON@214..216 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@216..222 "\"json\"" [] [] - 1: COMMA@222..224 "," [] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY@224..247 - 0: IDENT@224..238 "hasOwnProperty" [] [] - 1: COLON@238..240 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@240..247 "\"true\"" [] [Whitespace(" ")] - 3: R_CURLY@247..248 "}" [] [] - 2: SEMICOLON@248..249 ";" [] [] - 5: JS_IMPORT@249..282 - 0: IMPORT_KW@249..257 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@257..282 - 0: JS_MODULE_SOURCE@257..261 - 0: JS_STRING_LITERAL@257..261 "\"x\"" [] [Whitespace(" ")] - 1: JS_IMPORT_ASSERTION@261..282 - 0: WITH_KW@261..265 "with" [] [] - 1: L_CURLY@265..268 "{" [Newline("\n")] [Whitespace(" ")] - 2: JS_IMPORT_ASSERTION_ENTRY_LIST@268..281 - 0: JS_IMPORT_ASSERTION_ENTRY@268..281 - 0: IDENT@268..272 "type" [] [] - 1: COLON@272..274 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL@274..281 "\"json\"" [] [Whitespace(" ")] - 3: R_CURLY@281..282 "}" [] [] - 2: (empty) - 4: EOF@282..283 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.rast b/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.rast deleted file mode 100644 index ec97ea07d0a3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.rast +++ /dev/null @@ -1,49 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@7..13 "\"test\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@14..22 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportBareClause { - source: JsModuleSource { - value_token: JS_STRING_LITERAL@22..36 "\"no_semicolon\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@36..37 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..37 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..36 - 0: JS_IMPORT@0..14 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@7..13 - 0: JS_MODULE_SOURCE@7..13 - 0: JS_STRING_LITERAL@7..13 "\"test\"" [] [] - 1: (empty) - 2: SEMICOLON@13..14 ";" [] [] - 1: JS_IMPORT@14..36 - 0: IMPORT_KW@14..22 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_BARE_CLAUSE@22..36 - 0: JS_MODULE_SOURCE@22..36 - 0: JS_STRING_LITERAL@22..36 "\"no_semicolon\"" [] [] - 1: (empty) - 2: (empty) - 4: EOF@36..37 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_call.rast b/crates/biome_js_parser/test_data/inline/ok/import_call.rast deleted file mode 100644 index 34a97d619a80..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_call.rast +++ /dev/null @@ -1,184 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@0..6 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@6..7 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@7..12 "\"foo\"" [] [], - }, - ], - r_paren_token: R_PAREN@12..13 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@13..20 "import" [Newline("\n")] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@20..21 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@21..26 "\"foo\"" [] [], - }, - COMMA@26..28 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@30..36 "assert" [] [], - }, - colon_token: COLON@36..38 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@40..44 "type" [] [], - }, - colon_token: COLON@44..46 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@46..53 "'json'" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@53..55 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@55..56 "}" [] [], - }, - ], - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@57..64 "import" [Newline("\n")] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@64..65 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@65..70 "\"foo\"" [] [], - }, - COMMA@70..72 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@72..74 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@74..78 "with" [] [], - }, - colon_token: COLON@78..80 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@82..99 "'resolution-mode'" [] [], - }, - colon_token: COLON@99..101 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@101..110 "'import'" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@110..112 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@112..113 "}" [] [], - }, - ], - r_paren_token: R_PAREN@113..114 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@114..115 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..115 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..114 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_IMPORT_CALL_EXPRESSION@0..13 - 0: IMPORT_KW@0..6 "import" [] [] - 1: JS_CALL_ARGUMENTS@6..13 - 0: L_PAREN@6..7 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@7..12 - 0: JS_STRING_LITERAL_EXPRESSION@7..12 - 0: JS_STRING_LITERAL@7..12 "\"foo\"" [] [] - 2: R_PAREN@12..13 ")" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@13..57 - 0: JS_IMPORT_CALL_EXPRESSION@13..57 - 0: IMPORT_KW@13..20 "import" [Newline("\n")] [] - 1: JS_CALL_ARGUMENTS@20..57 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@21..56 - 0: JS_STRING_LITERAL_EXPRESSION@21..26 - 0: JS_STRING_LITERAL@21..26 "\"foo\"" [] [] - 1: COMMA@26..28 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@28..56 - 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@30..55 - 0: JS_PROPERTY_OBJECT_MEMBER@30..55 - 0: JS_LITERAL_MEMBER_NAME@30..36 - 0: IDENT@30..36 "assert" [] [] - 1: COLON@36..38 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@38..55 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@40..53 - 0: JS_PROPERTY_OBJECT_MEMBER@40..53 - 0: JS_LITERAL_MEMBER_NAME@40..44 - 0: IDENT@40..44 "type" [] [] - 1: COLON@44..46 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@46..53 - 0: JS_STRING_LITERAL@46..53 "'json'" [] [Whitespace(" ")] - 2: R_CURLY@53..55 "}" [] [Whitespace(" ")] - 2: R_CURLY@55..56 "}" [] [] - 2: R_PAREN@56..57 ")" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@57..114 - 0: JS_IMPORT_CALL_EXPRESSION@57..114 - 0: IMPORT_KW@57..64 "import" [Newline("\n")] [] - 1: JS_CALL_ARGUMENTS@64..114 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@65..113 - 0: JS_STRING_LITERAL_EXPRESSION@65..70 - 0: JS_STRING_LITERAL@65..70 "\"foo\"" [] [] - 1: COMMA@70..72 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@72..113 - 0: L_CURLY@72..74 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@74..112 - 0: JS_PROPERTY_OBJECT_MEMBER@74..112 - 0: JS_LITERAL_MEMBER_NAME@74..78 - 0: IDENT@74..78 "with" [] [] - 1: COLON@78..80 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@80..112 - 0: L_CURLY@80..82 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@82..110 - 0: JS_PROPERTY_OBJECT_MEMBER@82..110 - 0: JS_LITERAL_MEMBER_NAME@82..99 - 0: JS_STRING_LITERAL@82..99 "'resolution-mode'" [] [] - 1: COLON@99..101 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@101..110 - 0: JS_STRING_LITERAL@101..110 "'import'" [] [Whitespace(" ")] - 2: R_CURLY@110..112 "}" [] [Whitespace(" ")] - 2: R_CURLY@112..113 "}" [] [] - 2: R_PAREN@113..114 ")" [] [] - 1: (empty) - 4: EOF@114..115 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_decl.rast b/crates/biome_js_parser/test_data/inline/ok/import_decl.rast deleted file mode 100644 index 7b59b6d531a6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_decl.rast +++ /dev/null @@ -1,48 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamespaceClause { - type_token: missing (optional), - namespace_specifier: JsNamespaceImportSpecifier { - star_token: STAR@7..9 "*" [] [Whitespace(" ")], - as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@12..16 "foo" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@21..26 "\"bla\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: JS_IMPORT@0..27 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMESPACE_CLAUSE@7..26 - 0: (empty) - 1: JS_NAMESPACE_IMPORT_SPECIFIER@7..16 - 0: STAR@7..9 "*" [] [Whitespace(" ")] - 1: AS_KW@9..12 "as" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@12..16 - 0: IDENT@12..16 "foo" [] [Whitespace(" ")] - 2: FROM_KW@16..21 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@21..26 - 0: JS_STRING_LITERAL@21..26 "\"bla\"" [] [] - 4: (empty) - 2: SEMICOLON@26..27 ";" [] [] - 4: EOF@27..28 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clause.rast b/crates/biome_js_parser/test_data/inline/ok/import_default_clause.rast deleted file mode 100644 index 256867c59fe5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_default_clause.rast +++ /dev/null @@ -1,44 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@7..11 "foo" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@11..16 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@16..22 "\"test\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: JS_IMPORT@0..23 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@7..22 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@7..11 - 0: JS_IDENTIFIER_BINDING@7..11 - 0: IDENT@7..11 "foo" [] [Whitespace(" ")] - 2: FROM_KW@11..16 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@16..22 - 0: JS_STRING_LITERAL@16..22 "\"test\"" [] [] - 4: (empty) - 2: SEMICOLON@22..23 ";" [] [] - 4: EOF@23..24 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.rast b/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.rast deleted file mode 100644 index 709a24cb7b7f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.rast +++ /dev/null @@ -1,64 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportCombinedClause { - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@7..8 "e" [] [], - }, - }, - comma_token: COMMA@8..10 "," [] [Whitespace(" ")], - specifier: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@10..12 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@12..14 "f" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@21..24 "\"b\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - ], - eof_token: EOF@25..26 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..26 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..25 - 0: JS_IMPORT@0..25 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_COMBINED_CLAUSE@7..24 - 0: JS_DEFAULT_IMPORT_SPECIFIER@7..8 - 0: JS_IDENTIFIER_BINDING@7..8 - 0: IDENT@7..8 "e" [] [] - 1: COMMA@8..10 "," [] [Whitespace(" ")] - 2: JS_NAMED_IMPORT_SPECIFIERS@10..16 - 0: L_CURLY@10..12 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@12..14 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@12..14 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@12..14 - 0: IDENT@12..14 "f" [] [Whitespace(" ")] - 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] - 3: FROM_KW@16..21 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@21..24 - 0: JS_STRING_LITERAL@21..24 "\"b\"" [] [] - 5: (empty) - 2: SEMICOLON@24..25 ";" [] [] - 4: EOF@25..26 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_meta.rast b/crates/biome_js_parser/test_data/inline/ok/import_meta.rast deleted file mode 100644 index ab9c1eb868f1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_meta.rast +++ /dev/null @@ -1,29 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsImportMetaExpression { - import_token: IMPORT_KW@0..6 "import" [] [], - dot_token: DOT@6..7 "." [] [], - meta_token: META@7..11 "meta" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_EXPRESSION_STATEMENT@0..11 - 0: JS_IMPORT_META_EXPRESSION@0..11 - 0: IMPORT_KW@0..6 "import" [] [] - 1: DOT@6..7 "." [] [] - 2: META@7..11 "meta" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_named_clause.rast b/crates/biome_js_parser/test_data/inline/ok/import_named_clause.rast deleted file mode 100644 index 41242827a991..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_named_clause.rast +++ /dev/null @@ -1,198 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@7..8 "{" [] [], - specifiers: JsNamedImportSpecifierList [], - r_curly_token: R_CURLY@8..10 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@10..15 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@15..18 "\"a\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@19..27 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@29..30 "a" [] [], - }, - }, - COMMA@30..32 "," [] [Whitespace(" ")], - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@32..33 "b" [] [], - }, - }, - COMMA@33..35 "," [] [Whitespace(" ")], - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@35..36 "c" [] [], - }, - }, - COMMA@36..38 "," [] [Whitespace(" ")], - ], - r_curly_token: R_CURLY@38..40 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@40..45 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@45..48 "\"b\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@48..49 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@49..57 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@59..61 "f" [] [Whitespace(" ")], - }, - as_token: AS_KW@61..64 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@64..65 "x" [] [], - }, - }, - COMMA@65..67 "," [] [Whitespace(" ")], - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@67..75 "default" [] [Whitespace(" ")], - }, - as_token: AS_KW@75..78 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@78..79 "w" [] [], - }, - }, - COMMA@79..81 "," [] [Whitespace(" ")], - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: JS_STRING_LITERAL@81..89 "\"a-b-c\"" [] [Whitespace(" ")], - }, - as_token: AS_KW@89..92 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@92..94 "y" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@94..96 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@96..101 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@101..104 "\"b\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@104..105 ";" [] [], - }, - ], - eof_token: EOF@105..106 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..106 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..105 - 0: JS_IMPORT@0..19 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@7..18 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@7..10 - 0: L_CURLY@7..8 "{" [] [] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@8..8 - 2: R_CURLY@8..10 "}" [] [Whitespace(" ")] - 2: FROM_KW@10..15 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@15..18 - 0: JS_STRING_LITERAL@15..18 "\"a\"" [] [] - 4: (empty) - 2: SEMICOLON@18..19 ";" [] [] - 1: JS_IMPORT@19..49 - 0: IMPORT_KW@19..27 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@27..48 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@27..40 - 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@29..38 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@29..30 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "a" [] [] - 1: COMMA@30..32 "," [] [Whitespace(" ")] - 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@32..33 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "b" [] [] - 3: COMMA@33..35 "," [] [Whitespace(" ")] - 4: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@35..36 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@35..36 - 0: IDENT@35..36 "c" [] [] - 5: COMMA@36..38 "," [] [Whitespace(" ")] - 2: R_CURLY@38..40 "}" [] [Whitespace(" ")] - 2: FROM_KW@40..45 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@45..48 - 0: JS_STRING_LITERAL@45..48 "\"b\"" [] [] - 4: (empty) - 2: SEMICOLON@48..49 ";" [] [] - 2: JS_IMPORT@49..105 - 0: IMPORT_KW@49..57 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@57..104 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@57..96 - 0: L_CURLY@57..59 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@59..94 - 0: JS_NAMED_IMPORT_SPECIFIER@59..65 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@59..61 - 0: IDENT@59..61 "f" [] [Whitespace(" ")] - 2: AS_KW@61..64 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@64..65 - 0: IDENT@64..65 "x" [] [] - 1: COMMA@65..67 "," [] [Whitespace(" ")] - 2: JS_NAMED_IMPORT_SPECIFIER@67..79 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@67..75 - 0: IDENT@67..75 "default" [] [Whitespace(" ")] - 2: AS_KW@75..78 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@78..79 - 0: IDENT@78..79 "w" [] [] - 3: COMMA@79..81 "," [] [Whitespace(" ")] - 4: JS_NAMED_IMPORT_SPECIFIER@81..94 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@81..89 - 0: JS_STRING_LITERAL@81..89 "\"a-b-c\"" [] [Whitespace(" ")] - 2: AS_KW@89..92 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@92..94 - 0: IDENT@92..94 "y" [] [Whitespace(" ")] - 2: R_CURLY@94..96 "}" [] [Whitespace(" ")] - 2: FROM_KW@96..101 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@101..104 - 0: JS_STRING_LITERAL@101..104 "\"b\"" [] [] - 4: (empty) - 2: SEMICOLON@104..105 ";" [] [] - 4: EOF@105..106 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.rast b/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.rast deleted file mode 100644 index fd7894462623..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.rast +++ /dev/null @@ -1,122 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..12 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - JsForStatement { - for_token: FOR_KW@17..22 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@22..23 "(" [] [], - initializer: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..26 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@26..27 "(" [] [], - args: JsCallArgumentList [ - JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@27..34 "\"call\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@34..37 "in" [] [Whitespace(" ")], - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@37..40 "foo" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@40..41 ")" [] [], - }, - }, - first_semi_token: SEMICOLON@41..42 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@42..43 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@45..46 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@46..47 "}" [] [], - }, - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_FUNCTION_DECLARATION@0..17 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..12 - 0: IDENT@9..12 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@12..15 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..13 - 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@15..17 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..16 - 3: R_CURLY@16..17 "}" [] [] - 1: JS_FOR_STATEMENT@17..47 - 0: FOR_KW@17..22 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@22..23 "(" [] [] - 2: JS_CALL_EXPRESSION@23..41 - 0: JS_IDENTIFIER_EXPRESSION@23..26 - 0: JS_REFERENCE_IDENTIFIER@23..26 - 0: IDENT@23..26 "foo" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@26..41 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@27..40 - 0: JS_IN_EXPRESSION@27..40 - 0: JS_STRING_LITERAL_EXPRESSION@27..34 - 0: JS_STRING_LITERAL@27..34 "\"call\"" [] [Whitespace(" ")] - 1: IN_KW@34..37 "in" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@37..40 - 0: JS_REFERENCE_IDENTIFIER@37..40 - 0: IDENT@37..40 "foo" [] [] - 2: R_PAREN@40..41 ")" [] [] - 3: SEMICOLON@41..42 ";" [] [] - 4: (empty) - 5: SEMICOLON@42..43 ";" [] [] - 6: (empty) - 7: R_PAREN@43..45 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@45..47 - 0: L_CURLY@45..46 "{" [] [] - 1: JS_STATEMENT_LIST@46..46 - 2: R_CURLY@46..47 "}" [] [] - 4: EOF@47..48 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/issue_2790.rast b/crates/biome_js_parser/test_data/inline/ok/issue_2790.rast deleted file mode 100644 index e85e7bac8926..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/issue_2790.rast +++ /dev/null @@ -1,106 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@7..8 "{" [] [], - readonly_modifier: TsMappedTypeReadonlyModifierClause { - operator_token: missing (optional), - readonly_token: READONLY_KW@8..20 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - l_brack_token: L_BRACK@20..21 "[" [] [], - property_name: TsTypeParameterName { - ident_token: IDENT@21..23 "A" [] [Whitespace(" ")], - }, - in_token: IN_KW@23..26 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@26..32 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@32..33 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@33..34 "]" [] [], - optional_modifier: TsMappedTypeOptionalModifierClause { - operator_token: missing (optional), - question_mark_token: QUESTION@34..35 "?" [] [], - }, - mapped_type: TsTypeAnnotation { - colon_token: COLON@35..37 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@37..40 "any" [] [], - }, - }, - semicolon_token: SEMICOLON@40..41 ";" [] [], - r_curly_token: R_CURLY@41..43 "}" [Newline("\n")] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: JS_VARIABLE_STATEMENT@0..44 - 0: JS_VARIABLE_DECLARATION@0..43 - 0: (empty) - 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..43 - 0: JS_VARIABLE_DECLARATOR@4..43 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "x" [] [] - 1: TS_TYPE_ANNOTATION@5..43 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_MAPPED_TYPE@7..43 - 0: L_CURLY@7..8 "{" [] [] - 1: TS_MAPPED_TYPE_READONLY_MODIFIER_CLAUSE@8..20 - 0: (empty) - 1: READONLY_KW@8..20 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: L_BRACK@20..21 "[" [] [] - 3: TS_TYPE_PARAMETER_NAME@21..23 - 0: IDENT@21..23 "A" [] [Whitespace(" ")] - 4: IN_KW@23..26 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@26..33 - 0: KEYOF_KW@26..32 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@32..33 - 0: JS_REFERENCE_IDENTIFIER@32..33 - 0: IDENT@32..33 "B" [] [] - 1: (empty) - 6: (empty) - 7: R_BRACK@33..34 "]" [] [] - 8: TS_MAPPED_TYPE_OPTIONAL_MODIFIER_CLAUSE@34..35 - 0: (empty) - 1: QUESTION@34..35 "?" [] [] - 9: TS_TYPE_ANNOTATION@35..40 - 0: COLON@35..37 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@37..40 - 0: ANY_KW@37..40 "any" [] [] - 10: SEMICOLON@40..41 ";" [] [] - 11: R_CURLY@41..43 "}" [Newline("\n")] [] - 2: (empty) - 1: SEMICOLON@43..44 ";" [] [] - 4: EOF@44..45 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.rast b/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.rast deleted file mode 100644 index 6f548575b1e2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.rast +++ /dev/null @@ -1,196 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@12..24 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@24..26 "a" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@26..28 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@28..29 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@29..30 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsAccessorModifier { - modifier_token: ACCESSOR_KW@30..44 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@44..46 "b" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@46..48 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@48..49 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@49..50 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@50..62 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@62..71 "accessor" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@71..73 "c" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@75..76 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@76..77 ";" [] [], - }, - ], - r_curly_token: R_CURLY@77..79 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@79..86 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@86..90 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@90..91 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@91..104 "accessor" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@104..112 "foo" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@112..114 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@114..115 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..115 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..114 - 0: JS_CLASS_DECLARATION@0..79 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..77 - 0: JS_PROPERTY_CLASS_MEMBER@12..30 - 0: JS_PROPERTY_MODIFIER_LIST@12..24 - 0: JS_STATIC_MODIFIER@12..24 - 0: STATIC_KW@12..24 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@24..26 - 0: IDENT@24..26 "a" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@26..29 - 0: EQ@26..28 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@28..29 - 0: JS_NUMBER_LITERAL@28..29 "1" [] [] - 4: SEMICOLON@29..30 ";" [] [] - 1: JS_PROPERTY_CLASS_MEMBER@30..50 - 0: JS_PROPERTY_MODIFIER_LIST@30..44 - 0: JS_ACCESSOR_MODIFIER@30..44 - 0: ACCESSOR_KW@30..44 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@44..46 - 0: IDENT@44..46 "b" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@46..49 - 0: EQ@46..48 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@48..49 - 0: JS_NUMBER_LITERAL@48..49 "1" [] [] - 4: SEMICOLON@49..50 ";" [] [] - 2: JS_PROPERTY_CLASS_MEMBER@50..77 - 0: JS_PROPERTY_MODIFIER_LIST@50..71 - 0: JS_STATIC_MODIFIER@50..62 - 0: STATIC_KW@50..62 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_ACCESSOR_MODIFIER@62..71 - 0: ACCESSOR_KW@62..71 "accessor" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@71..73 - 0: IDENT@71..73 "c" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@73..76 - 0: EQ@73..75 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@75..76 - 0: JS_NUMBER_LITERAL@75..76 "1" [] [] - 4: SEMICOLON@76..77 ";" [] [] - 9: R_CURLY@77..79 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@79..114 - 0: JS_DECORATOR_LIST@79..79 - 1: (empty) - 2: CLASS_KW@79..86 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@86..90 - 0: IDENT@86..90 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@90..91 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@91..112 - 0: JS_PROPERTY_CLASS_MEMBER@91..104 - 0: JS_PROPERTY_MODIFIER_LIST@91..91 - 1: JS_LITERAL_MEMBER_NAME@91..104 - 0: IDENT@91..104 "accessor" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@104..112 - 0: JS_PROPERTY_MODIFIER_LIST@104..104 - 1: JS_LITERAL_MEMBER_NAME@104..112 - 0: IDENT@104..112 "foo" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: (empty) - 9: R_CURLY@112..114 "}" [Newline("\n")] [] - 4: EOF@114..115 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.rast b/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.rast deleted file mode 100644 index 6a8f12240899..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.rast +++ /dev/null @@ -1,67 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@1..2 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@2..5 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@5..6 ")" [] [], - }, - r_paren_token: R_PAREN@6..7 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@7..9 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..12 "foo" [] [], - }, - }, - ], - r_paren_token: R_PAREN@12..13 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_CALL_EXPRESSION@0..13 - 0: JS_PARENTHESIZED_EXPRESSION@0..7 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@1..6 - 0: L_PAREN@1..2 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@2..5 - 0: JS_REFERENCE_IDENTIFIER@2..5 - 0: IDENT@2..5 "foo" [] [] - 2: R_PAREN@5..6 ")" [] [] - 2: R_PAREN@6..7 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@7..13 - 0: L_PAREN@7..9 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@9..12 - 0: JS_IDENTIFIER_EXPRESSION@9..12 - 0: JS_REFERENCE_IDENTIFIER@9..12 - 0: IDENT@9..12 "foo" [] [] - 2: R_PAREN@12..13 ")" [] [] - 1: (empty) - 4: EOF@13..14 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.rast b/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.rast deleted file mode 100644 index af116e4f6398..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.rast +++ /dev/null @@ -1,197 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@0..7 "delete" [] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..8 "a" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@8..9 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@9..15 "'test'" [] [], - }, - r_brack_token: R_BRACK@15..16 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: VOID_KW@17..23 "void" [Newline("\n")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..24 "a" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: TYPEOF_KW@25..33 "typeof" [Newline("\n")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..34 "a" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: PLUS@35..37 "+" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@37..38 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: MINUS@39..41 "-" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@41..42 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: TILDE@43..45 "~" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@45..46 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: BANG@47..49 "!" [Newline("\n")] [], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@49..53 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@53..54 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsUnaryExpression { - operator_token: MINUS@54..56 "-" [Newline("\n")] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..58 "a" [] [Whitespace(" ")], - }, - }, - }, - operator_token: PLUS@58..60 "+" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: MINUS@60..61 "-" [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@61..63 "b" [] [Whitespace(" ")], - }, - }, - }, - }, - operator_token: PLUS@63..65 "+" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: PLUS@65..66 "+" [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@66..67 "a" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@67..68 ";" [] [], - }, - ], - eof_token: EOF@68..69 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..69 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..68 - 0: JS_EXPRESSION_STATEMENT@0..17 - 0: JS_UNARY_EXPRESSION@0..16 - 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@7..16 - 0: JS_IDENTIFIER_EXPRESSION@7..8 - 0: JS_REFERENCE_IDENTIFIER@7..8 - 0: IDENT@7..8 "a" [] [] - 1: (empty) - 2: L_BRACK@8..9 "[" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@9..15 - 0: JS_STRING_LITERAL@9..15 "'test'" [] [] - 4: R_BRACK@15..16 "]" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@17..25 - 0: JS_UNARY_EXPRESSION@17..24 - 0: VOID_KW@17..23 "void" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@23..24 - 0: JS_REFERENCE_IDENTIFIER@23..24 - 0: IDENT@23..24 "a" [] [] - 1: SEMICOLON@24..25 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@25..35 - 0: JS_UNARY_EXPRESSION@25..34 - 0: TYPEOF_KW@25..33 "typeof" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@33..34 - 0: JS_REFERENCE_IDENTIFIER@33..34 - 0: IDENT@33..34 "a" [] [] - 1: SEMICOLON@34..35 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@35..39 - 0: JS_UNARY_EXPRESSION@35..38 - 0: PLUS@35..37 "+" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@37..38 - 0: JS_NUMBER_LITERAL@37..38 "1" [] [] - 1: SEMICOLON@38..39 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@39..43 - 0: JS_UNARY_EXPRESSION@39..42 - 0: MINUS@39..41 "-" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@41..42 - 0: JS_NUMBER_LITERAL@41..42 "1" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@43..47 - 0: JS_UNARY_EXPRESSION@43..46 - 0: TILDE@43..45 "~" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@45..46 - 0: JS_NUMBER_LITERAL@45..46 "1" [] [] - 1: SEMICOLON@46..47 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@47..54 - 0: JS_UNARY_EXPRESSION@47..53 - 0: BANG@47..49 "!" [Newline("\n")] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@49..53 - 0: TRUE_KW@49..53 "true" [] [] - 1: SEMICOLON@53..54 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@54..68 - 0: JS_BINARY_EXPRESSION@54..67 - 0: JS_BINARY_EXPRESSION@54..63 - 0: JS_UNARY_EXPRESSION@54..58 - 0: MINUS@54..56 "-" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@56..58 - 0: JS_REFERENCE_IDENTIFIER@56..58 - 0: IDENT@56..58 "a" [] [Whitespace(" ")] - 1: PLUS@58..60 "+" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@60..63 - 0: MINUS@60..61 "-" [] [] - 1: JS_IDENTIFIER_EXPRESSION@61..63 - 0: JS_REFERENCE_IDENTIFIER@61..63 - 0: IDENT@61..63 "b" [] [Whitespace(" ")] - 1: PLUS@63..65 "+" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@65..67 - 0: PLUS@65..66 "+" [] [] - 1: JS_IDENTIFIER_EXPRESSION@66..67 - 0: JS_REFERENCE_IDENTIFIER@66..67 - 0: IDENT@66..67 "a" [] [] - 1: SEMICOLON@67..68 ";" [] [] - 4: EOF@68..69 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.rast deleted file mode 100644 index 6da2234985d2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.rast +++ /dev/null @@ -1,209 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..10 "a-b-c-d-e" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@11..12 "<" [] [], - slash_token: SLASH@12..13 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@13..22 "a-b-c-d-e" [] [], - }, - r_angle_token: R_ANGLE@22..23 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@24..26 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@26..36 "a-b-c-d-e" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@36..37 "/" [] [], - r_angle_token: R_ANGLE@37..38 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@39..41 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@41..44 "if" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@44..45 "/" [] [], - r_angle_token: R_ANGLE@45..46 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@47..49 "<" [Newline("\n")] [], - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@49..58 "namespace" [] [], - }, - colon_token: COLON@58..59 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@59..63 "name" [] [], - }, - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@63..64 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@64..65 "<" [] [], - slash_token: SLASH@65..66 "/" [] [], - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@66..75 "namespace" [] [], - }, - colon_token: COLON@75..76 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@76..80 "name" [] [], - }, - }, - r_angle_token: R_ANGLE@80..81 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@81..82 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@82..84 "<" [Newline("\n")] [], - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@84..101 "dashed-namespaced" [] [], - }, - colon_token: COLON@101..102 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@102..114 "dashed-name" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@114..115 "/" [] [], - r_angle_token: R_ANGLE@115..116 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@116..117 ";" [] [], - }, - ], - eof_token: EOF@117..118 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..118 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..117 - 0: JS_EXPRESSION_STATEMENT@0..24 - 0: JSX_TAG_EXPRESSION@0..23 - 0: JSX_ELEMENT@0..23 - 0: JSX_OPENING_ELEMENT@0..11 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..10 - 0: JSX_IDENT@1..10 "a-b-c-d-e" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@10..10 - 4: R_ANGLE@10..11 ">" [] [] - 1: JSX_CHILD_LIST@11..11 - 2: JSX_CLOSING_ELEMENT@11..23 - 0: L_ANGLE@11..12 "<" [] [] - 1: SLASH@12..13 "/" [] [] - 2: JSX_NAME@13..22 - 0: JSX_IDENT@13..22 "a-b-c-d-e" [] [] - 3: R_ANGLE@22..23 ">" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@24..39 - 0: JSX_TAG_EXPRESSION@24..38 - 0: JSX_SELF_CLOSING_ELEMENT@24..38 - 0: L_ANGLE@24..26 "<" [Newline("\n")] [] - 1: JSX_NAME@26..36 - 0: JSX_IDENT@26..36 "a-b-c-d-e" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@36..36 - 4: SLASH@36..37 "/" [] [] - 5: R_ANGLE@37..38 ">" [] [] - 1: SEMICOLON@38..39 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@39..47 - 0: JSX_TAG_EXPRESSION@39..46 - 0: JSX_SELF_CLOSING_ELEMENT@39..46 - 0: L_ANGLE@39..41 "<" [Newline("\n")] [] - 1: JSX_NAME@41..44 - 0: JSX_IDENT@41..44 "if" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@44..44 - 4: SLASH@44..45 "/" [] [] - 5: R_ANGLE@45..46 ">" [] [] - 1: SEMICOLON@46..47 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@47..82 - 0: JSX_TAG_EXPRESSION@47..81 - 0: JSX_ELEMENT@47..81 - 0: JSX_OPENING_ELEMENT@47..64 - 0: L_ANGLE@47..49 "<" [Newline("\n")] [] - 1: JSX_NAMESPACE_NAME@49..63 - 0: JSX_NAME@49..58 - 0: JSX_IDENT@49..58 "namespace" [] [] - 1: COLON@58..59 ":" [] [] - 2: JSX_NAME@59..63 - 0: JSX_IDENT@59..63 "name" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@63..63 - 4: R_ANGLE@63..64 ">" [] [] - 1: JSX_CHILD_LIST@64..64 - 2: JSX_CLOSING_ELEMENT@64..81 - 0: L_ANGLE@64..65 "<" [] [] - 1: SLASH@65..66 "/" [] [] - 2: JSX_NAMESPACE_NAME@66..80 - 0: JSX_NAME@66..75 - 0: JSX_IDENT@66..75 "namespace" [] [] - 1: COLON@75..76 ":" [] [] - 2: JSX_NAME@76..80 - 0: JSX_IDENT@76..80 "name" [] [] - 3: R_ANGLE@80..81 ">" [] [] - 1: SEMICOLON@81..82 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@82..117 - 0: JSX_TAG_EXPRESSION@82..116 - 0: JSX_SELF_CLOSING_ELEMENT@82..116 - 0: L_ANGLE@82..84 "<" [Newline("\n")] [] - 1: JSX_NAMESPACE_NAME@84..114 - 0: JSX_NAME@84..101 - 0: JSX_IDENT@84..101 "dashed-namespaced" [] [] - 1: COLON@101..102 ":" [] [] - 2: JSX_NAME@102..114 - 0: JSX_IDENT@102..114 "dashed-name" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@114..114 - 4: SLASH@114..115 "/" [] [] - 5: R_ANGLE@115..116 ">" [] [] - 1: SEMICOLON@116..117 ";" [] [] - 4: EOF@117..118 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast deleted file mode 100644 index 5fa1708dfe54..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast +++ /dev/null @@ -1,134 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "bar" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@4..6 "?" [] [Whitespace(" ")], - consequent: JsParenthesizedExpression { - l_paren_token: L_PAREN@6..7 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..10 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@10..12 ")" [] [Whitespace(" ")], - }, - colon_token: COLON@12..14 ":" [] [Whitespace(" ")], - alternate: JsParenthesizedExpression { - l_paren_token: L_PAREN@14..15 "(" [] [], - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@15..16 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@16..17 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@17..18 ">" [] [], - }, - children: JsxChildList [ - JsxExpressionChild { - l_curly_token: L_CURLY@18..19 "{" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@19..20 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@28..29 "<" [] [], - slash_token: SLASH@29..30 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@30..31 "a" [] [], - }, - r_angle_token: R_ANGLE@31..32 ">" [] [], - }, - }, - }, - r_paren_token: R_PAREN@32..33 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: JS_EXPRESSION_STATEMENT@0..34 - 0: JS_CONDITIONAL_EXPRESSION@0..33 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "bar" [] [Whitespace(" ")] - 1: QUESTION@4..6 "?" [] [Whitespace(" ")] - 2: JS_PARENTHESIZED_EXPRESSION@6..12 - 0: L_PAREN@6..7 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@7..10 - 0: JS_REFERENCE_IDENTIFIER@7..10 - 0: IDENT@7..10 "foo" [] [] - 2: R_PAREN@10..12 ")" [] [Whitespace(" ")] - 3: COLON@12..14 ":" [] [Whitespace(" ")] - 4: JS_PARENTHESIZED_EXPRESSION@14..33 - 0: L_PAREN@14..15 "(" [] [] - 1: JSX_TAG_EXPRESSION@15..32 - 0: JSX_ELEMENT@15..32 - 0: JSX_OPENING_ELEMENT@15..18 - 0: L_ANGLE@15..16 "<" [] [] - 1: JSX_NAME@16..17 - 0: JSX_IDENT@16..17 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@17..17 - 4: R_ANGLE@17..18 ">" [] [] - 1: JSX_CHILD_LIST@18..28 - 0: JSX_EXPRESSION_CHILD@18..28 - 0: L_CURLY@18..19 "{" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@19..27 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@19..22 - 0: L_PAREN@19..20 "(" [] [] - 1: JS_PARAMETER_LIST@20..20 - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..26 - 3: R_CURLY@26..27 "}" [] [] - 2: R_CURLY@27..28 "}" [] [] - 2: JSX_CLOSING_ELEMENT@28..32 - 0: L_ANGLE@28..29 "<" [] [] - 1: SLASH@29..30 "/" [] [] - 2: JSX_NAME@30..31 - 0: JSX_IDENT@30..31 "a" [] [] - 3: R_ANGLE@31..32 ">" [] [] - 2: R_PAREN@32..33 ")" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.rast deleted file mode 100644 index 843484229bae..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.rast +++ /dev/null @@ -1,1507 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "x" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@5..6 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@6..11 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@11..12 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@13..18 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@18..19 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@25..28 "key" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@34..36 "f" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@44..45 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@45..46 "}" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@47..49 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@49..52 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@52..53 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@53..56 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@56..57 "{" [] [], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@57..58 "1" [] [], - }, - r_curly_token: R_CURLY@58..59 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@59..62 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@62..63 "{" [] [], - expression: JsBigintLiteralExpression { - value_token: JS_BIGINT_LITERAL@63..80 "9007199254740991n" [] [], - }, - r_curly_token: R_CURLY@80..81 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@81..84 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@84..85 "{" [] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@85..87 "\"\"" [] [], - }, - r_curly_token: R_CURLY@87..88 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@88..91 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@91..92 "{" [] [], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@92..96 "true" [] [], - }, - r_curly_token: R_CURLY@96..97 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@97..100 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@100..101 "{" [] [], - expression: JsNullLiteralExpression { - value_token: NULL_KW@101..105 "null" [] [], - }, - r_curly_token: R_CURLY@105..106 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@106..109 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@109..110 "{" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@110..119 "undefined" [] [], - }, - }, - r_curly_token: R_CURLY@119..120 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@120..123 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@123..124 "{" [] [], - expression: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@124..127 "/a/" [] [], - }, - r_curly_token: R_CURLY@127..128 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@128..131 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@131..132 "{" [] [], - expression: JsArrayExpression { - l_brack_token: L_BRACK@132..133 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@133..134 "]" [] [], - }, - r_curly_token: R_CURLY@134..135 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@135..138 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@138..139 "{" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@139..141 "x" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@141..144 "=>" [] [Whitespace(" ")], - body: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@144..151 "console" [] [], - }, - }, - operator_token: DOT@151..152 "." [] [], - member: JsName { - value_token: IDENT@152..155 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@155..156 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@156..157 "x" [] [], - }, - }, - ], - r_paren_token: R_PAREN@157..158 ")" [] [], - }, - }, - }, - r_curly_token: R_CURLY@158..159 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@159..162 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@162..163 "{" [] [], - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@163..165 "x" [] [Whitespace(" ")], - }, - operator_token: EQ@165..167 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@167..168 "1" [] [], - }, - }, - r_curly_token: R_CURLY@168..169 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@169..172 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@172..173 "{" [] [], - expression: JsAwaitExpression { - await_token: AWAIT_KW@173..179 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@179..180 "x" [] [], - }, - }, - }, - r_curly_token: R_CURLY@180..181 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@181..184 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@184..185 "{" [] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@185..187 "1" [] [Whitespace(" ")], - }, - operator_token: PLUS@187..189 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@189..190 "1" [] [], - }, - }, - r_curly_token: R_CURLY@190..191 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@191..194 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@194..195 "{" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@195..196 "f" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@196..197 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@197..198 ")" [] [], - }, - }, - r_curly_token: R_CURLY@198..199 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@199..202 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@202..203 "{" [] [], - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@203..204 "a" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@204..205 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@205..206 "b" [] [], - }, - }, - r_brack_token: R_BRACK@206..207 "]" [] [], - }, - r_curly_token: R_CURLY@207..208 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@208..211 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@211..212 "{" [] [], - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@212..213 "a" [] [], - }, - }, - question_mark_token: QUESTION@213..214 "?" [] [], - consequent: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@214..215 "1" [] [], - }, - colon_token: COLON@215..216 ":" [] [], - alternate: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@216..217 "2" [] [], - }, - }, - r_curly_token: R_CURLY@217..218 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@218..221 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@221..222 "{" [] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@222..231 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@231..232 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@232..233 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@233..235 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@235..236 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@236..237 "}" [] [], - }, - }, - r_curly_token: R_CURLY@237..238 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@238..241 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@241..242 "{" [] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@242..251 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@251..252 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@252..254 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@254..255 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@255..256 "}" [] [], - }, - }, - r_curly_token: R_CURLY@256..257 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@257..260 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@260..261 "{" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@261..262 "a" [] [], - }, - }, - r_curly_token: R_CURLY@262..263 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@263..266 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@266..267 "{" [] [], - expression: JsImportCallExpression { - import_token: IMPORT_KW@267..273 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@273..274 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@274..280 "\"a.js\"" [] [], - }, - ], - r_paren_token: R_PAREN@280..281 ")" [] [], - }, - }, - r_curly_token: R_CURLY@281..282 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@282..285 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@285..286 "{" [] [], - expression: JsInExpression { - property: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@286..290 "key" [] [Whitespace(" ")], - }, - }, - in_token: IN_KW@290..293 "in" [] [Whitespace(" ")], - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@293..294 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@294..295 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@295..298 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@298..299 "{" [] [], - expression: JsInstanceofExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@299..301 "a" [] [Whitespace(" ")], - }, - }, - instanceof_token: INSTANCEOF_KW@301..312 "instanceof" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@312..318 "Object" [] [], - }, - }, - }, - r_curly_token: R_CURLY@318..319 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@319..322 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@322..323 "{" [] [], - expression: JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@323..325 "a" [] [Whitespace(" ")], - }, - }, - operator_token: AMP2@325..328 "&&" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@328..329 "b" [] [], - }, - }, - }, - r_curly_token: R_CURLY@329..330 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@330..333 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@333..334 "{" [] [], - expression: JsNewExpression { - new_token: NEW_KW@334..338 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@338..339 "f" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@339..340 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@340..341 ")" [] [], - }, - }, - r_curly_token: R_CURLY@341..342 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@342..345 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@345..346 "{" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@346..347 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@347..348 "}" [] [], - }, - r_curly_token: R_CURLY@348..349 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@349..352 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@352..353 "{" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@353..354 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@354..355 "a" [] [], - }, - }, - r_paren_token: R_PAREN@355..356 ")" [] [], - }, - r_curly_token: R_CURLY@356..357 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@357..360 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@360..361 "{" [] [], - expression: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@361..362 "a" [] [], - }, - operator_token: PLUS2@362..364 "++" [] [], - }, - r_curly_token: R_CURLY@364..365 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@365..368 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@368..369 "{" [] [], - expression: JsPreUpdateExpression { - operator_token: PLUS2@369..371 "++" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@371..372 "a" [] [], - }, - }, - r_curly_token: R_CURLY@372..373 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@373..376 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@376..377 "{" [] [], - expression: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@377..378 "a" [] [], - }, - }, - comma_token: COMMA@378..379 "," [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@379..380 "b" [] [], - }, - }, - }, - r_curly_token: R_CURLY@380..381 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@381..384 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@384..385 "{" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@385..386 "a" [] [], - }, - }, - operator_token: DOT@386..387 "." [] [], - member: JsName { - value_token: IDENT@387..388 "b" [] [], - }, - }, - r_curly_token: R_CURLY@388..389 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@389..392 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@392..393 "{" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsSuperExpression { - super_token: SUPER_KW@393..398 "super" [] [], - }, - operator_token: DOT@398..399 "." [] [], - member: JsName { - value_token: IDENT@399..400 "a" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@400..401 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@401..402 ")" [] [], - }, - }, - r_curly_token: R_CURLY@402..403 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@403..406 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@406..407 "{" [] [], - expression: JsThisExpression { - this_token: THIS_KW@407..411 "this" [] [], - }, - r_curly_token: R_CURLY@411..412 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@412..415 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@415..416 "{" [] [], - expression: JsUnaryExpression { - operator_token: DELETE_KW@416..423 "delete" [] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@423..424 "a" [] [], - }, - }, - operator_token: DOT@424..425 "." [] [], - member: JsName { - value_token: IDENT@425..426 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@426..427 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@427..430 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@430..431 "{" [] [], - expression: JsUnaryExpression { - operator_token: VOID_KW@431..436 "void" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@436..437 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@437..438 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@438..441 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@441..442 "{" [] [], - expression: JsUnaryExpression { - operator_token: TYPEOF_KW@442..449 "typeof" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@449..450 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@450..451 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@451..454 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@454..455 "{" [] [], - expression: JsUnaryExpression { - operator_token: PLUS@455..456 "+" [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@456..457 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@457..458 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@458..461 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@461..462 "{" [] [], - expression: JsUnaryExpression { - operator_token: MINUS@462..463 "-" [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@463..464 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@464..465 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@465..468 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@468..469 "{" [] [], - expression: JsUnaryExpression { - operator_token: BANG@469..470 "!" [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@470..471 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@471..472 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@472..475 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@475..476 "{" [] [], - expression: JsUnaryExpression { - operator_token: TILDE@476..477 "~" [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@477..478 "a" [] [], - }, - }, - }, - r_curly_token: R_CURLY@478..479 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@479..482 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@482..483 "{" [] [], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@483..484 "`" [] [], - elements: JsTemplateElementList [], - r_tick_token: BACKTICK@484..485 "`" [] [], - }, - r_curly_token: R_CURLY@485..486 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@486..489 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@489..509 "{" [] [Comments("/* A JSX comment */")], - expression: missing (optional), - r_curly_token: R_CURLY@509..510 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@510..513 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@513..538 "{" [] [Comments("/* Multi\n line\n */")], - expression: missing (optional), - r_curly_token: R_CURLY@538..539 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@539..542 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@542..543 "{" [] [], - expression: missing (optional), - r_curly_token: R_CURLY@543..544 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@544..545 "\n" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@545..546 "<" [] [], - slash_token: SLASH@546..547 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@547..550 "div" [] [], - }, - r_angle_token: R_ANGLE@550..551 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@551..561 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@561..562 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@562..563 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@563..564 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@564..566 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@566..567 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@567..579 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@579..580 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@580..583 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@583..584 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@584..593 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@593..594 "{" [] [], - expression: JsYieldExpression { - yield_token: YIELD_KW@594..600 "yield" [] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@600..601 "a" [] [], - }, - }, - }, - }, - r_curly_token: R_CURLY@601..602 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@602..607 "\n " [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@607..608 "<" [] [], - slash_token: SLASH@608..609 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@609..612 "div" [] [], - }, - r_angle_token: R_ANGLE@612..613 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@613..614 ";" [] [], - }, - ], - r_curly_token: R_CURLY@614..616 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@616..617 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..617 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..616 - 0: JS_VARIABLE_STATEMENT@0..6 - 0: JS_VARIABLE_DECLARATION@0..5 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..5 - 0: JS_VARIABLE_DECLARATOR@4..5 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "x" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_VARIABLE_STATEMENT@6..13 - 0: JS_VARIABLE_DECLARATION@6..12 - 0: (empty) - 1: LET_KW@6..11 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@11..12 - 0: JS_VARIABLE_DECLARATOR@11..12 - 0: JS_IDENTIFIER_BINDING@11..12 - 0: IDENT@11..12 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@12..13 ";" [] [] - 2: JS_VARIABLE_STATEMENT@13..20 - 0: JS_VARIABLE_DECLARATION@13..19 - 0: (empty) - 1: LET_KW@13..18 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@18..19 - 0: JS_VARIABLE_DECLARATOR@18..19 - 0: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "b" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@19..20 ";" [] [] - 3: JS_VARIABLE_STATEMENT@20..29 - 0: JS_VARIABLE_DECLARATION@20..28 - 0: (empty) - 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@25..28 - 0: JS_VARIABLE_DECLARATOR@25..28 - 0: JS_IDENTIFIER_BINDING@25..28 - 0: IDENT@25..28 "key" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@28..29 ";" [] [] - 4: JS_VARIABLE_STATEMENT@29..47 - 0: JS_VARIABLE_DECLARATION@29..46 - 0: (empty) - 1: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@34..46 - 0: JS_VARIABLE_DECLARATOR@34..46 - 0: JS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "f" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@36..46 - 0: EQ@36..38 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@38..46 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@38..41 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..39 - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@44..46 - 0: L_CURLY@44..45 "{" [] [] - 1: JS_DIRECTIVE_LIST@45..45 - 2: JS_STATEMENT_LIST@45..45 - 3: R_CURLY@45..46 "}" [] [] - 1: SEMICOLON@46..47 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@47..551 - 0: JSX_TAG_EXPRESSION@47..551 - 0: JSX_ELEMENT@47..551 - 0: JSX_OPENING_ELEMENT@47..53 - 0: L_ANGLE@47..49 "<" [Newline("\n")] [] - 1: JSX_NAME@49..52 - 0: JSX_IDENT@49..52 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@52..52 - 4: R_ANGLE@52..53 ">" [] [] - 1: JSX_CHILD_LIST@53..545 - 0: JSX_TEXT@53..56 - 0: JSX_TEXT_LITERAL@53..56 "\n " [] [] - 1: JSX_EXPRESSION_CHILD@56..59 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@57..58 - 0: JS_NUMBER_LITERAL@57..58 "1" [] [] - 2: R_CURLY@58..59 "}" [] [] - 2: JSX_TEXT@59..62 - 0: JSX_TEXT_LITERAL@59..62 "\n " [] [] - 3: JSX_EXPRESSION_CHILD@62..81 - 0: L_CURLY@62..63 "{" [] [] - 1: JS_BIGINT_LITERAL_EXPRESSION@63..80 - 0: JS_BIGINT_LITERAL@63..80 "9007199254740991n" [] [] - 2: R_CURLY@80..81 "}" [] [] - 4: JSX_TEXT@81..84 - 0: JSX_TEXT_LITERAL@81..84 "\n " [] [] - 5: JSX_EXPRESSION_CHILD@84..88 - 0: L_CURLY@84..85 "{" [] [] - 1: JS_STRING_LITERAL_EXPRESSION@85..87 - 0: JS_STRING_LITERAL@85..87 "\"\"" [] [] - 2: R_CURLY@87..88 "}" [] [] - 6: JSX_TEXT@88..91 - 0: JSX_TEXT_LITERAL@88..91 "\n " [] [] - 7: JSX_EXPRESSION_CHILD@91..97 - 0: L_CURLY@91..92 "{" [] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@92..96 - 0: TRUE_KW@92..96 "true" [] [] - 2: R_CURLY@96..97 "}" [] [] - 8: JSX_TEXT@97..100 - 0: JSX_TEXT_LITERAL@97..100 "\n " [] [] - 9: JSX_EXPRESSION_CHILD@100..106 - 0: L_CURLY@100..101 "{" [] [] - 1: JS_NULL_LITERAL_EXPRESSION@101..105 - 0: NULL_KW@101..105 "null" [] [] - 2: R_CURLY@105..106 "}" [] [] - 10: JSX_TEXT@106..109 - 0: JSX_TEXT_LITERAL@106..109 "\n " [] [] - 11: JSX_EXPRESSION_CHILD@109..120 - 0: L_CURLY@109..110 "{" [] [] - 1: JS_IDENTIFIER_EXPRESSION@110..119 - 0: JS_REFERENCE_IDENTIFIER@110..119 - 0: IDENT@110..119 "undefined" [] [] - 2: R_CURLY@119..120 "}" [] [] - 12: JSX_TEXT@120..123 - 0: JSX_TEXT_LITERAL@120..123 "\n " [] [] - 13: JSX_EXPRESSION_CHILD@123..128 - 0: L_CURLY@123..124 "{" [] [] - 1: JS_REGEX_LITERAL_EXPRESSION@124..127 - 0: JS_REGEX_LITERAL@124..127 "/a/" [] [] - 2: R_CURLY@127..128 "}" [] [] - 14: JSX_TEXT@128..131 - 0: JSX_TEXT_LITERAL@128..131 "\n " [] [] - 15: JSX_EXPRESSION_CHILD@131..135 - 0: L_CURLY@131..132 "{" [] [] - 1: JS_ARRAY_EXPRESSION@132..134 - 0: L_BRACK@132..133 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@133..133 - 2: R_BRACK@133..134 "]" [] [] - 2: R_CURLY@134..135 "}" [] [] - 16: JSX_TEXT@135..138 - 0: JSX_TEXT_LITERAL@135..138 "\n " [] [] - 17: JSX_EXPRESSION_CHILD@138..159 - 0: L_CURLY@138..139 "{" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@139..158 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@139..141 - 0: IDENT@139..141 "x" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@141..144 "=>" [] [Whitespace(" ")] - 5: JS_CALL_EXPRESSION@144..158 - 0: JS_STATIC_MEMBER_EXPRESSION@144..155 - 0: JS_IDENTIFIER_EXPRESSION@144..151 - 0: JS_REFERENCE_IDENTIFIER@144..151 - 0: IDENT@144..151 "console" [] [] - 1: DOT@151..152 "." [] [] - 2: JS_NAME@152..155 - 0: IDENT@152..155 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@155..158 - 0: L_PAREN@155..156 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@156..157 - 0: JS_IDENTIFIER_EXPRESSION@156..157 - 0: JS_REFERENCE_IDENTIFIER@156..157 - 0: IDENT@156..157 "x" [] [] - 2: R_PAREN@157..158 ")" [] [] - 2: R_CURLY@158..159 "}" [] [] - 18: JSX_TEXT@159..162 - 0: JSX_TEXT_LITERAL@159..162 "\n " [] [] - 19: JSX_EXPRESSION_CHILD@162..169 - 0: L_CURLY@162..163 "{" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@163..168 - 0: JS_IDENTIFIER_ASSIGNMENT@163..165 - 0: IDENT@163..165 "x" [] [Whitespace(" ")] - 1: EQ@165..167 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@167..168 - 0: JS_NUMBER_LITERAL@167..168 "1" [] [] - 2: R_CURLY@168..169 "}" [] [] - 20: JSX_TEXT@169..172 - 0: JSX_TEXT_LITERAL@169..172 "\n " [] [] - 21: JSX_EXPRESSION_CHILD@172..181 - 0: L_CURLY@172..173 "{" [] [] - 1: JS_AWAIT_EXPRESSION@173..180 - 0: AWAIT_KW@173..179 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@179..180 - 0: JS_REFERENCE_IDENTIFIER@179..180 - 0: IDENT@179..180 "x" [] [] - 2: R_CURLY@180..181 "}" [] [] - 22: JSX_TEXT@181..184 - 0: JSX_TEXT_LITERAL@181..184 "\n " [] [] - 23: JSX_EXPRESSION_CHILD@184..191 - 0: L_CURLY@184..185 "{" [] [] - 1: JS_BINARY_EXPRESSION@185..190 - 0: JS_NUMBER_LITERAL_EXPRESSION@185..187 - 0: JS_NUMBER_LITERAL@185..187 "1" [] [Whitespace(" ")] - 1: PLUS@187..189 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@189..190 - 0: JS_NUMBER_LITERAL@189..190 "1" [] [] - 2: R_CURLY@190..191 "}" [] [] - 24: JSX_TEXT@191..194 - 0: JSX_TEXT_LITERAL@191..194 "\n " [] [] - 25: JSX_EXPRESSION_CHILD@194..199 - 0: L_CURLY@194..195 "{" [] [] - 1: JS_CALL_EXPRESSION@195..198 - 0: JS_IDENTIFIER_EXPRESSION@195..196 - 0: JS_REFERENCE_IDENTIFIER@195..196 - 0: IDENT@195..196 "f" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@196..198 - 0: L_PAREN@196..197 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@197..197 - 2: R_PAREN@197..198 ")" [] [] - 2: R_CURLY@198..199 "}" [] [] - 26: JSX_TEXT@199..202 - 0: JSX_TEXT_LITERAL@199..202 "\n " [] [] - 27: JSX_EXPRESSION_CHILD@202..208 - 0: L_CURLY@202..203 "{" [] [] - 1: JS_COMPUTED_MEMBER_EXPRESSION@203..207 - 0: JS_IDENTIFIER_EXPRESSION@203..204 - 0: JS_REFERENCE_IDENTIFIER@203..204 - 0: IDENT@203..204 "a" [] [] - 1: (empty) - 2: L_BRACK@204..205 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@205..206 - 0: JS_REFERENCE_IDENTIFIER@205..206 - 0: IDENT@205..206 "b" [] [] - 4: R_BRACK@206..207 "]" [] [] - 2: R_CURLY@207..208 "}" [] [] - 28: JSX_TEXT@208..211 - 0: JSX_TEXT_LITERAL@208..211 "\n " [] [] - 29: JSX_EXPRESSION_CHILD@211..218 - 0: L_CURLY@211..212 "{" [] [] - 1: JS_CONDITIONAL_EXPRESSION@212..217 - 0: JS_IDENTIFIER_EXPRESSION@212..213 - 0: JS_REFERENCE_IDENTIFIER@212..213 - 0: IDENT@212..213 "a" [] [] - 1: QUESTION@213..214 "?" [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@214..215 - 0: JS_NUMBER_LITERAL@214..215 "1" [] [] - 3: COLON@215..216 ":" [] [] - 4: JS_NUMBER_LITERAL_EXPRESSION@216..217 - 0: JS_NUMBER_LITERAL@216..217 "2" [] [] - 2: R_CURLY@217..218 "}" [] [] - 30: JSX_TEXT@218..221 - 0: JSX_TEXT_LITERAL@218..221 "\n " [] [] - 31: JSX_EXPRESSION_CHILD@221..238 - 0: L_CURLY@221..222 "{" [] [] - 1: JS_FUNCTION_EXPRESSION@222..237 - 0: (empty) - 1: FUNCTION_KW@222..231 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@231..232 - 0: IDENT@231..232 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@232..235 - 0: L_PAREN@232..233 "(" [] [] - 1: JS_PARAMETER_LIST@233..233 - 2: R_PAREN@233..235 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@235..237 - 0: L_CURLY@235..236 "{" [] [] - 1: JS_DIRECTIVE_LIST@236..236 - 2: JS_STATEMENT_LIST@236..236 - 3: R_CURLY@236..237 "}" [] [] - 2: R_CURLY@237..238 "}" [] [] - 32: JSX_TEXT@238..241 - 0: JSX_TEXT_LITERAL@238..241 "\n " [] [] - 33: JSX_EXPRESSION_CHILD@241..257 - 0: L_CURLY@241..242 "{" [] [] - 1: JS_FUNCTION_EXPRESSION@242..256 - 0: (empty) - 1: FUNCTION_KW@242..251 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@251..254 - 0: L_PAREN@251..252 "(" [] [] - 1: JS_PARAMETER_LIST@252..252 - 2: R_PAREN@252..254 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@254..256 - 0: L_CURLY@254..255 "{" [] [] - 1: JS_DIRECTIVE_LIST@255..255 - 2: JS_STATEMENT_LIST@255..255 - 3: R_CURLY@255..256 "}" [] [] - 2: R_CURLY@256..257 "}" [] [] - 34: JSX_TEXT@257..260 - 0: JSX_TEXT_LITERAL@257..260 "\n " [] [] - 35: JSX_EXPRESSION_CHILD@260..263 - 0: L_CURLY@260..261 "{" [] [] - 1: JS_IDENTIFIER_EXPRESSION@261..262 - 0: JS_REFERENCE_IDENTIFIER@261..262 - 0: IDENT@261..262 "a" [] [] - 2: R_CURLY@262..263 "}" [] [] - 36: JSX_TEXT@263..266 - 0: JSX_TEXT_LITERAL@263..266 "\n " [] [] - 37: JSX_EXPRESSION_CHILD@266..282 - 0: L_CURLY@266..267 "{" [] [] - 1: JS_IMPORT_CALL_EXPRESSION@267..281 - 0: IMPORT_KW@267..273 "import" [] [] - 1: JS_CALL_ARGUMENTS@273..281 - 0: L_PAREN@273..274 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@274..280 - 0: JS_STRING_LITERAL_EXPRESSION@274..280 - 0: JS_STRING_LITERAL@274..280 "\"a.js\"" [] [] - 2: R_PAREN@280..281 ")" [] [] - 2: R_CURLY@281..282 "}" [] [] - 38: JSX_TEXT@282..285 - 0: JSX_TEXT_LITERAL@282..285 "\n " [] [] - 39: JSX_EXPRESSION_CHILD@285..295 - 0: L_CURLY@285..286 "{" [] [] - 1: JS_IN_EXPRESSION@286..294 - 0: JS_IDENTIFIER_EXPRESSION@286..290 - 0: JS_REFERENCE_IDENTIFIER@286..290 - 0: IDENT@286..290 "key" [] [Whitespace(" ")] - 1: IN_KW@290..293 "in" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@293..294 - 0: JS_REFERENCE_IDENTIFIER@293..294 - 0: IDENT@293..294 "a" [] [] - 2: R_CURLY@294..295 "}" [] [] - 40: JSX_TEXT@295..298 - 0: JSX_TEXT_LITERAL@295..298 "\n " [] [] - 41: JSX_EXPRESSION_CHILD@298..319 - 0: L_CURLY@298..299 "{" [] [] - 1: JS_INSTANCEOF_EXPRESSION@299..318 - 0: JS_IDENTIFIER_EXPRESSION@299..301 - 0: JS_REFERENCE_IDENTIFIER@299..301 - 0: IDENT@299..301 "a" [] [Whitespace(" ")] - 1: INSTANCEOF_KW@301..312 "instanceof" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@312..318 - 0: JS_REFERENCE_IDENTIFIER@312..318 - 0: IDENT@312..318 "Object" [] [] - 2: R_CURLY@318..319 "}" [] [] - 42: JSX_TEXT@319..322 - 0: JSX_TEXT_LITERAL@319..322 "\n " [] [] - 43: JSX_EXPRESSION_CHILD@322..330 - 0: L_CURLY@322..323 "{" [] [] - 1: JS_LOGICAL_EXPRESSION@323..329 - 0: JS_IDENTIFIER_EXPRESSION@323..325 - 0: JS_REFERENCE_IDENTIFIER@323..325 - 0: IDENT@323..325 "a" [] [Whitespace(" ")] - 1: AMP2@325..328 "&&" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@328..329 - 0: JS_REFERENCE_IDENTIFIER@328..329 - 0: IDENT@328..329 "b" [] [] - 2: R_CURLY@329..330 "}" [] [] - 44: JSX_TEXT@330..333 - 0: JSX_TEXT_LITERAL@330..333 "\n " [] [] - 45: JSX_EXPRESSION_CHILD@333..342 - 0: L_CURLY@333..334 "{" [] [] - 1: JS_NEW_EXPRESSION@334..341 - 0: NEW_KW@334..338 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@338..339 - 0: JS_REFERENCE_IDENTIFIER@338..339 - 0: IDENT@338..339 "f" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@339..341 - 0: L_PAREN@339..340 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@340..340 - 2: R_PAREN@340..341 ")" [] [] - 2: R_CURLY@341..342 "}" [] [] - 46: JSX_TEXT@342..345 - 0: JSX_TEXT_LITERAL@342..345 "\n " [] [] - 47: JSX_EXPRESSION_CHILD@345..349 - 0: L_CURLY@345..346 "{" [] [] - 1: JS_OBJECT_EXPRESSION@346..348 - 0: L_CURLY@346..347 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@347..347 - 2: R_CURLY@347..348 "}" [] [] - 2: R_CURLY@348..349 "}" [] [] - 48: JSX_TEXT@349..352 - 0: JSX_TEXT_LITERAL@349..352 "\n " [] [] - 49: JSX_EXPRESSION_CHILD@352..357 - 0: L_CURLY@352..353 "{" [] [] - 1: JS_PARENTHESIZED_EXPRESSION@353..356 - 0: L_PAREN@353..354 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@354..355 - 0: JS_REFERENCE_IDENTIFIER@354..355 - 0: IDENT@354..355 "a" [] [] - 2: R_PAREN@355..356 ")" [] [] - 2: R_CURLY@356..357 "}" [] [] - 50: JSX_TEXT@357..360 - 0: JSX_TEXT_LITERAL@357..360 "\n " [] [] - 51: JSX_EXPRESSION_CHILD@360..365 - 0: L_CURLY@360..361 "{" [] [] - 1: JS_POST_UPDATE_EXPRESSION@361..364 - 0: JS_IDENTIFIER_ASSIGNMENT@361..362 - 0: IDENT@361..362 "a" [] [] - 1: PLUS2@362..364 "++" [] [] - 2: R_CURLY@364..365 "}" [] [] - 52: JSX_TEXT@365..368 - 0: JSX_TEXT_LITERAL@365..368 "\n " [] [] - 53: JSX_EXPRESSION_CHILD@368..373 - 0: L_CURLY@368..369 "{" [] [] - 1: JS_PRE_UPDATE_EXPRESSION@369..372 - 0: PLUS2@369..371 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@371..372 - 0: IDENT@371..372 "a" [] [] - 2: R_CURLY@372..373 "}" [] [] - 54: JSX_TEXT@373..376 - 0: JSX_TEXT_LITERAL@373..376 "\n " [] [] - 55: JSX_EXPRESSION_CHILD@376..381 - 0: L_CURLY@376..377 "{" [] [] - 1: JS_SEQUENCE_EXPRESSION@377..380 - 0: JS_IDENTIFIER_EXPRESSION@377..378 - 0: JS_REFERENCE_IDENTIFIER@377..378 - 0: IDENT@377..378 "a" [] [] - 1: COMMA@378..379 "," [] [] - 2: JS_IDENTIFIER_EXPRESSION@379..380 - 0: JS_REFERENCE_IDENTIFIER@379..380 - 0: IDENT@379..380 "b" [] [] - 2: R_CURLY@380..381 "}" [] [] - 56: JSX_TEXT@381..384 - 0: JSX_TEXT_LITERAL@381..384 "\n " [] [] - 57: JSX_EXPRESSION_CHILD@384..389 - 0: L_CURLY@384..385 "{" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@385..388 - 0: JS_IDENTIFIER_EXPRESSION@385..386 - 0: JS_REFERENCE_IDENTIFIER@385..386 - 0: IDENT@385..386 "a" [] [] - 1: DOT@386..387 "." [] [] - 2: JS_NAME@387..388 - 0: IDENT@387..388 "b" [] [] - 2: R_CURLY@388..389 "}" [] [] - 58: JSX_TEXT@389..392 - 0: JSX_TEXT_LITERAL@389..392 "\n " [] [] - 59: JSX_EXPRESSION_CHILD@392..403 - 0: L_CURLY@392..393 "{" [] [] - 1: JS_CALL_EXPRESSION@393..402 - 0: JS_STATIC_MEMBER_EXPRESSION@393..400 - 0: JS_SUPER_EXPRESSION@393..398 - 0: SUPER_KW@393..398 "super" [] [] - 1: DOT@398..399 "." [] [] - 2: JS_NAME@399..400 - 0: IDENT@399..400 "a" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@400..402 - 0: L_PAREN@400..401 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@401..401 - 2: R_PAREN@401..402 ")" [] [] - 2: R_CURLY@402..403 "}" [] [] - 60: JSX_TEXT@403..406 - 0: JSX_TEXT_LITERAL@403..406 "\n " [] [] - 61: JSX_EXPRESSION_CHILD@406..412 - 0: L_CURLY@406..407 "{" [] [] - 1: JS_THIS_EXPRESSION@407..411 - 0: THIS_KW@407..411 "this" [] [] - 2: R_CURLY@411..412 "}" [] [] - 62: JSX_TEXT@412..415 - 0: JSX_TEXT_LITERAL@412..415 "\n " [] [] - 63: JSX_EXPRESSION_CHILD@415..427 - 0: L_CURLY@415..416 "{" [] [] - 1: JS_UNARY_EXPRESSION@416..426 - 0: DELETE_KW@416..423 "delete" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@423..426 - 0: JS_IDENTIFIER_EXPRESSION@423..424 - 0: JS_REFERENCE_IDENTIFIER@423..424 - 0: IDENT@423..424 "a" [] [] - 1: DOT@424..425 "." [] [] - 2: JS_NAME@425..426 - 0: IDENT@425..426 "a" [] [] - 2: R_CURLY@426..427 "}" [] [] - 64: JSX_TEXT@427..430 - 0: JSX_TEXT_LITERAL@427..430 "\n " [] [] - 65: JSX_EXPRESSION_CHILD@430..438 - 0: L_CURLY@430..431 "{" [] [] - 1: JS_UNARY_EXPRESSION@431..437 - 0: VOID_KW@431..436 "void" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@436..437 - 0: JS_REFERENCE_IDENTIFIER@436..437 - 0: IDENT@436..437 "a" [] [] - 2: R_CURLY@437..438 "}" [] [] - 66: JSX_TEXT@438..441 - 0: JSX_TEXT_LITERAL@438..441 "\n " [] [] - 67: JSX_EXPRESSION_CHILD@441..451 - 0: L_CURLY@441..442 "{" [] [] - 1: JS_UNARY_EXPRESSION@442..450 - 0: TYPEOF_KW@442..449 "typeof" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@449..450 - 0: JS_REFERENCE_IDENTIFIER@449..450 - 0: IDENT@449..450 "a" [] [] - 2: R_CURLY@450..451 "}" [] [] - 68: JSX_TEXT@451..454 - 0: JSX_TEXT_LITERAL@451..454 "\n " [] [] - 69: JSX_EXPRESSION_CHILD@454..458 - 0: L_CURLY@454..455 "{" [] [] - 1: JS_UNARY_EXPRESSION@455..457 - 0: PLUS@455..456 "+" [] [] - 1: JS_IDENTIFIER_EXPRESSION@456..457 - 0: JS_REFERENCE_IDENTIFIER@456..457 - 0: IDENT@456..457 "a" [] [] - 2: R_CURLY@457..458 "}" [] [] - 70: JSX_TEXT@458..461 - 0: JSX_TEXT_LITERAL@458..461 "\n " [] [] - 71: JSX_EXPRESSION_CHILD@461..465 - 0: L_CURLY@461..462 "{" [] [] - 1: JS_UNARY_EXPRESSION@462..464 - 0: MINUS@462..463 "-" [] [] - 1: JS_IDENTIFIER_EXPRESSION@463..464 - 0: JS_REFERENCE_IDENTIFIER@463..464 - 0: IDENT@463..464 "a" [] [] - 2: R_CURLY@464..465 "}" [] [] - 72: JSX_TEXT@465..468 - 0: JSX_TEXT_LITERAL@465..468 "\n " [] [] - 73: JSX_EXPRESSION_CHILD@468..472 - 0: L_CURLY@468..469 "{" [] [] - 1: JS_UNARY_EXPRESSION@469..471 - 0: BANG@469..470 "!" [] [] - 1: JS_IDENTIFIER_EXPRESSION@470..471 - 0: JS_REFERENCE_IDENTIFIER@470..471 - 0: IDENT@470..471 "a" [] [] - 2: R_CURLY@471..472 "}" [] [] - 74: JSX_TEXT@472..475 - 0: JSX_TEXT_LITERAL@472..475 "\n " [] [] - 75: JSX_EXPRESSION_CHILD@475..479 - 0: L_CURLY@475..476 "{" [] [] - 1: JS_UNARY_EXPRESSION@476..478 - 0: TILDE@476..477 "~" [] [] - 1: JS_IDENTIFIER_EXPRESSION@477..478 - 0: JS_REFERENCE_IDENTIFIER@477..478 - 0: IDENT@477..478 "a" [] [] - 2: R_CURLY@478..479 "}" [] [] - 76: JSX_TEXT@479..482 - 0: JSX_TEXT_LITERAL@479..482 "\n " [] [] - 77: JSX_EXPRESSION_CHILD@482..486 - 0: L_CURLY@482..483 "{" [] [] - 1: JS_TEMPLATE_EXPRESSION@483..485 - 0: (empty) - 1: (empty) - 2: BACKTICK@483..484 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@484..484 - 4: BACKTICK@484..485 "`" [] [] - 2: R_CURLY@485..486 "}" [] [] - 78: JSX_TEXT@486..489 - 0: JSX_TEXT_LITERAL@486..489 "\n " [] [] - 79: JSX_EXPRESSION_CHILD@489..510 - 0: L_CURLY@489..509 "{" [] [Comments("/* A JSX comment */")] - 1: (empty) - 2: R_CURLY@509..510 "}" [] [] - 80: JSX_TEXT@510..513 - 0: JSX_TEXT_LITERAL@510..513 "\n " [] [] - 81: JSX_EXPRESSION_CHILD@513..539 - 0: L_CURLY@513..538 "{" [] [Comments("/* Multi\n line\n */")] - 1: (empty) - 2: R_CURLY@538..539 "}" [] [] - 82: JSX_TEXT@539..542 - 0: JSX_TEXT_LITERAL@539..542 "\n " [] [] - 83: JSX_EXPRESSION_CHILD@542..544 - 0: L_CURLY@542..543 "{" [] [] - 1: (empty) - 2: R_CURLY@543..544 "}" [] [] - 84: JSX_TEXT@544..545 - 0: JSX_TEXT_LITERAL@544..545 "\n" [] [] - 2: JSX_CLOSING_ELEMENT@545..551 - 0: L_ANGLE@545..546 "<" [] [] - 1: SLASH@546..547 "/" [] [] - 2: JSX_NAME@547..550 - 0: JSX_IDENT@547..550 "div" [] [] - 3: R_ANGLE@550..551 ">" [] [] - 1: (empty) - 6: JS_FUNCTION_DECLARATION@551..616 - 0: (empty) - 1: FUNCTION_KW@551..561 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@561..562 "*" [] [] - 3: JS_IDENTIFIER_BINDING@562..563 - 0: IDENT@562..563 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@563..566 - 0: L_PAREN@563..564 "(" [] [] - 1: JS_PARAMETER_LIST@564..564 - 2: R_PAREN@564..566 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@566..616 - 0: L_CURLY@566..567 "{" [] [] - 1: JS_DIRECTIVE_LIST@567..567 - 2: JS_STATEMENT_LIST@567..614 - 0: JS_RETURN_STATEMENT@567..614 - 0: RETURN_KW@567..579 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JSX_TAG_EXPRESSION@579..613 - 0: JSX_ELEMENT@579..613 - 0: JSX_OPENING_ELEMENT@579..584 - 0: L_ANGLE@579..580 "<" [] [] - 1: JSX_NAME@580..583 - 0: JSX_IDENT@580..583 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@583..583 - 4: R_ANGLE@583..584 ">" [] [] - 1: JSX_CHILD_LIST@584..607 - 0: JSX_TEXT@584..593 - 0: JSX_TEXT_LITERAL@584..593 "\n " [] [] - 1: JSX_EXPRESSION_CHILD@593..602 - 0: L_CURLY@593..594 "{" [] [] - 1: JS_YIELD_EXPRESSION@594..601 - 0: YIELD_KW@594..600 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@600..601 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@600..601 - 0: JS_REFERENCE_IDENTIFIER@600..601 - 0: IDENT@600..601 "a" [] [] - 2: R_CURLY@601..602 "}" [] [] - 2: JSX_TEXT@602..607 - 0: JSX_TEXT_LITERAL@602..607 "\n " [] [] - 2: JSX_CLOSING_ELEMENT@607..613 - 0: L_ANGLE@607..608 "<" [] [] - 1: SLASH@608..609 "/" [] [] - 2: JSX_NAME@609..612 - 0: JSX_IDENT@609..612 "div" [] [] - 3: R_ANGLE@612..613 ">" [] [] - 2: SEMICOLON@613..614 ";" [] [] - 3: R_CURLY@614..616 "}" [Newline("\n")] [] - 4: EOF@616..617 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.rast deleted file mode 100644 index 4e1e600e070a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.rast +++ /dev/null @@ -1,78 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@6..11 "\n " [] [], - }, - JsxExpressionChild { - l_curly_token: L_CURLY@11..25 "{" [] [Comments("/* comment */")], - expression: missing (optional), - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@26..47 "\n some\n text\n" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@47..48 "<" [] [], - slash_token: SLASH@48..49 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@49..53 "test" [] [], - }, - r_angle_token: R_ANGLE@53..54 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_EXPRESSION_STATEMENT@0..54 - 0: JSX_TAG_EXPRESSION@0..54 - 0: JSX_ELEMENT@0..54 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..47 - 0: JSX_TEXT@6..11 - 0: JSX_TEXT_LITERAL@6..11 "\n " [] [] - 1: JSX_EXPRESSION_CHILD@11..26 - 0: L_CURLY@11..25 "{" [] [Comments("/* comment */")] - 1: (empty) - 2: R_CURLY@25..26 "}" [] [] - 2: JSX_TEXT@26..47 - 0: JSX_TEXT_LITERAL@26..47 "\n some\n text\n" [] [] - 2: JSX_CLOSING_ELEMENT@47..54 - 0: L_ANGLE@47..48 "<" [] [] - 1: SLASH@48..49 "/" [] [] - 2: JSX_NAME@49..53 - 0: JSX_IDENT@49..53 "test" [] [] - 3: R_ANGLE@53..54 ">" [] [] - 1: (empty) - 4: EOF@54..55 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.rast deleted file mode 100644 index 84da262d1108..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.rast +++ /dev/null @@ -1,142 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..4 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@4..5 ">" [] [], - }, - children: JsxChildList [ - JsxSpreadChild { - l_curly_token: L_CURLY@5..6 "{" [] [], - dotdotdot_token: DOT3@6..9 "..." [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..10 "a" [] [], - }, - }, - r_curly_token: R_CURLY@10..11 "}" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@11..12 "<" [] [], - slash_token: SLASH@12..13 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@13..16 "div" [] [], - }, - r_angle_token: R_ANGLE@16..17 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@18..20 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@20..23 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@23..24 ">" [] [], - }, - children: JsxChildList [ - JsxSpreadChild { - l_curly_token: L_CURLY@24..25 "{" [] [], - dotdotdot_token: DOT3@25..28 "..." [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..29 "a" [] [], - }, - }, - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - JsxText { - value_token: JSX_TEXT_LITERAL@30..35 "After" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@35..36 "<" [] [], - slash_token: SLASH@36..37 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@37..40 "div" [] [], - }, - r_angle_token: R_ANGLE@40..41 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - ], - eof_token: EOF@42..43 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JSX_TAG_EXPRESSION@0..17 - 0: JSX_ELEMENT@0..17 - 0: JSX_OPENING_ELEMENT@0..5 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..4 - 0: JSX_IDENT@1..4 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@4..4 - 4: R_ANGLE@4..5 ">" [] [] - 1: JSX_CHILD_LIST@5..11 - 0: JSX_SPREAD_CHILD@5..11 - 0: L_CURLY@5..6 "{" [] [] - 1: DOT3@6..9 "..." [] [] - 2: JS_IDENTIFIER_EXPRESSION@9..10 - 0: JS_REFERENCE_IDENTIFIER@9..10 - 0: IDENT@9..10 "a" [] [] - 3: R_CURLY@10..11 "}" [] [] - 2: JSX_CLOSING_ELEMENT@11..17 - 0: L_ANGLE@11..12 "<" [] [] - 1: SLASH@12..13 "/" [] [] - 2: JSX_NAME@13..16 - 0: JSX_IDENT@13..16 "div" [] [] - 3: R_ANGLE@16..17 ">" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@18..42 - 0: JSX_TAG_EXPRESSION@18..41 - 0: JSX_ELEMENT@18..41 - 0: JSX_OPENING_ELEMENT@18..24 - 0: L_ANGLE@18..20 "<" [Newline("\n")] [] - 1: JSX_NAME@20..23 - 0: JSX_IDENT@20..23 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@23..23 - 4: R_ANGLE@23..24 ">" [] [] - 1: JSX_CHILD_LIST@24..35 - 0: JSX_SPREAD_CHILD@24..30 - 0: L_CURLY@24..25 "{" [] [] - 1: DOT3@25..28 "..." [] [] - 2: JS_IDENTIFIER_EXPRESSION@28..29 - 0: JS_REFERENCE_IDENTIFIER@28..29 - 0: IDENT@28..29 "a" [] [] - 3: R_CURLY@29..30 "}" [] [] - 1: JSX_TEXT@30..35 - 0: JSX_TEXT_LITERAL@30..35 "After" [] [] - 2: JSX_CLOSING_ELEMENT@35..41 - 0: L_ANGLE@35..36 "<" [] [] - 1: SLASH@36..37 "/" [] [] - 2: JSX_NAME@37..40 - 0: JSX_IDENT@37..40 "div" [] [] - 3: R_ANGLE@40..41 ">" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 4: EOF@42..43 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.rast deleted file mode 100644 index de2b1b0a56cf..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.rast +++ /dev/null @@ -1,84 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..9 "closing" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@9..30 "/" [] [Whitespace(" "), Comments("/* some comment */"), Whitespace(" ")], - r_angle_token: R_ANGLE@30..31 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@32..34 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@34..38 "open" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@38..39 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@39..40 "<" [] [], - slash_token: SLASH@40..62 "/" [Newline("\n"), Comments("/* some comment */"), Whitespace(" ")] [Whitespace(" ")], - name: JsxName { - value_token: JSX_IDENT@62..66 "open" [] [], - }, - r_angle_token: R_ANGLE@66..67 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@67..68 ";" [] [], - }, - ], - eof_token: EOF@68..69 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..69 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..68 - 0: JS_EXPRESSION_STATEMENT@0..32 - 0: JSX_TAG_EXPRESSION@0..31 - 0: JSX_SELF_CLOSING_ELEMENT@0..31 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..9 - 0: JSX_IDENT@1..9 "closing" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@9..9 - 4: SLASH@9..30 "/" [] [Whitespace(" "), Comments("/* some comment */"), Whitespace(" ")] - 5: R_ANGLE@30..31 ">" [] [] - 1: SEMICOLON@31..32 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@32..68 - 0: JSX_TAG_EXPRESSION@32..67 - 0: JSX_ELEMENT@32..67 - 0: JSX_OPENING_ELEMENT@32..39 - 0: L_ANGLE@32..34 "<" [Newline("\n")] [] - 1: JSX_NAME@34..38 - 0: JSX_IDENT@34..38 "open" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@38..38 - 4: R_ANGLE@38..39 ">" [] [] - 1: JSX_CHILD_LIST@39..39 - 2: JSX_CLOSING_ELEMENT@39..67 - 0: L_ANGLE@39..40 "<" [] [] - 1: SLASH@40..62 "/" [Newline("\n"), Comments("/* some comment */"), Whitespace(" ")] [Whitespace(" ")] - 2: JSX_NAME@62..66 - 0: JSX_IDENT@62..66 "open" [] [] - 3: R_ANGLE@66..67 ">" [] [] - 1: SEMICOLON@67..68 ";" [] [] - 4: EOF@68..69 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.rast deleted file mode 100644 index 99523f5f543e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.rast +++ /dev/null @@ -1,41 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@5..6 "/" [] [], - r_angle_token: R_ANGLE@6..7 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@7..8 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..8 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..7 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JSX_TAG_EXPRESSION@0..7 - 0: JSX_SELF_CLOSING_ELEMENT@0..7 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: SLASH@5..6 "/" [] [] - 5: R_ANGLE@6..7 ">" [] [] - 1: (empty) - 4: EOF@7..8 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.rast deleted file mode 100644 index 1fafc53cfac2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.rast +++ /dev/null @@ -1,73 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@5..7 "id" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@7..8 "=" [] [], - value: JsxSelfClosingElement { - l_angle_token: L_ANGLE@8..9 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@9..10 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@10..11 "/" [] [], - r_angle_token: R_ANGLE@11..13 ">" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@13..14 "/" [] [], - r_angle_token: R_ANGLE@14..15 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - ], - eof_token: EOF@16..17 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..17 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..16 - 0: JS_EXPRESSION_STATEMENT@0..16 - 0: JSX_TAG_EXPRESSION@0..15 - 0: JSX_SELF_CLOSING_ELEMENT@0..15 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..13 - 0: JSX_ATTRIBUTE@5..13 - 0: JSX_NAME@5..7 - 0: JSX_IDENT@5..7 "id" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@7..13 - 0: EQ@7..8 "=" [] [] - 1: JSX_SELF_CLOSING_ELEMENT@8..13 - 0: L_ANGLE@8..9 "<" [] [] - 1: JSX_NAME@9..10 - 0: JSX_IDENT@9..10 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@10..10 - 4: SLASH@10..11 "/" [] [] - 5: R_ANGLE@11..13 ">" [] [Whitespace(" ")] - 4: SLASH@13..14 "/" [] [] - 5: R_ANGLE@14..15 ">" [] [] - 1: SEMICOLON@15..16 ";" [] [] - 4: EOF@16..17 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.rast deleted file mode 100644 index ab1f8d8ce2d1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.rast +++ /dev/null @@ -1,139 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@5..7 "id" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@7..8 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@8..9 "{" [] [], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@9..10 "1" [] [], - }, - r_curly_token: R_CURLY@10..12 "}" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@12..13 "/" [] [], - r_angle_token: R_ANGLE@13..14 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@15..17 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@17..21 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@21..30 "className" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@30..31 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@31..32 "{" [] [], - expression: JsTemplateExpression { - tag: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..38 "prefix" [] [], - }, - }, - type_arguments: missing (optional), - l_tick_token: BACKTICK@38..39 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@39..43 "none" [] [], - }, - ], - r_tick_token: BACKTICK@43..44 "`" [] [], - }, - r_curly_token: R_CURLY@44..46 "}" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@46..47 "/" [] [], - r_angle_token: R_ANGLE@47..48 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@48..49 ";" [] [], - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JSX_TAG_EXPRESSION@0..14 - 0: JSX_SELF_CLOSING_ELEMENT@0..14 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..12 - 0: JSX_ATTRIBUTE@5..12 - 0: JSX_NAME@5..7 - 0: JSX_IDENT@5..7 "id" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@7..12 - 0: EQ@7..8 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@8..12 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@9..10 - 0: JS_NUMBER_LITERAL@9..10 "1" [] [] - 2: R_CURLY@10..12 "}" [] [Whitespace(" ")] - 4: SLASH@12..13 "/" [] [] - 5: R_ANGLE@13..14 ">" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@15..49 - 0: JSX_TAG_EXPRESSION@15..48 - 0: JSX_SELF_CLOSING_ELEMENT@15..48 - 0: L_ANGLE@15..17 "<" [Newline("\n")] [] - 1: JSX_NAME@17..21 - 0: JSX_IDENT@17..21 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@21..46 - 0: JSX_ATTRIBUTE@21..46 - 0: JSX_NAME@21..30 - 0: JSX_IDENT@21..30 "className" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@30..46 - 0: EQ@30..31 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@31..46 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_TEMPLATE_EXPRESSION@32..44 - 0: JS_IDENTIFIER_EXPRESSION@32..38 - 0: JS_REFERENCE_IDENTIFIER@32..38 - 0: IDENT@32..38 "prefix" [] [] - 1: (empty) - 2: BACKTICK@38..39 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@39..43 - 0: JS_TEMPLATE_CHUNK_ELEMENT@39..43 - 0: TEMPLATE_CHUNK@39..43 "none" [] [] - 4: BACKTICK@43..44 "`" [] [] - 2: R_CURLY@44..46 "}" [] [Whitespace(" ")] - 4: SLASH@46..47 "/" [] [] - 5: R_ANGLE@47..48 ">" [] [] - 1: SEMICOLON@48..49 ";" [] [] - 4: EOF@49..50 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.rast deleted file mode 100644 index 29c2c280e8c5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.rast +++ /dev/null @@ -1,60 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@5..7 "id" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@7..8 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@8..12 "\"a\"" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@12..13 "/" [] [], - r_angle_token: R_ANGLE@13..14 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - ], - eof_token: EOF@15..16 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..16 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..15 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JSX_TAG_EXPRESSION@0..14 - 0: JSX_SELF_CLOSING_ELEMENT@0..14 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..12 - 0: JSX_ATTRIBUTE@5..12 - 0: JSX_NAME@5..7 - 0: JSX_IDENT@5..7 "id" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@7..12 - 0: EQ@7..8 "=" [] [] - 1: JSX_STRING@8..12 - 0: JSX_STRING_LITERAL@8..12 "\"a\"" [] [Whitespace(" ")] - 4: SLASH@12..13 "/" [] [] - 5: R_ANGLE@13..14 ">" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 4: EOF@15..16 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.rast deleted file mode 100644 index 2278c1d058ff..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.rast +++ /dev/null @@ -1,402 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@26..27 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@27..31 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@31..45 "string_literal" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@45..46 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@46..50 "\"a\"" [] [Whitespace(" ")], - }, - }, - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@50..60 "expression" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@60..61 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@61..62 "{" [] [], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@62..63 "1" [] [], - }, - r_curly_token: R_CURLY@63..65 "}" [] [Whitespace(" ")], - }, - }, - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@65..73 "novalue" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@73..75 "el" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@75..76 "=" [] [], - value: JsxSelfClosingElement { - l_angle_token: L_ANGLE@76..77 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@77..78 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@78..79 "/" [] [], - r_angle_token: R_ANGLE@79..80 ">" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@80..81 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@81..82 "<" [] [], - slash_token: SLASH@82..83 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@83..86 "div" [] [], - }, - r_angle_token: R_ANGLE@86..87 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@87..88 ";" [] [], - }, - ], - r_curly_token: R_CURLY@88..90 "}" [Newline("\n")] [], - }, - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@90..92 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@92..96 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@96..107 "dashed-name" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@107..108 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@108..115 "'test'" [] [Whitespace(" ")], - }, - }, - }, - JsxAttribute { - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@115..118 "use" [] [], - }, - colon_token: COLON@118..119 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@119..127 "validate" [] [], - }, - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@127..128 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@128..135 "\"abcd\"" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@135..136 "/" [] [], - r_angle_token: R_ANGLE@136..137 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@137..138 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@138..140 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@140..144 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxNamespaceName { - namespace: JsxName { - value_token: JSX_IDENT@144..165 "use-dashed_underscore" [] [], - }, - colon_token: COLON@165..166 ":" [] [], - name: JsxName { - value_token: JSX_IDENT@166..174 "validate" [] [], - }, - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@174..175 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@175..183 "\"ahaha\"" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@183..184 "/" [] [], - r_angle_token: R_ANGLE@184..185 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@185..186 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@186..188 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@188..192 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@192..208 "multiline-string" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@208..209 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@209..233 "'test\n continues here'" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@233..234 "/" [] [], - r_angle_token: R_ANGLE@234..235 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@235..236 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@236..238 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@238..242 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@242..264 "invalid-unicode-escape" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@264..265 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@265..282 "\"\\u10000\\u20000\"" [] [Whitespace(" ")], - }, - }, - }, - ], - slash_token: SLASH@282..283 "/" [] [], - r_angle_token: R_ANGLE@283..284 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@284..285 ";" [] [], - }, - ], - eof_token: EOF@285..286 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..286 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..285 - 0: JS_FUNCTION_DECLARATION@0..90 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@13..90 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..88 - 0: JS_RETURN_STATEMENT@14..88 - 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JSX_TAG_EXPRESSION@26..87 - 0: JSX_ELEMENT@26..87 - 0: JSX_OPENING_ELEMENT@26..81 - 0: L_ANGLE@26..27 "<" [] [] - 1: JSX_NAME@27..31 - 0: JSX_IDENT@27..31 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@31..80 - 0: JSX_ATTRIBUTE@31..50 - 0: JSX_NAME@31..45 - 0: JSX_IDENT@31..45 "string_literal" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@45..50 - 0: EQ@45..46 "=" [] [] - 1: JSX_STRING@46..50 - 0: JSX_STRING_LITERAL@46..50 "\"a\"" [] [Whitespace(" ")] - 1: JSX_ATTRIBUTE@50..65 - 0: JSX_NAME@50..60 - 0: JSX_IDENT@50..60 "expression" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@60..65 - 0: EQ@60..61 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@61..65 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@62..63 - 0: JS_NUMBER_LITERAL@62..63 "1" [] [] - 2: R_CURLY@63..65 "}" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE@65..73 - 0: JSX_NAME@65..73 - 0: JSX_IDENT@65..73 "novalue" [] [Whitespace(" ")] - 1: (empty) - 3: JSX_ATTRIBUTE@73..80 - 0: JSX_NAME@73..75 - 0: JSX_IDENT@73..75 "el" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@75..80 - 0: EQ@75..76 "=" [] [] - 1: JSX_SELF_CLOSING_ELEMENT@76..80 - 0: L_ANGLE@76..77 "<" [] [] - 1: JSX_NAME@77..78 - 0: JSX_IDENT@77..78 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@78..78 - 4: SLASH@78..79 "/" [] [] - 5: R_ANGLE@79..80 ">" [] [] - 4: R_ANGLE@80..81 ">" [] [] - 1: JSX_CHILD_LIST@81..81 - 2: JSX_CLOSING_ELEMENT@81..87 - 0: L_ANGLE@81..82 "<" [] [] - 1: SLASH@82..83 "/" [] [] - 2: JSX_NAME@83..86 - 0: JSX_IDENT@83..86 "div" [] [] - 3: R_ANGLE@86..87 ">" [] [] - 2: SEMICOLON@87..88 ";" [] [] - 3: R_CURLY@88..90 "}" [Newline("\n")] [] - 1: JS_EXPRESSION_STATEMENT@90..138 - 0: JSX_TAG_EXPRESSION@90..137 - 0: JSX_SELF_CLOSING_ELEMENT@90..137 - 0: L_ANGLE@90..92 "<" [Newline("\n")] [] - 1: JSX_NAME@92..96 - 0: JSX_IDENT@92..96 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@96..135 - 0: JSX_ATTRIBUTE@96..115 - 0: JSX_NAME@96..107 - 0: JSX_IDENT@96..107 "dashed-name" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@107..115 - 0: EQ@107..108 "=" [] [] - 1: JSX_STRING@108..115 - 0: JSX_STRING_LITERAL@108..115 "'test'" [] [Whitespace(" ")] - 1: JSX_ATTRIBUTE@115..135 - 0: JSX_NAMESPACE_NAME@115..127 - 0: JSX_NAME@115..118 - 0: JSX_IDENT@115..118 "use" [] [] - 1: COLON@118..119 ":" [] [] - 2: JSX_NAME@119..127 - 0: JSX_IDENT@119..127 "validate" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@127..135 - 0: EQ@127..128 "=" [] [] - 1: JSX_STRING@128..135 - 0: JSX_STRING_LITERAL@128..135 "\"abcd\"" [] [Whitespace(" ")] - 4: SLASH@135..136 "/" [] [] - 5: R_ANGLE@136..137 ">" [] [] - 1: SEMICOLON@137..138 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@138..186 - 0: JSX_TAG_EXPRESSION@138..185 - 0: JSX_SELF_CLOSING_ELEMENT@138..185 - 0: L_ANGLE@138..140 "<" [Newline("\n")] [] - 1: JSX_NAME@140..144 - 0: JSX_IDENT@140..144 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@144..183 - 0: JSX_ATTRIBUTE@144..183 - 0: JSX_NAMESPACE_NAME@144..174 - 0: JSX_NAME@144..165 - 0: JSX_IDENT@144..165 "use-dashed_underscore" [] [] - 1: COLON@165..166 ":" [] [] - 2: JSX_NAME@166..174 - 0: JSX_IDENT@166..174 "validate" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@174..183 - 0: EQ@174..175 "=" [] [] - 1: JSX_STRING@175..183 - 0: JSX_STRING_LITERAL@175..183 "\"ahaha\"" [] [Whitespace(" ")] - 4: SLASH@183..184 "/" [] [] - 5: R_ANGLE@184..185 ">" [] [] - 1: SEMICOLON@185..186 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@186..236 - 0: JSX_TAG_EXPRESSION@186..235 - 0: JSX_SELF_CLOSING_ELEMENT@186..235 - 0: L_ANGLE@186..188 "<" [Newline("\n")] [] - 1: JSX_NAME@188..192 - 0: JSX_IDENT@188..192 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@192..233 - 0: JSX_ATTRIBUTE@192..233 - 0: JSX_NAME@192..208 - 0: JSX_IDENT@192..208 "multiline-string" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@208..233 - 0: EQ@208..209 "=" [] [] - 1: JSX_STRING@209..233 - 0: JSX_STRING_LITERAL@209..233 "'test\n continues here'" [] [Whitespace(" ")] - 4: SLASH@233..234 "/" [] [] - 5: R_ANGLE@234..235 ">" [] [] - 1: SEMICOLON@235..236 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@236..285 - 0: JSX_TAG_EXPRESSION@236..284 - 0: JSX_SELF_CLOSING_ELEMENT@236..284 - 0: L_ANGLE@236..238 "<" [Newline("\n")] [] - 1: JSX_NAME@238..242 - 0: JSX_IDENT@238..242 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@242..282 - 0: JSX_ATTRIBUTE@242..282 - 0: JSX_NAME@242..264 - 0: JSX_IDENT@242..264 "invalid-unicode-escape" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@264..282 - 0: EQ@264..265 "=" [] [] - 1: JSX_STRING@265..282 - 0: JSX_STRING_LITERAL@265..282 "\"\\u10000\\u20000\"" [] [Whitespace(" ")] - 4: SLASH@282..283 "/" [] [] - 5: R_ANGLE@283..284 ">" [] [] - 1: SEMICOLON@284..285 ";" [] [] - 4: EOF@285..286 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.rast deleted file mode 100644 index 9431406d5f9e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.rast +++ /dev/null @@ -1,230 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..2 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@2..3 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@3..8 "\n " [] [], - }, - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@8..9 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@9..10 "b" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@11..19 "\n " [] [], - }, - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@19..20 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@20..21 "d" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@21..22 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@22..23 "<" [] [], - slash_token: SLASH@23..24 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@24..25 "d" [] [], - }, - r_angle_token: R_ANGLE@25..26 ">" [] [], - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@26..34 "\n " [] [], - }, - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@34..35 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@35..36 "e" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@37..38 "<" [] [], - slash_token: SLASH@38..39 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@39..40 "e" [] [], - }, - r_angle_token: R_ANGLE@40..41 ">" [] [], - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@41..46 "\n " [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@46..47 "<" [] [], - slash_token: SLASH@47..48 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@48..49 "b" [] [], - }, - r_angle_token: R_ANGLE@49..50 ">" [] [], - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@50..55 "\n " [] [], - }, - JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@55..56 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@56..57 "c" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@57..58 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@58..59 "<" [] [], - slash_token: SLASH@59..60 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@60..61 "c" [] [], - }, - r_angle_token: R_ANGLE@61..62 ">" [] [], - }, - }, - JsxText { - value_token: JSX_TEXT_LITERAL@62..63 "\n" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@63..64 "<" [] [], - slash_token: SLASH@64..65 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@65..66 "a" [] [], - }, - r_angle_token: R_ANGLE@66..67 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: JS_EXPRESSION_STATEMENT@0..67 - 0: JSX_TAG_EXPRESSION@0..67 - 0: JSX_ELEMENT@0..67 - 0: JSX_OPENING_ELEMENT@0..3 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..2 - 0: JSX_IDENT@1..2 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@2..2 - 4: R_ANGLE@2..3 ">" [] [] - 1: JSX_CHILD_LIST@3..63 - 0: JSX_TEXT@3..8 - 0: JSX_TEXT_LITERAL@3..8 "\n " [] [] - 1: JSX_ELEMENT@8..50 - 0: JSX_OPENING_ELEMENT@8..11 - 0: L_ANGLE@8..9 "<" [] [] - 1: JSX_NAME@9..10 - 0: JSX_IDENT@9..10 "b" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@10..10 - 4: R_ANGLE@10..11 ">" [] [] - 1: JSX_CHILD_LIST@11..46 - 0: JSX_TEXT@11..19 - 0: JSX_TEXT_LITERAL@11..19 "\n " [] [] - 1: JSX_ELEMENT@19..26 - 0: JSX_OPENING_ELEMENT@19..22 - 0: L_ANGLE@19..20 "<" [] [] - 1: JSX_NAME@20..21 - 0: JSX_IDENT@20..21 "d" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@21..21 - 4: R_ANGLE@21..22 ">" [] [] - 1: JSX_CHILD_LIST@22..22 - 2: JSX_CLOSING_ELEMENT@22..26 - 0: L_ANGLE@22..23 "<" [] [] - 1: SLASH@23..24 "/" [] [] - 2: JSX_NAME@24..25 - 0: JSX_IDENT@24..25 "d" [] [] - 3: R_ANGLE@25..26 ">" [] [] - 2: JSX_TEXT@26..34 - 0: JSX_TEXT_LITERAL@26..34 "\n " [] [] - 3: JSX_ELEMENT@34..41 - 0: JSX_OPENING_ELEMENT@34..37 - 0: L_ANGLE@34..35 "<" [] [] - 1: JSX_NAME@35..36 - 0: JSX_IDENT@35..36 "e" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@36..36 - 4: R_ANGLE@36..37 ">" [] [] - 1: JSX_CHILD_LIST@37..37 - 2: JSX_CLOSING_ELEMENT@37..41 - 0: L_ANGLE@37..38 "<" [] [] - 1: SLASH@38..39 "/" [] [] - 2: JSX_NAME@39..40 - 0: JSX_IDENT@39..40 "e" [] [] - 3: R_ANGLE@40..41 ">" [] [] - 4: JSX_TEXT@41..46 - 0: JSX_TEXT_LITERAL@41..46 "\n " [] [] - 2: JSX_CLOSING_ELEMENT@46..50 - 0: L_ANGLE@46..47 "<" [] [] - 1: SLASH@47..48 "/" [] [] - 2: JSX_NAME@48..49 - 0: JSX_IDENT@48..49 "b" [] [] - 3: R_ANGLE@49..50 ">" [] [] - 2: JSX_TEXT@50..55 - 0: JSX_TEXT_LITERAL@50..55 "\n " [] [] - 3: JSX_ELEMENT@55..62 - 0: JSX_OPENING_ELEMENT@55..58 - 0: L_ANGLE@55..56 "<" [] [] - 1: JSX_NAME@56..57 - 0: JSX_IDENT@56..57 "c" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@57..57 - 4: R_ANGLE@57..58 ">" [] [] - 1: JSX_CHILD_LIST@58..58 - 2: JSX_CLOSING_ELEMENT@58..62 - 0: L_ANGLE@58..59 "<" [] [] - 1: SLASH@59..60 "/" [] [] - 2: JSX_NAME@60..61 - 0: JSX_IDENT@60..61 "c" [] [] - 3: R_ANGLE@61..62 ">" [] [] - 4: JSX_TEXT@62..63 - 0: JSX_TEXT_LITERAL@62..63 "\n" [] [] - 2: JSX_CLOSING_ELEMENT@63..67 - 0: L_ANGLE@63..64 "<" [] [] - 1: SLASH@64..65 "/" [] [] - 2: JSX_NAME@65..66 - 0: JSX_IDENT@65..66 "a" [] [] - 3: R_ANGLE@66..67 ">" [] [] - 1: (empty) - 4: EOF@67..68 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast deleted file mode 100644 index 69d5985bd80e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast +++ /dev/null @@ -1,198 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..8 "f" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], - body: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@16..17 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@17..20 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@20..21 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@21..22 "<" [] [], - slash_token: SLASH@22..23 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@23..26 "div" [] [], - }, - r_angle_token: R_ANGLE@26..27 ">" [] [], - }, - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@35..37 "f" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@37..39 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@39..40 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")], - body: JsParenthesizedExpression { - l_paren_token: L_PAREN@45..46 "(" [] [], - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@46..47 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@47..50 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@50..51 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@51..52 "<" [] [], - slash_token: SLASH@52..53 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@53..56 "div" [] [], - }, - r_angle_token: R_ANGLE@56..57 ">" [] [], - }, - }, - }, - r_paren_token: R_PAREN@57..58 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - ], - eof_token: EOF@59..60 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..60 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..59 - 0: JS_VARIABLE_STATEMENT@0..28 - 0: JS_VARIABLE_DECLARATION@0..27 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..27 - 0: JS_VARIABLE_DECLARATOR@6..27 - 0: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "f" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..27 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@10..27 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] - 5: JSX_TAG_EXPRESSION@16..27 - 0: JSX_ELEMENT@16..27 - 0: JSX_OPENING_ELEMENT@16..21 - 0: L_ANGLE@16..17 "<" [] [] - 1: JSX_NAME@17..20 - 0: JSX_IDENT@17..20 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@20..20 - 4: R_ANGLE@20..21 ">" [] [] - 1: JSX_CHILD_LIST@21..21 - 2: JSX_CLOSING_ELEMENT@21..27 - 0: L_ANGLE@21..22 "<" [] [] - 1: SLASH@22..23 "/" [] [] - 2: JSX_NAME@23..26 - 0: JSX_IDENT@23..26 "div" [] [] - 3: R_ANGLE@26..27 ">" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 1: JS_VARIABLE_STATEMENT@28..59 - 0: JS_VARIABLE_DECLARATION@28..58 - 0: (empty) - 1: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@35..58 - 0: JS_VARIABLE_DECLARATOR@35..58 - 0: JS_IDENTIFIER_BINDING@35..37 - 0: IDENT@35..37 "f" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@37..58 - 0: EQ@37..39 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@39..58 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@39..42 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_PARAMETER_LIST@40..40 - 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")] - 5: JS_PARENTHESIZED_EXPRESSION@45..58 - 0: L_PAREN@45..46 "(" [] [] - 1: JSX_TAG_EXPRESSION@46..57 - 0: JSX_ELEMENT@46..57 - 0: JSX_OPENING_ELEMENT@46..51 - 0: L_ANGLE@46..47 "<" [] [] - 1: JSX_NAME@47..50 - 0: JSX_IDENT@47..50 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@50..50 - 4: R_ANGLE@50..51 ">" [] [] - 1: JSX_CHILD_LIST@51..51 - 2: JSX_CLOSING_ELEMENT@51..57 - 0: L_ANGLE@51..52 "<" [] [] - 1: SLASH@52..53 "/" [] [] - 2: JSX_NAME@53..56 - 0: JSX_IDENT@53..56 "div" [] [] - 3: R_ANGLE@56..57 ">" [] [] - 2: R_PAREN@57..58 ")" [] [] - 1: SEMICOLON@58..59 ";" [] [] - 4: EOF@59..60 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.rast deleted file mode 100644 index 288de54ddc09..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.rast +++ /dev/null @@ -1,99 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@26..27 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@27..30 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@30..31 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@31..32 "<" [] [], - slash_token: SLASH@32..33 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@33..36 "div" [] [], - }, - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@37..39 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_FUNCTION_DECLARATION@0..39 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@13..39 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..37 - 0: JS_RETURN_STATEMENT@14..37 - 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JSX_TAG_EXPRESSION@26..37 - 0: JSX_ELEMENT@26..37 - 0: JSX_OPENING_ELEMENT@26..31 - 0: L_ANGLE@26..27 "<" [] [] - 1: JSX_NAME@27..30 - 0: JSX_IDENT@27..30 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@30..30 - 4: R_ANGLE@30..31 ">" [] [] - 1: JSX_CHILD_LIST@31..31 - 2: JSX_CLOSING_ELEMENT@31..37 - 0: L_ANGLE@31..32 "<" [] [] - 1: SLASH@32..33 "/" [] [] - 2: JSX_NAME@33..36 - 0: JSX_IDENT@33..36 "div" [] [] - 3: R_ANGLE@36..37 ">" [] [] - 2: (empty) - 3: R_CURLY@37..39 "}" [Newline("\n")] [] - 4: EOF@39..40 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.rast deleted file mode 100644 index 288de54ddc09..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.rast +++ /dev/null @@ -1,99 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@26..27 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@27..30 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@30..31 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@31..32 "<" [] [], - slash_token: SLASH@32..33 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@33..36 "div" [] [], - }, - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@37..39 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@39..40 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..40 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..39 - 0: JS_FUNCTION_DECLARATION@0..39 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@13..39 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..37 - 0: JS_RETURN_STATEMENT@14..37 - 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JSX_TAG_EXPRESSION@26..37 - 0: JSX_ELEMENT@26..37 - 0: JSX_OPENING_ELEMENT@26..31 - 0: L_ANGLE@26..27 "<" [] [] - 1: JSX_NAME@27..30 - 0: JSX_IDENT@27..30 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@30..30 - 4: R_ANGLE@30..31 ">" [] [] - 1: JSX_CHILD_LIST@31..31 - 2: JSX_CLOSING_ELEMENT@31..37 - 0: L_ANGLE@31..32 "<" [] [] - 1: SLASH@32..33 "/" [] [] - 2: JSX_NAME@33..36 - 0: JSX_IDENT@33..36 "div" [] [] - 3: R_ANGLE@36..37 ">" [] [] - 2: (empty) - 3: R_CURLY@37..39 "}" [Newline("\n")] [] - 4: EOF@39..40 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.rast deleted file mode 100644 index 255f91cdead3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.rast +++ /dev/null @@ -1,82 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@26..27 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@27..31 "div" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@31..32 "/" [] [], - r_angle_token: R_ANGLE@32..33 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@33..35 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: JS_FUNCTION_DECLARATION@0..35 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..13 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..11 - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@13..35 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..33 - 0: JS_RETURN_STATEMENT@14..33 - 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JSX_TAG_EXPRESSION@26..33 - 0: JSX_SELF_CLOSING_ELEMENT@26..33 - 0: L_ANGLE@26..27 "<" [] [] - 1: JSX_NAME@27..31 - 0: JSX_IDENT@27..31 "div" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@31..31 - 4: SLASH@31..32 "/" [] [] - 5: R_ANGLE@32..33 ">" [] [] - 2: (empty) - 3: R_CURLY@33..35 "}" [Newline("\n")] [] - 4: EOF@35..36 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.rast deleted file mode 100644 index 4639a5b571fd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.rast +++ /dev/null @@ -1,107 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..5 "span" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@6..7 "<" [] [], - slash_token: SLASH@7..8 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@8..12 "span" [] [], - }, - r_angle_token: R_ANGLE@12..13 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@14..16 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@16..20 "span" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@20..21 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@21..22 "=" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@22..23 "<" [] [], - slash_token: SLASH@23..24 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@24..28 "span" [] [], - }, - r_angle_token: R_ANGLE@28..29 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@29..30 ";" [] [], - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_EXPRESSION_STATEMENT@0..14 - 0: JSX_TAG_EXPRESSION@0..13 - 0: JSX_ELEMENT@0..13 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..5 - 0: JSX_IDENT@1..5 "span" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@5..5 - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..6 - 2: JSX_CLOSING_ELEMENT@6..13 - 0: L_ANGLE@6..7 "<" [] [] - 1: SLASH@7..8 "/" [] [] - 2: JSX_NAME@8..12 - 0: JSX_IDENT@8..12 "span" [] [] - 3: R_ANGLE@12..13 ">" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@14..30 - 0: JSX_TAG_EXPRESSION@14..29 - 0: JSX_ELEMENT@14..29 - 0: JSX_OPENING_ELEMENT@14..21 - 0: L_ANGLE@14..16 "<" [Newline("\n")] [] - 1: JSX_NAME@16..20 - 0: JSX_IDENT@16..20 "span" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@20..20 - 4: R_ANGLE@20..21 ">" [] [] - 1: JSX_CHILD_LIST@21..22 - 0: JSX_TEXT@21..22 - 0: JSX_TEXT_LITERAL@21..22 "=" [] [] - 2: JSX_CLOSING_ELEMENT@22..29 - 0: L_ANGLE@22..23 "<" [] [] - 1: SLASH@23..24 "/" [] [] - 2: JSX_NAME@24..28 - 0: JSX_IDENT@24..28 "span" [] [] - 3: R_ANGLE@28..29 ">" [] [] - 1: SEMICOLON@29..30 ";" [] [] - 4: EOF@30..31 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.rast deleted file mode 100644 index 993bfc84c8b4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.rast +++ /dev/null @@ -1,149 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@0..1 "<" [] [], - r_angle_token: R_ANGLE@1..2 ">" [] [], - }, - children: JsxChildList [], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@2..3 "<" [] [], - slash_token: SLASH@3..4 "/" [] [], - r_angle_token: R_ANGLE@4..5 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@5..6 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@6..8 "<" [Newline("\n")] [], - r_angle_token: R_ANGLE@8..9 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@9..13 "abcd" [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@13..14 "<" [] [], - slash_token: SLASH@14..15 "/" [] [], - r_angle_token: R_ANGLE@15..16 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@17..19 "<" [Newline("\n")] [], - r_angle_token: R_ANGLE@19..20 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@20..34 " whitespace\n" [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@34..35 "<" [] [], - slash_token: SLASH@35..36 "/" [] [], - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxFragment { - opening_fragment: JsxOpeningFragment { - l_angle_token: L_ANGLE@38..40 "<" [Newline("\n")] [], - r_angle_token: R_ANGLE@40..59 ">" [Newline("\n"), Whitespace(" "), Comments("/*comment */"), Newline("\n"), Whitespace(" ")] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@59..62 "\n " [] [], - }, - ], - closing_fragment: JsxClosingFragment { - l_angle_token: L_ANGLE@62..63 "<" [] [], - slash_token: SLASH@63..67 "/" [Newline("\n"), Whitespace(" ")] [], - r_angle_token: R_ANGLE@67..69 ">" [Newline("\n")] [], - }, - }, - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - ], - eof_token: EOF@70..71 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..71 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..70 - 0: JS_EXPRESSION_STATEMENT@0..6 - 0: JSX_TAG_EXPRESSION@0..5 - 0: JSX_FRAGMENT@0..5 - 0: JSX_OPENING_FRAGMENT@0..2 - 0: L_ANGLE@0..1 "<" [] [] - 1: R_ANGLE@1..2 ">" [] [] - 1: JSX_CHILD_LIST@2..2 - 2: JSX_CLOSING_FRAGMENT@2..5 - 0: L_ANGLE@2..3 "<" [] [] - 1: SLASH@3..4 "/" [] [] - 2: R_ANGLE@4..5 ">" [] [] - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@6..17 - 0: JSX_TAG_EXPRESSION@6..16 - 0: JSX_FRAGMENT@6..16 - 0: JSX_OPENING_FRAGMENT@6..9 - 0: L_ANGLE@6..8 "<" [Newline("\n")] [] - 1: R_ANGLE@8..9 ">" [] [] - 1: JSX_CHILD_LIST@9..13 - 0: JSX_TEXT@9..13 - 0: JSX_TEXT_LITERAL@9..13 "abcd" [] [] - 2: JSX_CLOSING_FRAGMENT@13..16 - 0: L_ANGLE@13..14 "<" [] [] - 1: SLASH@14..15 "/" [] [] - 2: R_ANGLE@15..16 ">" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@17..38 - 0: JSX_TAG_EXPRESSION@17..37 - 0: JSX_FRAGMENT@17..37 - 0: JSX_OPENING_FRAGMENT@17..20 - 0: L_ANGLE@17..19 "<" [Newline("\n")] [] - 1: R_ANGLE@19..20 ">" [] [] - 1: JSX_CHILD_LIST@20..34 - 0: JSX_TEXT@20..34 - 0: JSX_TEXT_LITERAL@20..34 " whitespace\n" [] [] - 2: JSX_CLOSING_FRAGMENT@34..37 - 0: L_ANGLE@34..35 "<" [] [] - 1: SLASH@35..36 "/" [] [] - 2: R_ANGLE@36..37 ">" [] [] - 1: SEMICOLON@37..38 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@38..70 - 0: JSX_TAG_EXPRESSION@38..69 - 0: JSX_FRAGMENT@38..69 - 0: JSX_OPENING_FRAGMENT@38..59 - 0: L_ANGLE@38..40 "<" [Newline("\n")] [] - 1: R_ANGLE@40..59 ">" [Newline("\n"), Whitespace(" "), Comments("/*comment */"), Newline("\n"), Whitespace(" ")] [] - 1: JSX_CHILD_LIST@59..62 - 0: JSX_TEXT@59..62 - 0: JSX_TEXT_LITERAL@59..62 "\n " [] [] - 2: JSX_CLOSING_FRAGMENT@62..69 - 0: L_ANGLE@62..63 "<" [] [] - 1: SLASH@63..67 "/" [Newline("\n"), Whitespace(" ")] [] - 2: R_ANGLE@67..69 ">" [Newline("\n")] [] - 1: SEMICOLON@69..70 ";" [] [] - 4: EOF@70..71 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.rast deleted file mode 100644 index 68da288b185e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.rast +++ /dev/null @@ -1,224 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxMemberName { - object: JsxMemberName { - object: JsxMemberName { - object: JsxReferenceIdentifier { - value_token: JSX_IDENT@1..2 "a" [] [], - }, - dot_token: DOT@2..3 "." [] [], - member: JsName { - value_token: IDENT@3..4 "b" [] [], - }, - }, - dot_token: DOT@4..5 "." [] [], - member: JsName { - value_token: IDENT@5..6 "c" [] [], - }, - }, - dot_token: DOT@6..7 "." [] [], - member: JsName { - value_token: IDENT@7..8 "d" [] [], - }, - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@8..9 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@9..10 "<" [] [], - slash_token: SLASH@10..11 "/" [] [], - name: JsxMemberName { - object: JsxMemberName { - object: JsxMemberName { - object: JsxReferenceIdentifier { - value_token: JSX_IDENT@11..12 "a" [] [], - }, - dot_token: DOT@12..13 "." [] [], - member: JsName { - value_token: IDENT@13..14 "b" [] [], - }, - }, - dot_token: DOT@14..15 "." [] [], - member: JsName { - value_token: IDENT@15..16 "c" [] [], - }, - }, - dot_token: DOT@16..17 "." [] [], - member: JsName { - value_token: IDENT@17..18 "d" [] [], - }, - }, - r_angle_token: R_ANGLE@18..19 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@20..22 "<" [Newline("\n")] [], - name: JsxMemberName { - object: JsxReferenceIdentifier { - value_token: JSX_IDENT@22..25 "a-b" [] [], - }, - dot_token: DOT@25..26 "." [] [], - member: JsName { - value_token: IDENT@26..27 "c" [] [], - }, - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@27..28 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@28..29 "<" [] [], - slash_token: SLASH@29..30 "/" [] [], - name: JsxMemberName { - object: JsxReferenceIdentifier { - value_token: JSX_IDENT@30..33 "a-b" [] [], - }, - dot_token: DOT@33..34 "." [] [], - member: JsName { - value_token: IDENT@34..35 "c" [] [], - }, - }, - r_angle_token: R_ANGLE@35..36 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@37..39 "<" [Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@39..43 "Abcd" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@43..44 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@44..45 "<" [] [], - slash_token: SLASH@45..46 "/" [] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@46..50 "Abcd" [] [], - }, - r_angle_token: R_ANGLE@50..51 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@51..52 ";" [] [], - }, - ], - eof_token: EOF@52..53 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..53 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..52 - 0: JS_EXPRESSION_STATEMENT@0..20 - 0: JSX_TAG_EXPRESSION@0..19 - 0: JSX_ELEMENT@0..19 - 0: JSX_OPENING_ELEMENT@0..9 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_MEMBER_NAME@1..8 - 0: JSX_MEMBER_NAME@1..6 - 0: JSX_MEMBER_NAME@1..4 - 0: JSX_REFERENCE_IDENTIFIER@1..2 - 0: JSX_IDENT@1..2 "a" [] [] - 1: DOT@2..3 "." [] [] - 2: JS_NAME@3..4 - 0: IDENT@3..4 "b" [] [] - 1: DOT@4..5 "." [] [] - 2: JS_NAME@5..6 - 0: IDENT@5..6 "c" [] [] - 1: DOT@6..7 "." [] [] - 2: JS_NAME@7..8 - 0: IDENT@7..8 "d" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@8..8 - 4: R_ANGLE@8..9 ">" [] [] - 1: JSX_CHILD_LIST@9..9 - 2: JSX_CLOSING_ELEMENT@9..19 - 0: L_ANGLE@9..10 "<" [] [] - 1: SLASH@10..11 "/" [] [] - 2: JSX_MEMBER_NAME@11..18 - 0: JSX_MEMBER_NAME@11..16 - 0: JSX_MEMBER_NAME@11..14 - 0: JSX_REFERENCE_IDENTIFIER@11..12 - 0: JSX_IDENT@11..12 "a" [] [] - 1: DOT@12..13 "." [] [] - 2: JS_NAME@13..14 - 0: IDENT@13..14 "b" [] [] - 1: DOT@14..15 "." [] [] - 2: JS_NAME@15..16 - 0: IDENT@15..16 "c" [] [] - 1: DOT@16..17 "." [] [] - 2: JS_NAME@17..18 - 0: IDENT@17..18 "d" [] [] - 3: R_ANGLE@18..19 ">" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@20..37 - 0: JSX_TAG_EXPRESSION@20..36 - 0: JSX_ELEMENT@20..36 - 0: JSX_OPENING_ELEMENT@20..28 - 0: L_ANGLE@20..22 "<" [Newline("\n")] [] - 1: JSX_MEMBER_NAME@22..27 - 0: JSX_REFERENCE_IDENTIFIER@22..25 - 0: JSX_IDENT@22..25 "a-b" [] [] - 1: DOT@25..26 "." [] [] - 2: JS_NAME@26..27 - 0: IDENT@26..27 "c" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@27..27 - 4: R_ANGLE@27..28 ">" [] [] - 1: JSX_CHILD_LIST@28..28 - 2: JSX_CLOSING_ELEMENT@28..36 - 0: L_ANGLE@28..29 "<" [] [] - 1: SLASH@29..30 "/" [] [] - 2: JSX_MEMBER_NAME@30..35 - 0: JSX_REFERENCE_IDENTIFIER@30..33 - 0: JSX_IDENT@30..33 "a-b" [] [] - 1: DOT@33..34 "." [] [] - 2: JS_NAME@34..35 - 0: IDENT@34..35 "c" [] [] - 3: R_ANGLE@35..36 ">" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@37..52 - 0: JSX_TAG_EXPRESSION@37..51 - 0: JSX_ELEMENT@37..51 - 0: JSX_OPENING_ELEMENT@37..44 - 0: L_ANGLE@37..39 "<" [Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@39..43 - 0: JSX_IDENT@39..43 "Abcd" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@43..43 - 4: R_ANGLE@43..44 ">" [] [] - 1: JSX_CHILD_LIST@44..44 - 2: JSX_CLOSING_ELEMENT@44..51 - 0: L_ANGLE@44..45 "<" [] [] - 1: SLASH@45..46 "/" [] [] - 2: JSX_REFERENCE_IDENTIFIER@46..50 - 0: JSX_IDENT@46..50 "Abcd" [] [] - 3: R_ANGLE@50..51 ">" [] [] - 1: SEMICOLON@51..52 ";" [] [] - 4: EOF@52..53 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.rast deleted file mode 100644 index 1a8f807d5148..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.rast +++ /dev/null @@ -1,99 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsStaticMemberExpression { - object: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@8..9 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@9..13 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@13..14 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@14..18 "abcd" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@18..19 "<" [] [], - slash_token: SLASH@19..20 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@20..24 "test" [] [], - }, - r_angle_token: R_ANGLE@24..25 ">" [] [], - }, - }, - }, - operator_token: DOT@25..26 "." [] [], - member: JsName { - value_token: IDENT@26..27 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_VARIABLE_STATEMENT@0..28 - 0: JS_VARIABLE_DECLARATION@0..27 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..27 - 0: JS_VARIABLE_DECLARATOR@4..27 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..27 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@8..27 - 0: JSX_TAG_EXPRESSION@8..25 - 0: JSX_ELEMENT@8..25 - 0: JSX_OPENING_ELEMENT@8..14 - 0: L_ANGLE@8..9 "<" [] [] - 1: JSX_NAME@9..13 - 0: JSX_IDENT@9..13 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@13..13 - 4: R_ANGLE@13..14 ">" [] [] - 1: JSX_CHILD_LIST@14..18 - 0: JSX_TEXT@14..18 - 0: JSX_TEXT_LITERAL@14..18 "abcd" [] [] - 2: JSX_CLOSING_ELEMENT@18..25 - 0: L_ANGLE@18..19 "<" [] [] - 1: SLASH@19..20 "/" [] [] - 2: JSX_NAME@20..24 - 0: JSX_IDENT@20..24 "test" [] [] - 3: R_ANGLE@24..25 ">" [] [] - 1: DOT@25..26 "." [] [] - 2: JS_NAME@26..27 - 0: IDENT@26..27 "c" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast deleted file mode 100644 index a62bac282fd6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast +++ /dev/null @@ -1,98 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "obj" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@11..12 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@13..15 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@15..17 "a" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@17..18 "{" [] [], - dotdotdot_token: DOT3@18..21 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@26..27 "/" [] [], - r_angle_token: R_ANGLE@27..28 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_VARIABLE_STATEMENT@0..13 - 0: JS_VARIABLE_DECLARATION@0..12 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..12 - 0: JS_VARIABLE_DECLARATOR@4..12 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "obj" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..12 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@10..12 - 0: L_CURLY@10..11 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@11..11 - 2: R_CURLY@11..12 "}" [] [] - 1: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@13..29 - 0: JSX_TAG_EXPRESSION@13..28 - 0: JSX_SELF_CLOSING_ELEMENT@13..28 - 0: L_ANGLE@13..15 "<" [Newline("\n")] [] - 1: JSX_NAME@15..17 - 0: JSX_IDENT@15..17 "a" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@17..26 - 0: JSX_SPREAD_ATTRIBUTE@17..26 - 0: L_CURLY@17..18 "{" [] [] - 1: DOT3@18..21 "..." [] [] - 2: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "obj" [] [] - 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] - 4: SLASH@26..27 "/" [] [] - 5: R_ANGLE@27..28 ">" [] [] - 1: SEMICOLON@28..29 ";" [] [] - 4: EOF@29..30 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_text.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_text.rast deleted file mode 100644 index 2aefd006a8b5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_text.rast +++ /dev/null @@ -1,211 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..2 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@2..3 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@3..7 "test" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@7..8 "<" [] [], - slash_token: SLASH@8..9 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@9..10 "a" [] [], - }, - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@12..14 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@14..15 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@15..16 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@16..39 " whitespace handling " [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@39..40 "<" [] [], - slash_token: SLASH@40..41 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@41..42 "a" [] [], - }, - r_angle_token: R_ANGLE@42..43 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@44..46 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@46..47 "a" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@47..48 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@48..77 " multi\n line\n node\n" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@77..78 "<" [] [], - slash_token: SLASH@78..79 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@79..80 "a" [] [], - }, - r_angle_token: R_ANGLE@80..81 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@81..82 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@82..84 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@84..88 "test" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@88..89 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@89..95 "\\u3333" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@95..96 "<" [] [], - slash_token: SLASH@96..97 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@97..101 "test" [] [], - }, - r_angle_token: R_ANGLE@101..141 ">" [] [Whitespace(" "), Comments("// no error for inval ...")], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@141..142 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..142 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..141 - 0: JS_EXPRESSION_STATEMENT@0..12 - 0: JSX_TAG_EXPRESSION@0..11 - 0: JSX_ELEMENT@0..11 - 0: JSX_OPENING_ELEMENT@0..3 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..2 - 0: JSX_IDENT@1..2 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@2..2 - 4: R_ANGLE@2..3 ">" [] [] - 1: JSX_CHILD_LIST@3..7 - 0: JSX_TEXT@3..7 - 0: JSX_TEXT_LITERAL@3..7 "test" [] [] - 2: JSX_CLOSING_ELEMENT@7..11 - 0: L_ANGLE@7..8 "<" [] [] - 1: SLASH@8..9 "/" [] [] - 2: JSX_NAME@9..10 - 0: JSX_IDENT@9..10 "a" [] [] - 3: R_ANGLE@10..11 ">" [] [] - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@12..44 - 0: JSX_TAG_EXPRESSION@12..43 - 0: JSX_ELEMENT@12..43 - 0: JSX_OPENING_ELEMENT@12..16 - 0: L_ANGLE@12..14 "<" [Newline("\n")] [] - 1: JSX_NAME@14..15 - 0: JSX_IDENT@14..15 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@15..15 - 4: R_ANGLE@15..16 ">" [] [] - 1: JSX_CHILD_LIST@16..39 - 0: JSX_TEXT@16..39 - 0: JSX_TEXT_LITERAL@16..39 " whitespace handling " [] [] - 2: JSX_CLOSING_ELEMENT@39..43 - 0: L_ANGLE@39..40 "<" [] [] - 1: SLASH@40..41 "/" [] [] - 2: JSX_NAME@41..42 - 0: JSX_IDENT@41..42 "a" [] [] - 3: R_ANGLE@42..43 ">" [] [] - 1: SEMICOLON@43..44 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@44..82 - 0: JSX_TAG_EXPRESSION@44..81 - 0: JSX_ELEMENT@44..81 - 0: JSX_OPENING_ELEMENT@44..48 - 0: L_ANGLE@44..46 "<" [Newline("\n")] [] - 1: JSX_NAME@46..47 - 0: JSX_IDENT@46..47 "a" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@47..47 - 4: R_ANGLE@47..48 ">" [] [] - 1: JSX_CHILD_LIST@48..77 - 0: JSX_TEXT@48..77 - 0: JSX_TEXT_LITERAL@48..77 " multi\n line\n node\n" [] [] - 2: JSX_CLOSING_ELEMENT@77..81 - 0: L_ANGLE@77..78 "<" [] [] - 1: SLASH@78..79 "/" [] [] - 2: JSX_NAME@79..80 - 0: JSX_IDENT@79..80 "a" [] [] - 3: R_ANGLE@80..81 ">" [] [] - 1: SEMICOLON@81..82 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@82..141 - 0: JSX_TAG_EXPRESSION@82..141 - 0: JSX_ELEMENT@82..141 - 0: JSX_OPENING_ELEMENT@82..89 - 0: L_ANGLE@82..84 "<" [Newline("\n")] [] - 1: JSX_NAME@84..88 - 0: JSX_IDENT@84..88 "test" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@88..88 - 4: R_ANGLE@88..89 ">" [] [] - 1: JSX_CHILD_LIST@89..95 - 0: JSX_TEXT@89..95 - 0: JSX_TEXT_LITERAL@89..95 "\\u3333" [] [] - 2: JSX_CLOSING_ELEMENT@95..141 - 0: L_ANGLE@95..96 "<" [] [] - 1: SLASH@96..97 "/" [] [] - 2: JSX_NAME@97..101 - 0: JSX_IDENT@97..101 "test" [] [] - 3: R_ANGLE@101..141 ">" [] [Whitespace(" "), Comments("// no error for inval ...")] - 1: (empty) - 4: EOF@141..142 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.rast b/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.rast deleted file mode 100644 index 9851592e2225..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.rast +++ /dev/null @@ -1,357 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..51 "<" [Comments("// These may look lik ..."), Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@51..53 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@53..60 "extends" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@60..61 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@61..65 "() =" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@65..66 "<" [] [], - slash_token: SLASH@66..67 "/" [] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@67..68 "A" [] [], - }, - r_angle_token: R_ANGLE@68..69 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@70..72 "<" [Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@72..74 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@74..81 "extends" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@81..82 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@82..85 "\"B\"" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@85..86 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@86..90 "() =" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@90..91 "<" [] [], - slash_token: SLASH@91..92 "/" [] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@92..93 "A" [] [], - }, - r_angle_token: R_ANGLE@93..94 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@94..95 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@95..97 "<" [Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@97..99 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@99..107 "extends" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@107..109 "ok" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@109..110 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@110..114 "() =" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@114..115 "<" [] [], - slash_token: SLASH@115..116 "/" [] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@116..117 "A" [] [], - }, - r_angle_token: R_ANGLE@117..118 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@118..119 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@119..121 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@121..127 "const" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@127..128 "A" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@128..129 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@129..133 "() =" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@133..134 "<" [] [], - slash_token: SLASH@134..135 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@135..140 "const" [] [], - }, - r_angle_token: R_ANGLE@140..141 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@141..142 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@142..144 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@144..150 "const" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@150..152 "A" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@152..159 "extends" [] [], - }, - initializer: missing (optional), - }, - ], - slash_token: SLASH@159..160 "/" [] [], - r_angle_token: R_ANGLE@160..161 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@161..162 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@162..164 "<" [Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@164..166 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@166..173 "extends" [] [], - }, - initializer: missing (optional), - }, - ], - slash_token: SLASH@173..174 "/" [] [], - r_angle_token: R_ANGLE@174..175 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@175..176 ";" [] [], - }, - ], - eof_token: EOF@176..177 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..177 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..176 - 0: JS_EXPRESSION_STATEMENT@0..70 - 0: JSX_TAG_EXPRESSION@0..69 - 0: JSX_ELEMENT@0..69 - 0: JSX_OPENING_ELEMENT@0..61 - 0: L_ANGLE@0..51 "<" [Comments("// These may look lik ..."), Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@51..53 - 0: JSX_IDENT@51..53 "A" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@53..60 - 0: JSX_ATTRIBUTE@53..60 - 0: JSX_NAME@53..60 - 0: JSX_IDENT@53..60 "extends" [] [] - 1: (empty) - 4: R_ANGLE@60..61 ">" [] [] - 1: JSX_CHILD_LIST@61..65 - 0: JSX_TEXT@61..65 - 0: JSX_TEXT_LITERAL@61..65 "() =" [] [] - 2: JSX_CLOSING_ELEMENT@65..69 - 0: L_ANGLE@65..66 "<" [] [] - 1: SLASH@66..67 "/" [] [] - 2: JSX_REFERENCE_IDENTIFIER@67..68 - 0: JSX_IDENT@67..68 "A" [] [] - 3: R_ANGLE@68..69 ">" [] [] - 1: SEMICOLON@69..70 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@70..95 - 0: JSX_TAG_EXPRESSION@70..94 - 0: JSX_ELEMENT@70..94 - 0: JSX_OPENING_ELEMENT@70..86 - 0: L_ANGLE@70..72 "<" [Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@72..74 - 0: JSX_IDENT@72..74 "A" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@74..85 - 0: JSX_ATTRIBUTE@74..85 - 0: JSX_NAME@74..81 - 0: JSX_IDENT@74..81 "extends" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@81..85 - 0: EQ@81..82 "=" [] [] - 1: JSX_STRING@82..85 - 0: JSX_STRING_LITERAL@82..85 "\"B\"" [] [] - 4: R_ANGLE@85..86 ">" [] [] - 1: JSX_CHILD_LIST@86..90 - 0: JSX_TEXT@86..90 - 0: JSX_TEXT_LITERAL@86..90 "() =" [] [] - 2: JSX_CLOSING_ELEMENT@90..94 - 0: L_ANGLE@90..91 "<" [] [] - 1: SLASH@91..92 "/" [] [] - 2: JSX_REFERENCE_IDENTIFIER@92..93 - 0: JSX_IDENT@92..93 "A" [] [] - 3: R_ANGLE@93..94 ">" [] [] - 1: SEMICOLON@94..95 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@95..119 - 0: JSX_TAG_EXPRESSION@95..118 - 0: JSX_ELEMENT@95..118 - 0: JSX_OPENING_ELEMENT@95..110 - 0: L_ANGLE@95..97 "<" [Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@97..99 - 0: JSX_IDENT@97..99 "A" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@99..109 - 0: JSX_ATTRIBUTE@99..107 - 0: JSX_NAME@99..107 - 0: JSX_IDENT@99..107 "extends" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@107..109 - 0: JSX_NAME@107..109 - 0: JSX_IDENT@107..109 "ok" [] [] - 1: (empty) - 4: R_ANGLE@109..110 ">" [] [] - 1: JSX_CHILD_LIST@110..114 - 0: JSX_TEXT@110..114 - 0: JSX_TEXT_LITERAL@110..114 "() =" [] [] - 2: JSX_CLOSING_ELEMENT@114..118 - 0: L_ANGLE@114..115 "<" [] [] - 1: SLASH@115..116 "/" [] [] - 2: JSX_REFERENCE_IDENTIFIER@116..117 - 0: JSX_IDENT@116..117 "A" [] [] - 3: R_ANGLE@117..118 ">" [] [] - 1: SEMICOLON@118..119 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@119..142 - 0: JSX_TAG_EXPRESSION@119..141 - 0: JSX_ELEMENT@119..141 - 0: JSX_OPENING_ELEMENT@119..129 - 0: L_ANGLE@119..121 "<" [Newline("\n")] [] - 1: JSX_NAME@121..127 - 0: JSX_IDENT@121..127 "const" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@127..128 - 0: JSX_ATTRIBUTE@127..128 - 0: JSX_NAME@127..128 - 0: JSX_IDENT@127..128 "A" [] [] - 1: (empty) - 4: R_ANGLE@128..129 ">" [] [] - 1: JSX_CHILD_LIST@129..133 - 0: JSX_TEXT@129..133 - 0: JSX_TEXT_LITERAL@129..133 "() =" [] [] - 2: JSX_CLOSING_ELEMENT@133..141 - 0: L_ANGLE@133..134 "<" [] [] - 1: SLASH@134..135 "/" [] [] - 2: JSX_NAME@135..140 - 0: JSX_IDENT@135..140 "const" [] [] - 3: R_ANGLE@140..141 ">" [] [] - 1: SEMICOLON@141..142 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@142..162 - 0: JSX_TAG_EXPRESSION@142..161 - 0: JSX_SELF_CLOSING_ELEMENT@142..161 - 0: L_ANGLE@142..144 "<" [Newline("\n")] [] - 1: JSX_NAME@144..150 - 0: JSX_IDENT@144..150 "const" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@150..159 - 0: JSX_ATTRIBUTE@150..152 - 0: JSX_NAME@150..152 - 0: JSX_IDENT@150..152 "A" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@152..159 - 0: JSX_NAME@152..159 - 0: JSX_IDENT@152..159 "extends" [] [] - 1: (empty) - 4: SLASH@159..160 "/" [] [] - 5: R_ANGLE@160..161 ">" [] [] - 1: SEMICOLON@161..162 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@162..176 - 0: JSX_TAG_EXPRESSION@162..175 - 0: JSX_SELF_CLOSING_ELEMENT@162..175 - 0: L_ANGLE@162..164 "<" [Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@164..166 - 0: JSX_IDENT@164..166 "A" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@166..173 - 0: JSX_ATTRIBUTE@166..173 - 0: JSX_NAME@166..173 - 0: JSX_IDENT@166..173 "extends" [] [] - 1: (empty) - 4: SLASH@173..174 "/" [] [] - 5: R_ANGLE@174..175 ">" [] [] - 1: SEMICOLON@175..176 ";" [] [] - 4: EOF@176..177 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/labeled_statement.rast b/crates/biome_js_parser/test_data/inline/ok/labeled_statement.rast deleted file mode 100644 index 8cd7d9200802..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/labeled_statement.rast +++ /dev/null @@ -1,75 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..6 "label1" [] [], - }, - colon_token: COLON@6..8 ":" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@8..9 "1" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@9..16 "label1" [Newline("\n")] [], - }, - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@18..19 "1" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@19..26 "label2" [Newline("\n")] [], - }, - colon_token: COLON@26..28 ":" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@28..29 "2" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_LABELED_STATEMENT@0..9 - 0: JS_LABEL@0..6 - 0: IDENT@0..6 "label1" [] [] - 1: COLON@6..8 ":" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@8..9 - 0: JS_NUMBER_LITERAL_EXPRESSION@8..9 - 0: JS_NUMBER_LITERAL@8..9 "1" [] [] - 1: (empty) - 1: JS_LABELED_STATEMENT@9..19 - 0: JS_LABEL@9..16 - 0: IDENT@9..16 "label1" [Newline("\n")] [] - 1: COLON@16..18 ":" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@18..19 - 0: JS_NUMBER_LITERAL_EXPRESSION@18..19 - 0: JS_NUMBER_LITERAL@18..19 "1" [] [] - 1: (empty) - 2: JS_LABELED_STATEMENT@19..29 - 0: JS_LABEL@19..26 - 0: IDENT@19..26 "label2" [Newline("\n")] [] - 1: COLON@26..28 ":" [] [Whitespace(" ")] - 2: JS_EXPRESSION_STATEMENT@28..29 - 0: JS_NUMBER_LITERAL_EXPRESSION@28..29 - 0: JS_NUMBER_LITERAL@28..29 "2" [] [] - 1: (empty) - 4: EOF@29..30 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.rast deleted file mode 100644 index 76309c6926d6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.rast +++ /dev/null @@ -1,63 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsLabeledStatement { - label: JsLabel { - value_token: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [], - }, - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - body: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@27..28 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@31..32 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@33..34 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..34 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..33 - 0: JS_LABELED_STATEMENT@0..33 - 0: JS_LABEL@0..16 - 0: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [] - 1: COLON@16..18 ":" [] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@18..33 - 0: (empty) - 1: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@27..28 - 0: IDENT@27..28 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@28..31 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..29 - 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@31..33 - 0: L_CURLY@31..32 "{" [] [] - 1: JS_DIRECTIVE_LIST@32..32 - 2: JS_STATEMENT_LIST@32..32 - 3: R_CURLY@32..33 "}" [] [] - 4: EOF@33..34 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast b/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast deleted file mode 100644 index a4c827628600..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast +++ /dev/null @@ -1,76 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsIfStatement { - if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], - l_paren_token: L_PAREN@3..4 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@4..8 "true" [] [], - }, - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - consequent: JsLabeledStatement { - label: JsLabel { - value_token: IDENT@10..16 "label1" [] [], - }, - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - body: JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@18..22 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@22..24 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@26..28 "10" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - }, - else_clause: missing (optional), - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: JS_IF_STATEMENT@0..29 - 0: IF_KW@0..3 "if" [] [Whitespace(" ")] - 1: L_PAREN@3..4 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 - 0: TRUE_KW@4..8 "true" [] [] - 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 4: JS_LABELED_STATEMENT@10..29 - 0: JS_LABEL@10..16 - 0: IDENT@10..16 "label1" [] [] - 1: COLON@16..18 ":" [] [Whitespace(" ")] - 2: JS_VARIABLE_STATEMENT@18..29 - 0: JS_VARIABLE_DECLARATION@18..28 - 0: (empty) - 1: VAR_KW@18..22 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@22..28 - 0: JS_VARIABLE_DECLARATOR@22..28 - 0: JS_IDENTIFIER_BINDING@22..24 - 0: IDENT@22..24 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@24..28 - 0: EQ@24..26 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@26..28 - 0: JS_NUMBER_LITERAL@26..28 "10" [] [] - 1: SEMICOLON@28..29 ";" [] [] - 5: (empty) - 4: EOF@29..30 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.rast b/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.rast deleted file mode 100644 index 0a4fff668575..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.rast +++ /dev/null @@ -1,124 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..23 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" "), Comments("// NO ASI")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@23..26 "x" [Newline("\n")] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@26..28 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@28..29 "1" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@29..30 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@30..35 "for" [Newline("\n")] [Whitespace(" ")], - await_token: AWAIT_KW@35..41 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@41..42 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: VAR_KW@42..46 "var" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@46..48 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@48..51 "of" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@51..52 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@52..53 "]" [] [], - }, - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - body: JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..65 "let" [] [Whitespace(" "), Comments("// ASI")], - }, - }, - semicolon_token: missing (optional), - }, - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@65..68 "x" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@68..70 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@70..71 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@71..72 ";" [] [], - }, - ], - eof_token: EOF@72..73 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..73 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..72 - 0: JS_VARIABLE_STATEMENT@0..30 - 0: JS_VARIABLE_DECLARATION@0..29 - 0: (empty) - 1: LET_KW@0..23 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" "), Comments("// NO ASI")] - 2: JS_VARIABLE_DECLARATOR_LIST@23..29 - 0: JS_VARIABLE_DECLARATOR@23..29 - 0: JS_IDENTIFIER_BINDING@23..26 - 0: IDENT@23..26 "x" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@26..29 - 0: EQ@26..28 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@28..29 - 0: JS_NUMBER_LITERAL@28..29 "1" [] [] - 1: SEMICOLON@29..30 ";" [] [] - 1: JS_FOR_OF_STATEMENT@30..65 - 0: FOR_KW@30..35 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@35..41 "await" [] [Whitespace(" ")] - 2: L_PAREN@41..42 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@42..48 - 0: (empty) - 1: VAR_KW@42..46 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@46..48 - 0: JS_IDENTIFIER_BINDING@46..48 - 0: IDENT@46..48 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@48..51 "of" [] [Whitespace(" ")] - 5: JS_ARRAY_EXPRESSION@51..53 - 0: L_BRACK@51..52 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@52..52 - 2: R_BRACK@52..53 "]" [] [] - 6: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 7: JS_EXPRESSION_STATEMENT@55..65 - 0: JS_IDENTIFIER_EXPRESSION@55..65 - 0: JS_REFERENCE_IDENTIFIER@55..65 - 0: IDENT@55..65 "let" [] [Whitespace(" "), Comments("// ASI")] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@65..72 - 0: JS_ASSIGNMENT_EXPRESSION@65..71 - 0: JS_IDENTIFIER_ASSIGNMENT@65..68 - 0: IDENT@65..68 "x" [Newline("\n")] [Whitespace(" ")] - 1: EQ@68..70 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@70..71 - 0: JS_NUMBER_LITERAL@70..71 "1" [] [] - 1: SEMICOLON@71..72 ";" [] [] - 4: EOF@72..73 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/literals.rast b/crates/biome_js_parser/test_data/inline/ok/literals.rast deleted file mode 100644 index 947496aec896..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/literals.rast +++ /dev/null @@ -1,165 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..1 "5" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@1..6 "true" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: FALSE_KW@6..12 "false" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBigintLiteralExpression { - value_token: JS_BIGINT_LITERAL@12..15 "5n" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@15..21 "\"foo\"" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@21..27 "'bar'" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNullLiteralExpression { - value_token: NULL_KW@27..32 "null" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@32..34 "0" [Newline("\n")] [], - }, - comma_token: COMMA@34..36 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@36..39 "0.0" [] [], - }, - }, - comma_token: COMMA@39..41 "," [] [Whitespace(" ")], - right: JsBigintLiteralExpression { - value_token: JS_BIGINT_LITERAL@41..43 "0n" [] [], - }, - }, - comma_token: COMMA@43..45 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@45..49 "0e00" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@49..66 "\"test\\\nnew-line\"" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@66..67 ";" [] [], - }, - JsExpressionStatement { - expression: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@67..103 "/^[يفمئامئ\u{200d}ئاسۆند]/i" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@103..125 ";" [] [Whitespace(" "), Comments("//regex with unicode")], - }, - JsExpressionStatement { - expression: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@125..150 "/[\\p{Control}--[\\t\\n]]/v" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@150..151 ";" [] [], - }, - JsExpressionStatement { - expression: JsRegexLiteralExpression { - value_token: JS_REGEX_LITERAL@151..158 "/\\’/" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@158..211 ";" [] [Whitespace(" "), Comments("// regex with escaped ...")], - }, - ], - eof_token: EOF@211..212 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..212 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..211 - 0: JS_EXPRESSION_STATEMENT@0..1 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..1 - 0: JS_NUMBER_LITERAL@0..1 "5" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@1..6 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@1..6 - 0: TRUE_KW@1..6 "true" [Newline("\n")] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@6..12 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@6..12 - 0: FALSE_KW@6..12 "false" [Newline("\n")] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@12..15 - 0: JS_BIGINT_LITERAL_EXPRESSION@12..15 - 0: JS_BIGINT_LITERAL@12..15 "5n" [Newline("\n")] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@15..21 - 0: JS_STRING_LITERAL_EXPRESSION@15..21 - 0: JS_STRING_LITERAL@15..21 "\"foo\"" [Newline("\n")] [] - 1: (empty) - 5: JS_EXPRESSION_STATEMENT@21..27 - 0: JS_STRING_LITERAL_EXPRESSION@21..27 - 0: JS_STRING_LITERAL@21..27 "'bar'" [Newline("\n")] [] - 1: (empty) - 6: JS_EXPRESSION_STATEMENT@27..32 - 0: JS_NULL_LITERAL_EXPRESSION@27..32 - 0: NULL_KW@27..32 "null" [Newline("\n")] [] - 1: (empty) - 7: JS_EXPRESSION_STATEMENT@32..49 - 0: JS_SEQUENCE_EXPRESSION@32..49 - 0: JS_SEQUENCE_EXPRESSION@32..43 - 0: JS_SEQUENCE_EXPRESSION@32..39 - 0: JS_NUMBER_LITERAL_EXPRESSION@32..34 - 0: JS_NUMBER_LITERAL@32..34 "0" [Newline("\n")] [] - 1: COMMA@34..36 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@36..39 - 0: JS_NUMBER_LITERAL@36..39 "0.0" [] [] - 1: COMMA@39..41 "," [] [Whitespace(" ")] - 2: JS_BIGINT_LITERAL_EXPRESSION@41..43 - 0: JS_BIGINT_LITERAL@41..43 "0n" [] [] - 1: COMMA@43..45 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@45..49 - 0: JS_NUMBER_LITERAL@45..49 "0e00" [] [] - 1: (empty) - 8: JS_EXPRESSION_STATEMENT@49..67 - 0: JS_STRING_LITERAL_EXPRESSION@49..66 - 0: JS_STRING_LITERAL@49..66 "\"test\\\nnew-line\"" [Newline("\n")] [] - 1: SEMICOLON@66..67 ";" [] [] - 9: JS_EXPRESSION_STATEMENT@67..125 - 0: JS_REGEX_LITERAL_EXPRESSION@67..103 - 0: JS_REGEX_LITERAL@67..103 "/^[يفمئامئ\u{200d}ئاسۆند]/i" [Newline("\n")] [] - 1: SEMICOLON@103..125 ";" [] [Whitespace(" "), Comments("//regex with unicode")] - 10: JS_EXPRESSION_STATEMENT@125..151 - 0: JS_REGEX_LITERAL_EXPRESSION@125..150 - 0: JS_REGEX_LITERAL@125..150 "/[\\p{Control}--[\\t\\n]]/v" [Newline("\n")] [] - 1: SEMICOLON@150..151 ";" [] [] - 11: JS_EXPRESSION_STATEMENT@151..211 - 0: JS_REGEX_LITERAL_EXPRESSION@151..158 - 0: JS_REGEX_LITERAL@151..158 "/\\’/" [Newline("\n")] [] - 1: SEMICOLON@158..211 ";" [] [Whitespace(" "), Comments("// regex with escaped ...")] - 4: EOF@211..212 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/logical_expressions.rast b/crates/biome_js_parser/test_data/inline/ok/logical_expressions.rast deleted file mode 100644 index 3ad3f85fe531..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/logical_expressions.rast +++ /dev/null @@ -1,93 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], - }, - }, - operator_token: QUESTION2@4..7 "??" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..10 "bar" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..13 "a" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: PIPE2@13..16 "||" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "b" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..20 "a" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: AMP2@20..23 "&&" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..24 "b" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_EXPRESSION_STATEMENT@0..10 - 0: JS_LOGICAL_EXPRESSION@0..10 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "foo" [] [Whitespace(" ")] - 1: QUESTION2@4..7 "??" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@7..10 - 0: JS_REFERENCE_IDENTIFIER@7..10 - 0: IDENT@7..10 "bar" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@10..17 - 0: JS_LOGICAL_EXPRESSION@10..17 - 0: JS_IDENTIFIER_EXPRESSION@10..13 - 0: JS_REFERENCE_IDENTIFIER@10..13 - 0: IDENT@10..13 "a" [Newline("\n")] [Whitespace(" ")] - 1: PIPE2@13..16 "||" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "b" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@17..24 - 0: JS_LOGICAL_EXPRESSION@17..24 - 0: JS_IDENTIFIER_EXPRESSION@17..20 - 0: JS_REFERENCE_IDENTIFIER@17..20 - 0: IDENT@17..20 "a" [Newline("\n")] [Whitespace(" ")] - 1: AMP2@20..23 "&&" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@23..24 - 0: JS_REFERENCE_IDENTIFIER@23..24 - 0: IDENT@23..24 "b" [] [] - 1: (empty) - 4: EOF@24..25 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/metavar.options.json b/crates/biome_js_parser/test_data/inline/ok/metavar.options.json deleted file mode 100644 index 5305a1b4a61b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/metavar.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "grit_metavariables": true } diff --git a/crates/biome_js_parser/test_data/inline/ok/metavar.rast b/crates/biome_js_parser/test_data/inline/ok/metavar.rast deleted file mode 100644 index 57ed61f31eaa..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/metavar.rast +++ /dev/null @@ -1,364 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsMetavariable { - value_token: GRIT_METAVARIABLE@7..23 "µdefaultImport" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@23..28 "from" [] [Whitespace(" ")], - source: JsMetavariable { - value_token: GRIT_METAVARIABLE@28..36 "µsource" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsMetavariable { - value_token: GRIT_METAVARIABLE@47..60 "µnamedImport" [] [], - }, - }, - COMMA@60..62 "," [] [Whitespace(" ")], - JsShorthandNamedImportSpecifier { - type_token: TYPE_KW@62..67 "type" [] [Whitespace(" ")], - local_name: JsMetavariable { - value_token: GRIT_METAVARIABLE@67..79 "µnamedType" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@79..81 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@81..86 "from" [] [Whitespace(" ")], - source: JsMetavariable { - value_token: GRIT_METAVARIABLE@86..94 "µsource" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@94..95 ";" [] [], - }, - JsExpressionStatement { - expression: JsMetavariable { - value_token: GRIT_METAVARIABLE@95..108 "µstatement" [Newline("\n"), Newline("\n")] [], - }, - semicolon_token: SEMICOLON@108..109 ";" [] [], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@109..120 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@120..123 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@123..124 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@124..126 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@126..127 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsMetavariable { - value_token: GRIT_METAVARIABLE@127..143 "µstatement" [Newline("\n"), Whitespace(" ")] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@143..144 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@144..155 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@155..159 "bar" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@159..161 "=" [] [Whitespace(" ")], - expression: JsMetavariable { - value_token: GRIT_METAVARIABLE@161..173 "µexpression" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@173..174 ";" [] [], - }, - ], - r_curly_token: R_CURLY@174..176 "}" [Newline("\n")] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@176..184 "class" [Newline("\n"), Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@184..188 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@188..189 "{" [] [], - members: JsClassMemberList [ - JsMetavariable { - value_token: GRIT_METAVARIABLE@189..207 "µclassMember" [Newline("\n"), Whitespace(" ")] [], - }, - JsEmptyClassMember { - semicolon_token: SEMICOLON@207..208 ";" [] [], - }, - ], - r_curly_token: R_CURLY@208..210 "}" [Newline("\n")] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@210..218 "const" [Newline("\n"), Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@218..220 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsMetavariable { - value_token: GRIT_METAVARIABLE@220..225 "µkey" [] [], - }, - colon_token: COLON@225..227 ":" [] [Whitespace(" ")], - pattern: JsIdentifierBinding { - name_token: IDENT@227..231 "key" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@231..233 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@233..235 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@235..237 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsMetavariable { - value_token: GRIT_METAVARIABLE@237..242 "µkey" [] [], - }, - colon_token: COLON@242..244 ":" [] [Whitespace(" ")], - value: JsMetavariable { - value_token: GRIT_METAVARIABLE@244..252 "µvalue" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@252..253 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@253..254 ";" [] [], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@254..265 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsMetavariable { - value_token: GRIT_METAVARIABLE@265..279 "µfunctionName" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@279..280 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@280..282 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@282..283 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@283..284 "}" [] [], - }, - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@284..291 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], - binding_identifier: JsMetavariable { - value_token: GRIT_METAVARIABLE@291..298 "µType" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@298..300 "=" [] [Whitespace(" ")], - ty: JsMetavariable { - value_token: GRIT_METAVARIABLE@300..311 "µOtherType" [] [], - }, - semicolon_token: SEMICOLON@311..312 ";" [] [], - }, - ], - eof_token: EOF@312..313 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..313 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..312 - 0: JS_IMPORT@0..37 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@7..36 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@7..23 - 0: JS_METAVARIABLE@7..23 - 0: GRIT_METAVARIABLE@7..23 "µdefaultImport" [] [Whitespace(" ")] - 2: FROM_KW@23..28 "from" [] [Whitespace(" ")] - 3: JS_METAVARIABLE@28..36 - 0: GRIT_METAVARIABLE@28..36 "µsource" [] [] - 4: (empty) - 2: SEMICOLON@36..37 ";" [] [] - 1: JS_IMPORT@37..95 - 0: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@45..94 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@45..81 - 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@47..79 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@47..60 - 0: (empty) - 1: JS_METAVARIABLE@47..60 - 0: GRIT_METAVARIABLE@47..60 "µnamedImport" [] [] - 1: COMMA@60..62 "," [] [Whitespace(" ")] - 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@62..79 - 0: TYPE_KW@62..67 "type" [] [Whitespace(" ")] - 1: JS_METAVARIABLE@67..79 - 0: GRIT_METAVARIABLE@67..79 "µnamedType" [] [Whitespace(" ")] - 2: R_CURLY@79..81 "}" [] [Whitespace(" ")] - 2: FROM_KW@81..86 "from" [] [Whitespace(" ")] - 3: JS_METAVARIABLE@86..94 - 0: GRIT_METAVARIABLE@86..94 "µsource" [] [] - 4: (empty) - 2: SEMICOLON@94..95 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@95..109 - 0: JS_METAVARIABLE@95..108 - 0: GRIT_METAVARIABLE@95..108 "µstatement" [Newline("\n"), Newline("\n")] [] - 1: SEMICOLON@108..109 ";" [] [] - 3: JS_FUNCTION_DECLARATION@109..176 - 0: (empty) - 1: FUNCTION_KW@109..120 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@120..123 - 0: IDENT@120..123 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@123..126 - 0: L_PAREN@123..124 "(" [] [] - 1: JS_PARAMETER_LIST@124..124 - 2: R_PAREN@124..126 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@126..176 - 0: L_CURLY@126..127 "{" [] [] - 1: JS_DIRECTIVE_LIST@127..127 - 2: JS_STATEMENT_LIST@127..174 - 0: JS_METAVARIABLE@127..143 - 0: GRIT_METAVARIABLE@127..143 "µstatement" [Newline("\n"), Whitespace(" ")] [] - 1: JS_EMPTY_STATEMENT@143..144 - 0: SEMICOLON@143..144 ";" [] [] - 2: JS_VARIABLE_STATEMENT@144..174 - 0: JS_VARIABLE_DECLARATION@144..173 - 0: (empty) - 1: CONST_KW@144..155 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@155..173 - 0: JS_VARIABLE_DECLARATOR@155..173 - 0: JS_IDENTIFIER_BINDING@155..159 - 0: IDENT@155..159 "bar" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@159..173 - 0: EQ@159..161 "=" [] [Whitespace(" ")] - 1: JS_METAVARIABLE@161..173 - 0: GRIT_METAVARIABLE@161..173 "µexpression" [] [] - 1: SEMICOLON@173..174 ";" [] [] - 3: R_CURLY@174..176 "}" [Newline("\n")] [] - 4: JS_CLASS_DECLARATION@176..210 - 0: JS_DECORATOR_LIST@176..176 - 1: (empty) - 2: CLASS_KW@176..184 "class" [Newline("\n"), Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@184..188 - 0: IDENT@184..188 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@188..189 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@189..208 - 0: JS_METAVARIABLE@189..207 - 0: GRIT_METAVARIABLE@189..207 "µclassMember" [Newline("\n"), Whitespace(" ")] [] - 1: JS_EMPTY_CLASS_MEMBER@207..208 - 0: SEMICOLON@207..208 ";" [] [] - 9: R_CURLY@208..210 "}" [Newline("\n")] [] - 5: JS_VARIABLE_STATEMENT@210..254 - 0: JS_VARIABLE_DECLARATION@210..253 - 0: (empty) - 1: CONST_KW@210..218 "const" [Newline("\n"), Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@218..253 - 0: JS_VARIABLE_DECLARATOR@218..253 - 0: JS_OBJECT_BINDING_PATTERN@218..233 - 0: L_CURLY@218..220 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@220..231 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@220..231 - 0: JS_METAVARIABLE@220..225 - 0: GRIT_METAVARIABLE@220..225 "µkey" [] [] - 1: COLON@225..227 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@227..231 - 0: IDENT@227..231 "key" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@231..233 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@233..253 - 0: EQ@233..235 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@235..253 - 0: L_CURLY@235..237 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@237..252 - 0: JS_PROPERTY_OBJECT_MEMBER@237..252 - 0: JS_METAVARIABLE@237..242 - 0: GRIT_METAVARIABLE@237..242 "µkey" [] [] - 1: COLON@242..244 ":" [] [Whitespace(" ")] - 2: JS_METAVARIABLE@244..252 - 0: GRIT_METAVARIABLE@244..252 "µvalue" [] [Whitespace(" ")] - 2: R_CURLY@252..253 "}" [] [] - 1: SEMICOLON@253..254 ";" [] [] - 6: JS_FUNCTION_DECLARATION@254..284 - 0: (empty) - 1: FUNCTION_KW@254..265 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_METAVARIABLE@265..279 - 0: GRIT_METAVARIABLE@265..279 "µfunctionName" [] [] - 4: (empty) - 5: JS_PARAMETERS@279..282 - 0: L_PAREN@279..280 "(" [] [] - 1: JS_PARAMETER_LIST@280..280 - 2: R_PAREN@280..282 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@282..284 - 0: L_CURLY@282..283 "{" [] [] - 1: JS_DIRECTIVE_LIST@283..283 - 2: JS_STATEMENT_LIST@283..283 - 3: R_CURLY@283..284 "}" [] [] - 7: TS_TYPE_ALIAS_DECLARATION@284..312 - 0: TYPE_KW@284..291 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] - 1: JS_METAVARIABLE@291..298 - 0: GRIT_METAVARIABLE@291..298 "µType" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@298..300 "=" [] [Whitespace(" ")] - 4: JS_METAVARIABLE@300..311 - 0: GRIT_METAVARIABLE@300..311 "µOtherType" [] [] - 5: SEMICOLON@311..312 ";" [] [] - 4: EOF@312..313 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/method_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/method_class_member.rast deleted file mode 100644 index 6af73302f5da..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/method_class_member.rast +++ /dev/null @@ -1,1083 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@12..21 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@24..25 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@26..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@35..46 "asyncMethod" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@46..47 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@49..50 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@51..59 "async" [Newline("\n"), Whitespace(" ")] [], - star_token: STAR@59..61 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@61..81 "asyncGeneratorMethod" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@81..82 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@84..85 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@85..86 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: STAR@86..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@91..106 "generatorMethod" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@106..107 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@109..110 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@110..111 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@111..119 "\"foo\"" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@119..120 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@120..122 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@122..123 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@123..124 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsComputedMemberName { - l_brack_token: L_BRACK@124..128 "[" [Newline("\n"), Whitespace(" ")] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@128..134 "\"foo\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@134..136 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@136..141 "\"bar\"" [] [], - }, - }, - r_brack_token: R_BRACK@141..142 "]" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@142..143 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@143..145 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@145..146 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@146..147 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@147..151 "5" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@151..152 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@152..154 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@154..155 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@155..156 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsPrivateClassMemberName { - hash_token: HASH@156..160 "#" [Newline("\n"), Whitespace(" ")] [], - id_token: IDENT@160..167 "private" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@167..168 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@168..170 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@170..171 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@171..172 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@172..174 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@174..181 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@181..200 "ContextualKeywords" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@200..201 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@201..238 "static" [Newline("\n"), Whitespace(" "), Comments("// Methods called static"), Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@238..239 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@239..241 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@241..242 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@242..243 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@243..252 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@252..258 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@258..259 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@259..261 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@261..262 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@262..263 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: STAR@263..268 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@268..274 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@274..275 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@275..277 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@277..278 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@278..279 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@279..287 "async" [Newline("\n"), Whitespace(" ")] [], - star_token: STAR@287..289 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@289..295 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@295..296 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@296..298 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@298..299 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@299..300 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@300..310 "declare" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@310..311 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@311..313 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@313..314 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@314..315 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@315..321 "get" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@321..322 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@322..324 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@324..325 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@325..347 "}" [] [Whitespace(" "), Comments("// Method called get")], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@347..353 "set" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@353..354 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@354..356 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@356..357 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@357..379 "}" [] [Whitespace(" "), Comments("// Method called set")], - }, - }, - ], - r_curly_token: R_CURLY@379..381 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@381..388 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@388..395 "Static" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@395..396 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@396..406 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@406..412 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@412..413 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@413..415 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@415..416 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@416..417 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@417..427 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@427..433 "async" [] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@433..444 "asyncMethod" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@444..445 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@445..447 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@447..448 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@448..449 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@449..459 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@459..464 "async" [] [], - star_token: STAR@464..466 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@466..486 "asyncGeneratorMethod" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@486..487 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@487..489 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@489..490 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@490..491 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@491..501 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: STAR@501..503 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@503..518 "generatorMethod" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@518..519 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@519..521 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@521..522 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@522..523 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@523..533 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@533..539 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@539..540 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@540..542 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@542..543 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@543..544 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@544..554 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@554..560 "async" [] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@560..566 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@566..567 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@567..569 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@569..570 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@570..571 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@571..581 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@581..586 "async" [] [], - star_token: STAR@586..588 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@588..594 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@594..595 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@595..597 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@597..598 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@598..599 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@599..609 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: STAR@609..611 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@611..617 "static" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@617..618 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@618..620 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@620..621 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@621..622 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@622..624 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@624..625 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..625 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..624 - 0: JS_CLASS_DECLARATION@0..174 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..172 - 0: JS_METHOD_CLASS_MEMBER@12..26 - 0: JS_METHOD_MODIFIER_LIST@12..12 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@12..21 - 0: IDENT@12..21 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@21..24 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_PARAMETER_LIST@22..22 - 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@24..26 - 0: L_CURLY@24..25 "{" [] [] - 1: JS_DIRECTIVE_LIST@25..25 - 2: JS_STATEMENT_LIST@25..25 - 3: R_CURLY@25..26 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@26..51 - 0: JS_METHOD_MODIFIER_LIST@26..26 - 1: ASYNC_KW@26..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@35..46 - 0: IDENT@35..46 "asyncMethod" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@46..49 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_PARAMETER_LIST@47..47 - 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@49..51 - 0: L_CURLY@49..50 "{" [] [] - 1: JS_DIRECTIVE_LIST@50..50 - 2: JS_STATEMENT_LIST@50..50 - 3: R_CURLY@50..51 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@51..86 - 0: JS_METHOD_MODIFIER_LIST@51..51 - 1: ASYNC_KW@51..59 "async" [Newline("\n"), Whitespace(" ")] [] - 2: STAR@59..61 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@61..81 - 0: IDENT@61..81 "asyncGeneratorMethod" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@81..84 - 0: L_PAREN@81..82 "(" [] [] - 1: JS_PARAMETER_LIST@82..82 - 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@84..86 - 0: L_CURLY@84..85 "{" [] [] - 1: JS_DIRECTIVE_LIST@85..85 - 2: JS_STATEMENT_LIST@85..85 - 3: R_CURLY@85..86 "}" [] [] - 3: JS_METHOD_CLASS_MEMBER@86..111 - 0: JS_METHOD_MODIFIER_LIST@86..86 - 1: (empty) - 2: STAR@86..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@91..106 - 0: IDENT@91..106 "generatorMethod" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@106..109 - 0: L_PAREN@106..107 "(" [] [] - 1: JS_PARAMETER_LIST@107..107 - 2: R_PAREN@107..109 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@109..111 - 0: L_CURLY@109..110 "{" [] [] - 1: JS_DIRECTIVE_LIST@110..110 - 2: JS_STATEMENT_LIST@110..110 - 3: R_CURLY@110..111 "}" [] [] - 4: JS_METHOD_CLASS_MEMBER@111..124 - 0: JS_METHOD_MODIFIER_LIST@111..111 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@111..119 - 0: JS_STRING_LITERAL@111..119 "\"foo\"" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@119..122 - 0: L_PAREN@119..120 "(" [] [] - 1: JS_PARAMETER_LIST@120..120 - 2: R_PAREN@120..122 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@122..124 - 0: L_CURLY@122..123 "{" [] [] - 1: JS_DIRECTIVE_LIST@123..123 - 2: JS_STATEMENT_LIST@123..123 - 3: R_CURLY@123..124 "}" [] [] - 5: JS_METHOD_CLASS_MEMBER@124..147 - 0: JS_METHOD_MODIFIER_LIST@124..124 - 1: (empty) - 2: (empty) - 3: JS_COMPUTED_MEMBER_NAME@124..142 - 0: L_BRACK@124..128 "[" [Newline("\n"), Whitespace(" ")] [] - 1: JS_BINARY_EXPRESSION@128..141 - 0: JS_STRING_LITERAL_EXPRESSION@128..134 - 0: JS_STRING_LITERAL@128..134 "\"foo\"" [] [Whitespace(" ")] - 1: PLUS@134..136 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@136..141 - 0: JS_STRING_LITERAL@136..141 "\"bar\"" [] [] - 2: R_BRACK@141..142 "]" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@142..145 - 0: L_PAREN@142..143 "(" [] [] - 1: JS_PARAMETER_LIST@143..143 - 2: R_PAREN@143..145 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@145..147 - 0: L_CURLY@145..146 "{" [] [] - 1: JS_DIRECTIVE_LIST@146..146 - 2: JS_STATEMENT_LIST@146..146 - 3: R_CURLY@146..147 "}" [] [] - 6: JS_METHOD_CLASS_MEMBER@147..156 - 0: JS_METHOD_MODIFIER_LIST@147..147 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@147..151 - 0: JS_NUMBER_LITERAL@147..151 "5" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@151..154 - 0: L_PAREN@151..152 "(" [] [] - 1: JS_PARAMETER_LIST@152..152 - 2: R_PAREN@152..154 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@154..156 - 0: L_CURLY@154..155 "{" [] [] - 1: JS_DIRECTIVE_LIST@155..155 - 2: JS_STATEMENT_LIST@155..155 - 3: R_CURLY@155..156 "}" [] [] - 7: JS_METHOD_CLASS_MEMBER@156..172 - 0: JS_METHOD_MODIFIER_LIST@156..156 - 1: (empty) - 2: (empty) - 3: JS_PRIVATE_CLASS_MEMBER_NAME@156..167 - 0: HASH@156..160 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@160..167 "private" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@167..170 - 0: L_PAREN@167..168 "(" [] [] - 1: JS_PARAMETER_LIST@168..168 - 2: R_PAREN@168..170 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@170..172 - 0: L_CURLY@170..171 "{" [] [] - 1: JS_DIRECTIVE_LIST@171..171 - 2: JS_STATEMENT_LIST@171..171 - 3: R_CURLY@171..172 "}" [] [] - 9: R_CURLY@172..174 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@174..381 - 0: JS_DECORATOR_LIST@174..174 - 1: (empty) - 2: CLASS_KW@174..181 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@181..200 - 0: IDENT@181..200 "ContextualKeywords" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@200..201 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@201..379 - 0: JS_METHOD_CLASS_MEMBER@201..243 - 0: JS_METHOD_MODIFIER_LIST@201..201 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@201..238 - 0: IDENT@201..238 "static" [Newline("\n"), Whitespace(" "), Comments("// Methods called static"), Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@238..241 - 0: L_PAREN@238..239 "(" [] [] - 1: JS_PARAMETER_LIST@239..239 - 2: R_PAREN@239..241 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@241..243 - 0: L_CURLY@241..242 "{" [] [] - 1: JS_DIRECTIVE_LIST@242..242 - 2: JS_STATEMENT_LIST@242..242 - 3: R_CURLY@242..243 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@243..263 - 0: JS_METHOD_MODIFIER_LIST@243..243 - 1: ASYNC_KW@243..252 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@252..258 - 0: IDENT@252..258 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@258..261 - 0: L_PAREN@258..259 "(" [] [] - 1: JS_PARAMETER_LIST@259..259 - 2: R_PAREN@259..261 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@261..263 - 0: L_CURLY@261..262 "{" [] [] - 1: JS_DIRECTIVE_LIST@262..262 - 2: JS_STATEMENT_LIST@262..262 - 3: R_CURLY@262..263 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@263..279 - 0: JS_METHOD_MODIFIER_LIST@263..263 - 1: (empty) - 2: STAR@263..268 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@268..274 - 0: IDENT@268..274 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@274..277 - 0: L_PAREN@274..275 "(" [] [] - 1: JS_PARAMETER_LIST@275..275 - 2: R_PAREN@275..277 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@277..279 - 0: L_CURLY@277..278 "{" [] [] - 1: JS_DIRECTIVE_LIST@278..278 - 2: JS_STATEMENT_LIST@278..278 - 3: R_CURLY@278..279 "}" [] [] - 3: JS_METHOD_CLASS_MEMBER@279..300 - 0: JS_METHOD_MODIFIER_LIST@279..279 - 1: ASYNC_KW@279..287 "async" [Newline("\n"), Whitespace(" ")] [] - 2: STAR@287..289 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@289..295 - 0: IDENT@289..295 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@295..298 - 0: L_PAREN@295..296 "(" [] [] - 1: JS_PARAMETER_LIST@296..296 - 2: R_PAREN@296..298 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@298..300 - 0: L_CURLY@298..299 "{" [] [] - 1: JS_DIRECTIVE_LIST@299..299 - 2: JS_STATEMENT_LIST@299..299 - 3: R_CURLY@299..300 "}" [] [] - 4: JS_METHOD_CLASS_MEMBER@300..315 - 0: JS_METHOD_MODIFIER_LIST@300..300 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@300..310 - 0: IDENT@300..310 "declare" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@310..313 - 0: L_PAREN@310..311 "(" [] [] - 1: JS_PARAMETER_LIST@311..311 - 2: R_PAREN@311..313 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@313..315 - 0: L_CURLY@313..314 "{" [] [] - 1: JS_DIRECTIVE_LIST@314..314 - 2: JS_STATEMENT_LIST@314..314 - 3: R_CURLY@314..315 "}" [] [] - 5: JS_METHOD_CLASS_MEMBER@315..347 - 0: JS_METHOD_MODIFIER_LIST@315..315 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@315..321 - 0: IDENT@315..321 "get" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@321..324 - 0: L_PAREN@321..322 "(" [] [] - 1: JS_PARAMETER_LIST@322..322 - 2: R_PAREN@322..324 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@324..347 - 0: L_CURLY@324..325 "{" [] [] - 1: JS_DIRECTIVE_LIST@325..325 - 2: JS_STATEMENT_LIST@325..325 - 3: R_CURLY@325..347 "}" [] [Whitespace(" "), Comments("// Method called get")] - 6: JS_METHOD_CLASS_MEMBER@347..379 - 0: JS_METHOD_MODIFIER_LIST@347..347 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@347..353 - 0: IDENT@347..353 "set" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@353..356 - 0: L_PAREN@353..354 "(" [] [] - 1: JS_PARAMETER_LIST@354..354 - 2: R_PAREN@354..356 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@356..379 - 0: L_CURLY@356..357 "{" [] [] - 1: JS_DIRECTIVE_LIST@357..357 - 2: JS_STATEMENT_LIST@357..357 - 3: R_CURLY@357..379 "}" [] [Whitespace(" "), Comments("// Method called set")] - 9: R_CURLY@379..381 "}" [Newline("\n")] [] - 2: JS_CLASS_DECLARATION@381..624 - 0: JS_DECORATOR_LIST@381..381 - 1: (empty) - 2: CLASS_KW@381..388 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@388..395 - 0: IDENT@388..395 "Static" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@395..396 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@396..622 - 0: JS_METHOD_CLASS_MEMBER@396..417 - 0: JS_METHOD_MODIFIER_LIST@396..406 - 0: JS_STATIC_MODIFIER@396..406 - 0: STATIC_KW@396..406 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@406..412 - 0: IDENT@406..412 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@412..415 - 0: L_PAREN@412..413 "(" [] [] - 1: JS_PARAMETER_LIST@413..413 - 2: R_PAREN@413..415 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@415..417 - 0: L_CURLY@415..416 "{" [] [] - 1: JS_DIRECTIVE_LIST@416..416 - 2: JS_STATEMENT_LIST@416..416 - 3: R_CURLY@416..417 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@417..449 - 0: JS_METHOD_MODIFIER_LIST@417..427 - 0: JS_STATIC_MODIFIER@417..427 - 0: STATIC_KW@417..427 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@427..433 "async" [] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@433..444 - 0: IDENT@433..444 "asyncMethod" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@444..447 - 0: L_PAREN@444..445 "(" [] [] - 1: JS_PARAMETER_LIST@445..445 - 2: R_PAREN@445..447 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@447..449 - 0: L_CURLY@447..448 "{" [] [] - 1: JS_DIRECTIVE_LIST@448..448 - 2: JS_STATEMENT_LIST@448..448 - 3: R_CURLY@448..449 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@449..491 - 0: JS_METHOD_MODIFIER_LIST@449..459 - 0: JS_STATIC_MODIFIER@449..459 - 0: STATIC_KW@449..459 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@459..464 "async" [] [] - 2: STAR@464..466 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@466..486 - 0: IDENT@466..486 "asyncGeneratorMethod" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@486..489 - 0: L_PAREN@486..487 "(" [] [] - 1: JS_PARAMETER_LIST@487..487 - 2: R_PAREN@487..489 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@489..491 - 0: L_CURLY@489..490 "{" [] [] - 1: JS_DIRECTIVE_LIST@490..490 - 2: JS_STATEMENT_LIST@490..490 - 3: R_CURLY@490..491 "}" [] [] - 3: JS_METHOD_CLASS_MEMBER@491..523 - 0: JS_METHOD_MODIFIER_LIST@491..501 - 0: JS_STATIC_MODIFIER@491..501 - 0: STATIC_KW@491..501 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: STAR@501..503 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@503..518 - 0: IDENT@503..518 "generatorMethod" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@518..521 - 0: L_PAREN@518..519 "(" [] [] - 1: JS_PARAMETER_LIST@519..519 - 2: R_PAREN@519..521 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@521..523 - 0: L_CURLY@521..522 "{" [] [] - 1: JS_DIRECTIVE_LIST@522..522 - 2: JS_STATEMENT_LIST@522..522 - 3: R_CURLY@522..523 "}" [] [] - 4: JS_METHOD_CLASS_MEMBER@523..544 - 0: JS_METHOD_MODIFIER_LIST@523..533 - 0: JS_STATIC_MODIFIER@523..533 - 0: STATIC_KW@523..533 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@533..539 - 0: IDENT@533..539 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@539..542 - 0: L_PAREN@539..540 "(" [] [] - 1: JS_PARAMETER_LIST@540..540 - 2: R_PAREN@540..542 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@542..544 - 0: L_CURLY@542..543 "{" [] [] - 1: JS_DIRECTIVE_LIST@543..543 - 2: JS_STATEMENT_LIST@543..543 - 3: R_CURLY@543..544 "}" [] [] - 5: JS_METHOD_CLASS_MEMBER@544..571 - 0: JS_METHOD_MODIFIER_LIST@544..554 - 0: JS_STATIC_MODIFIER@544..554 - 0: STATIC_KW@544..554 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@554..560 "async" [] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@560..566 - 0: IDENT@560..566 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@566..569 - 0: L_PAREN@566..567 "(" [] [] - 1: JS_PARAMETER_LIST@567..567 - 2: R_PAREN@567..569 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@569..571 - 0: L_CURLY@569..570 "{" [] [] - 1: JS_DIRECTIVE_LIST@570..570 - 2: JS_STATEMENT_LIST@570..570 - 3: R_CURLY@570..571 "}" [] [] - 6: JS_METHOD_CLASS_MEMBER@571..599 - 0: JS_METHOD_MODIFIER_LIST@571..581 - 0: JS_STATIC_MODIFIER@571..581 - 0: STATIC_KW@571..581 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@581..586 "async" [] [] - 2: STAR@586..588 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@588..594 - 0: IDENT@588..594 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@594..597 - 0: L_PAREN@594..595 "(" [] [] - 1: JS_PARAMETER_LIST@595..595 - 2: R_PAREN@595..597 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@597..599 - 0: L_CURLY@597..598 "{" [] [] - 1: JS_DIRECTIVE_LIST@598..598 - 2: JS_STATEMENT_LIST@598..598 - 3: R_CURLY@598..599 "}" [] [] - 7: JS_METHOD_CLASS_MEMBER@599..622 - 0: JS_METHOD_MODIFIER_LIST@599..609 - 0: JS_STATIC_MODIFIER@599..609 - 0: STATIC_KW@599..609 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: STAR@609..611 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@611..617 - 0: IDENT@611..617 "static" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@617..620 - 0: L_PAREN@617..618 "(" [] [] - 1: JS_PARAMETER_LIST@618..618 - 2: R_PAREN@618..620 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@620..622 - 0: L_CURLY@620..621 "{" [] [] - 1: JS_DIRECTIVE_LIST@621..621 - 2: JS_STATEMENT_LIST@621..621 - 3: R_CURLY@621..622 "}" [] [] - 9: R_CURLY@622..624 "}" [Newline("\n")] [] - 4: EOF@624..625 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/module.rast b/crates/biome_js_parser/test_data/inline/ok/module.rast deleted file mode 100644 index 9f5eb380ff8f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/module.rast +++ /dev/null @@ -1,145 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@7..9 "a" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@9..14 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@14..17 "\"b\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@18..26 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@26..28 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@28..30 "a" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@30..31 "}" [] [], - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..34 "c" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@34..35 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@35..36 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@47..49 "c" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@51..56 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@56..59 "\"c\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - ], - eof_token: EOF@60..61 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..61 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..60 - 0: JS_IMPORT@0..18 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@7..17 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@7..9 - 0: JS_IDENTIFIER_BINDING@7..9 - 0: IDENT@7..9 "a" [] [Whitespace(" ")] - 2: FROM_KW@9..14 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@14..17 - 0: JS_STRING_LITERAL@14..17 "\"b\"" [] [] - 4: (empty) - 2: SEMICOLON@17..18 ";" [] [] - 1: JS_EXPORT@18..32 - 0: JS_DECORATOR_LIST@18..18 - 1: EXPORT_KW@18..26 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@26..32 - 0: (empty) - 1: L_CURLY@26..28 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@28..30 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@28..30 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@28..30 - 0: IDENT@28..30 "a" [] [Whitespace(" ")] - 3: R_CURLY@30..31 "}" [] [] - 4: SEMICOLON@31..32 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@32..37 - 0: JS_CALL_EXPRESSION@32..36 - 0: JS_IDENTIFIER_EXPRESSION@32..34 - 0: JS_REFERENCE_IDENTIFIER@32..34 - 0: IDENT@32..34 "c" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@34..36 - 0: L_PAREN@34..35 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@35..35 - 2: R_PAREN@35..36 ")" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 3: JS_IMPORT@37..60 - 0: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@45..59 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@45..51 - 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@47..49 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@47..49 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@47..49 - 0: IDENT@47..49 "c" [] [Whitespace(" ")] - 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] - 2: FROM_KW@51..56 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@56..59 - 0: JS_STRING_LITERAL@56..59 "\"c\"" [] [] - 4: (empty) - 2: SEMICOLON@59..60 ";" [] [] - 4: EOF@60..61 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/new_exprs.rast b/crates/biome_js_parser/test_data/inline/ok/new_exprs.rast deleted file mode 100644 index 10aacca8f00f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/new_exprs.rast +++ /dev/null @@ -1,311 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..7 "Foo" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@7..8 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@8..9 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@9..14 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..17 "foo" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsNewTargetExpression { - new_token: NEW_KW@18..22 "new" [Newline("\n")] [], - dot_token: DOT@22..23 "." [] [], - target_token: TARGET@23..29 "target" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@29..34 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsNewExpression { - new_token: NEW_KW@34..38 "new" [] [Whitespace(" ")], - callee: JsNewExpression { - new_token: NEW_KW@38..42 "new" [] [Whitespace(" ")], - callee: JsNewExpression { - new_token: NEW_KW@42..46 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..49 "Foo" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@49..50 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@50..51 ")" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - semicolon_token: SEMICOLON@51..52 ";" [] [], - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@52..57 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..60 "Foo" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@60..61 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@61..64 "bar" [] [], - }, - }, - COMMA@64..66 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@66..69 "baz" [] [], - }, - }, - COMMA@69..71 "," [] [Whitespace(" ")], - JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@71..73 "6" [] [Whitespace(" ")], - }, - operator_token: PLUS@73..75 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@75..76 "6" [] [], - }, - }, - COMMA@76..78 "," [] [Whitespace(" ")], - JsBinaryExpression { - left: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@78..81 "foo" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@81..82 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@82..85 "bar" [] [], - }, - }, - r_brack_token: R_BRACK@85..87 "]" [] [Whitespace(" ")], - }, - operator_token: PLUS@87..89 "+" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@89..90 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@90..91 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@91..94 "foo" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@94..96 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@96..99 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@99..100 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@100..101 "}" [] [], - }, - }, - r_paren_token: R_PAREN@101..103 ")" [] [Whitespace(" ")], - }, - operator_token: STAR@103..105 "*" [] [Whitespace(" ")], - right: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@105..108 "foo" [] [], - }, - }, - operator_token: QUESTIONDOT@108..110 "?." [] [], - member: JsName { - value_token: IDENT@110..113 "bar" [] [], - }, - }, - }, - }, - ], - r_paren_token: R_PAREN@113..114 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@114..115 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..115 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..114 - 0: JS_EXPRESSION_STATEMENT@0..9 - 0: JS_NEW_EXPRESSION@0..9 - 0: NEW_KW@0..4 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@4..7 - 0: JS_REFERENCE_IDENTIFIER@4..7 - 0: IDENT@4..7 "Foo" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@7..9 - 0: L_PAREN@7..8 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@8..8 - 2: R_PAREN@8..9 ")" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@9..18 - 0: JS_NEW_EXPRESSION@9..17 - 0: NEW_KW@9..14 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@14..17 - 0: JS_REFERENCE_IDENTIFIER@14..17 - 0: IDENT@14..17 "foo" [] [] - 2: (empty) - 3: (empty) - 1: SEMICOLON@17..18 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@18..29 - 0: JS_NEW_TARGET_EXPRESSION@18..29 - 0: NEW_KW@18..22 "new" [Newline("\n")] [] - 1: DOT@22..23 "." [] [] - 2: TARGET@23..29 "target" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@29..52 - 0: JS_NEW_EXPRESSION@29..51 - 0: NEW_KW@29..34 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@34..51 - 0: NEW_KW@34..38 "new" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@38..51 - 0: NEW_KW@38..42 "new" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@42..51 - 0: NEW_KW@42..46 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@46..49 - 0: JS_REFERENCE_IDENTIFIER@46..49 - 0: IDENT@46..49 "Foo" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@49..51 - 0: L_PAREN@49..50 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@50..50 - 2: R_PAREN@50..51 ")" [] [] - 2: (empty) - 3: (empty) - 2: (empty) - 3: (empty) - 2: (empty) - 3: (empty) - 1: SEMICOLON@51..52 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@52..114 - 0: JS_NEW_EXPRESSION@52..114 - 0: NEW_KW@52..57 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@57..60 - 0: JS_REFERENCE_IDENTIFIER@57..60 - 0: IDENT@57..60 "Foo" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@60..114 - 0: L_PAREN@60..61 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@61..113 - 0: JS_IDENTIFIER_EXPRESSION@61..64 - 0: JS_REFERENCE_IDENTIFIER@61..64 - 0: IDENT@61..64 "bar" [] [] - 1: COMMA@64..66 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@66..69 - 0: JS_REFERENCE_IDENTIFIER@66..69 - 0: IDENT@66..69 "baz" [] [] - 3: COMMA@69..71 "," [] [Whitespace(" ")] - 4: JS_BINARY_EXPRESSION@71..76 - 0: JS_NUMBER_LITERAL_EXPRESSION@71..73 - 0: JS_NUMBER_LITERAL@71..73 "6" [] [Whitespace(" ")] - 1: PLUS@73..75 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@75..76 - 0: JS_NUMBER_LITERAL@75..76 "6" [] [] - 5: COMMA@76..78 "," [] [Whitespace(" ")] - 6: JS_BINARY_EXPRESSION@78..113 - 0: JS_COMPUTED_MEMBER_EXPRESSION@78..87 - 0: JS_IDENTIFIER_EXPRESSION@78..81 - 0: JS_REFERENCE_IDENTIFIER@78..81 - 0: IDENT@78..81 "foo" [] [] - 1: (empty) - 2: L_BRACK@81..82 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@82..85 - 0: JS_REFERENCE_IDENTIFIER@82..85 - 0: IDENT@82..85 "bar" [] [] - 4: R_BRACK@85..87 "]" [] [Whitespace(" ")] - 1: PLUS@87..89 "+" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@89..113 - 0: JS_PARENTHESIZED_EXPRESSION@89..103 - 0: L_PAREN@89..90 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@90..101 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@90..96 - 0: L_PAREN@90..91 "(" [] [] - 1: JS_PARAMETER_LIST@91..94 - 0: JS_FORMAL_PARAMETER@91..94 - 0: JS_DECORATOR_LIST@91..91 - 1: JS_IDENTIFIER_BINDING@91..94 - 0: IDENT@91..94 "foo" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@94..96 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@96..99 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@99..101 - 0: L_CURLY@99..100 "{" [] [] - 1: JS_DIRECTIVE_LIST@100..100 - 2: JS_STATEMENT_LIST@100..100 - 3: R_CURLY@100..101 "}" [] [] - 2: R_PAREN@101..103 ")" [] [Whitespace(" ")] - 1: STAR@103..105 "*" [] [Whitespace(" ")] - 2: JS_STATIC_MEMBER_EXPRESSION@105..113 - 0: JS_IDENTIFIER_EXPRESSION@105..108 - 0: JS_REFERENCE_IDENTIFIER@105..108 - 0: IDENT@105..108 "foo" [] [] - 1: QUESTIONDOT@108..110 "?." [] [] - 2: JS_NAME@110..113 - 0: IDENT@110..113 "bar" [] [] - 2: R_PAREN@113..114 ")" [] [] - 1: (empty) - 4: EOF@114..115 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.rast b/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.rast deleted file mode 100644 index 089dff1aebad..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.rast +++ /dev/null @@ -1,216 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@1..2 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [], - r_curly_token: R_CURLY@2..4 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@4..6 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@6..7 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@7..8 "}" [] [], - }, - }, - r_paren_token: R_PAREN@8..9 ")" [] [], - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@10..12 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@12..14 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@14..17 "bar" [] [], - }, - init: missing (optional), - }, - COMMA@17..19 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@19..23 "baz" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@23..25 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@25..27 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@27..28 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - r_paren_token: R_PAREN@29..30 ")" [] [], - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@31..33 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@35..38 "bar" [] [], - }, - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - pattern: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@40..41 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@41..45 "baz" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@47..52 "\"baz\"" [] [], - }, - }, - }, - ], - r_brack_token: R_BRACK@52..53 "]" [] [], - }, - init: missing (optional), - }, - COMMA@53..55 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@55..59 "foo" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@59..61 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@61..66 "\"foo\"" [] [], - }, - }, - }, - COMMA@66..68 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@68..71 "..." [] [], - target: JsIdentifierAssignment { - name_token: IDENT@71..76 "rest" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@76..78 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@78..80 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@80..81 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@81..82 "}" [] [], - }, - }, - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: JS_EXPRESSION_STATEMENT@0..10 - 0: JS_PARENTHESIZED_EXPRESSION@0..9 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..8 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..4 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@2..2 - 2: R_CURLY@2..4 "}" [] [Whitespace(" ")] - 1: EQ@4..6 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@6..8 - 0: L_CURLY@6..7 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@7..7 - 2: R_CURLY@7..8 "}" [] [] - 2: R_PAREN@8..9 ")" [] [] - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@10..31 - 0: JS_PARENTHESIZED_EXPRESSION@10..30 - 0: L_PAREN@10..12 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@12..29 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@12..25 - 0: L_CURLY@12..14 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@14..23 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@14..17 - 0: JS_IDENTIFIER_ASSIGNMENT@14..17 - 0: IDENT@14..17 "bar" [] [] - 1: (empty) - 1: COMMA@17..19 "," [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@19..23 - 0: JS_IDENTIFIER_ASSIGNMENT@19..23 - 0: IDENT@19..23 "baz" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@23..25 "}" [] [Whitespace(" ")] - 1: EQ@25..27 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@27..29 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@28..28 - 2: R_CURLY@28..29 "}" [] [] - 2: R_PAREN@29..30 ")" [] [] - 1: SEMICOLON@30..31 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@31..84 - 0: JS_PARENTHESIZED_EXPRESSION@31..83 - 0: L_PAREN@31..33 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@33..82 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@33..78 - 0: L_CURLY@33..35 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@35..76 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@35..53 - 0: JS_LITERAL_MEMBER_NAME@35..38 - 0: IDENT@35..38 "bar" [] [] - 1: COLON@38..40 ":" [] [Whitespace(" ")] - 2: JS_ARRAY_ASSIGNMENT_PATTERN@40..53 - 0: L_BRACK@40..41 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@41..52 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@41..52 - 0: JS_IDENTIFIER_ASSIGNMENT@41..45 - 0: IDENT@41..45 "baz" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@45..52 - 0: EQ@45..47 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@47..52 - 0: JS_STRING_LITERAL@47..52 "\"baz\"" [] [] - 2: R_BRACK@52..53 "]" [] [] - 3: (empty) - 1: COMMA@53..55 "," [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@55..66 - 0: JS_IDENTIFIER_ASSIGNMENT@55..59 - 0: IDENT@55..59 "foo" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@59..66 - 0: EQ@59..61 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@61..66 - 0: JS_STRING_LITERAL@61..66 "\"foo\"" [] [] - 3: COMMA@66..68 "," [] [Whitespace(" ")] - 4: JS_OBJECT_ASSIGNMENT_PATTERN_REST@68..76 - 0: DOT3@68..71 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@71..76 - 0: IDENT@71..76 "rest" [] [Whitespace(" ")] - 2: R_CURLY@76..78 "}" [] [Whitespace(" ")] - 1: EQ@78..80 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@80..82 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@81..81 - 2: R_CURLY@81..82 "}" [] [] - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 4: EOF@84..85 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr.rast deleted file mode 100644 index 17bf449c0b69..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr.rast +++ /dev/null @@ -1,104 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@9..10 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@11..16 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@16..18 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@18..20 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@20..21 "{" [] [], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "foo" [] [], - }, - }, - COMMA@24..25 "," [] [], - ], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@26..27 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..27 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..26 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..10 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..10 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..9 - 2: R_CURLY@9..10 "}" [] [] - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_VARIABLE_STATEMENT@11..26 - 0: JS_VARIABLE_DECLARATION@11..26 - 0: (empty) - 1: LET_KW@11..16 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@16..26 - 0: JS_VARIABLE_DECLARATOR@16..26 - 0: JS_IDENTIFIER_BINDING@16..18 - 0: IDENT@16..18 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@18..26 - 0: EQ@18..20 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@20..26 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@21..25 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "foo" [] [] - 1: COMMA@24..25 "," [] [] - 2: R_CURLY@25..26 "}" [] [] - 1: (empty) - 4: EOF@26..27 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.rast deleted file mode 100644 index afe2dbb40c55..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.rast +++ /dev/null @@ -1,129 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: ASYNC_KW@9..18 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@18..21 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@24..25 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - }, - COMMA@26..27 "," [] [], - JsMethodObjectMember { - async_token: ASYNC_KW@27..36 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: STAR@36..37 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@37..40 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@40..41 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@43..44 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@44..45 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@45..47 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_VARIABLE_STATEMENT@0..47 - 0: JS_VARIABLE_DECLARATION@0..47 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..47 - 0: JS_VARIABLE_DECLARATOR@4..47 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..47 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..47 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..45 - 0: JS_METHOD_OBJECT_MEMBER@9..26 - 0: ASYNC_KW@9..18 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@18..21 - 0: IDENT@18..21 "foo" [] [] - 3: (empty) - 4: JS_PARAMETERS@21..24 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_PARAMETER_LIST@22..22 - 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@24..26 - 0: L_CURLY@24..25 "{" [] [] - 1: JS_DIRECTIVE_LIST@25..25 - 2: JS_STATEMENT_LIST@25..25 - 3: R_CURLY@25..26 "}" [] [] - 1: COMMA@26..27 "," [] [] - 2: JS_METHOD_OBJECT_MEMBER@27..45 - 0: ASYNC_KW@27..36 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: STAR@36..37 "*" [] [] - 2: JS_LITERAL_MEMBER_NAME@37..40 - 0: IDENT@37..40 "foo" [] [] - 3: (empty) - 4: JS_PARAMETERS@40..43 - 0: L_PAREN@40..41 "(" [] [] - 1: JS_PARAMETER_LIST@41..41 - 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@43..45 - 0: L_CURLY@43..44 "{" [] [] - 1: JS_DIRECTIVE_LIST@44..44 - 2: JS_STATEMENT_LIST@44..44 - 3: R_CURLY@44..45 "}" [] [] - 2: R_CURLY@45..47 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@47..48 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.rast deleted file mode 100644 index b542e4cbaa6b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.rast +++ /dev/null @@ -1,91 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: STAR@10..11 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@11..14 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@14..15 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_VARIABLE_STATEMENT@0..21 - 0: JS_VARIABLE_DECLARATION@0..21 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..21 - 0: JS_VARIABLE_DECLARATOR@4..21 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..21 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..21 - 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@10..20 - 0: JS_METHOD_OBJECT_MEMBER@10..20 - 0: (empty) - 1: STAR@10..11 "*" [] [] - 2: JS_LITERAL_MEMBER_NAME@11..14 - 0: IDENT@11..14 "foo" [] [] - 3: (empty) - 4: JS_PARAMETERS@14..17 - 0: L_PAREN@14..15 "(" [] [] - 1: JS_PARAMETER_LIST@15..15 - 2: R_PAREN@15..17 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@17..20 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..18 - 3: R_CURLY@18..20 "}" [] [Whitespace(" ")] - 2: R_CURLY@20..21 "}" [] [] - 1: (empty) - 4: EOF@21..22 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast deleted file mode 100644 index 1eaf6c557b03..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast +++ /dev/null @@ -1,98 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declarations: JsVariableDeclarations { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - items: JsVariableDeclarationList [ - JsVariableDeclaration { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - excl_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsGetterObjectMember { - get_token: GET_KW@9..15 "get" [Whitespace("\n ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..18 "foo" [] [], - }, - l_paren_token: L_PAREN@18..19 "(" [] [], - r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@21..22 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@22..33 "return" [Whitespace("\n ")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..36 "foo" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - ], - r_curly_token: R_CURLY@37..40 "}" [Whitespace("\n ")] [], - }, - }, - ], - r_curly_token: R_CURLY@40..42 "}" [Whitespace("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@42..43 "" [Whitespace("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_VARIABLE_STATEMENT@0..42 - 0: JS_VARIABLE_DECLARATIONS@0..42 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_LIST@4..42 - 0: JS_VARIABLE_DECLARATION@4..42 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@6..42 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..42 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..40 - 0: JS_GETTER_OBJECT_MEMBER@9..40 - 0: GET_KW@9..15 "get" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..18 - 0: IDENT@15..18 "foo" [] [] - 2: L_PAREN@18..19 "(" [] [] - 3: R_PAREN@19..21 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@21..40 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_DIRECTIVE_LIST@22..22 - 2: JS_STATEMENT_LIST@22..37 - 0: JS_RETURN_STATEMENT@22..37 - 0: RETURN_KW@22..33 "return" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@33..36 - 0: JS_REFERENCE_IDENTIFIER@33..36 - 0: IDENT@33..36 "foo" [] [] - 2: SEMICOLON@36..37 ";" [] [] - 3: R_CURLY@37..40 "}" [Whitespace("\n ")] [] - 2: R_CURLY@40..42 "}" [Whitespace("\n")] [] - 1: (empty) - 4: EOF@42..43 "" [Whitespace("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast deleted file mode 100644 index 11169cbd9fab..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast +++ /dev/null @@ -1,70 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@10..11 "a" [] [], - }, - colon_token: COLON@11..13 ":" [] [Whitespace(" ")], - value: JsBooleanLiteralExpression { - value_token: TRUE_KW@13..18 "true" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@19..20 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..20 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..19 - 0: JS_VARIABLE_STATEMENT@0..19 - 0: JS_VARIABLE_DECLARATION@0..19 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..19 - 0: JS_VARIABLE_DECLARATOR@4..19 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..19 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..19 - 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@10..18 - 0: JS_PROPERTY_OBJECT_MEMBER@10..18 - 0: JS_LITERAL_MEMBER_NAME@10..11 - 0: IDENT@10..11 "a" [] [] - 1: COLON@11..13 ":" [] [Whitespace(" ")] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@13..18 - 0: TRUE_KW@13..18 "true" [] [Whitespace(" ")] - 2: R_CURLY@18..19 "}" [] [] - 1: (empty) - 4: EOF@19..20 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.rast deleted file mode 100644 index 57c1e8364bf4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.rast +++ /dev/null @@ -1,45 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..2 "{" [] [], - members: JsObjectMemberList [ - JsShorthandPropertyObjectMember { - name: JsReferenceIdentifier { - value_token: IDENT@2..5 "foo" [] [], - }, - }, - ], - r_curly_token: R_CURLY@5..6 "}" [] [], - }, - r_paren_token: R_PAREN@6..7 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@7..8 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..8 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..7 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JS_PARENTHESIZED_EXPRESSION@0..7 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..6 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@2..5 - 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@2..5 - 0: JS_REFERENCE_IDENTIFIER@2..5 - 0: IDENT@2..5 "foo" [] [] - 2: R_CURLY@5..6 "}" [] [] - 2: R_PAREN@6..7 ")" [] [] - 1: (empty) - 4: EOF@7..8 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_method.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_method.rast deleted file mode 100644 index 8a217f403d48..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_method.rast +++ /dev/null @@ -1,307 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@9..15 "foo" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@15..16 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@18..19 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@19..20 "}" [] [], - }, - }, - COMMA@20..21 "," [] [], - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@21..29 "\"bar\"" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@29..30 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@30..31 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@31..33 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@33..34 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@34..36 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@36..37 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@39..40 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - }, - COMMA@41..42 "," [] [], - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsComputedMemberName { - l_brack_token: L_BRACK@42..46 "[" [Newline("\n"), Whitespace(" ")] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@46..52 "\"foo\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@52..54 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@54..59 "\"bar\"" [] [], - }, - }, - r_brack_token: R_BRACK@59..60 "]" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@60..61 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@61..62 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@62..64 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@64..65 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@65..66 "}" [] [], - }, - }, - COMMA@66..67 "," [] [], - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@67..71 "5" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@71..72 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@72..75 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@75..79 "rest" [] [], - }, - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@79..81 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@81..82 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@82..83 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@83..85 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@85..86 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..86 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..85 - 0: JS_VARIABLE_STATEMENT@0..85 - 0: JS_VARIABLE_DECLARATION@0..85 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..85 - 0: JS_VARIABLE_DECLARATOR@4..85 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..85 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..85 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..83 - 0: JS_METHOD_OBJECT_MEMBER@9..20 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@9..15 - 0: IDENT@9..15 "foo" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@15..18 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_PARAMETER_LIST@16..16 - 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@18..20 - 0: L_CURLY@18..19 "{" [] [] - 1: JS_DIRECTIVE_LIST@19..19 - 2: JS_STATEMENT_LIST@19..19 - 3: R_CURLY@19..20 "}" [] [] - 1: COMMA@20..21 "," [] [] - 2: JS_METHOD_OBJECT_MEMBER@21..41 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@21..29 - 0: JS_STRING_LITERAL@21..29 "\"bar\"" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@29..39 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_PARAMETER_LIST@30..37 - 0: JS_FORMAL_PARAMETER@30..31 - 0: JS_DECORATOR_LIST@30..30 - 1: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@31..33 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@33..34 - 0: JS_DECORATOR_LIST@33..33 - 1: JS_IDENTIFIER_BINDING@33..34 - 0: IDENT@33..34 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@34..36 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@36..37 - 0: JS_DECORATOR_LIST@36..36 - 1: JS_IDENTIFIER_BINDING@36..37 - 0: IDENT@36..37 "c" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@39..41 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..40 - 3: R_CURLY@40..41 "}" [] [] - 3: COMMA@41..42 "," [] [] - 4: JS_METHOD_OBJECT_MEMBER@42..66 - 0: (empty) - 1: (empty) - 2: JS_COMPUTED_MEMBER_NAME@42..60 - 0: L_BRACK@42..46 "[" [Newline("\n"), Whitespace(" ")] [] - 1: JS_BINARY_EXPRESSION@46..59 - 0: JS_STRING_LITERAL_EXPRESSION@46..52 - 0: JS_STRING_LITERAL@46..52 "\"foo\"" [] [Whitespace(" ")] - 1: PLUS@52..54 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@54..59 - 0: JS_STRING_LITERAL@54..59 "\"bar\"" [] [] - 2: R_BRACK@59..60 "]" [] [] - 3: (empty) - 4: JS_PARAMETERS@60..64 - 0: L_PAREN@60..61 "(" [] [] - 1: JS_PARAMETER_LIST@61..62 - 0: JS_FORMAL_PARAMETER@61..62 - 0: JS_DECORATOR_LIST@61..61 - 1: JS_IDENTIFIER_BINDING@61..62 - 0: IDENT@61..62 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@62..64 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@64..66 - 0: L_CURLY@64..65 "{" [] [] - 1: JS_DIRECTIVE_LIST@65..65 - 2: JS_STATEMENT_LIST@65..65 - 3: R_CURLY@65..66 "}" [] [] - 5: COMMA@66..67 "," [] [] - 6: JS_METHOD_OBJECT_MEMBER@67..83 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@67..71 - 0: JS_NUMBER_LITERAL@67..71 "5" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@71..81 - 0: L_PAREN@71..72 "(" [] [] - 1: JS_PARAMETER_LIST@72..79 - 0: JS_REST_PARAMETER@72..79 - 0: JS_DECORATOR_LIST@72..72 - 1: DOT3@72..75 "..." [] [] - 2: JS_IDENTIFIER_BINDING@75..79 - 0: IDENT@75..79 "rest" [] [] - 3: (empty) - 2: R_PAREN@79..81 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@81..83 - 0: L_CURLY@81..82 "{" [] [] - 1: JS_DIRECTIVE_LIST@82..82 - 2: JS_STATEMENT_LIST@82..82 - 3: R_CURLY@82..83 "}" [] [] - 2: R_CURLY@83..85 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@85..86 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast deleted file mode 100644 index 0d8f7af01daf..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast +++ /dev/null @@ -1,108 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declarations: JsVariableDeclarations { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - items: JsVariableDeclarationList [ - JsVariableDeclaration { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - excl_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsSetterObjectMember { - set_token: SET_KW@9..15 "set" [Whitespace("\n ")] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@15..16 "[" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..19 "foo" [] [], - }, - }, - r_brack_token: R_BRACK@19..20 "]" [] [], - }, - l_paren_token: L_PAREN@20..21 "(" [] [], - parameter: JsIdentifierBinding { - name_token: IDENT@21..24 "bar" [] [], - }, - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@27..39 "return" [Whitespace("\n ")] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@39..40 "5" [] [], - }, - semicolon_token: SEMICOLON@40..41 ";" [] [], - }, - ], - r_curly_token: R_CURLY@41..44 "}" [Whitespace("\n ")] [], - }, - }, - ], - r_curly_token: R_CURLY@44..46 "}" [Whitespace("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@46..47 "" [Whitespace("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_VARIABLE_STATEMENT@0..46 - 0: JS_VARIABLE_DECLARATIONS@0..46 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_LIST@4..46 - 0: JS_VARIABLE_DECLARATION@4..46 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@6..46 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..46 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..44 - 0: JS_SETTER_OBJECT_MEMBER@9..44 - 0: SET_KW@9..15 "set" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_NAME@15..20 - 0: L_BRACK@15..16 "[" [] [] - 1: JS_IDENTIFIER_EXPRESSION@16..19 - 0: JS_REFERENCE_IDENTIFIER@16..19 - 0: IDENT@16..19 "foo" [] [] - 2: R_BRACK@19..20 "]" [] [] - 2: L_PAREN@20..21 "(" [] [] - 3: JS_IDENTIFIER_BINDING@21..24 - 0: IDENT@21..24 "bar" [] [] - 4: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@26..44 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..41 - 0: JS_RETURN_STATEMENT@27..41 - 0: RETURN_KW@27..39 "return" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@39..40 - 0: JS_NUMBER_LITERAL@39..40 "5" [] [] - 2: SEMICOLON@40..41 ";" [] [] - 3: R_CURLY@41..44 "}" [Whitespace("\n ")] [] - 2: R_CURLY@44..46 "}" [Whitespace("\n")] [] - 1: (empty) - 4: EOF@46..47 "" [Whitespace("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast deleted file mode 100644 index dfa56e30794f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast +++ /dev/null @@ -1,68 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsSpread { - dotdotdot_token: DOT3@9..12 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..15 "foo" [] [], - }, - }, - }, - ], - r_curly_token: R_CURLY@15..16 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@16..17 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..17 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..16 - 0: JS_VARIABLE_STATEMENT@0..16 - 0: JS_VARIABLE_DECLARATION@0..16 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..16 - 0: JS_VARIABLE_DECLARATOR@4..16 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..16 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..16 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..15 - 0: JS_SPREAD@9..15 - 0: DOT3@9..12 "..." [] [] - 1: JS_IDENTIFIER_EXPRESSION@12..15 - 0: JS_REFERENCE_IDENTIFIER@12..15 - 0: IDENT@12..15 "foo" [] [] - 2: R_CURLY@15..16 "}" [] [] - 1: (empty) - 4: EOF@16..17 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_member_name.rast b/crates/biome_js_parser/test_data/inline/ok/object_member_name.rast deleted file mode 100644 index b39e4102ae85..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_member_name.rast +++ /dev/null @@ -1,150 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@9..14 "\"foo\"" [] [], - }, - colon_token: COLON@14..16 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..19 "foo" [] [], - }, - }, - }, - COMMA@19..21 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsComputedMemberName { - l_brack_token: L_BRACK@21..22 "[" [] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")], - }, - operator_token: PLUS@24..26 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@26..27 "6" [] [], - }, - }, - r_brack_token: R_BRACK@27..28 "]" [] [], - }, - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..33 "foo" [] [], - }, - }, - }, - COMMA@33..35 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@35..38 "bar" [] [], - }, - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..43 "foo" [] [], - }, - }, - }, - COMMA@43..45 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@45..46 "7" [] [], - }, - colon_token: COLON@46..48 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@48..51 "foo" [] [], - }, - }, - }, - ], - r_curly_token: R_CURLY@51..52 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@52..53 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..53 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..52 - 0: JS_VARIABLE_STATEMENT@0..52 - 0: JS_VARIABLE_DECLARATION@0..52 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..52 - 0: JS_VARIABLE_DECLARATOR@4..52 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..52 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..52 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..51 - 0: JS_PROPERTY_OBJECT_MEMBER@9..19 - 0: JS_LITERAL_MEMBER_NAME@9..14 - 0: JS_STRING_LITERAL@9..14 "\"foo\"" [] [] - 1: COLON@14..16 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@16..19 - 0: JS_REFERENCE_IDENTIFIER@16..19 - 0: IDENT@16..19 "foo" [] [] - 1: COMMA@19..21 "," [] [Whitespace(" ")] - 2: JS_PROPERTY_OBJECT_MEMBER@21..33 - 0: JS_COMPUTED_MEMBER_NAME@21..28 - 0: L_BRACK@21..22 "[" [] [] - 1: JS_BINARY_EXPRESSION@22..27 - 0: JS_NUMBER_LITERAL_EXPRESSION@22..24 - 0: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")] - 1: PLUS@24..26 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@26..27 - 0: JS_NUMBER_LITERAL@26..27 "6" [] [] - 2: R_BRACK@27..28 "]" [] [] - 1: COLON@28..30 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@30..33 - 0: JS_REFERENCE_IDENTIFIER@30..33 - 0: IDENT@30..33 "foo" [] [] - 3: COMMA@33..35 "," [] [Whitespace(" ")] - 4: JS_PROPERTY_OBJECT_MEMBER@35..43 - 0: JS_LITERAL_MEMBER_NAME@35..38 - 0: IDENT@35..38 "bar" [] [] - 1: COLON@38..40 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@40..43 - 0: JS_REFERENCE_IDENTIFIER@40..43 - 0: IDENT@40..43 "foo" [] [] - 5: COMMA@43..45 "," [] [Whitespace(" ")] - 6: JS_PROPERTY_OBJECT_MEMBER@45..51 - 0: JS_LITERAL_MEMBER_NAME@45..46 - 0: JS_NUMBER_LITERAL@45..46 "7" [] [] - 1: COLON@46..48 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@48..51 - 0: JS_REFERENCE_IDENTIFIER@48..51 - 0: IDENT@48..51 "foo" [] [] - 2: R_CURLY@51..52 "}" [] [] - 1: (empty) - 4: EOF@52..53 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.rast b/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.rast deleted file mode 100644 index 20b4321f3a91..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.rast +++ /dev/null @@ -1,80 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsObjectExpression { - l_curly_token: L_CURLY@5..7 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@7..8 "a" [] [], - }, - colon_token: COLON@8..10 ":" [] [Whitespace(" ")], - value: JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@10..14 "\"x\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@14..17 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - first_semi_token: SEMICOLON@21..22 ";" [] [], - test: missing (optional), - second_semi_token: SEMICOLON@22..23 ";" [] [], - update: missing (optional), - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@25..26 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: JS_FOR_STATEMENT@0..27 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_OBJECT_EXPRESSION@5..21 - 0: L_CURLY@5..7 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@7..20 - 0: JS_PROPERTY_OBJECT_MEMBER@7..20 - 0: JS_LITERAL_MEMBER_NAME@7..8 - 0: IDENT@7..8 "a" [] [] - 1: COLON@8..10 ":" [] [Whitespace(" ")] - 2: JS_IN_EXPRESSION@10..20 - 0: JS_STRING_LITERAL_EXPRESSION@10..14 - 0: JS_STRING_LITERAL@10..14 "\"x\"" [] [Whitespace(" ")] - 1: IN_KW@14..17 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@17..20 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@18..18 - 2: R_CURLY@18..20 "}" [] [Whitespace(" ")] - 2: R_CURLY@20..21 "}" [] [] - 3: SEMICOLON@21..22 ";" [] [] - 4: (empty) - 5: SEMICOLON@22..23 ";" [] [] - 6: (empty) - 7: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_STATEMENT_LIST@26..26 - 2: R_CURLY@26..27 "}" [] [] - 4: EOF@27..28 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_name.rast b/crates/biome_js_parser/test_data/inline/ok/object_prop_name.rast deleted file mode 100644 index b39e4102ae85..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_prop_name.rast +++ /dev/null @@ -1,150 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@9..14 "\"foo\"" [] [], - }, - colon_token: COLON@14..16 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..19 "foo" [] [], - }, - }, - }, - COMMA@19..21 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsComputedMemberName { - l_brack_token: L_BRACK@21..22 "[" [] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")], - }, - operator_token: PLUS@24..26 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@26..27 "6" [] [], - }, - }, - r_brack_token: R_BRACK@27..28 "]" [] [], - }, - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..33 "foo" [] [], - }, - }, - }, - COMMA@33..35 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@35..38 "bar" [] [], - }, - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..43 "foo" [] [], - }, - }, - }, - COMMA@43..45 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@45..46 "7" [] [], - }, - colon_token: COLON@46..48 ":" [] [Whitespace(" ")], - value: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@48..51 "foo" [] [], - }, - }, - }, - ], - r_curly_token: R_CURLY@51..52 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@52..53 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..53 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..52 - 0: JS_VARIABLE_STATEMENT@0..52 - 0: JS_VARIABLE_DECLARATION@0..52 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..52 - 0: JS_VARIABLE_DECLARATOR@4..52 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..52 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..52 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..51 - 0: JS_PROPERTY_OBJECT_MEMBER@9..19 - 0: JS_LITERAL_MEMBER_NAME@9..14 - 0: JS_STRING_LITERAL@9..14 "\"foo\"" [] [] - 1: COLON@14..16 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@16..19 - 0: JS_REFERENCE_IDENTIFIER@16..19 - 0: IDENT@16..19 "foo" [] [] - 1: COMMA@19..21 "," [] [Whitespace(" ")] - 2: JS_PROPERTY_OBJECT_MEMBER@21..33 - 0: JS_COMPUTED_MEMBER_NAME@21..28 - 0: L_BRACK@21..22 "[" [] [] - 1: JS_BINARY_EXPRESSION@22..27 - 0: JS_NUMBER_LITERAL_EXPRESSION@22..24 - 0: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")] - 1: PLUS@24..26 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@26..27 - 0: JS_NUMBER_LITERAL@26..27 "6" [] [] - 2: R_BRACK@27..28 "]" [] [] - 1: COLON@28..30 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@30..33 - 0: JS_REFERENCE_IDENTIFIER@30..33 - 0: IDENT@30..33 "foo" [] [] - 3: COMMA@33..35 "," [] [Whitespace(" ")] - 4: JS_PROPERTY_OBJECT_MEMBER@35..43 - 0: JS_LITERAL_MEMBER_NAME@35..38 - 0: IDENT@35..38 "bar" [] [] - 1: COLON@38..40 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@40..43 - 0: JS_REFERENCE_IDENTIFIER@40..43 - 0: IDENT@40..43 "foo" [] [] - 5: COMMA@43..45 "," [] [Whitespace(" ")] - 6: JS_PROPERTY_OBJECT_MEMBER@45..51 - 0: JS_LITERAL_MEMBER_NAME@45..46 - 0: JS_NUMBER_LITERAL@45..46 "7" [] [] - 1: COLON@46..48 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@48..51 - 0: JS_REFERENCE_IDENTIFIER@48..51 - 0: IDENT@48..51 "foo" [] [] - 2: R_CURLY@51..52 "}" [] [] - 1: (empty) - 4: EOF@52..53 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_property_binding.rast b/crates/biome_js_parser/test_data/inline/ok/object_property_binding.rast deleted file mode 100644 index b89e1e1403c1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_property_binding.rast +++ /dev/null @@ -1,148 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@6..9 "foo" [] [], - }, - colon_token: COLON@9..11 ":" [] [Whitespace(" ")], - pattern: JsIdentifierBinding { - name_token: IDENT@11..16 "bar" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@16..18 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@18..20 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@20..21 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@29..32 "foo" [] [], - }, - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - pattern: JsIdentifierBinding { - name_token: IDENT@34..42 "bar_bar" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..48 "baz" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - r_curly_token: R_CURLY@48..50 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@50..52 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@52..53 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@53..54 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_VARIABLE_STATEMENT@0..22 - 0: JS_VARIABLE_DECLARATION@0..22 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..22 - 0: JS_VARIABLE_DECLARATOR@4..22 - 0: JS_OBJECT_BINDING_PATTERN@4..18 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..16 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@6..16 - 0: JS_LITERAL_MEMBER_NAME@6..9 - 0: IDENT@6..9 "foo" [] [] - 1: COLON@9..11 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@11..16 - 0: IDENT@11..16 "bar" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@16..18 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@18..22 - 0: EQ@18..20 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@20..22 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@21..21 - 2: R_CURLY@21..22 "}" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@22..54 - 0: JS_VARIABLE_DECLARATION@22..54 - 0: (empty) - 1: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@27..54 - 0: JS_VARIABLE_DECLARATOR@27..54 - 0: JS_OBJECT_BINDING_PATTERN@27..50 - 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@29..48 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@29..48 - 0: JS_LITERAL_MEMBER_NAME@29..32 - 0: IDENT@29..32 "foo" [] [] - 1: COLON@32..34 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@34..42 - 0: IDENT@34..42 "bar_bar" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@42..48 - 0: EQ@42..44 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@44..48 - 0: JS_REFERENCE_IDENTIFIER@44..48 - 0: IDENT@44..48 "baz" [] [Whitespace(" ")] - 2: R_CURLY@48..50 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@50..54 - 0: EQ@50..52 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@52..54 - 0: L_CURLY@52..53 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@53..53 - 2: R_CURLY@53..54 "}" [] [] - 1: (empty) - 4: EOF@54..55 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.rast b/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.rast deleted file mode 100644 index b20a9fbae61f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.rast +++ /dev/null @@ -1,180 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@6..7 "a" [] [], - }, - init: missing (optional), - }, - COMMA@7..9 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@9..11 "b" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@13..15 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@23..25 "d" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@25..27 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@27..36 "\"default\"" [] [], - }, - }, - }, - COMMA@36..38 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@38..40 "e" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..46 "call" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@46..47 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], - }, - }, - }, - }, - ], - r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@51..53 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@53..54 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@54..55 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..55 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..54 - 0: JS_VARIABLE_STATEMENT@0..16 - 0: JS_VARIABLE_DECLARATION@0..16 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..16 - 0: JS_VARIABLE_DECLARATOR@4..16 - 0: JS_OBJECT_BINDING_PATTERN@4..13 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..11 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@6..7 - 0: JS_IDENTIFIER_BINDING@6..7 - 0: IDENT@6..7 "a" [] [] - 1: (empty) - 1: COMMA@7..9 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@9..11 - 0: JS_IDENTIFIER_BINDING@9..11 - 0: IDENT@9..11 "b" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@13..16 - 0: EQ@13..15 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "c" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@16..54 - 0: JS_VARIABLE_DECLARATION@16..54 - 0: (empty) - 1: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@21..54 - 0: JS_VARIABLE_DECLARATOR@21..54 - 0: JS_OBJECT_BINDING_PATTERN@21..51 - 0: L_CURLY@21..23 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@23..49 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@23..36 - 0: JS_IDENTIFIER_BINDING@23..25 - 0: IDENT@23..25 "d" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@25..36 - 0: EQ@25..27 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@27..36 - 0: JS_STRING_LITERAL@27..36 "\"default\"" [] [] - 1: COMMA@36..38 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@38..49 - 0: JS_IDENTIFIER_BINDING@38..40 - 0: IDENT@38..40 "e" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@40..49 - 0: EQ@40..42 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@42..49 - 0: JS_IDENTIFIER_EXPRESSION@42..46 - 0: JS_REFERENCE_IDENTIFIER@42..46 - 0: IDENT@42..46 "call" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@46..49 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@47..47 - 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] - 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@51..54 - 0: EQ@51..53 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@53..54 - 0: JS_REFERENCE_IDENTIFIER@53..54 - 0: IDENT@53..54 "c" [] [] - 1: (empty) - 4: EOF@54..55 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.rast b/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.rast deleted file mode 100644 index 39d1a2cb6260..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.rast +++ /dev/null @@ -1,134 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..6 "String" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@6..7 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..11 "item" [] [], - }, - }, - ], - r_paren_token: R_PAREN@11..12 ")" [] [], - }, - }, - operator_token: QUESTIONDOT@12..14 "?." [] [], - member: JsName { - value_token: IDENT@14..16 "b" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@16..18 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@18..19 "0" [] [], - }, - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..27 "String" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@27..28 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..32 "item" [] [], - }, - }, - ], - r_paren_token: R_PAREN@32..33 ")" [] [], - }, - }, - operator_token: QUESTIONDOT@33..35 "?." [] [], - member: JsName { - value_token: IDENT@35..37 "b" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@37..38 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..42 "aBcd" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - ], - eof_token: EOF@43..44 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..44 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..43 - 0: JS_EXPRESSION_STATEMENT@0..20 - 0: JS_BINARY_EXPRESSION@0..19 - 0: JS_STATIC_MEMBER_EXPRESSION@0..16 - 0: JS_CALL_EXPRESSION@0..12 - 0: JS_IDENTIFIER_EXPRESSION@0..6 - 0: JS_REFERENCE_IDENTIFIER@0..6 - 0: IDENT@0..6 "String" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@6..12 - 0: L_PAREN@6..7 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@7..11 - 0: JS_IDENTIFIER_EXPRESSION@7..11 - 0: JS_REFERENCE_IDENTIFIER@7..11 - 0: IDENT@7..11 "item" [] [] - 2: R_PAREN@11..12 ")" [] [] - 1: QUESTIONDOT@12..14 "?." [] [] - 2: JS_NAME@14..16 - 0: IDENT@14..16 "b" [] [Whitespace(" ")] - 1: L_ANGLE@16..18 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@18..19 - 0: JS_NUMBER_LITERAL@18..19 "0" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@20..43 - 0: JS_BINARY_EXPRESSION@20..42 - 0: JS_STATIC_MEMBER_EXPRESSION@20..37 - 0: JS_CALL_EXPRESSION@20..33 - 0: JS_IDENTIFIER_EXPRESSION@20..27 - 0: JS_REFERENCE_IDENTIFIER@20..27 - 0: IDENT@20..27 "String" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@27..33 - 0: L_PAREN@27..28 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@28..32 - 0: JS_IDENTIFIER_EXPRESSION@28..32 - 0: JS_REFERENCE_IDENTIFIER@28..32 - 0: IDENT@28..32 "item" [] [] - 2: R_PAREN@32..33 ")" [] [] - 1: QUESTIONDOT@33..35 "?." [] [] - 2: JS_NAME@35..37 - 0: IDENT@35..37 "b" [] [Whitespace(" ")] - 1: L_ANGLE@37..38 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@38..42 - 0: JS_REFERENCE_IDENTIFIER@38..42 - 0: IDENT@38..42 "aBcd" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 4: EOF@43..44 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/parameter_list.rast b/crates/biome_js_parser/test_data/inline/ok/parameter_list.rast deleted file mode 100644 index 2197b493ae06..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/parameter_list.rast +++ /dev/null @@ -1,102 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..34 "evalInComputedPropertyKey" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@34..35 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@35..37 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsComputedMemberName { - l_brack_token: L_BRACK@37..38 "[" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..46 "computed" [] [], - }, - }, - r_brack_token: R_BRACK@46..47 "]" [] [], - }, - colon_token: COLON@47..49 ":" [] [Whitespace(" ")], - pattern: JsIdentifierBinding { - name_token: IDENT@49..57 "ignored" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@60..61 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@61..62 "}" [] [], - }, - }, - ], - eof_token: EOF@62..63 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..63 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..62 - 0: JS_FUNCTION_DECLARATION@0..62 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..34 - 0: IDENT@9..34 "evalInComputedPropertyKey" [] [] - 4: (empty) - 5: JS_PARAMETERS@34..60 - 0: L_PAREN@34..35 "(" [] [] - 1: JS_PARAMETER_LIST@35..58 - 0: JS_FORMAL_PARAMETER@35..58 - 0: JS_DECORATOR_LIST@35..35 - 1: JS_OBJECT_BINDING_PATTERN@35..58 - 0: L_CURLY@35..37 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@37..57 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@37..57 - 0: JS_COMPUTED_MEMBER_NAME@37..47 - 0: L_BRACK@37..38 "[" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..46 - 0: JS_REFERENCE_IDENTIFIER@38..46 - 0: IDENT@38..46 "computed" [] [] - 2: R_BRACK@46..47 "]" [] [] - 1: COLON@47..49 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@49..57 - 0: IDENT@49..57 "ignored" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@57..58 "}" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@60..62 - 0: L_CURLY@60..61 "{" [] [] - 1: JS_DIRECTIVE_LIST@61..61 - 2: JS_STATEMENT_LIST@61..61 - 3: R_CURLY@61..62 "}" [] [] - 4: EOF@62..63 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/paren_or_arrow_expr.rast b/crates/biome_js_parser/test_data/inline/ok/paren_or_arrow_expr.rast deleted file mode 100644 index eae9b321d28f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/paren_or_arrow_expr.rast +++ /dev/null @@ -1,310 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..4 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@4..5 ")" [] [], - }, - semicolon_token: SEMICOLON@5..6 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@6..8 "(" [Newline("\n")] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@8..11 "foo" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@16..17 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@17..18 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@19..21 "(" [Newline("\n")] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@21..23 "5" [] [Whitespace(" ")], - }, - operator_token: PLUS@23..25 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@25..26 "5" [] [], - }, - }, - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..30 "(" [Newline("\n")] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@30..31 "{" [] [], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@31..34 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@34..36 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@36..39 "bar" [] [], - }, - init: missing (optional), - }, - COMMA@39..41 "," [] [Whitespace(" ")], - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@41..42 "b" [] [], - }, - colon_token: COLON@42..44 ":" [] [Whitespace(" ")], - pattern: JsArrayBindingPattern { - l_brack_token: L_BRACK@44..45 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@45..46 "f" [] [], - }, - init: missing (optional), - }, - COMMA@46..48 "," [] [Whitespace(" ")], - JsArrayBindingPatternRestElement { - dotdotdot_token: DOT3@48..51 "..." [] [], - pattern: JsIdentifierBinding { - name_token: IDENT@51..54 "baz" [] [], - }, - }, - ], - r_brack_token: R_BRACK@54..55 "]" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@55..56 "}" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@61..62 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@64..66 "(" [Newline("\n")] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@66..69 "foo" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@69..71 "," [] [Whitespace(" ")], - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@71..74 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@74..77 "bar" [] [], - }, - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@77..79 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@82..83 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@83..84 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: JS_EXPRESSION_STATEMENT@0..6 - 0: JS_PARENTHESIZED_EXPRESSION@0..5 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@1..4 - 0: JS_REFERENCE_IDENTIFIER@1..4 - 0: IDENT@1..4 "foo" [] [] - 2: R_PAREN@4..5 ")" [] [] - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@6..19 - 0: JS_ARROW_FUNCTION_EXPRESSION@6..18 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@6..13 - 0: L_PAREN@6..8 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@8..11 - 0: JS_FORMAL_PARAMETER@8..11 - 0: JS_DECORATOR_LIST@8..8 - 1: JS_IDENTIFIER_BINDING@8..11 - 0: IDENT@8..11 "foo" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@16..18 - 0: L_CURLY@16..17 "{" [] [] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..17 - 3: R_CURLY@17..18 "}" [] [] - 1: SEMICOLON@18..19 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@19..28 - 0: JS_PARENTHESIZED_EXPRESSION@19..27 - 0: L_PAREN@19..21 "(" [Newline("\n")] [] - 1: JS_BINARY_EXPRESSION@21..26 - 0: JS_NUMBER_LITERAL_EXPRESSION@21..23 - 0: JS_NUMBER_LITERAL@21..23 "5" [] [Whitespace(" ")] - 1: PLUS@23..25 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@25..26 - 0: JS_NUMBER_LITERAL@25..26 "5" [] [] - 2: R_PAREN@26..27 ")" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@28..64 - 0: JS_ARROW_FUNCTION_EXPRESSION@28..63 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@28..58 - 0: L_PAREN@28..30 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@30..56 - 0: JS_FORMAL_PARAMETER@30..56 - 0: JS_DECORATOR_LIST@30..30 - 1: JS_OBJECT_BINDING_PATTERN@30..56 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@31..55 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@31..34 - 0: JS_IDENTIFIER_BINDING@31..34 - 0: IDENT@31..34 "foo" [] [] - 1: (empty) - 1: COMMA@34..36 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@36..39 - 0: JS_IDENTIFIER_BINDING@36..39 - 0: IDENT@36..39 "bar" [] [] - 1: (empty) - 3: COMMA@39..41 "," [] [Whitespace(" ")] - 4: JS_OBJECT_BINDING_PATTERN_PROPERTY@41..55 - 0: JS_LITERAL_MEMBER_NAME@41..42 - 0: IDENT@41..42 "b" [] [] - 1: COLON@42..44 ":" [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN@44..55 - 0: L_BRACK@44..45 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@45..54 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@45..46 - 0: JS_IDENTIFIER_BINDING@45..46 - 0: IDENT@45..46 "f" [] [] - 1: (empty) - 1: COMMA@46..48 "," [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@48..54 - 0: DOT3@48..51 "..." [] [] - 1: JS_IDENTIFIER_BINDING@51..54 - 0: IDENT@51..54 "baz" [] [] - 2: R_BRACK@54..55 "]" [] [] - 3: (empty) - 2: R_CURLY@55..56 "}" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@61..63 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_DIRECTIVE_LIST@62..62 - 2: JS_STATEMENT_LIST@62..62 - 3: R_CURLY@62..63 "}" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@64..84 - 0: JS_ARROW_FUNCTION_EXPRESSION@64..84 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@64..79 - 0: L_PAREN@64..66 "(" [Newline("\n")] [] - 1: JS_PARAMETER_LIST@66..77 - 0: JS_FORMAL_PARAMETER@66..69 - 0: JS_DECORATOR_LIST@66..66 - 1: JS_IDENTIFIER_BINDING@66..69 - 0: IDENT@66..69 "foo" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@69..71 "," [] [Whitespace(" ")] - 2: JS_REST_PARAMETER@71..77 - 0: JS_DECORATOR_LIST@71..71 - 1: DOT3@71..74 "..." [] [] - 2: JS_IDENTIFIER_BINDING@74..77 - 0: IDENT@74..77 "bar" [] [] - 3: (empty) - 2: R_PAREN@77..79 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@82..84 - 0: L_CURLY@82..83 "{" [] [] - 1: JS_DIRECTIVE_LIST@83..83 - 2: JS_STATEMENT_LIST@83..83 - 3: R_CURLY@83..84 "}" [] [] - 1: (empty) - 4: EOF@84..85 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.rast b/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.rast deleted file mode 100644 index b16ee6da4cd9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.rast +++ /dev/null @@ -1,309 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..2 "a" [] [], - }, - }, - comma_token: COMMA@2..4 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@4..5 "b" [] [], - }, - }, - }, - r_paren_token: R_PAREN@5..6 ")" [] [], - }, - semicolon_token: SEMICOLON@6..7 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@7..9 "(" [Newline("\n")] [], - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..10 "a" [] [], - }, - }, - comma_token: COMMA@10..12 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@12..13 "b" [] [], - }, - }, - }, - comma_token: COMMA@13..15 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@16..17 ")" [] [], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@20..21 "a" [] [], - }, - }, - comma_token: COMMA@21..23 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..24 "b" [] [], - }, - }, - }, - comma_token: COMMA@24..26 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..27 "c" [] [], - }, - }, - }, - comma_token: COMMA@27..29 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@29..30 "d" [] [], - }, - }, - }, - comma_token: COMMA@30..32 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..33 "e" [] [], - }, - }, - }, - comma_token: COMMA@33..35 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "f" [] [], - }, - }, - }, - r_paren_token: R_PAREN@36..37 ")" [] [], - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@38..40 "(" [Newline("\n")] [], - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..41 "a" [] [], - }, - }, - comma_token: COMMA@41..43 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..44 "b" [] [], - }, - }, - }, - comma_token: COMMA@44..46 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..47 "c" [] [], - }, - }, - }, - comma_token: COMMA@47..49 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..50 "d" [] [], - }, - }, - }, - comma_token: COMMA@50..52 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@52..53 "e" [] [], - }, - }, - }, - comma_token: COMMA@53..55 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..56 "f" [] [], - }, - }, - }, - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@57..59 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..60 "a" [] [], - }, - }, - COMMA@60..62 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@62..63 "b" [] [], - }, - }, - COMMA@63..65 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@65..66 "c" [] [], - }, - }, - ], - r_paren_token: R_PAREN@66..67 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JS_PARENTHESIZED_EXPRESSION@0..6 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@1..5 - 0: JS_IDENTIFIER_EXPRESSION@1..2 - 0: JS_REFERENCE_IDENTIFIER@1..2 - 0: IDENT@1..2 "a" [] [] - 1: COMMA@2..4 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@4..5 - 0: JS_REFERENCE_IDENTIFIER@4..5 - 0: IDENT@4..5 "b" [] [] - 2: R_PAREN@5..6 ")" [] [] - 1: SEMICOLON@6..7 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@7..18 - 0: JS_PARENTHESIZED_EXPRESSION@7..17 - 0: L_PAREN@7..9 "(" [Newline("\n")] [] - 1: JS_SEQUENCE_EXPRESSION@9..16 - 0: JS_SEQUENCE_EXPRESSION@9..13 - 0: JS_IDENTIFIER_EXPRESSION@9..10 - 0: JS_REFERENCE_IDENTIFIER@9..10 - 0: IDENT@9..10 "a" [] [] - 1: COMMA@10..12 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@12..13 - 0: JS_REFERENCE_IDENTIFIER@12..13 - 0: IDENT@12..13 "b" [] [] - 1: COMMA@13..15 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "c" [] [] - 2: R_PAREN@16..17 ")" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@18..38 - 0: JS_PARENTHESIZED_EXPRESSION@18..37 - 0: L_PAREN@18..20 "(" [Newline("\n")] [] - 1: JS_SEQUENCE_EXPRESSION@20..36 - 0: JS_SEQUENCE_EXPRESSION@20..33 - 0: JS_SEQUENCE_EXPRESSION@20..30 - 0: JS_SEQUENCE_EXPRESSION@20..27 - 0: JS_SEQUENCE_EXPRESSION@20..24 - 0: JS_IDENTIFIER_EXPRESSION@20..21 - 0: JS_REFERENCE_IDENTIFIER@20..21 - 0: IDENT@20..21 "a" [] [] - 1: COMMA@21..23 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@23..24 - 0: JS_REFERENCE_IDENTIFIER@23..24 - 0: IDENT@23..24 "b" [] [] - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@26..27 - 0: JS_REFERENCE_IDENTIFIER@26..27 - 0: IDENT@26..27 "c" [] [] - 1: COMMA@27..29 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@29..30 - 0: JS_REFERENCE_IDENTIFIER@29..30 - 0: IDENT@29..30 "d" [] [] - 1: COMMA@30..32 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@32..33 - 0: JS_REFERENCE_IDENTIFIER@32..33 - 0: IDENT@32..33 "e" [] [] - 1: COMMA@33..35 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "f" [] [] - 2: R_PAREN@36..37 ")" [] [] - 1: SEMICOLON@37..38 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@38..67 - 0: JS_CALL_EXPRESSION@38..67 - 0: JS_PARENTHESIZED_EXPRESSION@38..57 - 0: L_PAREN@38..40 "(" [Newline("\n")] [] - 1: JS_SEQUENCE_EXPRESSION@40..56 - 0: JS_SEQUENCE_EXPRESSION@40..53 - 0: JS_SEQUENCE_EXPRESSION@40..50 - 0: JS_SEQUENCE_EXPRESSION@40..47 - 0: JS_SEQUENCE_EXPRESSION@40..44 - 0: JS_IDENTIFIER_EXPRESSION@40..41 - 0: JS_REFERENCE_IDENTIFIER@40..41 - 0: IDENT@40..41 "a" [] [] - 1: COMMA@41..43 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@43..44 - 0: JS_REFERENCE_IDENTIFIER@43..44 - 0: IDENT@43..44 "b" [] [] - 1: COMMA@44..46 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@46..47 - 0: JS_REFERENCE_IDENTIFIER@46..47 - 0: IDENT@46..47 "c" [] [] - 1: COMMA@47..49 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@49..50 - 0: JS_REFERENCE_IDENTIFIER@49..50 - 0: IDENT@49..50 "d" [] [] - 1: COMMA@50..52 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@52..53 - 0: JS_REFERENCE_IDENTIFIER@52..53 - 0: IDENT@52..53 "e" [] [] - 1: COMMA@53..55 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@55..56 - 0: JS_REFERENCE_IDENTIFIER@55..56 - 0: IDENT@55..56 "f" [] [] - 2: R_PAREN@56..57 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@57..67 - 0: L_PAREN@57..59 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@59..66 - 0: JS_IDENTIFIER_EXPRESSION@59..60 - 0: JS_REFERENCE_IDENTIFIER@59..60 - 0: IDENT@59..60 "a" [] [] - 1: COMMA@60..62 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@62..63 - 0: JS_REFERENCE_IDENTIFIER@62..63 - 0: IDENT@62..63 "b" [] [] - 3: COMMA@63..65 "," [] [Whitespace(" ")] - 4: JS_IDENTIFIER_EXPRESSION@65..66 - 0: JS_REFERENCE_IDENTIFIER@65..66 - 0: IDENT@65..66 "c" [] [] - 2: R_PAREN@66..67 ")" [] [] - 1: (empty) - 4: EOF@67..68 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.rast b/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.rast deleted file mode 100644 index 8cd18cc8745f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.rast +++ /dev/null @@ -1,86 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForInStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@5..6 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@6..8 "a" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsInExpression { - property: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@10..14 "\"a\"" [] [Whitespace(" ")], - }, - in_token: IN_KW@14..17 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - }, - }, - }, - ], - r_brack_token: R_BRACK@19..21 "]" [] [Whitespace(" ")], - }, - in_token: IN_KW@21..24 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@24..25 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@25..26 "]" [] [], - }, - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@28..29 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_FOR_IN_STATEMENT@0..30 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_ARRAY_ASSIGNMENT_PATTERN@5..21 - 0: L_BRACK@5..6 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@6..19 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@6..19 - 0: JS_IDENTIFIER_ASSIGNMENT@6..8 - 0: IDENT@6..8 "a" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@8..19 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_IN_EXPRESSION@10..19 - 0: JS_STRING_LITERAL_EXPRESSION@10..14 - 0: JS_STRING_LITERAL@10..14 "\"a\"" [] [Whitespace(" ")] - 1: IN_KW@14..17 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@17..19 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@18..18 - 2: R_CURLY@18..19 "}" [] [] - 2: R_BRACK@19..21 "]" [] [Whitespace(" ")] - 3: IN_KW@21..24 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@24..26 - 0: L_BRACK@24..25 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@25..25 - 2: R_BRACK@25..26 "]" [] [] - 5: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@28..30 - 0: L_CURLY@28..29 "{" [] [] - 1: JS_STATEMENT_LIST@29..29 - 2: R_CURLY@29..30 "}" [] [] - 4: EOF@30..31 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/post_update_expr.rast b/crates/biome_js_parser/test_data/inline/ok/post_update_expr.rast deleted file mode 100644 index 5aa7a16032da..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/post_update_expr.rast +++ /dev/null @@ -1,45 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@0..3 "foo" [] [], - }, - operator_token: PLUS2@3..5 "++" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@5..9 "foo" [Newline("\n")] [], - }, - operator_token: MINUS2@9..11 "--" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_EXPRESSION_STATEMENT@0..5 - 0: JS_POST_UPDATE_EXPRESSION@0..5 - 0: JS_IDENTIFIER_ASSIGNMENT@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: PLUS2@3..5 "++" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@5..11 - 0: JS_POST_UPDATE_EXPRESSION@5..11 - 0: JS_IDENTIFIER_ASSIGNMENT@5..9 - 0: IDENT@5..9 "foo" [Newline("\n")] [] - 1: MINUS2@9..11 "--" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/postfix_expr.rast b/crates/biome_js_parser/test_data/inline/ok/postfix_expr.rast deleted file mode 100644 index 5aa7a16032da..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/postfix_expr.rast +++ /dev/null @@ -1,45 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@0..3 "foo" [] [], - }, - operator_token: PLUS2@3..5 "++" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsPostUpdateExpression { - operand: JsIdentifierAssignment { - name_token: IDENT@5..9 "foo" [Newline("\n")] [], - }, - operator_token: MINUS2@9..11 "--" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_EXPRESSION_STATEMENT@0..5 - 0: JS_POST_UPDATE_EXPRESSION@0..5 - 0: JS_IDENTIFIER_ASSIGNMENT@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: PLUS2@3..5 "++" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@5..11 - 0: JS_POST_UPDATE_EXPRESSION@5..11 - 0: JS_IDENTIFIER_ASSIGNMENT@5..9 - 0: IDENT@5..9 "foo" [Newline("\n")] [] - 1: MINUS2@9..11 "--" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.rast b/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.rast deleted file mode 100644 index 55328921731f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.rast +++ /dev/null @@ -1,45 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsPreUpdateExpression { - operator_token: PLUS2@0..2 "++" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@2..5 "foo" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsPreUpdateExpression { - operator_token: MINUS2@5..8 "--" [Newline("\n")] [], - operand: JsIdentifierAssignment { - name_token: IDENT@8..11 "foo" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_EXPRESSION_STATEMENT@0..5 - 0: JS_PRE_UPDATE_EXPRESSION@0..5 - 0: PLUS2@0..2 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@2..5 - 0: IDENT@2..5 "foo" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@5..11 - 0: JS_PRE_UPDATE_EXPRESSION@5..11 - 0: MINUS2@5..8 "--" [Newline("\n")] [] - 1: JS_IDENTIFIER_ASSIGNMENT@8..11 - 0: IDENT@8..11 "foo" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.rast b/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.rast deleted file mode 100644 index d86f04cb31ed..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.rast +++ /dev/null @@ -1,123 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [], - id_token: IDENT@12..16 "prop" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsInExpression { - property: JsPrivateName { - hash_token: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [], - value_token: IDENT@32..37 "prop" [] [Whitespace(" ")], - }, - in_token: IN_KW@37..40 "in" [] [Whitespace(" ")], - object: JsThisExpression { - this_token: THIS_KW@40..44 "this" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@44..47 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@47..49 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_CLASS_DECLARATION@0..49 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..47 - 0: JS_PROPERTY_CLASS_MEMBER@9..17 - 0: JS_PROPERTY_MODIFIER_LIST@9..9 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@9..16 - 0: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [] - 1: IDENT@12..16 "prop" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@16..17 ";" [] [] - 1: JS_METHOD_CLASS_MEMBER@17..47 - 0: JS_METHOD_MODIFIER_LIST@17..17 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@17..23 - 0: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@26..47 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..44 - 0: JS_EXPRESSION_STATEMENT@27..44 - 0: JS_IN_EXPRESSION@27..44 - 0: JS_PRIVATE_NAME@27..37 - 0: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@32..37 "prop" [] [Whitespace(" ")] - 1: IN_KW@37..40 "in" [] [Whitespace(" ")] - 2: JS_THIS_EXPRESSION@40..44 - 0: THIS_KW@40..44 "this" [] [] - 1: (empty) - 3: R_CURLY@44..47 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@47..49 "}" [Newline("\n")] [] - 4: EOF@49..50 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.rast b/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.rast deleted file mode 100644 index 963111819698..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.rast +++ /dev/null @@ -1,538 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@1..2 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@2..3 "x" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@3..4 "}" [] [], - }, - operator_token: EQ@4..6 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@6..7 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@7..8 "}" [] [], - }, - }, - r_paren_token: R_PAREN@8..9 ")" [] [], - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@10..12 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@12..13 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@13..14 "x" [] [], - }, - colon_token: COLON@14..16 ":" [] [Whitespace(" ")], - pattern: JsIdentifierAssignment { - name_token: IDENT@16..17 "y" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@17..18 "}" [] [], - }, - operator_token: EQ@18..20 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@20..21 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - r_paren_token: R_PAREN@22..23 ")" [] [], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@24..26 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@26..27 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@27..28 "x" [] [], - }, - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - pattern: JsStaticMemberAssignment { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..31 "y" [] [], - }, - }, - operator_token: DOT@31..32 "." [] [], - member: JsName { - value_token: IDENT@32..36 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@36..37 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@37..38 ")" [] [], - }, - }, - dot_token: DOT@38..39 "." [] [], - member: JsName { - value_token: IDENT@39..40 "z" [] [], - }, - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - operator_token: EQ@41..43 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@43..44 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@44..45 "}" [] [], - }, - }, - r_paren_token: R_PAREN@45..46 ")" [] [], - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@47..49 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@49..50 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@50..51 "x" [] [], - }, - colon_token: COLON@51..53 ":" [] [Whitespace(" ")], - pattern: JsParenthesizedAssignment { - l_paren_token: L_PAREN@53..54 "(" [] [], - assignment: JsParenthesizedAssignment { - l_paren_token: L_PAREN@54..55 "(" [] [], - assignment: JsIdentifierAssignment { - name_token: IDENT@55..56 "z" [] [], - }, - r_paren_token: R_PAREN@56..57 ")" [] [], - }, - r_paren_token: R_PAREN@57..58 ")" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@58..59 "}" [] [], - }, - operator_token: EQ@59..61 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@61..62 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - }, - r_paren_token: R_PAREN@63..64 ")" [] [], - }, - semicolon_token: SEMICOLON@64..65 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@65..67 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@67..68 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@68..69 "x" [] [], - }, - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - pattern: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@71..72 "z" [] [], - }, - }, - l_brack_token: L_BRACK@72..73 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@73..83 "\"computed\"" [] [], - }, - r_brack_token: R_BRACK@83..84 "]" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@84..85 "}" [] [], - }, - operator_token: EQ@85..87 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@87..88 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@88..89 "}" [] [], - }, - }, - r_paren_token: R_PAREN@89..90 ")" [] [], - }, - semicolon_token: SEMICOLON@90..91 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@91..93 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@93..94 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternShorthandProperty { - identifier: JsIdentifierAssignment { - name_token: IDENT@94..96 "x" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@96..98 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@98..107 "\"default\"" [] [], - }, - }, - }, - ], - r_curly_token: R_CURLY@107..108 "}" [] [], - }, - operator_token: EQ@108..110 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@110..111 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@111..112 "}" [] [], - }, - }, - r_paren_token: R_PAREN@112..113 ")" [] [], - }, - semicolon_token: SEMICOLON@113..114 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@114..116 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@116..117 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@117..118 "x" [] [], - }, - colon_token: COLON@118..120 ":" [] [Whitespace(" ")], - pattern: JsIdentifierAssignment { - name_token: IDENT@120..122 "y" [] [Whitespace(" ")], - }, - init: JsInitializerClause { - eq_token: EQ@122..124 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@124..133 "\"default\"" [] [], - }, - }, - }, - ], - r_curly_token: R_CURLY@133..134 "}" [] [], - }, - operator_token: EQ@134..136 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@136..137 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@137..138 "}" [] [], - }, - }, - r_paren_token: R_PAREN@138..139 ")" [] [], - }, - semicolon_token: SEMICOLON@139..140 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@140..142 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@142..143 "{" [] [], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@143..144 "0" [] [], - }, - colon_token: COLON@144..146 ":" [] [Whitespace(" ")], - pattern: JsIdentifierAssignment { - name_token: IDENT@146..147 "y" [] [], - }, - init: missing (optional), - }, - COMMA@147..149 "," [] [Whitespace(" ")], - JsObjectAssignmentPatternProperty { - member: JsComputedMemberName { - l_brack_token: L_BRACK@149..150 "[" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@150..158 "computed" [] [], - }, - }, - r_brack_token: R_BRACK@158..159 "]" [] [], - }, - colon_token: COLON@159..161 ":" [] [Whitespace(" ")], - pattern: JsIdentifierAssignment { - name_token: IDENT@161..162 "z" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@162..164 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@164..166 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@166..167 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@167..168 "}" [] [], - }, - }, - r_paren_token: R_PAREN@168..169 ")" [] [], - }, - semicolon_token: SEMICOLON@169..170 ";" [] [], - }, - ], - eof_token: EOF@170..171 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..171 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..170 - 0: JS_EXPRESSION_STATEMENT@0..10 - 0: JS_PARENTHESIZED_EXPRESSION@0..9 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..8 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..4 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@2..3 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@2..3 - 0: JS_IDENTIFIER_ASSIGNMENT@2..3 - 0: IDENT@2..3 "x" [] [] - 1: (empty) - 2: R_CURLY@3..4 "}" [] [] - 1: EQ@4..6 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@6..8 - 0: L_CURLY@6..7 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@7..7 - 2: R_CURLY@7..8 "}" [] [] - 2: R_PAREN@8..9 ")" [] [] - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@10..24 - 0: JS_PARENTHESIZED_EXPRESSION@10..23 - 0: L_PAREN@10..12 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@12..22 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@12..18 - 0: L_CURLY@12..13 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@13..17 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@13..17 - 0: JS_LITERAL_MEMBER_NAME@13..14 - 0: IDENT@13..14 "x" [] [] - 1: COLON@14..16 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_ASSIGNMENT@16..17 - 0: IDENT@16..17 "y" [] [] - 3: (empty) - 2: R_CURLY@17..18 "}" [] [] - 1: EQ@18..20 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@20..22 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@21..21 - 2: R_CURLY@21..22 "}" [] [] - 2: R_PAREN@22..23 ")" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@24..47 - 0: JS_PARENTHESIZED_EXPRESSION@24..46 - 0: L_PAREN@24..26 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@26..45 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@26..41 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@27..40 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@27..40 - 0: JS_LITERAL_MEMBER_NAME@27..28 - 0: IDENT@27..28 "x" [] [] - 1: COLON@28..30 ":" [] [Whitespace(" ")] - 2: JS_STATIC_MEMBER_ASSIGNMENT@30..40 - 0: JS_CALL_EXPRESSION@30..38 - 0: JS_STATIC_MEMBER_EXPRESSION@30..36 - 0: JS_IDENTIFIER_EXPRESSION@30..31 - 0: JS_REFERENCE_IDENTIFIER@30..31 - 0: IDENT@30..31 "y" [] [] - 1: DOT@31..32 "." [] [] - 2: JS_NAME@32..36 - 0: IDENT@32..36 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@36..38 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@37..37 - 2: R_PAREN@37..38 ")" [] [] - 1: DOT@38..39 "." [] [] - 2: JS_NAME@39..40 - 0: IDENT@39..40 "z" [] [] - 3: (empty) - 2: R_CURLY@40..41 "}" [] [] - 1: EQ@41..43 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@43..45 - 0: L_CURLY@43..44 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@44..44 - 2: R_CURLY@44..45 "}" [] [] - 2: R_PAREN@45..46 ")" [] [] - 1: SEMICOLON@46..47 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@47..65 - 0: JS_PARENTHESIZED_EXPRESSION@47..64 - 0: L_PAREN@47..49 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@49..63 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@49..59 - 0: L_CURLY@49..50 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@50..58 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@50..58 - 0: JS_LITERAL_MEMBER_NAME@50..51 - 0: IDENT@50..51 "x" [] [] - 1: COLON@51..53 ":" [] [Whitespace(" ")] - 2: JS_PARENTHESIZED_ASSIGNMENT@53..58 - 0: L_PAREN@53..54 "(" [] [] - 1: JS_PARENTHESIZED_ASSIGNMENT@54..57 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@55..56 - 0: IDENT@55..56 "z" [] [] - 2: R_PAREN@56..57 ")" [] [] - 2: R_PAREN@57..58 ")" [] [] - 3: (empty) - 2: R_CURLY@58..59 "}" [] [] - 1: EQ@59..61 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@61..63 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@62..62 - 2: R_CURLY@62..63 "}" [] [] - 2: R_PAREN@63..64 ")" [] [] - 1: SEMICOLON@64..65 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@65..91 - 0: JS_PARENTHESIZED_EXPRESSION@65..90 - 0: L_PAREN@65..67 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@67..89 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@67..85 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@68..84 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@68..84 - 0: JS_LITERAL_MEMBER_NAME@68..69 - 0: IDENT@68..69 "x" [] [] - 1: COLON@69..71 ":" [] [Whitespace(" ")] - 2: JS_COMPUTED_MEMBER_ASSIGNMENT@71..84 - 0: JS_IDENTIFIER_EXPRESSION@71..72 - 0: JS_REFERENCE_IDENTIFIER@71..72 - 0: IDENT@71..72 "z" [] [] - 1: L_BRACK@72..73 "[" [] [] - 2: JS_STRING_LITERAL_EXPRESSION@73..83 - 0: JS_STRING_LITERAL@73..83 "\"computed\"" [] [] - 3: R_BRACK@83..84 "]" [] [] - 3: (empty) - 2: R_CURLY@84..85 "}" [] [] - 1: EQ@85..87 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@87..89 - 0: L_CURLY@87..88 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@88..88 - 2: R_CURLY@88..89 "}" [] [] - 2: R_PAREN@89..90 ")" [] [] - 1: SEMICOLON@90..91 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@91..114 - 0: JS_PARENTHESIZED_EXPRESSION@91..113 - 0: L_PAREN@91..93 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@93..112 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@93..108 - 0: L_CURLY@93..94 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@94..107 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@94..107 - 0: JS_IDENTIFIER_ASSIGNMENT@94..96 - 0: IDENT@94..96 "x" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@96..107 - 0: EQ@96..98 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@98..107 - 0: JS_STRING_LITERAL@98..107 "\"default\"" [] [] - 2: R_CURLY@107..108 "}" [] [] - 1: EQ@108..110 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@110..112 - 0: L_CURLY@110..111 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@111..111 - 2: R_CURLY@111..112 "}" [] [] - 2: R_PAREN@112..113 ")" [] [] - 1: SEMICOLON@113..114 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@114..140 - 0: JS_PARENTHESIZED_EXPRESSION@114..139 - 0: L_PAREN@114..116 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@116..138 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@116..134 - 0: L_CURLY@116..117 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@117..133 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@117..133 - 0: JS_LITERAL_MEMBER_NAME@117..118 - 0: IDENT@117..118 "x" [] [] - 1: COLON@118..120 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_ASSIGNMENT@120..122 - 0: IDENT@120..122 "y" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@122..133 - 0: EQ@122..124 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@124..133 - 0: JS_STRING_LITERAL@124..133 "\"default\"" [] [] - 2: R_CURLY@133..134 "}" [] [] - 1: EQ@134..136 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@136..138 - 0: L_CURLY@136..137 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@137..137 - 2: R_CURLY@137..138 "}" [] [] - 2: R_PAREN@138..139 ")" [] [] - 1: SEMICOLON@139..140 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@140..170 - 0: JS_PARENTHESIZED_EXPRESSION@140..169 - 0: L_PAREN@140..142 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@142..168 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@142..164 - 0: L_CURLY@142..143 "{" [] [] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@143..162 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@143..147 - 0: JS_LITERAL_MEMBER_NAME@143..144 - 0: JS_NUMBER_LITERAL@143..144 "0" [] [] - 1: COLON@144..146 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_ASSIGNMENT@146..147 - 0: IDENT@146..147 "y" [] [] - 3: (empty) - 1: COMMA@147..149 "," [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@149..162 - 0: JS_COMPUTED_MEMBER_NAME@149..159 - 0: L_BRACK@149..150 "[" [] [] - 1: JS_IDENTIFIER_EXPRESSION@150..158 - 0: JS_REFERENCE_IDENTIFIER@150..158 - 0: IDENT@150..158 "computed" [] [] - 2: R_BRACK@158..159 "]" [] [] - 1: COLON@159..161 ":" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_ASSIGNMENT@161..162 - 0: IDENT@161..162 "z" [] [] - 3: (empty) - 2: R_CURLY@162..164 "}" [] [Whitespace(" ")] - 1: EQ@164..166 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@166..168 - 0: L_CURLY@166..167 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@167..167 - 2: R_CURLY@167..168 "}" [] [] - 2: R_PAREN@168..169 ")" [] [] - 1: SEMICOLON@169..170 ";" [] [] - 4: EOF@170..171 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/property_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/property_class_member.rast deleted file mode 100644 index ea9fbc519afd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/property_class_member.rast +++ /dev/null @@ -1,315 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@11..22 "property" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@22..32 "declare" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@33..56 "initializedProperty" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@56..58 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@58..61 "\"a\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@61..67 "\"a\"" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@67..68 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@68..72 "5" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsComputedMemberName { - l_brack_token: L_BRACK@72..76 "[" [Newline("\n"), Whitespace(" ")] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@76..80 "\"a\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@80..82 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@82..85 "\"b\"" [] [], - }, - }, - r_brack_token: R_BRACK@85..86 "]" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@86..96 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@96..110 "staticProperty" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@110..120 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@120..146 "staticInitializedProperty" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@146..148 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@148..149 "1" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@149..153 "#" [Newline("\n"), Whitespace(" ")] [], - id_token: IDENT@153..160 "private" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@160..164 "#" [Newline("\n"), Whitespace(" ")] [], - id_token: IDENT@164..183 "privateInitialized" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@183..185 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@185..188 "\"a\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@188..198 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsPrivateClassMemberName { - hash_token: HASH@198..199 "#" [] [], - id_token: IDENT@199..212 "staticPrivate" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@212..222 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsPrivateClassMemberName { - hash_token: HASH@222..223 "#" [] [], - id_token: IDENT@223..256 "staticPrivateInitializedProperty" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@256..258 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@258..259 "1" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@259..261 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@261..262 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..262 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..261 - 0: JS_CLASS_DECLARATION@0..261 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..259 - 0: JS_PROPERTY_CLASS_MEMBER@11..22 - 0: JS_PROPERTY_MODIFIER_LIST@11..11 - 1: JS_LITERAL_MEMBER_NAME@11..22 - 0: IDENT@11..22 "property" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@22..33 - 0: JS_PROPERTY_MODIFIER_LIST@22..22 - 1: JS_LITERAL_MEMBER_NAME@22..32 - 0: IDENT@22..32 "declare" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@32..33 ";" [] [] - 2: JS_PROPERTY_CLASS_MEMBER@33..61 - 0: JS_PROPERTY_MODIFIER_LIST@33..33 - 1: JS_LITERAL_MEMBER_NAME@33..56 - 0: IDENT@33..56 "initializedProperty" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@56..61 - 0: EQ@56..58 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@58..61 - 0: JS_STRING_LITERAL@58..61 "\"a\"" [] [] - 4: (empty) - 3: JS_PROPERTY_CLASS_MEMBER@61..68 - 0: JS_PROPERTY_MODIFIER_LIST@61..61 - 1: JS_LITERAL_MEMBER_NAME@61..67 - 0: JS_STRING_LITERAL@61..67 "\"a\"" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@67..68 ";" [] [] - 4: JS_PROPERTY_CLASS_MEMBER@68..72 - 0: JS_PROPERTY_MODIFIER_LIST@68..68 - 1: JS_LITERAL_MEMBER_NAME@68..72 - 0: JS_NUMBER_LITERAL@68..72 "5" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PROPERTY_CLASS_MEMBER@72..86 - 0: JS_PROPERTY_MODIFIER_LIST@72..72 - 1: JS_COMPUTED_MEMBER_NAME@72..86 - 0: L_BRACK@72..76 "[" [Newline("\n"), Whitespace(" ")] [] - 1: JS_BINARY_EXPRESSION@76..85 - 0: JS_STRING_LITERAL_EXPRESSION@76..80 - 0: JS_STRING_LITERAL@76..80 "\"a\"" [] [Whitespace(" ")] - 1: PLUS@80..82 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@82..85 - 0: JS_STRING_LITERAL@82..85 "\"b\"" [] [] - 2: R_BRACK@85..86 "]" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 6: JS_PROPERTY_CLASS_MEMBER@86..110 - 0: JS_PROPERTY_MODIFIER_LIST@86..96 - 0: JS_STATIC_MODIFIER@86..96 - 0: STATIC_KW@86..96 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@96..110 - 0: IDENT@96..110 "staticProperty" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 7: JS_PROPERTY_CLASS_MEMBER@110..149 - 0: JS_PROPERTY_MODIFIER_LIST@110..120 - 0: JS_STATIC_MODIFIER@110..120 - 0: STATIC_KW@110..120 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@120..146 - 0: IDENT@120..146 "staticInitializedProperty" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@146..149 - 0: EQ@146..148 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@148..149 - 0: JS_NUMBER_LITERAL@148..149 "1" [] [] - 4: (empty) - 8: JS_PROPERTY_CLASS_MEMBER@149..160 - 0: JS_PROPERTY_MODIFIER_LIST@149..149 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@149..160 - 0: HASH@149..153 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@153..160 "private" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 9: JS_PROPERTY_CLASS_MEMBER@160..188 - 0: JS_PROPERTY_MODIFIER_LIST@160..160 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@160..183 - 0: HASH@160..164 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@164..183 "privateInitialized" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@183..188 - 0: EQ@183..185 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@185..188 - 0: JS_STRING_LITERAL@185..188 "\"a\"" [] [] - 4: (empty) - 10: JS_PROPERTY_CLASS_MEMBER@188..212 - 0: JS_PROPERTY_MODIFIER_LIST@188..198 - 0: JS_STATIC_MODIFIER@188..198 - 0: STATIC_KW@188..198 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@198..212 - 0: HASH@198..199 "#" [] [] - 1: IDENT@199..212 "staticPrivate" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 11: JS_PROPERTY_CLASS_MEMBER@212..259 - 0: JS_PROPERTY_MODIFIER_LIST@212..222 - 0: JS_STATIC_MODIFIER@212..222 - 0: STATIC_KW@212..222 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_PRIVATE_CLASS_MEMBER_NAME@222..256 - 0: HASH@222..223 "#" [] [] - 1: IDENT@223..256 "staticPrivateInitializedProperty" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@256..259 - 0: EQ@256..258 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@258..259 - 0: JS_NUMBER_LITERAL@258..259 "1" [] [] - 4: (empty) - 9: R_CURLY@259..261 "}" [Newline("\n")] [] - 4: EOF@261..262 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.rast deleted file mode 100644 index d7f44a734874..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.rast +++ /dev/null @@ -1,131 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..23 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@26..28 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@28..30 "a" [] [Whitespace(" ")], - }, - operator_token: EQ@30..32 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..37 "await" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@37..39 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@50..55 "test2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@55..56 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@58..60 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@60..67 "return" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@67..72 "await" [] [], - }, - }, - semicolon_token: SEMICOLON@72..74 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@74..75 "}" [] [], - }, - }, - ], - eof_token: EOF@75..76 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..76 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..75 - 0: JS_FUNCTION_DECLARATION@0..40 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..23 - 0: IDENT@19..23 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@23..26 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..24 - 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@26..40 - 0: L_CURLY@26..28 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..39 - 0: JS_EXPRESSION_STATEMENT@28..39 - 0: JS_ASSIGNMENT_EXPRESSION@28..37 - 0: JS_IDENTIFIER_ASSIGNMENT@28..30 - 0: IDENT@28..30 "a" [] [Whitespace(" ")] - 1: EQ@30..32 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@32..37 - 0: JS_REFERENCE_IDENTIFIER@32..37 - 0: IDENT@32..37 "await" [] [] - 1: SEMICOLON@37..39 ";" [] [Whitespace(" ")] - 3: R_CURLY@39..40 "}" [] [] - 1: JS_FUNCTION_DECLARATION@40..75 - 0: (empty) - 1: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@50..55 - 0: IDENT@50..55 "test2" [] [] - 4: (empty) - 5: JS_PARAMETERS@55..58 - 0: L_PAREN@55..56 "(" [] [] - 1: JS_PARAMETER_LIST@56..56 - 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@58..75 - 0: L_CURLY@58..60 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@60..60 - 2: JS_STATEMENT_LIST@60..74 - 0: JS_RETURN_STATEMENT@60..74 - 0: RETURN_KW@60..67 "return" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@67..72 - 0: JS_REFERENCE_IDENTIFIER@67..72 - 0: IDENT@67..72 "await" [] [] - 2: SEMICOLON@72..74 ";" [] [Whitespace(" ")] - 3: R_CURLY@74..75 "}" [] [] - 4: EOF@75..76 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.rast deleted file mode 100644 index 2e920c2abdae..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.rast +++ /dev/null @@ -1,184 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..22 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..33 "yield" [] [Whitespace(" ")], - }, - }, - operator_token: STAR@33..34 "*" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@34..37 "bar" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@37..39 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@50..53 "bar" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@53..54 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@56..58 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@58..63 "yield" [] [], - }, - }, - semicolon_token: SEMICOLON@63..65 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@65..66 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@66..76 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@76..79 "baz" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@79..80 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@82..84 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..90 "yield" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@90..91 "}" [] [], - }, - }, - ], - eof_token: EOF@91..92 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..92 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..91 - 0: JS_FUNCTION_DECLARATION@0..40 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..22 - 0: IDENT@19..22 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@22..25 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_PARAMETER_LIST@23..23 - 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@25..40 - 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..39 - 0: JS_EXPRESSION_STATEMENT@27..39 - 0: JS_BINARY_EXPRESSION@27..37 - 0: JS_IDENTIFIER_EXPRESSION@27..33 - 0: JS_REFERENCE_IDENTIFIER@27..33 - 0: IDENT@27..33 "yield" [] [Whitespace(" ")] - 1: STAR@33..34 "*" [] [] - 2: JS_IDENTIFIER_EXPRESSION@34..37 - 0: JS_REFERENCE_IDENTIFIER@34..37 - 0: IDENT@34..37 "bar" [] [] - 1: SEMICOLON@37..39 ";" [] [Whitespace(" ")] - 3: R_CURLY@39..40 "}" [] [] - 1: JS_FUNCTION_DECLARATION@40..66 - 0: (empty) - 1: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@50..53 - 0: IDENT@50..53 "bar" [] [] - 4: (empty) - 5: JS_PARAMETERS@53..56 - 0: L_PAREN@53..54 "(" [] [] - 1: JS_PARAMETER_LIST@54..54 - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@56..66 - 0: L_CURLY@56..58 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@58..58 - 2: JS_STATEMENT_LIST@58..65 - 0: JS_EXPRESSION_STATEMENT@58..65 - 0: JS_IDENTIFIER_EXPRESSION@58..63 - 0: JS_REFERENCE_IDENTIFIER@58..63 - 0: IDENT@58..63 "yield" [] [] - 1: SEMICOLON@63..65 ";" [] [Whitespace(" ")] - 3: R_CURLY@65..66 "}" [] [] - 2: JS_FUNCTION_DECLARATION@66..91 - 0: (empty) - 1: FUNCTION_KW@66..76 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@76..79 - 0: IDENT@76..79 "baz" [] [] - 4: (empty) - 5: JS_PARAMETERS@79..82 - 0: L_PAREN@79..80 "(" [] [] - 1: JS_PARAMETER_LIST@80..80 - 2: R_PAREN@80..82 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@82..91 - 0: L_CURLY@82..84 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@84..84 - 2: JS_STATEMENT_LIST@84..90 - 0: JS_EXPRESSION_STATEMENT@84..90 - 0: JS_IDENTIFIER_EXPRESSION@84..90 - 0: JS_REFERENCE_IDENTIFIER@84..90 - 0: IDENT@84..90 "yield" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@90..91 "}" [] [] - 4: EOF@91..92 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.rast b/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.rast deleted file mode 100644 index 66611aa95327..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.rast +++ /dev/null @@ -1,400 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@3..6 "..." [] [], - target: JsIdentifierAssignment { - name_token: IDENT@6..11 "abcd" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@13..15 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..16 "a" [] [], - }, - }, - }, - r_paren_token: R_PAREN@16..17 ")" [] [], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@22..25 "..." [] [], - target: JsParenthesizedAssignment { - l_paren_token: L_PAREN@25..26 "(" [] [], - assignment: JsIdentifierAssignment { - name_token: IDENT@26..30 "abcd" [] [], - }, - r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@32..34 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@34..36 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@36..37 "a" [] [], - }, - }, - }, - r_paren_token: R_PAREN@37..38 ")" [] [], - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@39..41 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@43..46 "..." [] [], - target: JsStaticMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..47 "m" [] [], - }, - }, - dot_token: DOT@47..48 "." [] [], - member: JsName { - value_token: IDENT@48..53 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@53..55 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@55..57 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@57..58 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@58..59 ")" [] [], - }, - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@60..62 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@62..64 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@64..67 "..." [] [], - target: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@67..68 "m" [] [], - }, - }, - l_brack_token: L_BRACK@68..69 "[" [] [], - member: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@69..73 "call" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@73..74 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@74..75 ")" [] [], - }, - }, - r_brack_token: R_BRACK@75..77 "]" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@77..79 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@79..81 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@81..82 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@84..86 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@86..88 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@88..91 "..." [] [], - target: JsStaticMemberAssignment { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@91..94 "any" [] [], - }, - }, - operator_token: DOT@94..95 "." [] [], - member: JsName { - value_token: IDENT@95..105 "expression" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@105..106 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@106..107 ")" [] [], - }, - }, - dot_token: DOT@107..108 "." [] [], - member: JsName { - value_token: IDENT@108..110 "b" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@110..112 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@112..114 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@114..115 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@115..116 ")" [] [], - }, - semicolon_token: SEMICOLON@116..117 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@117..119 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@119..121 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@121..122 "b" [] [], - }, - colon_token: COLON@122..124 ":" [] [Whitespace(" ")], - pattern: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@124..126 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternRest { - dotdotdot_token: DOT3@126..129 "..." [] [], - target: JsIdentifierAssignment { - name_token: IDENT@129..131 "a" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@131..133 "}" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@133..135 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@135..137 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..138 "c" [] [], - }, - }, - }, - r_paren_token: R_PAREN@138..139 ")" [] [], - }, - semicolon_token: SEMICOLON@139..140 ";" [] [], - }, - ], - eof_token: EOF@140..141 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..141 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..140 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JS_PARENTHESIZED_EXPRESSION@0..17 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@1..16 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..13 - 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@3..11 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@3..11 - 0: DOT3@3..6 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@6..11 - 0: IDENT@6..11 "abcd" [] [Whitespace(" ")] - 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] - 1: EQ@13..15 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@15..16 - 0: JS_REFERENCE_IDENTIFIER@15..16 - 0: IDENT@15..16 "a" [] [] - 2: R_PAREN@16..17 ")" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@18..39 - 0: JS_PARENTHESIZED_EXPRESSION@18..38 - 0: L_PAREN@18..20 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@20..37 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@20..34 - 0: L_CURLY@20..22 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@22..32 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@22..32 - 0: DOT3@22..25 "..." [] [] - 1: JS_PARENTHESIZED_ASSIGNMENT@25..32 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@26..30 - 0: IDENT@26..30 "abcd" [] [] - 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] - 2: R_CURLY@32..34 "}" [] [Whitespace(" ")] - 1: EQ@34..36 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@36..37 - 0: JS_REFERENCE_IDENTIFIER@36..37 - 0: IDENT@36..37 "a" [] [] - 2: R_PAREN@37..38 ")" [] [] - 1: SEMICOLON@38..39 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@39..60 - 0: JS_PARENTHESIZED_EXPRESSION@39..59 - 0: L_PAREN@39..41 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@41..58 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@41..55 - 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@43..53 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@43..53 - 0: DOT3@43..46 "..." [] [] - 1: JS_STATIC_MEMBER_ASSIGNMENT@46..53 - 0: JS_IDENTIFIER_EXPRESSION@46..47 - 0: JS_REFERENCE_IDENTIFIER@46..47 - 0: IDENT@46..47 "m" [] [] - 1: DOT@47..48 "." [] [] - 2: JS_NAME@48..53 - 0: IDENT@48..53 "test" [] [Whitespace(" ")] - 2: R_CURLY@53..55 "}" [] [Whitespace(" ")] - 1: EQ@55..57 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@57..58 - 0: JS_REFERENCE_IDENTIFIER@57..58 - 0: IDENT@57..58 "c" [] [] - 2: R_PAREN@58..59 ")" [] [] - 1: SEMICOLON@59..60 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@60..84 - 0: JS_PARENTHESIZED_EXPRESSION@60..83 - 0: L_PAREN@60..62 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@62..82 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@62..79 - 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@64..77 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@64..77 - 0: DOT3@64..67 "..." [] [] - 1: JS_COMPUTED_MEMBER_ASSIGNMENT@67..77 - 0: JS_IDENTIFIER_EXPRESSION@67..68 - 0: JS_REFERENCE_IDENTIFIER@67..68 - 0: IDENT@67..68 "m" [] [] - 1: L_BRACK@68..69 "[" [] [] - 2: JS_CALL_EXPRESSION@69..75 - 0: JS_IDENTIFIER_EXPRESSION@69..73 - 0: JS_REFERENCE_IDENTIFIER@69..73 - 0: IDENT@69..73 "call" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@73..75 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@74..74 - 2: R_PAREN@74..75 ")" [] [] - 3: R_BRACK@75..77 "]" [] [Whitespace(" ")] - 2: R_CURLY@77..79 "}" [] [Whitespace(" ")] - 1: EQ@79..81 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@81..82 - 0: JS_REFERENCE_IDENTIFIER@81..82 - 0: IDENT@81..82 "c" [] [] - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@84..117 - 0: JS_PARENTHESIZED_EXPRESSION@84..116 - 0: L_PAREN@84..86 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@86..115 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@86..112 - 0: L_CURLY@86..88 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@88..110 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@88..110 - 0: DOT3@88..91 "..." [] [] - 1: JS_STATIC_MEMBER_ASSIGNMENT@91..110 - 0: JS_CALL_EXPRESSION@91..107 - 0: JS_STATIC_MEMBER_EXPRESSION@91..105 - 0: JS_IDENTIFIER_EXPRESSION@91..94 - 0: JS_REFERENCE_IDENTIFIER@91..94 - 0: IDENT@91..94 "any" [] [] - 1: DOT@94..95 "." [] [] - 2: JS_NAME@95..105 - 0: IDENT@95..105 "expression" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@105..107 - 0: L_PAREN@105..106 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@106..106 - 2: R_PAREN@106..107 ")" [] [] - 1: DOT@107..108 "." [] [] - 2: JS_NAME@108..110 - 0: IDENT@108..110 "b" [] [Whitespace(" ")] - 2: R_CURLY@110..112 "}" [] [Whitespace(" ")] - 1: EQ@112..114 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@114..115 - 0: JS_REFERENCE_IDENTIFIER@114..115 - 0: IDENT@114..115 "c" [] [] - 2: R_PAREN@115..116 ")" [] [] - 1: SEMICOLON@116..117 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@117..140 - 0: JS_PARENTHESIZED_EXPRESSION@117..139 - 0: L_PAREN@117..119 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@119..138 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@119..135 - 0: L_CURLY@119..121 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@121..133 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@121..133 - 0: JS_LITERAL_MEMBER_NAME@121..122 - 0: IDENT@121..122 "b" [] [] - 1: COLON@122..124 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_ASSIGNMENT_PATTERN@124..133 - 0: L_CURLY@124..126 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@126..131 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@126..131 - 0: DOT3@126..129 "..." [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@129..131 - 0: IDENT@129..131 "a" [] [Whitespace(" ")] - 2: R_CURLY@131..133 "}" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@133..135 "}" [] [Whitespace(" ")] - 1: EQ@135..137 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@137..138 - 0: JS_REFERENCE_IDENTIFIER@137..138 - 0: IDENT@137..138 "c" [] [] - 2: R_PAREN@138..139 ")" [] [] - 1: SEMICOLON@139..140 ";" [] [] - 4: EOF@140..141 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.rast b/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.rast deleted file mode 100644 index e3c9fb21a312..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.rast +++ /dev/null @@ -1,143 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternRest { - dotdotdot_token: DOT3@6..9 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@9..14 "abcd" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@16..18 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..19 "a" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@27..28 "b" [] [], - }, - colon_token: COLON@28..30 ":" [] [Whitespace(" ")], - pattern: JsObjectBindingPattern { - l_curly_token: L_CURLY@30..32 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternRest { - dotdotdot_token: DOT3@32..35 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@35..37 "a" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@37..39 "}" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@39..41 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@41..43 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..44 "c" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - ], - eof_token: EOF@45..46 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..46 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..45 - 0: JS_VARIABLE_STATEMENT@0..20 - 0: JS_VARIABLE_DECLARATION@0..19 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..19 - 0: JS_VARIABLE_DECLARATOR@4..19 - 0: JS_OBJECT_BINDING_PATTERN@4..16 - 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..14 - 0: JS_OBJECT_BINDING_PATTERN_REST@6..14 - 0: DOT3@6..9 "..." [] [] - 1: JS_IDENTIFIER_BINDING@9..14 - 0: IDENT@9..14 "abcd" [] [Whitespace(" ")] - 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@16..19 - 0: EQ@16..18 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@18..19 - 0: JS_REFERENCE_IDENTIFIER@18..19 - 0: IDENT@18..19 "a" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 1: JS_VARIABLE_STATEMENT@20..45 - 0: JS_VARIABLE_DECLARATION@20..44 - 0: (empty) - 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@25..44 - 0: JS_VARIABLE_DECLARATOR@25..44 - 0: JS_OBJECT_BINDING_PATTERN@25..41 - 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@27..39 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@27..39 - 0: JS_LITERAL_MEMBER_NAME@27..28 - 0: IDENT@27..28 "b" [] [] - 1: COLON@28..30 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN@30..39 - 0: L_CURLY@30..32 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@32..37 - 0: JS_OBJECT_BINDING_PATTERN_REST@32..37 - 0: DOT3@32..35 "..." [] [] - 1: JS_IDENTIFIER_BINDING@35..37 - 0: IDENT@35..37 "a" [] [Whitespace(" ")] - 2: R_CURLY@37..39 "}" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@39..41 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@41..44 - 0: EQ@41..43 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@43..44 - 0: JS_REFERENCE_IDENTIFIER@43..44 - 0: IDENT@43..44 "c" [] [] - 1: SEMICOLON@44..45 ";" [] [] - 4: EOF@45..46 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/return_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/return_stmt.rast deleted file mode 100644 index 0d2d5f242694..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/return_stmt.rast +++ /dev/null @@ -1,85 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@0..1 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1..3 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@3..6 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@6..7 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@7..16 "return" [Newline("\n"), Whitespace(" ")] [], - argument: missing (optional), - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsReturnStatement { - return_token: RETURN_KW@17..27 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..30 "foo" [] [], - }, - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - JsReturnStatement { - return_token: RETURN_KW@31..40 "return" [Newline("\n"), Whitespace(" ")] [], - argument: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@40..42 "}" [Newline("\n")] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@42..43 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_EXPRESSION_STATEMENT@0..42 - 0: JS_ARROW_FUNCTION_EXPRESSION@0..42 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@0..3 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_PARAMETER_LIST@1..1 - 2: R_PAREN@1..3 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@3..6 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@6..42 - 0: L_CURLY@6..7 "{" [] [] - 1: JS_DIRECTIVE_LIST@7..7 - 2: JS_STATEMENT_LIST@7..40 - 0: JS_RETURN_STATEMENT@7..17 - 0: RETURN_KW@7..16 "return" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: SEMICOLON@16..17 ";" [] [] - 1: JS_RETURN_STATEMENT@17..31 - 0: RETURN_KW@17..27 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@27..30 - 0: JS_REFERENCE_IDENTIFIER@27..30 - 0: IDENT@27..30 "foo" [] [] - 2: SEMICOLON@30..31 ";" [] [] - 2: JS_RETURN_STATEMENT@31..40 - 0: RETURN_KW@31..40 "return" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: R_CURLY@40..42 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@42..43 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.rast b/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.rast deleted file mode 100644 index 803e49640b12..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.rast +++ /dev/null @@ -1,127 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@9..16 "test" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@16..17 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@19..20 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@20..29 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@29..31 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@31..33 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@33..40 "\"inner\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@40..41 ";" [] [], - }, - ], - r_curly_token: R_CURLY@41..45 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@45..47 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - ], - eof_token: EOF@48..49 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..49 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..48 - 0: JS_VARIABLE_STATEMENT@0..48 - 0: JS_VARIABLE_DECLARATION@0..47 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..47 - 0: JS_VARIABLE_DECLARATOR@4..47 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..47 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..47 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..45 - 0: JS_METHOD_OBJECT_MEMBER@9..45 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@9..16 - 0: IDENT@9..16 "test" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@16..19 - 0: L_PAREN@16..17 "(" [] [] - 1: JS_PARAMETER_LIST@17..17 - 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@19..45 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_DIRECTIVE_LIST@20..20 - 2: JS_STATEMENT_LIST@20..41 - 0: JS_VARIABLE_STATEMENT@20..41 - 0: JS_VARIABLE_DECLARATION@20..40 - 0: (empty) - 1: LET_KW@20..29 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@29..40 - 0: JS_VARIABLE_DECLARATOR@29..40 - 0: JS_IDENTIFIER_BINDING@29..31 - 0: IDENT@29..31 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@31..40 - 0: EQ@31..33 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@33..40 - 0: JS_STRING_LITERAL@33..40 "\"inner\"" [] [] - 1: SEMICOLON@40..41 ";" [] [] - 3: R_CURLY@41..45 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@45..47 "}" [Newline("\n")] [] - 1: SEMICOLON@47..48 ";" [] [] - 4: EOF@48..49 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/semicolons.rast b/crates/biome_js_parser/test_data/inline/ok/semicolons.rast deleted file mode 100644 index 5a28b61399f9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/semicolons.rast +++ /dev/null @@ -1,223 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "foo" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..13 "bar" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@14..19 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@19..24 "foo2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..27 "b" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@33..37 "foo3" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@38..43 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@43..47 "foo4" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@47..52 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@52..56 "foo5" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@56..66 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@66..70 "foo6" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@70..71 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@71..73 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@75..82 "return" [] [Whitespace(" ")], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@82..87 "true" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@87..88 "}" [] [], - }, - }, - ], - eof_token: EOF@88..89 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..89 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..88 - 0: JS_VARIABLE_STATEMENT@0..14 - 0: JS_VARIABLE_DECLARATION@0..13 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..13 - 0: JS_VARIABLE_DECLARATOR@4..13 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "foo" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..13 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@10..13 - 0: JS_REFERENCE_IDENTIFIER@10..13 - 0: IDENT@10..13 "bar" [] [] - 1: SEMICOLON@13..14 ";" [] [] - 1: JS_VARIABLE_STATEMENT@14..28 - 0: JS_VARIABLE_DECLARATION@14..27 - 0: (empty) - 1: LET_KW@14..19 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@19..27 - 0: JS_VARIABLE_DECLARATOR@19..27 - 0: JS_IDENTIFIER_BINDING@19..24 - 0: IDENT@19..24 "foo2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@24..27 - 0: EQ@24..26 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@26..27 - 0: JS_REFERENCE_IDENTIFIER@26..27 - 0: IDENT@26..27 "b" [] [] - 1: SEMICOLON@27..28 ";" [] [] - 2: JS_VARIABLE_STATEMENT@28..38 - 0: JS_VARIABLE_DECLARATION@28..37 - 0: (empty) - 1: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@33..37 - 0: JS_VARIABLE_DECLARATOR@33..37 - 0: JS_IDENTIFIER_BINDING@33..37 - 0: IDENT@33..37 "foo3" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@37..38 ";" [] [] - 3: JS_VARIABLE_STATEMENT@38..47 - 0: JS_VARIABLE_DECLARATION@38..47 - 0: (empty) - 1: LET_KW@38..43 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@43..47 - 0: JS_VARIABLE_DECLARATOR@43..47 - 0: JS_IDENTIFIER_BINDING@43..47 - 0: IDENT@43..47 "foo4" [] [] - 1: (empty) - 2: (empty) - 1: (empty) - 4: JS_VARIABLE_STATEMENT@47..56 - 0: JS_VARIABLE_DECLARATION@47..56 - 0: (empty) - 1: LET_KW@47..52 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@52..56 - 0: JS_VARIABLE_DECLARATOR@52..56 - 0: JS_IDENTIFIER_BINDING@52..56 - 0: IDENT@52..56 "foo5" [] [] - 1: (empty) - 2: (empty) - 1: (empty) - 5: JS_FUNCTION_DECLARATION@56..88 - 0: (empty) - 1: FUNCTION_KW@56..66 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@66..70 - 0: IDENT@66..70 "foo6" [] [] - 4: (empty) - 5: JS_PARAMETERS@70..73 - 0: L_PAREN@70..71 "(" [] [] - 1: JS_PARAMETER_LIST@71..71 - 2: R_PAREN@71..73 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@73..88 - 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@75..75 - 2: JS_STATEMENT_LIST@75..87 - 0: JS_RETURN_STATEMENT@75..87 - 0: RETURN_KW@75..82 "return" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@82..87 - 0: TRUE_KW@82..87 "true" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@87..88 "}" [] [] - 4: EOF@88..89 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/sequence_expr.rast b/crates/biome_js_parser/test_data/inline/ok/sequence_expr.rast deleted file mode 100644 index 4dbf1d0ff30b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/sequence_expr.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsSequenceExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..1 "1" [] [], - }, - comma_token: COMMA@1..3 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@3..4 "2" [] [], - }, - }, - comma_token: COMMA@4..6 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@6..7 "3" [] [], - }, - }, - comma_token: COMMA@7..9 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@9..10 "4" [] [], - }, - }, - comma_token: COMMA@10..12 "," [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@12..13 "5" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_SEQUENCE_EXPRESSION@0..13 - 0: JS_SEQUENCE_EXPRESSION@0..10 - 0: JS_SEQUENCE_EXPRESSION@0..7 - 0: JS_SEQUENCE_EXPRESSION@0..4 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..1 - 0: JS_NUMBER_LITERAL@0..1 "1" [] [] - 1: COMMA@1..3 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@3..4 - 0: JS_NUMBER_LITERAL@3..4 "2" [] [] - 1: COMMA@4..6 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@6..7 - 0: JS_NUMBER_LITERAL@6..7 "3" [] [] - 1: COMMA@7..9 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@9..10 - 0: JS_NUMBER_LITERAL@9..10 "4" [] [] - 1: COMMA@10..12 "," [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@12..13 - 0: JS_NUMBER_LITERAL@12..13 "5" [] [] - 1: (empty) - 4: EOF@13..14 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/setter_class_member.rast deleted file mode 100644 index 7234ca273225..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/setter_class_member.rast +++ /dev/null @@ -1,727 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..14 "Setters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@14..15 "{" [] [], - members: JsClassMemberList [ - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@22..25 "foo" [] [], - }, - l_paren_token: L_PAREN@25..26 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@26..27 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@29..30 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@31..38 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@38..41 "bax" [] [], - }, - l_paren_token: L_PAREN@41..42 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@42..43 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: COMMA@43..44 "," [] [], - r_paren_token: R_PAREN@44..46 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@46..47 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@47..48 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@48..55 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@55..61 "static" [] [], - }, - l_paren_token: L_PAREN@61..62 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@62..63 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@65..66 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@66..67 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@67..77 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - set_token: SET_KW@77..81 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@81..84 "bar" [] [], - }, - l_paren_token: L_PAREN@84..85 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@85..86 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@88..89 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@89..90 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@90..100 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - set_token: SET_KW@100..104 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@104..107 "baz" [] [], - }, - l_paren_token: L_PAREN@107..108 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@108..109 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: COMMA@109..110 "," [] [], - r_paren_token: R_PAREN@110..112 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@112..113 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@113..114 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@114..121 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@121..126 "\"baz\"" [] [], - }, - l_paren_token: L_PAREN@126..127 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@127..128 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@128..130 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@130..131 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@131..132 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@132..139 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@139..140 "[" [] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@140..144 "\"a\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@144..146 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@146..149 "\"b\"" [] [], - }, - }, - r_brack_token: R_BRACK@149..150 "]" [] [], - }, - l_paren_token: L_PAREN@150..151 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@151..152 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@152..154 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@154..155 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@155..156 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@156..163 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@163..164 "5" [] [], - }, - l_paren_token: L_PAREN@164..165 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@165..166 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@166..168 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@168..169 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@169..170 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@170..177 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@177..178 "6" [] [], - }, - l_paren_token: L_PAREN@178..179 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@179..180 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: COMMA@180..181 "," [] [], - r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@183..184 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@184..185 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@185..192 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsPrivateClassMemberName { - hash_token: HASH@192..193 "#" [] [], - id_token: IDENT@193..200 "private" [] [], - }, - l_paren_token: L_PAREN@200..201 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@201..202 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@202..204 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@204..205 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@205..206 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@206..208 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@208..215 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@215..226 "NotSetters" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@226..227 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@227..233 "set" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@233..234 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@234..235 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@235..237 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@237..238 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@238..239 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@239..248 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@248..251 "set" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@251..252 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@252..253 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@253..255 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@255..256 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@256..257 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@257..267 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@267..270 "set" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@270..271 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@271..272 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@272..274 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@274..275 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@275..276 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@276..278 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@278..279 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..279 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..278 - 0: JS_CLASS_DECLARATION@0..208 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..14 - 0: IDENT@6..14 "Setters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@14..15 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@15..206 - 0: JS_SETTER_CLASS_MEMBER@15..31 - 0: JS_METHOD_MODIFIER_LIST@15..15 - 1: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@22..25 - 0: IDENT@22..25 "foo" [] [] - 3: L_PAREN@25..26 "(" [] [] - 4: JS_FORMAL_PARAMETER@26..27 - 0: JS_DECORATOR_LIST@26..26 - 1: JS_IDENTIFIER_BINDING@26..27 - 0: IDENT@26..27 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@27..29 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@29..31 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_DIRECTIVE_LIST@30..30 - 2: JS_STATEMENT_LIST@30..30 - 3: R_CURLY@30..31 "}" [] [] - 1: JS_SETTER_CLASS_MEMBER@31..48 - 0: JS_METHOD_MODIFIER_LIST@31..31 - 1: SET_KW@31..38 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@38..41 - 0: IDENT@38..41 "bax" [] [] - 3: L_PAREN@41..42 "(" [] [] - 4: JS_FORMAL_PARAMETER@42..43 - 0: JS_DECORATOR_LIST@42..42 - 1: JS_IDENTIFIER_BINDING@42..43 - 0: IDENT@42..43 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: COMMA@43..44 "," [] [] - 6: R_PAREN@44..46 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@46..48 - 0: L_CURLY@46..47 "{" [] [] - 1: JS_DIRECTIVE_LIST@47..47 - 2: JS_STATEMENT_LIST@47..47 - 3: R_CURLY@47..48 "}" [] [] - 2: JS_SETTER_CLASS_MEMBER@48..67 - 0: JS_METHOD_MODIFIER_LIST@48..48 - 1: SET_KW@48..55 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@55..61 - 0: IDENT@55..61 "static" [] [] - 3: L_PAREN@61..62 "(" [] [] - 4: JS_FORMAL_PARAMETER@62..63 - 0: JS_DECORATOR_LIST@62..62 - 1: JS_IDENTIFIER_BINDING@62..63 - 0: IDENT@62..63 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@63..65 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@65..67 - 0: L_CURLY@65..66 "{" [] [] - 1: JS_DIRECTIVE_LIST@66..66 - 2: JS_STATEMENT_LIST@66..66 - 3: R_CURLY@66..67 "}" [] [] - 3: JS_SETTER_CLASS_MEMBER@67..90 - 0: JS_METHOD_MODIFIER_LIST@67..77 - 0: JS_STATIC_MODIFIER@67..77 - 0: STATIC_KW@67..77 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@77..81 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@81..84 - 0: IDENT@81..84 "bar" [] [] - 3: L_PAREN@84..85 "(" [] [] - 4: JS_FORMAL_PARAMETER@85..86 - 0: JS_DECORATOR_LIST@85..85 - 1: JS_IDENTIFIER_BINDING@85..86 - 0: IDENT@85..86 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@86..88 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@88..90 - 0: L_CURLY@88..89 "{" [] [] - 1: JS_DIRECTIVE_LIST@89..89 - 2: JS_STATEMENT_LIST@89..89 - 3: R_CURLY@89..90 "}" [] [] - 4: JS_SETTER_CLASS_MEMBER@90..114 - 0: JS_METHOD_MODIFIER_LIST@90..100 - 0: JS_STATIC_MODIFIER@90..100 - 0: STATIC_KW@90..100 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@100..104 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@104..107 - 0: IDENT@104..107 "baz" [] [] - 3: L_PAREN@107..108 "(" [] [] - 4: JS_FORMAL_PARAMETER@108..109 - 0: JS_DECORATOR_LIST@108..108 - 1: JS_IDENTIFIER_BINDING@108..109 - 0: IDENT@108..109 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: COMMA@109..110 "," [] [] - 6: R_PAREN@110..112 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@112..114 - 0: L_CURLY@112..113 "{" [] [] - 1: JS_DIRECTIVE_LIST@113..113 - 2: JS_STATEMENT_LIST@113..113 - 3: R_CURLY@113..114 "}" [] [] - 5: JS_SETTER_CLASS_MEMBER@114..132 - 0: JS_METHOD_MODIFIER_LIST@114..114 - 1: SET_KW@114..121 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@121..126 - 0: JS_STRING_LITERAL@121..126 "\"baz\"" [] [] - 3: L_PAREN@126..127 "(" [] [] - 4: JS_FORMAL_PARAMETER@127..128 - 0: JS_DECORATOR_LIST@127..127 - 1: JS_IDENTIFIER_BINDING@127..128 - 0: IDENT@127..128 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@128..130 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@130..132 - 0: L_CURLY@130..131 "{" [] [] - 1: JS_DIRECTIVE_LIST@131..131 - 2: JS_STATEMENT_LIST@131..131 - 3: R_CURLY@131..132 "}" [] [] - 6: JS_SETTER_CLASS_MEMBER@132..156 - 0: JS_METHOD_MODIFIER_LIST@132..132 - 1: SET_KW@132..139 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_COMPUTED_MEMBER_NAME@139..150 - 0: L_BRACK@139..140 "[" [] [] - 1: JS_BINARY_EXPRESSION@140..149 - 0: JS_STRING_LITERAL_EXPRESSION@140..144 - 0: JS_STRING_LITERAL@140..144 "\"a\"" [] [Whitespace(" ")] - 1: PLUS@144..146 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@146..149 - 0: JS_STRING_LITERAL@146..149 "\"b\"" [] [] - 2: R_BRACK@149..150 "]" [] [] - 3: L_PAREN@150..151 "(" [] [] - 4: JS_FORMAL_PARAMETER@151..152 - 0: JS_DECORATOR_LIST@151..151 - 1: JS_IDENTIFIER_BINDING@151..152 - 0: IDENT@151..152 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@152..154 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@154..156 - 0: L_CURLY@154..155 "{" [] [] - 1: JS_DIRECTIVE_LIST@155..155 - 2: JS_STATEMENT_LIST@155..155 - 3: R_CURLY@155..156 "}" [] [] - 7: JS_SETTER_CLASS_MEMBER@156..170 - 0: JS_METHOD_MODIFIER_LIST@156..156 - 1: SET_KW@156..163 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@163..164 - 0: JS_NUMBER_LITERAL@163..164 "5" [] [] - 3: L_PAREN@164..165 "(" [] [] - 4: JS_FORMAL_PARAMETER@165..166 - 0: JS_DECORATOR_LIST@165..165 - 1: JS_IDENTIFIER_BINDING@165..166 - 0: IDENT@165..166 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@166..168 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@168..170 - 0: L_CURLY@168..169 "{" [] [] - 1: JS_DIRECTIVE_LIST@169..169 - 2: JS_STATEMENT_LIST@169..169 - 3: R_CURLY@169..170 "}" [] [] - 8: JS_SETTER_CLASS_MEMBER@170..185 - 0: JS_METHOD_MODIFIER_LIST@170..170 - 1: SET_KW@170..177 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@177..178 - 0: JS_NUMBER_LITERAL@177..178 "6" [] [] - 3: L_PAREN@178..179 "(" [] [] - 4: JS_FORMAL_PARAMETER@179..180 - 0: JS_DECORATOR_LIST@179..179 - 1: JS_IDENTIFIER_BINDING@179..180 - 0: IDENT@179..180 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: COMMA@180..181 "," [] [] - 6: R_PAREN@181..183 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@183..185 - 0: L_CURLY@183..184 "{" [] [] - 1: JS_DIRECTIVE_LIST@184..184 - 2: JS_STATEMENT_LIST@184..184 - 3: R_CURLY@184..185 "}" [] [] - 9: JS_SETTER_CLASS_MEMBER@185..206 - 0: JS_METHOD_MODIFIER_LIST@185..185 - 1: SET_KW@185..192 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_PRIVATE_CLASS_MEMBER_NAME@192..200 - 0: HASH@192..193 "#" [] [] - 1: IDENT@193..200 "private" [] [] - 3: L_PAREN@200..201 "(" [] [] - 4: JS_FORMAL_PARAMETER@201..202 - 0: JS_DECORATOR_LIST@201..201 - 1: JS_IDENTIFIER_BINDING@201..202 - 0: IDENT@201..202 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@202..204 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@204..206 - 0: L_CURLY@204..205 "{" [] [] - 1: JS_DIRECTIVE_LIST@205..205 - 2: JS_STATEMENT_LIST@205..205 - 3: R_CURLY@205..206 "}" [] [] - 9: R_CURLY@206..208 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@208..278 - 0: JS_DECORATOR_LIST@208..208 - 1: (empty) - 2: CLASS_KW@208..215 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@215..226 - 0: IDENT@215..226 "NotSetters" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@226..227 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@227..276 - 0: JS_METHOD_CLASS_MEMBER@227..239 - 0: JS_METHOD_MODIFIER_LIST@227..227 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@227..233 - 0: IDENT@227..233 "set" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@233..237 - 0: L_PAREN@233..234 "(" [] [] - 1: JS_PARAMETER_LIST@234..235 - 0: JS_FORMAL_PARAMETER@234..235 - 0: JS_DECORATOR_LIST@234..234 - 1: JS_IDENTIFIER_BINDING@234..235 - 0: IDENT@234..235 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@235..237 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@237..239 - 0: L_CURLY@237..238 "{" [] [] - 1: JS_DIRECTIVE_LIST@238..238 - 2: JS_STATEMENT_LIST@238..238 - 3: R_CURLY@238..239 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@239..257 - 0: JS_METHOD_MODIFIER_LIST@239..239 - 1: ASYNC_KW@239..248 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@248..251 - 0: IDENT@248..251 "set" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@251..255 - 0: L_PAREN@251..252 "(" [] [] - 1: JS_PARAMETER_LIST@252..253 - 0: JS_FORMAL_PARAMETER@252..253 - 0: JS_DECORATOR_LIST@252..252 - 1: JS_IDENTIFIER_BINDING@252..253 - 0: IDENT@252..253 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@253..255 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@255..257 - 0: L_CURLY@255..256 "{" [] [] - 1: JS_DIRECTIVE_LIST@256..256 - 2: JS_STATEMENT_LIST@256..256 - 3: R_CURLY@256..257 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@257..276 - 0: JS_METHOD_MODIFIER_LIST@257..267 - 0: JS_STATIC_MODIFIER@257..267 - 0: STATIC_KW@257..267 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@267..270 - 0: IDENT@267..270 "set" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@270..274 - 0: L_PAREN@270..271 "(" [] [] - 1: JS_PARAMETER_LIST@271..272 - 0: JS_FORMAL_PARAMETER@271..272 - 0: JS_DECORATOR_LIST@271..271 - 1: JS_IDENTIFIER_BINDING@271..272 - 0: IDENT@271..272 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@272..274 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@274..276 - 0: L_CURLY@274..275 "{" [] [] - 1: JS_DIRECTIVE_LIST@275..275 - 2: JS_STATEMENT_LIST@275..275 - 3: R_CURLY@275..276 "}" [] [] - 9: R_CURLY@276..278 "}" [Newline("\n")] [] - 4: EOF@278..279 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_object_member.rast b/crates/biome_js_parser/test_data/inline/ok/setter_object_member.rast deleted file mode 100644 index 758043cb7c81..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/setter_object_member.rast +++ /dev/null @@ -1,346 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsSetterObjectMember { - set_token: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..18 "foo" [] [], - }, - l_paren_token: L_PAREN@18..19 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@19..24 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@27..30 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@30..31 "," [] [], - JsSetterObjectMember { - set_token: SET_KW@31..37 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@37..38 "a" [] [], - }, - l_paren_token: L_PAREN@38..39 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@39..44 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: COMMA@44..45 "," [] [], - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@47..48 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@51..52 "," [] [], - JsSetterObjectMember { - set_token: SET_KW@52..58 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@58..63 "\"bar\"" [] [], - }, - l_paren_token: L_PAREN@63..64 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@64..69 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@71..72 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@72..75 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@75..76 "," [] [], - JsSetterObjectMember { - set_token: SET_KW@76..82 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@82..83 "[" [] [], - expression: JsBinaryExpression { - left: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@83..87 "\"a\"" [] [Whitespace(" ")], - }, - operator_token: PLUS@87..89 "+" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@89..92 "\"b\"" [] [], - }, - }, - r_brack_token: R_BRACK@92..93 "]" [] [], - }, - l_paren_token: L_PAREN@93..94 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@94..99 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@101..102 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@102..105 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@105..106 "," [] [], - JsSetterObjectMember { - set_token: SET_KW@106..112 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@112..113 "5" [] [], - }, - l_paren_token: L_PAREN@113..114 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@114..119 "value" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@119..121 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@121..122 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@122..125 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - COMMA@125..126 "," [] [], - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@126..131 "set" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@131..132 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@132..134 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@134..135 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@135..145 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@145..180 "\"This is a method and not a setter\"" [] [], - }, - semicolon_token: SEMICOLON@180..181 ";" [] [], - }, - ], - r_curly_token: R_CURLY@181..184 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@184..186 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@186..187 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..187 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..186 - 0: JS_VARIABLE_STATEMENT@0..186 - 0: JS_VARIABLE_DECLARATION@0..186 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..186 - 0: JS_VARIABLE_DECLARATOR@4..186 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..186 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..186 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..184 - 0: JS_SETTER_OBJECT_MEMBER@9..30 - 0: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..18 - 0: IDENT@15..18 "foo" [] [] - 2: L_PAREN@18..19 "(" [] [] - 3: JS_FORMAL_PARAMETER@19..24 - 0: JS_DECORATOR_LIST@19..19 - 1: JS_IDENTIFIER_BINDING@19..24 - 0: IDENT@19..24 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@26..30 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..27 - 3: R_CURLY@27..30 "}" [Newline("\n"), Whitespace(" ")] [] - 1: COMMA@30..31 "," [] [] - 2: JS_SETTER_OBJECT_MEMBER@31..51 - 0: SET_KW@31..37 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@37..38 - 0: IDENT@37..38 "a" [] [] - 2: L_PAREN@38..39 "(" [] [] - 3: JS_FORMAL_PARAMETER@39..44 - 0: JS_DECORATOR_LIST@39..39 - 1: JS_IDENTIFIER_BINDING@39..44 - 0: IDENT@39..44 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: COMMA@44..45 "," [] [] - 5: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@47..51 - 0: L_CURLY@47..48 "{" [] [] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..48 - 3: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [] - 3: COMMA@51..52 "," [] [] - 4: JS_SETTER_OBJECT_MEMBER@52..75 - 0: SET_KW@52..58 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@58..63 - 0: JS_STRING_LITERAL@58..63 "\"bar\"" [] [] - 2: L_PAREN@63..64 "(" [] [] - 3: JS_FORMAL_PARAMETER@64..69 - 0: JS_DECORATOR_LIST@64..64 - 1: JS_IDENTIFIER_BINDING@64..69 - 0: IDENT@64..69 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@69..71 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@71..75 - 0: L_CURLY@71..72 "{" [] [] - 1: JS_DIRECTIVE_LIST@72..72 - 2: JS_STATEMENT_LIST@72..72 - 3: R_CURLY@72..75 "}" [Newline("\n"), Whitespace(" ")] [] - 5: COMMA@75..76 "," [] [] - 6: JS_SETTER_OBJECT_MEMBER@76..105 - 0: SET_KW@76..82 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_NAME@82..93 - 0: L_BRACK@82..83 "[" [] [] - 1: JS_BINARY_EXPRESSION@83..92 - 0: JS_STRING_LITERAL_EXPRESSION@83..87 - 0: JS_STRING_LITERAL@83..87 "\"a\"" [] [Whitespace(" ")] - 1: PLUS@87..89 "+" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@89..92 - 0: JS_STRING_LITERAL@89..92 "\"b\"" [] [] - 2: R_BRACK@92..93 "]" [] [] - 2: L_PAREN@93..94 "(" [] [] - 3: JS_FORMAL_PARAMETER@94..99 - 0: JS_DECORATOR_LIST@94..94 - 1: JS_IDENTIFIER_BINDING@94..99 - 0: IDENT@94..99 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@99..101 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@101..105 - 0: L_CURLY@101..102 "{" [] [] - 1: JS_DIRECTIVE_LIST@102..102 - 2: JS_STATEMENT_LIST@102..102 - 3: R_CURLY@102..105 "}" [Newline("\n"), Whitespace(" ")] [] - 7: COMMA@105..106 "," [] [] - 8: JS_SETTER_OBJECT_MEMBER@106..125 - 0: SET_KW@106..112 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@112..113 - 0: JS_NUMBER_LITERAL@112..113 "5" [] [] - 2: L_PAREN@113..114 "(" [] [] - 3: JS_FORMAL_PARAMETER@114..119 - 0: JS_DECORATOR_LIST@114..114 - 1: JS_IDENTIFIER_BINDING@114..119 - 0: IDENT@114..119 "value" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@119..121 ")" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@121..125 - 0: L_CURLY@121..122 "{" [] [] - 1: JS_DIRECTIVE_LIST@122..122 - 2: JS_STATEMENT_LIST@122..122 - 3: R_CURLY@122..125 "}" [Newline("\n"), Whitespace(" ")] [] - 9: COMMA@125..126 "," [] [] - 10: JS_METHOD_OBJECT_MEMBER@126..184 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@126..131 - 0: IDENT@126..131 "set" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@131..134 - 0: L_PAREN@131..132 "(" [] [] - 1: JS_PARAMETER_LIST@132..132 - 2: R_PAREN@132..134 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@134..184 - 0: L_CURLY@134..135 "{" [] [] - 1: JS_DIRECTIVE_LIST@135..135 - 2: JS_STATEMENT_LIST@135..181 - 0: JS_RETURN_STATEMENT@135..181 - 0: RETURN_KW@135..145 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@145..180 - 0: JS_STRING_LITERAL@145..180 "\"This is a method and not a setter\"" [] [] - 2: SEMICOLON@180..181 ";" [] [] - 3: R_CURLY@181..184 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@184..186 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@186..187 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast b/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast deleted file mode 100644 index d6dff41c16f1..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast +++ /dev/null @@ -1,69 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..7 "id" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@9..15 "async" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@15..18 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..23 "async" [] [], - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_VARIABLE_STATEMENT@0..24 - 0: JS_VARIABLE_DECLARATION@0..23 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..23 - 0: JS_VARIABLE_DECLARATOR@4..23 - 0: JS_IDENTIFIER_BINDING@4..7 - 0: IDENT@4..7 "id" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@7..23 - 0: EQ@7..9 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@9..23 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@9..15 - 0: IDENT@9..15 "async" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@15..18 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@18..23 - 0: JS_REFERENCE_IDENTIFIER@18..23 - 0: IDENT@18..23 "async" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.rast b/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.rast deleted file mode 100644 index 7202f6523e18..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.rast +++ /dev/null @@ -1,134 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@18..24 "async" [] [Whitespace(" ")], - star_token: STAR@24..26 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@26..37 "constructor" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@37..38 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@38..40 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@40..41 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@41..42 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@42..51 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: STAR@51..53 "*" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@53..64 "constructor" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@64..65 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@67..68 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@68..69 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@69..71 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@71..72 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..72 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..71 - 0: JS_CLASS_DECLARATION@0..71 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..69 - 0: JS_METHOD_CLASS_MEMBER@9..42 - 0: JS_METHOD_MODIFIER_LIST@9..18 - 0: JS_STATIC_MODIFIER@9..18 - 0: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] - 1: ASYNC_KW@18..24 "async" [] [Whitespace(" ")] - 2: STAR@24..26 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@26..37 - 0: IDENT@26..37 "constructor" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@37..40 - 0: L_PAREN@37..38 "(" [] [] - 1: JS_PARAMETER_LIST@38..38 - 2: R_PAREN@38..40 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@40..42 - 0: L_CURLY@40..41 "{" [] [] - 1: JS_DIRECTIVE_LIST@41..41 - 2: JS_STATEMENT_LIST@41..41 - 3: R_CURLY@41..42 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@42..69 - 0: JS_METHOD_MODIFIER_LIST@42..51 - 0: JS_STATIC_MODIFIER@42..51 - 0: STATIC_KW@42..51 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] - 1: (empty) - 2: STAR@51..53 "*" [] [Whitespace(" ")] - 3: JS_LITERAL_MEMBER_NAME@53..64 - 0: IDENT@53..64 "constructor" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@64..67 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_PARAMETER_LIST@65..65 - 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@67..69 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_DIRECTIVE_LIST@68..68 - 2: JS_STATEMENT_LIST@68..68 - 3: R_CURLY@68..69 "}" [] [] - 9: R_CURLY@69..71 "}" [Newline("\n")] [] - 4: EOF@71..72 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.rast b/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.rast deleted file mode 100644 index 9b4099c80559..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.rast +++ /dev/null @@ -1,106 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@9..19 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@19..20 "a" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsStaticInitializationBlockClassMember { - static_token: STATIC_KW@21..31 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - l_curly_token: L_CURLY@31..32 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsThisExpression { - this_token: THIS_KW@32..41 "this" [Newline("\n"), Whitespace(" ")] [], - }, - dot_token: DOT@41..42 "." [] [], - member: JsName { - value_token: IDENT@42..44 "a" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@44..46 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@46..52 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@52..53 ";" [] [], - }, - ], - r_curly_token: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_curly_token: R_CURLY@57..59 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@59..60 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..60 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..59 - 0: JS_CLASS_DECLARATION@0..59 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..57 - 0: JS_PROPERTY_CLASS_MEMBER@9..21 - 0: JS_PROPERTY_MODIFIER_LIST@9..19 - 0: JS_STATIC_MODIFIER@9..19 - 0: STATIC_KW@9..19 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@19..20 - 0: IDENT@19..20 "a" [] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@20..21 ";" [] [] - 1: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@21..57 - 0: STATIC_KW@21..31 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_CURLY@31..32 "{" [] [] - 2: JS_STATEMENT_LIST@32..53 - 0: JS_EXPRESSION_STATEMENT@32..53 - 0: JS_ASSIGNMENT_EXPRESSION@32..52 - 0: JS_STATIC_MEMBER_ASSIGNMENT@32..44 - 0: JS_THIS_EXPRESSION@32..41 - 0: THIS_KW@32..41 "this" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@41..42 "." [] [] - 2: JS_NAME@42..44 - 0: IDENT@42..44 "a" [] [Whitespace(" ")] - 1: EQ@44..46 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@46..52 - 0: JS_STRING_LITERAL@46..52 "\"test\"" [] [] - 1: SEMICOLON@52..53 ";" [] [] - 3: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@57..59 "}" [Newline("\n")] [] - 4: EOF@59..60 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/static_member_expression.rast b/crates/biome_js_parser/test_data/inline/ok/static_member_expression.rast deleted file mode 100644 index 42411637f7f5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/static_member_expression.rast +++ /dev/null @@ -1,350 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - operator_token: DOT@3..4 "." [] [], - member: JsName { - value_token: IDENT@4..7 "bar" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..11 "foo" [Newline("\n")] [], - }, - }, - operator_token: DOT@11..12 "." [] [], - member: JsName { - value_token: IDENT@12..17 "await" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..21 "foo" [Newline("\n")] [], - }, - }, - operator_token: DOT@21..22 "." [] [], - member: JsName { - value_token: IDENT@22..27 "yield" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..31 "foo" [Newline("\n")] [], - }, - }, - operator_token: DOT@31..32 "." [] [], - member: JsName { - value_token: IDENT@32..35 "for" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@35..39 "foo" [Newline("\n")] [], - }, - }, - operator_token: QUESTIONDOT@39..41 "?." [] [], - member: JsName { - value_token: IDENT@41..44 "for" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..48 "foo" [Newline("\n")] [], - }, - }, - operator_token: QUESTIONDOT@48..50 "?." [] [], - member: JsName { - value_token: IDENT@50..53 "bar" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@53..60 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@60..65 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@65..66 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@66..70 "#" [Newline("\n"), Whitespace(" ")] [], - id_token: IDENT@70..73 "bar" [] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: missing (optional), - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@73..80 "test" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@80..81 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@81..86 "other" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@88..89 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@89..98 "this" [Newline("\n"), Whitespace(" ")] [], - }, - operator_token: DOT@98..99 "." [] [], - member: JsPrivateName { - hash_token: HASH@99..100 "#" [] [], - value_token: IDENT@100..103 "bar" [] [], - }, - }, - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@104..113 "this" [Newline("\n"), Whitespace(" ")] [], - }, - operator_token: QUESTIONDOT@113..115 "?." [] [], - member: JsPrivateName { - hash_token: HASH@115..116 "#" [] [], - value_token: IDENT@116..119 "bar" [] [], - }, - }, - semicolon_token: SEMICOLON@119..120 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@120..130 "other" [Newline("\n"), Whitespace(" ")] [], - }, - }, - operator_token: DOT@130..131 "." [] [], - member: JsPrivateName { - hash_token: HASH@131..132 "#" [] [], - value_token: IDENT@132..135 "bar" [] [], - }, - }, - semicolon_token: SEMICOLON@135..136 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@136..146 "other" [Newline("\n"), Whitespace(" ")] [], - }, - }, - operator_token: QUESTIONDOT@146..148 "?." [] [], - member: JsPrivateName { - hash_token: HASH@148..149 "#" [] [], - value_token: IDENT@149..152 "bar" [] [], - }, - }, - semicolon_token: SEMICOLON@152..153 ";" [] [], - }, - ], - r_curly_token: R_CURLY@153..157 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@157..159 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@159..160 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..160 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..159 - 0: JS_EXPRESSION_STATEMENT@0..7 - 0: JS_STATIC_MEMBER_EXPRESSION@0..7 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: DOT@3..4 "." [] [] - 2: JS_NAME@4..7 - 0: IDENT@4..7 "bar" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@7..17 - 0: JS_STATIC_MEMBER_EXPRESSION@7..17 - 0: JS_IDENTIFIER_EXPRESSION@7..11 - 0: JS_REFERENCE_IDENTIFIER@7..11 - 0: IDENT@7..11 "foo" [Newline("\n")] [] - 1: DOT@11..12 "." [] [] - 2: JS_NAME@12..17 - 0: IDENT@12..17 "await" [] [] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@17..27 - 0: JS_STATIC_MEMBER_EXPRESSION@17..27 - 0: JS_IDENTIFIER_EXPRESSION@17..21 - 0: JS_REFERENCE_IDENTIFIER@17..21 - 0: IDENT@17..21 "foo" [Newline("\n")] [] - 1: DOT@21..22 "." [] [] - 2: JS_NAME@22..27 - 0: IDENT@22..27 "yield" [] [] - 1: (empty) - 3: JS_EXPRESSION_STATEMENT@27..35 - 0: JS_STATIC_MEMBER_EXPRESSION@27..35 - 0: JS_IDENTIFIER_EXPRESSION@27..31 - 0: JS_REFERENCE_IDENTIFIER@27..31 - 0: IDENT@27..31 "foo" [Newline("\n")] [] - 1: DOT@31..32 "." [] [] - 2: JS_NAME@32..35 - 0: IDENT@32..35 "for" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@35..44 - 0: JS_STATIC_MEMBER_EXPRESSION@35..44 - 0: JS_IDENTIFIER_EXPRESSION@35..39 - 0: JS_REFERENCE_IDENTIFIER@35..39 - 0: IDENT@35..39 "foo" [Newline("\n")] [] - 1: QUESTIONDOT@39..41 "?." [] [] - 2: JS_NAME@41..44 - 0: IDENT@41..44 "for" [] [] - 1: (empty) - 5: JS_EXPRESSION_STATEMENT@44..53 - 0: JS_STATIC_MEMBER_EXPRESSION@44..53 - 0: JS_IDENTIFIER_EXPRESSION@44..48 - 0: JS_REFERENCE_IDENTIFIER@44..48 - 0: IDENT@44..48 "foo" [Newline("\n")] [] - 1: QUESTIONDOT@48..50 "?." [] [] - 2: JS_NAME@50..53 - 0: IDENT@50..53 "bar" [] [] - 1: (empty) - 6: JS_CLASS_DECLARATION@53..159 - 0: JS_DECORATOR_LIST@53..53 - 1: (empty) - 2: CLASS_KW@53..60 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@60..65 - 0: IDENT@60..65 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@65..66 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@66..157 - 0: JS_PROPERTY_CLASS_MEMBER@66..73 - 0: JS_PROPERTY_MODIFIER_LIST@66..66 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@66..73 - 0: HASH@66..70 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@70..73 "bar" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: JS_METHOD_CLASS_MEMBER@73..157 - 0: JS_METHOD_MODIFIER_LIST@73..73 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@73..80 - 0: IDENT@73..80 "test" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@80..88 - 0: L_PAREN@80..81 "(" [] [] - 1: JS_PARAMETER_LIST@81..86 - 0: JS_FORMAL_PARAMETER@81..86 - 0: JS_DECORATOR_LIST@81..81 - 1: JS_IDENTIFIER_BINDING@81..86 - 0: IDENT@81..86 "other" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@86..88 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@88..157 - 0: L_CURLY@88..89 "{" [] [] - 1: JS_DIRECTIVE_LIST@89..89 - 2: JS_STATEMENT_LIST@89..153 - 0: JS_EXPRESSION_STATEMENT@89..104 - 0: JS_STATIC_MEMBER_EXPRESSION@89..103 - 0: JS_THIS_EXPRESSION@89..98 - 0: THIS_KW@89..98 "this" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@98..99 "." [] [] - 2: JS_PRIVATE_NAME@99..103 - 0: HASH@99..100 "#" [] [] - 1: IDENT@100..103 "bar" [] [] - 1: SEMICOLON@103..104 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@104..120 - 0: JS_STATIC_MEMBER_EXPRESSION@104..119 - 0: JS_THIS_EXPRESSION@104..113 - 0: THIS_KW@104..113 "this" [Newline("\n"), Whitespace(" ")] [] - 1: QUESTIONDOT@113..115 "?." [] [] - 2: JS_PRIVATE_NAME@115..119 - 0: HASH@115..116 "#" [] [] - 1: IDENT@116..119 "bar" [] [] - 1: SEMICOLON@119..120 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@120..136 - 0: JS_STATIC_MEMBER_EXPRESSION@120..135 - 0: JS_IDENTIFIER_EXPRESSION@120..130 - 0: JS_REFERENCE_IDENTIFIER@120..130 - 0: IDENT@120..130 "other" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@130..131 "." [] [] - 2: JS_PRIVATE_NAME@131..135 - 0: HASH@131..132 "#" [] [] - 1: IDENT@132..135 "bar" [] [] - 1: SEMICOLON@135..136 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@136..153 - 0: JS_STATIC_MEMBER_EXPRESSION@136..152 - 0: JS_IDENTIFIER_EXPRESSION@136..146 - 0: JS_REFERENCE_IDENTIFIER@136..146 - 0: IDENT@136..146 "other" [Newline("\n"), Whitespace(" ")] [] - 1: QUESTIONDOT@146..148 "?." [] [] - 2: JS_PRIVATE_NAME@148..152 - 0: HASH@148..149 "#" [] [] - 1: IDENT@149..152 "bar" [] [] - 1: SEMICOLON@152..153 ";" [] [] - 3: R_CURLY@153..157 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@157..159 "}" [Newline("\n")] [] - 4: EOF@159..160 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/static_method.rast b/crates/biome_js_parser/test_data/inline/ok/static_method.rast deleted file mode 100644 index 1bfa14cec9ac..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/static_method.rast +++ /dev/null @@ -1,243 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@11..20 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@20..23 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..27 "bar" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@29..30 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@31..40 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: STAR@40..41 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@41..44 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@47..48 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@49..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@58..64 "async" [] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@64..67 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@67..68 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@70..71 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@71..72 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@72..81 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: ASYNC_KW@81..87 "async" [] [Whitespace(" ")], - star_token: STAR@87..88 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@88..91 "foo" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@91..92 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@92..94 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@94..95 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@95..96 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@96..98 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@98..99 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..99 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..98 - 0: JS_CLASS_DECLARATION@0..98 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..96 - 0: JS_METHOD_CLASS_MEMBER@11..31 - 0: JS_METHOD_MODIFIER_LIST@11..20 - 0: JS_STATIC_MODIFIER@11..20 - 0: STATIC_KW@11..20 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@20..23 - 0: IDENT@20..23 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@23..29 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..27 - 0: JS_FORMAL_PARAMETER@24..27 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..27 - 0: IDENT@24..27 "bar" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@27..29 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@29..31 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_DIRECTIVE_LIST@30..30 - 2: JS_STATEMENT_LIST@30..30 - 3: R_CURLY@30..31 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@31..49 - 0: JS_METHOD_MODIFIER_LIST@31..40 - 0: JS_STATIC_MODIFIER@31..40 - 0: STATIC_KW@31..40 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: STAR@40..41 "*" [] [] - 3: JS_LITERAL_MEMBER_NAME@41..44 - 0: IDENT@41..44 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..45 - 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@47..49 - 0: L_CURLY@47..48 "{" [] [] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..48 - 3: R_CURLY@48..49 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@49..72 - 0: JS_METHOD_MODIFIER_LIST@49..58 - 0: JS_STATIC_MODIFIER@49..58 - 0: STATIC_KW@49..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@58..64 "async" [] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@64..67 - 0: IDENT@64..67 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@67..70 - 0: L_PAREN@67..68 "(" [] [] - 1: JS_PARAMETER_LIST@68..68 - 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@70..72 - 0: L_CURLY@70..71 "{" [] [] - 1: JS_DIRECTIVE_LIST@71..71 - 2: JS_STATEMENT_LIST@71..71 - 3: R_CURLY@71..72 "}" [] [] - 3: JS_METHOD_CLASS_MEMBER@72..96 - 0: JS_METHOD_MODIFIER_LIST@72..81 - 0: JS_STATIC_MODIFIER@72..81 - 0: STATIC_KW@72..81 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: ASYNC_KW@81..87 "async" [] [Whitespace(" ")] - 2: STAR@87..88 "*" [] [] - 3: JS_LITERAL_MEMBER_NAME@88..91 - 0: IDENT@88..91 "foo" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@91..94 - 0: L_PAREN@91..92 "(" [] [] - 1: JS_PARAMETER_LIST@92..92 - 2: R_PAREN@92..94 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@94..96 - 0: L_CURLY@94..95 "{" [] [] - 1: JS_DIRECTIVE_LIST@95..95 - 2: JS_STATEMENT_LIST@95..95 - 3: R_CURLY@95..96 "}" [] [] - 9: R_CURLY@96..98 "}" [Newline("\n")] [] - 4: EOF@98..99 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/subscripts.rast b/crates/biome_js_parser/test_data/inline/ok/subscripts.rast deleted file mode 100644 index fc0c948ffe3a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/subscripts.rast +++ /dev/null @@ -1,150 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsTemplateExpression { - tag: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..3 "foo" [] [], - }, - }, - type_arguments: missing (optional), - l_tick_token: BACKTICK@3..4 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@4..7 "bar" [] [], - }, - ], - r_tick_token: BACKTICK@7..8 "`" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsCallExpression { - callee: JsCallExpression { - callee: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..12 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@12..13 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..16 "bar" [] [], - }, - }, - ], - r_paren_token: R_PAREN@16..17 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@17..18 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..21 "baz" [] [], - }, - }, - ], - r_paren_token: R_PAREN@21..22 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@22..23 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..26 "baz" [] [], - }, - }, - ], - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@27..28 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..31 "bar" [] [], - }, - }, - r_brack_token: R_BRACK@31..32 "]" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@32..33 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..33 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..32 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_TEMPLATE_EXPRESSION@0..8 - 0: JS_IDENTIFIER_EXPRESSION@0..3 - 0: JS_REFERENCE_IDENTIFIER@0..3 - 0: IDENT@0..3 "foo" [] [] - 1: (empty) - 2: BACKTICK@3..4 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@4..7 - 0: JS_TEMPLATE_CHUNK_ELEMENT@4..7 - 0: TEMPLATE_CHUNK@4..7 "bar" [] [] - 4: BACKTICK@7..8 "`" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@8..32 - 0: JS_COMPUTED_MEMBER_EXPRESSION@8..32 - 0: JS_CALL_EXPRESSION@8..27 - 0: JS_CALL_EXPRESSION@8..22 - 0: JS_CALL_EXPRESSION@8..17 - 0: JS_IDENTIFIER_EXPRESSION@8..12 - 0: JS_REFERENCE_IDENTIFIER@8..12 - 0: IDENT@8..12 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@12..17 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@13..16 - 0: JS_IDENTIFIER_EXPRESSION@13..16 - 0: JS_REFERENCE_IDENTIFIER@13..16 - 0: IDENT@13..16 "bar" [] [] - 2: R_PAREN@16..17 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@17..22 - 0: L_PAREN@17..18 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@18..21 - 0: JS_IDENTIFIER_EXPRESSION@18..21 - 0: JS_REFERENCE_IDENTIFIER@18..21 - 0: IDENT@18..21 "baz" [] [] - 2: R_PAREN@21..22 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@22..27 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@23..26 - 0: JS_IDENTIFIER_EXPRESSION@23..26 - 0: JS_REFERENCE_IDENTIFIER@23..26 - 0: IDENT@23..26 "baz" [] [] - 2: R_PAREN@26..27 ")" [] [] - 1: (empty) - 2: L_BRACK@27..28 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@28..31 - 0: JS_REFERENCE_IDENTIFIER@28..31 - 0: IDENT@28..31 "bar" [] [] - 4: R_BRACK@31..32 "]" [] [] - 1: (empty) - 4: EOF@32..33 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression.rast b/crates/biome_js_parser/test_data/inline/ok/super_expression.rast deleted file mode 100644 index e5f77522955b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/super_expression.rast +++ /dev/null @@ -1,232 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@19..21 "B" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@21..22 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@22..36 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@39..40 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@40..50 "super" [Newline("\n"), Whitespace(" ")] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@50..51 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@51..52 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@52..53 ";" [] [], - }, - ], - r_curly_token: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@57..64 "test" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@64..65 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@67..68 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsSuperExpression { - super_token: SUPER_KW@68..78 "super" [Newline("\n"), Whitespace(" ")] [], - }, - operator_token: DOT@78..79 "." [] [], - member: JsName { - value_token: IDENT@79..83 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@83..84 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..85 "a" [] [], - }, - }, - COMMA@85..87 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@87..88 "b" [] [], - }, - }, - ], - r_paren_token: R_PAREN@88..89 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@89..90 ";" [] [], - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsSuperExpression { - super_token: SUPER_KW@90..100 "super" [Newline("\n"), Whitespace(" ")] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@100..101 "[" [] [], - member: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@101..102 "1" [] [], - }, - r_brack_token: R_BRACK@102..103 "]" [] [], - }, - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - ], - r_curly_token: R_CURLY@104..108 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@108..110 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@110..111 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..111 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..110 - 0: JS_CLASS_DECLARATION@0..110 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@11..21 - 0: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@19..21 - 0: JS_REFERENCE_IDENTIFIER@19..21 - 0: IDENT@19..21 "B" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@21..22 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@22..108 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@22..57 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@22..22 - 1: JS_LITERAL_MEMBER_NAME@22..36 - 0: IDENT@22..36 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@36..39 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@37..37 - 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@39..57 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..53 - 0: JS_EXPRESSION_STATEMENT@40..53 - 0: JS_CALL_EXPRESSION@40..52 - 0: JS_SUPER_EXPRESSION@40..50 - 0: SUPER_KW@40..50 "super" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@50..52 - 0: L_PAREN@50..51 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@51..51 - 2: R_PAREN@51..52 ")" [] [] - 1: SEMICOLON@52..53 ";" [] [] - 3: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [] - 1: JS_METHOD_CLASS_MEMBER@57..108 - 0: JS_METHOD_MODIFIER_LIST@57..57 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@57..64 - 0: IDENT@57..64 "test" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@64..67 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_PARAMETER_LIST@65..65 - 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@67..108 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_DIRECTIVE_LIST@68..68 - 2: JS_STATEMENT_LIST@68..104 - 0: JS_EXPRESSION_STATEMENT@68..90 - 0: JS_CALL_EXPRESSION@68..89 - 0: JS_STATIC_MEMBER_EXPRESSION@68..83 - 0: JS_SUPER_EXPRESSION@68..78 - 0: SUPER_KW@68..78 "super" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@78..79 "." [] [] - 2: JS_NAME@79..83 - 0: IDENT@79..83 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@83..89 - 0: L_PAREN@83..84 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@84..88 - 0: JS_IDENTIFIER_EXPRESSION@84..85 - 0: JS_REFERENCE_IDENTIFIER@84..85 - 0: IDENT@84..85 "a" [] [] - 1: COMMA@85..87 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@87..88 - 0: JS_REFERENCE_IDENTIFIER@87..88 - 0: IDENT@87..88 "b" [] [] - 2: R_PAREN@88..89 ")" [] [] - 1: SEMICOLON@89..90 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@90..104 - 0: JS_COMPUTED_MEMBER_EXPRESSION@90..103 - 0: JS_SUPER_EXPRESSION@90..100 - 0: SUPER_KW@90..100 "super" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: L_BRACK@100..101 "[" [] [] - 3: JS_NUMBER_LITERAL_EXPRESSION@101..102 - 0: JS_NUMBER_LITERAL@101..102 "1" [] [] - 4: R_BRACK@102..103 "]" [] [] - 1: SEMICOLON@103..104 ";" [] [] - 3: R_CURLY@104..108 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@108..110 "}" [Newline("\n")] [] - 4: EOF@110..111 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.rast b/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.rast deleted file mode 100644 index b5f9d7a06836..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.rast +++ /dev/null @@ -1,126 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..18 "B" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@20..31 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@32..34 "c" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@34..36 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@36..41 "super" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@41..42 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@42..43 ")" [] [], - }, - }, - }, - }, - ], - r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@45..46 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@46..48 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_CLASS_DECLARATION@0..49 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@8..18 - 0: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@16..18 - 0: JS_REFERENCE_IDENTIFIER@16..18 - 0: IDENT@16..18 "B" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@20..48 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..48 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..31 - 0: IDENT@20..31 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@31..45 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..43 - 0: JS_FORMAL_PARAMETER@32..43 - 0: JS_DECORATOR_LIST@32..32 - 1: JS_IDENTIFIER_BINDING@32..34 - 0: IDENT@32..34 "c" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@34..43 - 0: EQ@34..36 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@36..43 - 0: JS_SUPER_EXPRESSION@36..41 - 0: SUPER_KW@36..41 "super" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@41..43 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@42..42 - 2: R_PAREN@42..43 ")" [] [] - 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@45..48 - 0: L_CURLY@45..46 "{" [] [] - 1: JS_DIRECTIVE_LIST@46..46 - 2: JS_STATEMENT_LIST@46..46 - 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] - 9: R_CURLY@48..49 "}" [] [] - 4: EOF@49..50 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/switch_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/switch_stmt.rast deleted file mode 100644 index e50112dfdf46..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/switch_stmt.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsSwitchStatement { - switch_token: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")], - l_paren_token: L_PAREN@7..8 "(" [] [], - discriminant: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@8..11 "foo" [] [], - }, - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - l_curly_token: L_CURLY@13..14 "{" [] [], - cases: JsSwitchCaseList [ - JsCaseClause { - case_token: CASE_KW@14..21 "case" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "bar" [] [], - }, - }, - colon_token: COLON@24..25 ":" [] [], - consequent: JsStatementList [], - }, - JsDefaultClause { - default_token: DEFAULT_KW@25..34 "default" [Newline("\n"), Whitespace(" ")] [], - colon_token: COLON@34..35 ":" [] [], - consequent: JsStatementList [], - }, - ], - r_curly_token: R_CURLY@35..37 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@37..38 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..38 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..37 - 0: JS_SWITCH_STATEMENT@0..37 - 0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")] - 1: L_PAREN@7..8 "(" [] [] - 2: JS_IDENTIFIER_EXPRESSION@8..11 - 0: JS_REFERENCE_IDENTIFIER@8..11 - 0: IDENT@8..11 "foo" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: L_CURLY@13..14 "{" [] [] - 5: JS_SWITCH_CASE_LIST@14..35 - 0: JS_CASE_CLAUSE@14..25 - 0: CASE_KW@14..21 "case" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "bar" [] [] - 2: COLON@24..25 ":" [] [] - 3: JS_STATEMENT_LIST@25..25 - 1: JS_DEFAULT_CLAUSE@25..35 - 0: DEFAULT_KW@25..34 "default" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@34..35 ":" [] [] - 2: JS_STATEMENT_LIST@35..35 - 6: R_CURLY@35..37 "}" [Newline("\n")] [] - 4: EOF@37..38 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/template_literal.rast b/crates/biome_js_parser/test_data/inline/ok/template_literal.rast deleted file mode 100644 index bcfd941b2c5d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/template_literal.rast +++ /dev/null @@ -1,306 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@8..9 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@9..13 "foo " [] [], - }, - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@13..15 "${" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@15..18 "bar" [] [], - }, - }, - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - ], - r_tick_token: BACKTICK@19..20 "`" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@26..28 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@30..31 "`" [] [], - elements: JsTemplateElementList [], - r_tick_token: BACKTICK@31..32 "`" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@38..40 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@42..43 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@43..45 "${" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..48 "foo" [] [], - }, - }, - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - ], - r_tick_token: BACKTICK@49..50 "`" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@51..56 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@56..58 "d" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@58..60 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@60..61 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@61..64 "foo" [] [], - }, - ], - r_tick_token: BACKTICK@64..65 "`" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@65..66 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@71..73 "e" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - expression: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@75..76 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@76..78 "${" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@80..81 "a" [] [], - }, - colon_token: COLON@81..83 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - r_curly_token: R_CURLY@93..94 "}" [] [], - }, - ], - r_tick_token: BACKTICK@94..95 "`" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@95..96 ";" [] [], - }, - ], - eof_token: EOF@96..97 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..97 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..96 - 0: JS_VARIABLE_STATEMENT@0..21 - 0: JS_VARIABLE_DECLARATION@0..20 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..20 - 0: JS_VARIABLE_DECLARATOR@4..20 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..20 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@8..20 - 0: (empty) - 1: (empty) - 2: BACKTICK@8..9 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@9..19 - 0: JS_TEMPLATE_CHUNK_ELEMENT@9..13 - 0: TEMPLATE_CHUNK@9..13 "foo " [] [] - 1: JS_TEMPLATE_ELEMENT@13..19 - 0: DOLLAR_CURLY@13..15 "${" [] [] - 1: JS_IDENTIFIER_EXPRESSION@15..18 - 0: JS_REFERENCE_IDENTIFIER@15..18 - 0: IDENT@15..18 "bar" [] [] - 2: R_CURLY@18..19 "}" [] [] - 4: BACKTICK@19..20 "`" [] [] - 1: SEMICOLON@20..21 ";" [] [] - 1: JS_VARIABLE_STATEMENT@21..33 - 0: JS_VARIABLE_DECLARATION@21..32 - 0: (empty) - 1: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@26..32 - 0: JS_VARIABLE_DECLARATOR@26..32 - 0: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@28..32 - 0: EQ@28..30 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@30..32 - 0: (empty) - 1: (empty) - 2: BACKTICK@30..31 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@31..31 - 4: BACKTICK@31..32 "`" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_VARIABLE_STATEMENT@33..51 - 0: JS_VARIABLE_DECLARATION@33..50 - 0: (empty) - 1: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@38..50 - 0: JS_VARIABLE_DECLARATOR@38..50 - 0: JS_IDENTIFIER_BINDING@38..40 - 0: IDENT@38..40 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@40..50 - 0: EQ@40..42 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@42..50 - 0: (empty) - 1: (empty) - 2: BACKTICK@42..43 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@43..49 - 0: JS_TEMPLATE_ELEMENT@43..49 - 0: DOLLAR_CURLY@43..45 "${" [] [] - 1: JS_IDENTIFIER_EXPRESSION@45..48 - 0: JS_REFERENCE_IDENTIFIER@45..48 - 0: IDENT@45..48 "foo" [] [] - 2: R_CURLY@48..49 "}" [] [] - 4: BACKTICK@49..50 "`" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 3: JS_VARIABLE_STATEMENT@51..66 - 0: JS_VARIABLE_DECLARATION@51..65 - 0: (empty) - 1: LET_KW@51..56 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@56..65 - 0: JS_VARIABLE_DECLARATOR@56..65 - 0: JS_IDENTIFIER_BINDING@56..58 - 0: IDENT@56..58 "d" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@58..65 - 0: EQ@58..60 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@60..65 - 0: (empty) - 1: (empty) - 2: BACKTICK@60..61 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@61..64 - 0: JS_TEMPLATE_CHUNK_ELEMENT@61..64 - 0: TEMPLATE_CHUNK@61..64 "foo" [] [] - 4: BACKTICK@64..65 "`" [] [] - 1: SEMICOLON@65..66 ";" [] [] - 4: JS_VARIABLE_STATEMENT@66..96 - 0: JS_VARIABLE_DECLARATION@66..95 - 0: (empty) - 1: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@71..95 - 0: JS_VARIABLE_DECLARATOR@71..95 - 0: JS_IDENTIFIER_BINDING@71..73 - 0: IDENT@71..73 "e" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@73..95 - 0: EQ@73..75 "=" [] [Whitespace(" ")] - 1: JS_TEMPLATE_EXPRESSION@75..95 - 0: (empty) - 1: (empty) - 2: BACKTICK@75..76 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@76..94 - 0: JS_TEMPLATE_ELEMENT@76..94 - 0: DOLLAR_CURLY@76..78 "${" [] [] - 1: JS_OBJECT_EXPRESSION@78..93 - 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@80..92 - 0: JS_PROPERTY_OBJECT_MEMBER@80..92 - 0: JS_LITERAL_MEMBER_NAME@80..81 - 0: IDENT@80..81 "a" [] [] - 1: COLON@81..83 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@83..92 - 0: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")] - 2: R_CURLY@92..93 "}" [] [] - 2: R_CURLY@93..94 "}" [] [] - 4: BACKTICK@94..95 "`" [] [] - 1: SEMICOLON@95..96 ";" [] [] - 4: EOF@96..97 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/this_expr.rast b/crates/biome_js_parser/test_data/inline/ok/this_expr.rast deleted file mode 100644 index cfb5adf27de0..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/this_expr.rast +++ /dev/null @@ -1,45 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsThisExpression { - this_token: THIS_KW@0..4 "this" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@4..9 "this" [Newline("\n")] [], - }, - operator_token: DOT@9..10 "." [] [], - member: JsName { - value_token: IDENT@10..13 "foo" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: JS_EXPRESSION_STATEMENT@0..4 - 0: JS_THIS_EXPRESSION@0..4 - 0: THIS_KW@0..4 "this" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@4..13 - 0: JS_STATIC_MEMBER_EXPRESSION@4..13 - 0: JS_THIS_EXPRESSION@4..9 - 0: THIS_KW@4..9 "this" [Newline("\n")] [] - 1: DOT@9..10 "." [] [] - 2: JS_NAME@10..13 - 0: IDENT@10..13 "foo" [] [] - 1: (empty) - 4: EOF@13..14 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/throw_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/throw_stmt.rast deleted file mode 100644 index e000a1825bc9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/throw_stmt.rast +++ /dev/null @@ -1,64 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsThrowStatement { - throw_token: THROW_KW@0..6 "throw" [] [Whitespace(" ")], - argument: JsNewExpression { - new_token: NEW_KW@6..10 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..15 "Error" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@15..16 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@16..21 "\"foo\"" [] [], - }, - ], - r_paren_token: R_PAREN@21..22 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - JsThrowStatement { - throw_token: THROW_KW@23..30 "throw" [Newline("\n")] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@30..35 "\"foo\"" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: JS_THROW_STATEMENT@0..23 - 0: THROW_KW@0..6 "throw" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@6..22 - 0: NEW_KW@6..10 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@10..15 - 0: JS_REFERENCE_IDENTIFIER@10..15 - 0: IDENT@10..15 "Error" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@15..22 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@16..21 - 0: JS_STRING_LITERAL_EXPRESSION@16..21 - 0: JS_STRING_LITERAL@16..21 "\"foo\"" [] [] - 2: R_PAREN@21..22 ")" [] [] - 2: SEMICOLON@22..23 ";" [] [] - 1: JS_THROW_STATEMENT@23..35 - 0: THROW_KW@23..30 "throw" [Newline("\n")] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@30..35 - 0: JS_STRING_LITERAL@30..35 "\"foo\"" [] [] - 2: (empty) - 4: EOF@35..36 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/try_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/try_stmt.rast deleted file mode 100644 index 8537a8868696..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/try_stmt.rast +++ /dev/null @@ -1,217 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsTryStatement { - try_token: TRY_KW@0..4 "try" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@4..5 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@7..13 "catch" [] [Whitespace(" ")], - declaration: missing (optional), - body: JsBlockStatement { - l_curly_token: L_CURLY@13..14 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@14..15 "}" [] [], - }, - }, - }, - JsTryStatement { - try_token: TRY_KW@15..20 "try" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@20..21 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@21..23 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@23..29 "catch" [] [Whitespace(" ")], - declaration: JsCatchDeclaration { - l_paren_token: L_PAREN@29..30 "(" [] [], - binding: JsIdentifierBinding { - name_token: IDENT@30..31 "e" [] [], - }, - type_annotation: missing (optional), - r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], - }, - body: JsBlockStatement { - l_curly_token: L_CURLY@33..34 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - }, - JsTryFinallyStatement { - try_token: TRY_KW@35..40 "try" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@40..41 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@41..43 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@43..49 "catch" [] [Whitespace(" ")], - declaration: missing (optional), - body: JsBlockStatement { - l_curly_token: L_CURLY@49..50 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@50..52 "}" [] [Whitespace(" ")], - }, - }, - finally_clause: JsFinallyClause { - finally_token: FINALLY_KW@52..60 "finally" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@60..61 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@61..62 "}" [] [], - }, - }, - }, - JsTryFinallyStatement { - try_token: TRY_KW@62..67 "try" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@67..68 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@68..70 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@70..76 "catch" [] [Whitespace(" ")], - declaration: JsCatchDeclaration { - l_paren_token: L_PAREN@76..77 "(" [] [], - binding: JsIdentifierBinding { - name_token: IDENT@77..78 "e" [] [], - }, - type_annotation: missing (optional), - r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], - }, - body: JsBlockStatement { - l_curly_token: L_CURLY@80..81 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@81..83 "}" [] [Whitespace(" ")], - }, - }, - finally_clause: JsFinallyClause { - finally_token: FINALLY_KW@83..91 "finally" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@91..92 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - }, - }, - JsTryFinallyStatement { - try_token: TRY_KW@93..98 "try" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@98..99 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@99..101 "}" [] [Whitespace(" ")], - }, - catch_clause: missing (optional), - finally_clause: JsFinallyClause { - finally_token: FINALLY_KW@101..109 "finally" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@109..110 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@110..111 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@111..112 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..112 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..111 - 0: JS_TRY_STATEMENT@0..15 - 0: TRY_KW@0..4 "try" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@4..7 - 0: L_CURLY@4..5 "{" [] [] - 1: JS_STATEMENT_LIST@5..5 - 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@7..15 - 0: CATCH_KW@7..13 "catch" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BLOCK_STATEMENT@13..15 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_STATEMENT_LIST@14..14 - 2: R_CURLY@14..15 "}" [] [] - 1: JS_TRY_STATEMENT@15..35 - 0: TRY_KW@15..20 "try" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@20..23 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_STATEMENT_LIST@21..21 - 2: R_CURLY@21..23 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@23..35 - 0: CATCH_KW@23..29 "catch" [] [Whitespace(" ")] - 1: JS_CATCH_DECLARATION@29..33 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "e" [] [] - 2: (empty) - 3: R_PAREN@31..33 ")" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@33..35 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_STATEMENT_LIST@34..34 - 2: R_CURLY@34..35 "}" [] [] - 2: JS_TRY_FINALLY_STATEMENT@35..62 - 0: TRY_KW@35..40 "try" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@40..43 - 0: L_CURLY@40..41 "{" [] [] - 1: JS_STATEMENT_LIST@41..41 - 2: R_CURLY@41..43 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@43..52 - 0: CATCH_KW@43..49 "catch" [] [Whitespace(" ")] - 1: (empty) - 2: JS_BLOCK_STATEMENT@49..52 - 0: L_CURLY@49..50 "{" [] [] - 1: JS_STATEMENT_LIST@50..50 - 2: R_CURLY@50..52 "}" [] [Whitespace(" ")] - 3: JS_FINALLY_CLAUSE@52..62 - 0: FINALLY_KW@52..60 "finally" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@60..62 - 0: L_CURLY@60..61 "{" [] [] - 1: JS_STATEMENT_LIST@61..61 - 2: R_CURLY@61..62 "}" [] [] - 3: JS_TRY_FINALLY_STATEMENT@62..93 - 0: TRY_KW@62..67 "try" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@67..70 - 0: L_CURLY@67..68 "{" [] [] - 1: JS_STATEMENT_LIST@68..68 - 2: R_CURLY@68..70 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@70..83 - 0: CATCH_KW@70..76 "catch" [] [Whitespace(" ")] - 1: JS_CATCH_DECLARATION@76..80 - 0: L_PAREN@76..77 "(" [] [] - 1: JS_IDENTIFIER_BINDING@77..78 - 0: IDENT@77..78 "e" [] [] - 2: (empty) - 3: R_PAREN@78..80 ")" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@80..83 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_STATEMENT_LIST@81..81 - 2: R_CURLY@81..83 "}" [] [Whitespace(" ")] - 3: JS_FINALLY_CLAUSE@83..93 - 0: FINALLY_KW@83..91 "finally" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@91..93 - 0: L_CURLY@91..92 "{" [] [] - 1: JS_STATEMENT_LIST@92..92 - 2: R_CURLY@92..93 "}" [] [] - 4: JS_TRY_FINALLY_STATEMENT@93..111 - 0: TRY_KW@93..98 "try" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@98..101 - 0: L_CURLY@98..99 "{" [] [] - 1: JS_STATEMENT_LIST@99..99 - 2: R_CURLY@99..101 "}" [] [Whitespace(" ")] - 2: (empty) - 3: JS_FINALLY_CLAUSE@101..111 - 0: FINALLY_KW@101..109 "finally" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@109..111 - 0: L_CURLY@109..110 "{" [] [] - 1: JS_STATEMENT_LIST@110..110 - 2: R_CURLY@110..111 "}" [] [] - 4: EOF@111..112 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.rast b/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.rast deleted file mode 100644 index a1769ee6ef72..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.rast +++ /dev/null @@ -1,670 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@19..29 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@29..35 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@35..51 "ConcreteMembers" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@51..52 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@52..61 "name" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@61..63 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@63..69 "string" [] [], - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@69..70 ";" [] [], - }, - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@70..86 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@86..87 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@87..91 "name" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@91..93 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@93..99 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@101..103 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsThisExpression { - this_token: THIS_KW@103..107 "this" [] [], - }, - dot_token: DOT@107..108 "." [] [], - member: JsName { - value_token: IDENT@108..113 "name" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@113..115 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@115..119 "name" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@119..121 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@121..122 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@122..134 "display" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@134..135 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@135..136 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@136..138 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@138..143 "void" [] [Whitespace(" ")], - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@143..145 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@145..152 "console" [] [], - }, - }, - operator_token: DOT@152..153 "." [] [], - member: JsName { - value_token: IDENT@153..156 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@156..157 "(" [] [], - args: JsCallArgumentList [ - JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@157..161 "this" [] [], - }, - operator_token: DOT@161..162 "." [] [], - member: JsName { - value_token: IDENT@162..166 "name" [] [], - }, - }, - ], - r_paren_token: R_PAREN@166..167 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@167..169 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@169..170 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@170..182 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - get_token: GET_KW@182..186 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@186..193 "my_name" [] [], - }, - l_paren_token: L_PAREN@193..194 "(" [] [], - r_paren_token: R_PAREN@194..196 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@196..198 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@198..205 "return" [] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@205..209 "this" [] [], - }, - operator_token: DOT@209..210 "." [] [], - member: JsName { - value_token: IDENT@210..214 "name" [] [], - }, - }, - semicolon_token: SEMICOLON@214..216 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@216..217 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@217..229 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - set_token: SET_KW@229..233 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@233..240 "my_name" [] [], - }, - l_paren_token: L_PAREN@240..241 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@241..245 "name" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@247..249 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsStaticMemberAssignment { - object: JsThisExpression { - this_token: THIS_KW@249..253 "this" [] [], - }, - dot_token: DOT@253..254 "." [] [], - member: JsName { - value_token: IDENT@254..259 "name" [] [Whitespace(" ")], - }, - }, - operator_token: EQ@259..261 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@261..265 "name" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@265..267 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@267..268 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsPrivateClassMemberName { - hash_token: HASH@268..274 "#" [Newline("\n"), Whitespace(" ")] [], - id_token: IDENT@274..288 "private_method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@288..289 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@289..291 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@291..293 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@293..294 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@294..296 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@296..306 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@306..312 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@312..328 "AbstractMembers" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@328..329 "{" [] [], - members: JsClassMemberList [ - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@329..343 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@343..347 "name" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@347..349 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@349..355 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@355..356 ";" [] [], - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@356..370 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@370..377 "display" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@377..378 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@378..379 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: SEMICOLON@379..380 ";" [] [], - }, - TsGetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@380..394 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - get_token: GET_KW@394..398 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@398..405 "my_name" [] [], - }, - l_paren_token: L_PAREN@405..406 "(" [] [], - r_paren_token: R_PAREN@406..407 ")" [] [], - return_type: missing (optional), - semicolon_token: SEMICOLON@407..408 ";" [] [], - }, - TsSetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@408..422 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - set_token: SET_KW@422..426 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@426..433 "my_name" [] [], - }, - l_paren_token: L_PAREN@433..434 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@434..437 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@437..438 ")" [] [], - semicolon_token: SEMICOLON@438..439 ";" [] [], - }, - TsSetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@439..453 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - set_token: SET_KW@453..457 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@457..463 "my_age" [] [], - }, - l_paren_token: L_PAREN@463..464 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@464..467 "age" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: COMMA@467..468 "," [] [], - r_paren_token: R_PAREN@468..469 ")" [] [], - semicolon_token: SEMICOLON@469..470 ";" [] [], - }, - ], - r_curly_token: R_CURLY@470..472 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@472..473 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..473 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..472 - 0: JS_CLASS_DECLARATION@0..19 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..18 - 9: R_CURLY@18..19 "}" [] [] - 1: JS_CLASS_DECLARATION@19..296 - 0: JS_DECORATOR_LIST@19..19 - 1: ABSTRACT_KW@19..29 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@29..35 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@35..51 - 0: IDENT@35..51 "ConcreteMembers" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@51..52 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@52..294 - 0: JS_PROPERTY_CLASS_MEMBER@52..70 - 0: JS_PROPERTY_MODIFIER_LIST@52..52 - 1: JS_LITERAL_MEMBER_NAME@52..61 - 0: IDENT@52..61 "name" [Newline("\n"), Whitespace(" ")] [] - 2: TS_TYPE_ANNOTATION@61..69 - 0: COLON@61..63 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@63..69 - 0: STRING_KW@63..69 "string" [] [] - 3: (empty) - 4: SEMICOLON@69..70 ";" [] [] - 1: JS_CONSTRUCTOR_CLASS_MEMBER@70..122 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@70..70 - 1: JS_LITERAL_MEMBER_NAME@70..86 - 0: IDENT@70..86 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@86..101 - 0: L_PAREN@86..87 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@87..99 - 0: JS_FORMAL_PARAMETER@87..99 - 0: JS_DECORATOR_LIST@87..87 - 1: JS_IDENTIFIER_BINDING@87..91 - 0: IDENT@87..91 "name" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@91..99 - 0: COLON@91..93 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@93..99 - 0: STRING_KW@93..99 "string" [] [] - 4: (empty) - 2: R_PAREN@99..101 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@101..122 - 0: L_CURLY@101..103 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@103..103 - 2: JS_STATEMENT_LIST@103..121 - 0: JS_EXPRESSION_STATEMENT@103..121 - 0: JS_ASSIGNMENT_EXPRESSION@103..119 - 0: JS_STATIC_MEMBER_ASSIGNMENT@103..113 - 0: JS_THIS_EXPRESSION@103..107 - 0: THIS_KW@103..107 "this" [] [] - 1: DOT@107..108 "." [] [] - 2: JS_NAME@108..113 - 0: IDENT@108..113 "name" [] [Whitespace(" ")] - 1: EQ@113..115 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@115..119 - 0: JS_REFERENCE_IDENTIFIER@115..119 - 0: IDENT@115..119 "name" [] [] - 1: SEMICOLON@119..121 ";" [] [Whitespace(" ")] - 3: R_CURLY@121..122 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@122..170 - 0: JS_METHOD_MODIFIER_LIST@122..122 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@122..134 - 0: IDENT@122..134 "display" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@134..136 - 0: L_PAREN@134..135 "(" [] [] - 1: JS_PARAMETER_LIST@135..135 - 2: R_PAREN@135..136 ")" [] [] - 7: TS_RETURN_TYPE_ANNOTATION@136..143 - 0: COLON@136..138 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@138..143 - 0: VOID_KW@138..143 "void" [] [Whitespace(" ")] - 8: JS_FUNCTION_BODY@143..170 - 0: L_CURLY@143..145 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@145..145 - 2: JS_STATEMENT_LIST@145..169 - 0: JS_EXPRESSION_STATEMENT@145..169 - 0: JS_CALL_EXPRESSION@145..167 - 0: JS_STATIC_MEMBER_EXPRESSION@145..156 - 0: JS_IDENTIFIER_EXPRESSION@145..152 - 0: JS_REFERENCE_IDENTIFIER@145..152 - 0: IDENT@145..152 "console" [] [] - 1: DOT@152..153 "." [] [] - 2: JS_NAME@153..156 - 0: IDENT@153..156 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@156..167 - 0: L_PAREN@156..157 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@157..166 - 0: JS_STATIC_MEMBER_EXPRESSION@157..166 - 0: JS_THIS_EXPRESSION@157..161 - 0: THIS_KW@157..161 "this" [] [] - 1: DOT@161..162 "." [] [] - 2: JS_NAME@162..166 - 0: IDENT@162..166 "name" [] [] - 2: R_PAREN@166..167 ")" [] [] - 1: SEMICOLON@167..169 ";" [] [Whitespace(" ")] - 3: R_CURLY@169..170 "}" [] [] - 3: JS_GETTER_CLASS_MEMBER@170..217 - 0: JS_METHOD_MODIFIER_LIST@170..182 - 0: TS_ACCESSIBILITY_MODIFIER@170..182 - 0: PUBLIC_KW@170..182 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@182..186 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@186..193 - 0: IDENT@186..193 "my_name" [] [] - 3: L_PAREN@193..194 "(" [] [] - 4: R_PAREN@194..196 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@196..217 - 0: L_CURLY@196..198 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@198..198 - 2: JS_STATEMENT_LIST@198..216 - 0: JS_RETURN_STATEMENT@198..216 - 0: RETURN_KW@198..205 "return" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@205..214 - 0: JS_THIS_EXPRESSION@205..209 - 0: THIS_KW@205..209 "this" [] [] - 1: DOT@209..210 "." [] [] - 2: JS_NAME@210..214 - 0: IDENT@210..214 "name" [] [] - 2: SEMICOLON@214..216 ";" [] [Whitespace(" ")] - 3: R_CURLY@216..217 "}" [] [] - 4: JS_SETTER_CLASS_MEMBER@217..268 - 0: JS_METHOD_MODIFIER_LIST@217..229 - 0: TS_ACCESSIBILITY_MODIFIER@217..229 - 0: PUBLIC_KW@217..229 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@229..233 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@233..240 - 0: IDENT@233..240 "my_name" [] [] - 3: L_PAREN@240..241 "(" [] [] - 4: JS_FORMAL_PARAMETER@241..245 - 0: JS_DECORATOR_LIST@241..241 - 1: JS_IDENTIFIER_BINDING@241..245 - 0: IDENT@241..245 "name" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@245..247 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@247..268 - 0: L_CURLY@247..249 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@249..249 - 2: JS_STATEMENT_LIST@249..267 - 0: JS_EXPRESSION_STATEMENT@249..267 - 0: JS_ASSIGNMENT_EXPRESSION@249..265 - 0: JS_STATIC_MEMBER_ASSIGNMENT@249..259 - 0: JS_THIS_EXPRESSION@249..253 - 0: THIS_KW@249..253 "this" [] [] - 1: DOT@253..254 "." [] [] - 2: JS_NAME@254..259 - 0: IDENT@254..259 "name" [] [Whitespace(" ")] - 1: EQ@259..261 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@261..265 - 0: JS_REFERENCE_IDENTIFIER@261..265 - 0: IDENT@261..265 "name" [] [] - 1: SEMICOLON@265..267 ";" [] [Whitespace(" ")] - 3: R_CURLY@267..268 "}" [] [] - 5: JS_METHOD_CLASS_MEMBER@268..294 - 0: JS_METHOD_MODIFIER_LIST@268..268 - 1: (empty) - 2: (empty) - 3: JS_PRIVATE_CLASS_MEMBER_NAME@268..288 - 0: HASH@268..274 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@274..288 "private_method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@288..291 - 0: L_PAREN@288..289 "(" [] [] - 1: JS_PARAMETER_LIST@289..289 - 2: R_PAREN@289..291 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@291..294 - 0: L_CURLY@291..293 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@293..293 - 2: JS_STATEMENT_LIST@293..293 - 3: R_CURLY@293..294 "}" [] [] - 9: R_CURLY@294..296 "}" [Newline("\n")] [] - 2: JS_CLASS_DECLARATION@296..472 - 0: JS_DECORATOR_LIST@296..296 - 1: ABSTRACT_KW@296..306 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@306..312 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@312..328 - 0: IDENT@312..328 "AbstractMembers" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@328..329 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@329..470 - 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@329..356 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@329..343 - 0: TS_ABSTRACT_MODIFIER@329..343 - 0: ABSTRACT_KW@329..343 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@343..347 - 0: IDENT@343..347 "name" [] [] - 2: TS_TYPE_ANNOTATION@347..355 - 0: COLON@347..349 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@349..355 - 0: STRING_KW@349..355 "string" [] [] - 3: SEMICOLON@355..356 ";" [] [] - 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@356..380 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@356..370 - 0: TS_ABSTRACT_MODIFIER@356..370 - 0: ABSTRACT_KW@356..370 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@370..377 - 0: IDENT@370..377 "display" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@377..379 - 0: L_PAREN@377..378 "(" [] [] - 1: JS_PARAMETER_LIST@378..378 - 2: R_PAREN@378..379 ")" [] [] - 6: (empty) - 7: SEMICOLON@379..380 ";" [] [] - 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@380..408 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@380..394 - 0: TS_ABSTRACT_MODIFIER@380..394 - 0: ABSTRACT_KW@380..394 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: GET_KW@394..398 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@398..405 - 0: IDENT@398..405 "my_name" [] [] - 3: L_PAREN@405..406 "(" [] [] - 4: R_PAREN@406..407 ")" [] [] - 5: (empty) - 6: SEMICOLON@407..408 ";" [] [] - 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@408..439 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@408..422 - 0: TS_ABSTRACT_MODIFIER@408..422 - 0: ABSTRACT_KW@408..422 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@422..426 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@426..433 - 0: IDENT@426..433 "my_name" [] [] - 3: L_PAREN@433..434 "(" [] [] - 4: JS_FORMAL_PARAMETER@434..437 - 0: JS_DECORATOR_LIST@434..434 - 1: JS_IDENTIFIER_BINDING@434..437 - 0: IDENT@434..437 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@437..438 ")" [] [] - 7: SEMICOLON@438..439 ";" [] [] - 4: TS_SETTER_SIGNATURE_CLASS_MEMBER@439..470 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@439..453 - 0: TS_ABSTRACT_MODIFIER@439..453 - 0: ABSTRACT_KW@439..453 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: SET_KW@453..457 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@457..463 - 0: IDENT@457..463 "my_age" [] [] - 3: L_PAREN@463..464 "(" [] [] - 4: JS_FORMAL_PARAMETER@464..467 - 0: JS_DECORATOR_LIST@464..464 - 1: JS_IDENTIFIER_BINDING@464..467 - 0: IDENT@464..467 "age" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: COMMA@467..468 "," [] [] - 6: R_PAREN@468..469 ")" [] [] - 7: SEMICOLON@469..470 ";" [] [] - 9: R_CURLY@470..472 "}" [Newline("\n")] [] - 4: EOF@472..473 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.rast b/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.rast deleted file mode 100644 index cf045f01e52a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.rast +++ /dev/null @@ -1,75 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [ - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAbstractModifier { - modifier_token: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@33..37 "name" [] [], - }, - property_annotation: TsOptionalPropertyAnnotation { - question_mark_token: QUESTION@37..38 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@40..46 "string" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - ], - r_curly_token: R_CURLY@47..49 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@49..50 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..50 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..49 - 0: JS_CLASS_DECLARATION@0..49 - 0: JS_DECORATOR_LIST@0..0 - 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..47 - 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@18..47 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..33 - 0: TS_ABSTRACT_MODIFIER@18..33 - 0: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@33..37 - 0: IDENT@33..37 "name" [] [] - 2: TS_OPTIONAL_PROPERTY_ANNOTATION@37..46 - 0: QUESTION@37..38 "?" [] [] - 1: TS_TYPE_ANNOTATION@38..46 - 0: COLON@38..40 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@40..46 - 0: STRING_KW@40..46 "string" [] [] - 3: SEMICOLON@46..47 ";" [] [] - 9: R_CURLY@47..49 "}" [Newline("\n")] [] - 4: EOF@49..50 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast b/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast deleted file mode 100644 index 9be5b1bdee7c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast +++ /dev/null @@ -1,97 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@15..17 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@17..18 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@18..20 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@20..21 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@21..23 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@23..25 "d" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@25..27 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@27..33 "\"test\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - }, - ], - eof_token: EOF@34..35 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..35 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..34 - 0: TS_DECLARE_STATEMENT@0..34 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@8..34 - 0: JS_VARIABLE_DECLARATION@8..33 - 0: (empty) - 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..33 - 0: JS_VARIABLE_DECLARATOR@14..15 - 0: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@15..17 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@17..18 - 0: JS_IDENTIFIER_BINDING@17..18 - 0: IDENT@17..18 "b" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@18..20 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@20..21 - 0: JS_IDENTIFIER_BINDING@20..21 - 0: IDENT@20..21 "c" [] [] - 1: (empty) - 2: (empty) - 5: COMMA@21..23 "," [] [Whitespace(" ")] - 6: JS_VARIABLE_DECLARATOR@23..33 - 0: JS_IDENTIFIER_BINDING@23..25 - 0: IDENT@23..25 "d" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@25..33 - 0: EQ@25..27 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@27..33 - 0: JS_STRING_LITERAL@27..33 "\"test\"" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 4: EOF@34..35 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.rast b/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.rast deleted file mode 100644 index 3e114785ffe5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.rast +++ /dev/null @@ -1,131 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@8..13 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@13..15 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@17..18 "X" [] [], - }, - initializer: missing (optional), - }, - COMMA@18..20 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@20..21 "Y" [] [], - }, - initializer: missing (optional), - }, - COMMA@21..23 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@23..25 "Z" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@25..26 "}" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@26..35 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsEnumDeclaration { - const_token: CONST_KW@35..41 "const" [] [Whitespace(" ")], - enum_token: ENUM_KW@41..46 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@46..48 "B" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@50..51 "X" [] [], - }, - initializer: missing (optional), - }, - COMMA@51..53 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@53..54 "Y" [] [], - }, - initializer: missing (optional), - }, - COMMA@54..56 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@56..58 "Z" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@58..59 "}" [] [], - }, - }, - ], - eof_token: EOF@59..60 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..60 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..59 - 0: TS_DECLARE_STATEMENT@0..26 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_ENUM_DECLARATION@8..26 - 0: (empty) - 1: ENUM_KW@8..13 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@13..15 - 0: IDENT@13..15 "A" [] [Whitespace(" ")] - 3: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@17..25 - 0: TS_ENUM_MEMBER@17..18 - 0: TS_LITERAL_ENUM_MEMBER_NAME@17..18 - 0: IDENT@17..18 "X" [] [] - 1: (empty) - 1: COMMA@18..20 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@20..21 - 0: TS_LITERAL_ENUM_MEMBER_NAME@20..21 - 0: IDENT@20..21 "Y" [] [] - 1: (empty) - 3: COMMA@21..23 "," [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER@23..25 - 0: TS_LITERAL_ENUM_MEMBER_NAME@23..25 - 0: IDENT@23..25 "Z" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@25..26 "}" [] [] - 1: TS_DECLARE_STATEMENT@26..59 - 0: DECLARE_KW@26..35 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_ENUM_DECLARATION@35..59 - 0: CONST_KW@35..41 "const" [] [Whitespace(" ")] - 1: ENUM_KW@41..46 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@46..48 - 0: IDENT@46..48 "B" [] [Whitespace(" ")] - 3: L_CURLY@48..50 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@50..58 - 0: TS_ENUM_MEMBER@50..51 - 0: TS_LITERAL_ENUM_MEMBER_NAME@50..51 - 0: IDENT@50..51 "X" [] [] - 1: (empty) - 1: COMMA@51..53 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@53..54 - 0: TS_LITERAL_ENUM_MEMBER_NAME@53..54 - 0: IDENT@53..54 "Y" [] [] - 1: (empty) - 3: COMMA@54..56 "," [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER@56..58 - 0: TS_LITERAL_ENUM_MEMBER_NAME@56..58 - 0: IDENT@56..58 "Z" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@58..59 "}" [] [] - 4: EOF@59..60 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.rast b/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.rast deleted file mode 100644 index ef3d8555e563..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.rast +++ /dev/null @@ -1,75 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@15..17 "a" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@17..18 "{" [] [], - items: JsModuleItemList [ - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@30..34 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@34..35 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@35..36 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@36..38 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@38..44 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - ], - r_curly_token: R_CURLY@45..47 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: TS_DECLARE_STATEMENT@0..47 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..47 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "a" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@17..47 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_MODULE_ITEM_LIST@18..45 - 0: TS_DECLARE_FUNCTION_DECLARATION@18..45 - 0: (empty) - 1: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@30..34 - 0: IDENT@30..34 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@34..36 - 0: L_PAREN@34..35 "(" [] [] - 1: JS_PARAMETER_LIST@35..35 - 2: R_PAREN@35..36 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@36..44 - 0: COLON@36..38 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@38..44 - 0: STRING_KW@38..44 "string" [] [] - 6: SEMICOLON@44..45 ";" [] [] - 2: R_CURLY@45..47 "}" [Newline("\n")] [] - 4: EOF@47..48 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.rast b/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.rast deleted file mode 100644 index 3c21779bd863..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.rast +++ /dev/null @@ -1,89 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@8..18 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@18..20 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@22..23 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@25..31 "string" [] [], - }, - }, - separator_token: COMMA@31..33 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@33..34 "c" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@36..43 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@43..44 "}" [] [], - }, - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: TS_DECLARE_STATEMENT@0..44 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@8..44 - 0: INTERFACE_KW@8..18 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@18..20 - 0: IDENT@18..20 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@20..22 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@22..43 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@22..33 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@22..23 - 0: IDENT@22..23 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@23..31 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@25..31 - 0: STRING_KW@25..31 "string" [] [] - 4: COMMA@31..33 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@33..43 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@33..34 - 0: IDENT@33..34 "c" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@34..43 - 0: COLON@34..36 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@36..43 - 0: NUMBER_KW@36..43 "number" [] [Whitespace(" ")] - 4: (empty) - 6: R_CURLY@43..44 "}" [] [] - 4: EOF@44..45 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast b/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast deleted file mode 100644 index 2b5f20cbf344..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast +++ /dev/null @@ -1,89 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@8..12 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@12..13 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@13..15 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@15..16 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@16..18 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@18..19 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@19..21 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@21..22 "d" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - }, - ], - eof_token: EOF@23..24 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..24 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..23 - 0: TS_DECLARE_STATEMENT@0..23 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@8..23 - 0: JS_VARIABLE_DECLARATION@8..22 - 0: (empty) - 1: LET_KW@8..12 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@12..22 - 0: JS_VARIABLE_DECLARATOR@12..13 - 0: JS_IDENTIFIER_BINDING@12..13 - 0: IDENT@12..13 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@13..15 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@15..16 - 0: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "b" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@16..18 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@18..19 - 0: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "c" [] [] - 1: (empty) - 2: (empty) - 5: COMMA@19..21 "," [] [Whitespace(" ")] - 6: JS_VARIABLE_DECLARATOR@21..22 - 0: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "d" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@22..23 ";" [] [] - 4: EOF@23..24 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast b/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast deleted file mode 100644 index 921e99ed1b5a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast +++ /dev/null @@ -1,75 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@8..12 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@12..13 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@13..15 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@15..16 "b" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@16..18 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@18..19 "c" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - }, - ], - eof_token: EOF@20..21 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..21 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..20 - 0: TS_DECLARE_STATEMENT@0..20 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@8..20 - 0: JS_VARIABLE_DECLARATION@8..19 - 0: (empty) - 1: VAR_KW@8..12 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@12..19 - 0: JS_VARIABLE_DECLARATOR@12..13 - 0: JS_IDENTIFIER_BINDING@12..13 - 0: IDENT@12..13 "a" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@13..15 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@15..16 - 0: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "b" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@16..18 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@18..19 - 0: JS_IDENTIFIER_BINDING@18..19 - 0: IDENT@18..19 "c" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@19..20 ";" [] [] - 4: EOF@20..21 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_array_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_array_type.rast deleted file mode 100644 index 8018f0403f6b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_array_type.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsStringType { - string_token: STRING_KW@9..15 "string" [] [], - }, - l_brack_token: L_BRACK@15..16 "[" [] [], - r_brack_token: R_BRACK@16..17 "]" [] [], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@18..24 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@24..26 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@26..28 "=" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsObjectType { - l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@30..31 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@31..33 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@33..40 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@40..42 "}" [] [Whitespace(" ")], - }, - l_brack_token: L_BRACK@42..43 "[" [] [], - r_brack_token: R_BRACK@43..44 "]" [] [], - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - ], - eof_token: EOF@45..46 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..46 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..45 - 0: TS_TYPE_ALIAS_DECLARATION@0..18 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_ARRAY_TYPE@9..17 - 0: TS_STRING_TYPE@9..15 - 0: STRING_KW@9..15 "string" [] [] - 1: L_BRACK@15..16 "[" [] [] - 2: R_BRACK@16..17 "]" [] [] - 5: SEMICOLON@17..18 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@18..45 - 0: TYPE_KW@18..24 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@24..26 - 0: IDENT@24..26 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@26..28 "=" [] [Whitespace(" ")] - 4: TS_ARRAY_TYPE@28..44 - 0: TS_OBJECT_TYPE@28..42 - 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@30..40 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@30..40 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@30..31 - 0: IDENT@30..31 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@31..40 - 0: COLON@31..33 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@33..40 - 0: NUMBER_KW@33..40 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@40..42 "}" [] [Whitespace(" ")] - 1: L_BRACK@42..43 "[" [] [] - 2: R_BRACK@43..44 "]" [] [] - 5: SEMICOLON@44..45 ";" [] [] - 4: EOF@45..46 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.rast b/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.rast deleted file mode 100644 index 9c370a772485..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.rast +++ /dev/null @@ -1,77 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsConditionalExpression { - test: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..2 "a" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2..4 "?" [] [Whitespace(" ")], - consequent: JsParenthesizedExpression { - l_paren_token: L_PAREN@4..5 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@5..6 "b" [] [], - }, - }, - r_paren_token: R_PAREN@6..8 ")" [] [Whitespace(" ")], - }, - colon_token: COLON@8..10 ":" [] [Whitespace(" ")], - alternate: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@10..12 "a" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@15..16 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - ], - eof_token: EOF@18..19 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..19 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..18 - 0: JS_EXPRESSION_STATEMENT@0..18 - 0: JS_CONDITIONAL_EXPRESSION@0..17 - 0: JS_IDENTIFIER_EXPRESSION@0..2 - 0: JS_REFERENCE_IDENTIFIER@0..2 - 0: IDENT@0..2 "a" [] [Whitespace(" ")] - 1: QUESTION@2..4 "?" [] [Whitespace(" ")] - 2: JS_PARENTHESIZED_EXPRESSION@4..8 - 0: L_PAREN@4..5 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@5..6 - 0: JS_REFERENCE_IDENTIFIER@5..6 - 0: IDENT@5..6 "b" [] [] - 2: R_PAREN@6..8 ")" [] [Whitespace(" ")] - 3: COLON@8..10 ":" [] [Whitespace(" ")] - 4: JS_ARROW_FUNCTION_EXPRESSION@10..17 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "a" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@15..17 - 0: L_CURLY@15..16 "{" [] [] - 1: JS_DIRECTIVE_LIST@16..16 - 2: JS_STATEMENT_LIST@16..16 - 3: R_CURLY@16..17 "}" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 4: EOF@18..19 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast b/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast deleted file mode 100644 index 6edd1f7d1de6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast +++ /dev/null @@ -1,417 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@8..9 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@9..10 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@10..12 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@12..14 "B" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@22..23 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@25..27 "C" [] [Whitespace(" ")], - }, - constraint: missing (optional), - default: TsDefaultTypeClause { - eq_token: EQ@27..29 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@29..35 "string" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@35..36 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@37..38 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@40..41 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@41..43 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@43..44 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@44..46 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@46..47 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@47..49 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@49..50 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@50..52 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@52..53 "C" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@55..58 "=>" [] [Whitespace(" ")], - body: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@58..65 "\"hello\"" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@65..66 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@71..73 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@75..81 "async" [] [Whitespace(" ")], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@81..82 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@82..83 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@83..85 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@85..86 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@86..87 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@87..88 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@88..89 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@89..91 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@91..92 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@92..94 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@94..95 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@95..97 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@97..98 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@98..99 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@99..101 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@101..108 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@108..109 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@109..115 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@115..117 ">" [] [Whitespace(" ")], - }, - }, - }, - fat_arrow_token: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")], - body: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@120..127 "\"hello\"" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@127..128 ";" [] [], - }, - ], - eof_token: EOF@128..129 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..129 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..128 - 0: JS_VARIABLE_STATEMENT@0..66 - 0: JS_VARIABLE_DECLARATION@0..65 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..65 - 0: JS_VARIABLE_DECLARATOR@4..65 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..65 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@8..65 - 0: (empty) - 1: TS_TYPE_PARAMETERS@8..36 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@9..35 - 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 - 1: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@10..12 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@12..23 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@12..12 - 1: TS_TYPE_PARAMETER_NAME@12..14 - 0: IDENT@12..14 "B" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@14..23 - 0: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@22..23 - 0: JS_REFERENCE_IDENTIFIER@22..23 - 0: IDENT@22..23 "A" [] [] - 1: (empty) - 3: (empty) - 3: COMMA@23..25 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@25..35 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@25..25 - 1: TS_TYPE_PARAMETER_NAME@25..27 - 0: IDENT@25..27 "C" [] [Whitespace(" ")] - 2: (empty) - 3: TS_DEFAULT_TYPE_CLAUSE@27..35 - 0: EQ@27..29 "=" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@29..35 - 0: STRING_KW@29..35 "string" [] [] - 2: R_ANGLE@35..36 ">" [] [] - 2: JS_PARAMETERS@36..55 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_PARAMETER_LIST@37..53 - 0: JS_FORMAL_PARAMETER@37..41 - 0: JS_DECORATOR_LIST@37..37 - 1: JS_IDENTIFIER_BINDING@37..38 - 0: IDENT@37..38 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@38..41 - 0: COLON@38..40 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@40..41 - 0: JS_REFERENCE_IDENTIFIER@40..41 - 0: IDENT@40..41 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@41..43 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@43..47 - 0: JS_DECORATOR_LIST@43..43 - 1: JS_IDENTIFIER_BINDING@43..44 - 0: IDENT@43..44 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@44..47 - 0: COLON@44..46 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@46..47 - 0: JS_REFERENCE_IDENTIFIER@46..47 - 0: IDENT@46..47 "B" [] [] - 1: (empty) - 4: (empty) - 3: COMMA@47..49 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@49..53 - 0: JS_DECORATOR_LIST@49..49 - 1: JS_IDENTIFIER_BINDING@49..50 - 0: IDENT@49..50 "c" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@50..53 - 0: COLON@50..52 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@52..53 - 0: JS_REFERENCE_IDENTIFIER@52..53 - 0: IDENT@52..53 "C" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@55..58 "=>" [] [Whitespace(" ")] - 5: JS_STRING_LITERAL_EXPRESSION@58..65 - 0: JS_STRING_LITERAL@58..65 "\"hello\"" [] [] - 1: SEMICOLON@65..66 ";" [] [] - 1: JS_VARIABLE_STATEMENT@66..128 - 0: JS_VARIABLE_DECLARATION@66..127 - 0: (empty) - 1: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@71..127 - 0: JS_VARIABLE_DECLARATOR@71..127 - 0: JS_IDENTIFIER_BINDING@71..73 - 0: IDENT@71..73 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@73..127 - 0: EQ@73..75 "=" [] [Whitespace(" ")] - 1: JS_ARROW_FUNCTION_EXPRESSION@75..127 - 0: ASYNC_KW@75..81 "async" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETERS@81..87 - 0: L_ANGLE@81..82 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@82..86 - 0: TS_TYPE_PARAMETER@82..83 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@82..82 - 1: TS_TYPE_PARAMETER_NAME@82..83 - 0: IDENT@82..83 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@83..85 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@85..86 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@85..85 - 1: TS_TYPE_PARAMETER_NAME@85..86 - 0: IDENT@85..86 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@86..87 ">" [] [] - 2: JS_PARAMETERS@87..99 - 0: L_PAREN@87..88 "(" [] [] - 1: JS_PARAMETER_LIST@88..98 - 0: JS_FORMAL_PARAMETER@88..92 - 0: JS_DECORATOR_LIST@88..88 - 1: JS_IDENTIFIER_BINDING@88..89 - 0: IDENT@88..89 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@89..92 - 0: COLON@89..91 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@91..92 - 0: JS_REFERENCE_IDENTIFIER@91..92 - 0: IDENT@91..92 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@92..94 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@94..98 - 0: JS_DECORATOR_LIST@94..94 - 1: JS_IDENTIFIER_BINDING@94..95 - 0: IDENT@94..95 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@95..98 - 0: COLON@95..97 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@97..98 - 0: JS_REFERENCE_IDENTIFIER@97..98 - 0: IDENT@97..98 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@98..99 ")" [] [] - 3: TS_RETURN_TYPE_ANNOTATION@99..117 - 0: COLON@99..101 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@101..117 - 0: JS_REFERENCE_IDENTIFIER@101..108 - 0: IDENT@101..108 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@108..117 - 0: L_ANGLE@108..109 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@109..115 - 0: TS_STRING_TYPE@109..115 - 0: STRING_KW@109..115 "string" [] [] - 2: R_ANGLE@115..117 ">" [] [Whitespace(" ")] - 4: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")] - 5: JS_STRING_LITERAL_EXPRESSION@120..127 - 0: JS_STRING_LITERAL@120..127 "\"hello\"" [] [] - 1: SEMICOLON@127..128 ";" [] [] - 4: EOF@128..129 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.rast b/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.rast deleted file mode 100644 index 210a8362d818..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.rast +++ /dev/null @@ -1,517 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@7..10 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@17..18 "B" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@18..19 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@19..20 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@26..27 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@27..29 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@29..31 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@33..35 "(" [Newline("\n")] [], - assignment: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@35..37 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@37..40 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@40..46 "string" [] [], - }, - }, - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@48..50 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@50..58 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@59..61 "(" [Newline("\n")] [], - assignment: TsAsAssignment { - assignment: JsParenthesizedAssignment { - l_paren_token: L_PAREN@61..62 "(" [] [], - assignment: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@62..64 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@64..67 "as" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@67..70 "any" [] [], - }, - }, - r_paren_token: R_PAREN@70..72 ")" [] [Whitespace(" ")], - }, - as_token: AS_KW@72..75 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@75..81 "string" [] [], - }, - }, - r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@83..85 "=" [] [Whitespace(" ")], - right: JsNullLiteralExpression { - value_token: NULL_KW@85..89 "null" [] [], - }, - }, - semicolon_token: SEMICOLON@89..90 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@90..92 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@92..94 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@94..95 "b" [] [], - }, - colon_token: COLON@95..97 ":" [] [Whitespace(" ")], - pattern: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@97..99 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@99..102 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@102..109 "string" [] [Whitespace(" ")], - }, - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@109..111 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@111..113 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@113..115 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@115..116 "b" [] [], - }, - colon_token: COLON@116..118 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@118..125 "\"test\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - }, - r_paren_token: R_PAREN@126..127 ")" [] [], - }, - semicolon_token: SEMICOLON@127..128 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@128..130 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@130..132 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@132..134 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@134..137 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@137..144 "string" [] [Whitespace(" ")], - }, - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@144..146 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@146..148 "=" [] [Whitespace(" ")], - right: JsArrayExpression { - l_brack_token: L_BRACK@148..150 "[" [] [Whitespace(" ")], - elements: JsArrayElementList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@150..157 "\"test\"" [] [Whitespace(" ")], - }, - ], - r_brack_token: R_BRACK@157..158 "]" [] [], - }, - }, - r_paren_token: R_PAREN@158..159 ")" [] [], - }, - semicolon_token: SEMICOLON@159..160 ";" [] [], - }, - JsForInStatement { - for_token: FOR_KW@160..165 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@165..166 "(" [] [], - initializer: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@166..168 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@168..171 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@171..178 "string" [] [Whitespace(" ")], - }, - }, - in_token: IN_KW@178..181 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@181..182 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@182..183 "]" [] [], - }, - r_paren_token: R_PAREN@183..185 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@185..186 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@186..187 "}" [] [], - }, - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@187..189 "(" [Newline("\n")] [], - assignment: TsAsAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@189..191 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@191..194 "as" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@194..195 "B" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@195..196 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@196..202 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@202..203 ">" [] [], - }, - }, - }, - r_paren_token: R_PAREN@203..205 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@205..207 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@207..209 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@209..210 "a" [] [], - }, - colon_token: COLON@210..212 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@212..219 "\"test\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@219..220 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@220..221 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@221..223 "(" [Newline("\n")] [], - assignment: TsTypeAssertionAssignment { - l_angle_token: L_ANGLE@223..224 "<" [] [], - ty: TsNumberType { - number_token: NUMBER_KW@224..230 "number" [] [], - }, - r_angle_token: R_ANGLE@230..232 ">" [] [Whitespace(" ")], - assignment: JsIdentifierAssignment { - name_token: IDENT@232..233 "a" [] [], - }, - }, - r_paren_token: R_PAREN@233..235 ")" [] [Whitespace(" ")], - }, - operator_token: PLUSEQ@235..238 "+=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@238..239 "1" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@239..240 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..240 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..239 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_TYPE_ANNOTATION@5..10 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@7..10 - 0: ANY_KW@7..10 "any" [] [] - 2: (empty) - 1: SEMICOLON@10..11 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@11..33 - 0: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@17..18 - 0: IDENT@17..18 "B" [] [] - 2: TS_TYPE_PARAMETERS@18..22 - 0: L_ANGLE@18..19 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@19..20 - 0: TS_TYPE_PARAMETER@19..20 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 - 1: TS_TYPE_PARAMETER_NAME@19..20 - 0: IDENT@19..20 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] - 3: EQ@22..24 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@24..32 - 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@26..31 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@26..31 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@26..27 - 0: IDENT@26..27 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@27..31 - 0: COLON@27..29 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@29..31 - 0: JS_REFERENCE_IDENTIFIER@29..31 - 0: IDENT@29..31 "A" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 2: R_CURLY@31..32 "}" [] [] - 5: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..59 - 0: JS_ASSIGNMENT_EXPRESSION@33..58 - 0: JS_PARENTHESIZED_ASSIGNMENT@33..48 - 0: L_PAREN@33..35 "(" [Newline("\n")] [] - 1: TS_AS_ASSIGNMENT@35..46 - 0: JS_IDENTIFIER_ASSIGNMENT@35..37 - 0: IDENT@35..37 "a" [] [Whitespace(" ")] - 1: AS_KW@37..40 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@40..46 - 0: STRING_KW@40..46 "string" [] [] - 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 1: EQ@48..50 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@50..58 - 0: JS_STRING_LITERAL@50..58 "\"string\"" [] [] - 1: SEMICOLON@58..59 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@59..90 - 0: JS_ASSIGNMENT_EXPRESSION@59..89 - 0: JS_PARENTHESIZED_ASSIGNMENT@59..83 - 0: L_PAREN@59..61 "(" [Newline("\n")] [] - 1: TS_AS_ASSIGNMENT@61..81 - 0: JS_PARENTHESIZED_ASSIGNMENT@61..72 - 0: L_PAREN@61..62 "(" [] [] - 1: TS_AS_ASSIGNMENT@62..70 - 0: JS_IDENTIFIER_ASSIGNMENT@62..64 - 0: IDENT@62..64 "a" [] [Whitespace(" ")] - 1: AS_KW@64..67 "as" [] [Whitespace(" ")] - 2: TS_ANY_TYPE@67..70 - 0: ANY_KW@67..70 "any" [] [] - 2: R_PAREN@70..72 ")" [] [Whitespace(" ")] - 1: AS_KW@72..75 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@75..81 - 0: STRING_KW@75..81 "string" [] [] - 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] - 1: EQ@83..85 "=" [] [Whitespace(" ")] - 2: JS_NULL_LITERAL_EXPRESSION@85..89 - 0: NULL_KW@85..89 "null" [] [] - 1: SEMICOLON@89..90 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@90..128 - 0: JS_PARENTHESIZED_EXPRESSION@90..127 - 0: L_PAREN@90..92 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@92..126 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@92..111 - 0: L_CURLY@92..94 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@94..109 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@94..109 - 0: JS_LITERAL_MEMBER_NAME@94..95 - 0: IDENT@94..95 "b" [] [] - 1: COLON@95..97 ":" [] [Whitespace(" ")] - 2: TS_AS_ASSIGNMENT@97..109 - 0: JS_IDENTIFIER_ASSIGNMENT@97..99 - 0: IDENT@97..99 "a" [] [Whitespace(" ")] - 1: AS_KW@99..102 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@102..109 - 0: STRING_KW@102..109 "string" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@109..111 "}" [] [Whitespace(" ")] - 1: EQ@111..113 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@113..126 - 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@115..125 - 0: JS_PROPERTY_OBJECT_MEMBER@115..125 - 0: JS_LITERAL_MEMBER_NAME@115..116 - 0: IDENT@115..116 "b" [] [] - 1: COLON@116..118 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@118..125 - 0: JS_STRING_LITERAL@118..125 "\"test\"" [] [Whitespace(" ")] - 2: R_CURLY@125..126 "}" [] [] - 2: R_PAREN@126..127 ")" [] [] - 1: SEMICOLON@127..128 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@128..160 - 0: JS_PARENTHESIZED_EXPRESSION@128..159 - 0: L_PAREN@128..130 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@130..158 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@130..146 - 0: L_BRACK@130..132 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@132..144 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@132..144 - 0: TS_AS_ASSIGNMENT@132..144 - 0: JS_IDENTIFIER_ASSIGNMENT@132..134 - 0: IDENT@132..134 "a" [] [Whitespace(" ")] - 1: AS_KW@134..137 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@137..144 - 0: STRING_KW@137..144 "string" [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@144..146 "]" [] [Whitespace(" ")] - 1: EQ@146..148 "=" [] [Whitespace(" ")] - 2: JS_ARRAY_EXPRESSION@148..158 - 0: L_BRACK@148..150 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ELEMENT_LIST@150..157 - 0: JS_STRING_LITERAL_EXPRESSION@150..157 - 0: JS_STRING_LITERAL@150..157 "\"test\"" [] [Whitespace(" ")] - 2: R_BRACK@157..158 "]" [] [] - 2: R_PAREN@158..159 ")" [] [] - 1: SEMICOLON@159..160 ";" [] [] - 6: JS_FOR_IN_STATEMENT@160..187 - 0: FOR_KW@160..165 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@165..166 "(" [] [] - 2: TS_AS_ASSIGNMENT@166..178 - 0: JS_IDENTIFIER_ASSIGNMENT@166..168 - 0: IDENT@166..168 "a" [] [Whitespace(" ")] - 1: AS_KW@168..171 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@171..178 - 0: STRING_KW@171..178 "string" [] [Whitespace(" ")] - 3: IN_KW@178..181 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@181..183 - 0: L_BRACK@181..182 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@182..182 - 2: R_BRACK@182..183 "]" [] [] - 5: R_PAREN@183..185 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@185..187 - 0: L_CURLY@185..186 "{" [] [] - 1: JS_STATEMENT_LIST@186..186 - 2: R_CURLY@186..187 "}" [] [] - 7: JS_EXPRESSION_STATEMENT@187..221 - 0: JS_ASSIGNMENT_EXPRESSION@187..220 - 0: JS_PARENTHESIZED_ASSIGNMENT@187..205 - 0: L_PAREN@187..189 "(" [Newline("\n")] [] - 1: TS_AS_ASSIGNMENT@189..203 - 0: JS_IDENTIFIER_ASSIGNMENT@189..191 - 0: IDENT@189..191 "a" [] [Whitespace(" ")] - 1: AS_KW@191..194 "as" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@194..203 - 0: JS_REFERENCE_IDENTIFIER@194..195 - 0: IDENT@194..195 "B" [] [] - 1: TS_TYPE_ARGUMENTS@195..203 - 0: L_ANGLE@195..196 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@196..202 - 0: TS_STRING_TYPE@196..202 - 0: STRING_KW@196..202 "string" [] [] - 2: R_ANGLE@202..203 ">" [] [] - 2: R_PAREN@203..205 ")" [] [Whitespace(" ")] - 1: EQ@205..207 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@207..220 - 0: L_CURLY@207..209 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@209..219 - 0: JS_PROPERTY_OBJECT_MEMBER@209..219 - 0: JS_LITERAL_MEMBER_NAME@209..210 - 0: IDENT@209..210 "a" [] [] - 1: COLON@210..212 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@212..219 - 0: JS_STRING_LITERAL@212..219 "\"test\"" [] [Whitespace(" ")] - 2: R_CURLY@219..220 "}" [] [] - 1: SEMICOLON@220..221 ";" [] [] - 8: JS_EXPRESSION_STATEMENT@221..239 - 0: JS_ASSIGNMENT_EXPRESSION@221..239 - 0: JS_PARENTHESIZED_ASSIGNMENT@221..235 - 0: L_PAREN@221..223 "(" [Newline("\n")] [] - 1: TS_TYPE_ASSERTION_ASSIGNMENT@223..233 - 0: L_ANGLE@223..224 "<" [] [] - 1: TS_NUMBER_TYPE@224..230 - 0: NUMBER_KW@224..230 "number" [] [] - 2: R_ANGLE@230..232 ">" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_ASSIGNMENT@232..233 - 0: IDENT@232..233 "a" [] [] - 2: R_PAREN@233..235 ")" [] [Whitespace(" ")] - 1: PLUSEQ@235..238 "+=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@238..239 - 0: JS_NUMBER_LITERAL@238..239 "1" [] [] - 1: (empty) - 4: EOF@239..240 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.rast b/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.rast deleted file mode 100644 index 8530fb6e2da5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.rast +++ /dev/null @@ -1,290 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "x" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@7..11 "any" [] [Whitespace(" ")], - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@11..13 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@13..21 "\"string\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@27..29 "y" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@29..31 "=" [] [Whitespace(" ")], - expression: TsAsExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@31..33 "x" [] [Whitespace(" ")], - }, - }, - as_token: AS_KW@33..36 "as" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@36..42 "string" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@48..50 "z" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@50..52 "=" [] [Whitespace(" ")], - expression: TsAsExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@52..54 "x" [] [Whitespace(" ")], - }, - }, - as_token: AS_KW@54..57 "as" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@57..62 "const" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@62..63 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@63..68 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@68..89 "not_an_as_expression" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@89..91 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@91..92 "x" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@92..95 "as" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@95..96 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@96..101 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@101..112 "precedence" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@112..114 "=" [] [Whitespace(" ")], - expression: TsAsExpression { - expression: TsAsExpression { - expression: JsBinaryExpression { - left: TsAsExpression { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@114..122 "\"hello\"" [] [Whitespace(" ")], - }, - as_token: AS_KW@122..125 "as" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@125..131 "const" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - operator_token: PLUS@131..133 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@133..135 "3" [] [Whitespace(" ")], - }, - }, - as_token: AS_KW@135..138 "as" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@138..145 "number" [] [Whitespace(" ")], - }, - }, - as_token: AS_KW@145..148 "as" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@148..154 "number" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@154..155 ";" [] [], - }, - ], - eof_token: EOF@155..156 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..156 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..155 - 0: JS_VARIABLE_STATEMENT@0..22 - 0: JS_VARIABLE_DECLARATION@0..21 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..21 - 0: JS_VARIABLE_DECLARATOR@4..21 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "x" [] [] - 1: TS_TYPE_ANNOTATION@5..11 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@7..11 - 0: ANY_KW@7..11 "any" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@11..21 - 0: EQ@11..13 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@13..21 - 0: JS_STRING_LITERAL@13..21 "\"string\"" [] [] - 1: SEMICOLON@21..22 ";" [] [] - 1: JS_VARIABLE_STATEMENT@22..43 - 0: JS_VARIABLE_DECLARATION@22..42 - 0: (empty) - 1: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@27..42 - 0: JS_VARIABLE_DECLARATOR@27..42 - 0: JS_IDENTIFIER_BINDING@27..29 - 0: IDENT@27..29 "y" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@29..42 - 0: EQ@29..31 "=" [] [Whitespace(" ")] - 1: TS_AS_EXPRESSION@31..42 - 0: JS_IDENTIFIER_EXPRESSION@31..33 - 0: JS_REFERENCE_IDENTIFIER@31..33 - 0: IDENT@31..33 "x" [] [Whitespace(" ")] - 1: AS_KW@33..36 "as" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@36..42 - 0: STRING_KW@36..42 "string" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 2: JS_VARIABLE_STATEMENT@43..63 - 0: JS_VARIABLE_DECLARATION@43..62 - 0: (empty) - 1: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@48..62 - 0: JS_VARIABLE_DECLARATOR@48..62 - 0: JS_IDENTIFIER_BINDING@48..50 - 0: IDENT@48..50 "z" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@50..62 - 0: EQ@50..52 "=" [] [Whitespace(" ")] - 1: TS_AS_EXPRESSION@52..62 - 0: JS_IDENTIFIER_EXPRESSION@52..54 - 0: JS_REFERENCE_IDENTIFIER@52..54 - 0: IDENT@52..54 "x" [] [Whitespace(" ")] - 1: AS_KW@54..57 "as" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@57..62 - 0: JS_REFERENCE_IDENTIFIER@57..62 - 0: IDENT@57..62 "const" [] [] - 1: (empty) - 1: SEMICOLON@62..63 ";" [] [] - 3: JS_VARIABLE_STATEMENT@63..92 - 0: JS_VARIABLE_DECLARATION@63..92 - 0: (empty) - 1: LET_KW@63..68 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@68..92 - 0: JS_VARIABLE_DECLARATOR@68..92 - 0: JS_IDENTIFIER_BINDING@68..89 - 0: IDENT@68..89 "not_an_as_expression" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@89..92 - 0: EQ@89..91 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@91..92 - 0: JS_REFERENCE_IDENTIFIER@91..92 - 0: IDENT@91..92 "x" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@92..96 - 0: JS_IDENTIFIER_EXPRESSION@92..95 - 0: JS_REFERENCE_IDENTIFIER@92..95 - 0: IDENT@92..95 "as" [Newline("\n")] [] - 1: SEMICOLON@95..96 ";" [] [] - 5: JS_VARIABLE_STATEMENT@96..155 - 0: JS_VARIABLE_DECLARATION@96..154 - 0: (empty) - 1: LET_KW@96..101 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@101..154 - 0: JS_VARIABLE_DECLARATOR@101..154 - 0: JS_IDENTIFIER_BINDING@101..112 - 0: IDENT@101..112 "precedence" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@112..154 - 0: EQ@112..114 "=" [] [Whitespace(" ")] - 1: TS_AS_EXPRESSION@114..154 - 0: TS_AS_EXPRESSION@114..145 - 0: JS_BINARY_EXPRESSION@114..135 - 0: TS_AS_EXPRESSION@114..131 - 0: JS_STRING_LITERAL_EXPRESSION@114..122 - 0: JS_STRING_LITERAL@114..122 "\"hello\"" [] [Whitespace(" ")] - 1: AS_KW@122..125 "as" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@125..131 - 0: JS_REFERENCE_IDENTIFIER@125..131 - 0: IDENT@125..131 "const" [] [Whitespace(" ")] - 1: (empty) - 1: PLUS@131..133 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@133..135 - 0: JS_NUMBER_LITERAL@133..135 "3" [] [Whitespace(" ")] - 1: AS_KW@135..138 "as" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@138..145 - 0: NUMBER_KW@138..145 "number" [] [Whitespace(" ")] - 1: AS_KW@145..148 "as" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@148..154 - 0: NUMBER_KW@148..154 "number" [] [] - 1: SEMICOLON@154..155 ";" [] [] - 4: EOF@155..156 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast b/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast deleted file mode 100644 index 1a4c548c6d9a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast +++ /dev/null @@ -1,578 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@10..11 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@11..12 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@12..14 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@14..15 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@15..17 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@17..18 "C" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@18..19 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@19..20 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@22..23 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..26 "a" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@26..27 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@27..28 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@28..30 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@30..31 "B" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@31..33 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@33..34 "C" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@34..35 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@35..36 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@36..37 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsCallExpression { - callee: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@38..40 "(" [Newline("\n")] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@40..41 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@43..46 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@48..50 "a" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - }, - r_paren_token: R_PAREN@51..52 ")" [] [], - }, - operator_token: DOT@52..53 "." [] [], - member: JsName { - value_token: IDENT@53..54 "a" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@54..55 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@55..56 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@56..58 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@58..59 "B" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@59..61 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@61..62 "C" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@62..63 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@63..64 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@64..65 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@65..67 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@67..68 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@70..73 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@73..74 "a" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@74..75 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@75..76 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@76..77 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@77..79 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@79..80 "B" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@80..82 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@82..83 "C" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@83..84 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@84..85 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@85..86 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@86..87 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@93..94 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@94..95 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@95..96 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@96..98 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@98..100 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@100..101 "T" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@101..102 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@102..104 "a" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@104..105 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@105..106 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@106..107 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@107..108 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@108..109 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@109..112 "arg" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@112..114 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@114..115 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")], - return_type: TsNumberType { - number_token: NUMBER_KW@120..126 "number" [] [], - }, - }, - COMMA@126..128 "," [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@128..134 "number" [] [], - }, - COMMA@134..136 "," [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@136..142 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@142..143 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@143..144 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@144..145 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@145..146 ";" [] [], - }, - ], - eof_token: EOF@146..147 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..147 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..146 - 0: JS_FUNCTION_DECLARATION@0..24 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 4: TS_TYPE_PARAMETERS@10..19 - 0: L_ANGLE@10..11 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@11..18 - 0: TS_TYPE_PARAMETER@11..12 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@11..11 - 1: TS_TYPE_PARAMETER_NAME@11..12 - 0: IDENT@11..12 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@12..14 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@14..15 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@14..14 - 1: TS_TYPE_PARAMETER_NAME@14..15 - 0: IDENT@14..15 "B" [] [] - 2: (empty) - 3: (empty) - 3: COMMA@15..17 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@17..18 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@17..17 - 1: TS_TYPE_PARAMETER_NAME@17..18 - 0: IDENT@17..18 "C" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@18..19 ">" [] [] - 5: JS_PARAMETERS@19..22 - 0: L_PAREN@19..20 "(" [] [] - 1: JS_PARAMETER_LIST@20..20 - 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@22..24 - 0: L_CURLY@22..23 "{" [] [] - 1: JS_DIRECTIVE_LIST@23..23 - 2: JS_STATEMENT_LIST@23..23 - 3: R_CURLY@23..24 "}" [] [] - 1: JS_EXPRESSION_STATEMENT@24..38 - 0: JS_CALL_EXPRESSION@24..37 - 0: JS_IDENTIFIER_EXPRESSION@24..26 - 0: JS_REFERENCE_IDENTIFIER@24..26 - 0: IDENT@24..26 "a" [Newline("\n")] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@26..35 - 0: L_ANGLE@26..27 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@27..34 - 0: TS_REFERENCE_TYPE@27..28 - 0: JS_REFERENCE_IDENTIFIER@27..28 - 0: IDENT@27..28 "A" [] [] - 1: (empty) - 1: COMMA@28..30 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@30..31 - 0: JS_REFERENCE_IDENTIFIER@30..31 - 0: IDENT@30..31 "B" [] [] - 1: (empty) - 3: COMMA@31..33 "," [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@33..34 - 0: JS_REFERENCE_IDENTIFIER@33..34 - 0: IDENT@33..34 "C" [] [] - 1: (empty) - 2: R_ANGLE@34..35 ">" [] [] - 3: JS_CALL_ARGUMENTS@35..37 - 0: L_PAREN@35..36 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@36..36 - 2: R_PAREN@36..37 ")" [] [] - 1: SEMICOLON@37..38 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@38..87 - 0: JS_CALL_EXPRESSION@38..86 - 0: JS_CALL_EXPRESSION@38..75 - 0: JS_CALL_EXPRESSION@38..65 - 0: JS_STATIC_MEMBER_EXPRESSION@38..54 - 0: JS_PARENTHESIZED_EXPRESSION@38..52 - 0: L_PAREN@38..40 "(" [Newline("\n")] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@40..51 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@40..43 - 0: L_PAREN@40..41 "(" [] [] - 1: JS_PARAMETER_LIST@41..41 - 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@43..46 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@46..51 - 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..50 - 0: JS_EXPRESSION_STATEMENT@48..50 - 0: JS_IDENTIFIER_EXPRESSION@48..50 - 0: JS_REFERENCE_IDENTIFIER@48..50 - 0: IDENT@48..50 "a" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@50..51 "}" [] [] - 2: R_PAREN@51..52 ")" [] [] - 1: DOT@52..53 "." [] [] - 2: JS_NAME@53..54 - 0: IDENT@53..54 "a" [] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@54..63 - 0: L_ANGLE@54..55 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@55..62 - 0: TS_REFERENCE_TYPE@55..56 - 0: JS_REFERENCE_IDENTIFIER@55..56 - 0: IDENT@55..56 "A" [] [] - 1: (empty) - 1: COMMA@56..58 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@58..59 - 0: JS_REFERENCE_IDENTIFIER@58..59 - 0: IDENT@58..59 "B" [] [] - 1: (empty) - 3: COMMA@59..61 "," [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@61..62 - 0: JS_REFERENCE_IDENTIFIER@61..62 - 0: IDENT@61..62 "C" [] [] - 1: (empty) - 2: R_ANGLE@62..63 ">" [] [] - 3: JS_CALL_ARGUMENTS@63..65 - 0: L_PAREN@63..64 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@64..64 - 2: R_PAREN@64..65 ")" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@65..75 - 0: L_PAREN@65..67 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@67..74 - 0: JS_ARROW_FUNCTION_EXPRESSION@67..74 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@67..70 - 0: L_PAREN@67..68 "(" [] [] - 1: JS_PARAMETER_LIST@68..68 - 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@70..73 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@73..74 - 0: JS_REFERENCE_IDENTIFIER@73..74 - 0: IDENT@73..74 "a" [] [] - 2: R_PAREN@74..75 ")" [] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@75..84 - 0: L_ANGLE@75..76 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@76..83 - 0: TS_REFERENCE_TYPE@76..77 - 0: JS_REFERENCE_IDENTIFIER@76..77 - 0: IDENT@76..77 "A" [] [] - 1: (empty) - 1: COMMA@77..79 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@79..80 - 0: JS_REFERENCE_IDENTIFIER@79..80 - 0: IDENT@79..80 "B" [] [] - 1: (empty) - 3: COMMA@80..82 "," [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@82..83 - 0: JS_REFERENCE_IDENTIFIER@82..83 - 0: IDENT@82..83 "C" [] [] - 1: (empty) - 2: R_ANGLE@83..84 ">" [] [] - 3: JS_CALL_ARGUMENTS@84..86 - 0: L_PAREN@84..85 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@85..85 - 2: R_PAREN@85..86 ")" [] [] - 1: SEMICOLON@86..87 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@87..102 - 0: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@93..94 - 0: IDENT@93..94 "A" [] [] - 2: TS_TYPE_PARAMETERS@94..98 - 0: L_ANGLE@94..95 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@95..96 - 0: TS_TYPE_PARAMETER@95..96 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@95..95 - 1: TS_TYPE_PARAMETER_NAME@95..96 - 0: IDENT@95..96 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@96..98 ">" [] [Whitespace(" ")] - 3: EQ@98..100 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@100..101 - 0: JS_REFERENCE_IDENTIFIER@100..101 - 0: IDENT@100..101 "T" [] [] - 1: (empty) - 5: SEMICOLON@101..102 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@102..146 - 0: JS_CALL_EXPRESSION@102..145 - 0: JS_IDENTIFIER_EXPRESSION@102..104 - 0: JS_REFERENCE_IDENTIFIER@102..104 - 0: IDENT@102..104 "a" [Newline("\n")] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@104..143 - 0: L_ANGLE@104..105 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@105..142 - 0: TS_FUNCTION_TYPE@105..126 - 0: TS_TYPE_PARAMETERS@105..108 - 0: L_ANGLE@105..106 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@106..107 - 0: TS_TYPE_PARAMETER@106..107 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@106..106 - 1: TS_TYPE_PARAMETER_NAME@106..107 - 0: IDENT@106..107 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@107..108 ">" [] [] - 1: JS_PARAMETERS@108..117 - 0: L_PAREN@108..109 "(" [] [] - 1: JS_PARAMETER_LIST@109..115 - 0: JS_FORMAL_PARAMETER@109..115 - 0: JS_DECORATOR_LIST@109..109 - 1: JS_IDENTIFIER_BINDING@109..112 - 0: IDENT@109..112 "arg" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@112..115 - 0: COLON@112..114 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@114..115 - 0: JS_REFERENCE_IDENTIFIER@114..115 - 0: IDENT@114..115 "T" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@115..117 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")] - 3: TS_NUMBER_TYPE@120..126 - 0: NUMBER_KW@120..126 "number" [] [] - 1: COMMA@126..128 "," [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@128..134 - 0: NUMBER_KW@128..134 "number" [] [] - 3: COMMA@134..136 "," [] [Whitespace(" ")] - 4: TS_STRING_TYPE@136..142 - 0: STRING_KW@136..142 "string" [] [] - 2: R_ANGLE@142..143 ">" [] [] - 3: JS_CALL_ARGUMENTS@143..145 - 0: L_PAREN@143..144 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@144..144 - 2: R_PAREN@144..145 ")" [] [] - 1: SEMICOLON@145..146 ";" [] [] - 4: EOF@146..147 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.rast deleted file mode 100644 index f8dc98617455..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.rast +++ /dev/null @@ -1,433 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsCallSignatureTypeMember { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@11..12 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@12..13 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@15..21 "string" [] [], - }, - }, - separator_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@30..32 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@32..34 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsCallSignatureTypeMember { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@37..38 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@38..40 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@40..41 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@41..43 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@43..44 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@44..45 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@45..47 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@47..54 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@54..55 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@55..61 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@61..63 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@63..65 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@65..67 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsCallSignatureTypeMember { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@67..68 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@68..69 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@69..71 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@71..72 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@72..73 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@73..74 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@74..75 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@75..77 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@77..78 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@78..80 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@80..81 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@81..83 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@83..84 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@84..85 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@85..87 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@87..94 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@94..95 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@101..103 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@103..105 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@105..107 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsCallSignatureTypeMember { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@107..108 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@108..114 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@114..115 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@115..116 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@116..117 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@117..118 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@118..120 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@120..121 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@121..122 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@122..124 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@124..131 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@131..132 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@132..133 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..133 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..132 - 0: TS_TYPE_ALIAS_DECLARATION@0..24 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..24 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..23 - 0: TS_CALL_SIGNATURE_TYPE_MEMBER@11..23 - 0: (empty) - 1: JS_PARAMETERS@11..13 - 0: L_PAREN@11..12 "(" [] [] - 1: JS_PARAMETER_LIST@12..12 - 2: R_PAREN@12..13 ")" [] [] - 2: TS_RETURN_TYPE_ANNOTATION@13..21 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@15..21 - 0: STRING_KW@15..21 "string" [] [] - 3: SEMICOLON@21..23 ";" [] [Whitespace(" ")] - 2: R_CURLY@23..24 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@24..55 - 0: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@30..32 - 0: IDENT@30..32 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@32..34 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@34..55 - 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@36..54 - 0: TS_CALL_SIGNATURE_TYPE_MEMBER@36..54 - 0: (empty) - 1: JS_PARAMETERS@36..45 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_PARAMETER_LIST@37..44 - 0: JS_FORMAL_PARAMETER@37..38 - 0: JS_DECORATOR_LIST@37..37 - 1: JS_IDENTIFIER_BINDING@37..38 - 0: IDENT@37..38 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@38..40 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@40..41 - 0: JS_DECORATOR_LIST@40..40 - 1: JS_IDENTIFIER_BINDING@40..41 - 0: IDENT@40..41 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@41..43 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@43..44 - 0: JS_DECORATOR_LIST@43..43 - 1: JS_IDENTIFIER_BINDING@43..44 - 0: IDENT@43..44 "c" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@44..45 ")" [] [] - 2: TS_RETURN_TYPE_ANNOTATION@45..54 - 0: COLON@45..47 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@47..54 - 0: NUMBER_KW@47..54 "number" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@54..55 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@55..95 - 0: TYPE_KW@55..61 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@61..63 - 0: IDENT@61..63 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@63..65 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@65..95 - 0: L_CURLY@65..67 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@67..94 - 0: TS_CALL_SIGNATURE_TYPE_MEMBER@67..94 - 0: TS_TYPE_PARAMETERS@67..73 - 0: L_ANGLE@67..68 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@68..72 - 0: TS_TYPE_PARAMETER@68..69 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@68..68 - 1: TS_TYPE_PARAMETER_NAME@68..69 - 0: IDENT@68..69 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@69..71 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@71..72 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@71..71 - 1: TS_TYPE_PARAMETER_NAME@71..72 - 0: IDENT@71..72 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@72..73 ">" [] [] - 1: JS_PARAMETERS@73..85 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_PARAMETER_LIST@74..84 - 0: JS_FORMAL_PARAMETER@74..78 - 0: JS_DECORATOR_LIST@74..74 - 1: JS_IDENTIFIER_BINDING@74..75 - 0: IDENT@74..75 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@75..78 - 0: COLON@75..77 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@77..78 - 0: JS_REFERENCE_IDENTIFIER@77..78 - 0: IDENT@77..78 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@78..80 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@80..84 - 0: JS_DECORATOR_LIST@80..80 - 1: JS_IDENTIFIER_BINDING@80..81 - 0: IDENT@80..81 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@81..84 - 0: COLON@81..83 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@83..84 - 0: JS_REFERENCE_IDENTIFIER@83..84 - 0: IDENT@83..84 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@84..85 ")" [] [] - 2: TS_RETURN_TYPE_ANNOTATION@85..94 - 0: COLON@85..87 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@87..94 - 0: NUMBER_KW@87..94 "number" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@94..95 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@95..132 - 0: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@101..103 - 0: IDENT@101..103 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@103..105 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@105..132 - 0: L_CURLY@105..107 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@107..131 - 0: TS_CALL_SIGNATURE_TYPE_MEMBER@107..131 - 0: TS_TYPE_PARAMETERS@107..116 - 0: L_ANGLE@107..108 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@108..115 - 0: TS_TYPE_PARAMETER@108..115 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@108..114 - 0: TS_CONST_MODIFIER@108..114 - 0: CONST_KW@108..114 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@114..115 - 0: IDENT@114..115 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@115..116 ">" [] [] - 1: JS_PARAMETERS@116..122 - 0: L_PAREN@116..117 "(" [] [] - 1: JS_PARAMETER_LIST@117..121 - 0: JS_FORMAL_PARAMETER@117..121 - 0: JS_DECORATOR_LIST@117..117 - 1: JS_IDENTIFIER_BINDING@117..118 - 0: IDENT@117..118 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@118..121 - 0: COLON@118..120 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@120..121 - 0: JS_REFERENCE_IDENTIFIER@120..121 - 0: IDENT@120..121 "A" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@121..122 ")" [] [] - 2: TS_RETURN_TYPE_ANNOTATION@122..131 - 0: COLON@122..124 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@124..131 - 0: NUMBER_KW@124..131 "number" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@131..132 "}" [] [] - 5: (empty) - 4: EOF@132..133 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.rast deleted file mode 100644 index b1fde3853d6b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsTryStatement { - try_token: TRY_KW@0..4 "try" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@4..5 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@7..13 "catch" [] [Whitespace(" ")], - declaration: JsCatchDeclaration { - l_paren_token: L_PAREN@13..14 "(" [] [], - binding: JsIdentifierBinding { - name_token: IDENT@14..19 "error" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@19..21 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@21..24 "any" [] [], - }, - }, - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - }, - body: JsBlockStatement { - l_curly_token: L_CURLY@26..27 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - }, - }, - JsTryStatement { - try_token: TRY_KW@28..33 "try" [Newline("\n")] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@33..34 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@34..36 "}" [] [Whitespace(" ")], - }, - catch_clause: JsCatchClause { - catch_token: CATCH_KW@36..42 "catch" [] [Whitespace(" ")], - declaration: JsCatchDeclaration { - l_paren_token: L_PAREN@42..43 "(" [] [], - binding: JsIdentifierBinding { - name_token: IDENT@43..48 "error" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@48..50 ":" [] [Whitespace(" ")], - ty: TsUnknownType { - unknown_token: UNKNOWN_KW@50..57 "unknown" [] [], - }, - }, - r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], - }, - body: JsBlockStatement { - l_curly_token: L_CURLY@59..60 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@61..62 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..62 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..61 - 0: JS_TRY_STATEMENT@0..28 - 0: TRY_KW@0..4 "try" [] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@4..7 - 0: L_CURLY@4..5 "{" [] [] - 1: JS_STATEMENT_LIST@5..5 - 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@7..28 - 0: CATCH_KW@7..13 "catch" [] [Whitespace(" ")] - 1: JS_CATCH_DECLARATION@13..26 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_IDENTIFIER_BINDING@14..19 - 0: IDENT@14..19 "error" [] [] - 2: TS_TYPE_ANNOTATION@19..24 - 0: COLON@19..21 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@21..24 - 0: ANY_KW@21..24 "any" [] [] - 3: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@26..28 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_STATEMENT_LIST@27..27 - 2: R_CURLY@27..28 "}" [] [] - 1: JS_TRY_STATEMENT@28..61 - 0: TRY_KW@28..33 "try" [Newline("\n")] [Whitespace(" ")] - 1: JS_BLOCK_STATEMENT@33..36 - 0: L_CURLY@33..34 "{" [] [] - 1: JS_STATEMENT_LIST@34..34 - 2: R_CURLY@34..36 "}" [] [Whitespace(" ")] - 2: JS_CATCH_CLAUSE@36..61 - 0: CATCH_KW@36..42 "catch" [] [Whitespace(" ")] - 1: JS_CATCH_DECLARATION@42..59 - 0: L_PAREN@42..43 "(" [] [] - 1: JS_IDENTIFIER_BINDING@43..48 - 0: IDENT@43..48 "error" [] [] - 2: TS_TYPE_ANNOTATION@48..57 - 0: COLON@48..50 ":" [] [Whitespace(" ")] - 1: TS_UNKNOWN_TYPE@50..57 - 0: UNKNOWN_KW@50..57 "unknown" [] [] - 3: R_PAREN@57..59 ")" [] [Whitespace(" ")] - 2: JS_BLOCK_STATEMENT@59..61 - 0: L_CURLY@59..60 "{" [] [] - 1: JS_STATEMENT_LIST@60..60 - 2: R_CURLY@60..61 "}" [] [] - 4: EOF@61..62 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast b/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast deleted file mode 100644 index 24f5cb0325d2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast +++ /dev/null @@ -1,41 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..15 "abstract" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@15..16 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: JS_CLASS_DECLARATION@0..17 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..15 - 0: IDENT@6..15 "abstract" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@15..16 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@16..16 - 9: R_CURLY@16..17 "}" [] [] - 4: EOF@17..18 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.rast b/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.rast deleted file mode 100644 index 4b174ede3cec..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.rast +++ /dev/null @@ -1,132 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@9..13 "a" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@15..21 "string" [] [], - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@22..26 "b" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: TsOptionalPropertyAnnotation { - question_mark_token: QUESTION@26..27 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@27..29 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@29..36 "string" [] [Whitespace(" ")], - }, - }, - }, - value: JsInitializerClause { - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@38..44 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@45..49 "c" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: TsDefinitePropertyAnnotation { - excl_token: BANG@49..50 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@50..52 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@52..58 "string" [] [], - }, - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - ], - r_curly_token: R_CURLY@59..61 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@61..62 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..62 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..61 - 0: JS_CLASS_DECLARATION@0..61 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..59 - 0: JS_PROPERTY_CLASS_MEMBER@9..22 - 0: JS_PROPERTY_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..13 - 0: IDENT@9..13 "a" [Newline("\n"), Whitespace(" ")] [] - 2: TS_TYPE_ANNOTATION@13..21 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@15..21 - 0: STRING_KW@15..21 "string" [] [] - 3: (empty) - 4: SEMICOLON@21..22 ";" [] [] - 1: JS_PROPERTY_CLASS_MEMBER@22..45 - 0: JS_PROPERTY_MODIFIER_LIST@22..22 - 1: JS_LITERAL_MEMBER_NAME@22..26 - 0: IDENT@22..26 "b" [Newline("\n"), Whitespace(" ")] [] - 2: TS_OPTIONAL_PROPERTY_ANNOTATION@26..36 - 0: QUESTION@26..27 "?" [] [] - 1: TS_TYPE_ANNOTATION@27..36 - 0: COLON@27..29 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@29..36 - 0: STRING_KW@29..36 "string" [] [Whitespace(" ")] - 3: JS_INITIALIZER_CLAUSE@36..44 - 0: EQ@36..38 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@38..44 - 0: JS_STRING_LITERAL@38..44 "\"test\"" [] [] - 4: SEMICOLON@44..45 ";" [] [] - 2: JS_PROPERTY_CLASS_MEMBER@45..59 - 0: JS_PROPERTY_MODIFIER_LIST@45..45 - 1: JS_LITERAL_MEMBER_NAME@45..49 - 0: IDENT@45..49 "c" [Newline("\n"), Whitespace(" ")] [] - 2: TS_DEFINITE_PROPERTY_ANNOTATION@49..58 - 0: BANG@49..50 "!" [] [] - 1: TS_TYPE_ANNOTATION@50..58 - 0: COLON@50..52 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@52..58 - 0: STRING_KW@52..58 "string" [] [] - 3: (empty) - 4: SEMICOLON@58..59 ";" [] [] - 9: R_CURLY@59..61 "}" [Newline("\n")] [] - 4: EOF@61..62 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.rast b/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.rast deleted file mode 100644 index 44130f1206a4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.rast +++ /dev/null @@ -1,558 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@12..20 "base1" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: missing (optional), - value: missing (optional), - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - ], - r_curly_token: R_CURLY@21..23 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@23..33 "abstract" [Newline("\n")] [Whitespace(" ")], - class_token: CLASS_KW@33..39 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@39..44 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@44..52 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@52..57 "Base" [] [Whitespace(" ")], - }, - }, - type_arguments: missing (optional), - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@57..58 "{" [] [], - members: JsClassMemberList [ - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@58..71 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@71..72 "a" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@72..74 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@74..80 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@80..81 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@81..94 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@102..103 "c" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@103..105 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@105..111 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@112..125 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@125..133 "private" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@133..134 "d" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@134..136 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@136..142 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@142..143 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@143..156 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@156..164 "private" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@164..173 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@173..174 "e" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@174..176 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@176..182 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@182..183 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@183..196 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@196..205 "readonly" [] [Whitespace(" ")], - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@205..213 "declare" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@213..214 "f" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@214..216 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@216..222 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@222..223 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@223..236 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@236..244 "private" [] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@244..251 "static" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@251..260 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@260..261 "g" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@261..263 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@263..269 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@269..270 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@270..283 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@283..290 "static" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@290..299 "readonly" [] [Whitespace(" ")], - }, - TsDeclareModifier { - modifier_token: DECLARE_KW@299..307 "declare" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@307..308 "h" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@308..310 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@310..316 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@316..317 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@317..332 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@332..341 "readonly" [] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@341..350 "abstract" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@350..351 "i" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@351..353 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@353..359 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@359..360 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@360..375 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@375..384 "abstract" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@384..393 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@393..394 "j" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@394..396 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@396..402 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@402..403 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@403..418 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsOverrideModifier { - modifier_token: OVERRIDE_KW@418..427 "override" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@427..436 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@436..441 "base1" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@441..443 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@443..449 "string" [] [], - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@449..450 ";" [] [], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@450..463 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@463..470 "static" [] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@470..479 "accessor" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@479..488 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@488..489 "k" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@489..491 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@491..497 "string" [] [], - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@497..498 ";" [] [], - }, - TsPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@498..513 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsAbstractModifier { - modifier_token: ABSTRACT_KW@513..522 "abstract" [] [Whitespace(" ")], - }, - JsAccessorModifier { - modifier_token: ACCESSOR_KW@522..531 "accessor" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@531..540 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@540..541 "l" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@541..543 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@543..549 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@549..550 ";" [] [], - }, - ], - r_curly_token: R_CURLY@550..552 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@552..553 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..553 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..552 - 0: JS_CLASS_DECLARATION@0..23 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Base" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..21 - 0: JS_PROPERTY_CLASS_MEMBER@12..21 - 0: JS_PROPERTY_MODIFIER_LIST@12..12 - 1: JS_LITERAL_MEMBER_NAME@12..20 - 0: IDENT@12..20 "base1" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: (empty) - 4: SEMICOLON@20..21 ";" [] [] - 9: R_CURLY@21..23 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@23..552 - 0: JS_DECORATOR_LIST@23..23 - 1: ABSTRACT_KW@23..33 "abstract" [Newline("\n")] [Whitespace(" ")] - 2: CLASS_KW@33..39 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@39..44 - 0: IDENT@39..44 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@44..57 - 0: EXTENDS_KW@44..52 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@52..57 - 0: JS_REFERENCE_IDENTIFIER@52..57 - 0: IDENT@52..57 "Base" [] [Whitespace(" ")] - 2: (empty) - 6: (empty) - 7: L_CURLY@57..58 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@58..550 - 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@58..81 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@58..71 - 0: TS_DECLARE_MODIFIER@58..71 - 0: DECLARE_KW@58..71 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@71..72 - 0: IDENT@71..72 "a" [] [] - 2: TS_TYPE_ANNOTATION@72..80 - 0: COLON@72..74 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@74..80 - 0: STRING_KW@74..80 "string" [] [] - 3: SEMICOLON@80..81 ";" [] [] - 1: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@81..112 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@81..102 - 0: TS_ACCESSIBILITY_MODIFIER@81..94 - 0: PRIVATE_KW@81..94 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_DECLARE_MODIFIER@94..102 - 0: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@102..103 - 0: IDENT@102..103 "c" [] [] - 2: TS_TYPE_ANNOTATION@103..111 - 0: COLON@103..105 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@105..111 - 0: STRING_KW@105..111 "string" [] [] - 3: SEMICOLON@111..112 ";" [] [] - 2: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@112..143 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@112..133 - 0: TS_DECLARE_MODIFIER@112..125 - 0: DECLARE_KW@112..125 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@125..133 - 0: PRIVATE_KW@125..133 "private" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@133..134 - 0: IDENT@133..134 "d" [] [] - 2: TS_TYPE_ANNOTATION@134..142 - 0: COLON@134..136 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@136..142 - 0: STRING_KW@136..142 "string" [] [] - 3: SEMICOLON@142..143 ";" [] [] - 3: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@143..183 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@143..173 - 0: TS_DECLARE_MODIFIER@143..156 - 0: DECLARE_KW@143..156 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@156..164 - 0: PRIVATE_KW@156..164 "private" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@164..173 - 0: READONLY_KW@164..173 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@173..174 - 0: IDENT@173..174 "e" [] [] - 2: TS_TYPE_ANNOTATION@174..182 - 0: COLON@174..176 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@176..182 - 0: STRING_KW@176..182 "string" [] [] - 3: SEMICOLON@182..183 ";" [] [] - 4: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@183..223 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@183..213 - 0: TS_ACCESSIBILITY_MODIFIER@183..196 - 0: PRIVATE_KW@183..196 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@196..205 - 0: READONLY_KW@196..205 "readonly" [] [Whitespace(" ")] - 2: TS_DECLARE_MODIFIER@205..213 - 0: DECLARE_KW@205..213 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@213..214 - 0: IDENT@213..214 "f" [] [] - 2: TS_TYPE_ANNOTATION@214..222 - 0: COLON@214..216 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@216..222 - 0: STRING_KW@216..222 "string" [] [] - 3: SEMICOLON@222..223 ";" [] [] - 5: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@223..270 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@223..260 - 0: TS_DECLARE_MODIFIER@223..236 - 0: DECLARE_KW@223..236 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@236..244 - 0: PRIVATE_KW@236..244 "private" [] [Whitespace(" ")] - 2: JS_STATIC_MODIFIER@244..251 - 0: STATIC_KW@244..251 "static" [] [Whitespace(" ")] - 3: TS_READONLY_MODIFIER@251..260 - 0: READONLY_KW@251..260 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@260..261 - 0: IDENT@260..261 "g" [] [] - 2: TS_TYPE_ANNOTATION@261..269 - 0: COLON@261..263 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@263..269 - 0: STRING_KW@263..269 "string" [] [] - 3: SEMICOLON@269..270 ";" [] [] - 6: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@270..317 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@270..307 - 0: TS_ACCESSIBILITY_MODIFIER@270..283 - 0: PRIVATE_KW@270..283 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@283..290 - 0: STATIC_KW@283..290 "static" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@290..299 - 0: READONLY_KW@290..299 "readonly" [] [Whitespace(" ")] - 3: TS_DECLARE_MODIFIER@299..307 - 0: DECLARE_KW@299..307 "declare" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@307..308 - 0: IDENT@307..308 "h" [] [] - 2: TS_TYPE_ANNOTATION@308..316 - 0: COLON@308..310 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@310..316 - 0: STRING_KW@310..316 "string" [] [] - 3: SEMICOLON@316..317 ";" [] [] - 7: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@317..360 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@317..350 - 0: TS_ACCESSIBILITY_MODIFIER@317..332 - 0: PROTECTED_KW@317..332 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@332..341 - 0: READONLY_KW@332..341 "readonly" [] [Whitespace(" ")] - 2: TS_ABSTRACT_MODIFIER@341..350 - 0: ABSTRACT_KW@341..350 "abstract" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@350..351 - 0: IDENT@350..351 "i" [] [] - 2: TS_TYPE_ANNOTATION@351..359 - 0: COLON@351..353 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@353..359 - 0: STRING_KW@353..359 "string" [] [] - 3: SEMICOLON@359..360 ";" [] [] - 8: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@360..403 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@360..393 - 0: TS_ACCESSIBILITY_MODIFIER@360..375 - 0: PROTECTED_KW@360..375 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@375..384 - 0: ABSTRACT_KW@375..384 "abstract" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@384..393 - 0: READONLY_KW@384..393 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@393..394 - 0: IDENT@393..394 "j" [] [] - 2: TS_TYPE_ANNOTATION@394..402 - 0: COLON@394..396 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@396..402 - 0: STRING_KW@396..402 "string" [] [] - 3: SEMICOLON@402..403 ";" [] [] - 9: JS_PROPERTY_CLASS_MEMBER@403..450 - 0: JS_PROPERTY_MODIFIER_LIST@403..436 - 0: TS_ACCESSIBILITY_MODIFIER@403..418 - 0: PROTECTED_KW@403..418 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_OVERRIDE_MODIFIER@418..427 - 0: OVERRIDE_KW@418..427 "override" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@427..436 - 0: READONLY_KW@427..436 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@436..441 - 0: IDENT@436..441 "base1" [] [] - 2: TS_TYPE_ANNOTATION@441..449 - 0: COLON@441..443 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@443..449 - 0: STRING_KW@443..449 "string" [] [] - 3: (empty) - 4: SEMICOLON@449..450 ";" [] [] - 10: JS_PROPERTY_CLASS_MEMBER@450..498 - 0: JS_PROPERTY_MODIFIER_LIST@450..488 - 0: TS_ACCESSIBILITY_MODIFIER@450..463 - 0: PRIVATE_KW@450..463 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@463..470 - 0: STATIC_KW@463..470 "static" [] [Whitespace(" ")] - 2: JS_ACCESSOR_MODIFIER@470..479 - 0: ACCESSOR_KW@470..479 "accessor" [] [Whitespace(" ")] - 3: TS_READONLY_MODIFIER@479..488 - 0: READONLY_KW@479..488 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@488..489 - 0: IDENT@488..489 "k" [] [] - 2: TS_TYPE_ANNOTATION@489..497 - 0: COLON@489..491 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@491..497 - 0: STRING_KW@491..497 "string" [] [] - 3: (empty) - 4: SEMICOLON@497..498 ";" [] [] - 11: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@498..550 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@498..540 - 0: TS_ACCESSIBILITY_MODIFIER@498..513 - 0: PROTECTED_KW@498..513 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_ABSTRACT_MODIFIER@513..522 - 0: ABSTRACT_KW@513..522 "abstract" [] [Whitespace(" ")] - 2: JS_ACCESSOR_MODIFIER@522..531 - 0: ACCESSOR_KW@522..531 "accessor" [] [Whitespace(" ")] - 3: TS_READONLY_MODIFIER@531..540 - 0: READONLY_KW@531..540 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@540..541 - 0: IDENT@540..541 "l" [] [] - 2: TS_TYPE_ANNOTATION@541..549 - 0: COLON@541..543 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@543..549 - 0: STRING_KW@543..549 "string" [] [] - 3: SEMICOLON@549..550 ";" [] [] - 9: R_CURLY@550..552 "}" [Newline("\n")] [] - 4: EOF@552..553 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast b/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast deleted file mode 100644 index 238400f7d6e0..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..16 "BuildError" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@16..17 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@17..18 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@18..20 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@20..21 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@21..23 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@23..24 "C" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@24..26 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@26..27 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_CLASS_DECLARATION@0..28 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..16 - 0: IDENT@6..16 "BuildError" [] [] - 4: TS_TYPE_PARAMETERS@16..26 - 0: L_ANGLE@16..17 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@17..24 - 0: TS_TYPE_PARAMETER@17..18 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@17..17 - 1: TS_TYPE_PARAMETER_NAME@17..18 - 0: IDENT@17..18 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@18..20 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@20..21 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@20..20 - 1: TS_TYPE_PARAMETER_NAME@20..21 - 0: IDENT@20..21 "B" [] [] - 2: (empty) - 3: (empty) - 3: COMMA@21..23 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@23..24 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@23..23 - 1: TS_TYPE_PARAMETER_NAME@23..24 - 0: IDENT@23..24 "C" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@24..26 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@26..27 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@27..27 - 9: R_CURLY@27..28 "}" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.rast deleted file mode 100644 index d8c931656611..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.rast +++ /dev/null @@ -1,2388 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@9..15 "number" [] [], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@22..24 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsStringType { - string_token: STRING_KW@26..33 "string" [] [Whitespace(" ")], - }, - extends_token: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")], - extends_type: TsNumberType { - number_token: NUMBER_KW@41..48 "number" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@48..50 "?" [] [Whitespace(" ")], - true_type: TsStringType { - string_token: STRING_KW@50..57 "string" [] [Whitespace(" ")], - }, - colon_token: COLON@57..59 ":" [] [Whitespace(" ")], - false_type: TsNumberType { - number_token: NUMBER_KW@59..65 "number" [] [], - }, - }, - semicolon_token: SEMICOLON@65..66 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@72..74 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@74..76 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@76..78 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")], - extends_type: TsParenthesizedType { - l_paren_token: L_PAREN@86..87 "(" [] [], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@87..89 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@89..97 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@97..99 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - question_mark_token: QUESTION@99..101 "?" [] [Whitespace(" ")], - true_type: TsNumberType { - number_token: NUMBER_KW@101..108 "number" [] [Whitespace(" ")], - }, - colon_token: COLON@108..110 ":" [] [Whitespace(" ")], - false_type: TsStringType { - string_token: STRING_KW@110..116 "string" [] [], - }, - }, - r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@118..120 "?" [] [Whitespace(" ")], - true_type: TsVoidType { - void_token: VOID_KW@120..125 "void" [] [Whitespace(" ")], - }, - colon_token: COLON@125..127 ":" [] [Whitespace(" ")], - false_type: TsNumberType { - number_token: NUMBER_KW@127..133 "number" [] [], - }, - }, - semicolon_token: SEMICOLON@133..134 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@134..140 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@140..141 "D" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@141..142 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@142..143 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@143..145 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@145..147 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@147..149 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@149..157 "extends" [] [Whitespace(" ")], - extends_type: TsTupleType { - l_brack_token: L_BRACK@157..158 "[" [] [], - elements: TsTupleTypeElementList [ - TsInferType { - infer_token: INFER_KW@158..164 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@164..166 "S" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@166..174 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@174..180 "string" [] [], - }, - }, - }, - COMMA@180..182 "," [] [Whitespace(" ")], - TsRestTupleTypeElement { - dotdotdot_token: DOT3@182..185 "..." [] [], - ty: TsArrayType { - element_type: TsUnknownType { - unknown_token: UNKNOWN_KW@185..192 "unknown" [] [], - }, - l_brack_token: L_BRACK@192..193 "[" [] [], - r_brack_token: R_BRACK@193..194 "]" [] [], - }, - }, - ], - r_brack_token: R_BRACK@194..196 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@196..198 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@198..200 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@200..202 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@202..207 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@207..208 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@208..214 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@214..215 "E" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@215..216 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@216..217 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@217..219 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@219..220 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@220..222 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@222..224 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@224..226 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@226..234 "extends" [] [Whitespace(" ")], - extends_type: TsParenthesizedType { - l_paren_token: L_PAREN@234..235 "(" [] [], - ty: TsConditionalType { - check_type: TsInferType { - infer_token: INFER_KW@235..241 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@241..243 "U" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - extends_token: EXTENDS_KW@243..251 "extends" [] [Whitespace(" ")], - extends_type: TsNumberType { - number_token: NUMBER_KW@251..258 "number" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@258..260 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@260..262 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@262..264 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@264..266 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - r_paren_token: R_PAREN@266..268 ")" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@268..270 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@270..272 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@272..274 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@274..275 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@275..281 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@281..282 "F" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@282..283 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@283..284 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@284..286 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@286..288 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@288..290 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@290..298 "extends" [] [Whitespace(" ")], - extends_type: TsMappedType { - l_curly_token: L_CURLY@298..300 "{" [] [Whitespace(" ")], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@300..301 "[" [] [], - property_name: TsTypeParameterName { - ident_token: IDENT@301..303 "P" [] [Whitespace(" ")], - }, - in_token: IN_KW@303..306 "in" [] [Whitespace(" ")], - keys_type: TsConditionalType { - check_type: TsInferType { - infer_token: INFER_KW@306..312 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@312..314 "U" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - extends_token: EXTENDS_KW@314..322 "extends" [] [Whitespace(" ")], - extends_type: TsTypeOperatorType { - operator_token: KEYOF_KW@322..328 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@328..330 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - question_mark_token: QUESTION@330..332 "?" [] [Whitespace(" ")], - true_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@332..334 "1" [] [Whitespace(" ")], - }, - colon_token: COLON@334..336 ":" [] [Whitespace(" ")], - false_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@336..337 "0" [] [], - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@337..338 "]" [] [], - optional_modifier: missing (optional), - mapped_type: TsTypeAnnotation { - colon_token: COLON@338..340 ":" [] [Whitespace(" ")], - ty: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@340..341 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@341..343 ";" [] [Whitespace(" ")], - r_curly_token: R_CURLY@343..345 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@345..347 "?" [] [Whitespace(" ")], - true_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@347..349 "1" [] [Whitespace(" ")], - }, - colon_token: COLON@349..351 ":" [] [Whitespace(" ")], - false_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@351..352 "0" [] [], - }, - }, - semicolon_token: SEMICOLON@352..353 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@353..359 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@359..360 "G" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@360..361 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@361..362 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@362..364 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@364..366 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@366..368 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")], - extends_type: TsTupleType { - l_brack_token: L_BRACK@376..377 "[" [] [], - elements: TsTupleTypeElementList [ - TsUnknownType { - unknown_token: UNKNOWN_KW@377..384 "unknown" [] [], - }, - COMMA@384..386 "," [] [Whitespace(" ")], - TsInferType { - infer_token: INFER_KW@386..392 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@392..394 "S" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@394..402 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@402..408 "string" [] [], - }, - }, - }, - ], - r_brack_token: R_BRACK@408..410 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@410..412 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@412..414 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@414..416 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@416..421 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@421..422 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@422..428 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@428..430 "H" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@430..432 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@432..434 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@434..442 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@442..443 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@443..445 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@445..448 "=>" [] [Whitespace(" ")], - return_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@448..450 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@450..458 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@458..460 "C" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - question_mark_token: QUESTION@460..462 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@462..464 "D" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@464..466 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@466..468 "E" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - }, - question_mark_token: QUESTION@468..470 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@470..472 "F" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@472..474 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@474..475 "G" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@475..476 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@476..482 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@482..483 "J" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@483..484 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@484..485 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@485..487 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@487..489 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@489..491 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@491..499 "extends" [] [Whitespace(" ")], - extends_type: TsParenthesizedType { - l_paren_token: L_PAREN@499..500 "(" [] [], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@500..501 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@501..504 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@504..505 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@505..507 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@507..510 "any" [] [], - }, - l_brack_token: L_BRACK@510..511 "[" [] [], - r_brack_token: R_BRACK@511..512 "]" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@512..514 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@514..517 "=>" [] [Whitespace(" ")], - return_type: TsInferType { - infer_token: INFER_KW@517..523 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@523..525 "R" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@525..533 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@533..539 "string" [] [], - }, - }, - }, - }, - r_paren_token: R_PAREN@539..541 ")" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@541..543 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@543..545 "R" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@545..547 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@547..552 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@552..553 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@553..559 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@559..566 "Equals" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@566..568 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@568..570 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@570..578 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@578..579 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@579..580 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@580..582 ":" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@582..584 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@584..592 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@592..594 "C" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - question_mark_token: QUESTION@594..596 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@596..598 "D" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@598..600 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@600..601 "E" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@601..603 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@603..606 "=>" [] [Whitespace(" ")], - return_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@606..608 "0" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@608..610 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@610..612 "F" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@612..614 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@614..615 "G" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@615..616 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@616..622 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@622..627 "Curry" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@627..628 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@628..630 "F" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@630..638 "extends" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@638..639 "(" [] [], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@639..640 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@640..643 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@643..647 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@647..649 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@649..652 "any" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@652..654 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@654..657 "=>" [] [Whitespace(" ")], - return_type: TsAnyType { - any_token: ANY_KW@657..660 "any" [] [], - }, - }, - r_paren_token: R_PAREN@660..661 ")" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@661..663 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@663..664 "=" [] [], - ty: TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@664..670 "<" [Newline("\n"), Whitespace(" ")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@670..672 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@672..680 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@680..683 "any" [] [], - }, - l_brack_token: L_BRACK@683..684 "[" [] [], - r_brack_token: R_BRACK@684..685 "]" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@685..686 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@686..687 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@687..690 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@690..694 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@694..696 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@696..701 "Tools" [] [], - }, - dot_token: DOT@701..702 "." [] [], - right: JsName { - value_token: IDENT@702..706 "Cast" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@706..707 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@707..712 "Tools" [] [], - }, - dot_token: DOT@712..713 "." [] [], - right: JsName { - value_token: IDENT@713..717 "Cast" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@717..718 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@718..719 "T" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@719..721 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@721..725 "Gaps" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@725..726 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@726..736 "Parameters" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@736..737 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@737..738 "F" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@738..739 ">" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@739..740 ">" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@740..741 ">" [] [], - }, - }, - COMMA@741..743 "," [] [Whitespace(" ")], - TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@743..746 "any" [] [], - }, - l_brack_token: L_BRACK@746..747 "[" [] [], - r_brack_token: R_BRACK@747..748 "]" [] [], - }, - ], - r_angle_token: R_ANGLE@748..749 ">" [] [], - }, - }, - }, - }, - ], - r_paren_token: R_PAREN@749..751 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@751..753 "=>" [] [], - return_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@753..769 "GapsOf" [Newline("\n"), Whitespace(" ")] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@769..770 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@770..771 "T" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@771..773 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@773..783 "Parameters" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@783..784 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@784..785 "F" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@785..786 ">" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@786..788 ">" [] [Whitespace(" ")], - }, - }, - extends_token: EXTENDS_KW@788..796 "extends" [] [Whitespace(" ")], - extends_type: TsTupleType { - l_brack_token: L_BRACK@796..797 "[" [] [], - elements: TsTupleTypeElementList [ - TsAnyType { - any_token: ANY_KW@797..800 "any" [] [], - }, - COMMA@800..802 "," [] [Whitespace(" ")], - TsRestTupleTypeElement { - dotdotdot_token: DOT3@802..805 "..." [] [], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@805..808 "any" [] [], - }, - l_brack_token: L_BRACK@808..809 "[" [] [], - r_brack_token: R_BRACK@809..810 "]" [] [], - }, - }, - ], - r_brack_token: R_BRACK@810..811 "]" [] [], - }, - question_mark_token: QUESTION@811..823 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@823..828 "Curry" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@828..829 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@829..830 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@830..833 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@833..837 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@837..839 ":" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@839..845 "GapsOf" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@845..846 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@846..847 "T" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@847..849 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@849..859 "Parameters" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@859..860 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@860..861 "F" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@861..862 ">" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@862..864 ">" [] [Whitespace(" ")], - }, - }, - extends_token: EXTENDS_KW@864..872 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@872..878 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@878..880 "G" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@880..882 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@882..887 "Tools" [] [], - }, - dot_token: DOT@887..888 "." [] [], - right: JsName { - value_token: IDENT@888..892 "Cast" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@892..893 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@893..894 "G" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@894..896 "," [] [Whitespace(" ")], - TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@896..899 "any" [] [], - }, - l_brack_token: L_BRACK@899..900 "[" [] [], - r_brack_token: R_BRACK@900..901 "]" [] [], - }, - ], - r_angle_token: R_ANGLE@901..903 ">" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@903..905 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@905..910 "never" [] [], - }, - }, - }, - }, - ], - r_paren_token: R_PAREN@910..912 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@912..915 "=>" [] [Whitespace(" ")], - return_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@915..925 "ReturnType" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@925..926 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@926..927 "F" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@927..928 ">" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@928..929 ">" [] [], - }, - }, - colon_token: COLON@929..941 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@941..951 "ReturnType" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@951..952 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@952..953 "F" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@953..954 ">" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@954..955 ";" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@955..966 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@966..978 "GapsOfWorker" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@978..979 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@979..982 "T1" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@982..990 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@990..993 "any" [] [], - }, - l_brack_token: L_BRACK@993..994 "[" [] [], - r_brack_token: R_BRACK@994..995 "]" [] [], - }, - }, - default: missing (optional), - }, - COMMA@995..997 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@997..1000 "T2" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1000..1008 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@1008..1011 "any" [] [], - }, - l_brack_token: L_BRACK@1011..1012 "[" [] [], - r_brack_token: R_BRACK@1012..1013 "]" [] [], - }, - }, - default: missing (optional), - }, - COMMA@1013..1015 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1015..1018 "TN" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1018..1026 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@1026..1029 "any" [] [], - }, - l_brack_token: L_BRACK@1029..1030 "[" [] [], - r_brack_token: R_BRACK@1030..1032 "]" [] [Whitespace(" ")], - }, - }, - default: TsDefaultTypeClause { - eq_token: EQ@1032..1034 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@1034..1035 "[" [] [], - elements: TsTupleTypeElementList [], - r_brack_token: R_BRACK@1035..1036 "]" [] [], - }, - }, - }, - COMMA@1036..1038 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1038..1040 "I" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1040..1048 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@1048..1051 "any" [] [], - }, - l_brack_token: L_BRACK@1051..1052 "[" [] [], - r_brack_token: R_BRACK@1052..1054 "]" [] [Whitespace(" ")], - }, - }, - default: TsDefaultTypeClause { - eq_token: EQ@1054..1056 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@1056..1057 "[" [] [], - elements: TsTupleTypeElementList [], - r_brack_token: R_BRACK@1057..1058 "]" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@1058..1060 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@1060..1061 "{" [] [], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@1061..1067 "0" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1067..1069 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1069..1075 "GapsOf" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1075..1076 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1076..1078 "T1" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1078..1080 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1080..1082 "T2" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1082..1084 "," [] [Whitespace(" ")], - TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1084..1089 "GapOf" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1089..1090 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1090..1092 "T1" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1092..1094 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1094..1096 "T2" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1096..1098 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1098..1100 "TN" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1100..1102 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1102..1103 "I" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1103..1105 ">" [] [Whitespace(" ")], - }, - }, - extends_token: EXTENDS_KW@1105..1113 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1119..1121 "G" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@1121..1123 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@1123..1128 "Tools" [] [], - }, - dot_token: DOT@1128..1129 "." [] [], - right: JsName { - value_token: IDENT@1129..1133 "Cast" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1133..1134 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1134..1135 "G" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1135..1137 "," [] [Whitespace(" ")], - TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@1137..1140 "any" [] [], - }, - l_brack_token: L_BRACK@1140..1141 "[" [] [], - r_brack_token: R_BRACK@1141..1142 "]" [] [], - }, - ], - r_angle_token: R_ANGLE@1142..1144 ">" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@1144..1146 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@1146..1151 "never" [] [], - }, - }, - COMMA@1151..1153 "," [] [Whitespace(" ")], - TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@1153..1158 "Tools" [] [], - }, - dot_token: DOT@1158..1159 "." [] [], - right: JsName { - value_token: IDENT@1159..1163 "Next" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1163..1164 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1164..1165 "I" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1165..1166 ">" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@1166..1167 ">" [] [], - }, - }, - }, - separator_token: SEMICOLON@1167..1168 ";" [] [], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: JS_NUMBER_LITERAL@1168..1174 "1" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1174..1176 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@1176..1181 "Tools" [] [], - }, - dot_token: DOT@1181..1182 "." [] [], - right: JsName { - value_token: IDENT@1182..1188 "Concat" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1188..1189 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1189..1191 "TN" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1191..1193 "," [] [Whitespace(" ")], - TsConditionalType { - check_type: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@1193..1198 "Tools" [] [], - }, - dot_token: DOT@1198..1199 "." [] [], - right: JsName { - value_token: IDENT@1199..1203 "Drop" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1203..1204 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@1204..1209 "Tools" [] [], - }, - dot_token: DOT@1209..1210 "." [] [], - right: JsName { - value_token: IDENT@1210..1213 "Pos" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1213..1214 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1214..1215 "I" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1215..1216 ">" [] [], - }, - }, - COMMA@1216..1218 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1218..1220 "T2" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1220..1222 ">" [] [Whitespace(" ")], - }, - }, - extends_token: EXTENDS_KW@1222..1230 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@1230..1236 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1236..1238 "D" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@1238..1240 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@1240..1245 "Tools" [] [], - }, - dot_token: DOT@1245..1246 "." [] [], - right: JsName { - value_token: IDENT@1246..1250 "Cast" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1250..1251 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1251..1252 "D" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1252..1254 "," [] [Whitespace(" ")], - TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@1254..1257 "any" [] [], - }, - l_brack_token: L_BRACK@1257..1258 "[" [] [], - r_brack_token: R_BRACK@1258..1259 "]" [] [], - }, - ], - r_angle_token: R_ANGLE@1259..1261 ">" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@1261..1263 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@1263..1268 "never" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@1268..1269 ">" [] [], - }, - }, - }, - separator_token: SEMICOLON@1269..1270 ";" [] [], - }, - ], - r_curly_token: R_CURLY@1270..1272 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@1272..1273 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..1273 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..1272 - 0: TS_TYPE_ALIAS_DECLARATION@0..16 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_NUMBER_TYPE@9..15 - 0: NUMBER_KW@9..15 "number" [] [] - 5: SEMICOLON@15..16 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@16..66 - 0: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@22..24 - 0: IDENT@22..24 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@24..26 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@26..65 - 0: TS_STRING_TYPE@26..33 - 0: STRING_KW@26..33 "string" [] [Whitespace(" ")] - 1: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@41..48 - 0: NUMBER_KW@41..48 "number" [] [Whitespace(" ")] - 3: QUESTION@48..50 "?" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@50..57 - 0: STRING_KW@50..57 "string" [] [Whitespace(" ")] - 5: COLON@57..59 ":" [] [Whitespace(" ")] - 6: TS_NUMBER_TYPE@59..65 - 0: NUMBER_KW@59..65 "number" [] [] - 5: SEMICOLON@65..66 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@66..134 - 0: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@72..74 - 0: IDENT@72..74 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@74..76 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@76..133 - 0: TS_REFERENCE_TYPE@76..78 - 0: JS_REFERENCE_IDENTIFIER@76..78 - 0: IDENT@76..78 "A" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")] - 2: TS_PARENTHESIZED_TYPE@86..118 - 0: L_PAREN@86..87 "(" [] [] - 1: TS_CONDITIONAL_TYPE@87..116 - 0: TS_REFERENCE_TYPE@87..89 - 0: JS_REFERENCE_IDENTIFIER@87..89 - 0: IDENT@87..89 "B" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@89..97 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@97..99 - 0: JS_REFERENCE_IDENTIFIER@97..99 - 0: IDENT@97..99 "A" [] [Whitespace(" ")] - 1: (empty) - 3: QUESTION@99..101 "?" [] [Whitespace(" ")] - 4: TS_NUMBER_TYPE@101..108 - 0: NUMBER_KW@101..108 "number" [] [Whitespace(" ")] - 5: COLON@108..110 ":" [] [Whitespace(" ")] - 6: TS_STRING_TYPE@110..116 - 0: STRING_KW@110..116 "string" [] [] - 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] - 3: QUESTION@118..120 "?" [] [Whitespace(" ")] - 4: TS_VOID_TYPE@120..125 - 0: VOID_KW@120..125 "void" [] [Whitespace(" ")] - 5: COLON@125..127 ":" [] [Whitespace(" ")] - 6: TS_NUMBER_TYPE@127..133 - 0: NUMBER_KW@127..133 "number" [] [] - 5: SEMICOLON@133..134 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@134..208 - 0: TYPE_KW@134..140 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@140..141 - 0: IDENT@140..141 "D" [] [] - 2: TS_TYPE_PARAMETERS@141..145 - 0: L_ANGLE@141..142 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@142..143 - 0: TS_TYPE_PARAMETER@142..143 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@142..142 - 1: TS_TYPE_PARAMETER_NAME@142..143 - 0: IDENT@142..143 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@143..145 ">" [] [Whitespace(" ")] - 3: EQ@145..147 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@147..207 - 0: TS_REFERENCE_TYPE@147..149 - 0: JS_REFERENCE_IDENTIFIER@147..149 - 0: IDENT@147..149 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@149..157 "extends" [] [Whitespace(" ")] - 2: TS_TUPLE_TYPE@157..196 - 0: L_BRACK@157..158 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@158..194 - 0: TS_INFER_TYPE@158..180 - 0: INFER_KW@158..164 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@164..166 - 0: IDENT@164..166 "S" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@166..180 - 0: EXTENDS_KW@166..174 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@174..180 - 0: STRING_KW@174..180 "string" [] [] - 1: COMMA@180..182 "," [] [Whitespace(" ")] - 2: TS_REST_TUPLE_TYPE_ELEMENT@182..194 - 0: DOT3@182..185 "..." [] [] - 1: TS_ARRAY_TYPE@185..194 - 0: TS_UNKNOWN_TYPE@185..192 - 0: UNKNOWN_KW@185..192 "unknown" [] [] - 1: L_BRACK@192..193 "[" [] [] - 2: R_BRACK@193..194 "]" [] [] - 2: R_BRACK@194..196 "]" [] [Whitespace(" ")] - 3: QUESTION@196..198 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@198..200 - 0: JS_REFERENCE_IDENTIFIER@198..200 - 0: IDENT@198..200 "S" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@200..202 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@202..207 - 0: NEVER_KW@202..207 "never" [] [] - 5: SEMICOLON@207..208 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@208..275 - 0: TYPE_KW@208..214 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@214..215 - 0: IDENT@214..215 "E" [] [] - 2: TS_TYPE_PARAMETERS@215..222 - 0: L_ANGLE@215..216 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@216..220 - 0: TS_TYPE_PARAMETER@216..217 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@216..216 - 1: TS_TYPE_PARAMETER_NAME@216..217 - 0: IDENT@216..217 "U" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@217..219 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@219..220 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@219..219 - 1: TS_TYPE_PARAMETER_NAME@219..220 - 0: IDENT@219..220 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@220..222 ">" [] [Whitespace(" ")] - 3: EQ@222..224 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@224..275 - 0: TS_REFERENCE_TYPE@224..226 - 0: JS_REFERENCE_IDENTIFIER@224..226 - 0: IDENT@224..226 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@226..234 "extends" [] [Whitespace(" ")] - 2: TS_PARENTHESIZED_TYPE@234..268 - 0: L_PAREN@234..235 "(" [] [] - 1: TS_CONDITIONAL_TYPE@235..266 - 0: TS_INFER_TYPE@235..243 - 0: INFER_KW@235..241 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@241..243 - 0: IDENT@241..243 "U" [] [Whitespace(" ")] - 2: (empty) - 1: EXTENDS_KW@243..251 "extends" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@251..258 - 0: NUMBER_KW@251..258 "number" [] [Whitespace(" ")] - 3: QUESTION@258..260 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@260..262 - 0: JS_REFERENCE_IDENTIFIER@260..262 - 0: IDENT@260..262 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@262..264 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@264..266 - 0: JS_REFERENCE_IDENTIFIER@264..266 - 0: IDENT@264..266 "T" [] [Whitespace(" ")] - 1: (empty) - 2: R_PAREN@266..268 ")" [] [Whitespace(" ")] - 3: QUESTION@268..270 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@270..272 - 0: JS_REFERENCE_IDENTIFIER@270..272 - 0: IDENT@270..272 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@272..274 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@274..275 - 0: JS_REFERENCE_IDENTIFIER@274..275 - 0: IDENT@274..275 "T" [] [] - 1: (empty) - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@275..353 - 0: TYPE_KW@275..281 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@281..282 - 0: IDENT@281..282 "F" [] [] - 2: TS_TYPE_PARAMETERS@282..286 - 0: L_ANGLE@282..283 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@283..284 - 0: TS_TYPE_PARAMETER@283..284 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@283..283 - 1: TS_TYPE_PARAMETER_NAME@283..284 - 0: IDENT@283..284 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@284..286 ">" [] [Whitespace(" ")] - 3: EQ@286..288 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@288..352 - 0: TS_REFERENCE_TYPE@288..290 - 0: JS_REFERENCE_IDENTIFIER@288..290 - 0: IDENT@288..290 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@290..298 "extends" [] [Whitespace(" ")] - 2: TS_MAPPED_TYPE@298..345 - 0: L_CURLY@298..300 "{" [] [Whitespace(" ")] - 1: (empty) - 2: L_BRACK@300..301 "[" [] [] - 3: TS_TYPE_PARAMETER_NAME@301..303 - 0: IDENT@301..303 "P" [] [Whitespace(" ")] - 4: IN_KW@303..306 "in" [] [Whitespace(" ")] - 5: TS_CONDITIONAL_TYPE@306..337 - 0: TS_INFER_TYPE@306..314 - 0: INFER_KW@306..312 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@312..314 - 0: IDENT@312..314 "U" [] [Whitespace(" ")] - 2: (empty) - 1: EXTENDS_KW@314..322 "extends" [] [Whitespace(" ")] - 2: TS_TYPE_OPERATOR_TYPE@322..330 - 0: KEYOF_KW@322..328 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@328..330 - 0: JS_REFERENCE_IDENTIFIER@328..330 - 0: IDENT@328..330 "T" [] [Whitespace(" ")] - 1: (empty) - 3: QUESTION@330..332 "?" [] [Whitespace(" ")] - 4: TS_NUMBER_LITERAL_TYPE@332..334 - 0: (empty) - 1: JS_NUMBER_LITERAL@332..334 "1" [] [Whitespace(" ")] - 5: COLON@334..336 ":" [] [Whitespace(" ")] - 6: TS_NUMBER_LITERAL_TYPE@336..337 - 0: (empty) - 1: JS_NUMBER_LITERAL@336..337 "0" [] [] - 6: (empty) - 7: R_BRACK@337..338 "]" [] [] - 8: (empty) - 9: TS_TYPE_ANNOTATION@338..341 - 0: COLON@338..340 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_LITERAL_TYPE@340..341 - 0: (empty) - 1: JS_NUMBER_LITERAL@340..341 "1" [] [] - 10: SEMICOLON@341..343 ";" [] [Whitespace(" ")] - 11: R_CURLY@343..345 "}" [] [Whitespace(" ")] - 3: QUESTION@345..347 "?" [] [Whitespace(" ")] - 4: TS_NUMBER_LITERAL_TYPE@347..349 - 0: (empty) - 1: JS_NUMBER_LITERAL@347..349 "1" [] [Whitespace(" ")] - 5: COLON@349..351 ":" [] [Whitespace(" ")] - 6: TS_NUMBER_LITERAL_TYPE@351..352 - 0: (empty) - 1: JS_NUMBER_LITERAL@351..352 "0" [] [] - 5: SEMICOLON@352..353 ";" [] [] - 6: TS_TYPE_ALIAS_DECLARATION@353..422 - 0: TYPE_KW@353..359 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@359..360 - 0: IDENT@359..360 "G" [] [] - 2: TS_TYPE_PARAMETERS@360..364 - 0: L_ANGLE@360..361 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@361..362 - 0: TS_TYPE_PARAMETER@361..362 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@361..361 - 1: TS_TYPE_PARAMETER_NAME@361..362 - 0: IDENT@361..362 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@362..364 ">" [] [Whitespace(" ")] - 3: EQ@364..366 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@366..421 - 0: TS_REFERENCE_TYPE@366..368 - 0: JS_REFERENCE_IDENTIFIER@366..368 - 0: IDENT@366..368 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")] - 2: TS_TUPLE_TYPE@376..410 - 0: L_BRACK@376..377 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@377..408 - 0: TS_UNKNOWN_TYPE@377..384 - 0: UNKNOWN_KW@377..384 "unknown" [] [] - 1: COMMA@384..386 "," [] [Whitespace(" ")] - 2: TS_INFER_TYPE@386..408 - 0: INFER_KW@386..392 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@392..394 - 0: IDENT@392..394 "S" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@394..408 - 0: EXTENDS_KW@394..402 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@402..408 - 0: STRING_KW@402..408 "string" [] [] - 2: R_BRACK@408..410 "]" [] [Whitespace(" ")] - 3: QUESTION@410..412 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@412..414 - 0: JS_REFERENCE_IDENTIFIER@412..414 - 0: IDENT@412..414 "S" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@414..416 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@416..421 - 0: NEVER_KW@416..421 "never" [] [] - 5: SEMICOLON@421..422 ";" [] [] - 7: TS_TYPE_ALIAS_DECLARATION@422..476 - 0: TYPE_KW@422..428 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@428..430 - 0: IDENT@428..430 "H" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@430..432 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@432..475 - 0: TS_REFERENCE_TYPE@432..434 - 0: JS_REFERENCE_IDENTIFIER@432..434 - 0: IDENT@432..434 "A" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@434..442 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@442..468 - 0: (empty) - 1: JS_PARAMETERS@442..445 - 0: L_PAREN@442..443 "(" [] [] - 1: JS_PARAMETER_LIST@443..443 - 2: R_PAREN@443..445 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@445..448 "=>" [] [Whitespace(" ")] - 3: TS_CONDITIONAL_TYPE@448..468 - 0: TS_REFERENCE_TYPE@448..450 - 0: JS_REFERENCE_IDENTIFIER@448..450 - 0: IDENT@448..450 "B" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@450..458 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@458..460 - 0: JS_REFERENCE_IDENTIFIER@458..460 - 0: IDENT@458..460 "C" [] [Whitespace(" ")] - 1: (empty) - 3: QUESTION@460..462 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@462..464 - 0: JS_REFERENCE_IDENTIFIER@462..464 - 0: IDENT@462..464 "D" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@464..466 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@466..468 - 0: JS_REFERENCE_IDENTIFIER@466..468 - 0: IDENT@466..468 "E" [] [Whitespace(" ")] - 1: (empty) - 3: QUESTION@468..470 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@470..472 - 0: JS_REFERENCE_IDENTIFIER@470..472 - 0: IDENT@470..472 "F" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@472..474 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@474..475 - 0: JS_REFERENCE_IDENTIFIER@474..475 - 0: IDENT@474..475 "G" [] [] - 1: (empty) - 5: SEMICOLON@475..476 ";" [] [] - 8: TS_TYPE_ALIAS_DECLARATION@476..553 - 0: TYPE_KW@476..482 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@482..483 - 0: IDENT@482..483 "J" [] [] - 2: TS_TYPE_PARAMETERS@483..487 - 0: L_ANGLE@483..484 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@484..485 - 0: TS_TYPE_PARAMETER@484..485 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@484..484 - 1: TS_TYPE_PARAMETER_NAME@484..485 - 0: IDENT@484..485 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@485..487 ">" [] [Whitespace(" ")] - 3: EQ@487..489 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@489..552 - 0: TS_REFERENCE_TYPE@489..491 - 0: JS_REFERENCE_IDENTIFIER@489..491 - 0: IDENT@489..491 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@491..499 "extends" [] [Whitespace(" ")] - 2: TS_PARENTHESIZED_TYPE@499..541 - 0: L_PAREN@499..500 "(" [] [] - 1: TS_FUNCTION_TYPE@500..539 - 0: (empty) - 1: JS_PARAMETERS@500..514 - 0: L_PAREN@500..501 "(" [] [] - 1: JS_PARAMETER_LIST@501..512 - 0: JS_REST_PARAMETER@501..512 - 0: JS_DECORATOR_LIST@501..501 - 1: DOT3@501..504 "..." [] [] - 2: JS_IDENTIFIER_BINDING@504..505 - 0: IDENT@504..505 "a" [] [] - 3: TS_TYPE_ANNOTATION@505..512 - 0: COLON@505..507 ":" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@507..512 - 0: TS_ANY_TYPE@507..510 - 0: ANY_KW@507..510 "any" [] [] - 1: L_BRACK@510..511 "[" [] [] - 2: R_BRACK@511..512 "]" [] [] - 2: R_PAREN@512..514 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@514..517 "=>" [] [Whitespace(" ")] - 3: TS_INFER_TYPE@517..539 - 0: INFER_KW@517..523 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@523..525 - 0: IDENT@523..525 "R" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@525..539 - 0: EXTENDS_KW@525..533 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@533..539 - 0: STRING_KW@533..539 "string" [] [] - 2: R_PAREN@539..541 ")" [] [Whitespace(" ")] - 3: QUESTION@541..543 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@543..545 - 0: JS_REFERENCE_IDENTIFIER@543..545 - 0: IDENT@543..545 "R" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@545..547 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@547..552 - 0: NEVER_KW@547..552 "never" [] [] - 5: SEMICOLON@552..553 ";" [] [] - 9: TS_TYPE_ALIAS_DECLARATION@553..616 - 0: TYPE_KW@553..559 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@559..566 - 0: IDENT@559..566 "Equals" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@566..568 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@568..615 - 0: TS_REFERENCE_TYPE@568..570 - 0: JS_REFERENCE_IDENTIFIER@568..570 - 0: IDENT@568..570 "A" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@570..578 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@578..608 - 0: (empty) - 1: JS_PARAMETERS@578..603 - 0: L_PAREN@578..579 "(" [] [] - 1: JS_PARAMETER_LIST@579..601 - 0: JS_FORMAL_PARAMETER@579..601 - 0: JS_DECORATOR_LIST@579..579 - 1: JS_IDENTIFIER_BINDING@579..580 - 0: IDENT@579..580 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@580..601 - 0: COLON@580..582 ":" [] [Whitespace(" ")] - 1: TS_CONDITIONAL_TYPE@582..601 - 0: TS_REFERENCE_TYPE@582..584 - 0: JS_REFERENCE_IDENTIFIER@582..584 - 0: IDENT@582..584 "B" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@584..592 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@592..594 - 0: JS_REFERENCE_IDENTIFIER@592..594 - 0: IDENT@592..594 "C" [] [Whitespace(" ")] - 1: (empty) - 3: QUESTION@594..596 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@596..598 - 0: JS_REFERENCE_IDENTIFIER@596..598 - 0: IDENT@596..598 "D" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@598..600 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@600..601 - 0: JS_REFERENCE_IDENTIFIER@600..601 - 0: IDENT@600..601 "E" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@601..603 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@603..606 "=>" [] [Whitespace(" ")] - 3: TS_NUMBER_LITERAL_TYPE@606..608 - 0: (empty) - 1: JS_NUMBER_LITERAL@606..608 "0" [] [Whitespace(" ")] - 3: QUESTION@608..610 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@610..612 - 0: JS_REFERENCE_IDENTIFIER@610..612 - 0: IDENT@610..612 "F" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@612..614 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@614..615 - 0: JS_REFERENCE_IDENTIFIER@614..615 - 0: IDENT@614..615 "G" [] [] - 1: (empty) - 5: SEMICOLON@615..616 ";" [] [] - 10: TS_TYPE_ALIAS_DECLARATION@616..955 - 0: TYPE_KW@616..622 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@622..627 - 0: IDENT@622..627 "Curry" [] [] - 2: TS_TYPE_PARAMETERS@627..663 - 0: L_ANGLE@627..628 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@628..661 - 0: TS_TYPE_PARAMETER@628..661 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@628..628 - 1: TS_TYPE_PARAMETER_NAME@628..630 - 0: IDENT@628..630 "F" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@630..661 - 0: EXTENDS_KW@630..638 "extends" [] [Whitespace(" ")] - 1: TS_PARENTHESIZED_TYPE@638..661 - 0: L_PAREN@638..639 "(" [] [] - 1: TS_FUNCTION_TYPE@639..660 - 0: (empty) - 1: JS_PARAMETERS@639..654 - 0: L_PAREN@639..640 "(" [] [] - 1: JS_PARAMETER_LIST@640..652 - 0: JS_REST_PARAMETER@640..652 - 0: JS_DECORATOR_LIST@640..640 - 1: DOT3@640..643 "..." [] [] - 2: JS_IDENTIFIER_BINDING@643..647 - 0: IDENT@643..647 "args" [] [] - 3: TS_TYPE_ANNOTATION@647..652 - 0: COLON@647..649 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@649..652 - 0: ANY_KW@649..652 "any" [] [] - 2: R_PAREN@652..654 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@654..657 "=>" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@657..660 - 0: ANY_KW@657..660 "any" [] [] - 2: R_PAREN@660..661 ")" [] [] - 3: (empty) - 2: R_ANGLE@661..663 ">" [] [Whitespace(" ")] - 3: EQ@663..664 "=" [] [] - 4: TS_FUNCTION_TYPE@664..954 - 0: TS_TYPE_PARAMETERS@664..686 - 0: L_ANGLE@664..670 "<" [Newline("\n"), Whitespace(" ")] [] - 1: TS_TYPE_PARAMETER_LIST@670..685 - 0: TS_TYPE_PARAMETER@670..685 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@670..670 - 1: TS_TYPE_PARAMETER_NAME@670..672 - 0: IDENT@670..672 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@672..685 - 0: EXTENDS_KW@672..680 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@680..685 - 0: TS_ANY_TYPE@680..683 - 0: ANY_KW@680..683 "any" [] [] - 1: L_BRACK@683..684 "[" [] [] - 2: R_BRACK@684..685 "]" [] [] - 3: (empty) - 2: R_ANGLE@685..686 ">" [] [] - 1: JS_PARAMETERS@686..751 - 0: L_PAREN@686..687 "(" [] [] - 1: JS_PARAMETER_LIST@687..749 - 0: JS_REST_PARAMETER@687..749 - 0: JS_DECORATOR_LIST@687..687 - 1: DOT3@687..690 "..." [] [] - 2: JS_IDENTIFIER_BINDING@690..694 - 0: IDENT@690..694 "args" [] [] - 3: TS_TYPE_ANNOTATION@694..749 - 0: COLON@694..696 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@696..749 - 0: TS_QUALIFIED_NAME@696..706 - 0: JS_REFERENCE_IDENTIFIER@696..701 - 0: IDENT@696..701 "Tools" [] [] - 1: DOT@701..702 "." [] [] - 2: JS_NAME@702..706 - 0: IDENT@702..706 "Cast" [] [] - 1: TS_TYPE_ARGUMENTS@706..749 - 0: L_ANGLE@706..707 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@707..748 - 0: TS_REFERENCE_TYPE@707..741 - 0: TS_QUALIFIED_NAME@707..717 - 0: JS_REFERENCE_IDENTIFIER@707..712 - 0: IDENT@707..712 "Tools" [] [] - 1: DOT@712..713 "." [] [] - 2: JS_NAME@713..717 - 0: IDENT@713..717 "Cast" [] [] - 1: TS_TYPE_ARGUMENTS@717..741 - 0: L_ANGLE@717..718 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@718..740 - 0: TS_REFERENCE_TYPE@718..719 - 0: JS_REFERENCE_IDENTIFIER@718..719 - 0: IDENT@718..719 "T" [] [] - 1: (empty) - 1: COMMA@719..721 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@721..740 - 0: JS_REFERENCE_IDENTIFIER@721..725 - 0: IDENT@721..725 "Gaps" [] [] - 1: TS_TYPE_ARGUMENTS@725..740 - 0: L_ANGLE@725..726 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@726..739 - 0: TS_REFERENCE_TYPE@726..739 - 0: JS_REFERENCE_IDENTIFIER@726..736 - 0: IDENT@726..736 "Parameters" [] [] - 1: TS_TYPE_ARGUMENTS@736..739 - 0: L_ANGLE@736..737 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@737..738 - 0: TS_REFERENCE_TYPE@737..738 - 0: JS_REFERENCE_IDENTIFIER@737..738 - 0: IDENT@737..738 "F" [] [] - 1: (empty) - 2: R_ANGLE@738..739 ">" [] [] - 2: R_ANGLE@739..740 ">" [] [] - 2: R_ANGLE@740..741 ">" [] [] - 1: COMMA@741..743 "," [] [Whitespace(" ")] - 2: TS_ARRAY_TYPE@743..748 - 0: TS_ANY_TYPE@743..746 - 0: ANY_KW@743..746 "any" [] [] - 1: L_BRACK@746..747 "[" [] [] - 2: R_BRACK@747..748 "]" [] [] - 2: R_ANGLE@748..749 ">" [] [] - 2: R_PAREN@749..751 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@751..753 "=>" [] [] - 3: TS_CONDITIONAL_TYPE@753..954 - 0: TS_REFERENCE_TYPE@753..788 - 0: JS_REFERENCE_IDENTIFIER@753..769 - 0: IDENT@753..769 "GapsOf" [Newline("\n"), Whitespace(" ")] [] - 1: TS_TYPE_ARGUMENTS@769..788 - 0: L_ANGLE@769..770 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@770..786 - 0: TS_REFERENCE_TYPE@770..771 - 0: JS_REFERENCE_IDENTIFIER@770..771 - 0: IDENT@770..771 "T" [] [] - 1: (empty) - 1: COMMA@771..773 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@773..786 - 0: JS_REFERENCE_IDENTIFIER@773..783 - 0: IDENT@773..783 "Parameters" [] [] - 1: TS_TYPE_ARGUMENTS@783..786 - 0: L_ANGLE@783..784 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@784..785 - 0: TS_REFERENCE_TYPE@784..785 - 0: JS_REFERENCE_IDENTIFIER@784..785 - 0: IDENT@784..785 "F" [] [] - 1: (empty) - 2: R_ANGLE@785..786 ">" [] [] - 2: R_ANGLE@786..788 ">" [] [Whitespace(" ")] - 1: EXTENDS_KW@788..796 "extends" [] [Whitespace(" ")] - 2: TS_TUPLE_TYPE@796..811 - 0: L_BRACK@796..797 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@797..810 - 0: TS_ANY_TYPE@797..800 - 0: ANY_KW@797..800 "any" [] [] - 1: COMMA@800..802 "," [] [Whitespace(" ")] - 2: TS_REST_TUPLE_TYPE_ELEMENT@802..810 - 0: DOT3@802..805 "..." [] [] - 1: TS_ARRAY_TYPE@805..810 - 0: TS_ANY_TYPE@805..808 - 0: ANY_KW@805..808 "any" [] [] - 1: L_BRACK@808..809 "[" [] [] - 2: R_BRACK@809..810 "]" [] [] - 2: R_BRACK@810..811 "]" [] [] - 3: QUESTION@811..823 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@823..929 - 0: JS_REFERENCE_IDENTIFIER@823..828 - 0: IDENT@823..828 "Curry" [] [] - 1: TS_TYPE_ARGUMENTS@828..929 - 0: L_ANGLE@828..829 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@829..928 - 0: TS_FUNCTION_TYPE@829..928 - 0: (empty) - 1: JS_PARAMETERS@829..912 - 0: L_PAREN@829..830 "(" [] [] - 1: JS_PARAMETER_LIST@830..910 - 0: JS_REST_PARAMETER@830..910 - 0: JS_DECORATOR_LIST@830..830 - 1: DOT3@830..833 "..." [] [] - 2: JS_IDENTIFIER_BINDING@833..837 - 0: IDENT@833..837 "args" [] [] - 3: TS_TYPE_ANNOTATION@837..910 - 0: COLON@837..839 ":" [] [Whitespace(" ")] - 1: TS_CONDITIONAL_TYPE@839..910 - 0: TS_REFERENCE_TYPE@839..864 - 0: JS_REFERENCE_IDENTIFIER@839..845 - 0: IDENT@839..845 "GapsOf" [] [] - 1: TS_TYPE_ARGUMENTS@845..864 - 0: L_ANGLE@845..846 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@846..862 - 0: TS_REFERENCE_TYPE@846..847 - 0: JS_REFERENCE_IDENTIFIER@846..847 - 0: IDENT@846..847 "T" [] [] - 1: (empty) - 1: COMMA@847..849 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@849..862 - 0: JS_REFERENCE_IDENTIFIER@849..859 - 0: IDENT@849..859 "Parameters" [] [] - 1: TS_TYPE_ARGUMENTS@859..862 - 0: L_ANGLE@859..860 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@860..861 - 0: TS_REFERENCE_TYPE@860..861 - 0: JS_REFERENCE_IDENTIFIER@860..861 - 0: IDENT@860..861 "F" [] [] - 1: (empty) - 2: R_ANGLE@861..862 ">" [] [] - 2: R_ANGLE@862..864 ">" [] [Whitespace(" ")] - 1: EXTENDS_KW@864..872 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@872..880 - 0: INFER_KW@872..878 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@878..880 - 0: IDENT@878..880 "G" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@880..882 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@882..903 - 0: TS_QUALIFIED_NAME@882..892 - 0: JS_REFERENCE_IDENTIFIER@882..887 - 0: IDENT@882..887 "Tools" [] [] - 1: DOT@887..888 "." [] [] - 2: JS_NAME@888..892 - 0: IDENT@888..892 "Cast" [] [] - 1: TS_TYPE_ARGUMENTS@892..903 - 0: L_ANGLE@892..893 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@893..901 - 0: TS_REFERENCE_TYPE@893..894 - 0: JS_REFERENCE_IDENTIFIER@893..894 - 0: IDENT@893..894 "G" [] [] - 1: (empty) - 1: COMMA@894..896 "," [] [Whitespace(" ")] - 2: TS_ARRAY_TYPE@896..901 - 0: TS_ANY_TYPE@896..899 - 0: ANY_KW@896..899 "any" [] [] - 1: L_BRACK@899..900 "[" [] [] - 2: R_BRACK@900..901 "]" [] [] - 2: R_ANGLE@901..903 ">" [] [Whitespace(" ")] - 5: COLON@903..905 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@905..910 - 0: NEVER_KW@905..910 "never" [] [] - 2: R_PAREN@910..912 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@912..915 "=>" [] [Whitespace(" ")] - 3: TS_REFERENCE_TYPE@915..928 - 0: JS_REFERENCE_IDENTIFIER@915..925 - 0: IDENT@915..925 "ReturnType" [] [] - 1: TS_TYPE_ARGUMENTS@925..928 - 0: L_ANGLE@925..926 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@926..927 - 0: TS_REFERENCE_TYPE@926..927 - 0: JS_REFERENCE_IDENTIFIER@926..927 - 0: IDENT@926..927 "F" [] [] - 1: (empty) - 2: R_ANGLE@927..928 ">" [] [] - 2: R_ANGLE@928..929 ">" [] [] - 5: COLON@929..941 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@941..954 - 0: JS_REFERENCE_IDENTIFIER@941..951 - 0: IDENT@941..951 "ReturnType" [] [] - 1: TS_TYPE_ARGUMENTS@951..954 - 0: L_ANGLE@951..952 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@952..953 - 0: TS_REFERENCE_TYPE@952..953 - 0: JS_REFERENCE_IDENTIFIER@952..953 - 0: IDENT@952..953 "F" [] [] - 1: (empty) - 2: R_ANGLE@953..954 ">" [] [] - 5: SEMICOLON@954..955 ";" [] [] - 11: TS_INTERFACE_DECLARATION@955..1272 - 0: INTERFACE_KW@955..966 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@966..978 - 0: IDENT@966..978 "GapsOfWorker" [] [] - 2: TS_TYPE_PARAMETERS@978..1060 - 0: L_ANGLE@978..979 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@979..1058 - 0: TS_TYPE_PARAMETER@979..995 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@979..979 - 1: TS_TYPE_PARAMETER_NAME@979..982 - 0: IDENT@979..982 "T1" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@982..995 - 0: EXTENDS_KW@982..990 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@990..995 - 0: TS_ANY_TYPE@990..993 - 0: ANY_KW@990..993 "any" [] [] - 1: L_BRACK@993..994 "[" [] [] - 2: R_BRACK@994..995 "]" [] [] - 3: (empty) - 1: COMMA@995..997 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@997..1013 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@997..997 - 1: TS_TYPE_PARAMETER_NAME@997..1000 - 0: IDENT@997..1000 "T2" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1000..1013 - 0: EXTENDS_KW@1000..1008 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@1008..1013 - 0: TS_ANY_TYPE@1008..1011 - 0: ANY_KW@1008..1011 "any" [] [] - 1: L_BRACK@1011..1012 "[" [] [] - 2: R_BRACK@1012..1013 "]" [] [] - 3: (empty) - 3: COMMA@1013..1015 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@1015..1036 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1015..1015 - 1: TS_TYPE_PARAMETER_NAME@1015..1018 - 0: IDENT@1015..1018 "TN" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1018..1032 - 0: EXTENDS_KW@1018..1026 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@1026..1032 - 0: TS_ANY_TYPE@1026..1029 - 0: ANY_KW@1026..1029 "any" [] [] - 1: L_BRACK@1029..1030 "[" [] [] - 2: R_BRACK@1030..1032 "]" [] [Whitespace(" ")] - 3: TS_DEFAULT_TYPE_CLAUSE@1032..1036 - 0: EQ@1032..1034 "=" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@1034..1036 - 0: L_BRACK@1034..1035 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@1035..1035 - 2: R_BRACK@1035..1036 "]" [] [] - 5: COMMA@1036..1038 "," [] [Whitespace(" ")] - 6: TS_TYPE_PARAMETER@1038..1058 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1038..1038 - 1: TS_TYPE_PARAMETER_NAME@1038..1040 - 0: IDENT@1038..1040 "I" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1040..1054 - 0: EXTENDS_KW@1040..1048 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@1048..1054 - 0: TS_ANY_TYPE@1048..1051 - 0: ANY_KW@1048..1051 "any" [] [] - 1: L_BRACK@1051..1052 "[" [] [] - 2: R_BRACK@1052..1054 "]" [] [Whitespace(" ")] - 3: TS_DEFAULT_TYPE_CLAUSE@1054..1058 - 0: EQ@1054..1056 "=" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@1056..1058 - 0: L_BRACK@1056..1057 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@1057..1057 - 2: R_BRACK@1057..1058 "]" [] [] - 2: R_ANGLE@1058..1060 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@1060..1061 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@1061..1270 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1061..1168 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1061..1067 - 0: JS_NUMBER_LITERAL@1061..1067 "0" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1067..1167 - 0: COLON@1067..1069 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@1069..1167 - 0: JS_REFERENCE_IDENTIFIER@1069..1075 - 0: IDENT@1069..1075 "GapsOf" [] [] - 1: TS_TYPE_ARGUMENTS@1075..1167 - 0: L_ANGLE@1075..1076 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1076..1166 - 0: TS_REFERENCE_TYPE@1076..1078 - 0: JS_REFERENCE_IDENTIFIER@1076..1078 - 0: IDENT@1076..1078 "T1" [] [] - 1: (empty) - 1: COMMA@1078..1080 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1080..1082 - 0: JS_REFERENCE_IDENTIFIER@1080..1082 - 0: IDENT@1080..1082 "T2" [] [] - 1: (empty) - 3: COMMA@1082..1084 "," [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1084..1151 - 0: TS_REFERENCE_TYPE@1084..1105 - 0: JS_REFERENCE_IDENTIFIER@1084..1089 - 0: IDENT@1084..1089 "GapOf" [] [] - 1: TS_TYPE_ARGUMENTS@1089..1105 - 0: L_ANGLE@1089..1090 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1090..1103 - 0: TS_REFERENCE_TYPE@1090..1092 - 0: JS_REFERENCE_IDENTIFIER@1090..1092 - 0: IDENT@1090..1092 "T1" [] [] - 1: (empty) - 1: COMMA@1092..1094 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1094..1096 - 0: JS_REFERENCE_IDENTIFIER@1094..1096 - 0: IDENT@1094..1096 "T2" [] [] - 1: (empty) - 3: COMMA@1096..1098 "," [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1098..1100 - 0: JS_REFERENCE_IDENTIFIER@1098..1100 - 0: IDENT@1098..1100 "TN" [] [] - 1: (empty) - 5: COMMA@1100..1102 "," [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@1102..1103 - 0: JS_REFERENCE_IDENTIFIER@1102..1103 - 0: IDENT@1102..1103 "I" [] [] - 1: (empty) - 2: R_ANGLE@1103..1105 ">" [] [Whitespace(" ")] - 1: EXTENDS_KW@1105..1113 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@1113..1121 - 0: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1119..1121 - 0: IDENT@1119..1121 "G" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@1121..1123 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1123..1144 - 0: TS_QUALIFIED_NAME@1123..1133 - 0: JS_REFERENCE_IDENTIFIER@1123..1128 - 0: IDENT@1123..1128 "Tools" [] [] - 1: DOT@1128..1129 "." [] [] - 2: JS_NAME@1129..1133 - 0: IDENT@1129..1133 "Cast" [] [] - 1: TS_TYPE_ARGUMENTS@1133..1144 - 0: L_ANGLE@1133..1134 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1134..1142 - 0: TS_REFERENCE_TYPE@1134..1135 - 0: JS_REFERENCE_IDENTIFIER@1134..1135 - 0: IDENT@1134..1135 "G" [] [] - 1: (empty) - 1: COMMA@1135..1137 "," [] [Whitespace(" ")] - 2: TS_ARRAY_TYPE@1137..1142 - 0: TS_ANY_TYPE@1137..1140 - 0: ANY_KW@1137..1140 "any" [] [] - 1: L_BRACK@1140..1141 "[" [] [] - 2: R_BRACK@1141..1142 "]" [] [] - 2: R_ANGLE@1142..1144 ">" [] [Whitespace(" ")] - 5: COLON@1144..1146 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@1146..1151 - 0: NEVER_KW@1146..1151 "never" [] [] - 5: COMMA@1151..1153 "," [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@1153..1166 - 0: TS_QUALIFIED_NAME@1153..1163 - 0: JS_REFERENCE_IDENTIFIER@1153..1158 - 0: IDENT@1153..1158 "Tools" [] [] - 1: DOT@1158..1159 "." [] [] - 2: JS_NAME@1159..1163 - 0: IDENT@1159..1163 "Next" [] [] - 1: TS_TYPE_ARGUMENTS@1163..1166 - 0: L_ANGLE@1163..1164 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1164..1165 - 0: TS_REFERENCE_TYPE@1164..1165 - 0: JS_REFERENCE_IDENTIFIER@1164..1165 - 0: IDENT@1164..1165 "I" [] [] - 1: (empty) - 2: R_ANGLE@1165..1166 ">" [] [] - 2: R_ANGLE@1166..1167 ">" [] [] - 4: SEMICOLON@1167..1168 ";" [] [] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1168..1270 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1168..1174 - 0: JS_NUMBER_LITERAL@1168..1174 "1" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1174..1269 - 0: COLON@1174..1176 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@1176..1269 - 0: TS_QUALIFIED_NAME@1176..1188 - 0: JS_REFERENCE_IDENTIFIER@1176..1181 - 0: IDENT@1176..1181 "Tools" [] [] - 1: DOT@1181..1182 "." [] [] - 2: JS_NAME@1182..1188 - 0: IDENT@1182..1188 "Concat" [] [] - 1: TS_TYPE_ARGUMENTS@1188..1269 - 0: L_ANGLE@1188..1189 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1189..1268 - 0: TS_REFERENCE_TYPE@1189..1191 - 0: JS_REFERENCE_IDENTIFIER@1189..1191 - 0: IDENT@1189..1191 "TN" [] [] - 1: (empty) - 1: COMMA@1191..1193 "," [] [Whitespace(" ")] - 2: TS_CONDITIONAL_TYPE@1193..1268 - 0: TS_REFERENCE_TYPE@1193..1222 - 0: TS_QUALIFIED_NAME@1193..1203 - 0: JS_REFERENCE_IDENTIFIER@1193..1198 - 0: IDENT@1193..1198 "Tools" [] [] - 1: DOT@1198..1199 "." [] [] - 2: JS_NAME@1199..1203 - 0: IDENT@1199..1203 "Drop" [] [] - 1: TS_TYPE_ARGUMENTS@1203..1222 - 0: L_ANGLE@1203..1204 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1204..1220 - 0: TS_REFERENCE_TYPE@1204..1216 - 0: TS_QUALIFIED_NAME@1204..1213 - 0: JS_REFERENCE_IDENTIFIER@1204..1209 - 0: IDENT@1204..1209 "Tools" [] [] - 1: DOT@1209..1210 "." [] [] - 2: JS_NAME@1210..1213 - 0: IDENT@1210..1213 "Pos" [] [] - 1: TS_TYPE_ARGUMENTS@1213..1216 - 0: L_ANGLE@1213..1214 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1214..1215 - 0: TS_REFERENCE_TYPE@1214..1215 - 0: JS_REFERENCE_IDENTIFIER@1214..1215 - 0: IDENT@1214..1215 "I" [] [] - 1: (empty) - 2: R_ANGLE@1215..1216 ">" [] [] - 1: COMMA@1216..1218 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1218..1220 - 0: JS_REFERENCE_IDENTIFIER@1218..1220 - 0: IDENT@1218..1220 "T2" [] [] - 1: (empty) - 2: R_ANGLE@1220..1222 ">" [] [Whitespace(" ")] - 1: EXTENDS_KW@1222..1230 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@1230..1238 - 0: INFER_KW@1230..1236 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1236..1238 - 0: IDENT@1236..1238 "D" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@1238..1240 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1240..1261 - 0: TS_QUALIFIED_NAME@1240..1250 - 0: JS_REFERENCE_IDENTIFIER@1240..1245 - 0: IDENT@1240..1245 "Tools" [] [] - 1: DOT@1245..1246 "." [] [] - 2: JS_NAME@1246..1250 - 0: IDENT@1246..1250 "Cast" [] [] - 1: TS_TYPE_ARGUMENTS@1250..1261 - 0: L_ANGLE@1250..1251 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1251..1259 - 0: TS_REFERENCE_TYPE@1251..1252 - 0: JS_REFERENCE_IDENTIFIER@1251..1252 - 0: IDENT@1251..1252 "D" [] [] - 1: (empty) - 1: COMMA@1252..1254 "," [] [Whitespace(" ")] - 2: TS_ARRAY_TYPE@1254..1259 - 0: TS_ANY_TYPE@1254..1257 - 0: ANY_KW@1254..1257 "any" [] [] - 1: L_BRACK@1257..1258 "[" [] [] - 2: R_BRACK@1258..1259 "]" [] [] - 2: R_ANGLE@1259..1261 ">" [] [Whitespace(" ")] - 5: COLON@1261..1263 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@1263..1268 - 0: NEVER_KW@1263..1268 "never" [] [] - 2: R_ANGLE@1268..1269 ">" [] [] - 4: SEMICOLON@1269..1270 ";" [] [] - 6: R_CURLY@1270..1272 "}" [Newline("\n")] [] - 4: EOF@1272..1273 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast b/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast deleted file mode 100644 index 0da32f362981..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast +++ /dev/null @@ -1,200 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..6 "X" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@6..7 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@7..8 "V" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@8..10 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@10..12 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@12..14 "V" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@23..26 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@26..30 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@30..32 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@32..35 "any" [] [], - }, - l_brack_token: L_BRACK@35..36 "[" [] [], - r_brack_token: R_BRACK@36..37 "]" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@39..42 "=>" [] [Whitespace(" ")], - return_type: TsAnyType { - any_token: ANY_KW@42..46 "any" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@46..48 "?" [] [Whitespace(" ")], - true_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@48..49 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@49..52 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@52..56 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@56..58 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@58..68 "Parameters" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@68..69 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@69..70 "V" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@70..71 ">" [] [], - }, - }, - }, - }, - ], - r_paren_token: R_PAREN@71..73 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@73..76 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@76..81 "void" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@81..83 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@83..91 "Function" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@91..92 ";" [] [], - }, - ], - eof_token: EOF@92..93 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..93 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..92 - 0: TS_TYPE_ALIAS_DECLARATION@0..92 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..6 - 0: IDENT@5..6 "X" [] [] - 2: TS_TYPE_PARAMETERS@6..10 - 0: L_ANGLE@6..7 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@7..8 - 0: TS_TYPE_PARAMETER@7..8 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 - 1: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "V" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@8..10 ">" [] [Whitespace(" ")] - 3: EQ@10..12 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@12..91 - 0: TS_REFERENCE_TYPE@12..14 - 0: JS_REFERENCE_IDENTIFIER@12..14 - 0: IDENT@12..14 "V" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@22..46 - 0: (empty) - 1: JS_PARAMETERS@22..39 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_PARAMETER_LIST@23..37 - 0: JS_REST_PARAMETER@23..37 - 0: JS_DECORATOR_LIST@23..23 - 1: DOT3@23..26 "..." [] [] - 2: JS_IDENTIFIER_BINDING@26..30 - 0: IDENT@26..30 "args" [] [] - 3: TS_TYPE_ANNOTATION@30..37 - 0: COLON@30..32 ":" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@32..37 - 0: TS_ANY_TYPE@32..35 - 0: ANY_KW@32..35 "any" [] [] - 1: L_BRACK@35..36 "[" [] [] - 2: R_BRACK@36..37 "]" [] [] - 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@39..42 "=>" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@42..46 - 0: ANY_KW@42..46 "any" [] [Whitespace(" ")] - 3: QUESTION@46..48 "?" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@48..81 - 0: (empty) - 1: JS_PARAMETERS@48..73 - 0: L_PAREN@48..49 "(" [] [] - 1: JS_PARAMETER_LIST@49..71 - 0: JS_REST_PARAMETER@49..71 - 0: JS_DECORATOR_LIST@49..49 - 1: DOT3@49..52 "..." [] [] - 2: JS_IDENTIFIER_BINDING@52..56 - 0: IDENT@52..56 "args" [] [] - 3: TS_TYPE_ANNOTATION@56..71 - 0: COLON@56..58 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@58..71 - 0: JS_REFERENCE_IDENTIFIER@58..68 - 0: IDENT@58..68 "Parameters" [] [] - 1: TS_TYPE_ARGUMENTS@68..71 - 0: L_ANGLE@68..69 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@69..70 - 0: TS_REFERENCE_TYPE@69..70 - 0: JS_REFERENCE_IDENTIFIER@69..70 - 0: IDENT@69..70 "V" [] [] - 1: (empty) - 2: R_ANGLE@70..71 ">" [] [] - 2: R_PAREN@71..73 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@73..76 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@76..81 - 0: VOID_KW@76..81 "void" [] [Whitespace(" ")] - 5: COLON@81..83 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@83..91 - 0: JS_REFERENCE_IDENTIFIER@83..91 - 0: IDENT@83..91 "Function" [] [] - 1: (empty) - 5: SEMICOLON@91..92 ";" [] [] - 4: EOF@92..93 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast deleted file mode 100644 index cc5bce273d9f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast +++ /dev/null @@ -1,462 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@11..15 "new" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@15..16 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@16..17 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@17..19 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@19..25 "string" [] [], - }, - }, - separator_token: SEMICOLON@25..27 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@34..36 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@40..44 "new" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@45..46 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@46..48 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@48..54 "string" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@54..56 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@56..57 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@57..59 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@59..65 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], - }, - type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@67..68 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@68..74 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@74..76 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@80..84 "new" [] [Whitespace(" ")], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@84..85 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@85..86 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@86..88 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@88..89 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@89..90 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@90..91 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@91..92 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@92..94 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@94..95 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@95..97 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@97..98 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@98..100 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@100..101 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@101..102 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@102..104 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@104..111 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@111..112 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@112..118 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@118..120 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@120..122 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@122..124 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsConstructSignatureTypeMember { - new_token: NEW_KW@124..128 "new" [] [Whitespace(" ")], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@128..129 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@129..135 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@135..136 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@136..137 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@137..138 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@138..139 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@139..141 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@141..142 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@142..144 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@144..145 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@145..147 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@147..148 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@148..149 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@149..151 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@151..158 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@158..159 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@159..160 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..160 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..159 - 0: TS_TYPE_ALIAS_DECLARATION@0..28 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..28 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..27 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@11..27 - 0: NEW_KW@11..15 "new" [] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@15..17 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_PARAMETER_LIST@16..16 - 2: R_PAREN@16..17 ")" [] [] - 3: TS_TYPE_ANNOTATION@17..25 - 0: COLON@17..19 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@19..25 - 0: STRING_KW@19..25 "string" [] [] - 4: SEMICOLON@25..27 ";" [] [Whitespace(" ")] - 2: R_CURLY@27..28 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@28..68 - 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@36..38 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@38..68 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@40..67 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@40..67 - 0: NEW_KW@40..44 "new" [] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@44..67 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..65 - 0: JS_FORMAL_PARAMETER@45..54 - 0: JS_DECORATOR_LIST@45..45 - 1: JS_IDENTIFIER_BINDING@45..46 - 0: IDENT@45..46 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@46..54 - 0: COLON@46..48 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@48..54 - 0: STRING_KW@48..54 "string" [] [] - 4: (empty) - 1: COMMA@54..56 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@56..65 - 0: JS_DECORATOR_LIST@56..56 - 1: JS_IDENTIFIER_BINDING@56..57 - 0: IDENT@56..57 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@57..65 - 0: COLON@57..59 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@59..65 - 0: NUMBER_KW@59..65 "number" [] [] - 4: (empty) - 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 2: R_CURLY@67..68 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@68..112 - 0: TYPE_KW@68..74 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@74..76 - 0: IDENT@74..76 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@76..78 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@78..112 - 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@80..111 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@80..111 - 0: NEW_KW@80..84 "new" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETERS@84..90 - 0: L_ANGLE@84..85 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@85..89 - 0: TS_TYPE_PARAMETER@85..86 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@85..85 - 1: TS_TYPE_PARAMETER_NAME@85..86 - 0: IDENT@85..86 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@86..88 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@88..89 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@88..88 - 1: TS_TYPE_PARAMETER_NAME@88..89 - 0: IDENT@88..89 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@89..90 ">" [] [] - 2: JS_PARAMETERS@90..102 - 0: L_PAREN@90..91 "(" [] [] - 1: JS_PARAMETER_LIST@91..101 - 0: JS_FORMAL_PARAMETER@91..95 - 0: JS_DECORATOR_LIST@91..91 - 1: JS_IDENTIFIER_BINDING@91..92 - 0: IDENT@91..92 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@92..95 - 0: COLON@92..94 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@94..95 - 0: JS_REFERENCE_IDENTIFIER@94..95 - 0: IDENT@94..95 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@95..97 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@97..101 - 0: JS_DECORATOR_LIST@97..97 - 1: JS_IDENTIFIER_BINDING@97..98 - 0: IDENT@97..98 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@98..101 - 0: COLON@98..100 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@100..101 - 0: JS_REFERENCE_IDENTIFIER@100..101 - 0: IDENT@100..101 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@101..102 ")" [] [] - 3: TS_TYPE_ANNOTATION@102..111 - 0: COLON@102..104 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@104..111 - 0: STRING_KW@104..111 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@111..112 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@112..159 - 0: TYPE_KW@112..118 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@118..120 - 0: IDENT@118..120 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@120..122 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@122..159 - 0: L_CURLY@122..124 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@124..158 - 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@124..158 - 0: NEW_KW@124..128 "new" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETERS@128..137 - 0: L_ANGLE@128..129 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@129..136 - 0: TS_TYPE_PARAMETER@129..136 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@129..135 - 0: TS_CONST_MODIFIER@129..135 - 0: CONST_KW@129..135 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@135..136 - 0: IDENT@135..136 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@136..137 ">" [] [] - 2: JS_PARAMETERS@137..149 - 0: L_PAREN@137..138 "(" [] [] - 1: JS_PARAMETER_LIST@138..148 - 0: JS_FORMAL_PARAMETER@138..142 - 0: JS_DECORATOR_LIST@138..138 - 1: JS_IDENTIFIER_BINDING@138..139 - 0: IDENT@138..139 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@139..142 - 0: COLON@139..141 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@141..142 - 0: JS_REFERENCE_IDENTIFIER@141..142 - 0: IDENT@141..142 "T" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@142..144 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@144..148 - 0: JS_DECORATOR_LIST@144..144 - 1: JS_IDENTIFIER_BINDING@144..145 - 0: IDENT@144..145 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@145..148 - 0: COLON@145..147 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@147..148 - 0: JS_REFERENCE_IDENTIFIER@147..148 - 0: IDENT@147..148 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@148..149 ")" [] [] - 3: TS_TYPE_ANNOTATION@149..158 - 0: COLON@149..151 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@151..158 - 0: STRING_KW@151..158 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@158..159 "}" [] [] - 5: (empty) - 4: EOF@159..160 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.rast deleted file mode 100644 index d7ca2b062f54..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.rast +++ /dev/null @@ -1,479 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: missing (optional), - new_token: NEW_KW@9..12 "new" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@12..13 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@13..14 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@14..16 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@16..22 "string" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..25 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@27..33 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@38..44 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@51..53 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@53..55 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: ABSTRACT_KW@55..64 "abstract" [] [Whitespace(" ")], - new_token: NEW_KW@64..67 "new" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@67..68 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@68..69 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@71..77 "string" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@77..79 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@79..80 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@80..82 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@82..88 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@88..90 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@93..99 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@99..100 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@106..108 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@108..110 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: missing (optional), - new_token: NEW_KW@110..113 "new" [] [], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@113..114 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@114..115 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@115..117 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@117..118 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@118..119 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@119..120 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@120..121 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@121..123 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@123..124 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@124..126 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@126..127 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@127..129 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@129..130 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@130..132 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@132..135 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@135..141 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@141..142 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@142..148 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@148..150 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@150..152 "=" [] [Whitespace(" ")], - ty: TsConstructorType { - abstract_token: ABSTRACT_KW@152..161 "abstract" [] [Whitespace(" ")], - new_token: NEW_KW@161..164 "new" [] [], - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@164..165 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@165..166 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@166..168 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@168..169 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@169..170 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@170..171 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@171..172 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@172..174 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@174..175 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@175..177 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@177..178 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@178..180 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@180..181 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@183..186 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@186..192 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@192..193 ";" [] [], - }, - ], - eof_token: EOF@193..194 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..194 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..193 - 0: TS_TYPE_ALIAS_DECLARATION@0..45 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@9..44 - 0: (empty) - 1: NEW_KW@9..12 "new" [] [] - 2: (empty) - 3: JS_PARAMETERS@12..35 - 0: L_PAREN@12..13 "(" [] [] - 1: JS_PARAMETER_LIST@13..33 - 0: JS_FORMAL_PARAMETER@13..22 - 0: JS_DECORATOR_LIST@13..13 - 1: JS_IDENTIFIER_BINDING@13..14 - 0: IDENT@13..14 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@14..22 - 0: COLON@14..16 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@16..22 - 0: STRING_KW@16..22 "string" [] [] - 4: (empty) - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@24..33 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@25..33 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@27..33 - 0: NUMBER_KW@27..33 "number" [] [] - 4: (empty) - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@38..44 - 0: STRING_KW@38..44 "string" [] [] - 5: SEMICOLON@44..45 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@45..100 - 0: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@51..53 - 0: IDENT@51..53 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@53..55 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@55..99 - 0: ABSTRACT_KW@55..64 "abstract" [] [Whitespace(" ")] - 1: NEW_KW@64..67 "new" [] [] - 2: (empty) - 3: JS_PARAMETERS@67..90 - 0: L_PAREN@67..68 "(" [] [] - 1: JS_PARAMETER_LIST@68..88 - 0: JS_FORMAL_PARAMETER@68..77 - 0: JS_DECORATOR_LIST@68..68 - 1: JS_IDENTIFIER_BINDING@68..69 - 0: IDENT@68..69 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@69..77 - 0: COLON@69..71 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@71..77 - 0: STRING_KW@71..77 "string" [] [] - 4: (empty) - 1: COMMA@77..79 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@79..88 - 0: JS_DECORATOR_LIST@79..79 - 1: JS_IDENTIFIER_BINDING@79..80 - 0: IDENT@79..80 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@80..88 - 0: COLON@80..82 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@82..88 - 0: NUMBER_KW@82..88 "number" [] [] - 4: (empty) - 2: R_PAREN@88..90 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@93..99 - 0: STRING_KW@93..99 "string" [] [] - 5: SEMICOLON@99..100 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@100..142 - 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@106..108 - 0: IDENT@106..108 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@108..110 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@110..141 - 0: (empty) - 1: NEW_KW@110..113 "new" [] [] - 2: TS_TYPE_PARAMETERS@113..119 - 0: L_ANGLE@113..114 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@114..118 - 0: TS_TYPE_PARAMETER@114..115 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@114..114 - 1: TS_TYPE_PARAMETER_NAME@114..115 - 0: IDENT@114..115 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@115..117 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@117..118 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@117..117 - 1: TS_TYPE_PARAMETER_NAME@117..118 - 0: IDENT@117..118 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@118..119 ">" [] [] - 3: JS_PARAMETERS@119..132 - 0: L_PAREN@119..120 "(" [] [] - 1: JS_PARAMETER_LIST@120..130 - 0: JS_FORMAL_PARAMETER@120..124 - 0: JS_DECORATOR_LIST@120..120 - 1: JS_IDENTIFIER_BINDING@120..121 - 0: IDENT@120..121 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@121..124 - 0: COLON@121..123 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@123..124 - 0: JS_REFERENCE_IDENTIFIER@123..124 - 0: IDENT@123..124 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@124..126 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@126..130 - 0: JS_DECORATOR_LIST@126..126 - 1: JS_IDENTIFIER_BINDING@126..127 - 0: IDENT@126..127 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@127..130 - 0: COLON@127..129 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@129..130 - 0: JS_REFERENCE_IDENTIFIER@129..130 - 0: IDENT@129..130 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@130..132 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@132..135 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@135..141 - 0: STRING_KW@135..141 "string" [] [] - 5: SEMICOLON@141..142 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@142..193 - 0: TYPE_KW@142..148 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@148..150 - 0: IDENT@148..150 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@150..152 "=" [] [Whitespace(" ")] - 4: TS_CONSTRUCTOR_TYPE@152..192 - 0: ABSTRACT_KW@152..161 "abstract" [] [Whitespace(" ")] - 1: NEW_KW@161..164 "new" [] [] - 2: TS_TYPE_PARAMETERS@164..170 - 0: L_ANGLE@164..165 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@165..169 - 0: TS_TYPE_PARAMETER@165..166 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@165..165 - 1: TS_TYPE_PARAMETER_NAME@165..166 - 0: IDENT@165..166 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@166..168 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@168..169 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@168..168 - 1: TS_TYPE_PARAMETER_NAME@168..169 - 0: IDENT@168..169 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@169..170 ">" [] [] - 3: JS_PARAMETERS@170..183 - 0: L_PAREN@170..171 "(" [] [] - 1: JS_PARAMETER_LIST@171..181 - 0: JS_FORMAL_PARAMETER@171..175 - 0: JS_DECORATOR_LIST@171..171 - 1: JS_IDENTIFIER_BINDING@171..172 - 0: IDENT@171..172 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@172..175 - 0: COLON@172..174 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@174..175 - 0: JS_REFERENCE_IDENTIFIER@174..175 - 0: IDENT@174..175 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@175..177 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@177..181 - 0: JS_DECORATOR_LIST@177..177 - 1: JS_IDENTIFIER_BINDING@177..178 - 0: IDENT@177..178 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@178..181 - 0: COLON@178..180 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@180..181 - 0: JS_REFERENCE_IDENTIFIER@180..181 - 0: IDENT@180..181 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@181..183 ")" [] [Whitespace(" ")] - 4: FAT_ARROW@183..186 "=>" [] [Whitespace(" ")] - 5: TS_STRING_TYPE@186..192 - 0: STRING_KW@186..192 "string" [] [] - 5: SEMICOLON@192..193 ";" [] [] - 4: EOF@193..194 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast b/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast deleted file mode 100644 index 31608a48e0b0..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast +++ /dev/null @@ -1,67 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@15..20 "test" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@22..28 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@28..29 "X" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@29..31 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@32..33 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..33 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..32 - 0: TS_DECLARE_STATEMENT@0..32 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..32 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@15..20 - 0: IDENT@15..20 "test" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@20..32 - 0: L_CURLY@20..22 "{" [] [Whitespace(" ")] - 1: JS_MODULE_ITEM_LIST@22..31 - 0: JS_VARIABLE_STATEMENT@22..31 - 0: JS_VARIABLE_DECLARATION@22..29 - 0: (empty) - 1: CONST_KW@22..28 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@28..29 - 0: JS_VARIABLE_DECLARATOR@28..29 - 0: JS_IDENTIFIER_BINDING@28..29 - 0: IDENT@28..29 "X" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@29..31 ";" [] [Whitespace(" ")] - 2: R_CURLY@31..32 "}" [] [] - 4: EOF@32..33 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.rast b/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.rast deleted file mode 100644 index a2189b4e27ca..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.rast +++ /dev/null @@ -1,327 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@17..21 "test" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@21..22 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@22..23 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@25..26 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@26..28 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@28..29 "R" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@29..30 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@30..31 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@31..32 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@34..35 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@35..37 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@37..38 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@38..40 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@40..41 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@41..42 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@42..44 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "R" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@46..55 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@55..64 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@64..69 "test2" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@69..70 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@70..72 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@72..74 "a" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@74..75 "}" [] [], - }, - question_mark_token: QUESTION@75..76 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@76..78 ":" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@80..81 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@81..83 ":" [] [Whitespace(" ")], - ty: TsStringLiteralType { - literal_token: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@92..93 "}" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@93..94 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@94..102 "declare" [Newline("\n")] [], - }, - }, - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@102..112 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@112..129 "not_a_declaration" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@129..130 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@130..132 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@132..133 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@133..134 "}" [] [], - }, - }, - ], - eof_token: EOF@134..135 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..135 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..134 - 0: TS_DECLARE_STATEMENT@0..46 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@8..46 - 0: (empty) - 1: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@17..21 - 0: IDENT@17..21 "test" [] [] - 3: TS_TYPE_PARAMETERS@21..30 - 0: L_ANGLE@21..22 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@22..29 - 0: TS_TYPE_PARAMETER@22..23 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@22..22 - 1: TS_TYPE_PARAMETER_NAME@22..23 - 0: IDENT@22..23 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@23..25 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@25..26 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@25..25 - 1: TS_TYPE_PARAMETER_NAME@25..26 - 0: IDENT@25..26 "B" [] [] - 2: (empty) - 3: (empty) - 3: COMMA@26..28 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@28..29 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@28..28 - 1: TS_TYPE_PARAMETER_NAME@28..29 - 0: IDENT@28..29 "R" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@29..30 ">" [] [] - 4: JS_PARAMETERS@30..42 - 0: L_PAREN@30..31 "(" [] [] - 1: JS_PARAMETER_LIST@31..41 - 0: JS_FORMAL_PARAMETER@31..35 - 0: JS_DECORATOR_LIST@31..31 - 1: JS_IDENTIFIER_BINDING@31..32 - 0: IDENT@31..32 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@32..35 - 0: COLON@32..34 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@34..35 - 0: JS_REFERENCE_IDENTIFIER@34..35 - 0: IDENT@34..35 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@35..37 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@37..41 - 0: JS_DECORATOR_LIST@37..37 - 1: JS_IDENTIFIER_BINDING@37..38 - 0: IDENT@37..38 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@38..41 - 0: COLON@38..40 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@40..41 - 0: JS_REFERENCE_IDENTIFIER@40..41 - 0: IDENT@40..41 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@41..42 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@42..45 - 0: COLON@42..44 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "R" [] [] - 1: (empty) - 6: SEMICOLON@45..46 ";" [] [] - 1: TS_DECLARE_STATEMENT@46..94 - 0: DECLARE_KW@46..55 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@55..94 - 0: (empty) - 1: FUNCTION_KW@55..64 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@64..69 - 0: IDENT@64..69 "test2" [] [] - 3: (empty) - 4: JS_PARAMETERS@69..94 - 0: L_PAREN@69..70 "(" [] [] - 1: JS_PARAMETER_LIST@70..93 - 0: JS_FORMAL_PARAMETER@70..93 - 0: JS_DECORATOR_LIST@70..70 - 1: JS_OBJECT_BINDING_PATTERN@70..75 - 0: L_CURLY@70..72 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@72..74 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@72..74 - 0: JS_IDENTIFIER_BINDING@72..74 - 0: IDENT@72..74 "a" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@74..75 "}" [] [] - 2: QUESTION@75..76 "?" [] [] - 3: TS_TYPE_ANNOTATION@76..93 - 0: COLON@76..78 ":" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@78..93 - 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@80..92 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@80..92 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@80..81 - 0: IDENT@80..81 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@81..92 - 0: COLON@81..83 ":" [] [Whitespace(" ")] - 1: TS_STRING_LITERAL_TYPE@83..92 - 0: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@92..93 "}" [] [] - 4: (empty) - 2: R_PAREN@93..94 ")" [] [] - 5: (empty) - 6: (empty) - 2: JS_EXPRESSION_STATEMENT@94..102 - 0: JS_IDENTIFIER_EXPRESSION@94..102 - 0: JS_REFERENCE_IDENTIFIER@94..102 - 0: IDENT@94..102 "declare" [Newline("\n")] [] - 1: (empty) - 3: JS_FUNCTION_DECLARATION@102..134 - 0: (empty) - 1: FUNCTION_KW@102..112 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@112..129 - 0: IDENT@112..129 "not_a_declaration" [] [] - 4: (empty) - 5: JS_PARAMETERS@129..132 - 0: L_PAREN@129..130 "(" [] [] - 1: JS_PARAMETER_LIST@130..130 - 2: R_PAREN@130..132 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@132..134 - 0: L_CURLY@132..133 "{" [] [] - 1: JS_DIRECTIVE_LIST@133..133 - 2: JS_STATEMENT_LIST@133..133 - 3: R_CURLY@133..134 "}" [] [] - 4: EOF@134..135 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.rast deleted file mode 100644 index 3aeb6a517873..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.rast +++ /dev/null @@ -1,107 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@19..20 "{" [] [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@39..43 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@43..44 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@44..50 "option" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@50..52 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@52..55 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@55..56 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@56..58 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@58..62 "void" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@62..64 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: TS_DECLARE_STATEMENT@0..64 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@8..64 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@15..19 - 0: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@19..64 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_MODULE_ITEM_LIST@20..62 - 0: JS_EXPORT@20..62 - 0: JS_DECORATOR_LIST@20..20 - 1: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: TS_DECLARE_FUNCTION_DECLARATION@30..62 - 0: (empty) - 1: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@39..43 - 0: IDENT@39..43 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@43..56 - 0: L_PAREN@43..44 "(" [] [] - 1: JS_PARAMETER_LIST@44..55 - 0: JS_FORMAL_PARAMETER@44..55 - 0: JS_DECORATOR_LIST@44..44 - 1: JS_IDENTIFIER_BINDING@44..50 - 0: IDENT@44..50 "option" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@50..55 - 0: COLON@50..52 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@52..55 - 0: ANY_KW@52..55 "any" [] [] - 4: (empty) - 2: R_PAREN@55..56 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@56..62 - 0: COLON@56..58 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@58..62 - 0: VOID_KW@58..62 "void" [] [] - 6: (empty) - 2: R_CURLY@62..64 "}" [Newline("\n")] [] - 4: EOF@64..65 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.rast deleted file mode 100644 index 8c9e022b1db7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.rast +++ /dev/null @@ -1,210 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@19..20 "{" [] [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@30..38 "default" [] [Whitespace(" ")], - declaration: TsDeclareFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@38..46 "function" [] [], - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@46..47 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@47..53 "option" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@53..55 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@55..58 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@58..59 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@59..61 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@61..65 "void" [] [], - }, - }, - semicolon_token: missing (optional), - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@65..67 "}" [Newline("\n")] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@67..76 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@76..83 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@83..87 "'y'" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@87..88 "{" [] [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@88..98 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")], - declaration: TsDeclareFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@106..115 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@115..119 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@119..120 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@120..126 "option" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@126..128 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@128..131 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@131..132 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@132..134 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@134..138 "void" [] [], - }, - }, - semicolon_token: missing (optional), - }, - semicolon_token: missing (optional), - }, - }, - ], - r_curly_token: R_CURLY@138..140 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@140..141 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..141 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..140 - 0: TS_DECLARE_STATEMENT@0..67 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@8..67 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@15..19 - 0: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@19..67 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_MODULE_ITEM_LIST@20..65 - 0: JS_EXPORT@20..65 - 0: JS_DECORATOR_LIST@20..20 - 1: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@30..65 - 0: DEFAULT_KW@30..38 "default" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@38..65 - 0: (empty) - 1: FUNCTION_KW@38..46 "function" [] [] - 2: (empty) - 3: (empty) - 4: JS_PARAMETERS@46..59 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_PARAMETER_LIST@47..58 - 0: JS_FORMAL_PARAMETER@47..58 - 0: JS_DECORATOR_LIST@47..47 - 1: JS_IDENTIFIER_BINDING@47..53 - 0: IDENT@47..53 "option" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@53..58 - 0: COLON@53..55 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@55..58 - 0: ANY_KW@55..58 "any" [] [] - 4: (empty) - 2: R_PAREN@58..59 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@59..65 - 0: COLON@59..61 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@61..65 - 0: VOID_KW@61..65 "void" [] [] - 6: (empty) - 2: (empty) - 2: R_CURLY@65..67 "}" [Newline("\n")] [] - 1: TS_DECLARE_STATEMENT@67..140 - 0: DECLARE_KW@67..76 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@76..140 - 0: MODULE_KW@76..83 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@83..87 - 0: JS_STRING_LITERAL@83..87 "'y'" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@87..140 - 0: L_CURLY@87..88 "{" [] [] - 1: JS_MODULE_ITEM_LIST@88..138 - 0: JS_EXPORT@88..138 - 0: JS_DECORATOR_LIST@88..88 - 1: EXPORT_KW@88..98 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@98..138 - 0: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@106..138 - 0: (empty) - 1: FUNCTION_KW@106..115 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@115..119 - 0: IDENT@115..119 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@119..132 - 0: L_PAREN@119..120 "(" [] [] - 1: JS_PARAMETER_LIST@120..131 - 0: JS_FORMAL_PARAMETER@120..131 - 0: JS_DECORATOR_LIST@120..120 - 1: JS_IDENTIFIER_BINDING@120..126 - 0: IDENT@120..126 "option" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@126..131 - 0: COLON@126..128 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@128..131 - 0: ANY_KW@128..131 "any" [] [] - 4: (empty) - 2: R_PAREN@131..132 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@132..138 - 0: COLON@132..134 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@134..138 - 0: VOID_KW@134..138 "void" [] [] - 6: (empty) - 2: (empty) - 2: R_CURLY@138..140 "}" [Newline("\n")] [] - 4: EOF@140..141 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.rast b/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.rast deleted file mode 100644 index e4481078b5a3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.rast +++ /dev/null @@ -1,150 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsTypeAliasDeclaration { - type_token: TYPE_KW@8..13 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@13..15 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@15..17 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@17..23 "string" [] [], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@24..33 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsTypeAliasDeclaration { - type_token: TYPE_KW@33..38 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@38..40 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@42..49 "string" [] [Whitespace(" ")], - }, - PIPE@49..51 "|" [] [Whitespace(" ")], - TsIntersectionType { - leading_separator_token: missing (optional), - types: TsIntersectionTypeElementList [ - TsNumberType { - number_token: NUMBER_KW@51..58 "number" [] [Whitespace(" ")], - }, - AMP@58..60 "&" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@60..62 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@62..63 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@63..65 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@65..71 "string" [] [], - }, - }, - separator_token: COMMA@71..73 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@73..74 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@74..76 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@76..83 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@83..84 "}" [] [], - }, - ], - }, - ], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: TS_DECLARE_STATEMENT@0..24 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_TYPE_ALIAS_DECLARATION@8..24 - 0: TYPE_KW@8..13 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@13..15 - 0: IDENT@13..15 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@15..17 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@17..23 - 0: STRING_KW@17..23 "string" [] [] - 5: SEMICOLON@23..24 ";" [] [] - 1: TS_DECLARE_STATEMENT@24..84 - 0: DECLARE_KW@24..33 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ALIAS_DECLARATION@33..84 - 0: TYPE_KW@33..38 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@38..40 - 0: IDENT@38..40 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@40..42 "=" [] [Whitespace(" ")] - 4: TS_UNION_TYPE@42..84 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@42..84 - 0: TS_STRING_TYPE@42..49 - 0: STRING_KW@42..49 "string" [] [Whitespace(" ")] - 1: PIPE@49..51 "|" [] [Whitespace(" ")] - 2: TS_INTERSECTION_TYPE@51..84 - 0: (empty) - 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@51..84 - 0: TS_NUMBER_TYPE@51..58 - 0: NUMBER_KW@51..58 "number" [] [Whitespace(" ")] - 1: AMP@58..60 "&" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@60..84 - 0: L_CURLY@60..62 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@62..83 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@62..73 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@62..63 - 0: IDENT@62..63 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@63..71 - 0: COLON@63..65 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@65..71 - 0: STRING_KW@65..71 "string" [] [] - 4: COMMA@71..73 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@73..83 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@73..74 - 0: IDENT@73..74 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@74..83 - 0: COLON@74..76 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@76..83 - 0: NUMBER_KW@76..83 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@83..84 "}" [] [] - 5: (empty) - 4: EOF@84..85 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.rast deleted file mode 100644 index 339748a8ab59..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.rast +++ /dev/null @@ -1,87 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@12..14 "@" [Newline("\n")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@14..18 "test" [] [], - }, - }, - }, - ], - name: JsComputedMemberName { - l_brack_token: L_BRACK@18..20 "[" [Newline("\n")] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@20..23 "'a'" [] [], - }, - r_brack_token: R_BRACK@23..24 "]" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@26..32 "string" [] [], - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - ], - r_curly_token: R_CURLY@33..35 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: JS_CLASS_DECLARATION@0..35 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..33 - 0: JS_PROPERTY_CLASS_MEMBER@12..33 - 0: JS_PROPERTY_MODIFIER_LIST@12..18 - 0: JS_DECORATOR@12..18 - 0: AT@12..14 "@" [Newline("\n")] [] - 1: JS_IDENTIFIER_EXPRESSION@14..18 - 0: JS_REFERENCE_IDENTIFIER@14..18 - 0: IDENT@14..18 "test" [] [] - 1: JS_COMPUTED_MEMBER_NAME@18..24 - 0: L_BRACK@18..20 "[" [Newline("\n")] [] - 1: JS_STRING_LITERAL_EXPRESSION@20..23 - 0: JS_STRING_LITERAL@20..23 "'a'" [] [] - 2: R_BRACK@23..24 "]" [] [] - 2: TS_TYPE_ANNOTATION@24..32 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@26..32 - 0: STRING_KW@26..32 "string" [] [] - 3: (empty) - 4: SEMICOLON@32..33 ";" [] [] - 9: R_CURLY@33..35 "}" [Newline("\n")] [] - 4: EOF@35..36 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.rast deleted file mode 100644 index 92463de35f4c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.rast +++ /dev/null @@ -1,236 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@12..16 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..21 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - name: JsLiteralMemberName { - value: IDENT@21..25 "prop" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@27..33 "string" [] [], - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@34..38 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..43 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@43..49 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@49..50 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@52..53 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@53..54 "}" [] [], - }, - }, - JsGetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@54..58 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@58..63 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - get_token: GET_KW@63..67 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@67..73 "getter" [] [], - }, - l_paren_token: L_PAREN@73..74 "(" [] [], - r_paren_token: R_PAREN@74..76 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@76..77 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@77..78 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [ - JsDecorator { - at_token: AT@78..82 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@82..87 "test" [] [Whitespace(" ")], - }, - }, - }, - ], - set_token: SET_KW@87..91 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@91..97 "setter" [] [], - }, - l_paren_token: L_PAREN@97..98 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@98..99 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@101..102 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@102..103 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@103..105 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@105..106 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..106 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..105 - 0: JS_CLASS_DECLARATION@0..105 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..103 - 0: JS_PROPERTY_CLASS_MEMBER@12..34 - 0: JS_PROPERTY_MODIFIER_LIST@12..21 - 0: JS_DECORATOR@12..21 - 0: AT@12..16 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@16..21 - 0: JS_REFERENCE_IDENTIFIER@16..21 - 0: IDENT@16..21 "test" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@21..25 - 0: IDENT@21..25 "prop" [] [] - 2: TS_TYPE_ANNOTATION@25..33 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@27..33 - 0: STRING_KW@27..33 "string" [] [] - 3: (empty) - 4: SEMICOLON@33..34 ";" [] [] - 1: JS_METHOD_CLASS_MEMBER@34..54 - 0: JS_METHOD_MODIFIER_LIST@34..43 - 0: JS_DECORATOR@34..43 - 0: AT@34..38 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@38..43 - 0: JS_REFERENCE_IDENTIFIER@38..43 - 0: IDENT@38..43 "test" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@43..49 - 0: IDENT@43..49 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@49..52 - 0: L_PAREN@49..50 "(" [] [] - 1: JS_PARAMETER_LIST@50..50 - 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@52..54 - 0: L_CURLY@52..53 "{" [] [] - 1: JS_DIRECTIVE_LIST@53..53 - 2: JS_STATEMENT_LIST@53..53 - 3: R_CURLY@53..54 "}" [] [] - 2: JS_GETTER_CLASS_MEMBER@54..78 - 0: JS_METHOD_MODIFIER_LIST@54..63 - 0: JS_DECORATOR@54..63 - 0: AT@54..58 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@58..63 - 0: JS_REFERENCE_IDENTIFIER@58..63 - 0: IDENT@58..63 "test" [] [Whitespace(" ")] - 1: GET_KW@63..67 "get" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@67..73 - 0: IDENT@67..73 "getter" [] [] - 3: L_PAREN@73..74 "(" [] [] - 4: R_PAREN@74..76 ")" [] [Whitespace(" ")] - 5: (empty) - 6: JS_FUNCTION_BODY@76..78 - 0: L_CURLY@76..77 "{" [] [] - 1: JS_DIRECTIVE_LIST@77..77 - 2: JS_STATEMENT_LIST@77..77 - 3: R_CURLY@77..78 "}" [] [] - 3: JS_SETTER_CLASS_MEMBER@78..103 - 0: JS_METHOD_MODIFIER_LIST@78..87 - 0: JS_DECORATOR@78..87 - 0: AT@78..82 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_IDENTIFIER_EXPRESSION@82..87 - 0: JS_REFERENCE_IDENTIFIER@82..87 - 0: IDENT@82..87 "test" [] [Whitespace(" ")] - 1: SET_KW@87..91 "set" [] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@91..97 - 0: IDENT@91..97 "setter" [] [] - 3: L_PAREN@97..98 "(" [] [] - 4: JS_FORMAL_PARAMETER@98..99 - 0: JS_DECORATOR_LIST@98..98 - 1: JS_IDENTIFIER_BINDING@98..99 - 0: IDENT@98..99 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@99..101 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@101..103 - 0: L_CURLY@101..102 "{" [] [] - 1: JS_DIRECTIVE_LIST@102..102 - 2: JS_STATEMENT_LIST@102..102 - 3: R_CURLY@102..103 "}" [] [] - 9: R_CURLY@103..105 "}" [Newline("\n")] [] - 4: EOF@105..106 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.rast deleted file mode 100644 index 7d77c037ebb6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.rast +++ /dev/null @@ -1,82 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@0..1 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@1..5 "test" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@5..6 "(" [] [], - args: JsCallArgumentList [ - JsPreUpdateExpression { - operator_token: MINUS2@6..8 "--" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@8..9 "a" [] [], - }, - }, - ], - r_paren_token: R_PAREN@9..10 ")" [] [], - }, - }, - }, - ], - abstract_token: missing (optional), - class_token: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@17..22 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@22..23 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@23..24 "}" [] [], - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_CLASS_DECLARATION@0..24 - 0: JS_DECORATOR_LIST@0..10 - 0: JS_DECORATOR@0..10 - 0: AT@0..1 "@" [] [] - 1: JS_CALL_EXPRESSION@1..10 - 0: JS_IDENTIFIER_EXPRESSION@1..5 - 0: JS_REFERENCE_IDENTIFIER@1..5 - 0: IDENT@1..5 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@5..10 - 0: L_PAREN@5..6 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@6..9 - 0: JS_PRE_UPDATE_EXPRESSION@6..9 - 0: MINUS2@6..8 "--" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@8..9 - 0: IDENT@8..9 "a" [] [] - 2: R_PAREN@9..10 ")" [] [] - 1: (empty) - 2: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@17..22 - 0: IDENT@17..22 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@22..23 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@23..23 - 9: R_CURLY@23..24 "}" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast deleted file mode 100644 index 577edeec2b3e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast +++ /dev/null @@ -1,154 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@7..13 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@13..17 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@17..18 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsDecorator { - at_token: AT@18..21 "@" [Newline("\n"), Whitespace(" ")] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..30 "Decorator" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@30..31 "(" [] [], - args: JsCallArgumentList [ - JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@31..32 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@32..35 "val" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@35..37 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@37..40 "=>" [] [Whitespace(" ")], - body: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..43 "val" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@43..44 ")" [] [], - }, - }, - }, - ], - name: JsLiteralMemberName { - value: IDENT@44..54 "badField" [Newline("\n"), Whitespace(" ")] [], - }, - property_annotation: TsDefinitePropertyAnnotation { - excl_token: BANG@54..55 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@55..57 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@57..63 "number" [] [], - }, - }, - }, - value: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@63..65 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@65..66 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..66 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..65 - 0: JS_EXPORT@0..65 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@7..65 - 0: JS_DECORATOR_LIST@7..7 - 1: (empty) - 2: CLASS_KW@7..13 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@13..17 - 0: IDENT@13..17 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@17..18 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@18..63 - 0: JS_PROPERTY_CLASS_MEMBER@18..63 - 0: JS_PROPERTY_MODIFIER_LIST@18..44 - 0: JS_DECORATOR@18..44 - 0: AT@18..21 "@" [Newline("\n"), Whitespace(" ")] [] - 1: JS_CALL_EXPRESSION@21..44 - 0: JS_IDENTIFIER_EXPRESSION@21..30 - 0: JS_REFERENCE_IDENTIFIER@21..30 - 0: IDENT@21..30 "Decorator" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@30..44 - 0: L_PAREN@30..31 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@31..43 - 0: JS_ARROW_FUNCTION_EXPRESSION@31..43 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@31..37 - 0: L_PAREN@31..32 "(" [] [] - 1: JS_PARAMETER_LIST@32..35 - 0: JS_FORMAL_PARAMETER@32..35 - 0: JS_DECORATOR_LIST@32..32 - 1: JS_IDENTIFIER_BINDING@32..35 - 0: IDENT@32..35 "val" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@35..37 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@37..40 "=>" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@40..43 - 0: JS_REFERENCE_IDENTIFIER@40..43 - 0: IDENT@40..43 "val" [] [] - 2: R_PAREN@43..44 ")" [] [] - 1: JS_LITERAL_MEMBER_NAME@44..54 - 0: IDENT@44..54 "badField" [Newline("\n"), Whitespace(" ")] [] - 2: TS_DEFINITE_PROPERTY_ANNOTATION@54..63 - 0: BANG@54..55 "!" [] [] - 1: TS_TYPE_ANNOTATION@55..63 - 0: COLON@55..57 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@57..63 - 0: NUMBER_KW@57..63 "number" [] [] - 3: (empty) - 4: (empty) - 9: R_CURLY@63..65 "}" [Newline("\n")] [] - 4: EOF@65..66 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.rast deleted file mode 100644 index f42bc095bea3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.rast +++ /dev/null @@ -1,590 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@25..26 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@26..27 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..31 "foo" [] [Whitespace(" ")], - }, - }, - }, - ], - modifiers: TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@40..41 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@41..43 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@43..49 "number" [] [], - }, - }, - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@51..52 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@62..65 "CC" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@65..66 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@82..83 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@83..84 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..88 "foo" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@88..89 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@89..92 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@92..93 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@93..96 "arg" [] [], - }, - }, - ], - r_paren_token: R_PAREN@96..98 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - modifiers: TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@107..108 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@108..110 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@110..116 "number" [] [], - }, - }, - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@118..119 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@119..120 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@120..122 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@129..132 "CC" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@132..133 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@149..150 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@150..151 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@151..155 "foo" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@155..156 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@156..159 "dec" [] [], - }, - }, - operator_token: DOT@159..160 "." [] [], - member: JsName { - value_token: IDENT@160..166 "method" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@166..167 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@167..170 "arg" [] [], - }, - }, - ], - r_paren_token: R_PAREN@170..172 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - modifiers: TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@181..182 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@182..184 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@184..190 "number" [] [], - }, - }, - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@190..192 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@192..193 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@193..194 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@194..196 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@203..207 "CCC" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@207..208 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@224..225 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@225..226 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@226..230 "foo" [] [Whitespace(" ")], - }, - }, - }, - JsDecorator { - at_token: AT@230..231 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@231..234 "dec" [] [], - }, - }, - operator_token: DOT@234..235 "." [] [], - member: JsName { - value_token: IDENT@235..241 "method" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@241..242 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@242..245 "arg" [] [], - }, - }, - ], - r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@264..265 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@265..267 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@267..273 "number" [] [], - }, - }, - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@273..275 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@275..276 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@276..277 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@277..279 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@279..280 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..280 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..279 - 0: JS_CLASS_DECLARATION@0..55 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..53 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..53 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..25 - 0: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@25..51 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@26..49 - 0: TS_PROPERTY_PARAMETER@26..49 - 0: JS_DECORATOR_LIST@26..31 - 0: JS_DECORATOR@26..31 - 0: AT@26..27 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@27..31 - 0: JS_REFERENCE_IDENTIFIER@27..31 - 0: IDENT@27..31 "foo" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@31..40 - 0: TS_READONLY_MODIFIER@31..40 - 0: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@40..49 - 0: JS_DECORATOR_LIST@40..40 - 1: JS_IDENTIFIER_BINDING@40..41 - 0: IDENT@40..41 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@41..49 - 0: COLON@41..43 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@43..49 - 0: NUMBER_KW@43..49 "number" [] [] - 4: (empty) - 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@51..53 - 0: L_CURLY@51..52 "{" [] [] - 1: JS_DIRECTIVE_LIST@52..52 - 2: JS_STATEMENT_LIST@52..52 - 3: R_CURLY@52..53 "}" [] [] - 9: R_CURLY@53..55 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@55..122 - 0: JS_DECORATOR_LIST@55..55 - 1: (empty) - 2: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@62..65 - 0: IDENT@62..65 "CC" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@65..66 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@66..120 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@66..120 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@66..66 - 1: JS_LITERAL_MEMBER_NAME@66..82 - 0: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@82..118 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@83..116 - 0: TS_PROPERTY_PARAMETER@83..116 - 0: JS_DECORATOR_LIST@83..98 - 0: JS_DECORATOR@83..88 - 0: AT@83..84 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@84..88 - 0: JS_REFERENCE_IDENTIFIER@84..88 - 0: IDENT@84..88 "foo" [] [Whitespace(" ")] - 1: JS_DECORATOR@88..98 - 0: AT@88..89 "@" [] [] - 1: JS_CALL_EXPRESSION@89..98 - 0: JS_IDENTIFIER_EXPRESSION@89..92 - 0: JS_REFERENCE_IDENTIFIER@89..92 - 0: IDENT@89..92 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@92..98 - 0: L_PAREN@92..93 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@93..96 - 0: JS_IDENTIFIER_EXPRESSION@93..96 - 0: JS_REFERENCE_IDENTIFIER@93..96 - 0: IDENT@93..96 "arg" [] [] - 2: R_PAREN@96..98 ")" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@98..107 - 0: TS_READONLY_MODIFIER@98..107 - 0: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@107..116 - 0: JS_DECORATOR_LIST@107..107 - 1: JS_IDENTIFIER_BINDING@107..108 - 0: IDENT@107..108 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@108..116 - 0: COLON@108..110 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@110..116 - 0: NUMBER_KW@110..116 "number" [] [] - 4: (empty) - 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@118..120 - 0: L_CURLY@118..119 "{" [] [] - 1: JS_DIRECTIVE_LIST@119..119 - 2: JS_STATEMENT_LIST@119..119 - 3: R_CURLY@119..120 "}" [] [] - 9: R_CURLY@120..122 "}" [Newline("\n")] [] - 2: JS_CLASS_DECLARATION@122..196 - 0: JS_DECORATOR_LIST@122..122 - 1: (empty) - 2: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@129..132 - 0: IDENT@129..132 "CC" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@132..133 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@133..194 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@133..194 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@133..133 - 1: JS_LITERAL_MEMBER_NAME@133..149 - 0: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@149..192 - 0: L_PAREN@149..150 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@150..190 - 0: TS_PROPERTY_PARAMETER@150..190 - 0: JS_DECORATOR_LIST@150..172 - 0: JS_DECORATOR@150..155 - 0: AT@150..151 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@151..155 - 0: JS_REFERENCE_IDENTIFIER@151..155 - 0: IDENT@151..155 "foo" [] [Whitespace(" ")] - 1: JS_DECORATOR@155..172 - 0: AT@155..156 "@" [] [] - 1: JS_CALL_EXPRESSION@156..172 - 0: JS_STATIC_MEMBER_EXPRESSION@156..166 - 0: JS_IDENTIFIER_EXPRESSION@156..159 - 0: JS_REFERENCE_IDENTIFIER@156..159 - 0: IDENT@156..159 "dec" [] [] - 1: DOT@159..160 "." [] [] - 2: JS_NAME@160..166 - 0: IDENT@160..166 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@166..172 - 0: L_PAREN@166..167 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@167..170 - 0: JS_IDENTIFIER_EXPRESSION@167..170 - 0: JS_REFERENCE_IDENTIFIER@167..170 - 0: IDENT@167..170 "arg" [] [] - 2: R_PAREN@170..172 ")" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@172..181 - 0: TS_READONLY_MODIFIER@172..181 - 0: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@181..190 - 0: JS_DECORATOR_LIST@181..181 - 1: JS_IDENTIFIER_BINDING@181..182 - 0: IDENT@181..182 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@182..190 - 0: COLON@182..184 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@184..190 - 0: NUMBER_KW@184..190 "number" [] [] - 4: (empty) - 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@192..194 - 0: L_CURLY@192..193 "{" [] [] - 1: JS_DIRECTIVE_LIST@193..193 - 2: JS_STATEMENT_LIST@193..193 - 3: R_CURLY@193..194 "}" [] [] - 9: R_CURLY@194..196 "}" [Newline("\n")] [] - 3: JS_CLASS_DECLARATION@196..279 - 0: JS_DECORATOR_LIST@196..196 - 1: (empty) - 2: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@203..207 - 0: IDENT@203..207 "CCC" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@207..208 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@208..277 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@208..277 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@208..208 - 1: JS_LITERAL_MEMBER_NAME@208..224 - 0: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@224..275 - 0: L_PAREN@224..225 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@225..273 - 0: TS_PROPERTY_PARAMETER@225..273 - 0: JS_DECORATOR_LIST@225..247 - 0: JS_DECORATOR@225..230 - 0: AT@225..226 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@226..230 - 0: JS_REFERENCE_IDENTIFIER@226..230 - 0: IDENT@226..230 "foo" [] [Whitespace(" ")] - 1: JS_DECORATOR@230..247 - 0: AT@230..231 "@" [] [] - 1: JS_CALL_EXPRESSION@231..247 - 0: JS_STATIC_MEMBER_EXPRESSION@231..241 - 0: JS_IDENTIFIER_EXPRESSION@231..234 - 0: JS_REFERENCE_IDENTIFIER@231..234 - 0: IDENT@231..234 "dec" [] [] - 1: DOT@234..235 "." [] [] - 2: JS_NAME@235..241 - 0: IDENT@235..241 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@241..247 - 0: L_PAREN@241..242 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@242..245 - 0: JS_IDENTIFIER_EXPRESSION@242..245 - 0: JS_REFERENCE_IDENTIFIER@242..245 - 0: IDENT@242..245 "arg" [] [] - 2: R_PAREN@245..247 ")" [] [Whitespace(" ")] - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@247..264 - 0: TS_ACCESSIBILITY_MODIFIER@247..255 - 0: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@255..264 - 0: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@264..273 - 0: JS_DECORATOR_LIST@264..264 - 1: JS_IDENTIFIER_BINDING@264..265 - 0: IDENT@264..265 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@265..273 - 0: COLON@265..267 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@267..273 - 0: NUMBER_KW@267..273 "number" [] [] - 4: (empty) - 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@275..277 - 0: L_CURLY@275..276 "{" [] [] - 1: JS_DIRECTIVE_LIST@276..276 - 2: JS_STATEMENT_LIST@276..276 - 3: R_CURLY@276..277 "}" [] [] - 9: R_CURLY@277..279 "}" [Newline("\n")] [] - 4: EOF@279..280 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.rast deleted file mode 100644 index cef72941d84f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.rast +++ /dev/null @@ -1,1002 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@21..22 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@22..26 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@26..27 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@27..29 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@29..35 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@35..37 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@37..38 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..42 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@42..48 "third" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@48..50 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@50..59 "'default'" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@61..62 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@62..63 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@74..75 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@75..76 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@76..79 "dec" [] [], - }, - }, - operator_token: DOT@79..80 "." [] [], - member: JsName { - value_token: IDENT@80..82 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@82..83 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@85..86 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@86..88 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@88..94 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@94..96 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@96..97 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@97..100 "dec" [] [], - }, - }, - operator_token: DOT@100..101 "." [] [], - member: JsName { - value_token: IDENT@101..103 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@103..104 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@104..106 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@106..112 "third" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@112..114 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@114..123 "'default'" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@123..125 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@125..126 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@126..127 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@138..139 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@139..140 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@140..143 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@143..144 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@144..146 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@146..147 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@147..149 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@149..155 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@155..157 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@157..158 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@158..161 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@161..162 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@162..164 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@164..170 "third" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@170..172 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@172..181 "'default'" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@183..184 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@184..185 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@197..203 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@203..204 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@204..205 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@205..209 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@209..210 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@210..212 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@212..218 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@218..220 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@220..221 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@221..225 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@225..231 "third" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@231..233 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@233..242 "'default'" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@242..244 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@244..245 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@245..246 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@258..264 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@264..265 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@265..266 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@266..269 "dec" [] [], - }, - }, - operator_token: DOT@269..270 "." [] [], - member: JsName { - value_token: IDENT@270..272 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@272..273 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@273..275 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@275..276 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@276..278 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@278..284 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@284..286 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@286..287 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@287..290 "dec" [] [], - }, - }, - operator_token: DOT@290..291 "." [] [], - member: JsName { - value_token: IDENT@291..293 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@293..294 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@294..296 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@296..302 "third" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@302..304 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@304..313 "'default'" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@313..315 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@315..316 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@316..317 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@329..335 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@335..336 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@336..337 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@337..340 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@340..341 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@341..343 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@343..344 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@344..346 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@346..352 "second" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@352..354 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@354..355 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@355..358 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@358..359 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@359..361 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@361..367 "third" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@367..369 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@369..378 "'default'" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@378..380 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@380..381 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@381..382 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@382..384 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@384..385 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..385 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..384 - 0: JS_CLASS_DECLARATION@0..384 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..382 - 0: JS_METHOD_CLASS_MEMBER@9..63 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@9..20 - 0: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@20..61 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..59 - 0: JS_FORMAL_PARAMETER@21..27 - 0: JS_DECORATOR_LIST@21..26 - 0: JS_DECORATOR@21..26 - 0: AT@21..22 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@22..26 - 0: JS_REFERENCE_IDENTIFIER@22..26 - 0: IDENT@22..26 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@26..27 - 0: IDENT@26..27 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@27..29 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@29..35 - 0: JS_DECORATOR_LIST@29..29 - 1: JS_IDENTIFIER_BINDING@29..35 - 0: IDENT@29..35 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@35..37 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@37..59 - 0: JS_DECORATOR_LIST@37..42 - 0: JS_DECORATOR@37..42 - 0: AT@37..38 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@38..42 - 0: JS_REFERENCE_IDENTIFIER@38..42 - 0: IDENT@38..42 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@42..48 - 0: IDENT@42..48 "third" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@48..59 - 0: EQ@48..50 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@50..59 - 0: JS_STRING_LITERAL@50..59 "'default'" [] [] - 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@61..63 - 0: L_CURLY@61..62 "{" [] [] - 1: JS_DIRECTIVE_LIST@62..62 - 2: JS_STATEMENT_LIST@62..62 - 3: R_CURLY@62..63 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@63..127 - 0: JS_METHOD_MODIFIER_LIST@63..63 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@63..74 - 0: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@74..125 - 0: L_PAREN@74..75 "(" [] [] - 1: JS_PARAMETER_LIST@75..123 - 0: JS_FORMAL_PARAMETER@75..86 - 0: JS_DECORATOR_LIST@75..85 - 0: JS_DECORATOR@75..85 - 0: AT@75..76 "@" [] [] - 1: JS_CALL_EXPRESSION@76..85 - 0: JS_STATIC_MEMBER_EXPRESSION@76..82 - 0: JS_IDENTIFIER_EXPRESSION@76..79 - 0: JS_REFERENCE_IDENTIFIER@76..79 - 0: IDENT@76..79 "dec" [] [] - 1: DOT@79..80 "." [] [] - 2: JS_NAME@80..82 - 0: IDENT@80..82 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@82..85 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@83..83 - 2: R_PAREN@83..85 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@85..86 - 0: IDENT@85..86 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@86..88 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@88..94 - 0: JS_DECORATOR_LIST@88..88 - 1: JS_IDENTIFIER_BINDING@88..94 - 0: IDENT@88..94 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@94..96 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@96..123 - 0: JS_DECORATOR_LIST@96..106 - 0: JS_DECORATOR@96..106 - 0: AT@96..97 "@" [] [] - 1: JS_CALL_EXPRESSION@97..106 - 0: JS_STATIC_MEMBER_EXPRESSION@97..103 - 0: JS_IDENTIFIER_EXPRESSION@97..100 - 0: JS_REFERENCE_IDENTIFIER@97..100 - 0: IDENT@97..100 "dec" [] [] - 1: DOT@100..101 "." [] [] - 2: JS_NAME@101..103 - 0: IDENT@101..103 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@103..106 - 0: L_PAREN@103..104 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@104..104 - 2: R_PAREN@104..106 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@106..112 - 0: IDENT@106..112 "third" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@112..123 - 0: EQ@112..114 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@114..123 - 0: JS_STRING_LITERAL@114..123 "'default'" [] [] - 2: R_PAREN@123..125 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@125..127 - 0: L_CURLY@125..126 "{" [] [] - 1: JS_DIRECTIVE_LIST@126..126 - 2: JS_STATEMENT_LIST@126..126 - 3: R_CURLY@126..127 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@127..185 - 0: JS_METHOD_MODIFIER_LIST@127..127 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@127..138 - 0: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@138..183 - 0: L_PAREN@138..139 "(" [] [] - 1: JS_PARAMETER_LIST@139..181 - 0: JS_FORMAL_PARAMETER@139..147 - 0: JS_DECORATOR_LIST@139..146 - 0: JS_DECORATOR@139..146 - 0: AT@139..140 "@" [] [] - 1: JS_CALL_EXPRESSION@140..146 - 0: JS_IDENTIFIER_EXPRESSION@140..143 - 0: JS_REFERENCE_IDENTIFIER@140..143 - 0: IDENT@140..143 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@143..146 - 0: L_PAREN@143..144 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@144..144 - 2: R_PAREN@144..146 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@146..147 - 0: IDENT@146..147 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@147..149 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@149..155 - 0: JS_DECORATOR_LIST@149..149 - 1: JS_IDENTIFIER_BINDING@149..155 - 0: IDENT@149..155 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@155..157 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@157..181 - 0: JS_DECORATOR_LIST@157..164 - 0: JS_DECORATOR@157..164 - 0: AT@157..158 "@" [] [] - 1: JS_CALL_EXPRESSION@158..164 - 0: JS_IDENTIFIER_EXPRESSION@158..161 - 0: JS_REFERENCE_IDENTIFIER@158..161 - 0: IDENT@158..161 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@161..164 - 0: L_PAREN@161..162 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@162..162 - 2: R_PAREN@162..164 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@164..170 - 0: IDENT@164..170 "third" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@170..181 - 0: EQ@170..172 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@172..181 - 0: JS_STRING_LITERAL@172..181 "'default'" [] [] - 2: R_PAREN@181..183 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@183..185 - 0: L_CURLY@183..184 "{" [] [] - 1: JS_DIRECTIVE_LIST@184..184 - 2: JS_STATEMENT_LIST@184..184 - 3: R_CURLY@184..185 "}" [] [] - 3: JS_METHOD_CLASS_MEMBER@185..246 - 0: JS_METHOD_MODIFIER_LIST@185..197 - 0: JS_STATIC_MODIFIER@185..197 - 0: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@197..203 - 0: IDENT@197..203 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@203..244 - 0: L_PAREN@203..204 "(" [] [] - 1: JS_PARAMETER_LIST@204..242 - 0: JS_FORMAL_PARAMETER@204..210 - 0: JS_DECORATOR_LIST@204..209 - 0: JS_DECORATOR@204..209 - 0: AT@204..205 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@205..209 - 0: JS_REFERENCE_IDENTIFIER@205..209 - 0: IDENT@205..209 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@209..210 - 0: IDENT@209..210 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@210..212 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@212..218 - 0: JS_DECORATOR_LIST@212..212 - 1: JS_IDENTIFIER_BINDING@212..218 - 0: IDENT@212..218 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@218..220 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@220..242 - 0: JS_DECORATOR_LIST@220..225 - 0: JS_DECORATOR@220..225 - 0: AT@220..221 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@221..225 - 0: JS_REFERENCE_IDENTIFIER@221..225 - 0: IDENT@221..225 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@225..231 - 0: IDENT@225..231 "third" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@231..242 - 0: EQ@231..233 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@233..242 - 0: JS_STRING_LITERAL@233..242 "'default'" [] [] - 2: R_PAREN@242..244 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@244..246 - 0: L_CURLY@244..245 "{" [] [] - 1: JS_DIRECTIVE_LIST@245..245 - 2: JS_STATEMENT_LIST@245..245 - 3: R_CURLY@245..246 "}" [] [] - 4: JS_METHOD_CLASS_MEMBER@246..317 - 0: JS_METHOD_MODIFIER_LIST@246..258 - 0: JS_STATIC_MODIFIER@246..258 - 0: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@258..264 - 0: IDENT@258..264 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@264..315 - 0: L_PAREN@264..265 "(" [] [] - 1: JS_PARAMETER_LIST@265..313 - 0: JS_FORMAL_PARAMETER@265..276 - 0: JS_DECORATOR_LIST@265..275 - 0: JS_DECORATOR@265..275 - 0: AT@265..266 "@" [] [] - 1: JS_CALL_EXPRESSION@266..275 - 0: JS_STATIC_MEMBER_EXPRESSION@266..272 - 0: JS_IDENTIFIER_EXPRESSION@266..269 - 0: JS_REFERENCE_IDENTIFIER@266..269 - 0: IDENT@266..269 "dec" [] [] - 1: DOT@269..270 "." [] [] - 2: JS_NAME@270..272 - 0: IDENT@270..272 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@272..275 - 0: L_PAREN@272..273 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@273..273 - 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@275..276 - 0: IDENT@275..276 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@276..278 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@278..284 - 0: JS_DECORATOR_LIST@278..278 - 1: JS_IDENTIFIER_BINDING@278..284 - 0: IDENT@278..284 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@284..286 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@286..313 - 0: JS_DECORATOR_LIST@286..296 - 0: JS_DECORATOR@286..296 - 0: AT@286..287 "@" [] [] - 1: JS_CALL_EXPRESSION@287..296 - 0: JS_STATIC_MEMBER_EXPRESSION@287..293 - 0: JS_IDENTIFIER_EXPRESSION@287..290 - 0: JS_REFERENCE_IDENTIFIER@287..290 - 0: IDENT@287..290 "dec" [] [] - 1: DOT@290..291 "." [] [] - 2: JS_NAME@291..293 - 0: IDENT@291..293 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@293..296 - 0: L_PAREN@293..294 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@294..294 - 2: R_PAREN@294..296 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@296..302 - 0: IDENT@296..302 "third" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@302..313 - 0: EQ@302..304 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@304..313 - 0: JS_STRING_LITERAL@304..313 "'default'" [] [] - 2: R_PAREN@313..315 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@315..317 - 0: L_CURLY@315..316 "{" [] [] - 1: JS_DIRECTIVE_LIST@316..316 - 2: JS_STATEMENT_LIST@316..316 - 3: R_CURLY@316..317 "}" [] [] - 5: JS_METHOD_CLASS_MEMBER@317..382 - 0: JS_METHOD_MODIFIER_LIST@317..329 - 0: JS_STATIC_MODIFIER@317..329 - 0: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@329..335 - 0: IDENT@329..335 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@335..380 - 0: L_PAREN@335..336 "(" [] [] - 1: JS_PARAMETER_LIST@336..378 - 0: JS_FORMAL_PARAMETER@336..344 - 0: JS_DECORATOR_LIST@336..343 - 0: JS_DECORATOR@336..343 - 0: AT@336..337 "@" [] [] - 1: JS_CALL_EXPRESSION@337..343 - 0: JS_IDENTIFIER_EXPRESSION@337..340 - 0: JS_REFERENCE_IDENTIFIER@337..340 - 0: IDENT@337..340 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@340..343 - 0: L_PAREN@340..341 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@341..341 - 2: R_PAREN@341..343 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@343..344 - 0: IDENT@343..344 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@344..346 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@346..352 - 0: JS_DECORATOR_LIST@346..346 - 1: JS_IDENTIFIER_BINDING@346..352 - 0: IDENT@346..352 "second" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@352..354 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@354..378 - 0: JS_DECORATOR_LIST@354..361 - 0: JS_DECORATOR@354..361 - 0: AT@354..355 "@" [] [] - 1: JS_CALL_EXPRESSION@355..361 - 0: JS_IDENTIFIER_EXPRESSION@355..358 - 0: JS_REFERENCE_IDENTIFIER@355..358 - 0: IDENT@355..358 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@358..361 - 0: L_PAREN@358..359 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@359..359 - 2: R_PAREN@359..361 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@361..367 - 0: IDENT@361..367 "third" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@367..378 - 0: EQ@367..369 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@369..378 - 0: JS_STRING_LITERAL@369..378 "'default'" [] [] - 2: R_PAREN@378..380 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@380..382 - 0: L_CURLY@380..381 "{" [] [] - 1: JS_DIRECTIVE_LIST@381..381 - 2: JS_STATEMENT_LIST@381..381 - 3: R_CURLY@381..382 "}" [] [] - 9: R_CURLY@382..384 "}" [Newline("\n")] [] - 4: EOF@384..385 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.rast b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.rast deleted file mode 100644 index 39f864144cf2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.rast +++ /dev/null @@ -1,261 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@18..21 "val" [] [], - }, - l_paren_token: L_PAREN@21..22 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@22..23 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..27 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@27..28 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@30..31 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@41..44 "val" [] [], - }, - l_paren_token: L_PAREN@44..45 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@45..46 "@" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..49 "dec" [] [], - }, - }, - operator_token: DOT@49..50 "." [] [], - member: JsName { - value_token: IDENT@50..52 "fn" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@52..53 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@55..56 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@58..59 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - }, - JsSetterClassMember { - modifiers: JsMethodModifierList [], - set_token: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@69..72 "val" [] [], - }, - l_paren_token: L_PAREN@72..73 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@73..74 "@" [] [], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..77 "dec" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@77..78 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@80..81 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@83..84 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@84..85 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@85..87 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@87..88 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..88 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..87 - 0: JS_CLASS_DECLARATION@0..87 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..85 - 0: JS_SETTER_CLASS_MEMBER@9..32 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@18..21 - 0: IDENT@18..21 "val" [] [] - 3: L_PAREN@21..22 "(" [] [] - 4: JS_FORMAL_PARAMETER@22..28 - 0: JS_DECORATOR_LIST@22..27 - 0: JS_DECORATOR@22..27 - 0: AT@22..23 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@23..27 - 0: JS_REFERENCE_IDENTIFIER@23..27 - 0: IDENT@23..27 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@27..28 - 0: IDENT@27..28 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@28..30 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@30..32 - 0: L_CURLY@30..31 "{" [] [] - 1: JS_DIRECTIVE_LIST@31..31 - 2: JS_STATEMENT_LIST@31..31 - 3: R_CURLY@31..32 "}" [] [] - 1: JS_SETTER_CLASS_MEMBER@32..60 - 0: JS_METHOD_MODIFIER_LIST@32..32 - 1: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@41..44 - 0: IDENT@41..44 "val" [] [] - 3: L_PAREN@44..45 "(" [] [] - 4: JS_FORMAL_PARAMETER@45..56 - 0: JS_DECORATOR_LIST@45..55 - 0: JS_DECORATOR@45..55 - 0: AT@45..46 "@" [] [] - 1: JS_CALL_EXPRESSION@46..55 - 0: JS_STATIC_MEMBER_EXPRESSION@46..52 - 0: JS_IDENTIFIER_EXPRESSION@46..49 - 0: JS_REFERENCE_IDENTIFIER@46..49 - 0: IDENT@46..49 "dec" [] [] - 1: DOT@49..50 "." [] [] - 2: JS_NAME@50..52 - 0: IDENT@50..52 "fn" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@52..55 - 0: L_PAREN@52..53 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@53..53 - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@55..56 - 0: IDENT@55..56 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@56..58 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@58..60 - 0: L_CURLY@58..59 "{" [] [] - 1: JS_DIRECTIVE_LIST@59..59 - 2: JS_STATEMENT_LIST@59..59 - 3: R_CURLY@59..60 "}" [] [] - 2: JS_SETTER_CLASS_MEMBER@60..85 - 0: JS_METHOD_MODIFIER_LIST@60..60 - 1: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@69..72 - 0: IDENT@69..72 "val" [] [] - 3: L_PAREN@72..73 "(" [] [] - 4: JS_FORMAL_PARAMETER@73..81 - 0: JS_DECORATOR_LIST@73..80 - 0: JS_DECORATOR@73..80 - 0: AT@73..74 "@" [] [] - 1: JS_CALL_EXPRESSION@74..80 - 0: JS_IDENTIFIER_EXPRESSION@74..77 - 0: JS_REFERENCE_IDENTIFIER@74..77 - 0: IDENT@74..77 "dec" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@77..80 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@78..78 - 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@80..81 - 0: IDENT@80..81 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@81..83 ")" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@83..85 - 0: L_CURLY@83..84 "{" [] [] - 1: JS_DIRECTIVE_LIST@84..84 - 2: JS_STATEMENT_LIST@84..84 - 3: R_CURLY@84..85 "}" [] [] - 9: R_CURLY@85..87 "}" [Newline("\n")] [] - 4: EOF@87..88 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.rast b/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.rast deleted file mode 100644 index c172197fde79..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.rast +++ /dev/null @@ -1,179 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..6 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@6..7 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@7..8 "X" [] [], - }, - constraint: missing (optional), - default: TsDefaultTypeClause { - eq_token: EQ@8..9 "=" [] [], - ty: TsStringType { - string_token: STRING_KW@9..15 "string" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@15..17 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@17..19 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@19..20 "X" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@27..28 "B" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@28..29 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@29..31 "X" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@31..39 "extends" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsNumberType { - number_token: NUMBER_KW@39..46 "number" [] [Whitespace(" ")], - }, - PIPE@46..48 "|" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@48..55 "string" [] [Whitespace(" ")], - }, - ], - }, - }, - default: TsDefaultTypeClause { - eq_token: EQ@55..57 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@57..63 "string" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@63..65 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@65..67 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@67..69 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@69..70 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@70..72 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@72..74 "X" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@74..75 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@75..76 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..76 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..75 - 0: TS_TYPE_ALIAS_DECLARATION@0..21 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..6 - 0: IDENT@5..6 "A" [] [] - 2: TS_TYPE_PARAMETERS@6..17 - 0: L_ANGLE@6..7 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@7..15 - 0: TS_TYPE_PARAMETER@7..15 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 - 1: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "X" [] [] - 2: (empty) - 3: TS_DEFAULT_TYPE_CLAUSE@8..15 - 0: EQ@8..9 "=" [] [] - 1: TS_STRING_TYPE@9..15 - 0: STRING_KW@9..15 "string" [] [] - 2: R_ANGLE@15..17 ">" [] [Whitespace(" ")] - 3: EQ@17..19 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@19..20 - 0: JS_REFERENCE_IDENTIFIER@19..20 - 0: IDENT@19..20 "X" [] [] - 1: (empty) - 5: SEMICOLON@20..21 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@21..75 - 0: TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@27..28 - 0: IDENT@27..28 "B" [] [] - 2: TS_TYPE_PARAMETERS@28..65 - 0: L_ANGLE@28..29 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@29..63 - 0: TS_TYPE_PARAMETER@29..63 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@29..29 - 1: TS_TYPE_PARAMETER_NAME@29..31 - 0: IDENT@29..31 "X" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@31..55 - 0: EXTENDS_KW@31..39 "extends" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@39..55 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@39..55 - 0: TS_NUMBER_TYPE@39..46 - 0: NUMBER_KW@39..46 "number" [] [Whitespace(" ")] - 1: PIPE@46..48 "|" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@48..55 - 0: STRING_KW@48..55 "string" [] [Whitespace(" ")] - 3: TS_DEFAULT_TYPE_CLAUSE@55..63 - 0: EQ@55..57 "=" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@57..63 - 0: STRING_KW@57..63 "string" [] [] - 2: R_ANGLE@63..65 ">" [] [Whitespace(" ")] - 3: EQ@65..67 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@67..75 - 0: L_CURLY@67..69 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@69..74 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@69..74 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@69..70 - 0: IDENT@69..70 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@70..74 - 0: COLON@70..72 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@72..74 - 0: JS_REFERENCE_IDENTIFIER@72..74 - 0: IDENT@72..74 "X" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 2: R_CURLY@74..75 "}" [] [] - 5: (empty) - 4: EOF@75..76 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast deleted file mode 100644 index 9825ee22c9e2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast +++ /dev/null @@ -1,232 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@15..17 ":" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@19..20 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@20..22 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@22..29 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportAssignmentClause { - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..41 "a" [] [], - }, - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportAssignmentClause { - eq_token: EQ@50..52 "=" [] [Whitespace(" ")], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@52..58 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@58..59 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@60..68 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportAssignmentClause { - eq_token: EQ@68..70 "=" [] [Whitespace(" ")], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@70..79 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@79..80 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@82..83 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@83..84 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportAssignmentClause { - eq_token: EQ@92..94 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@94..96 "4" [] [Whitespace(" ")], - }, - operator_token: PLUS@96..98 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@98..100 "3" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@100..102 "+" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@102..103 "a" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@103..104 ";" [] [], - }, - }, - ], - eof_token: EOF@104..105 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..105 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..104 - 0: TS_DECLARE_STATEMENT@0..30 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@8..30 - 0: JS_VARIABLE_DECLARATION@8..30 - 0: (empty) - 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..30 - 0: JS_VARIABLE_DECLARATOR@14..30 - 0: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 1: TS_TYPE_ANNOTATION@15..30 - 0: COLON@15..17 ":" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@17..30 - 0: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@19..29 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@19..29 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@19..20 - 0: IDENT@19..20 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@20..29 - 0: COLON@20..22 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@22..29 - 0: STRING_KW@22..29 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@29..30 "}" [] [] - 2: (empty) - 1: (empty) - 1: JS_EXPORT@30..42 - 0: JS_DECORATOR_LIST@30..30 - 1: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_ASSIGNMENT_CLAUSE@38..42 - 0: EQ@38..40 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@40..41 - 0: JS_REFERENCE_IDENTIFIER@40..41 - 0: IDENT@40..41 "a" [] [] - 2: SEMICOLON@41..42 ";" [] [] - 2: JS_EXPORT@42..60 - 0: JS_DECORATOR_LIST@42..42 - 1: EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_ASSIGNMENT_CLAUSE@50..60 - 0: EQ@50..52 "=" [] [Whitespace(" ")] - 1: JS_CLASS_EXPRESSION@52..60 - 0: JS_DECORATOR_LIST@52..52 - 1: CLASS_KW@52..58 "class" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@58..59 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@59..59 - 8: R_CURLY@59..60 "}" [] [] - 2: (empty) - 3: JS_EXPORT@60..84 - 0: JS_DECORATOR_LIST@60..60 - 1: EXPORT_KW@60..68 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_ASSIGNMENT_CLAUSE@68..84 - 0: EQ@68..70 "=" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPRESSION@70..84 - 0: (empty) - 1: FUNCTION_KW@70..79 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@79..82 - 0: L_PAREN@79..80 "(" [] [] - 1: JS_PARAMETER_LIST@80..80 - 2: R_PAREN@80..82 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@82..84 - 0: L_CURLY@82..83 "{" [] [] - 1: JS_DIRECTIVE_LIST@83..83 - 2: JS_STATEMENT_LIST@83..83 - 3: R_CURLY@83..84 "}" [] [] - 2: (empty) - 4: JS_EXPORT@84..104 - 0: JS_DECORATOR_LIST@84..84 - 1: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_ASSIGNMENT_CLAUSE@92..104 - 0: EQ@92..94 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@94..103 - 0: JS_BINARY_EXPRESSION@94..100 - 0: JS_NUMBER_LITERAL_EXPRESSION@94..96 - 0: JS_NUMBER_LITERAL@94..96 "4" [] [Whitespace(" ")] - 1: PLUS@96..98 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@98..100 - 0: JS_NUMBER_LITERAL@98..100 "3" [] [Whitespace(" ")] - 1: PLUS@100..102 "+" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@102..103 - 0: JS_REFERENCE_IDENTIFIER@102..103 - 0: IDENT@102..103 "a" [] [] - 2: SEMICOLON@103..104 ";" [] [] - 4: EOF@104..105 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast deleted file mode 100644 index 784a3d26131f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast +++ /dev/null @@ -1,116 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@15..17 ":" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@19..20 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@20..22 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@22..29 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportAssignmentClause { - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..41 "a" [] [], - }, - }, - operator_token: DOT@41..42 "." [] [], - member: JsName { - value_token: IDENT@42..43 "b" [] [], - }, - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - }, - ], - eof_token: EOF@44..45 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..45 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..44 - 0: TS_DECLARE_STATEMENT@0..30 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@8..30 - 0: JS_VARIABLE_DECLARATION@8..30 - 0: (empty) - 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@14..30 - 0: JS_VARIABLE_DECLARATOR@14..30 - 0: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 1: TS_TYPE_ANNOTATION@15..30 - 0: COLON@15..17 ":" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@17..30 - 0: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@19..29 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@19..29 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@19..20 - 0: IDENT@19..20 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@20..29 - 0: COLON@20..22 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@22..29 - 0: STRING_KW@22..29 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@29..30 "}" [] [] - 2: (empty) - 1: (empty) - 1: JS_EXPORT@30..44 - 0: JS_DECORATOR_LIST@30..30 - 1: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_ASSIGNMENT_CLAUSE@38..44 - 0: EQ@38..40 "=" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@40..43 - 0: JS_IDENTIFIER_EXPRESSION@40..41 - 0: JS_REFERENCE_IDENTIFIER@40..41 - 0: IDENT@40..41 "a" [] [] - 1: DOT@41..42 "." [] [] - 2: JS_NAME@42..43 - 0: IDENT@42..43 "b" [] [] - 2: SEMICOLON@43..44 ";" [] [] - 4: EOF@44..45 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.rast deleted file mode 100644 index eccf4898638c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.rast +++ /dev/null @@ -1,234 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: TsExportDeclareClause { - declare_token: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")], - declaration: JsVariableDeclarationClause { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@15..21 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@21..22 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@22..24 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@24..30 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportDeclareClause { - declare_token: DECLARE_KW@39..47 "declare" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@47..57 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@57..59 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@59..60 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportDeclareClause { - declare_token: DECLARE_KW@69..77 "declare" [] [Whitespace(" ")], - declaration: TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@77..82 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@82..84 "B" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@84..85 "{" [] [], - members: TsEnumMemberList [], - r_curly_token: R_CURLY@85..86 "}" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportDeclareClause { - declare_token: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")], - declaration: TsTypeAliasDeclaration { - type_token: TYPE_KW@102..107 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@107..109 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@109..111 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@111..117 "string" [] [], - }, - semicolon_token: SEMICOLON@117..118 ";" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@118..126 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportDeclareClause { - declare_token: DECLARE_KW@126..134 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@134..140 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@140..142 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@142..143 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@143..144 "}" [] [], - }, - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@144..152 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportDeclareClause { - declare_token: DECLARE_KW@152..160 "declare" [] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@160..169 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@169..170 "e" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@170..171 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@171..172 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - }, - }, - ], - eof_token: EOF@172..173 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..173 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..172 - 0: JS_EXPORT@0..31 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: TS_EXPORT_DECLARE_CLAUSE@7..31 - 0: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_CLAUSE@15..31 - 0: JS_VARIABLE_DECLARATION@15..30 - 0: (empty) - 1: CONST_KW@15..21 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@21..30 - 0: JS_VARIABLE_DECLARATOR@21..30 - 0: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "a" [] [] - 1: TS_TYPE_ANNOTATION@22..30 - 0: COLON@22..24 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@24..30 - 0: STRING_KW@24..30 "string" [] [] - 2: (empty) - 1: SEMICOLON@30..31 ";" [] [] - 1: JS_EXPORT@31..61 - 0: JS_DECORATOR_LIST@31..31 - 1: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_DECLARE_CLAUSE@39..61 - 0: DECLARE_KW@39..47 "declare" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@47..61 - 0: INTERFACE_KW@47..57 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@57..59 - 0: IDENT@57..59 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@59..60 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@60..60 - 6: R_CURLY@60..61 "}" [] [] - 2: JS_EXPORT@61..86 - 0: JS_DECORATOR_LIST@61..61 - 1: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_DECLARE_CLAUSE@69..86 - 0: DECLARE_KW@69..77 "declare" [] [Whitespace(" ")] - 1: TS_ENUM_DECLARATION@77..86 - 0: (empty) - 1: ENUM_KW@77..82 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@82..84 - 0: IDENT@82..84 "B" [] [Whitespace(" ")] - 3: L_CURLY@84..85 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@85..85 - 5: R_CURLY@85..86 "}" [] [] - 3: JS_EXPORT@86..118 - 0: JS_DECORATOR_LIST@86..86 - 1: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_DECLARE_CLAUSE@94..118 - 0: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")] - 1: TS_TYPE_ALIAS_DECLARATION@102..118 - 0: TYPE_KW@102..107 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@107..109 - 0: IDENT@107..109 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@109..111 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@111..117 - 0: STRING_KW@111..117 "string" [] [] - 5: SEMICOLON@117..118 ";" [] [] - 4: JS_EXPORT@118..144 - 0: JS_DECORATOR_LIST@118..118 - 1: EXPORT_KW@118..126 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_DECLARE_CLAUSE@126..144 - 0: DECLARE_KW@126..134 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@134..144 - 0: JS_DECORATOR_LIST@134..134 - 1: (empty) - 2: CLASS_KW@134..140 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@140..142 - 0: IDENT@140..142 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@142..143 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@143..143 - 9: R_CURLY@143..144 "}" [] [] - 5: JS_EXPORT@144..172 - 0: JS_DECORATOR_LIST@144..144 - 1: EXPORT_KW@144..152 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_DECLARE_CLAUSE@152..172 - 0: DECLARE_KW@152..160 "declare" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@160..172 - 0: (empty) - 1: FUNCTION_KW@160..169 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@169..170 - 0: IDENT@169..170 "e" [] [] - 3: (empty) - 4: JS_PARAMETERS@170..172 - 0: L_PAREN@170..171 "(" [] [] - 1: JS_PARAMETER_LIST@171..171 - 2: R_PAREN@171..172 ")" [] [] - 5: (empty) - 6: (empty) - 4: EOF@172..173 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.rast deleted file mode 100644 index b33cb5e75006..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.rast +++ /dev/null @@ -1,202 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: TsDeclareFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@24..28 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@28..29 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@29..30 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@30..32 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@32..38 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@38..39 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@39..41 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@41..47 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@56..64 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@73..77 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@77..78 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@78..79 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@79..81 ":" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@81..88 "string" [] [Whitespace(" ")], - }, - PIPE@88..90 "|" [] [Whitespace(" ")], - TsUndefinedType { - undefined_token: UNDEFINED_KW@90..99 "undefined" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@99..100 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@100..102 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@102..109 "string" [] [Whitespace(" ")], - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@109..111 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@111..118 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@118..126 "\"hello\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@126..127 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@127..128 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..128 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..127 - 0: JS_EXPORT@0..48 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..48 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..48 - 0: (empty) - 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@24..28 - 0: IDENT@24..28 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@28..39 - 0: L_PAREN@28..29 "(" [] [] - 1: JS_PARAMETER_LIST@29..38 - 0: JS_FORMAL_PARAMETER@29..38 - 0: JS_DECORATOR_LIST@29..29 - 1: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@30..38 - 0: COLON@30..32 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@32..38 - 0: STRING_KW@32..38 "string" [] [] - 4: (empty) - 2: R_PAREN@38..39 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@39..47 - 0: COLON@39..41 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@41..47 - 0: STRING_KW@41..47 "string" [] [] - 6: SEMICOLON@47..48 ";" [] [] - 2: (empty) - 1: JS_EXPORT@48..127 - 0: JS_DECORATOR_LIST@48..48 - 1: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@56..127 - 0: DEFAULT_KW@56..64 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@64..127 - 0: (empty) - 1: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@73..77 - 0: IDENT@73..77 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@77..100 - 0: L_PAREN@77..78 "(" [] [] - 1: JS_PARAMETER_LIST@78..99 - 0: JS_FORMAL_PARAMETER@78..99 - 0: JS_DECORATOR_LIST@78..78 - 1: JS_IDENTIFIER_BINDING@78..79 - 0: IDENT@78..79 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@79..99 - 0: COLON@79..81 ":" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@81..99 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@81..99 - 0: TS_STRING_TYPE@81..88 - 0: STRING_KW@81..88 "string" [] [Whitespace(" ")] - 1: PIPE@88..90 "|" [] [Whitespace(" ")] - 2: TS_UNDEFINED_TYPE@90..99 - 0: UNDEFINED_KW@90..99 "undefined" [] [] - 4: (empty) - 2: R_PAREN@99..100 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@100..109 - 0: COLON@100..102 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@102..109 - 0: STRING_KW@102..109 "string" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@109..127 - 0: L_CURLY@109..111 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@111..111 - 2: JS_STATEMENT_LIST@111..126 - 0: JS_RETURN_STATEMENT@111..126 - 0: RETURN_KW@111..118 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@118..126 - 0: JS_STRING_LITERAL@118..126 "\"hello\"" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@126..127 "}" [] [] - 2: (empty) - 4: EOF@127..128 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.rast deleted file mode 100644 index 5db6f10fe648..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.rast +++ /dev/null @@ -1,49 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@25..27 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@29..30 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@30..31 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..31 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..30 - 0: JS_EXPORT@0..30 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..30 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@15..30 - 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@29..29 - 6: R_CURLY@29..30 "}" [] [] - 2: (empty) - 4: EOF@30..31 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.rast deleted file mode 100644 index f752101d9432..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.rast +++ /dev/null @@ -1,185 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@25..27 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@29..30 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@30..32 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@32..38 "string" [] [], - }, - }, - separator_token: SEMICOLON@38..40 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@57..67 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@67..69 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@69..71 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@71..72 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@72..74 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@74..81 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@81..82 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@82..90 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@90..98 "default" [] [Whitespace(" ")], - declaration: JsFunctionExportDefaultDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@98..107 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@107..111 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@111..112 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@112..114 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@114..115 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@115..116 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@116..117 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..117 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..116 - 0: JS_EXPORT@0..41 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..41 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@15..41 - 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@29..40 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@29..40 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@29..30 - 0: IDENT@29..30 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@30..38 - 0: COLON@30..32 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@32..38 - 0: STRING_KW@32..38 "string" [] [] - 4: SEMICOLON@38..40 ";" [] [Whitespace(" ")] - 6: R_CURLY@40..41 "}" [] [] - 2: (empty) - 1: JS_EXPORT@41..82 - 0: JS_DECORATOR_LIST@41..41 - 1: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@49..82 - 0: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@57..82 - 0: INTERFACE_KW@57..67 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@67..69 - 0: IDENT@67..69 "B" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@69..71 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@71..81 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@71..81 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@71..72 - 0: IDENT@71..72 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@72..81 - 0: COLON@72..74 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@74..81 - 0: STRING_KW@74..81 "string" [] [Whitespace(" ")] - 4: (empty) - 6: R_CURLY@81..82 "}" [] [] - 2: (empty) - 2: JS_EXPORT@82..116 - 0: JS_DECORATOR_LIST@82..82 - 1: EXPORT_KW@82..90 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@90..116 - 0: DEFAULT_KW@90..98 "default" [] [Whitespace(" ")] - 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@98..116 - 0: (empty) - 1: FUNCTION_KW@98..107 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@107..111 - 0: IDENT@107..111 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@111..114 - 0: L_PAREN@111..112 "(" [] [] - 1: JS_PARAMETER_LIST@112..112 - 2: R_PAREN@112..114 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@114..116 - 0: L_CURLY@114..115 "{" [] [] - 1: JS_DIRECTIVE_LIST@115..115 - 2: JS_STATEMENT_LIST@115..115 - 3: R_CURLY@115..116 "}" [] [] - 2: (empty) - 4: EOF@116..117 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.rast deleted file mode 100644 index 5700dc112211..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.rast +++ /dev/null @@ -1,111 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@7..12 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@12..14 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@14..16 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@16..17 "X" [] [], - }, - initializer: missing (optional), - }, - COMMA@17..19 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@19..21 "Y" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@22..30 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsEnumDeclaration { - const_token: CONST_KW@30..36 "const" [] [Whitespace(" ")], - enum_token: ENUM_KW@36..41 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@41..43 "B" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@45..46 "X" [] [], - }, - initializer: missing (optional), - }, - COMMA@46..48 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@48..50 "Y" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - }, - ], - eof_token: EOF@51..52 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..52 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..51 - 0: JS_EXPORT@0..22 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: TS_ENUM_DECLARATION@7..22 - 0: (empty) - 1: ENUM_KW@7..12 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@12..14 - 0: IDENT@12..14 "A" [] [Whitespace(" ")] - 3: L_CURLY@14..16 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@16..21 - 0: TS_ENUM_MEMBER@16..17 - 0: TS_LITERAL_ENUM_MEMBER_NAME@16..17 - 0: IDENT@16..17 "X" [] [] - 1: (empty) - 1: COMMA@17..19 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@19..21 - 0: TS_LITERAL_ENUM_MEMBER_NAME@19..21 - 0: IDENT@19..21 "Y" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@21..22 "}" [] [] - 1: JS_EXPORT@22..51 - 0: JS_DECORATOR_LIST@22..22 - 1: EXPORT_KW@22..30 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_ENUM_DECLARATION@30..51 - 0: CONST_KW@30..36 "const" [] [Whitespace(" ")] - 1: ENUM_KW@36..41 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@41..43 - 0: IDENT@41..43 "B" [] [Whitespace(" ")] - 3: L_CURLY@43..45 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@45..50 - 0: TS_ENUM_MEMBER@45..46 - 0: TS_LITERAL_ENUM_MEMBER_NAME@45..46 - 0: IDENT@45..46 "X" [] [] - 1: (empty) - 1: COMMA@46..48 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@48..50 - 0: TS_LITERAL_ENUM_MEMBER_NAME@48..50 - 0: IDENT@48..50 "Y" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@50..51 "}" [] [] - 4: EOF@51..52 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.rast deleted file mode 100644 index 4d7e3dfdefee..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.rast +++ /dev/null @@ -1,188 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@16..20 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@21..22 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@22..24 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@24..30 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@30..31 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@31..33 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@33..39 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@39..40 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@40..48 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@48..57 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@57..61 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@61..62 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@62..63 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@63..65 ":" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@65..72 "string" [] [Whitespace(" ")], - }, - PIPE@72..74 "|" [] [Whitespace(" ")], - TsUndefinedType { - undefined_token: UNDEFINED_KW@74..83 "undefined" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@83..84 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@84..86 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@86..93 "string" [] [Whitespace(" ")], - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@95..102 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@102..110 "\"hello\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@110..111 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@111..112 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..112 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..111 - 0: JS_EXPORT@0..40 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: TS_DECLARE_FUNCTION_DECLARATION@7..40 - 0: (empty) - 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@16..20 - 0: IDENT@16..20 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@20..31 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..30 - 0: JS_FORMAL_PARAMETER@21..30 - 0: JS_DECORATOR_LIST@21..21 - 1: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@22..30 - 0: COLON@22..24 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@24..30 - 0: STRING_KW@24..30 "string" [] [] - 4: (empty) - 2: R_PAREN@30..31 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@31..39 - 0: COLON@31..33 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@33..39 - 0: STRING_KW@33..39 "string" [] [] - 6: SEMICOLON@39..40 ";" [] [] - 1: JS_EXPORT@40..111 - 0: JS_DECORATOR_LIST@40..40 - 1: EXPORT_KW@40..48 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_FUNCTION_DECLARATION@48..111 - 0: (empty) - 1: FUNCTION_KW@48..57 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@57..61 - 0: IDENT@57..61 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@61..84 - 0: L_PAREN@61..62 "(" [] [] - 1: JS_PARAMETER_LIST@62..83 - 0: JS_FORMAL_PARAMETER@62..83 - 0: JS_DECORATOR_LIST@62..62 - 1: JS_IDENTIFIER_BINDING@62..63 - 0: IDENT@62..63 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@63..83 - 0: COLON@63..65 ":" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@65..83 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@65..83 - 0: TS_STRING_TYPE@65..72 - 0: STRING_KW@65..72 "string" [] [Whitespace(" ")] - 1: PIPE@72..74 "|" [] [Whitespace(" ")] - 2: TS_UNDEFINED_TYPE@74..83 - 0: UNDEFINED_KW@74..83 "undefined" [] [] - 4: (empty) - 2: R_PAREN@83..84 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@84..93 - 0: COLON@84..86 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@86..93 - 0: STRING_KW@86..93 "string" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@93..111 - 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@95..95 - 2: JS_STATEMENT_LIST@95..110 - 0: JS_RETURN_STATEMENT@95..110 - 0: RETURN_KW@95..102 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@102..110 - 0: JS_STRING_LITERAL@102..110 "\"hello\"" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@110..111 "}" [] [] - 4: EOF@111..112 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.rast deleted file mode 100644 index cea1b61a7d38..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.rast +++ /dev/null @@ -1,42 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@7..17 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@17..19 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@19..20 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - ], - eof_token: EOF@21..22 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..22 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..21 - 0: JS_EXPORT@0..21 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: TS_INTERFACE_DECLARATION@7..21 - 0: INTERFACE_KW@7..17 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@17..19 - 0: IDENT@17..19 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@19..20 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@20..20 - 6: R_CURLY@20..21 "}" [] [] - 4: EOF@21..22 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.rast deleted file mode 100644 index 90395473772d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.rast +++ /dev/null @@ -1,99 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: TYPE_KW@9..14 "type" [] [Whitespace(" ")], - source_name: JsLiteralExportName { - value: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@16..18 "}" [] [Whitespace(" ")], - from_token: FROM_KW@18..23 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@23..26 "\"a\"" [] [], - }, - assertion: missing (optional), - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: missing (optional), - l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@36..41 "type" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@41..43 "}" [] [Whitespace(" ")], - from_token: FROM_KW@43..48 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@48..56 "\"./type\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@56..57 ";" [] [], - }, - }, - ], - eof_token: EOF@57..58 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..58 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..57 - 0: JS_EXPORT@0..26 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..26 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@9..16 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@9..16 - 0: TYPE_KW@9..14 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@16..18 "}" [] [Whitespace(" ")] - 4: FROM_KW@18..23 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@23..26 - 0: JS_STRING_LITERAL@23..26 "\"a\"" [] [] - 6: (empty) - 7: (empty) - 1: JS_EXPORT@26..57 - 0: JS_DECORATOR_LIST@26..26 - 1: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@34..57 - 0: (empty) - 1: L_CURLY@34..36 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@36..41 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@36..41 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@36..41 - 0: IDENT@36..41 "type" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@41..43 "}" [] [Whitespace(" ")] - 4: FROM_KW@43..48 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@48..56 - 0: JS_STRING_LITERAL@48..56 "\"./type\"" [] [] - 6: (empty) - 7: SEMICOLON@56..57 ";" [] [] - 4: EOF@57..58 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.rast deleted file mode 100644 index 24ae45e5bdac..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@9..14 "type" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@14..15 "}" [] [], - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@15..23 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@23..25 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: TYPE_KW@25..30 "type" [] [Whitespace(" ")], - name: JsReferenceIdentifier { - value_token: IDENT@30..35 "type" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@35..36 "}" [] [], - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@46..51 "type" [] [Whitespace(" ")], - }, - as_token: AS_KW@51..54 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@54..68 "somethingElse" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@68..69 "}" [] [], - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@69..70 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..70 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..69 - 0: JS_EXPORT@0..15 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@7..15 - 0: (empty) - 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..14 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@9..14 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@9..14 - 0: IDENT@9..14 "type" [] [Whitespace(" ")] - 3: R_CURLY@14..15 "}" [] [] - 4: (empty) - 1: JS_EXPORT@15..36 - 0: JS_DECORATOR_LIST@15..15 - 1: EXPORT_KW@15..23 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@23..36 - 0: (empty) - 1: L_CURLY@23..25 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@25..35 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@25..35 - 0: TYPE_KW@25..30 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@30..35 - 0: IDENT@30..35 "type" [] [Whitespace(" ")] - 3: R_CURLY@35..36 "}" [] [] - 4: (empty) - 2: JS_EXPORT@36..69 - 0: JS_DECORATOR_LIST@36..36 - 1: EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@44..69 - 0: (empty) - 1: L_CURLY@44..46 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@46..68 - 0: JS_EXPORT_NAMED_SPECIFIER@46..68 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@46..51 - 0: IDENT@46..51 "type" [] [Whitespace(" ")] - 2: AS_KW@51..54 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@54..68 - 0: IDENT@54..68 "somethingElse" [] [Whitespace(" ")] - 3: R_CURLY@68..69 "}" [] [] - 4: (empty) - 4: EOF@69..70 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.rast deleted file mode 100644 index d7086d411494..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.rast +++ /dev/null @@ -1,103 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@16..23 "isPrime" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@23..24 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..25 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@27..33 "number" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@33..34 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - ty: TsBooleanType { - boolean_token: BOOLEAN_KW@36..43 "boolean" [] [], - }, - }, - semicolon_token: SEMICOLON@43..44 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@44..52 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsExportAsNamespaceClause { - as_token: AS_KW@52..55 "as" [] [Whitespace(" ")], - namespace_token: NAMESPACE_KW@55..65 "namespace" [] [Whitespace(" ")], - name: JsName { - value_token: IDENT@65..72 "mathLib" [] [], - }, - semicolon_token: SEMICOLON@72..73 ";" [] [], - }, - }, - ], - eof_token: EOF@73..74 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..74 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..73 - 0: JS_EXPORT@0..44 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: TS_DECLARE_FUNCTION_DECLARATION@7..44 - 0: (empty) - 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@16..23 - 0: IDENT@16..23 "isPrime" [] [] - 3: (empty) - 4: JS_PARAMETERS@23..34 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_PARAMETER_LIST@24..33 - 0: JS_FORMAL_PARAMETER@24..33 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@25..33 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@27..33 - 0: NUMBER_KW@27..33 "number" [] [] - 4: (empty) - 2: R_PAREN@33..34 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@34..43 - 0: COLON@34..36 ":" [] [Whitespace(" ")] - 1: TS_BOOLEAN_TYPE@36..43 - 0: BOOLEAN_KW@36..43 "boolean" [] [] - 6: SEMICOLON@43..44 ";" [] [] - 1: JS_EXPORT@44..73 - 0: JS_DECORATOR_LIST@44..44 - 1: EXPORT_KW@44..52 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_EXPORT_AS_NAMESPACE_CLAUSE@52..73 - 0: AS_KW@52..55 "as" [] [Whitespace(" ")] - 1: NAMESPACE_KW@55..65 "namespace" [] [Whitespace(" ")] - 2: JS_NAME@65..72 - 0: IDENT@65..72 "mathLib" [] [] - 3: SEMICOLON@72..73 ";" [] [] - 4: EOF@73..74 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.rast deleted file mode 100644 index d0dee347244e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.rast +++ /dev/null @@ -1,67 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@9..15 "string" [] [], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: TYPE_KW@24..29 "type" [] [Whitespace(" ")], - l_curly_token: L_CURLY@29..31 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@31..33 "A" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@33..34 "}" [] [], - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: TS_TYPE_ALIAS_DECLARATION@0..16 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@9..15 - 0: STRING_KW@9..15 "string" [] [] - 5: SEMICOLON@15..16 ";" [] [] - 1: JS_EXPORT@16..35 - 0: JS_DECORATOR_LIST@16..16 - 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@24..35 - 0: TYPE_KW@24..29 "type" [] [Whitespace(" ")] - 1: L_CURLY@29..31 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@31..33 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@31..33 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@31..33 - 0: IDENT@31..33 "A" [] [Whitespace(" ")] - 3: R_CURLY@33..34 "}" [] [] - 4: SEMICOLON@34..35 ";" [] [] - 4: EOF@35..36 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.rast deleted file mode 100644 index fd4d940904c0..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.rast +++ /dev/null @@ -1,57 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportNamedFromClause { - type_token: TYPE_KW@7..12 "type" [] [Whitespace(" ")], - l_curly_token: L_CURLY@12..14 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedFromSpecifierList [ - JsExportNamedFromSpecifier { - type_token: missing (optional), - source_name: JsLiteralExportName { - value: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - export_as: missing (optional), - }, - ], - r_curly_token: R_CURLY@16..18 "}" [] [Whitespace(" ")], - from_token: FROM_KW@18..23 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@23..26 "\"a\"" [] [], - }, - assertion: missing (optional), - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: JS_EXPORT@0..27 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..27 - 0: TYPE_KW@7..12 "type" [] [Whitespace(" ")] - 1: L_CURLY@12..14 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@14..16 - 0: JS_EXPORT_NAMED_FROM_SPECIFIER@14..16 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@16..18 "}" [] [Whitespace(" ")] - 4: FROM_KW@18..23 "from" [] [Whitespace(" ")] - 5: JS_MODULE_SOURCE@23..26 - 0: JS_STRING_LITERAL@23..26 "\"a\"" [] [] - 6: (empty) - 7: SEMICOLON@26..27 ";" [] [] - 4: EOF@27..28 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast b/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast deleted file mode 100644 index 6003643411cc..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast +++ /dev/null @@ -1,341 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "as" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@6..7 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@7..12 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@12..16 "type" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@22..23 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@24..32 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@32..34 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: missing (optional), - name: JsReferenceIdentifier { - value_token: IDENT@34..39 "type" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@39..40 "}" [] [], - semicolon_token: SEMICOLON@40..41 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@49..51 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@51..56 "type" [] [Whitespace(" ")], - }, - as_token: AS_KW@56..59 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@59..62 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@62..63 "}" [] [], - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@72..74 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: missing (optional), - local_name: JsReferenceIdentifier { - value_token: IDENT@74..77 "as" [] [Whitespace(" ")], - }, - as_token: AS_KW@77..80 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@80..83 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@83..84 "}" [] [], - semicolon_token: SEMICOLON@84..85 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: TYPE_KW@95..100 "type" [] [Whitespace(" ")], - local_name: JsReferenceIdentifier { - value_token: IDENT@100..103 "as" [] [Whitespace(" ")], - }, - as_token: AS_KW@103..106 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@106..109 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@109..110 "}" [] [], - semicolon_token: missing (optional), - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@110..118 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: TYPE_KW@120..125 "type" [] [Whitespace(" ")], - name: JsReferenceIdentifier { - value_token: IDENT@125..130 "type" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@130..131 "}" [] [], - semicolon_token: SEMICOLON@131..132 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@132..140 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@140..142 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedShorthandSpecifier { - type_token: TYPE_KW@142..147 "type" [] [Whitespace(" ")], - name: JsReferenceIdentifier { - value_token: IDENT@147..150 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@150..151 "}" [] [], - semicolon_token: SEMICOLON@151..152 ";" [] [], - }, - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@152..160 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportNamedClause { - type_token: missing (optional), - l_curly_token: L_CURLY@160..162 "{" [] [Whitespace(" ")], - specifiers: JsExportNamedSpecifierList [ - JsExportNamedSpecifier { - type_token: TYPE_KW@162..167 "type" [] [Whitespace(" ")], - local_name: JsReferenceIdentifier { - value_token: IDENT@167..169 "a" [] [Whitespace(" ")], - }, - as_token: AS_KW@169..172 "as" [] [Whitespace(" ")], - exported_name: JsLiteralExportName { - value: IDENT@172..175 "aa" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@175..176 "}" [] [], - semicolon_token: SEMICOLON@176..177 ";" [] [], - }, - }, - ], - eof_token: EOF@177..178 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..178 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..177 - 0: JS_VARIABLE_STATEMENT@0..7 - 0: JS_VARIABLE_DECLARATION@0..6 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..6 - 0: JS_VARIABLE_DECLARATOR@4..6 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "as" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@6..7 ";" [] [] - 1: JS_VARIABLE_STATEMENT@7..17 - 0: JS_VARIABLE_DECLARATION@7..16 - 0: (empty) - 1: LET_KW@7..12 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@12..16 - 0: JS_VARIABLE_DECLARATOR@12..16 - 0: JS_IDENTIFIER_BINDING@12..16 - 0: IDENT@12..16 "type" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@16..17 ";" [] [] - 2: JS_VARIABLE_STATEMENT@17..24 - 0: JS_VARIABLE_DECLARATION@17..23 - 0: (empty) - 1: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@22..23 - 0: JS_VARIABLE_DECLARATOR@22..23 - 0: JS_IDENTIFIER_BINDING@22..23 - 0: IDENT@22..23 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@23..24 ";" [] [] - 3: JS_EXPORT@24..41 - 0: JS_DECORATOR_LIST@24..24 - 1: EXPORT_KW@24..32 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@32..41 - 0: (empty) - 1: L_CURLY@32..34 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@34..39 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@34..39 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@34..39 - 0: IDENT@34..39 "type" [] [Whitespace(" ")] - 3: R_CURLY@39..40 "}" [] [] - 4: SEMICOLON@40..41 ";" [] [] - 4: JS_EXPORT@41..64 - 0: JS_DECORATOR_LIST@41..41 - 1: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@49..64 - 0: (empty) - 1: L_CURLY@49..51 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@51..62 - 0: JS_EXPORT_NAMED_SPECIFIER@51..62 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@51..56 - 0: IDENT@51..56 "type" [] [Whitespace(" ")] - 2: AS_KW@56..59 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@59..62 - 0: IDENT@59..62 "as" [] [Whitespace(" ")] - 3: R_CURLY@62..63 "}" [] [] - 4: SEMICOLON@63..64 ";" [] [] - 5: JS_EXPORT@64..85 - 0: JS_DECORATOR_LIST@64..64 - 1: EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@72..85 - 0: (empty) - 1: L_CURLY@72..74 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@74..83 - 0: JS_EXPORT_NAMED_SPECIFIER@74..83 - 0: (empty) - 1: JS_REFERENCE_IDENTIFIER@74..77 - 0: IDENT@74..77 "as" [] [Whitespace(" ")] - 2: AS_KW@77..80 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@80..83 - 0: IDENT@80..83 "as" [] [Whitespace(" ")] - 3: R_CURLY@83..84 "}" [] [] - 4: SEMICOLON@84..85 ";" [] [] - 6: JS_EXPORT@85..110 - 0: JS_DECORATOR_LIST@85..85 - 1: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@93..110 - 0: (empty) - 1: L_CURLY@93..95 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@95..109 - 0: JS_EXPORT_NAMED_SPECIFIER@95..109 - 0: TYPE_KW@95..100 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@100..103 - 0: IDENT@100..103 "as" [] [Whitespace(" ")] - 2: AS_KW@103..106 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@106..109 - 0: IDENT@106..109 "as" [] [Whitespace(" ")] - 3: R_CURLY@109..110 "}" [] [] - 4: (empty) - 7: JS_EXPORT@110..132 - 0: JS_DECORATOR_LIST@110..110 - 1: EXPORT_KW@110..118 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@118..132 - 0: (empty) - 1: L_CURLY@118..120 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@120..130 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@120..130 - 0: TYPE_KW@120..125 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@125..130 - 0: IDENT@125..130 "type" [] [Whitespace(" ")] - 3: R_CURLY@130..131 "}" [] [] - 4: SEMICOLON@131..132 ";" [] [] - 8: JS_EXPORT@132..152 - 0: JS_DECORATOR_LIST@132..132 - 1: EXPORT_KW@132..140 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@140..152 - 0: (empty) - 1: L_CURLY@140..142 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@142..150 - 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@142..150 - 0: TYPE_KW@142..147 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@147..150 - 0: IDENT@147..150 "as" [] [Whitespace(" ")] - 3: R_CURLY@150..151 "}" [] [] - 4: SEMICOLON@151..152 ";" [] [] - 9: JS_EXPORT@152..177 - 0: JS_DECORATOR_LIST@152..152 - 1: EXPORT_KW@152..160 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_CLAUSE@160..177 - 0: (empty) - 1: L_CURLY@160..162 "{" [] [Whitespace(" ")] - 2: JS_EXPORT_NAMED_SPECIFIER_LIST@162..175 - 0: JS_EXPORT_NAMED_SPECIFIER@162..175 - 0: TYPE_KW@162..167 "type" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@167..169 - 0: IDENT@167..169 "a" [] [Whitespace(" ")] - 2: AS_KW@169..172 "as" [] [Whitespace(" ")] - 3: JS_LITERAL_EXPORT_NAME@172..175 - 0: IDENT@172..175 "aa" [] [Whitespace(" ")] - 3: R_CURLY@175..176 "}" [] [] - 4: SEMICOLON@176..177 ";" [] [] - 4: EOF@177..178 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.rast deleted file mode 100644 index 1a846cab6882..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.rast +++ /dev/null @@ -1,118 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..28 "IHasVisualizationModel" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@30..36 "string" [] [], - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@44..46 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: JsExtendsClause { - extends_token: EXTENDS_KW@46..54 "extends" [] [Whitespace(" ")], - super_class: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@54..55 "C" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@55..56 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@56..78 "IHasVisualizationModel" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@78..80 ">" [] [Whitespace(" ")], - }, - }, - implements_clause: missing (optional), - l_curly_token: L_CURLY@80..81 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@81..88 "x" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@88..90 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@90..98 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@98..99 ";" [] [], - }, - ], - r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@101..102 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..102 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..101 - 0: TS_TYPE_ALIAS_DECLARATION@0..37 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..28 - 0: IDENT@5..28 "IHasVisualizationModel" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@28..30 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@30..36 - 0: STRING_KW@30..36 "string" [] [] - 5: SEMICOLON@36..37 ";" [] [] - 1: JS_CLASS_DECLARATION@37..101 - 0: JS_DECORATOR_LIST@37..37 - 1: (empty) - 2: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@44..46 - 0: IDENT@44..46 "D" [] [Whitespace(" ")] - 4: (empty) - 5: JS_EXTENDS_CLAUSE@46..80 - 0: EXTENDS_KW@46..54 "extends" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@54..55 - 0: JS_REFERENCE_IDENTIFIER@54..55 - 0: IDENT@54..55 "C" [] [] - 2: TS_TYPE_ARGUMENTS@55..80 - 0: L_ANGLE@55..56 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@56..78 - 0: TS_REFERENCE_TYPE@56..78 - 0: JS_REFERENCE_IDENTIFIER@56..78 - 0: IDENT@56..78 "IHasVisualizationModel" [] [] - 1: (empty) - 2: R_ANGLE@78..80 ">" [] [Whitespace(" ")] - 6: (empty) - 7: L_CURLY@80..81 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@81..99 - 0: JS_PROPERTY_CLASS_MEMBER@81..99 - 0: JS_PROPERTY_MODIFIER_LIST@81..81 - 1: JS_LITERAL_MEMBER_NAME@81..88 - 0: IDENT@81..88 "x" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@88..98 - 0: EQ@88..90 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@90..98 - 0: JS_STRING_LITERAL@90..98 "\"string\"" [] [] - 4: SEMICOLON@98..99 ";" [] [] - 9: R_CURLY@99..101 "}" [Newline("\n")] [] - 4: EOF@101..102 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.rast deleted file mode 100644 index fb8cb734813d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.rast +++ /dev/null @@ -1,76 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@15..18 "\"a\"" [] [], - }, - body: TsEmptyExternalModuleDeclarationBody { - semicolon_token: SEMICOLON@18..19 ";" [] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@28..35 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@35..38 "\"b\"" [] [], - }, - body: missing (optional), - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@38..47 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@47..54 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@54..63 "\"import\"" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@63..64 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@64..65 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@65..66 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..66 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..65 - 0: TS_DECLARE_STATEMENT@0..19 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@8..19 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@15..18 - 0: JS_STRING_LITERAL@15..18 "\"a\"" [] [] - 2: TS_EMPTY_EXTERNAL_MODULE_DECLARATION_BODY@18..19 - 0: SEMICOLON@18..19 ";" [] [] - 1: TS_DECLARE_STATEMENT@19..38 - 0: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@28..38 - 0: MODULE_KW@28..35 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@35..38 - 0: JS_STRING_LITERAL@35..38 "\"b\"" [] [] - 2: (empty) - 2: TS_DECLARE_STATEMENT@38..65 - 0: DECLARE_KW@38..47 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@47..65 - 0: MODULE_KW@47..54 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@54..63 - 0: JS_STRING_LITERAL@54..63 "\"import\"" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@63..65 - 0: L_CURLY@63..64 "{" [] [] - 1: JS_MODULE_ITEM_LIST@64..64 - 2: R_CURLY@64..65 "}" [] [] - 4: EOF@65..66 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.rast b/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.rast deleted file mode 100644 index 63635a41a1ac..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.rast +++ /dev/null @@ -1,287 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@11..12 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@12..14 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@14..15 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@15..16 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@16..26 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@26..27 "b" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@27..28 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@30..31 "x" [] [], - }, - init: missing (optional), - }, - COMMA@31..33 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@33..35 "y" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@35..37 "}" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@37..39 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@39..40 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@43..44 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@44..45 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@45..55 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@55..56 "c" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@56..57 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@57..58 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@58..60 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@60..66 "string" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@66..68 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@68..69 "y" [] [], - }, - question_mark_token: QUESTION@69..70 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@70..72 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@72..78 "number" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@78..80 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@80..81 "z" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@81..83 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@83..90 "string" [] [Whitespace(" ")], - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@90..92 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@92..98 "\"test\"" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@100..101 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@101..102 "}" [] [], - }, - }, - ], - eof_token: EOF@102..103 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..103 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..102 - 0: JS_FUNCTION_DECLARATION@0..16 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..14 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..12 - 0: JS_FORMAL_PARAMETER@11..12 - 0: JS_DECORATOR_LIST@11..11 - 1: JS_IDENTIFIER_BINDING@11..12 - 0: IDENT@11..12 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@12..14 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@14..16 - 0: L_CURLY@14..15 "{" [] [] - 1: JS_DIRECTIVE_LIST@15..15 - 2: JS_STATEMENT_LIST@15..15 - 3: R_CURLY@15..16 "}" [] [] - 1: JS_FUNCTION_DECLARATION@16..45 - 0: (empty) - 1: FUNCTION_KW@16..26 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@26..27 - 0: IDENT@26..27 "b" [] [] - 4: (empty) - 5: JS_PARAMETERS@27..43 - 0: L_PAREN@27..28 "(" [] [] - 1: JS_PARAMETER_LIST@28..41 - 0: JS_FORMAL_PARAMETER@28..41 - 0: JS_DECORATOR_LIST@28..28 - 1: JS_OBJECT_BINDING_PATTERN@28..37 - 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@30..35 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@30..31 - 0: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "x" [] [] - 1: (empty) - 1: COMMA@31..33 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@33..35 - 0: JS_IDENTIFIER_BINDING@33..35 - 0: IDENT@33..35 "y" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@35..37 "}" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@37..41 - 0: EQ@37..39 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@39..41 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@40..40 - 2: R_CURLY@40..41 "}" [] [] - 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@43..45 - 0: L_CURLY@43..44 "{" [] [] - 1: JS_DIRECTIVE_LIST@44..44 - 2: JS_STATEMENT_LIST@44..44 - 3: R_CURLY@44..45 "}" [] [] - 2: JS_FUNCTION_DECLARATION@45..102 - 0: (empty) - 1: FUNCTION_KW@45..55 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@55..56 - 0: IDENT@55..56 "c" [] [] - 4: (empty) - 5: JS_PARAMETERS@56..100 - 0: L_PAREN@56..57 "(" [] [] - 1: JS_PARAMETER_LIST@57..98 - 0: JS_FORMAL_PARAMETER@57..66 - 0: JS_DECORATOR_LIST@57..57 - 1: JS_IDENTIFIER_BINDING@57..58 - 0: IDENT@57..58 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@58..66 - 0: COLON@58..60 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@60..66 - 0: STRING_KW@60..66 "string" [] [] - 4: (empty) - 1: COMMA@66..68 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@68..78 - 0: JS_DECORATOR_LIST@68..68 - 1: JS_IDENTIFIER_BINDING@68..69 - 0: IDENT@68..69 "y" [] [] - 2: QUESTION@69..70 "?" [] [] - 3: TS_TYPE_ANNOTATION@70..78 - 0: COLON@70..72 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@72..78 - 0: NUMBER_KW@72..78 "number" [] [] - 4: (empty) - 3: COMMA@78..80 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@80..98 - 0: JS_DECORATOR_LIST@80..80 - 1: JS_IDENTIFIER_BINDING@80..81 - 0: IDENT@80..81 "z" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@81..90 - 0: COLON@81..83 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@83..90 - 0: STRING_KW@83..90 "string" [] [Whitespace(" ")] - 4: JS_INITIALIZER_CLAUSE@90..98 - 0: EQ@90..92 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@92..98 - 0: JS_STRING_LITERAL@92..98 "\"test\"" [] [] - 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@100..102 - 0: L_CURLY@100..101 "{" [] [] - 1: JS_DIRECTIVE_LIST@101..101 - 2: JS_STATEMENT_LIST@101..101 - 3: R_CURLY@101..102 "}" [] [] - 4: EOF@102..103 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.rast b/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.rast deleted file mode 100644 index d91fdc135fcb..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.rast +++ /dev/null @@ -1,174 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@26..27 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@27..28 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@28..32 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@32..33 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@35..36 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@47..48 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [ - JsDecorator { - at_token: AT@48..49 "@" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..53 "dec" [] [Whitespace(" ")], - }, - }, - }, - ], - binding: JsIdentifierBinding { - name_token: IDENT@53..54 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@56..57 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@57..58 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@58..60 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@60..61 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..61 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..60 - 0: JS_CLASS_DECLARATION@0..60 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@10..11 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@11..58 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@11..37 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@11..11 - 1: JS_LITERAL_MEMBER_NAME@11..26 - 0: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@26..35 - 0: L_PAREN@26..27 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@27..33 - 0: JS_FORMAL_PARAMETER@27..33 - 0: JS_DECORATOR_LIST@27..32 - 0: JS_DECORATOR@27..32 - 0: AT@27..28 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@28..32 - 0: JS_REFERENCE_IDENTIFIER@28..32 - 0: IDENT@28..32 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@32..33 - 0: IDENT@32..33 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@35..37 - 0: L_CURLY@35..36 "{" [] [] - 1: JS_DIRECTIVE_LIST@36..36 - 2: JS_STATEMENT_LIST@36..36 - 3: R_CURLY@36..37 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@37..58 - 0: JS_METHOD_MODIFIER_LIST@37..37 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@37..47 - 0: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@47..56 - 0: L_PAREN@47..48 "(" [] [] - 1: JS_PARAMETER_LIST@48..54 - 0: JS_FORMAL_PARAMETER@48..54 - 0: JS_DECORATOR_LIST@48..53 - 0: JS_DECORATOR@48..53 - 0: AT@48..49 "@" [] [] - 1: JS_IDENTIFIER_EXPRESSION@49..53 - 0: JS_REFERENCE_IDENTIFIER@49..53 - 0: IDENT@49..53 "dec" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@53..54 - 0: IDENT@53..54 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@56..58 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..57 - 3: R_CURLY@57..58 "}" [] [] - 9: R_CURLY@58..60 "}" [Newline("\n")] [] - 4: EOF@60..61 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.rast b/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.rast deleted file mode 100644 index 9c4b5f2574cd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.rast +++ /dev/null @@ -1,391 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@9..13 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@15..17 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@17..23 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@23..24 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@26..30 "void" [] [], - }, - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@31..41 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@41..45 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@45..46 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@46..47 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@47..49 ":" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@49..56 "string" [] [Whitespace(" ")], - }, - PIPE@56..58 "|" [] [Whitespace(" ")], - TsUndefinedType { - undefined_token: UNDEFINED_KW@58..67 "undefined" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@67..68 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@68..70 ":" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@70..75 "void" [] [Whitespace(" ")], - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@75..76 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@76..77 "}" [] [], - }, - }, - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@77..87 "function" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@87..94 "no_semi" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@94..95 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@95..96 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@96..98 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@98..104 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@104..105 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@105..115 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@115..122 "no_semi" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@122..123 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@123..124 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@124..126 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@126..132 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@132..134 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@134..135 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@135..136 "}" [] [], - }, - }, - TsDeclareFunctionDeclaration { - async_token: ASYNC_KW@136..143 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@143..152 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@152..166 "async_overload" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@166..167 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@167..168 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@168..170 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@170..176 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@176..177 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: ASYNC_KW@177..184 "async" [Newline("\n")] [Whitespace(" ")], - function_token: FUNCTION_KW@184..193 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@193..207 "async_overload" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@207..208 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@208..209 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@209..211 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@211..217 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@217..219 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@219..220 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@220..221 "}" [] [], - }, - }, - ], - eof_token: EOF@221..222 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..222 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..221 - 0: TS_DECLARE_FUNCTION_DECLARATION@0..31 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@9..13 - 0: IDENT@9..13 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@13..24 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..23 - 0: JS_FORMAL_PARAMETER@14..23 - 0: JS_DECORATOR_LIST@14..14 - 1: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@15..23 - 0: COLON@15..17 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@17..23 - 0: STRING_KW@17..23 "string" [] [] - 4: (empty) - 2: R_PAREN@23..24 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@24..30 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@26..30 - 0: VOID_KW@26..30 "void" [] [] - 6: SEMICOLON@30..31 ";" [] [] - 1: JS_FUNCTION_DECLARATION@31..77 - 0: (empty) - 1: FUNCTION_KW@31..41 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@41..45 - 0: IDENT@41..45 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@45..68 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_PARAMETER_LIST@46..67 - 0: JS_FORMAL_PARAMETER@46..67 - 0: JS_DECORATOR_LIST@46..46 - 1: JS_IDENTIFIER_BINDING@46..47 - 0: IDENT@46..47 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@47..67 - 0: COLON@47..49 ":" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@49..67 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@49..67 - 0: TS_STRING_TYPE@49..56 - 0: STRING_KW@49..56 "string" [] [Whitespace(" ")] - 1: PIPE@56..58 "|" [] [Whitespace(" ")] - 2: TS_UNDEFINED_TYPE@58..67 - 0: UNDEFINED_KW@58..67 "undefined" [] [] - 4: (empty) - 2: R_PAREN@67..68 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@68..75 - 0: COLON@68..70 ":" [] [Whitespace(" ")] - 1: TS_VOID_TYPE@70..75 - 0: VOID_KW@70..75 "void" [] [Whitespace(" ")] - 7: JS_FUNCTION_BODY@75..77 - 0: L_CURLY@75..76 "{" [] [] - 1: JS_DIRECTIVE_LIST@76..76 - 2: JS_STATEMENT_LIST@76..76 - 3: R_CURLY@76..77 "}" [] [] - 2: TS_DECLARE_FUNCTION_DECLARATION@77..105 - 0: (empty) - 1: FUNCTION_KW@77..87 "function" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@87..94 - 0: IDENT@87..94 "no_semi" [] [] - 3: (empty) - 4: JS_PARAMETERS@94..105 - 0: L_PAREN@94..95 "(" [] [] - 1: JS_PARAMETER_LIST@95..104 - 0: JS_FORMAL_PARAMETER@95..104 - 0: JS_DECORATOR_LIST@95..95 - 1: JS_IDENTIFIER_BINDING@95..96 - 0: IDENT@95..96 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@96..104 - 0: COLON@96..98 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@98..104 - 0: STRING_KW@98..104 "string" [] [] - 4: (empty) - 2: R_PAREN@104..105 ")" [] [] - 5: (empty) - 6: (empty) - 3: JS_FUNCTION_DECLARATION@105..136 - 0: (empty) - 1: FUNCTION_KW@105..115 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@115..122 - 0: IDENT@115..122 "no_semi" [] [] - 4: (empty) - 5: JS_PARAMETERS@122..134 - 0: L_PAREN@122..123 "(" [] [] - 1: JS_PARAMETER_LIST@123..132 - 0: JS_FORMAL_PARAMETER@123..132 - 0: JS_DECORATOR_LIST@123..123 - 1: JS_IDENTIFIER_BINDING@123..124 - 0: IDENT@123..124 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@124..132 - 0: COLON@124..126 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@126..132 - 0: STRING_KW@126..132 "string" [] [] - 4: (empty) - 2: R_PAREN@132..134 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@134..136 - 0: L_CURLY@134..135 "{" [] [] - 1: JS_DIRECTIVE_LIST@135..135 - 2: JS_STATEMENT_LIST@135..135 - 3: R_CURLY@135..136 "}" [] [] - 4: TS_DECLARE_FUNCTION_DECLARATION@136..177 - 0: ASYNC_KW@136..143 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@143..152 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@152..166 - 0: IDENT@152..166 "async_overload" [] [] - 3: (empty) - 4: JS_PARAMETERS@166..177 - 0: L_PAREN@166..167 "(" [] [] - 1: JS_PARAMETER_LIST@167..176 - 0: JS_FORMAL_PARAMETER@167..176 - 0: JS_DECORATOR_LIST@167..167 - 1: JS_IDENTIFIER_BINDING@167..168 - 0: IDENT@167..168 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@168..176 - 0: COLON@168..170 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@170..176 - 0: STRING_KW@170..176 "string" [] [] - 4: (empty) - 2: R_PAREN@176..177 ")" [] [] - 5: (empty) - 6: (empty) - 5: JS_FUNCTION_DECLARATION@177..221 - 0: ASYNC_KW@177..184 "async" [Newline("\n")] [Whitespace(" ")] - 1: FUNCTION_KW@184..193 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@193..207 - 0: IDENT@193..207 "async_overload" [] [] - 4: (empty) - 5: JS_PARAMETERS@207..219 - 0: L_PAREN@207..208 "(" [] [] - 1: JS_PARAMETER_LIST@208..217 - 0: JS_FORMAL_PARAMETER@208..217 - 0: JS_DECORATOR_LIST@208..208 - 1: JS_IDENTIFIER_BINDING@208..209 - 0: IDENT@208..209 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@209..217 - 0: COLON@209..211 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@211..217 - 0: STRING_KW@211..217 "string" [] [] - 4: (empty) - 2: R_PAREN@217..219 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@219..221 - 0: L_CURLY@219..220 "{" [] [] - 1: JS_DIRECTIVE_LIST@220..220 - 2: JS_STATEMENT_LIST@220..220 - 3: R_CURLY@220..221 "}" [] [] - 4: EOF@221..222 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.rast b/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.rast deleted file mode 100644 index 4917288ca3fa..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.rast +++ /dev/null @@ -1,340 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..13 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@14..15 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@15..17 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@17..23 "string" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@25..26 "b" [] [], - }, - question_mark_token: QUESTION@26..27 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@27..29 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@29..35 "number" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@35..37 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@37..38 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@38..39 "=" [] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@39..48 "\"default\"" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@50..51 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@51..52 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@52..62 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@62..67 "test2" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@67..68 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@68..69 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@69..71 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@71..73 "B" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@73..81 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@81..82 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - COMMA@82..84 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@84..86 "C" [] [Whitespace(" ")], - }, - constraint: missing (optional), - default: TsDefaultTypeClause { - eq_token: EQ@86..88 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@88..89 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - ], - r_angle_token: R_ANGLE@89..90 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@90..91 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@91..92 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@92..94 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@94..95 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@95..97 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@97..98 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@98..100 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@100..101 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@101..103 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@103..104 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@104..106 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@106..107 "C" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@109..110 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@110..111 "}" [] [], - }, - }, - ], - eof_token: EOF@111..112 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..112 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..111 - 0: JS_FUNCTION_DECLARATION@0..52 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..13 - 0: IDENT@9..13 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@13..50 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..48 - 0: JS_FORMAL_PARAMETER@14..23 - 0: JS_DECORATOR_LIST@14..14 - 1: JS_IDENTIFIER_BINDING@14..15 - 0: IDENT@14..15 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@15..23 - 0: COLON@15..17 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@17..23 - 0: STRING_KW@17..23 "string" [] [] - 4: (empty) - 1: COMMA@23..25 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@25..35 - 0: JS_DECORATOR_LIST@25..25 - 1: JS_IDENTIFIER_BINDING@25..26 - 0: IDENT@25..26 "b" [] [] - 2: QUESTION@26..27 "?" [] [] - 3: TS_TYPE_ANNOTATION@27..35 - 0: COLON@27..29 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@29..35 - 0: NUMBER_KW@29..35 "number" [] [] - 4: (empty) - 3: COMMA@35..37 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@37..48 - 0: JS_DECORATOR_LIST@37..37 - 1: JS_IDENTIFIER_BINDING@37..38 - 0: IDENT@37..38 "c" [] [] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@38..48 - 0: EQ@38..39 "=" [] [] - 1: JS_STRING_LITERAL_EXPRESSION@39..48 - 0: JS_STRING_LITERAL@39..48 "\"default\"" [] [] - 2: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@50..52 - 0: L_CURLY@50..51 "{" [] [] - 1: JS_DIRECTIVE_LIST@51..51 - 2: JS_STATEMENT_LIST@51..51 - 3: R_CURLY@51..52 "}" [] [] - 1: JS_FUNCTION_DECLARATION@52..111 - 0: (empty) - 1: FUNCTION_KW@52..62 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@62..67 - 0: IDENT@62..67 "test2" [] [] - 4: TS_TYPE_PARAMETERS@67..90 - 0: L_ANGLE@67..68 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@68..89 - 0: TS_TYPE_PARAMETER@68..69 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@68..68 - 1: TS_TYPE_PARAMETER_NAME@68..69 - 0: IDENT@68..69 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@69..71 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@71..82 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@71..71 - 1: TS_TYPE_PARAMETER_NAME@71..73 - 0: IDENT@71..73 "B" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@73..82 - 0: EXTENDS_KW@73..81 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@81..82 - 0: JS_REFERENCE_IDENTIFIER@81..82 - 0: IDENT@81..82 "A" [] [] - 1: (empty) - 3: (empty) - 3: COMMA@82..84 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@84..89 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@84..84 - 1: TS_TYPE_PARAMETER_NAME@84..86 - 0: IDENT@84..86 "C" [] [Whitespace(" ")] - 2: (empty) - 3: TS_DEFAULT_TYPE_CLAUSE@86..89 - 0: EQ@86..88 "=" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@88..89 - 0: JS_REFERENCE_IDENTIFIER@88..89 - 0: IDENT@88..89 "A" [] [] - 1: (empty) - 2: R_ANGLE@89..90 ">" [] [] - 5: JS_PARAMETERS@90..109 - 0: L_PAREN@90..91 "(" [] [] - 1: JS_PARAMETER_LIST@91..107 - 0: JS_FORMAL_PARAMETER@91..95 - 0: JS_DECORATOR_LIST@91..91 - 1: JS_IDENTIFIER_BINDING@91..92 - 0: IDENT@91..92 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@92..95 - 0: COLON@92..94 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@94..95 - 0: JS_REFERENCE_IDENTIFIER@94..95 - 0: IDENT@94..95 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@95..97 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@97..101 - 0: JS_DECORATOR_LIST@97..97 - 1: JS_IDENTIFIER_BINDING@97..98 - 0: IDENT@97..98 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@98..101 - 0: COLON@98..100 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@100..101 - 0: JS_REFERENCE_IDENTIFIER@100..101 - 0: IDENT@100..101 "B" [] [] - 1: (empty) - 4: (empty) - 3: COMMA@101..103 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@103..107 - 0: JS_DECORATOR_LIST@103..103 - 1: JS_IDENTIFIER_BINDING@103..104 - 0: IDENT@103..104 "c" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@104..107 - 0: COLON@104..106 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@106..107 - 0: JS_REFERENCE_IDENTIFIER@106..107 - 0: IDENT@106..107 "C" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@107..109 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@109..111 - 0: L_CURLY@109..110 "{" [] [] - 1: JS_DIRECTIVE_LIST@110..110 - 2: JS_STATEMENT_LIST@110..110 - 3: R_CURLY@110..111 "}" [] [] - 4: EOF@111..112 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_function_type.rast deleted file mode 100644 index 794d443259d7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_function_type.rast +++ /dev/null @@ -1,675 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@9..10 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@10..12 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@15..21 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@22..28 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@28..30 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@30..32 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@32..33 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@33..34 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@34..36 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@36..42 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@47..53 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@53..54 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@54..60 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@60..62 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@62..64 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@64..65 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@65..67 "b" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@67..69 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@69..75 "\"test\"" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@77..80 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@80..86 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@86..87 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@93..95 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@95..97 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@97..98 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@98..99 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@99..101 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@101..102 "d" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@107..113 "string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@113..119 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@119..121 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@121..123 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@123..124 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsArrayBindingPattern { - l_brack_token: L_BRACK@124..125 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@125..126 "a" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@126..127 "]" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@132..138 "string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@138..144 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@144..146 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@146..148 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@148..149 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@149..150 "{" [] [], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@150..151 "a" [] [], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@151..152 "}" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@152..154 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@154..157 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@157..163 "string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@163..169 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@169..171 "G" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@171..173 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@173..174 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@174..175 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@175..177 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@177..178 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@178..179 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@179..180 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@180..181 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@181..183 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@183..184 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@184..186 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@186..187 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@187..189 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@189..190 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@190..192 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@192..195 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@195..201 "string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@201..207 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@207..209 "H" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@209..211 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@211..212 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@212..213 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@213..215 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@215..218 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@218..220 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@220..223 "=>" [] [Whitespace(" ")], - return_type: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@223..225 "a" [] [Whitespace(" ")], - }, - is_token: IS_KW@225..228 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@228..234 "string" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@234..235 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@235..241 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@241..243 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@243..245 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@245..246 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@246..248 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@248..249 "a" [] [], - }, - init: missing (optional), - }, - COMMA@249..251 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@251..253 "b" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@253..254 "}" [] [], - }, - question_mark_token: QUESTION@254..255 "?" [] [], - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@255..257 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@257..260 "=>" [] [Whitespace(" ")], - return_type: TsStringType { - string_token: STRING_KW@260..266 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@266..267 ";" [] [], - }, - ], - eof_token: EOF@267..268 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..268 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..267 - 0: TS_TYPE_ALIAS_DECLARATION@0..22 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@9..21 - 0: (empty) - 1: JS_PARAMETERS@9..12 - 0: L_PAREN@9..10 "(" [] [] - 1: JS_PARAMETER_LIST@10..10 - 2: R_PAREN@10..12 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@15..21 - 0: STRING_KW@15..21 "string" [] [] - 5: SEMICOLON@21..22 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@22..54 - 0: TYPE_KW@22..28 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@28..30 - 0: IDENT@28..30 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@30..32 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@32..53 - 0: (empty) - 1: JS_PARAMETERS@32..44 - 0: L_PAREN@32..33 "(" [] [] - 1: JS_PARAMETER_LIST@33..42 - 0: JS_FORMAL_PARAMETER@33..42 - 0: JS_DECORATOR_LIST@33..33 - 1: JS_IDENTIFIER_BINDING@33..34 - 0: IDENT@33..34 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@34..42 - 0: COLON@34..36 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@36..42 - 0: STRING_KW@36..42 "string" [] [] - 4: (empty) - 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@47..53 - 0: STRING_KW@47..53 "string" [] [] - 5: SEMICOLON@53..54 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@54..87 - 0: TYPE_KW@54..60 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@60..62 - 0: IDENT@60..62 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@62..64 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@64..86 - 0: (empty) - 1: JS_PARAMETERS@64..77 - 0: L_PAREN@64..65 "(" [] [] - 1: JS_PARAMETER_LIST@65..75 - 0: JS_FORMAL_PARAMETER@65..75 - 0: JS_DECORATOR_LIST@65..65 - 1: JS_IDENTIFIER_BINDING@65..67 - 0: IDENT@65..67 "b" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@67..75 - 0: EQ@67..69 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@69..75 - 0: JS_STRING_LITERAL@69..75 "\"test\"" [] [] - 2: R_PAREN@75..77 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@77..80 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@80..86 - 0: STRING_KW@80..86 "string" [] [] - 5: SEMICOLON@86..87 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@87..113 - 0: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@93..95 - 0: IDENT@93..95 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@95..97 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@97..113 - 0: (empty) - 1: JS_PARAMETERS@97..104 - 0: L_PAREN@97..98 "(" [] [] - 1: JS_PARAMETER_LIST@98..102 - 0: JS_FORMAL_PARAMETER@98..99 - 0: JS_DECORATOR_LIST@98..98 - 1: JS_IDENTIFIER_BINDING@98..99 - 0: IDENT@98..99 "c" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@99..101 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@101..102 - 0: JS_DECORATOR_LIST@101..101 - 1: JS_IDENTIFIER_BINDING@101..102 - 0: IDENT@101..102 "d" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@107..113 - 0: STRING_KW@107..113 "string" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@113..138 - 0: TYPE_KW@113..119 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@119..121 - 0: IDENT@119..121 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@121..123 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@123..138 - 0: (empty) - 1: JS_PARAMETERS@123..129 - 0: L_PAREN@123..124 "(" [] [] - 1: JS_PARAMETER_LIST@124..127 - 0: JS_FORMAL_PARAMETER@124..127 - 0: JS_DECORATOR_LIST@124..124 - 1: JS_ARRAY_BINDING_PATTERN@124..127 - 0: L_BRACK@124..125 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@125..126 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@125..126 - 0: JS_IDENTIFIER_BINDING@125..126 - 0: IDENT@125..126 "a" [] [] - 1: (empty) - 2: R_BRACK@126..127 "]" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@132..138 - 0: STRING_KW@132..138 "string" [] [] - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@138..163 - 0: TYPE_KW@138..144 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@144..146 - 0: IDENT@144..146 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@146..148 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@148..163 - 0: (empty) - 1: JS_PARAMETERS@148..154 - 0: L_PAREN@148..149 "(" [] [] - 1: JS_PARAMETER_LIST@149..152 - 0: JS_FORMAL_PARAMETER@149..152 - 0: JS_DECORATOR_LIST@149..149 - 1: JS_OBJECT_BINDING_PATTERN@149..152 - 0: L_CURLY@149..150 "{" [] [] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@150..151 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@150..151 - 0: JS_IDENTIFIER_BINDING@150..151 - 0: IDENT@150..151 "a" [] [] - 1: (empty) - 2: R_CURLY@151..152 "}" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@152..154 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@154..157 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@157..163 - 0: STRING_KW@157..163 "string" [] [] - 5: (empty) - 6: TS_TYPE_ALIAS_DECLARATION@163..201 - 0: TYPE_KW@163..169 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@169..171 - 0: IDENT@169..171 "G" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@171..173 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@173..201 - 0: TS_TYPE_PARAMETERS@173..179 - 0: L_ANGLE@173..174 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@174..178 - 0: TS_TYPE_PARAMETER@174..175 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@174..174 - 1: TS_TYPE_PARAMETER_NAME@174..175 - 0: IDENT@174..175 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@175..177 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@177..178 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@177..177 - 1: TS_TYPE_PARAMETER_NAME@177..178 - 0: IDENT@177..178 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@178..179 ">" [] [] - 1: JS_PARAMETERS@179..192 - 0: L_PAREN@179..180 "(" [] [] - 1: JS_PARAMETER_LIST@180..190 - 0: JS_FORMAL_PARAMETER@180..184 - 0: JS_DECORATOR_LIST@180..180 - 1: JS_IDENTIFIER_BINDING@180..181 - 0: IDENT@180..181 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@181..184 - 0: COLON@181..183 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@183..184 - 0: JS_REFERENCE_IDENTIFIER@183..184 - 0: IDENT@183..184 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@184..186 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@186..190 - 0: JS_DECORATOR_LIST@186..186 - 1: JS_IDENTIFIER_BINDING@186..187 - 0: IDENT@186..187 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@187..190 - 0: COLON@187..189 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@189..190 - 0: JS_REFERENCE_IDENTIFIER@189..190 - 0: IDENT@189..190 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@192..195 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@195..201 - 0: STRING_KW@195..201 "string" [] [] - 5: (empty) - 7: TS_TYPE_ALIAS_DECLARATION@201..235 - 0: TYPE_KW@201..207 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@207..209 - 0: IDENT@207..209 "H" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@209..211 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@211..234 - 0: (empty) - 1: JS_PARAMETERS@211..220 - 0: L_PAREN@211..212 "(" [] [] - 1: JS_PARAMETER_LIST@212..218 - 0: JS_FORMAL_PARAMETER@212..218 - 0: JS_DECORATOR_LIST@212..212 - 1: JS_IDENTIFIER_BINDING@212..213 - 0: IDENT@212..213 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@213..218 - 0: COLON@213..215 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@215..218 - 0: ANY_KW@215..218 "any" [] [] - 4: (empty) - 2: R_PAREN@218..220 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@220..223 "=>" [] [Whitespace(" ")] - 3: TS_PREDICATE_RETURN_TYPE@223..234 - 0: JS_REFERENCE_IDENTIFIER@223..225 - 0: IDENT@223..225 "a" [] [Whitespace(" ")] - 1: IS_KW@225..228 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@228..234 - 0: STRING_KW@228..234 "string" [] [] - 5: SEMICOLON@234..235 ";" [] [] - 8: TS_TYPE_ALIAS_DECLARATION@235..267 - 0: TYPE_KW@235..241 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@241..243 - 0: IDENT@241..243 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@243..245 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@245..266 - 0: (empty) - 1: JS_PARAMETERS@245..257 - 0: L_PAREN@245..246 "(" [] [] - 1: JS_PARAMETER_LIST@246..255 - 0: JS_FORMAL_PARAMETER@246..255 - 0: JS_DECORATOR_LIST@246..246 - 1: JS_OBJECT_BINDING_PATTERN@246..254 - 0: L_CURLY@246..248 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@248..253 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@248..249 - 0: JS_IDENTIFIER_BINDING@248..249 - 0: IDENT@248..249 "a" [] [] - 1: (empty) - 1: COMMA@249..251 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@251..253 - 0: JS_IDENTIFIER_BINDING@251..253 - 0: IDENT@251..253 "b" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@253..254 "}" [] [] - 2: QUESTION@254..255 "?" [] [] - 3: (empty) - 4: (empty) - 2: R_PAREN@255..257 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@257..260 "=>" [] [Whitespace(" ")] - 3: TS_STRING_TYPE@260..266 - 0: STRING_KW@260..266 "string" [] [] - 5: SEMICOLON@266..267 ";" [] [] - 4: EOF@267..268 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.rast deleted file mode 100644 index 562c4bf27b5e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.rast +++ /dev/null @@ -1,262 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsGetterSignatureTypeMember { - get_token: GET_KW@11..15 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..16 "a" [] [], - }, - l_paren_token: L_PAREN@16..17 "(" [] [], - r_paren_token: R_PAREN@17..18 ")" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@20..27 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@34..36 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsGetterSignatureTypeMember { - get_token: GET_KW@40..44 "get" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@44..45 "a" [] [], - }, - l_paren_token: L_PAREN@45..46 "(" [] [], - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@48..49 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@49..108 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@108..110 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@110..112 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@112..114 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@114..117 "get" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@117..118 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@118..119 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@119..121 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@121..128 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@128..129 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@129..135 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@135..137 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@137..139 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@139..141 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@141..144 "get" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@144..146 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@146..153 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@153..154 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@154..160 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@160..162 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@162..164 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@164..166 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@166..170 "get" [] [Whitespace(" ")], - }, - optional_token: missing (optional), - type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@170..171 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@171..172 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..172 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..171 - 0: TS_TYPE_ALIAS_DECLARATION@0..28 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..28 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..27 - 0: TS_GETTER_SIGNATURE_TYPE_MEMBER@11..27 - 0: GET_KW@11..15 "get" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..16 - 0: IDENT@15..16 "a" [] [] - 2: L_PAREN@16..17 "(" [] [] - 3: R_PAREN@17..18 ")" [] [] - 4: TS_TYPE_ANNOTATION@18..27 - 0: COLON@18..20 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@20..27 - 0: NUMBER_KW@20..27 "number" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@27..28 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@28..49 - 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@36..38 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@38..49 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@40..48 - 0: TS_GETTER_SIGNATURE_TYPE_MEMBER@40..48 - 0: GET_KW@40..44 "get" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@44..45 - 0: IDENT@44..45 "a" [] [] - 2: L_PAREN@45..46 "(" [] [] - 3: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 2: R_CURLY@48..49 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@49..129 - 0: TYPE_KW@49..108 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@108..110 - 0: IDENT@108..110 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@110..112 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@112..129 - 0: L_CURLY@112..114 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@114..128 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@114..128 - 0: JS_LITERAL_MEMBER_NAME@114..117 - 0: IDENT@114..117 "get" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@117..119 - 0: L_PAREN@117..118 "(" [] [] - 1: JS_PARAMETER_LIST@118..118 - 2: R_PAREN@118..119 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@119..128 - 0: COLON@119..121 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@121..128 - 0: NUMBER_KW@121..128 "number" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@128..129 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@129..154 - 0: TYPE_KW@129..135 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@135..137 - 0: IDENT@135..137 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@137..139 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@139..154 - 0: L_CURLY@139..141 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@141..153 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@141..153 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@141..144 - 0: IDENT@141..144 "get" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@144..153 - 0: COLON@144..146 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@146..153 - 0: NUMBER_KW@146..153 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@153..154 "}" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@154..171 - 0: TYPE_KW@154..160 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@160..162 - 0: IDENT@160..162 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@162..164 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@164..171 - 0: L_CURLY@164..166 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@166..170 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@166..170 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@166..170 - 0: IDENT@166..170 "get" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_CURLY@170..171 "}" [] [] - 5: (empty) - 4: EOF@171..172 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.rast deleted file mode 100644 index 2de4e95dd2c3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.rast +++ /dev/null @@ -1,167 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@15..24 "\"./test\"" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@24..25 "{" [] [], - items: JsModuleItemList [ - TsGlobalDeclaration { - global_token: GLOBAL_KW@25..34 "global" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - body: TsModuleBlock { - l_curly_token: L_CURLY@34..35 "{" [] [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@35..45 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@45..52 "VERSION" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@52..54 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@54..60 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - ], - r_curly_token: R_CURLY@61..64 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@64..66 "}" [Newline("\n")] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@66..75 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsExternalModuleDeclaration { - module_token: MODULE_KW@75..82 "module" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@82..88 "\"foo\"" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@88..89 "{" [] [], - items: JsModuleItemList [ - TsGlobalDeclaration { - global_token: GLOBAL_KW@89..97 "global" [Newline("\n"), Whitespace(" ")] [], - body: TsModuleBlock { - l_curly_token: L_CURLY@97..101 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - items: JsModuleItemList [], - r_curly_token: R_CURLY@101..102 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@102..104 "}" [Newline("\n")] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@104..113 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsGlobalDeclaration { - global_token: GLOBAL_KW@113..120 "global" [] [Whitespace(" ")], - body: TsModuleBlock { - l_curly_token: L_CURLY@120..121 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@121..122 "}" [] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@122..131 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsGlobalDeclaration { - global_token: GLOBAL_KW@131..137 "global" [] [], - body: TsModuleBlock { - l_curly_token: L_CURLY@137..140 "{" [Newline("\n")] [Whitespace(" ")], - items: JsModuleItemList [], - r_curly_token: R_CURLY@140..141 "}" [] [], - }, - }, - }, - ], - eof_token: EOF@141..142 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..142 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..141 - 0: TS_DECLARE_STATEMENT@0..66 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@8..66 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@15..24 - 0: JS_STRING_LITERAL@15..24 "\"./test\"" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@24..66 - 0: L_CURLY@24..25 "{" [] [] - 1: JS_MODULE_ITEM_LIST@25..64 - 0: TS_GLOBAL_DECLARATION@25..64 - 0: GLOBAL_KW@25..34 "global" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_MODULE_BLOCK@34..64 - 0: L_CURLY@34..35 "{" [] [] - 1: JS_MODULE_ITEM_LIST@35..61 - 0: JS_VARIABLE_STATEMENT@35..61 - 0: JS_VARIABLE_DECLARATION@35..60 - 0: (empty) - 1: LET_KW@35..45 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@45..60 - 0: JS_VARIABLE_DECLARATOR@45..60 - 0: JS_IDENTIFIER_BINDING@45..52 - 0: IDENT@45..52 "VERSION" [] [] - 1: TS_TYPE_ANNOTATION@52..60 - 0: COLON@52..54 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@54..60 - 0: STRING_KW@54..60 "string" [] [] - 2: (empty) - 1: SEMICOLON@60..61 ";" [] [] - 2: R_CURLY@61..64 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@64..66 "}" [Newline("\n")] [] - 1: TS_DECLARE_STATEMENT@66..104 - 0: DECLARE_KW@66..75 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_EXTERNAL_MODULE_DECLARATION@75..104 - 0: MODULE_KW@75..82 "module" [] [Whitespace(" ")] - 1: JS_MODULE_SOURCE@82..88 - 0: JS_STRING_LITERAL@82..88 "\"foo\"" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@88..104 - 0: L_CURLY@88..89 "{" [] [] - 1: JS_MODULE_ITEM_LIST@89..102 - 0: TS_GLOBAL_DECLARATION@89..102 - 0: GLOBAL_KW@89..97 "global" [Newline("\n"), Whitespace(" ")] [] - 1: TS_MODULE_BLOCK@97..102 - 0: L_CURLY@97..101 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_MODULE_ITEM_LIST@101..101 - 2: R_CURLY@101..102 "}" [] [] - 2: R_CURLY@102..104 "}" [Newline("\n")] [] - 2: TS_DECLARE_STATEMENT@104..122 - 0: DECLARE_KW@104..113 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_GLOBAL_DECLARATION@113..122 - 0: GLOBAL_KW@113..120 "global" [] [Whitespace(" ")] - 1: TS_MODULE_BLOCK@120..122 - 0: L_CURLY@120..121 "{" [] [] - 1: JS_MODULE_ITEM_LIST@121..121 - 2: R_CURLY@121..122 "}" [] [] - 3: TS_DECLARE_STATEMENT@122..141 - 0: DECLARE_KW@122..131 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_GLOBAL_DECLARATION@131..141 - 0: GLOBAL_KW@131..137 "global" [] [] - 1: TS_MODULE_BLOCK@137..141 - 0: L_CURLY@137..140 "{" [Newline("\n")] [Whitespace(" ")] - 1: JS_MODULE_ITEM_LIST@140..140 - 2: R_CURLY@140..141 "}" [] [] - 4: EOF@141..142 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.rast b/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.rast deleted file mode 100644 index 4156e5498644..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..10 "global" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..46 "global" [Newline("\n")] [Whitespace(" "), Comments("// not a global decla ...")], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@46..54 "console" [Newline("\n")] [], - }, - }, - operator_token: DOT@54..55 "." [] [], - member: JsName { - value_token: IDENT@55..58 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@58..59 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@59..62 "\"a\"" [] [], - }, - ], - r_paren_token: R_PAREN@62..63 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - ], - eof_token: EOF@64..65 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..65 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..64 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_IDENTIFIER_BINDING@4..10 - 0: IDENT@4..10 "global" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@10..11 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@11..46 - 0: JS_IDENTIFIER_EXPRESSION@11..46 - 0: JS_REFERENCE_IDENTIFIER@11..46 - 0: IDENT@11..46 "global" [Newline("\n")] [Whitespace(" "), Comments("// not a global decla ...")] - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@46..64 - 0: JS_CALL_EXPRESSION@46..63 - 0: JS_STATIC_MEMBER_EXPRESSION@46..58 - 0: JS_IDENTIFIER_EXPRESSION@46..54 - 0: JS_REFERENCE_IDENTIFIER@46..54 - 0: IDENT@46..54 "console" [Newline("\n")] [] - 1: DOT@54..55 "." [] [] - 2: JS_NAME@55..58 - 0: IDENT@55..58 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@58..63 - 0: L_PAREN@58..59 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@59..62 - 0: JS_STRING_LITERAL_EXPRESSION@59..62 - 0: JS_STRING_LITERAL@59..62 "\"a\"" [] [] - 2: R_PAREN@62..63 ")" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: EOF@64..65 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast b/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast deleted file mode 100644 index 379f48b097a6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast +++ /dev/null @@ -1,176 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@7..12 "type" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@12..17 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@17..24 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@24..39 ";" [] [Whitespace(" "), Comments("// not a type")], - }, - JsImport { - import_token: IMPORT_KW@39..47 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: TYPE_KW@47..52 "type" [] [Whitespace(" ")], - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@52..56 "foo" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@56..61 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@61..68 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@68..69 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@69..77 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamespaceClause { - type_token: TYPE_KW@77..82 "type" [] [Whitespace(" ")], - namespace_specifier: JsNamespaceImportSpecifier { - star_token: STAR@82..84 "*" [] [Whitespace(" ")], - as_token: AS_KW@84..87 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@87..92 "foo2" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@92..97 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@97..104 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@104..105 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@105..113 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: TYPE_KW@113..118 "type" [] [Whitespace(" ")], - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@120..125 "foo3" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@125..127 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@127..132 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@132..137 "\"mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@137..138 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@138..146 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: TYPE_KW@146..151 "type" [] [Whitespace(" ")], - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@151..156 "from" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@156..161 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@161..168 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@168..169 ";" [] [], - }, - ], - eof_token: EOF@169..170 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..170 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..169 - 0: JS_IMPORT@0..39 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@7..24 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@7..12 - 0: JS_IDENTIFIER_BINDING@7..12 - 0: IDENT@7..12 "type" [] [Whitespace(" ")] - 2: FROM_KW@12..17 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@17..24 - 0: JS_STRING_LITERAL@17..24 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@24..39 ";" [] [Whitespace(" "), Comments("// not a type")] - 1: JS_IMPORT@39..69 - 0: IMPORT_KW@39..47 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@47..68 - 0: TYPE_KW@47..52 "type" [] [Whitespace(" ")] - 1: JS_DEFAULT_IMPORT_SPECIFIER@52..56 - 0: JS_IDENTIFIER_BINDING@52..56 - 0: IDENT@52..56 "foo" [] [Whitespace(" ")] - 2: FROM_KW@56..61 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@61..68 - 0: JS_STRING_LITERAL@61..68 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@68..69 ";" [] [] - 2: JS_IMPORT@69..105 - 0: IMPORT_KW@69..77 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMESPACE_CLAUSE@77..104 - 0: TYPE_KW@77..82 "type" [] [Whitespace(" ")] - 1: JS_NAMESPACE_IMPORT_SPECIFIER@82..92 - 0: STAR@82..84 "*" [] [Whitespace(" ")] - 1: AS_KW@84..87 "as" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@87..92 - 0: IDENT@87..92 "foo2" [] [Whitespace(" ")] - 2: FROM_KW@92..97 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@97..104 - 0: JS_STRING_LITERAL@97..104 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@104..105 ";" [] [] - 3: JS_IMPORT@105..138 - 0: IMPORT_KW@105..113 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@113..137 - 0: TYPE_KW@113..118 "type" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIERS@118..127 - 0: L_CURLY@118..120 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@120..125 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@120..125 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@120..125 - 0: IDENT@120..125 "foo3" [] [Whitespace(" ")] - 2: R_CURLY@125..127 "}" [] [Whitespace(" ")] - 2: FROM_KW@127..132 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@132..137 - 0: JS_STRING_LITERAL@132..137 "\"mod\"" [] [] - 4: (empty) - 2: SEMICOLON@137..138 ";" [] [] - 4: JS_IMPORT@138..169 - 0: IMPORT_KW@138..146 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@146..168 - 0: TYPE_KW@146..151 "type" [] [Whitespace(" ")] - 1: JS_DEFAULT_IMPORT_SPECIFIER@151..156 - 0: JS_IDENTIFIER_BINDING@151..156 - 0: IDENT@151..156 "from" [] [Whitespace(" ")] - 2: FROM_KW@156..161 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@161..168 - 0: JS_STRING_LITERAL@161..168 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@168..169 ";" [] [] - 4: EOF@169..170 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.rast deleted file mode 100644 index 98634bd5217f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.rast +++ /dev/null @@ -1,184 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsImportEqualsDeclaration { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - type_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@7..9 "x" [] [Whitespace(" ")], - }, - eq_token: EQ@9..11 "=" [] [Whitespace(" ")], - module_reference: TsExternalModuleReference { - require_token: REQUIRE_KW@11..18 "require" [] [], - l_paren_token: L_PAREN@18..19 "(" [] [], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@19..27 "\"./test\"" [] [], - }, - r_paren_token: R_PAREN@27..28 ")" [] [], - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@29..40 "namespace" [Newline("\n")] [Whitespace(" ")], - name: TsQualifiedModuleName { - left: TsIdentifierBinding { - name_token: IDENT@40..41 "a" [] [], - }, - dot_token: DOT@41..42 "." [] [], - right: JsName { - value_token: IDENT@42..44 "b" [] [Whitespace(" ")], - }, - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@44..45 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@45..46 "}" [] [], - }, - }, - TsImportEqualsDeclaration { - import_token: IMPORT_KW@46..54 "import" [Newline("\n")] [Whitespace(" ")], - type_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@54..56 "y" [] [Whitespace(" ")], - }, - eq_token: EQ@56..58 "=" [] [Whitespace(" ")], - module_reference: JsReferenceIdentifier { - value_token: IDENT@58..59 "a" [] [], - }, - semicolon_token: SEMICOLON@59..60 ";" [] [], - }, - TsImportEqualsDeclaration { - import_token: IMPORT_KW@60..68 "import" [Newline("\n")] [Whitespace(" ")], - type_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@68..70 "z" [] [Whitespace(" ")], - }, - eq_token: EQ@70..72 "=" [] [Whitespace(" ")], - module_reference: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@72..73 "a" [] [], - }, - dot_token: DOT@73..74 "." [] [], - right: JsName { - value_token: IDENT@74..75 "b" [] [], - }, - }, - semicolon_token: SEMICOLON@75..76 ";" [] [], - }, - TsImportEqualsDeclaration { - import_token: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")], - type_token: TYPE_KW@84..89 "type" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@89..91 "A" [] [Whitespace(" ")], - }, - eq_token: EQ@91..93 "=" [] [Whitespace(" ")], - module_reference: TsExternalModuleReference { - require_token: REQUIRE_KW@93..100 "require" [] [], - l_paren_token: L_PAREN@100..101 "(" [] [], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@101..106 "\"./a\"" [] [], - }, - r_paren_token: R_PAREN@106..107 ")" [] [], - }, - semicolon_token: SEMICOLON@107..108 ";" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@108..116 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: TsImportEqualsDeclaration { - import_token: IMPORT_KW@116..123 "import" [] [Whitespace(" ")], - type_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@123..125 "n" [] [Whitespace(" ")], - }, - eq_token: EQ@125..127 "=" [] [Whitespace(" ")], - module_reference: JsReferenceIdentifier { - value_token: IDENT@127..128 "a" [] [], - }, - semicolon_token: SEMICOLON@128..129 ";" [] [], - }, - }, - ], - eof_token: EOF@129..130 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..130 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..129 - 0: TS_IMPORT_EQUALS_DECLARATION@0..29 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_BINDING@7..9 - 0: IDENT@7..9 "x" [] [Whitespace(" ")] - 3: EQ@9..11 "=" [] [Whitespace(" ")] - 4: TS_EXTERNAL_MODULE_REFERENCE@11..28 - 0: REQUIRE_KW@11..18 "require" [] [] - 1: L_PAREN@18..19 "(" [] [] - 2: JS_MODULE_SOURCE@19..27 - 0: JS_STRING_LITERAL@19..27 "\"./test\"" [] [] - 3: R_PAREN@27..28 ")" [] [] - 5: SEMICOLON@28..29 ";" [] [] - 1: TS_MODULE_DECLARATION@29..46 - 0: NAMESPACE_KW@29..40 "namespace" [Newline("\n")] [Whitespace(" ")] - 1: TS_QUALIFIED_MODULE_NAME@40..44 - 0: TS_IDENTIFIER_BINDING@40..41 - 0: IDENT@40..41 "a" [] [] - 1: DOT@41..42 "." [] [] - 2: JS_NAME@42..44 - 0: IDENT@42..44 "b" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@44..46 - 0: L_CURLY@44..45 "{" [] [] - 1: JS_MODULE_ITEM_LIST@45..45 - 2: R_CURLY@45..46 "}" [] [] - 2: TS_IMPORT_EQUALS_DECLARATION@46..60 - 0: IMPORT_KW@46..54 "import" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_BINDING@54..56 - 0: IDENT@54..56 "y" [] [Whitespace(" ")] - 3: EQ@56..58 "=" [] [Whitespace(" ")] - 4: JS_REFERENCE_IDENTIFIER@58..59 - 0: IDENT@58..59 "a" [] [] - 5: SEMICOLON@59..60 ";" [] [] - 3: TS_IMPORT_EQUALS_DECLARATION@60..76 - 0: IMPORT_KW@60..68 "import" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_BINDING@68..70 - 0: IDENT@68..70 "z" [] [Whitespace(" ")] - 3: EQ@70..72 "=" [] [Whitespace(" ")] - 4: TS_QUALIFIED_NAME@72..75 - 0: JS_REFERENCE_IDENTIFIER@72..73 - 0: IDENT@72..73 "a" [] [] - 1: DOT@73..74 "." [] [] - 2: JS_NAME@74..75 - 0: IDENT@74..75 "b" [] [] - 5: SEMICOLON@75..76 ";" [] [] - 4: TS_IMPORT_EQUALS_DECLARATION@76..108 - 0: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")] - 1: TYPE_KW@84..89 "type" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@89..91 - 0: IDENT@89..91 "A" [] [Whitespace(" ")] - 3: EQ@91..93 "=" [] [Whitespace(" ")] - 4: TS_EXTERNAL_MODULE_REFERENCE@93..107 - 0: REQUIRE_KW@93..100 "require" [] [] - 1: L_PAREN@100..101 "(" [] [] - 2: JS_MODULE_SOURCE@101..106 - 0: JS_STRING_LITERAL@101..106 "\"./a\"" [] [] - 3: R_PAREN@106..107 ")" [] [] - 5: SEMICOLON@107..108 ";" [] [] - 5: JS_EXPORT@108..129 - 0: JS_DECORATOR_LIST@108..108 - 1: EXPORT_KW@108..116 "export" [Newline("\n")] [Whitespace(" ")] - 2: TS_IMPORT_EQUALS_DECLARATION@116..129 - 0: IMPORT_KW@116..123 "import" [] [Whitespace(" ")] - 1: (empty) - 2: JS_IDENTIFIER_BINDING@123..125 - 0: IDENT@123..125 "n" [] [Whitespace(" ")] - 3: EQ@125..127 "=" [] [Whitespace(" ")] - 4: JS_REFERENCE_IDENTIFIER@127..128 - 0: IDENT@127..128 "a" [] [] - 5: SEMICOLON@128..129 ";" [] [] - 4: EOF@129..130 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_import_type.rast deleted file mode 100644 index 60845a8cf015..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_type.rast +++ /dev/null @@ -1,862 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")], - import_token: IMPORT_KW@16..22 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@22..23 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@23..29 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@29..30 ")" [] [], - }, - qualifier_clause: missing (optional), - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@31..37 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@37..39 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@39..41 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@41..47 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@47..48 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@48..54 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@54..55 ")" [] [], - }, - qualifier_clause: missing (optional), - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@55..56 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@56..62 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@62..64 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@64..66 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: TYPEOF_KW@66..73 "typeof" [] [Whitespace(" ")], - import_token: IMPORT_KW@73..79 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@79..80 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@80..86 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@86..87 ")" [] [], - }, - qualifier_clause: TsImportTypeQualifier { - dot_token: DOT@87..88 "." [] [], - right: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@88..89 "a" [] [], - }, - dot_token: DOT@89..90 "." [] [], - right: JsName { - value_token: IDENT@90..91 "b" [] [], - }, - }, - dot_token: DOT@91..92 "." [] [], - right: JsName { - value_token: IDENT@92..93 "c" [] [], - }, - }, - dot_token: DOT@93..94 "." [] [], - right: JsName { - value_token: IDENT@94..95 "d" [] [], - }, - }, - dot_token: DOT@95..96 "." [] [], - right: JsName { - value_token: IDENT@96..97 "e" [] [], - }, - }, - dot_token: DOT@97..98 "." [] [], - right: JsName { - value_token: IDENT@98..99 "f" [] [], - }, - }, - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@99..100 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@106..108 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@108..110 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@110..116 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@116..117 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@117..123 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@123..124 ")" [] [], - }, - qualifier_clause: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@124..125 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@125..131 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@131..132 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@132..133 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@133..139 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@139..141 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@141..143 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@143..149 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@149..150 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@150..156 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@156..157 ")" [] [], - }, - qualifier_clause: TsImportTypeQualifier { - dot_token: DOT@157..158 "." [] [], - right: JsReferenceIdentifier { - value_token: IDENT@158..159 "C" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@159..160 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@160..166 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@166..167 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@167..168 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@168..174 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@174..176 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@176..178 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: TYPEOF_KW@178..185 "typeof" [] [Whitespace(" ")], - import_token: IMPORT_KW@185..191 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@191..192 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@192..198 "\"test\"" [] [], - }, - COMMA@198..200 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@200..202 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@202..206 "with" [] [], - }, - colon_token: COLON@206..208 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@208..210 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@210..227 "\"resolution-mode\"" [] [], - }, - colon_token: COLON@227..229 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@229..238 "\"import\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@238..240 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@240..241 "}" [] [], - }, - ], - r_paren_token: R_PAREN@241..242 ")" [] [], - }, - qualifier_clause: missing (optional), - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@242..243 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@243..249 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@249..251 "G" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@251..253 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@253..259 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@259..260 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@260..266 "\"test\"" [] [], - }, - COMMA@266..268 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@268..270 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@270..274 "with" [] [], - }, - colon_token: COLON@274..276 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@276..278 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@278..295 "\"resolution-mode\"" [] [], - }, - colon_token: COLON@295..297 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@297..306 "\"import\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@306..308 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@308..309 "}" [] [], - }, - ], - r_paren_token: R_PAREN@309..310 ")" [] [], - }, - qualifier_clause: TsImportTypeQualifier { - dot_token: DOT@310..311 "." [] [], - right: JsReferenceIdentifier { - value_token: IDENT@311..325 "TypeFromImport" [] [], - }, - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@325..326 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@326..332 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@332..334 "H" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@334..336 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@336..342 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@342..343 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@343..349 "\"test\"" [] [], - }, - COMMA@349..351 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@351..353 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@353..357 "with" [] [], - }, - colon_token: COLON@357..359 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@359..361 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@361..378 "\"resolution-mode\"" [] [], - }, - colon_token: COLON@378..380 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@380..389 "\"import\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@389..391 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@391..392 "}" [] [], - }, - ], - r_paren_token: R_PAREN@392..393 ")" [] [], - }, - qualifier_clause: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@393..394 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@394..400 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@400..401 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@401..402 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@402..408 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@408..410 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@410..412 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@412..418 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@418..419 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@419..425 "\"test\"" [] [], - }, - COMMA@425..427 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@427..429 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@429..433 "with" [] [], - }, - colon_token: COLON@433..435 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@435..437 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@437..454 "\"resolution-mode\"" [] [], - }, - colon_token: COLON@454..456 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@456..466 "\"require\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@466..468 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@468..469 "}" [] [], - }, - ], - r_paren_token: R_PAREN@469..470 ")" [] [], - }, - qualifier_clause: TsImportTypeQualifier { - dot_token: DOT@470..471 "." [] [], - right: JsReferenceIdentifier { - value_token: IDENT@471..472 "C" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@472..473 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@473..479 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@479..480 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@480..481 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@481..487 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@487..489 "J" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@489..491 "=" [] [Whitespace(" ")], - ty: TsImportType { - typeof_token: TYPEOF_KW@491..498 "typeof" [] [Whitespace(" ")], - import_token: IMPORT_KW@498..504 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@504..505 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@505..511 "\"test\"" [] [], - }, - COMMA@511..513 "," [] [Whitespace(" ")], - JsObjectExpression { - l_curly_token: L_CURLY@513..515 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@515..519 "with" [] [], - }, - colon_token: COLON@519..521 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@521..523 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: JS_STRING_LITERAL@523..540 "\"resolution-mode\"" [] [], - }, - colon_token: COLON@540..542 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@542..552 "\"require\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@552..554 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@554..555 "}" [] [], - }, - ], - r_paren_token: R_PAREN@555..556 ")" [] [], - }, - qualifier_clause: TsImportTypeQualifier { - dot_token: DOT@556..557 "." [] [], - right: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@557..558 "a" [] [], - }, - dot_token: DOT@558..559 "." [] [], - right: JsName { - value_token: IDENT@559..560 "b" [] [], - }, - }, - dot_token: DOT@560..561 "." [] [], - right: JsName { - value_token: IDENT@561..562 "c" [] [], - }, - }, - dot_token: DOT@562..563 "." [] [], - right: JsName { - value_token: IDENT@563..564 "d" [] [], - }, - }, - dot_token: DOT@564..565 "." [] [], - right: JsName { - value_token: IDENT@565..566 "e" [] [], - }, - }, - dot_token: DOT@566..567 "." [] [], - right: JsName { - value_token: IDENT@567..568 "f" [] [], - }, - }, - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@568..569 ";" [] [], - }, - ], - eof_token: EOF@569..570 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..570 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..569 - 0: TS_TYPE_ALIAS_DECLARATION@0..31 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@9..30 - 0: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")] - 1: IMPORT_KW@16..22 "import" [] [] - 2: JS_CALL_ARGUMENTS@22..30 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@23..29 - 0: JS_STRING_LITERAL_EXPRESSION@23..29 - 0: JS_STRING_LITERAL@23..29 "\"test\"" [] [] - 2: R_PAREN@29..30 ")" [] [] - 3: (empty) - 4: (empty) - 5: SEMICOLON@30..31 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@31..56 - 0: TYPE_KW@31..37 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@37..39 - 0: IDENT@37..39 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@39..41 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@41..55 - 0: (empty) - 1: IMPORT_KW@41..47 "import" [] [] - 2: JS_CALL_ARGUMENTS@47..55 - 0: L_PAREN@47..48 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@48..54 - 0: JS_STRING_LITERAL_EXPRESSION@48..54 - 0: JS_STRING_LITERAL@48..54 "\"test\"" [] [] - 2: R_PAREN@54..55 ")" [] [] - 3: (empty) - 4: (empty) - 5: SEMICOLON@55..56 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@56..100 - 0: TYPE_KW@56..62 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@62..64 - 0: IDENT@62..64 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@64..66 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@66..99 - 0: TYPEOF_KW@66..73 "typeof" [] [Whitespace(" ")] - 1: IMPORT_KW@73..79 "import" [] [] - 2: JS_CALL_ARGUMENTS@79..87 - 0: L_PAREN@79..80 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@80..86 - 0: JS_STRING_LITERAL_EXPRESSION@80..86 - 0: JS_STRING_LITERAL@80..86 "\"test\"" [] [] - 2: R_PAREN@86..87 ")" [] [] - 3: TS_IMPORT_TYPE_QUALIFIER@87..99 - 0: DOT@87..88 "." [] [] - 1: TS_QUALIFIED_NAME@88..99 - 0: TS_QUALIFIED_NAME@88..97 - 0: TS_QUALIFIED_NAME@88..95 - 0: TS_QUALIFIED_NAME@88..93 - 0: TS_QUALIFIED_NAME@88..91 - 0: JS_REFERENCE_IDENTIFIER@88..89 - 0: IDENT@88..89 "a" [] [] - 1: DOT@89..90 "." [] [] - 2: JS_NAME@90..91 - 0: IDENT@90..91 "b" [] [] - 1: DOT@91..92 "." [] [] - 2: JS_NAME@92..93 - 0: IDENT@92..93 "c" [] [] - 1: DOT@93..94 "." [] [] - 2: JS_NAME@94..95 - 0: IDENT@94..95 "d" [] [] - 1: DOT@95..96 "." [] [] - 2: JS_NAME@96..97 - 0: IDENT@96..97 "e" [] [] - 1: DOT@97..98 "." [] [] - 2: JS_NAME@98..99 - 0: IDENT@98..99 "f" [] [] - 4: (empty) - 5: SEMICOLON@99..100 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@100..133 - 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@106..108 - 0: IDENT@106..108 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@108..110 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@110..132 - 0: (empty) - 1: IMPORT_KW@110..116 "import" [] [] - 2: JS_CALL_ARGUMENTS@116..124 - 0: L_PAREN@116..117 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@117..123 - 0: JS_STRING_LITERAL_EXPRESSION@117..123 - 0: JS_STRING_LITERAL@117..123 "\"test\"" [] [] - 2: R_PAREN@123..124 ")" [] [] - 3: (empty) - 4: TS_TYPE_ARGUMENTS@124..132 - 0: L_ANGLE@124..125 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@125..131 - 0: TS_STRING_TYPE@125..131 - 0: STRING_KW@125..131 "string" [] [] - 2: R_ANGLE@131..132 ">" [] [] - 5: SEMICOLON@132..133 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@133..168 - 0: TYPE_KW@133..139 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@139..141 - 0: IDENT@139..141 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@141..143 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@143..167 - 0: (empty) - 1: IMPORT_KW@143..149 "import" [] [] - 2: JS_CALL_ARGUMENTS@149..157 - 0: L_PAREN@149..150 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@150..156 - 0: JS_STRING_LITERAL_EXPRESSION@150..156 - 0: JS_STRING_LITERAL@150..156 "\"test\"" [] [] - 2: R_PAREN@156..157 ")" [] [] - 3: TS_IMPORT_TYPE_QUALIFIER@157..159 - 0: DOT@157..158 "." [] [] - 1: JS_REFERENCE_IDENTIFIER@158..159 - 0: IDENT@158..159 "C" [] [] - 4: TS_TYPE_ARGUMENTS@159..167 - 0: L_ANGLE@159..160 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@160..166 - 0: TS_STRING_TYPE@160..166 - 0: STRING_KW@160..166 "string" [] [] - 2: R_ANGLE@166..167 ">" [] [] - 5: SEMICOLON@167..168 ";" [] [] - 5: TS_TYPE_ALIAS_DECLARATION@168..243 - 0: TYPE_KW@168..174 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@174..176 - 0: IDENT@174..176 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@176..178 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@178..242 - 0: TYPEOF_KW@178..185 "typeof" [] [Whitespace(" ")] - 1: IMPORT_KW@185..191 "import" [] [] - 2: JS_CALL_ARGUMENTS@191..242 - 0: L_PAREN@191..192 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@192..241 - 0: JS_STRING_LITERAL_EXPRESSION@192..198 - 0: JS_STRING_LITERAL@192..198 "\"test\"" [] [] - 1: COMMA@198..200 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@200..241 - 0: L_CURLY@200..202 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@202..240 - 0: JS_PROPERTY_OBJECT_MEMBER@202..240 - 0: JS_LITERAL_MEMBER_NAME@202..206 - 0: IDENT@202..206 "with" [] [] - 1: COLON@206..208 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@208..240 - 0: L_CURLY@208..210 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@210..238 - 0: JS_PROPERTY_OBJECT_MEMBER@210..238 - 0: JS_LITERAL_MEMBER_NAME@210..227 - 0: JS_STRING_LITERAL@210..227 "\"resolution-mode\"" [] [] - 1: COLON@227..229 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@229..238 - 0: JS_STRING_LITERAL@229..238 "\"import\"" [] [Whitespace(" ")] - 2: R_CURLY@238..240 "}" [] [Whitespace(" ")] - 2: R_CURLY@240..241 "}" [] [] - 2: R_PAREN@241..242 ")" [] [] - 3: (empty) - 4: (empty) - 5: SEMICOLON@242..243 ";" [] [] - 6: TS_TYPE_ALIAS_DECLARATION@243..326 - 0: TYPE_KW@243..249 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@249..251 - 0: IDENT@249..251 "G" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@251..253 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@253..325 - 0: (empty) - 1: IMPORT_KW@253..259 "import" [] [] - 2: JS_CALL_ARGUMENTS@259..310 - 0: L_PAREN@259..260 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@260..309 - 0: JS_STRING_LITERAL_EXPRESSION@260..266 - 0: JS_STRING_LITERAL@260..266 "\"test\"" [] [] - 1: COMMA@266..268 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@268..309 - 0: L_CURLY@268..270 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@270..308 - 0: JS_PROPERTY_OBJECT_MEMBER@270..308 - 0: JS_LITERAL_MEMBER_NAME@270..274 - 0: IDENT@270..274 "with" [] [] - 1: COLON@274..276 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@276..308 - 0: L_CURLY@276..278 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@278..306 - 0: JS_PROPERTY_OBJECT_MEMBER@278..306 - 0: JS_LITERAL_MEMBER_NAME@278..295 - 0: JS_STRING_LITERAL@278..295 "\"resolution-mode\"" [] [] - 1: COLON@295..297 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@297..306 - 0: JS_STRING_LITERAL@297..306 "\"import\"" [] [Whitespace(" ")] - 2: R_CURLY@306..308 "}" [] [Whitespace(" ")] - 2: R_CURLY@308..309 "}" [] [] - 2: R_PAREN@309..310 ")" [] [] - 3: TS_IMPORT_TYPE_QUALIFIER@310..325 - 0: DOT@310..311 "." [] [] - 1: JS_REFERENCE_IDENTIFIER@311..325 - 0: IDENT@311..325 "TypeFromImport" [] [] - 4: (empty) - 5: SEMICOLON@325..326 ";" [] [] - 7: TS_TYPE_ALIAS_DECLARATION@326..402 - 0: TYPE_KW@326..332 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@332..334 - 0: IDENT@332..334 "H" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@334..336 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@336..401 - 0: (empty) - 1: IMPORT_KW@336..342 "import" [] [] - 2: JS_CALL_ARGUMENTS@342..393 - 0: L_PAREN@342..343 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@343..392 - 0: JS_STRING_LITERAL_EXPRESSION@343..349 - 0: JS_STRING_LITERAL@343..349 "\"test\"" [] [] - 1: COMMA@349..351 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@351..392 - 0: L_CURLY@351..353 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@353..391 - 0: JS_PROPERTY_OBJECT_MEMBER@353..391 - 0: JS_LITERAL_MEMBER_NAME@353..357 - 0: IDENT@353..357 "with" [] [] - 1: COLON@357..359 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@359..391 - 0: L_CURLY@359..361 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@361..389 - 0: JS_PROPERTY_OBJECT_MEMBER@361..389 - 0: JS_LITERAL_MEMBER_NAME@361..378 - 0: JS_STRING_LITERAL@361..378 "\"resolution-mode\"" [] [] - 1: COLON@378..380 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@380..389 - 0: JS_STRING_LITERAL@380..389 "\"import\"" [] [Whitespace(" ")] - 2: R_CURLY@389..391 "}" [] [Whitespace(" ")] - 2: R_CURLY@391..392 "}" [] [] - 2: R_PAREN@392..393 ")" [] [] - 3: (empty) - 4: TS_TYPE_ARGUMENTS@393..401 - 0: L_ANGLE@393..394 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@394..400 - 0: TS_STRING_TYPE@394..400 - 0: STRING_KW@394..400 "string" [] [] - 2: R_ANGLE@400..401 ">" [] [] - 5: SEMICOLON@401..402 ";" [] [] - 8: TS_TYPE_ALIAS_DECLARATION@402..481 - 0: TYPE_KW@402..408 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@408..410 - 0: IDENT@408..410 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@410..412 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@412..480 - 0: (empty) - 1: IMPORT_KW@412..418 "import" [] [] - 2: JS_CALL_ARGUMENTS@418..470 - 0: L_PAREN@418..419 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@419..469 - 0: JS_STRING_LITERAL_EXPRESSION@419..425 - 0: JS_STRING_LITERAL@419..425 "\"test\"" [] [] - 1: COMMA@425..427 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@427..469 - 0: L_CURLY@427..429 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@429..468 - 0: JS_PROPERTY_OBJECT_MEMBER@429..468 - 0: JS_LITERAL_MEMBER_NAME@429..433 - 0: IDENT@429..433 "with" [] [] - 1: COLON@433..435 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@435..468 - 0: L_CURLY@435..437 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@437..466 - 0: JS_PROPERTY_OBJECT_MEMBER@437..466 - 0: JS_LITERAL_MEMBER_NAME@437..454 - 0: JS_STRING_LITERAL@437..454 "\"resolution-mode\"" [] [] - 1: COLON@454..456 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@456..466 - 0: JS_STRING_LITERAL@456..466 "\"require\"" [] [Whitespace(" ")] - 2: R_CURLY@466..468 "}" [] [Whitespace(" ")] - 2: R_CURLY@468..469 "}" [] [] - 2: R_PAREN@469..470 ")" [] [] - 3: TS_IMPORT_TYPE_QUALIFIER@470..472 - 0: DOT@470..471 "." [] [] - 1: JS_REFERENCE_IDENTIFIER@471..472 - 0: IDENT@471..472 "C" [] [] - 4: TS_TYPE_ARGUMENTS@472..480 - 0: L_ANGLE@472..473 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@473..479 - 0: TS_STRING_TYPE@473..479 - 0: STRING_KW@473..479 "string" [] [] - 2: R_ANGLE@479..480 ">" [] [] - 5: SEMICOLON@480..481 ";" [] [] - 9: TS_TYPE_ALIAS_DECLARATION@481..569 - 0: TYPE_KW@481..487 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@487..489 - 0: IDENT@487..489 "J" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@489..491 "=" [] [Whitespace(" ")] - 4: TS_IMPORT_TYPE@491..568 - 0: TYPEOF_KW@491..498 "typeof" [] [Whitespace(" ")] - 1: IMPORT_KW@498..504 "import" [] [] - 2: JS_CALL_ARGUMENTS@504..556 - 0: L_PAREN@504..505 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@505..555 - 0: JS_STRING_LITERAL_EXPRESSION@505..511 - 0: JS_STRING_LITERAL@505..511 "\"test\"" [] [] - 1: COMMA@511..513 "," [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@513..555 - 0: L_CURLY@513..515 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@515..554 - 0: JS_PROPERTY_OBJECT_MEMBER@515..554 - 0: JS_LITERAL_MEMBER_NAME@515..519 - 0: IDENT@515..519 "with" [] [] - 1: COLON@519..521 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@521..554 - 0: L_CURLY@521..523 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@523..552 - 0: JS_PROPERTY_OBJECT_MEMBER@523..552 - 0: JS_LITERAL_MEMBER_NAME@523..540 - 0: JS_STRING_LITERAL@523..540 "\"resolution-mode\"" [] [] - 1: COLON@540..542 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@542..552 - 0: JS_STRING_LITERAL@542..552 "\"require\"" [] [Whitespace(" ")] - 2: R_CURLY@552..554 "}" [] [Whitespace(" ")] - 2: R_CURLY@554..555 "}" [] [] - 2: R_PAREN@555..556 ")" [] [] - 3: TS_IMPORT_TYPE_QUALIFIER@556..568 - 0: DOT@556..557 "." [] [] - 1: TS_QUALIFIED_NAME@557..568 - 0: TS_QUALIFIED_NAME@557..566 - 0: TS_QUALIFIED_NAME@557..564 - 0: TS_QUALIFIED_NAME@557..562 - 0: TS_QUALIFIED_NAME@557..560 - 0: JS_REFERENCE_IDENTIFIER@557..558 - 0: IDENT@557..558 "a" [] [] - 1: DOT@558..559 "." [] [] - 2: JS_NAME@559..560 - 0: IDENT@559..560 "b" [] [] - 1: DOT@560..561 "." [] [] - 2: JS_NAME@561..562 - 0: IDENT@561..562 "c" [] [] - 1: DOT@562..563 "." [] [] - 2: JS_NAME@563..564 - 0: IDENT@563..564 "d" [] [] - 1: DOT@564..565 "." [] [] - 2: JS_NAME@565..566 - 0: IDENT@565..566 "e" [] [] - 1: DOT@566..567 "." [] [] - 2: JS_NAME@567..568 - 0: IDENT@567..568 "f" [] [] - 4: (empty) - 5: SEMICOLON@568..569 ";" [] [] - 4: EOF@569..570 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.rast deleted file mode 100644 index 8dba650cfeae..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.rast +++ /dev/null @@ -1,168 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - TsIndexSignatureClassMember { - modifiers: TsIndexSignatureModifierList [], - l_brack_token: L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@15..16 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@16..18 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@18..24 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@24..25 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@25..27 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@27..33 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - ], - r_curly_token: R_CURLY@34..36 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@36..43 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@43..45 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@45..46 "{" [] [], - members: JsClassMemberList [ - TsIndexSignatureClassMember { - modifiers: TsIndexSignatureModifierList [], - l_brack_token: L_BRACK@46..52 "[" [Newline("\n"), Whitespace(" ")] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@52..57 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@57..59 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@59..65 "string" [] [], - }, - }, - }, - r_brack_token: R_BRACK@65..66 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@66..68 ":" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@68..70 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@70..75 "prop" [] [Whitespace(" ")], - }, - optional_token: missing (optional), - type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@75..76 "}" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@76..78 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@78..79 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..79 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..78 - 0: JS_CLASS_DECLARATION@0..36 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..34 - 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@9..34 - 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@9..9 - 1: L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@15..24 - 0: JS_IDENTIFIER_BINDING@15..16 - 0: IDENT@15..16 "a" [] [] - 1: TS_TYPE_ANNOTATION@16..24 - 0: COLON@16..18 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@18..24 - 0: NUMBER_KW@18..24 "number" [] [] - 3: R_BRACK@24..25 "]" [] [] - 4: TS_TYPE_ANNOTATION@25..33 - 0: COLON@25..27 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@27..33 - 0: STRING_KW@27..33 "string" [] [] - 5: SEMICOLON@33..34 ";" [] [] - 9: R_CURLY@34..36 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@36..78 - 0: JS_DECORATOR_LIST@36..36 - 1: (empty) - 2: CLASS_KW@36..43 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@45..46 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@46..76 - 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@46..76 - 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@46..46 - 1: L_BRACK@46..52 "[" [Newline("\n"), Whitespace(" ")] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@52..65 - 0: JS_IDENTIFIER_BINDING@52..57 - 0: IDENT@52..57 "index" [] [] - 1: TS_TYPE_ANNOTATION@57..65 - 0: COLON@57..59 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@59..65 - 0: STRING_KW@59..65 "string" [] [] - 3: R_BRACK@65..66 "]" [] [] - 4: TS_TYPE_ANNOTATION@66..76 - 0: COLON@66..68 ":" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@68..76 - 0: L_CURLY@68..70 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@70..75 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@70..75 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@70..75 - 0: IDENT@70..75 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_CURLY@75..76 "}" [] [] - 5: (empty) - 9: R_CURLY@76..78 "}" [Newline("\n")] [] - 4: EOF@78..79 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast b/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast deleted file mode 100644 index a0e4981ad2b9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast +++ /dev/null @@ -1,164 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - TsIndexSignatureClassMember { - modifiers: TsIndexSignatureModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@9..21 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - l_brack_token: L_BRACK@21..22 "[" [] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@22..23 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@25..31 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@31..32 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@34..40 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@40..41 ";" [] [], - }, - ], - r_curly_token: R_CURLY@41..43 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@50..52 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@52..53 "{" [] [], - members: JsClassMemberList [ - TsIndexSignatureClassMember { - modifiers: TsIndexSignatureModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@53..65 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@65..74 "readonly" [] [Whitespace(" ")], - }, - ], - l_brack_token: L_BRACK@74..75 "[" [] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@75..76 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@76..78 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@78..84 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@84..85 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@85..87 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@87..93 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@93..94 ";" [] [], - }, - ], - r_curly_token: R_CURLY@94..96 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@96..97 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..97 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..96 - 0: JS_CLASS_DECLARATION@0..43 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..41 - 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@9..41 - 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@9..21 - 0: JS_STATIC_MODIFIER@9..21 - 0: STATIC_KW@9..21 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@21..22 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@22..31 - 0: JS_IDENTIFIER_BINDING@22..23 - 0: IDENT@22..23 "a" [] [] - 1: TS_TYPE_ANNOTATION@23..31 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@25..31 - 0: NUMBER_KW@25..31 "number" [] [] - 3: R_BRACK@31..32 "]" [] [] - 4: TS_TYPE_ANNOTATION@32..40 - 0: COLON@32..34 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@34..40 - 0: STRING_KW@34..40 "string" [] [] - 5: SEMICOLON@40..41 ";" [] [] - 9: R_CURLY@41..43 "}" [Newline("\n")] [] - 1: JS_CLASS_DECLARATION@43..96 - 0: JS_DECORATOR_LIST@43..43 - 1: (empty) - 2: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@50..52 - 0: IDENT@50..52 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@52..53 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@53..94 - 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@53..94 - 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@53..74 - 0: JS_STATIC_MODIFIER@53..65 - 0: STATIC_KW@53..65 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@65..74 - 0: READONLY_KW@65..74 "readonly" [] [Whitespace(" ")] - 1: L_BRACK@74..75 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@75..84 - 0: JS_IDENTIFIER_BINDING@75..76 - 0: IDENT@75..76 "a" [] [] - 1: TS_TYPE_ANNOTATION@76..84 - 0: COLON@76..78 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@78..84 - 0: NUMBER_KW@78..84 "number" [] [] - 3: R_BRACK@84..85 "]" [] [] - 4: TS_TYPE_ANNOTATION@85..93 - 0: COLON@85..87 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@87..93 - 0: STRING_KW@87..93 "string" [] [] - 5: SEMICOLON@93..94 ";" [] [] - 9: R_CURLY@94..96 "}" [Newline("\n")] [] - 4: EOF@96..97 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.rast deleted file mode 100644 index 23d0bb2ec5bd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.rast +++ /dev/null @@ -1,216 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@12..13 "{" [] [], - members: TsTypeMemberList [ - TsIndexSignatureTypeMember { - readonly_token: missing (optional), - l_brack_token: L_BRACK@13..19 "[" [Newline("\n"), Whitespace(" ")] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@19..20 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@20..22 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@22..28 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@28..29 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@29..31 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@31..37 "string" [] [], - }, - }, - separator_token: SEMICOLON@37..38 ";" [] [], - }, - ], - r_curly_token: R_CURLY@38..40 "}" [Newline("\n")] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@40..51 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@51..53 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@53..54 "{" [] [], - members: TsTypeMemberList [ - TsIndexSignatureTypeMember { - readonly_token: missing (optional), - l_brack_token: L_BRACK@54..60 "[" [Newline("\n"), Whitespace(" ")] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@60..65 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@65..67 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@67..73 "string" [] [], - }, - }, - }, - r_brack_token: R_BRACK@73..74 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@74..76 ":" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@76..78 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@78..83 "prop" [] [Whitespace(" ")], - }, - optional_token: missing (optional), - type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@83..84 "}" [] [], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@84..86 "}" [Newline("\n")] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@86..97 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@97..99 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@99..100 "{" [] [], - members: TsTypeMemberList [ - TsIndexSignatureTypeMember { - readonly_token: READONLY_KW@100..114 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - l_brack_token: L_BRACK@114..115 "[" [] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@115..116 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@116..118 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@118..124 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@124..125 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@125..127 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@127..133 "string" [] [], - }, - }, - separator_token: SEMICOLON@133..134 ";" [] [], - }, - ], - r_curly_token: R_CURLY@134..136 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@136..137 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..137 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..136 - 0: TS_INTERFACE_DECLARATION@0..40 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@12..13 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@13..38 - 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@13..38 - 0: (empty) - 1: L_BRACK@13..19 "[" [Newline("\n"), Whitespace(" ")] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@19..28 - 0: JS_IDENTIFIER_BINDING@19..20 - 0: IDENT@19..20 "a" [] [] - 1: TS_TYPE_ANNOTATION@20..28 - 0: COLON@20..22 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@22..28 - 0: NUMBER_KW@22..28 "number" [] [] - 3: R_BRACK@28..29 "]" [] [] - 4: TS_TYPE_ANNOTATION@29..37 - 0: COLON@29..31 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@31..37 - 0: STRING_KW@31..37 "string" [] [] - 5: SEMICOLON@37..38 ";" [] [] - 6: R_CURLY@38..40 "}" [Newline("\n")] [] - 1: TS_INTERFACE_DECLARATION@40..86 - 0: INTERFACE_KW@40..51 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@51..53 - 0: IDENT@51..53 "B" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@53..54 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@54..84 - 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@54..84 - 0: (empty) - 1: L_BRACK@54..60 "[" [Newline("\n"), Whitespace(" ")] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@60..73 - 0: JS_IDENTIFIER_BINDING@60..65 - 0: IDENT@60..65 "index" [] [] - 1: TS_TYPE_ANNOTATION@65..73 - 0: COLON@65..67 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@67..73 - 0: STRING_KW@67..73 "string" [] [] - 3: R_BRACK@73..74 "]" [] [] - 4: TS_TYPE_ANNOTATION@74..84 - 0: COLON@74..76 ":" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@76..84 - 0: L_CURLY@76..78 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@78..83 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@78..83 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@78..83 - 0: IDENT@78..83 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_CURLY@83..84 "}" [] [] - 5: (empty) - 6: R_CURLY@84..86 "}" [Newline("\n")] [] - 2: TS_INTERFACE_DECLARATION@86..136 - 0: INTERFACE_KW@86..97 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@97..99 - 0: IDENT@97..99 "C" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@99..100 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@100..134 - 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@100..134 - 0: READONLY_KW@100..114 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_BRACK@114..115 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@115..124 - 0: JS_IDENTIFIER_BINDING@115..116 - 0: IDENT@115..116 "a" [] [] - 1: TS_TYPE_ANNOTATION@116..124 - 0: COLON@116..118 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@118..124 - 0: NUMBER_KW@118..124 "number" [] [] - 3: R_BRACK@124..125 "]" [] [] - 4: TS_TYPE_ANNOTATION@125..133 - 0: COLON@125..127 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@127..133 - 0: STRING_KW@127..133 "string" [] [] - 5: SEMICOLON@133..134 ";" [] [] - 6: R_CURLY@134..136 "}" [Newline("\n")] [] - 4: EOF@136..137 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.rast deleted file mode 100644 index e77db06de4be..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.rast +++ /dev/null @@ -1,265 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsIndexSignatureTypeMember { - readonly_token: missing (optional), - l_brack_token: L_BRACK@11..12 "[" [] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@12..13 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@15..21 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@21..22 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@22..24 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@24..31 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@38..40 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsIndexSignatureTypeMember { - readonly_token: READONLY_KW@44..53 "readonly" [] [Whitespace(" ")], - l_brack_token: L_BRACK@53..54 "[" [] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@54..55 "a" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@55..57 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@57..63 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@63..64 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@64..66 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@66..73 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@73..74 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@74..106 "type" [Newline("\n"), Comments("// not an index signa ..."), Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@106..108 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@108..110 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@110..112 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsComputedMemberName { - l_brack_token: L_BRACK@112..113 "[" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@113..114 "a" [] [], - }, - }, - r_brack_token: R_BRACK@114..115 "]" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@115..117 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@117..124 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@124..125 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@125..131 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@131..133 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@133..135 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@135..137 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: READONLY_KW@137..146 "readonly" [] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@146..147 "[" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@147..148 "a" [] [], - }, - }, - r_brack_token: R_BRACK@148..149 "]" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@149..151 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@151..158 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@158..159 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@159..160 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..160 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..159 - 0: TS_TYPE_ALIAS_DECLARATION@0..32 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..32 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..31 - 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@11..31 - 0: (empty) - 1: L_BRACK@11..12 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@12..21 - 0: JS_IDENTIFIER_BINDING@12..13 - 0: IDENT@12..13 "a" [] [] - 1: TS_TYPE_ANNOTATION@13..21 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@15..21 - 0: NUMBER_KW@15..21 "number" [] [] - 3: R_BRACK@21..22 "]" [] [] - 4: TS_TYPE_ANNOTATION@22..31 - 0: COLON@22..24 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@24..31 - 0: STRING_KW@24..31 "string" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@31..32 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@32..74 - 0: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@38..40 - 0: IDENT@38..40 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@40..42 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@42..74 - 0: L_CURLY@42..44 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@44..73 - 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@44..73 - 0: READONLY_KW@44..53 "readonly" [] [Whitespace(" ")] - 1: L_BRACK@53..54 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@54..63 - 0: JS_IDENTIFIER_BINDING@54..55 - 0: IDENT@54..55 "a" [] [] - 1: TS_TYPE_ANNOTATION@55..63 - 0: COLON@55..57 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@57..63 - 0: NUMBER_KW@57..63 "number" [] [] - 3: R_BRACK@63..64 "]" [] [] - 4: TS_TYPE_ANNOTATION@64..73 - 0: COLON@64..66 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@66..73 - 0: STRING_KW@66..73 "string" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@73..74 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@74..125 - 0: TYPE_KW@74..106 "type" [Newline("\n"), Comments("// not an index signa ..."), Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@106..108 - 0: IDENT@106..108 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@108..110 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@110..125 - 0: L_CURLY@110..112 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@112..124 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@112..124 - 0: (empty) - 1: JS_COMPUTED_MEMBER_NAME@112..115 - 0: L_BRACK@112..113 "[" [] [] - 1: JS_IDENTIFIER_EXPRESSION@113..114 - 0: JS_REFERENCE_IDENTIFIER@113..114 - 0: IDENT@113..114 "a" [] [] - 2: R_BRACK@114..115 "]" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@115..124 - 0: COLON@115..117 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@117..124 - 0: STRING_KW@117..124 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@124..125 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@125..159 - 0: TYPE_KW@125..131 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@131..133 - 0: IDENT@131..133 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@133..135 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@135..159 - 0: L_CURLY@135..137 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@137..158 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@137..158 - 0: READONLY_KW@137..146 "readonly" [] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_NAME@146..149 - 0: L_BRACK@146..147 "[" [] [] - 1: JS_IDENTIFIER_EXPRESSION@147..148 - 0: JS_REFERENCE_IDENTIFIER@147..148 - 0: IDENT@147..148 "a" [] [] - 2: R_BRACK@148..149 "]" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@149..158 - 0: COLON@149..151 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@151..158 - 0: STRING_KW@151..158 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@158..159 "}" [] [] - 5: (empty) - 4: EOF@159..160 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.rast deleted file mode 100644 index 522b0f6c399f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.rast +++ /dev/null @@ -1,112 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsIndexedAccessType { - object_type: TsStringType { - string_token: STRING_KW@9..15 "string" [] [], - }, - l_brack_token: L_BRACK@15..16 "[" [] [], - index_type: TsNumberType { - number_token: NUMBER_KW@16..22 "number" [] [], - }, - r_brack_token: R_BRACK@22..23 "]" [] [], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@30..32 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@32..34 "=" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsIndexedAccessType { - object_type: TsIndexedAccessType { - object_type: TsIndexedAccessType { - object_type: TsStringType { - string_token: STRING_KW@34..40 "string" [] [], - }, - l_brack_token: L_BRACK@40..41 "[" [] [], - index_type: TsNumberType { - number_token: NUMBER_KW@41..47 "number" [] [], - }, - r_brack_token: R_BRACK@47..48 "]" [] [], - }, - l_brack_token: L_BRACK@48..49 "[" [] [], - index_type: TsNumberType { - number_token: NUMBER_KW@49..55 "number" [] [], - }, - r_brack_token: R_BRACK@55..56 "]" [] [], - }, - l_brack_token: L_BRACK@56..57 "[" [] [], - index_type: TsNumberType { - number_token: NUMBER_KW@57..63 "number" [] [], - }, - r_brack_token: R_BRACK@63..64 "]" [] [], - }, - l_brack_token: L_BRACK@64..65 "[" [] [], - r_brack_token: R_BRACK@65..66 "]" [] [], - }, - semicolon_token: SEMICOLON@66..67 ";" [] [], - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: TS_TYPE_ALIAS_DECLARATION@0..24 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_INDEXED_ACCESS_TYPE@9..23 - 0: TS_STRING_TYPE@9..15 - 0: STRING_KW@9..15 "string" [] [] - 1: L_BRACK@15..16 "[" [] [] - 2: TS_NUMBER_TYPE@16..22 - 0: NUMBER_KW@16..22 "number" [] [] - 3: R_BRACK@22..23 "]" [] [] - 5: SEMICOLON@23..24 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@24..67 - 0: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@30..32 - 0: IDENT@30..32 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@32..34 "=" [] [Whitespace(" ")] - 4: TS_ARRAY_TYPE@34..66 - 0: TS_INDEXED_ACCESS_TYPE@34..64 - 0: TS_INDEXED_ACCESS_TYPE@34..56 - 0: TS_INDEXED_ACCESS_TYPE@34..48 - 0: TS_STRING_TYPE@34..40 - 0: STRING_KW@34..40 "string" [] [] - 1: L_BRACK@40..41 "[" [] [] - 2: TS_NUMBER_TYPE@41..47 - 0: NUMBER_KW@41..47 "number" [] [] - 3: R_BRACK@47..48 "]" [] [] - 1: L_BRACK@48..49 "[" [] [] - 2: TS_NUMBER_TYPE@49..55 - 0: NUMBER_KW@49..55 "number" [] [] - 3: R_BRACK@55..56 "]" [] [] - 1: L_BRACK@56..57 "[" [] [] - 2: TS_NUMBER_TYPE@57..63 - 0: NUMBER_KW@57..63 "number" [] [] - 3: R_BRACK@63..64 "]" [] [] - 1: L_BRACK@64..65 "[" [] [] - 2: R_BRACK@65..66 "]" [] [] - 5: SEMICOLON@66..67 ";" [] [] - 4: EOF@67..68 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast b/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast deleted file mode 100644 index 5511ba943583..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast +++ /dev/null @@ -1,5227 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..9 "Args" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@9..10 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@10..11 "F" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@11..13 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@13..15 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@15..17 "F" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@17..25 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@25..26 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@26..29 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@29..33 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@33..35 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@35..41 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@41..42 "A" [] [], - }, - constraint: missing (optional), - }, - }, - }, - ], - r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@47..52 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@52..54 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@54..56 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@56..58 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@58..63 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@70..72 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@72..74 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@74..76 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@76..84 "extends" [] [Whitespace(" ")], - extends_type: TsImportType { - typeof_token: missing (optional), - import_token: IMPORT_KW@84..90 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@90..91 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@91..97 "\"test\"" [] [], - }, - ], - r_paren_token: R_PAREN@97..98 ")" [] [], - }, - qualifier_clause: TsImportTypeQualifier { - dot_token: DOT@98..99 "." [] [], - right: JsReferenceIdentifier { - value_token: IDENT@99..100 "C" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@100..101 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsInferType { - infer_token: INFER_KW@101..107 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@107..108 "P" [] [], - }, - constraint: missing (optional), - }, - ], - r_angle_token: R_ANGLE@108..110 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@110..112 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@112..114 "P" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@114..116 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@116..121 "never" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@121..127 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@127..129 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@129..131 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@131..133 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@133..141 "extends" [] [Whitespace(" ")], - extends_type: TsTypeofType { - typeof_token: TYPEOF_KW@141..148 "typeof" [] [Whitespace(" ")], - expression_name: JsReferenceIdentifier { - value_token: IDENT@148..153 "Array" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@153..154 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsInferType { - infer_token: INFER_KW@154..160 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@160..161 "P" [] [], - }, - constraint: missing (optional), - }, - ], - r_angle_token: R_ANGLE@161..163 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@163..165 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@165..167 "P" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@167..169 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@169..174 "never" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@174..180 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@180..182 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@182..184 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@184..186 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@186..194 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@194..196 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@196..199 "set" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@199..200 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@200..201 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@201..203 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@203..209 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@209..210 "P" [] [], - }, - constraint: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@210..211 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@211..213 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@213..220 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@220..222 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@222..224 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@224..226 "P" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@226..228 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@228..233 "never" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@233..239 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@239..241 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@241..243 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@243..245 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@245..253 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@253..255 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@255..258 "get" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@258..259 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@259..260 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@260..262 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@262..268 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@268..270 "P" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@270..272 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@272..274 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@274..276 "P" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@276..278 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@278..283 "never" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@283..289 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@289..291 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@291..293 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@293..295 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@295..303 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@303..305 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@305..311 "method" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@311..312 "(" [] [], - items: JsParameterList [ - TsThisParameter { - this_token: THIS_KW@312..316 "this" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@316..318 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@318..324 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@324..325 "P" [] [], - }, - constraint: missing (optional), - }, - }, - }, - ], - r_paren_token: R_PAREN@325..326 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@326..328 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@328..335 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@335..337 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@337..339 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@339..341 "P" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@341..343 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@343..348 "never" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@348..354 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@354..360 "valid9" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@360..361 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@361..362 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@362..364 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@364..366 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@366..368 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@376..381 "Array" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@381..382 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsInferType { - infer_token: INFER_KW@382..388 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@388..389 "R" [] [], - }, - constraint: missing (optional), - }, - ], - r_angle_token: R_ANGLE@389..391 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@391..393 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@393..395 "R" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@395..397 ":" [] [Whitespace(" ")], - false_type: TsAnyType { - any_token: ANY_KW@397..400 "any" [] [], - }, - }, - semicolon_token: SEMICOLON@400..401 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@401..407 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@407..429 "ContentBetweenBrackets" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@429..430 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@430..431 "S" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@431..433 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@433..435 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@435..437 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@437..445 "extends" [] [Whitespace(" ")], - extends_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@445..446 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@446..447 "[" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@447..449 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@449..455 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@455..456 "T" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@456..457 "}" [] [], - }, - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@457..458 "]" [] [], - }, - ], - r_tick_token: BACKTICK@458..460 "`" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@460..462 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@462..464 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@464..466 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@466..471 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@471..472 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@472..478 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@478..491 "WithSelectors" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@491..492 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@492..493 "S" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@493..495 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@495..497 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@497..499 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@499..507 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@507..509 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@509..517 "getState" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@517..519 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@519..520 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@520..522 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")], - return_type: TsInferType { - infer_token: INFER_KW@525..531 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@531..533 "T" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@533..534 "}" [] [], - }, - question_mark_token: QUESTION@534..541 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - true_type: TsIntersectionType { - leading_separator_token: missing (optional), - types: TsIntersectionTypeElementList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@541..543 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - AMP@543..545 "&" [] [Whitespace(" ")], - TsObjectType { - l_curly_token: L_CURLY@545..547 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@547..550 "use" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@550..552 ":" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@552..554 "{" [] [Whitespace(" ")], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@554..555 "[" [] [], - property_name: TsTypeParameterName { - ident_token: IDENT@555..557 "K" [] [Whitespace(" ")], - }, - in_token: IN_KW@557..560 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@560..566 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@566..567 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@567..568 "]" [] [], - optional_modifier: missing (optional), - mapped_type: TsTypeAnnotation { - colon_token: COLON@568..570 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@570..571 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@571..573 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@573..576 "=>" [] [Whitespace(" ")], - return_type: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@576..577 "T" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@577..578 "[" [] [], - index_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@578..579 "K" [] [], - }, - type_arguments: missing (optional), - }, - r_brack_token: R_BRACK@579..581 "]" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - r_curly_token: R_CURLY@581..583 "}" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@583..584 "}" [] [], - }, - ], - }, - colon_token: COLON@584..591 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@591..596 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@596..597 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@597..603 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@603..605 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@605..607 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@607..614 "MyType" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@614..622 "extends" [] [Whitespace(" ")], - extends_type: TsParenthesizedType { - l_paren_token: L_PAREN@622..623 "(" [] [], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@623..633 "OtherType" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@633..641 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@641..647 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@647..649 "T" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@649..651 "?" [] [Whitespace(" ")], - true_type: TsInferType { - infer_token: INFER_KW@651..657 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@657..659 "U" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - colon_token: COLON@659..661 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@661..671 "InnerFalse" [] [], - }, - type_arguments: missing (optional), - }, - }, - r_paren_token: R_PAREN@671..673 ")" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@673..675 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@675..685 "OuterTrue" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@685..687 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@687..697 "OuterFalse" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@697..703 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@703..707 "Join" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@707..708 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@708..710 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@710..718 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsUnknownType { - unknown_token: UNKNOWN_KW@718..725 "unknown" [] [], - }, - l_brack_token: L_BRACK@725..726 "[" [] [], - r_brack_token: R_BRACK@726..727 "]" [] [], - }, - }, - default: missing (optional), - }, - COMMA@727..729 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@729..731 "D" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@731..739 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@739..745 "string" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@745..747 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@747..748 "=" [] [], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@748..756 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@756..764 "extends" [] [Whitespace(" ")], - extends_type: TsTupleType { - l_brack_token: L_BRACK@764..765 "[" [] [], - elements: TsTupleTypeElementList [], - r_brack_token: R_BRACK@765..767 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@767..769 "?" [] [Whitespace(" ")], - true_type: TsStringLiteralType { - literal_token: JS_STRING_LITERAL@769..772 "''" [] [Whitespace(" ")], - }, - colon_token: COLON@772..773 ":" [] [], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@773..781 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@781..789 "extends" [] [Whitespace(" ")], - extends_type: TsTupleType { - l_brack_token: L_BRACK@789..790 "[" [] [], - elements: TsTupleTypeElementList [ - TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@790..797 "string" [] [Whitespace(" ")], - }, - PIPE@797..799 "|" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@799..806 "number" [] [Whitespace(" ")], - }, - PIPE@806..808 "|" [] [Whitespace(" ")], - TsBooleanType { - boolean_token: BOOLEAN_KW@808..816 "boolean" [] [Whitespace(" ")], - }, - PIPE@816..818 "|" [] [Whitespace(" ")], - TsBigintType { - bigint_token: BIGINT_KW@818..824 "bigint" [] [], - }, - ], - }, - ], - r_brack_token: R_BRACK@824..826 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@826..828 "?" [] [Whitespace(" ")], - true_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@828..829 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@829..831 "${" [] [], - ty: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@831..832 "T" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@832..833 "[" [] [], - index_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@833..834 "0" [] [], - }, - r_brack_token: R_BRACK@834..835 "]" [] [], - }, - r_curly_token: R_CURLY@835..836 "}" [] [], - }, - ], - r_tick_token: BACKTICK@836..838 "`" [] [Whitespace(" ")], - }, - colon_token: COLON@838..839 ":" [] [], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@839..847 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@847..855 "extends" [] [Whitespace(" ")], - extends_type: TsTupleType { - l_brack_token: L_BRACK@855..856 "[" [] [], - elements: TsTupleTypeElementList [ - TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@856..863 "string" [] [Whitespace(" ")], - }, - PIPE@863..865 "|" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@865..872 "number" [] [Whitespace(" ")], - }, - PIPE@872..874 "|" [] [Whitespace(" ")], - TsBooleanType { - boolean_token: BOOLEAN_KW@874..882 "boolean" [] [Whitespace(" ")], - }, - PIPE@882..884 "|" [] [Whitespace(" ")], - TsBigintType { - bigint_token: BIGINT_KW@884..890 "bigint" [] [], - }, - ], - }, - COMMA@890..892 "," [] [Whitespace(" ")], - TsRestTupleTypeElement { - dotdotdot_token: DOT3@892..895 "..." [] [], - ty: TsInferType { - infer_token: INFER_KW@895..901 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@901..902 "U" [] [], - }, - constraint: missing (optional), - }, - }, - ], - r_brack_token: R_BRACK@902..904 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@904..906 "?" [] [Whitespace(" ")], - true_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@906..907 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@907..909 "${" [] [], - ty: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@909..910 "T" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@910..911 "[" [] [], - index_type: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@911..912 "0" [] [], - }, - r_brack_token: R_BRACK@912..913 "]" [] [], - }, - r_curly_token: R_CURLY@913..914 "}" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@914..916 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@916..917 "D" [] [], - }, - type_arguments: missing (optional), - }, - r_curly_token: R_CURLY@917..918 "}" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@918..920 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@920..924 "Join" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@924..925 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@925..926 "U" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@926..928 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@928..929 "D" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@929..930 ">" [] [], - }, - }, - r_curly_token: R_CURLY@930..931 "}" [] [], - }, - ], - r_tick_token: BACKTICK@931..933 "`" [] [Whitespace(" ")], - }, - colon_token: COLON@933..934 ":" [] [], - false_type: TsStringType { - string_token: STRING_KW@934..946 "string" [Newline("\n"), Whitespace(" ")] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@946..947 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@947..953 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@953..962 "MatchPair" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@962..963 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@963..965 "S" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@965..973 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@973..979 "string" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@979..981 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@981..983 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@983..985 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@985..993 "extends" [] [Whitespace(" ")], - extends_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@993..994 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@994..995 "[" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@995..997 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@997..1003 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1003..1004 "A" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1004..1005 "}" [] [], - }, - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@1005..1006 "," [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1006..1008 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@1008..1014 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1014..1015 "B" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1015..1016 "}" [] [], - }, - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@1016..1017 "]" [] [], - }, - ], - r_tick_token: BACKTICK@1017..1019 "`" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1019..1021 "?" [] [Whitespace(" ")], - true_type: TsTupleType { - l_brack_token: L_BRACK@1021..1022 "[" [] [], - elements: TsTupleTypeElementList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1022..1023 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1023..1025 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1025..1026 "B" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_brack_token: R_BRACK@1026..1028 "]" [] [Whitespace(" ")], - }, - colon_token: COLON@1028..1030 ":" [] [Whitespace(" ")], - false_type: TsUnknownType { - unknown_token: UNKNOWN_KW@1030..1037 "unknown" [] [], - }, - }, - semicolon_token: SEMICOLON@1037..1038 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1038..1044 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1044..1059 "FirstTwoAndRest" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1059..1060 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1060..1062 "S" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1062..1070 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@1070..1076 "string" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1076..1078 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1078..1080 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1080..1082 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1082..1090 "extends" [] [Whitespace(" ")], - extends_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@1090..1091 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1091..1093 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@1093..1099 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1099..1100 "A" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1100..1101 "}" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1101..1103 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@1103..1109 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1109..1110 "B" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1110..1111 "}" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1111..1113 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1119..1120 "R" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1120..1121 "}" [] [], - }, - ], - r_tick_token: BACKTICK@1121..1123 "`" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1123..1125 "?" [] [Whitespace(" ")], - true_type: TsTupleType { - l_brack_token: L_BRACK@1125..1126 "[" [] [], - elements: TsTupleTypeElementList [ - TsTemplateLiteralType { - l_tick_token: BACKTICK@1126..1127 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1127..1129 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1129..1130 "A" [] [], - }, - type_arguments: missing (optional), - }, - r_curly_token: R_CURLY@1130..1131 "}" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1131..1133 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1133..1134 "B" [] [], - }, - type_arguments: missing (optional), - }, - r_curly_token: R_CURLY@1134..1135 "}" [] [], - }, - ], - r_tick_token: BACKTICK@1135..1136 "`" [] [], - }, - COMMA@1136..1138 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1138..1139 "R" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_brack_token: R_BRACK@1139..1141 "]" [] [Whitespace(" ")], - }, - colon_token: COLON@1141..1143 ":" [] [Whitespace(" ")], - false_type: TsUnknownType { - unknown_token: UNKNOWN_KW@1143..1150 "unknown" [] [], - }, - }, - semicolon_token: SEMICOLON@1150..1151 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1151..1157 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1157..1161 "Trim" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1161..1162 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1162..1164 "S" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1164..1172 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@1172..1178 "string" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1178..1180 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1180..1181 "=" [] [], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1181..1189 "S" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1189..1197 "extends" [] [Whitespace(" ")], - extends_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@1197..1198 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1198..1200 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@1200..1206 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1206..1207 "T" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1207..1208 "}" [] [], - }, - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@1208..1209 " " [] [], - }, - ], - r_tick_token: BACKTICK@1209..1211 "`" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1211..1213 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1213..1217 "Trim" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1217..1218 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1218..1219 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1219..1221 ">" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@1221..1222 ":" [] [], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1222..1229 "S" [Newline("\n"), Whitespace(" ")] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@1229..1230 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1230..1236 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1236..1239 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1239..1240 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1240..1241 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1241..1243 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1243..1245 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1245..1247 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1247..1255 "extends" [] [Whitespace(" ")], - extends_type: TsTemplateLiteralType { - l_tick_token: BACKTICK@1255..1256 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@1256..1257 "*" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@1257..1259 "${" [] [], - ty: TsInferType { - infer_token: INFER_KW@1259..1265 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1265..1266 "S" [] [], - }, - constraint: missing (optional), - }, - r_curly_token: R_CURLY@1266..1267 "}" [] [], - }, - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@1267..1268 "*" [] [], - }, - ], - r_tick_token: BACKTICK@1268..1270 "`" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1270..1272 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1272..1274 "S" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1274..1276 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@1276..1281 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@1281..1282 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1282..1288 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1288..1296 "Unpacked" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1296..1297 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1297..1298 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1298..1300 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1300..1302 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1302..1304 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1304..1312 "extends" [] [Whitespace(" ")], - extends_type: TsArrayType { - element_type: TsParenthesizedType { - l_paren_token: L_PAREN@1312..1313 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@1313..1319 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1319..1320 "U" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@1320..1321 ")" [] [], - }, - l_brack_token: L_BRACK@1321..1322 "[" [] [], - r_brack_token: R_BRACK@1322..1324 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1324..1326 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1326..1328 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1328..1329 ":" [] [], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1329..1336 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1336..1344 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@1344..1345 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@1345..1348 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@1348..1352 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@1352..1354 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@1354..1357 "any" [] [], - }, - l_brack_token: L_BRACK@1357..1358 "[" [] [], - r_brack_token: R_BRACK@1358..1359 "]" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@1359..1361 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@1361..1364 "=>" [] [Whitespace(" ")], - return_type: TsInferType { - infer_token: INFER_KW@1364..1370 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1370..1372 "U" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - }, - question_mark_token: QUESTION@1372..1374 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1374..1376 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1376..1377 ":" [] [], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1377..1384 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1384..1392 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1392..1399 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1399..1400 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsInferType { - infer_token: INFER_KW@1400..1406 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1406..1407 "U" [] [], - }, - constraint: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1407..1409 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@1409..1411 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1411..1413 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1413..1414 ":" [] [], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1414..1420 "T" [Newline("\n"), Whitespace(" ")] [], - }, - type_arguments: missing (optional), - }, - }, - }, - }, - semicolon_token: SEMICOLON@1420..1421 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1421..1427 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1427..1439 "ArgumentType" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1439..1440 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1440..1442 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1442..1450 "extends" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@1450..1451 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1451..1452 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1452..1454 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@1454..1457 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@1457..1459 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@1459..1462 "=>" [] [Whitespace(" ")], - return_type: TsAnyType { - any_token: ANY_KW@1462..1465 "any" [] [], - }, - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1465..1467 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1467..1469 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1469..1471 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1471..1479 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@1479..1480 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1480..1481 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1481..1483 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@1483..1489 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1489..1490 "A" [] [], - }, - constraint: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@1490..1492 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@1492..1495 "=>" [] [Whitespace(" ")], - return_type: TsAnyType { - any_token: ANY_KW@1495..1499 "any" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@1499..1501 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1501..1503 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1503..1505 ":" [] [Whitespace(" ")], - false_type: TsAnyType { - any_token: ANY_KW@1505..1508 "any" [] [], - }, - }, - semicolon_token: SEMICOLON@1508..1509 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1509..1515 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1515..1517 "X3" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1517..1518 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1518..1519 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1519..1521 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1521..1523 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1523..1525 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1525..1533 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@1533..1535 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1535..1536 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1536..1538 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@1538..1539 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1539..1540 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1540..1542 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@1542..1548 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1548..1549 "U" [] [], - }, - constraint: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@1549..1551 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@1551..1554 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@1554..1558 "void" [] [], - }, - }, - }, - separator_token: COMMA@1558..1560 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1560..1561 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1561..1563 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@1563..1564 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1564..1565 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1565..1567 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@1567..1573 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1573..1574 "U" [] [], - }, - constraint: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@1574..1576 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@1576..1579 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@1579..1584 "void" [] [Whitespace(" ")], - }, - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@1584..1586 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1586..1588 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1588..1590 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1590..1592 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@1592..1597 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@1597..1598 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1598..1604 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1604..1606 "X1" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1606..1607 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1607..1609 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1609..1617 "extends" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@1617..1619 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1619..1620 "x" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1620..1622 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@1622..1625 "any" [] [], - }, - }, - separator_token: COMMA@1625..1627 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1627..1628 "y" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1628..1630 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@1630..1634 "any" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@1634..1635 "}" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1635..1637 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1637..1639 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1639..1641 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1641..1649 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@1649..1651 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1651..1652 "x" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1652..1654 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@1654..1660 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1660..1661 "X" [] [], - }, - constraint: missing (optional), - }, - }, - separator_token: COMMA@1661..1663 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1663..1664 "y" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1664..1666 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@1666..1672 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1672..1674 "Y" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@1674..1676 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1676..1678 "?" [] [Whitespace(" ")], - true_type: TsTupleType { - l_brack_token: L_BRACK@1678..1679 "[" [] [], - elements: TsTupleTypeElementList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1679..1680 "X" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1680..1682 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1682..1683 "Y" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_brack_token: R_BRACK@1683..1685 "]" [] [Whitespace(" ")], - }, - colon_token: COLON@1685..1687 ":" [] [Whitespace(" ")], - false_type: TsAnyType { - any_token: ANY_KW@1687..1690 "any" [] [], - }, - }, - semicolon_token: SEMICOLON@1690..1691 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1691..1697 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1697..1700 "T62" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1700..1701 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1701..1702 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1702..1704 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1704..1706 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1706..1708 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1708..1716 "extends" [] [Whitespace(" ")], - extends_type: TsArrayType { - element_type: TsParenthesizedType { - l_paren_token: L_PAREN@1716..1717 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@1717..1723 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1723..1724 "U" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@1724..1725 ")" [] [], - }, - l_brack_token: L_BRACK@1725..1726 "[" [] [], - r_brack_token: R_BRACK@1726..1728 "]" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1728..1730 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1730..1732 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1732..1734 ":" [] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1734..1735 "U" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@1735..1736 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1736..1742 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1742..1745 "T63" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1745..1746 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1746..1747 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1747..1749 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1749..1751 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1751..1753 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1753..1761 "extends" [] [Whitespace(" ")], - extends_type: TsParenthesizedType { - l_paren_token: L_PAREN@1761..1762 "(" [] [], - ty: TsConditionalType { - check_type: TsParenthesizedType { - l_paren_token: L_PAREN@1762..1763 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@1763..1769 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1769..1770 "A" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@1770..1772 ")" [] [Whitespace(" ")], - }, - extends_token: EXTENDS_KW@1772..1780 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@1780..1786 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1786..1788 "B" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@1788..1790 "?" [] [Whitespace(" ")], - true_type: TsInferType { - infer_token: INFER_KW@1790..1796 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1796..1798 "C" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - colon_token: COLON@1798..1800 ":" [] [Whitespace(" ")], - false_type: TsInferType { - infer_token: INFER_KW@1800..1806 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1806..1807 "D" [] [], - }, - constraint: missing (optional), - }, - }, - r_paren_token: R_PAREN@1807..1809 ")" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@1809..1811 "?" [] [Whitespace(" ")], - true_type: TsStringType { - string_token: STRING_KW@1811..1818 "string" [] [Whitespace(" ")], - }, - colon_token: COLON@1818..1820 ":" [] [Whitespace(" ")], - false_type: TsNumberType { - number_token: NUMBER_KW@1820..1826 "number" [] [], - }, - }, - semicolon_token: SEMICOLON@1826..1827 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1827..1833 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1833..1836 "T75" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1836..1837 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1837..1838 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1838..1840 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1840..1842 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1842..1844 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1844..1852 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1852..1855 "T74" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1855..1856 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsInferType { - infer_token: INFER_KW@1856..1862 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1862..1863 "U" [] [], - }, - constraint: missing (optional), - }, - COMMA@1863..1865 "," [] [Whitespace(" ")], - TsInferType { - infer_token: INFER_KW@1865..1871 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@1871..1872 "U" [] [], - }, - constraint: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1872..1874 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@1874..1876 "?" [] [Whitespace(" ")], - true_type: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1876..1879 "T70" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1879..1880 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1880..1881 "U" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1881..1883 ">" [] [Whitespace(" ")], - }, - }, - PIPE@1883..1885 "|" [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1885..1888 "T72" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1888..1889 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1889..1890 "U" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1890..1892 ">" [] [Whitespace(" ")], - }, - }, - PIPE@1892..1894 "|" [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1894..1897 "T74" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1897..1898 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1898..1899 "U" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@1899..1901 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1901..1902 "U" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1902..1904 ">" [] [Whitespace(" ")], - }, - }, - ], - }, - colon_token: COLON@1904..1906 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@1906..1911 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@1911..1912 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@1912..1918 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@1918..1927 "Jsonified" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1927..1928 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1928..1929 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1929..1931 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@1931..1933 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1933..1935 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1935..1943 "extends" [] [Whitespace(" ")], - extends_type: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@1943..1950 "string" [] [Whitespace(" ")], - }, - PIPE@1950..1952 "|" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@1952..1959 "number" [] [Whitespace(" ")], - }, - PIPE@1959..1961 "|" [] [Whitespace(" ")], - TsBooleanType { - boolean_token: BOOLEAN_KW@1961..1969 "boolean" [] [Whitespace(" ")], - }, - PIPE@1969..1971 "|" [] [Whitespace(" ")], - TsNullLiteralType { - literal_token: NULL_KW@1971..1976 "null" [] [Whitespace(" ")], - }, - ], - }, - question_mark_token: QUESTION@1976..1978 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1978..1979 "T" [] [], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@1979..1986 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1986..1988 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@1988..1996 "extends" [] [Whitespace(" ")], - extends_type: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsUndefinedType { - undefined_token: UNDEFINED_KW@1996..2006 "undefined" [] [Whitespace(" ")], - }, - PIPE@2006..2008 "|" [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2008..2017 "Function" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - question_mark_token: QUESTION@2017..2019 "?" [] [Whitespace(" ")], - true_type: TsNeverType { - never_token: NEVER_KW@2019..2024 "never" [] [], - }, - colon_token: COLON@2024..2031 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2031..2033 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2033..2041 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@2041..2043 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@2043..2049 "toJSON" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2049..2050 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@2050..2051 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@2051..2053 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@2053..2059 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2059..2061 "R" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@2061..2063 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@2063..2065 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2065..2066 "R" [] [], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2066..2073 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2073..2075 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2075..2083 "extends" [] [Whitespace(" ")], - extends_type: TsNonPrimitiveType { - object_token: OBJECT_KW@2083..2090 "object" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@2090..2092 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2092..2107 "JsonifiedObject" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@2107..2108 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2108..2109 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@2109..2110 ">" [] [], - }, - }, - colon_token: COLON@2110..2113 ":" [Newline("\n")] [Whitespace(" ")], - false_type: TsStringLiteralType { - literal_token: JS_STRING_LITERAL@2113..2127 "\"what is this\"" [] [], - }, - }, - }, - }, - }, - semicolon_token: SEMICOLON@2127..2128 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2128..2134 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2134..2137 "T1" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@2137..2139 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2139..2142 "F1" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2142..2150 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2150..2151 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@2151..2154 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@2154..2158 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@2158..2160 ":" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2160..2161 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2161..2167 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2167..2168 "T" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2168..2169 ")" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@2169..2171 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2171..2174 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@2174..2179 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2179..2181 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2181..2183 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2183..2185 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@2185..2190 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@2190..2191 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2191..2197 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2197..2200 "T2" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@2200..2202 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2202..2205 "F1" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2205..2213 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2213..2214 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@2214..2218 "args" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@2218..2220 ":" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@2220..2221 "[" [] [], - elements: TsTupleTypeElementList [ - TsRestTupleTypeElement { - dotdotdot_token: DOT3@2221..2224 "..." [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2224..2225 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2225..2231 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2231..2232 "T" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2232..2233 ")" [] [], - }, - }, - ], - r_brack_token: R_BRACK@2233..2234 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@2234..2236 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2236..2239 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@2239..2244 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2244..2246 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2246..2248 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2248..2250 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@2250..2255 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@2255..2256 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2256..2262 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2262..2264 "T3" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@2264..2265 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@2265..2266 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@2266..2268 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@2268..2270 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2270..2272 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2272..2280 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2280..2288 "IsNumber" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@2288..2289 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsParenthesizedType { - l_paren_token: L_PAREN@2289..2290 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2290..2296 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2296..2297 "N" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2297..2298 ")" [] [], - }, - ], - r_angle_token: R_ANGLE@2298..2300 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2300..2302 "?" [] [Whitespace(" ")], - true_type: TsBooleanLiteralType { - literal: TRUE_KW@2302..2307 "true" [] [Whitespace(" ")], - }, - colon_token: COLON@2307..2309 ":" [] [Whitespace(" ")], - false_type: TsBooleanLiteralType { - literal: FALSE_KW@2309..2314 "false" [] [], - }, - }, - semicolon_token: SEMICOLON@2314..2315 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2315..2321 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2321..2324 "T4" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@2324..2326 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2326..2329 "F1" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2329..2337 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2337..2338 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@2338..2341 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@2341..2345 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@2345..2347 ":" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2347..2348 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2348..2349 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2349..2355 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2355..2356 "T" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2356..2357 ")" [] [], - }, - r_paren_token: R_PAREN@2357..2358 ")" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@2358..2360 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2360..2363 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@2363..2368 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2368..2370 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2370..2372 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2372..2374 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@2374..2379 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@2379..2380 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2380..2386 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2386..2389 "T5" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@2389..2391 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2391..2394 "F1" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2394..2402 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2402..2403 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@2403..2407 "args" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@2407..2409 ":" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@2409..2410 "[" [] [], - elements: TsTupleTypeElementList [ - TsRestTupleTypeElement { - dotdotdot_token: DOT3@2410..2413 "..." [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2413..2414 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2414..2415 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2415..2421 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2421..2422 "T" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2422..2423 ")" [] [], - }, - r_paren_token: R_PAREN@2423..2424 ")" [] [], - }, - }, - ], - r_brack_token: R_BRACK@2424..2425 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@2425..2427 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2427..2430 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@2430..2435 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2435..2437 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2437..2439 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2439..2441 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@2441..2446 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@2446..2447 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2447..2453 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2453..2455 "T6" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@2455..2456 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@2456..2457 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@2457..2459 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@2459..2461 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2461..2463 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2463..2471 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2471..2479 "IsNumber" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@2479..2480 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsParenthesizedType { - l_paren_token: L_PAREN@2480..2481 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2481..2482 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2482..2488 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2488..2489 "N" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2489..2490 ")" [] [], - }, - r_paren_token: R_PAREN@2490..2491 ")" [] [], - }, - ], - r_angle_token: R_ANGLE@2491..2493 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2493..2495 "?" [] [Whitespace(" ")], - true_type: TsBooleanLiteralType { - literal: TRUE_KW@2495..2500 "true" [] [Whitespace(" ")], - }, - colon_token: COLON@2500..2502 ":" [] [Whitespace(" ")], - false_type: TsBooleanLiteralType { - literal: FALSE_KW@2502..2507 "false" [] [], - }, - }, - semicolon_token: SEMICOLON@2507..2508 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2508..2514 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2514..2517 "T7" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@2517..2519 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2519..2522 "F1" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2522..2530 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2530..2531 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@2531..2534 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@2534..2538 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@2538..2540 ":" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2540..2541 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2541..2542 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2542..2543 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2543..2544 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2544..2550 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2550..2551 "T" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2551..2552 ")" [] [], - }, - r_paren_token: R_PAREN@2552..2553 ")" [] [], - }, - r_paren_token: R_PAREN@2553..2554 ")" [] [], - }, - r_paren_token: R_PAREN@2554..2555 ")" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@2555..2557 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2557..2560 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@2560..2565 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2565..2567 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2567..2569 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2569..2571 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@2571..2576 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@2576..2577 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2577..2583 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2583..2586 "T8" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@2586..2588 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2588..2591 "F1" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2591..2599 "extends" [] [Whitespace(" ")], - extends_type: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2599..2600 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@2600..2604 "args" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@2604..2606 ":" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@2606..2607 "[" [] [], - elements: TsTupleTypeElementList [ - TsRestTupleTypeElement { - dotdotdot_token: DOT3@2607..2610 "..." [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2610..2611 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2611..2612 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2612..2613 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2613..2614 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2614..2620 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2620..2621 "T" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2621..2622 ")" [] [], - }, - r_paren_token: R_PAREN@2622..2623 ")" [] [], - }, - r_paren_token: R_PAREN@2623..2624 ")" [] [], - }, - r_paren_token: R_PAREN@2624..2625 ")" [] [], - }, - }, - ], - r_brack_token: R_BRACK@2625..2626 "]" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@2626..2628 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2628..2631 "=>" [] [Whitespace(" ")], - return_type: TsVoidType { - void_token: VOID_KW@2631..2636 "void" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2636..2638 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2638..2640 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2640..2642 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@2642..2647 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@2647..2648 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2648..2654 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2654..2656 "T9" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@2656..2657 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@2657..2658 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@2658..2660 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@2660..2662 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2662..2664 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@2664..2672 "extends" [] [Whitespace(" ")], - extends_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2672..2680 "IsNumber" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@2680..2681 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsParenthesizedType { - l_paren_token: L_PAREN@2681..2682 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2682..2683 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2683..2684 "(" [] [], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@2684..2685 "(" [] [], - ty: TsInferType { - infer_token: INFER_KW@2685..2691 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2691..2692 "N" [] [], - }, - constraint: missing (optional), - }, - r_paren_token: R_PAREN@2692..2693 ")" [] [], - }, - r_paren_token: R_PAREN@2693..2694 ")" [] [], - }, - r_paren_token: R_PAREN@2694..2695 ")" [] [], - }, - r_paren_token: R_PAREN@2695..2696 ")" [] [], - }, - ], - r_angle_token: R_ANGLE@2696..2698 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@2698..2700 "?" [] [Whitespace(" ")], - true_type: TsBooleanLiteralType { - literal: TRUE_KW@2700..2705 "true" [] [Whitespace(" ")], - }, - colon_token: COLON@2705..2707 ":" [] [Whitespace(" ")], - false_type: TsBooleanLiteralType { - literal: FALSE_KW@2707..2712 "false" [] [], - }, - }, - semicolon_token: SEMICOLON@2712..2713 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@2713..2719 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@2719..2726 "Prepend" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@2726..2727 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@2727..2728 "E" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@2728..2730 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@2730..2732 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@2732..2740 "extends" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@2740..2743 "any" [] [], - }, - l_brack_token: L_BRACK@2743..2744 "[" [] [], - r_brack_token: R_BRACK@2744..2745 "]" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@2745..2747 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@2747..2748 "=" [] [], - ty: TsConditionalType { - check_type: TsParenthesizedType { - l_paren_token: L_PAREN@2748..2754 "(" [Newline("\n"), Whitespace(" ")] [], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2754..2755 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@2755..2759 "head" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@2759..2761 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2761..2762 "E" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@2762..2764 "," [] [Whitespace(" ")], - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@2764..2767 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@2767..2771 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@2771..2773 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2773..2774 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - ], - r_paren_token: R_PAREN@2774..2776 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2776..2779 "=>" [] [Whitespace(" ")], - return_type: TsAnyType { - any_token: ANY_KW@2779..2782 "any" [] [], - }, - }, - r_paren_token: R_PAREN@2782..2784 ")" [] [Whitespace(" ")], - }, - extends_token: EXTENDS_KW@2784..2792 "extends" [] [Whitespace(" ")], - extends_type: TsParenthesizedType { - l_paren_token: L_PAREN@2792..2793 "(" [] [], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@2793..2794 "(" [] [], - items: JsParameterList [ - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@2794..2797 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@2797..2801 "args" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@2801..2803 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@2803..2809 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@2809..2810 "U" [] [], - }, - constraint: missing (optional), - }, - }, - }, - ], - r_paren_token: R_PAREN@2810..2812 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@2812..2815 "=>" [] [Whitespace(" ")], - return_type: TsAnyType { - any_token: ANY_KW@2815..2818 "any" [] [], - }, - }, - r_paren_token: R_PAREN@2818..2819 ")" [] [], - }, - question_mark_token: QUESTION@2819..2826 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2826..2827 "U" [] [], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@2827..2834 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - false_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2834..2835 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@2835..2836 ";" [] [], - }, - ], - eof_token: EOF@2836..2837 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..2837 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..2836 - 0: TS_TYPE_ALIAS_DECLARATION@0..64 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..9 - 0: IDENT@5..9 "Args" [] [] - 2: TS_TYPE_PARAMETERS@9..13 - 0: L_ANGLE@9..10 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@10..11 - 0: TS_TYPE_PARAMETER@10..11 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@10..10 - 1: TS_TYPE_PARAMETER_NAME@10..11 - 0: IDENT@10..11 "F" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@11..13 ">" [] [Whitespace(" ")] - 3: EQ@13..15 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@15..63 - 0: TS_REFERENCE_TYPE@15..17 - 0: JS_REFERENCE_IDENTIFIER@15..17 - 0: IDENT@15..17 "F" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@17..25 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@25..52 - 0: (empty) - 1: JS_PARAMETERS@25..44 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_PARAMETER_LIST@26..42 - 0: JS_REST_PARAMETER@26..42 - 0: JS_DECORATOR_LIST@26..26 - 1: DOT3@26..29 "..." [] [] - 2: JS_IDENTIFIER_BINDING@29..33 - 0: IDENT@29..33 "args" [] [] - 3: TS_TYPE_ANNOTATION@33..42 - 0: COLON@33..35 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@35..42 - 0: INFER_KW@35..41 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@41..42 - 0: IDENT@41..42 "A" [] [] - 2: (empty) - 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@47..52 - 0: VOID_KW@47..52 "void" [] [Whitespace(" ")] - 3: QUESTION@52..54 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@54..56 - 0: JS_REFERENCE_IDENTIFIER@54..56 - 0: IDENT@54..56 "A" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@56..58 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@58..63 - 0: NEVER_KW@58..63 "never" [] [] - 5: SEMICOLON@63..64 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@64..121 - 0: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@70..72 - 0: IDENT@70..72 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@72..74 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@74..121 - 0: TS_REFERENCE_TYPE@74..76 - 0: JS_REFERENCE_IDENTIFIER@74..76 - 0: IDENT@74..76 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@76..84 "extends" [] [Whitespace(" ")] - 2: TS_IMPORT_TYPE@84..110 - 0: (empty) - 1: IMPORT_KW@84..90 "import" [] [] - 2: JS_CALL_ARGUMENTS@90..98 - 0: L_PAREN@90..91 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@91..97 - 0: JS_STRING_LITERAL_EXPRESSION@91..97 - 0: JS_STRING_LITERAL@91..97 "\"test\"" [] [] - 2: R_PAREN@97..98 ")" [] [] - 3: TS_IMPORT_TYPE_QUALIFIER@98..100 - 0: DOT@98..99 "." [] [] - 1: JS_REFERENCE_IDENTIFIER@99..100 - 0: IDENT@99..100 "C" [] [] - 4: TS_TYPE_ARGUMENTS@100..110 - 0: L_ANGLE@100..101 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@101..108 - 0: TS_INFER_TYPE@101..108 - 0: INFER_KW@101..107 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@107..108 - 0: IDENT@107..108 "P" [] [] - 2: (empty) - 2: R_ANGLE@108..110 ">" [] [Whitespace(" ")] - 3: QUESTION@110..112 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@112..114 - 0: JS_REFERENCE_IDENTIFIER@112..114 - 0: IDENT@112..114 "P" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@114..116 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@116..121 - 0: NEVER_KW@116..121 "never" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@121..174 - 0: TYPE_KW@121..127 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@127..129 - 0: IDENT@127..129 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@129..131 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@131..174 - 0: TS_REFERENCE_TYPE@131..133 - 0: JS_REFERENCE_IDENTIFIER@131..133 - 0: IDENT@131..133 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@133..141 "extends" [] [Whitespace(" ")] - 2: TS_TYPEOF_TYPE@141..163 - 0: TYPEOF_KW@141..148 "typeof" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@148..153 - 0: IDENT@148..153 "Array" [] [] - 2: TS_TYPE_ARGUMENTS@153..163 - 0: L_ANGLE@153..154 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@154..161 - 0: TS_INFER_TYPE@154..161 - 0: INFER_KW@154..160 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@160..161 - 0: IDENT@160..161 "P" [] [] - 2: (empty) - 2: R_ANGLE@161..163 ">" [] [Whitespace(" ")] - 3: QUESTION@163..165 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@165..167 - 0: JS_REFERENCE_IDENTIFIER@165..167 - 0: IDENT@165..167 "P" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@167..169 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@169..174 - 0: NEVER_KW@169..174 "never" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@174..233 - 0: TYPE_KW@174..180 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@180..182 - 0: IDENT@180..182 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@182..184 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@184..233 - 0: TS_REFERENCE_TYPE@184..186 - 0: JS_REFERENCE_IDENTIFIER@184..186 - 0: IDENT@184..186 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@186..194 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@194..222 - 0: L_CURLY@194..196 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@196..220 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@196..220 - 0: JS_LITERAL_MEMBER_NAME@196..199 - 0: IDENT@196..199 "set" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@199..211 - 0: L_PAREN@199..200 "(" [] [] - 1: JS_PARAMETER_LIST@200..210 - 0: JS_FORMAL_PARAMETER@200..210 - 0: JS_DECORATOR_LIST@200..200 - 1: JS_IDENTIFIER_BINDING@200..201 - 0: IDENT@200..201 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@201..210 - 0: COLON@201..203 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@203..210 - 0: INFER_KW@203..209 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@209..210 - 0: IDENT@209..210 "P" [] [] - 2: (empty) - 4: (empty) - 2: R_PAREN@210..211 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@211..220 - 0: COLON@211..213 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@213..220 - 0: NUMBER_KW@213..220 "number" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@220..222 "}" [] [Whitespace(" ")] - 3: QUESTION@222..224 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@224..226 - 0: JS_REFERENCE_IDENTIFIER@224..226 - 0: IDENT@224..226 "P" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@226..228 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@228..233 - 0: NEVER_KW@228..233 "never" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@233..283 - 0: TYPE_KW@233..239 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@239..241 - 0: IDENT@239..241 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@241..243 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@243..283 - 0: TS_REFERENCE_TYPE@243..245 - 0: JS_REFERENCE_IDENTIFIER@243..245 - 0: IDENT@243..245 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@245..253 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@253..272 - 0: L_CURLY@253..255 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@255..270 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@255..270 - 0: JS_LITERAL_MEMBER_NAME@255..258 - 0: IDENT@255..258 "get" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@258..260 - 0: L_PAREN@258..259 "(" [] [] - 1: JS_PARAMETER_LIST@259..259 - 2: R_PAREN@259..260 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@260..270 - 0: COLON@260..262 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@262..270 - 0: INFER_KW@262..268 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@268..270 - 0: IDENT@268..270 "P" [] [Whitespace(" ")] - 2: (empty) - 5: (empty) - 2: R_CURLY@270..272 "}" [] [Whitespace(" ")] - 3: QUESTION@272..274 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@274..276 - 0: JS_REFERENCE_IDENTIFIER@274..276 - 0: IDENT@274..276 "P" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@276..278 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@278..283 - 0: NEVER_KW@278..283 "never" [] [] - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@283..348 - 0: TYPE_KW@283..289 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@289..291 - 0: IDENT@289..291 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@291..293 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@293..348 - 0: TS_REFERENCE_TYPE@293..295 - 0: JS_REFERENCE_IDENTIFIER@293..295 - 0: IDENT@293..295 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@295..303 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@303..337 - 0: L_CURLY@303..305 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@305..335 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@305..335 - 0: JS_LITERAL_MEMBER_NAME@305..311 - 0: IDENT@305..311 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@311..326 - 0: L_PAREN@311..312 "(" [] [] - 1: JS_PARAMETER_LIST@312..325 - 0: TS_THIS_PARAMETER@312..325 - 0: THIS_KW@312..316 "this" [] [] - 1: TS_TYPE_ANNOTATION@316..325 - 0: COLON@316..318 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@318..325 - 0: INFER_KW@318..324 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@324..325 - 0: IDENT@324..325 "P" [] [] - 2: (empty) - 2: R_PAREN@325..326 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@326..335 - 0: COLON@326..328 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@328..335 - 0: NUMBER_KW@328..335 "number" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@335..337 "}" [] [Whitespace(" ")] - 3: QUESTION@337..339 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@339..341 - 0: JS_REFERENCE_IDENTIFIER@339..341 - 0: IDENT@339..341 "P" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@341..343 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@343..348 - 0: NEVER_KW@343..348 "never" [] [] - 5: (empty) - 6: TS_TYPE_ALIAS_DECLARATION@348..401 - 0: TYPE_KW@348..354 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@354..360 - 0: IDENT@354..360 "valid9" [] [] - 2: TS_TYPE_PARAMETERS@360..364 - 0: L_ANGLE@360..361 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@361..362 - 0: TS_TYPE_PARAMETER@361..362 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@361..361 - 1: TS_TYPE_PARAMETER_NAME@361..362 - 0: IDENT@361..362 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@362..364 ">" [] [Whitespace(" ")] - 3: EQ@364..366 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@366..400 - 0: TS_REFERENCE_TYPE@366..368 - 0: JS_REFERENCE_IDENTIFIER@366..368 - 0: IDENT@366..368 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@376..391 - 0: JS_REFERENCE_IDENTIFIER@376..381 - 0: IDENT@376..381 "Array" [] [] - 1: TS_TYPE_ARGUMENTS@381..391 - 0: L_ANGLE@381..382 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@382..389 - 0: TS_INFER_TYPE@382..389 - 0: INFER_KW@382..388 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@388..389 - 0: IDENT@388..389 "R" [] [] - 2: (empty) - 2: R_ANGLE@389..391 ">" [] [Whitespace(" ")] - 3: QUESTION@391..393 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@393..395 - 0: JS_REFERENCE_IDENTIFIER@393..395 - 0: IDENT@393..395 "R" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@395..397 ":" [] [Whitespace(" ")] - 6: TS_ANY_TYPE@397..400 - 0: ANY_KW@397..400 "any" [] [] - 5: SEMICOLON@400..401 ";" [] [] - 7: TS_TYPE_ALIAS_DECLARATION@401..472 - 0: TYPE_KW@401..407 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@407..429 - 0: IDENT@407..429 "ContentBetweenBrackets" [] [] - 2: TS_TYPE_PARAMETERS@429..433 - 0: L_ANGLE@429..430 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@430..431 - 0: TS_TYPE_PARAMETER@430..431 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@430..430 - 1: TS_TYPE_PARAMETER_NAME@430..431 - 0: IDENT@430..431 "S" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@431..433 ">" [] [Whitespace(" ")] - 3: EQ@433..435 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@435..471 - 0: TS_REFERENCE_TYPE@435..437 - 0: JS_REFERENCE_IDENTIFIER@435..437 - 0: IDENT@435..437 "S" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@437..445 "extends" [] [Whitespace(" ")] - 2: TS_TEMPLATE_LITERAL_TYPE@445..460 - 0: BACKTICK@445..446 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@446..458 - 0: TS_TEMPLATE_CHUNK_ELEMENT@446..447 - 0: TEMPLATE_CHUNK@446..447 "[" [] [] - 1: TS_TEMPLATE_ELEMENT@447..457 - 0: DOLLAR_CURLY@447..449 "${" [] [] - 1: TS_INFER_TYPE@449..456 - 0: INFER_KW@449..455 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@455..456 - 0: IDENT@455..456 "T" [] [] - 2: (empty) - 2: R_CURLY@456..457 "}" [] [] - 2: TS_TEMPLATE_CHUNK_ELEMENT@457..458 - 0: TEMPLATE_CHUNK@457..458 "]" [] [] - 2: BACKTICK@458..460 "`" [] [Whitespace(" ")] - 3: QUESTION@460..462 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@462..464 - 0: JS_REFERENCE_IDENTIFIER@462..464 - 0: IDENT@462..464 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@464..466 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@466..471 - 0: NEVER_KW@466..471 "never" [] [] - 5: SEMICOLON@471..472 ";" [] [] - 8: TS_TYPE_ALIAS_DECLARATION@472..597 - 0: TYPE_KW@472..478 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@478..491 - 0: IDENT@478..491 "WithSelectors" [] [] - 2: TS_TYPE_PARAMETERS@491..495 - 0: L_ANGLE@491..492 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@492..493 - 0: TS_TYPE_PARAMETER@492..493 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@492..492 - 1: TS_TYPE_PARAMETER_NAME@492..493 - 0: IDENT@492..493 "S" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@493..495 ">" [] [Whitespace(" ")] - 3: EQ@495..497 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@497..596 - 0: TS_REFERENCE_TYPE@497..499 - 0: JS_REFERENCE_IDENTIFIER@497..499 - 0: IDENT@497..499 "S" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@499..507 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@507..534 - 0: L_CURLY@507..509 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@509..533 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@509..533 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@509..517 - 0: IDENT@509..517 "getState" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@517..533 - 0: COLON@517..519 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@519..533 - 0: (empty) - 1: JS_PARAMETERS@519..522 - 0: L_PAREN@519..520 "(" [] [] - 1: JS_PARAMETER_LIST@520..520 - 2: R_PAREN@520..522 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")] - 3: TS_INFER_TYPE@525..533 - 0: INFER_KW@525..531 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@531..533 - 0: IDENT@531..533 "T" [] [Whitespace(" ")] - 2: (empty) - 4: (empty) - 2: R_CURLY@533..534 "}" [] [] - 3: QUESTION@534..541 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 4: TS_INTERSECTION_TYPE@541..584 - 0: (empty) - 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@541..584 - 0: TS_REFERENCE_TYPE@541..543 - 0: JS_REFERENCE_IDENTIFIER@541..543 - 0: IDENT@541..543 "S" [] [Whitespace(" ")] - 1: (empty) - 1: AMP@543..545 "&" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@545..584 - 0: L_CURLY@545..547 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@547..583 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@547..583 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@547..550 - 0: IDENT@547..550 "use" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@550..583 - 0: COLON@550..552 ":" [] [Whitespace(" ")] - 1: TS_MAPPED_TYPE@552..583 - 0: L_CURLY@552..554 "{" [] [Whitespace(" ")] - 1: (empty) - 2: L_BRACK@554..555 "[" [] [] - 3: TS_TYPE_PARAMETER_NAME@555..557 - 0: IDENT@555..557 "K" [] [Whitespace(" ")] - 4: IN_KW@557..560 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@560..567 - 0: KEYOF_KW@560..566 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@566..567 - 0: JS_REFERENCE_IDENTIFIER@566..567 - 0: IDENT@566..567 "T" [] [] - 1: (empty) - 6: (empty) - 7: R_BRACK@567..568 "]" [] [] - 8: (empty) - 9: TS_TYPE_ANNOTATION@568..581 - 0: COLON@568..570 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@570..581 - 0: (empty) - 1: JS_PARAMETERS@570..573 - 0: L_PAREN@570..571 "(" [] [] - 1: JS_PARAMETER_LIST@571..571 - 2: R_PAREN@571..573 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@573..576 "=>" [] [Whitespace(" ")] - 3: TS_INDEXED_ACCESS_TYPE@576..581 - 0: TS_REFERENCE_TYPE@576..577 - 0: JS_REFERENCE_IDENTIFIER@576..577 - 0: IDENT@576..577 "T" [] [] - 1: (empty) - 1: L_BRACK@577..578 "[" [] [] - 2: TS_REFERENCE_TYPE@578..579 - 0: JS_REFERENCE_IDENTIFIER@578..579 - 0: IDENT@578..579 "K" [] [] - 1: (empty) - 3: R_BRACK@579..581 "]" [] [Whitespace(" ")] - 10: (empty) - 11: R_CURLY@581..583 "}" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@583..584 "}" [] [] - 5: COLON@584..591 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_NEVER_TYPE@591..596 - 0: NEVER_KW@591..596 "never" [] [] - 5: SEMICOLON@596..597 ";" [] [] - 9: TS_TYPE_ALIAS_DECLARATION@597..697 - 0: TYPE_KW@597..603 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@603..605 - 0: IDENT@603..605 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@605..607 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@607..697 - 0: TS_REFERENCE_TYPE@607..614 - 0: JS_REFERENCE_IDENTIFIER@607..614 - 0: IDENT@607..614 "MyType" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@614..622 "extends" [] [Whitespace(" ")] - 2: TS_PARENTHESIZED_TYPE@622..673 - 0: L_PAREN@622..623 "(" [] [] - 1: TS_CONDITIONAL_TYPE@623..671 - 0: TS_REFERENCE_TYPE@623..633 - 0: JS_REFERENCE_IDENTIFIER@623..633 - 0: IDENT@623..633 "OtherType" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@633..641 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@641..649 - 0: INFER_KW@641..647 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@647..649 - 0: IDENT@647..649 "T" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@649..651 "?" [] [Whitespace(" ")] - 4: TS_INFER_TYPE@651..659 - 0: INFER_KW@651..657 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@657..659 - 0: IDENT@657..659 "U" [] [Whitespace(" ")] - 2: (empty) - 5: COLON@659..661 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@661..671 - 0: JS_REFERENCE_IDENTIFIER@661..671 - 0: IDENT@661..671 "InnerFalse" [] [] - 1: (empty) - 2: R_PAREN@671..673 ")" [] [Whitespace(" ")] - 3: QUESTION@673..675 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@675..685 - 0: JS_REFERENCE_IDENTIFIER@675..685 - 0: IDENT@675..685 "OuterTrue" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@685..687 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@687..697 - 0: JS_REFERENCE_IDENTIFIER@687..697 - 0: IDENT@687..697 "OuterFalse" [] [] - 1: (empty) - 5: (empty) - 10: TS_TYPE_ALIAS_DECLARATION@697..947 - 0: TYPE_KW@697..703 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@703..707 - 0: IDENT@703..707 "Join" [] [] - 2: TS_TYPE_PARAMETERS@707..747 - 0: L_ANGLE@707..708 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@708..745 - 0: TS_TYPE_PARAMETER@708..727 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@708..708 - 1: TS_TYPE_PARAMETER_NAME@708..710 - 0: IDENT@708..710 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@710..727 - 0: EXTENDS_KW@710..718 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@718..727 - 0: TS_UNKNOWN_TYPE@718..725 - 0: UNKNOWN_KW@718..725 "unknown" [] [] - 1: L_BRACK@725..726 "[" [] [] - 2: R_BRACK@726..727 "]" [] [] - 3: (empty) - 1: COMMA@727..729 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@729..745 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@729..729 - 1: TS_TYPE_PARAMETER_NAME@729..731 - 0: IDENT@729..731 "D" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@731..745 - 0: EXTENDS_KW@731..739 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@739..745 - 0: STRING_KW@739..745 "string" [] [] - 3: (empty) - 2: R_ANGLE@745..747 ">" [] [Whitespace(" ")] - 3: EQ@747..748 "=" [] [] - 4: TS_CONDITIONAL_TYPE@748..946 - 0: TS_REFERENCE_TYPE@748..756 - 0: JS_REFERENCE_IDENTIFIER@748..756 - 0: IDENT@748..756 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@756..764 "extends" [] [Whitespace(" ")] - 2: TS_TUPLE_TYPE@764..767 - 0: L_BRACK@764..765 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@765..765 - 2: R_BRACK@765..767 "]" [] [Whitespace(" ")] - 3: QUESTION@767..769 "?" [] [Whitespace(" ")] - 4: TS_STRING_LITERAL_TYPE@769..772 - 0: JS_STRING_LITERAL@769..772 "''" [] [Whitespace(" ")] - 5: COLON@772..773 ":" [] [] - 6: TS_CONDITIONAL_TYPE@773..946 - 0: TS_REFERENCE_TYPE@773..781 - 0: JS_REFERENCE_IDENTIFIER@773..781 - 0: IDENT@773..781 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@781..789 "extends" [] [Whitespace(" ")] - 2: TS_TUPLE_TYPE@789..826 - 0: L_BRACK@789..790 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@790..824 - 0: TS_UNION_TYPE@790..824 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@790..824 - 0: TS_STRING_TYPE@790..797 - 0: STRING_KW@790..797 "string" [] [Whitespace(" ")] - 1: PIPE@797..799 "|" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@799..806 - 0: NUMBER_KW@799..806 "number" [] [Whitespace(" ")] - 3: PIPE@806..808 "|" [] [Whitespace(" ")] - 4: TS_BOOLEAN_TYPE@808..816 - 0: BOOLEAN_KW@808..816 "boolean" [] [Whitespace(" ")] - 5: PIPE@816..818 "|" [] [Whitespace(" ")] - 6: TS_BIGINT_TYPE@818..824 - 0: BIGINT_KW@818..824 "bigint" [] [] - 2: R_BRACK@824..826 "]" [] [Whitespace(" ")] - 3: QUESTION@826..828 "?" [] [Whitespace(" ")] - 4: TS_TEMPLATE_LITERAL_TYPE@828..838 - 0: BACKTICK@828..829 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@829..836 - 0: TS_TEMPLATE_ELEMENT@829..836 - 0: DOLLAR_CURLY@829..831 "${" [] [] - 1: TS_INDEXED_ACCESS_TYPE@831..835 - 0: TS_REFERENCE_TYPE@831..832 - 0: JS_REFERENCE_IDENTIFIER@831..832 - 0: IDENT@831..832 "T" [] [] - 1: (empty) - 1: L_BRACK@832..833 "[" [] [] - 2: TS_NUMBER_LITERAL_TYPE@833..834 - 0: (empty) - 1: JS_NUMBER_LITERAL@833..834 "0" [] [] - 3: R_BRACK@834..835 "]" [] [] - 2: R_CURLY@835..836 "}" [] [] - 2: BACKTICK@836..838 "`" [] [Whitespace(" ")] - 5: COLON@838..839 ":" [] [] - 6: TS_CONDITIONAL_TYPE@839..946 - 0: TS_REFERENCE_TYPE@839..847 - 0: JS_REFERENCE_IDENTIFIER@839..847 - 0: IDENT@839..847 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@847..855 "extends" [] [Whitespace(" ")] - 2: TS_TUPLE_TYPE@855..904 - 0: L_BRACK@855..856 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@856..902 - 0: TS_UNION_TYPE@856..890 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@856..890 - 0: TS_STRING_TYPE@856..863 - 0: STRING_KW@856..863 "string" [] [Whitespace(" ")] - 1: PIPE@863..865 "|" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@865..872 - 0: NUMBER_KW@865..872 "number" [] [Whitespace(" ")] - 3: PIPE@872..874 "|" [] [Whitespace(" ")] - 4: TS_BOOLEAN_TYPE@874..882 - 0: BOOLEAN_KW@874..882 "boolean" [] [Whitespace(" ")] - 5: PIPE@882..884 "|" [] [Whitespace(" ")] - 6: TS_BIGINT_TYPE@884..890 - 0: BIGINT_KW@884..890 "bigint" [] [] - 1: COMMA@890..892 "," [] [Whitespace(" ")] - 2: TS_REST_TUPLE_TYPE_ELEMENT@892..902 - 0: DOT3@892..895 "..." [] [] - 1: TS_INFER_TYPE@895..902 - 0: INFER_KW@895..901 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@901..902 - 0: IDENT@901..902 "U" [] [] - 2: (empty) - 2: R_BRACK@902..904 "]" [] [Whitespace(" ")] - 3: QUESTION@904..906 "?" [] [Whitespace(" ")] - 4: TS_TEMPLATE_LITERAL_TYPE@906..933 - 0: BACKTICK@906..907 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@907..931 - 0: TS_TEMPLATE_ELEMENT@907..914 - 0: DOLLAR_CURLY@907..909 "${" [] [] - 1: TS_INDEXED_ACCESS_TYPE@909..913 - 0: TS_REFERENCE_TYPE@909..910 - 0: JS_REFERENCE_IDENTIFIER@909..910 - 0: IDENT@909..910 "T" [] [] - 1: (empty) - 1: L_BRACK@910..911 "[" [] [] - 2: TS_NUMBER_LITERAL_TYPE@911..912 - 0: (empty) - 1: JS_NUMBER_LITERAL@911..912 "0" [] [] - 3: R_BRACK@912..913 "]" [] [] - 2: R_CURLY@913..914 "}" [] [] - 1: TS_TEMPLATE_ELEMENT@914..918 - 0: DOLLAR_CURLY@914..916 "${" [] [] - 1: TS_REFERENCE_TYPE@916..917 - 0: JS_REFERENCE_IDENTIFIER@916..917 - 0: IDENT@916..917 "D" [] [] - 1: (empty) - 2: R_CURLY@917..918 "}" [] [] - 2: TS_TEMPLATE_ELEMENT@918..931 - 0: DOLLAR_CURLY@918..920 "${" [] [] - 1: TS_REFERENCE_TYPE@920..930 - 0: JS_REFERENCE_IDENTIFIER@920..924 - 0: IDENT@920..924 "Join" [] [] - 1: TS_TYPE_ARGUMENTS@924..930 - 0: L_ANGLE@924..925 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@925..929 - 0: TS_REFERENCE_TYPE@925..926 - 0: JS_REFERENCE_IDENTIFIER@925..926 - 0: IDENT@925..926 "U" [] [] - 1: (empty) - 1: COMMA@926..928 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@928..929 - 0: JS_REFERENCE_IDENTIFIER@928..929 - 0: IDENT@928..929 "D" [] [] - 1: (empty) - 2: R_ANGLE@929..930 ">" [] [] - 2: R_CURLY@930..931 "}" [] [] - 2: BACKTICK@931..933 "`" [] [Whitespace(" ")] - 5: COLON@933..934 ":" [] [] - 6: TS_STRING_TYPE@934..946 - 0: STRING_KW@934..946 "string" [Newline("\n"), Whitespace(" ")] [] - 5: SEMICOLON@946..947 ";" [] [] - 11: TS_TYPE_ALIAS_DECLARATION@947..1038 - 0: TYPE_KW@947..953 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@953..962 - 0: IDENT@953..962 "MatchPair" [] [] - 2: TS_TYPE_PARAMETERS@962..981 - 0: L_ANGLE@962..963 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@963..979 - 0: TS_TYPE_PARAMETER@963..979 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@963..963 - 1: TS_TYPE_PARAMETER_NAME@963..965 - 0: IDENT@963..965 "S" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@965..979 - 0: EXTENDS_KW@965..973 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@973..979 - 0: STRING_KW@973..979 "string" [] [] - 3: (empty) - 2: R_ANGLE@979..981 ">" [] [Whitespace(" ")] - 3: EQ@981..983 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@983..1037 - 0: TS_REFERENCE_TYPE@983..985 - 0: JS_REFERENCE_IDENTIFIER@983..985 - 0: IDENT@983..985 "S" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@985..993 "extends" [] [Whitespace(" ")] - 2: TS_TEMPLATE_LITERAL_TYPE@993..1019 - 0: BACKTICK@993..994 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@994..1017 - 0: TS_TEMPLATE_CHUNK_ELEMENT@994..995 - 0: TEMPLATE_CHUNK@994..995 "[" [] [] - 1: TS_TEMPLATE_ELEMENT@995..1005 - 0: DOLLAR_CURLY@995..997 "${" [] [] - 1: TS_INFER_TYPE@997..1004 - 0: INFER_KW@997..1003 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1003..1004 - 0: IDENT@1003..1004 "A" [] [] - 2: (empty) - 2: R_CURLY@1004..1005 "}" [] [] - 2: TS_TEMPLATE_CHUNK_ELEMENT@1005..1006 - 0: TEMPLATE_CHUNK@1005..1006 "," [] [] - 3: TS_TEMPLATE_ELEMENT@1006..1016 - 0: DOLLAR_CURLY@1006..1008 "${" [] [] - 1: TS_INFER_TYPE@1008..1015 - 0: INFER_KW@1008..1014 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1014..1015 - 0: IDENT@1014..1015 "B" [] [] - 2: (empty) - 2: R_CURLY@1015..1016 "}" [] [] - 4: TS_TEMPLATE_CHUNK_ELEMENT@1016..1017 - 0: TEMPLATE_CHUNK@1016..1017 "]" [] [] - 2: BACKTICK@1017..1019 "`" [] [Whitespace(" ")] - 3: QUESTION@1019..1021 "?" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@1021..1028 - 0: L_BRACK@1021..1022 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@1022..1026 - 0: TS_REFERENCE_TYPE@1022..1023 - 0: JS_REFERENCE_IDENTIFIER@1022..1023 - 0: IDENT@1022..1023 "A" [] [] - 1: (empty) - 1: COMMA@1023..1025 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1025..1026 - 0: JS_REFERENCE_IDENTIFIER@1025..1026 - 0: IDENT@1025..1026 "B" [] [] - 1: (empty) - 2: R_BRACK@1026..1028 "]" [] [Whitespace(" ")] - 5: COLON@1028..1030 ":" [] [Whitespace(" ")] - 6: TS_UNKNOWN_TYPE@1030..1037 - 0: UNKNOWN_KW@1030..1037 "unknown" [] [] - 5: SEMICOLON@1037..1038 ";" [] [] - 12: TS_TYPE_ALIAS_DECLARATION@1038..1151 - 0: TYPE_KW@1038..1044 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1044..1059 - 0: IDENT@1044..1059 "FirstTwoAndRest" [] [] - 2: TS_TYPE_PARAMETERS@1059..1078 - 0: L_ANGLE@1059..1060 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1060..1076 - 0: TS_TYPE_PARAMETER@1060..1076 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1060..1060 - 1: TS_TYPE_PARAMETER_NAME@1060..1062 - 0: IDENT@1060..1062 "S" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1062..1076 - 0: EXTENDS_KW@1062..1070 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@1070..1076 - 0: STRING_KW@1070..1076 "string" [] [] - 3: (empty) - 2: R_ANGLE@1076..1078 ">" [] [Whitespace(" ")] - 3: EQ@1078..1080 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1080..1150 - 0: TS_REFERENCE_TYPE@1080..1082 - 0: JS_REFERENCE_IDENTIFIER@1080..1082 - 0: IDENT@1080..1082 "S" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1082..1090 "extends" [] [Whitespace(" ")] - 2: TS_TEMPLATE_LITERAL_TYPE@1090..1123 - 0: BACKTICK@1090..1091 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@1091..1121 - 0: TS_TEMPLATE_ELEMENT@1091..1101 - 0: DOLLAR_CURLY@1091..1093 "${" [] [] - 1: TS_INFER_TYPE@1093..1100 - 0: INFER_KW@1093..1099 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1099..1100 - 0: IDENT@1099..1100 "A" [] [] - 2: (empty) - 2: R_CURLY@1100..1101 "}" [] [] - 1: TS_TEMPLATE_ELEMENT@1101..1111 - 0: DOLLAR_CURLY@1101..1103 "${" [] [] - 1: TS_INFER_TYPE@1103..1110 - 0: INFER_KW@1103..1109 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1109..1110 - 0: IDENT@1109..1110 "B" [] [] - 2: (empty) - 2: R_CURLY@1110..1111 "}" [] [] - 2: TS_TEMPLATE_ELEMENT@1111..1121 - 0: DOLLAR_CURLY@1111..1113 "${" [] [] - 1: TS_INFER_TYPE@1113..1120 - 0: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1119..1120 - 0: IDENT@1119..1120 "R" [] [] - 2: (empty) - 2: R_CURLY@1120..1121 "}" [] [] - 2: BACKTICK@1121..1123 "`" [] [Whitespace(" ")] - 3: QUESTION@1123..1125 "?" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@1125..1141 - 0: L_BRACK@1125..1126 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@1126..1139 - 0: TS_TEMPLATE_LITERAL_TYPE@1126..1136 - 0: BACKTICK@1126..1127 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@1127..1135 - 0: TS_TEMPLATE_ELEMENT@1127..1131 - 0: DOLLAR_CURLY@1127..1129 "${" [] [] - 1: TS_REFERENCE_TYPE@1129..1130 - 0: JS_REFERENCE_IDENTIFIER@1129..1130 - 0: IDENT@1129..1130 "A" [] [] - 1: (empty) - 2: R_CURLY@1130..1131 "}" [] [] - 1: TS_TEMPLATE_ELEMENT@1131..1135 - 0: DOLLAR_CURLY@1131..1133 "${" [] [] - 1: TS_REFERENCE_TYPE@1133..1134 - 0: JS_REFERENCE_IDENTIFIER@1133..1134 - 0: IDENT@1133..1134 "B" [] [] - 1: (empty) - 2: R_CURLY@1134..1135 "}" [] [] - 2: BACKTICK@1135..1136 "`" [] [] - 1: COMMA@1136..1138 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1138..1139 - 0: JS_REFERENCE_IDENTIFIER@1138..1139 - 0: IDENT@1138..1139 "R" [] [] - 1: (empty) - 2: R_BRACK@1139..1141 "]" [] [Whitespace(" ")] - 5: COLON@1141..1143 ":" [] [Whitespace(" ")] - 6: TS_UNKNOWN_TYPE@1143..1150 - 0: UNKNOWN_KW@1143..1150 "unknown" [] [] - 5: SEMICOLON@1150..1151 ";" [] [] - 13: TS_TYPE_ALIAS_DECLARATION@1151..1230 - 0: TYPE_KW@1151..1157 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1157..1161 - 0: IDENT@1157..1161 "Trim" [] [] - 2: TS_TYPE_PARAMETERS@1161..1180 - 0: L_ANGLE@1161..1162 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1162..1178 - 0: TS_TYPE_PARAMETER@1162..1178 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1162..1162 - 1: TS_TYPE_PARAMETER_NAME@1162..1164 - 0: IDENT@1162..1164 "S" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1164..1178 - 0: EXTENDS_KW@1164..1172 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@1172..1178 - 0: STRING_KW@1172..1178 "string" [] [] - 3: (empty) - 2: R_ANGLE@1178..1180 ">" [] [Whitespace(" ")] - 3: EQ@1180..1181 "=" [] [] - 4: TS_CONDITIONAL_TYPE@1181..1229 - 0: TS_REFERENCE_TYPE@1181..1189 - 0: JS_REFERENCE_IDENTIFIER@1181..1189 - 0: IDENT@1181..1189 "S" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1189..1197 "extends" [] [Whitespace(" ")] - 2: TS_TEMPLATE_LITERAL_TYPE@1197..1211 - 0: BACKTICK@1197..1198 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@1198..1209 - 0: TS_TEMPLATE_ELEMENT@1198..1208 - 0: DOLLAR_CURLY@1198..1200 "${" [] [] - 1: TS_INFER_TYPE@1200..1207 - 0: INFER_KW@1200..1206 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1206..1207 - 0: IDENT@1206..1207 "T" [] [] - 2: (empty) - 2: R_CURLY@1207..1208 "}" [] [] - 1: TS_TEMPLATE_CHUNK_ELEMENT@1208..1209 - 0: TEMPLATE_CHUNK@1208..1209 " " [] [] - 2: BACKTICK@1209..1211 "`" [] [Whitespace(" ")] - 3: QUESTION@1211..1213 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1213..1221 - 0: JS_REFERENCE_IDENTIFIER@1213..1217 - 0: IDENT@1213..1217 "Trim" [] [] - 1: TS_TYPE_ARGUMENTS@1217..1221 - 0: L_ANGLE@1217..1218 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1218..1219 - 0: TS_REFERENCE_TYPE@1218..1219 - 0: JS_REFERENCE_IDENTIFIER@1218..1219 - 0: IDENT@1218..1219 "T" [] [] - 1: (empty) - 2: R_ANGLE@1219..1221 ">" [] [Whitespace(" ")] - 5: COLON@1221..1222 ":" [] [] - 6: TS_REFERENCE_TYPE@1222..1229 - 0: JS_REFERENCE_IDENTIFIER@1222..1229 - 0: IDENT@1222..1229 "S" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 5: SEMICOLON@1229..1230 ";" [] [] - 14: TS_TYPE_ALIAS_DECLARATION@1230..1282 - 0: TYPE_KW@1230..1236 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1236..1239 - 0: IDENT@1236..1239 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@1239..1243 - 0: L_ANGLE@1239..1240 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1240..1241 - 0: TS_TYPE_PARAMETER@1240..1241 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1240..1240 - 1: TS_TYPE_PARAMETER_NAME@1240..1241 - 0: IDENT@1240..1241 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1241..1243 ">" [] [Whitespace(" ")] - 3: EQ@1243..1245 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1245..1281 - 0: TS_REFERENCE_TYPE@1245..1247 - 0: JS_REFERENCE_IDENTIFIER@1245..1247 - 0: IDENT@1245..1247 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1247..1255 "extends" [] [Whitespace(" ")] - 2: TS_TEMPLATE_LITERAL_TYPE@1255..1270 - 0: BACKTICK@1255..1256 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@1256..1268 - 0: TS_TEMPLATE_CHUNK_ELEMENT@1256..1257 - 0: TEMPLATE_CHUNK@1256..1257 "*" [] [] - 1: TS_TEMPLATE_ELEMENT@1257..1267 - 0: DOLLAR_CURLY@1257..1259 "${" [] [] - 1: TS_INFER_TYPE@1259..1266 - 0: INFER_KW@1259..1265 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1265..1266 - 0: IDENT@1265..1266 "S" [] [] - 2: (empty) - 2: R_CURLY@1266..1267 "}" [] [] - 2: TS_TEMPLATE_CHUNK_ELEMENT@1267..1268 - 0: TEMPLATE_CHUNK@1267..1268 "*" [] [] - 2: BACKTICK@1268..1270 "`" [] [Whitespace(" ")] - 3: QUESTION@1270..1272 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1272..1274 - 0: JS_REFERENCE_IDENTIFIER@1272..1274 - 0: IDENT@1272..1274 "S" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1274..1276 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@1276..1281 - 0: NEVER_KW@1276..1281 "never" [] [] - 5: SEMICOLON@1281..1282 ";" [] [] - 15: TS_TYPE_ALIAS_DECLARATION@1282..1421 - 0: TYPE_KW@1282..1288 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1288..1296 - 0: IDENT@1288..1296 "Unpacked" [] [] - 2: TS_TYPE_PARAMETERS@1296..1300 - 0: L_ANGLE@1296..1297 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1297..1298 - 0: TS_TYPE_PARAMETER@1297..1298 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1297..1297 - 1: TS_TYPE_PARAMETER_NAME@1297..1298 - 0: IDENT@1297..1298 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1298..1300 ">" [] [Whitespace(" ")] - 3: EQ@1300..1302 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1302..1420 - 0: TS_REFERENCE_TYPE@1302..1304 - 0: JS_REFERENCE_IDENTIFIER@1302..1304 - 0: IDENT@1302..1304 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1304..1312 "extends" [] [Whitespace(" ")] - 2: TS_ARRAY_TYPE@1312..1324 - 0: TS_PARENTHESIZED_TYPE@1312..1321 - 0: L_PAREN@1312..1313 "(" [] [] - 1: TS_INFER_TYPE@1313..1320 - 0: INFER_KW@1313..1319 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1319..1320 - 0: IDENT@1319..1320 "U" [] [] - 2: (empty) - 2: R_PAREN@1320..1321 ")" [] [] - 1: L_BRACK@1321..1322 "[" [] [] - 2: R_BRACK@1322..1324 "]" [] [Whitespace(" ")] - 3: QUESTION@1324..1326 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1326..1328 - 0: JS_REFERENCE_IDENTIFIER@1326..1328 - 0: IDENT@1326..1328 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1328..1329 ":" [] [] - 6: TS_CONDITIONAL_TYPE@1329..1420 - 0: TS_REFERENCE_TYPE@1329..1336 - 0: JS_REFERENCE_IDENTIFIER@1329..1336 - 0: IDENT@1329..1336 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1336..1344 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@1344..1372 - 0: (empty) - 1: JS_PARAMETERS@1344..1361 - 0: L_PAREN@1344..1345 "(" [] [] - 1: JS_PARAMETER_LIST@1345..1359 - 0: JS_REST_PARAMETER@1345..1359 - 0: JS_DECORATOR_LIST@1345..1345 - 1: DOT3@1345..1348 "..." [] [] - 2: JS_IDENTIFIER_BINDING@1348..1352 - 0: IDENT@1348..1352 "args" [] [] - 3: TS_TYPE_ANNOTATION@1352..1359 - 0: COLON@1352..1354 ":" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@1354..1359 - 0: TS_ANY_TYPE@1354..1357 - 0: ANY_KW@1354..1357 "any" [] [] - 1: L_BRACK@1357..1358 "[" [] [] - 2: R_BRACK@1358..1359 "]" [] [] - 2: R_PAREN@1359..1361 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@1361..1364 "=>" [] [Whitespace(" ")] - 3: TS_INFER_TYPE@1364..1372 - 0: INFER_KW@1364..1370 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1370..1372 - 0: IDENT@1370..1372 "U" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@1372..1374 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1374..1376 - 0: JS_REFERENCE_IDENTIFIER@1374..1376 - 0: IDENT@1374..1376 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1376..1377 ":" [] [] - 6: TS_CONDITIONAL_TYPE@1377..1420 - 0: TS_REFERENCE_TYPE@1377..1384 - 0: JS_REFERENCE_IDENTIFIER@1377..1384 - 0: IDENT@1377..1384 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1384..1392 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1392..1409 - 0: JS_REFERENCE_IDENTIFIER@1392..1399 - 0: IDENT@1392..1399 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@1399..1409 - 0: L_ANGLE@1399..1400 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1400..1407 - 0: TS_INFER_TYPE@1400..1407 - 0: INFER_KW@1400..1406 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1406..1407 - 0: IDENT@1406..1407 "U" [] [] - 2: (empty) - 2: R_ANGLE@1407..1409 ">" [] [Whitespace(" ")] - 3: QUESTION@1409..1411 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1411..1413 - 0: JS_REFERENCE_IDENTIFIER@1411..1413 - 0: IDENT@1411..1413 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1413..1414 ":" [] [] - 6: TS_REFERENCE_TYPE@1414..1420 - 0: JS_REFERENCE_IDENTIFIER@1414..1420 - 0: IDENT@1414..1420 "T" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 5: SEMICOLON@1420..1421 ";" [] [] - 16: TS_TYPE_ALIAS_DECLARATION@1421..1509 - 0: TYPE_KW@1421..1427 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1427..1439 - 0: IDENT@1427..1439 "ArgumentType" [] [] - 2: TS_TYPE_PARAMETERS@1439..1467 - 0: L_ANGLE@1439..1440 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1440..1465 - 0: TS_TYPE_PARAMETER@1440..1465 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1440..1440 - 1: TS_TYPE_PARAMETER_NAME@1440..1442 - 0: IDENT@1440..1442 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1442..1465 - 0: EXTENDS_KW@1442..1450 "extends" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@1450..1465 - 0: (empty) - 1: JS_PARAMETERS@1450..1459 - 0: L_PAREN@1450..1451 "(" [] [] - 1: JS_PARAMETER_LIST@1451..1457 - 0: JS_FORMAL_PARAMETER@1451..1457 - 0: JS_DECORATOR_LIST@1451..1451 - 1: JS_IDENTIFIER_BINDING@1451..1452 - 0: IDENT@1451..1452 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1452..1457 - 0: COLON@1452..1454 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@1454..1457 - 0: ANY_KW@1454..1457 "any" [] [] - 4: (empty) - 2: R_PAREN@1457..1459 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@1459..1462 "=>" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@1462..1465 - 0: ANY_KW@1462..1465 "any" [] [] - 3: (empty) - 2: R_ANGLE@1465..1467 ">" [] [Whitespace(" ")] - 3: EQ@1467..1469 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1469..1508 - 0: TS_REFERENCE_TYPE@1469..1471 - 0: JS_REFERENCE_IDENTIFIER@1469..1471 - 0: IDENT@1469..1471 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1471..1479 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@1479..1499 - 0: (empty) - 1: JS_PARAMETERS@1479..1492 - 0: L_PAREN@1479..1480 "(" [] [] - 1: JS_PARAMETER_LIST@1480..1490 - 0: JS_FORMAL_PARAMETER@1480..1490 - 0: JS_DECORATOR_LIST@1480..1480 - 1: JS_IDENTIFIER_BINDING@1480..1481 - 0: IDENT@1480..1481 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1481..1490 - 0: COLON@1481..1483 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@1483..1490 - 0: INFER_KW@1483..1489 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1489..1490 - 0: IDENT@1489..1490 "A" [] [] - 2: (empty) - 4: (empty) - 2: R_PAREN@1490..1492 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@1492..1495 "=>" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@1495..1499 - 0: ANY_KW@1495..1499 "any" [] [Whitespace(" ")] - 3: QUESTION@1499..1501 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1501..1503 - 0: JS_REFERENCE_IDENTIFIER@1501..1503 - 0: IDENT@1501..1503 "A" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1503..1505 ":" [] [Whitespace(" ")] - 6: TS_ANY_TYPE@1505..1508 - 0: ANY_KW@1505..1508 "any" [] [] - 5: SEMICOLON@1508..1509 ";" [] [] - 17: TS_TYPE_ALIAS_DECLARATION@1509..1598 - 0: TYPE_KW@1509..1515 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1515..1517 - 0: IDENT@1515..1517 "X3" [] [] - 2: TS_TYPE_PARAMETERS@1517..1521 - 0: L_ANGLE@1517..1518 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1518..1519 - 0: TS_TYPE_PARAMETER@1518..1519 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1518..1518 - 1: TS_TYPE_PARAMETER_NAME@1518..1519 - 0: IDENT@1518..1519 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1519..1521 ">" [] [Whitespace(" ")] - 3: EQ@1521..1523 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1523..1597 - 0: TS_REFERENCE_TYPE@1523..1525 - 0: JS_REFERENCE_IDENTIFIER@1523..1525 - 0: IDENT@1523..1525 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1525..1533 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@1533..1586 - 0: L_CURLY@1533..1535 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@1535..1584 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1535..1560 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1535..1536 - 0: IDENT@1535..1536 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1536..1558 - 0: COLON@1536..1538 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@1538..1558 - 0: (empty) - 1: JS_PARAMETERS@1538..1551 - 0: L_PAREN@1538..1539 "(" [] [] - 1: JS_PARAMETER_LIST@1539..1549 - 0: JS_FORMAL_PARAMETER@1539..1549 - 0: JS_DECORATOR_LIST@1539..1539 - 1: JS_IDENTIFIER_BINDING@1539..1540 - 0: IDENT@1539..1540 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1540..1549 - 0: COLON@1540..1542 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@1542..1549 - 0: INFER_KW@1542..1548 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1548..1549 - 0: IDENT@1548..1549 "U" [] [] - 2: (empty) - 4: (empty) - 2: R_PAREN@1549..1551 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@1551..1554 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@1554..1558 - 0: VOID_KW@1554..1558 "void" [] [] - 4: COMMA@1558..1560 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1560..1584 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1560..1561 - 0: IDENT@1560..1561 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1561..1584 - 0: COLON@1561..1563 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@1563..1584 - 0: (empty) - 1: JS_PARAMETERS@1563..1576 - 0: L_PAREN@1563..1564 "(" [] [] - 1: JS_PARAMETER_LIST@1564..1574 - 0: JS_FORMAL_PARAMETER@1564..1574 - 0: JS_DECORATOR_LIST@1564..1564 - 1: JS_IDENTIFIER_BINDING@1564..1565 - 0: IDENT@1564..1565 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1565..1574 - 0: COLON@1565..1567 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@1567..1574 - 0: INFER_KW@1567..1573 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1573..1574 - 0: IDENT@1573..1574 "U" [] [] - 2: (empty) - 4: (empty) - 2: R_PAREN@1574..1576 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@1576..1579 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@1579..1584 - 0: VOID_KW@1579..1584 "void" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@1584..1586 "}" [] [Whitespace(" ")] - 3: QUESTION@1586..1588 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1588..1590 - 0: JS_REFERENCE_IDENTIFIER@1588..1590 - 0: IDENT@1588..1590 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1590..1592 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@1592..1597 - 0: NEVER_KW@1592..1597 "never" [] [] - 5: SEMICOLON@1597..1598 ";" [] [] - 18: TS_TYPE_ALIAS_DECLARATION@1598..1691 - 0: TYPE_KW@1598..1604 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1604..1606 - 0: IDENT@1604..1606 "X1" [] [] - 2: TS_TYPE_PARAMETERS@1606..1637 - 0: L_ANGLE@1606..1607 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1607..1635 - 0: TS_TYPE_PARAMETER@1607..1635 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1607..1607 - 1: TS_TYPE_PARAMETER_NAME@1607..1609 - 0: IDENT@1607..1609 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1609..1635 - 0: EXTENDS_KW@1609..1617 "extends" [] [Whitespace(" ")] - 1: TS_OBJECT_TYPE@1617..1635 - 0: L_CURLY@1617..1619 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@1619..1634 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1619..1627 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1619..1620 - 0: IDENT@1619..1620 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1620..1625 - 0: COLON@1620..1622 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@1622..1625 - 0: ANY_KW@1622..1625 "any" [] [] - 4: COMMA@1625..1627 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1627..1634 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1627..1628 - 0: IDENT@1627..1628 "y" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1628..1634 - 0: COLON@1628..1630 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@1630..1634 - 0: ANY_KW@1630..1634 "any" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@1634..1635 "}" [] [] - 3: (empty) - 2: R_ANGLE@1635..1637 ">" [] [Whitespace(" ")] - 3: EQ@1637..1639 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1639..1690 - 0: TS_REFERENCE_TYPE@1639..1641 - 0: JS_REFERENCE_IDENTIFIER@1639..1641 - 0: IDENT@1639..1641 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1641..1649 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@1649..1676 - 0: L_CURLY@1649..1651 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@1651..1674 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1651..1663 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1651..1652 - 0: IDENT@1651..1652 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1652..1661 - 0: COLON@1652..1654 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@1654..1661 - 0: INFER_KW@1654..1660 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1660..1661 - 0: IDENT@1660..1661 "X" [] [] - 2: (empty) - 4: COMMA@1661..1663 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1663..1674 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@1663..1664 - 0: IDENT@1663..1664 "y" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1664..1674 - 0: COLON@1664..1666 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@1666..1674 - 0: INFER_KW@1666..1672 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1672..1674 - 0: IDENT@1672..1674 "Y" [] [Whitespace(" ")] - 2: (empty) - 4: (empty) - 2: R_CURLY@1674..1676 "}" [] [Whitespace(" ")] - 3: QUESTION@1676..1678 "?" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@1678..1685 - 0: L_BRACK@1678..1679 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@1679..1683 - 0: TS_REFERENCE_TYPE@1679..1680 - 0: JS_REFERENCE_IDENTIFIER@1679..1680 - 0: IDENT@1679..1680 "X" [] [] - 1: (empty) - 1: COMMA@1680..1682 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1682..1683 - 0: JS_REFERENCE_IDENTIFIER@1682..1683 - 0: IDENT@1682..1683 "Y" [] [] - 1: (empty) - 2: R_BRACK@1683..1685 "]" [] [Whitespace(" ")] - 5: COLON@1685..1687 ":" [] [Whitespace(" ")] - 6: TS_ANY_TYPE@1687..1690 - 0: ANY_KW@1687..1690 "any" [] [] - 5: SEMICOLON@1690..1691 ";" [] [] - 19: TS_TYPE_ALIAS_DECLARATION@1691..1736 - 0: TYPE_KW@1691..1697 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1697..1700 - 0: IDENT@1697..1700 "T62" [] [] - 2: TS_TYPE_PARAMETERS@1700..1704 - 0: L_ANGLE@1700..1701 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1701..1702 - 0: TS_TYPE_PARAMETER@1701..1702 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1701..1701 - 1: TS_TYPE_PARAMETER_NAME@1701..1702 - 0: IDENT@1701..1702 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1702..1704 ">" [] [Whitespace(" ")] - 3: EQ@1704..1706 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1706..1735 - 0: TS_REFERENCE_TYPE@1706..1708 - 0: JS_REFERENCE_IDENTIFIER@1706..1708 - 0: IDENT@1706..1708 "U" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1708..1716 "extends" [] [Whitespace(" ")] - 2: TS_ARRAY_TYPE@1716..1728 - 0: TS_PARENTHESIZED_TYPE@1716..1725 - 0: L_PAREN@1716..1717 "(" [] [] - 1: TS_INFER_TYPE@1717..1724 - 0: INFER_KW@1717..1723 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1723..1724 - 0: IDENT@1723..1724 "U" [] [] - 2: (empty) - 2: R_PAREN@1724..1725 ")" [] [] - 1: L_BRACK@1725..1726 "[" [] [] - 2: R_BRACK@1726..1728 "]" [] [Whitespace(" ")] - 3: QUESTION@1728..1730 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1730..1732 - 0: JS_REFERENCE_IDENTIFIER@1730..1732 - 0: IDENT@1730..1732 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@1732..1734 ":" [] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@1734..1735 - 0: JS_REFERENCE_IDENTIFIER@1734..1735 - 0: IDENT@1734..1735 "U" [] [] - 1: (empty) - 5: SEMICOLON@1735..1736 ";" [] [] - 20: TS_TYPE_ALIAS_DECLARATION@1736..1827 - 0: TYPE_KW@1736..1742 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1742..1745 - 0: IDENT@1742..1745 "T63" [] [] - 2: TS_TYPE_PARAMETERS@1745..1749 - 0: L_ANGLE@1745..1746 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1746..1747 - 0: TS_TYPE_PARAMETER@1746..1747 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1746..1746 - 1: TS_TYPE_PARAMETER_NAME@1746..1747 - 0: IDENT@1746..1747 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1747..1749 ">" [] [Whitespace(" ")] - 3: EQ@1749..1751 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1751..1826 - 0: TS_REFERENCE_TYPE@1751..1753 - 0: JS_REFERENCE_IDENTIFIER@1751..1753 - 0: IDENT@1751..1753 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1753..1761 "extends" [] [Whitespace(" ")] - 2: TS_PARENTHESIZED_TYPE@1761..1809 - 0: L_PAREN@1761..1762 "(" [] [] - 1: TS_CONDITIONAL_TYPE@1762..1807 - 0: TS_PARENTHESIZED_TYPE@1762..1772 - 0: L_PAREN@1762..1763 "(" [] [] - 1: TS_INFER_TYPE@1763..1770 - 0: INFER_KW@1763..1769 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1769..1770 - 0: IDENT@1769..1770 "A" [] [] - 2: (empty) - 2: R_PAREN@1770..1772 ")" [] [Whitespace(" ")] - 1: EXTENDS_KW@1772..1780 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@1780..1788 - 0: INFER_KW@1780..1786 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1786..1788 - 0: IDENT@1786..1788 "B" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@1788..1790 "?" [] [Whitespace(" ")] - 4: TS_INFER_TYPE@1790..1798 - 0: INFER_KW@1790..1796 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1796..1798 - 0: IDENT@1796..1798 "C" [] [Whitespace(" ")] - 2: (empty) - 5: COLON@1798..1800 ":" [] [Whitespace(" ")] - 6: TS_INFER_TYPE@1800..1807 - 0: INFER_KW@1800..1806 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1806..1807 - 0: IDENT@1806..1807 "D" [] [] - 2: (empty) - 2: R_PAREN@1807..1809 ")" [] [Whitespace(" ")] - 3: QUESTION@1809..1811 "?" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@1811..1818 - 0: STRING_KW@1811..1818 "string" [] [Whitespace(" ")] - 5: COLON@1818..1820 ":" [] [Whitespace(" ")] - 6: TS_NUMBER_TYPE@1820..1826 - 0: NUMBER_KW@1820..1826 "number" [] [] - 5: SEMICOLON@1826..1827 ";" [] [] - 21: TS_TYPE_ALIAS_DECLARATION@1827..1912 - 0: TYPE_KW@1827..1833 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1833..1836 - 0: IDENT@1833..1836 "T75" [] [] - 2: TS_TYPE_PARAMETERS@1836..1840 - 0: L_ANGLE@1836..1837 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1837..1838 - 0: TS_TYPE_PARAMETER@1837..1838 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1837..1837 - 1: TS_TYPE_PARAMETER_NAME@1837..1838 - 0: IDENT@1837..1838 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1838..1840 ">" [] [Whitespace(" ")] - 3: EQ@1840..1842 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1842..1911 - 0: TS_REFERENCE_TYPE@1842..1844 - 0: JS_REFERENCE_IDENTIFIER@1842..1844 - 0: IDENT@1842..1844 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1844..1852 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1852..1874 - 0: JS_REFERENCE_IDENTIFIER@1852..1855 - 0: IDENT@1852..1855 "T74" [] [] - 1: TS_TYPE_ARGUMENTS@1855..1874 - 0: L_ANGLE@1855..1856 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1856..1872 - 0: TS_INFER_TYPE@1856..1863 - 0: INFER_KW@1856..1862 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1862..1863 - 0: IDENT@1862..1863 "U" [] [] - 2: (empty) - 1: COMMA@1863..1865 "," [] [Whitespace(" ")] - 2: TS_INFER_TYPE@1865..1872 - 0: INFER_KW@1865..1871 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1871..1872 - 0: IDENT@1871..1872 "U" [] [] - 2: (empty) - 2: R_ANGLE@1872..1874 ">" [] [Whitespace(" ")] - 3: QUESTION@1874..1876 "?" [] [Whitespace(" ")] - 4: TS_UNION_TYPE@1876..1904 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@1876..1904 - 0: TS_REFERENCE_TYPE@1876..1883 - 0: JS_REFERENCE_IDENTIFIER@1876..1879 - 0: IDENT@1876..1879 "T70" [] [] - 1: TS_TYPE_ARGUMENTS@1879..1883 - 0: L_ANGLE@1879..1880 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1880..1881 - 0: TS_REFERENCE_TYPE@1880..1881 - 0: JS_REFERENCE_IDENTIFIER@1880..1881 - 0: IDENT@1880..1881 "U" [] [] - 1: (empty) - 2: R_ANGLE@1881..1883 ">" [] [Whitespace(" ")] - 1: PIPE@1883..1885 "|" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1885..1892 - 0: JS_REFERENCE_IDENTIFIER@1885..1888 - 0: IDENT@1885..1888 "T72" [] [] - 1: TS_TYPE_ARGUMENTS@1888..1892 - 0: L_ANGLE@1888..1889 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1889..1890 - 0: TS_REFERENCE_TYPE@1889..1890 - 0: JS_REFERENCE_IDENTIFIER@1889..1890 - 0: IDENT@1889..1890 "U" [] [] - 1: (empty) - 2: R_ANGLE@1890..1892 ">" [] [Whitespace(" ")] - 3: PIPE@1892..1894 "|" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1894..1904 - 0: JS_REFERENCE_IDENTIFIER@1894..1897 - 0: IDENT@1894..1897 "T74" [] [] - 1: TS_TYPE_ARGUMENTS@1897..1904 - 0: L_ANGLE@1897..1898 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@1898..1902 - 0: TS_REFERENCE_TYPE@1898..1899 - 0: JS_REFERENCE_IDENTIFIER@1898..1899 - 0: IDENT@1898..1899 "U" [] [] - 1: (empty) - 1: COMMA@1899..1901 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1901..1902 - 0: JS_REFERENCE_IDENTIFIER@1901..1902 - 0: IDENT@1901..1902 "U" [] [] - 1: (empty) - 2: R_ANGLE@1902..1904 ">" [] [Whitespace(" ")] - 5: COLON@1904..1906 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@1906..1911 - 0: NEVER_KW@1906..1911 "never" [] [] - 5: SEMICOLON@1911..1912 ";" [] [] - 22: TS_TYPE_ALIAS_DECLARATION@1912..2128 - 0: TYPE_KW@1912..1918 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1918..1927 - 0: IDENT@1918..1927 "Jsonified" [] [] - 2: TS_TYPE_PARAMETERS@1927..1931 - 0: L_ANGLE@1927..1928 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1928..1929 - 0: TS_TYPE_PARAMETER@1928..1929 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1928..1928 - 1: TS_TYPE_PARAMETER_NAME@1928..1929 - 0: IDENT@1928..1929 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1929..1931 ">" [] [Whitespace(" ")] - 3: EQ@1931..1933 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@1933..2127 - 0: TS_REFERENCE_TYPE@1933..1935 - 0: JS_REFERENCE_IDENTIFIER@1933..1935 - 0: IDENT@1933..1935 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1935..1943 "extends" [] [Whitespace(" ")] - 2: TS_UNION_TYPE@1943..1976 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@1943..1976 - 0: TS_STRING_TYPE@1943..1950 - 0: STRING_KW@1943..1950 "string" [] [Whitespace(" ")] - 1: PIPE@1950..1952 "|" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@1952..1959 - 0: NUMBER_KW@1952..1959 "number" [] [Whitespace(" ")] - 3: PIPE@1959..1961 "|" [] [Whitespace(" ")] - 4: TS_BOOLEAN_TYPE@1961..1969 - 0: BOOLEAN_KW@1961..1969 "boolean" [] [Whitespace(" ")] - 5: PIPE@1969..1971 "|" [] [Whitespace(" ")] - 6: TS_NULL_LITERAL_TYPE@1971..1976 - 0: NULL_KW@1971..1976 "null" [] [Whitespace(" ")] - 3: QUESTION@1976..1978 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@1978..1979 - 0: JS_REFERENCE_IDENTIFIER@1978..1979 - 0: IDENT@1978..1979 "T" [] [] - 1: (empty) - 5: COLON@1979..1986 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_CONDITIONAL_TYPE@1986..2127 - 0: TS_REFERENCE_TYPE@1986..1988 - 0: JS_REFERENCE_IDENTIFIER@1986..1988 - 0: IDENT@1986..1988 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@1988..1996 "extends" [] [Whitespace(" ")] - 2: TS_UNION_TYPE@1996..2017 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@1996..2017 - 0: TS_UNDEFINED_TYPE@1996..2006 - 0: UNDEFINED_KW@1996..2006 "undefined" [] [Whitespace(" ")] - 1: PIPE@2006..2008 "|" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@2008..2017 - 0: JS_REFERENCE_IDENTIFIER@2008..2017 - 0: IDENT@2008..2017 "Function" [] [Whitespace(" ")] - 1: (empty) - 3: QUESTION@2017..2019 "?" [] [Whitespace(" ")] - 4: TS_NEVER_TYPE@2019..2024 - 0: NEVER_KW@2019..2024 "never" [] [] - 5: COLON@2024..2031 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_CONDITIONAL_TYPE@2031..2127 - 0: TS_REFERENCE_TYPE@2031..2033 - 0: JS_REFERENCE_IDENTIFIER@2031..2033 - 0: IDENT@2031..2033 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2033..2041 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@2041..2063 - 0: L_CURLY@2041..2043 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@2043..2061 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@2043..2061 - 0: JS_LITERAL_MEMBER_NAME@2043..2049 - 0: IDENT@2043..2049 "toJSON" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@2049..2051 - 0: L_PAREN@2049..2050 "(" [] [] - 1: JS_PARAMETER_LIST@2050..2050 - 2: R_PAREN@2050..2051 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@2051..2061 - 0: COLON@2051..2053 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@2053..2061 - 0: INFER_KW@2053..2059 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2059..2061 - 0: IDENT@2059..2061 "R" [] [Whitespace(" ")] - 2: (empty) - 5: (empty) - 2: R_CURLY@2061..2063 "}" [] [Whitespace(" ")] - 3: QUESTION@2063..2065 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2065..2066 - 0: JS_REFERENCE_IDENTIFIER@2065..2066 - 0: IDENT@2065..2066 "R" [] [] - 1: (empty) - 5: COLON@2066..2073 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_CONDITIONAL_TYPE@2073..2127 - 0: TS_REFERENCE_TYPE@2073..2075 - 0: JS_REFERENCE_IDENTIFIER@2073..2075 - 0: IDENT@2073..2075 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2075..2083 "extends" [] [Whitespace(" ")] - 2: TS_NON_PRIMITIVE_TYPE@2083..2090 - 0: OBJECT_KW@2083..2090 "object" [] [Whitespace(" ")] - 3: QUESTION@2090..2092 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2092..2110 - 0: JS_REFERENCE_IDENTIFIER@2092..2107 - 0: IDENT@2092..2107 "JsonifiedObject" [] [] - 1: TS_TYPE_ARGUMENTS@2107..2110 - 0: L_ANGLE@2107..2108 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@2108..2109 - 0: TS_REFERENCE_TYPE@2108..2109 - 0: JS_REFERENCE_IDENTIFIER@2108..2109 - 0: IDENT@2108..2109 "T" [] [] - 1: (empty) - 2: R_ANGLE@2109..2110 ">" [] [] - 5: COLON@2110..2113 ":" [Newline("\n")] [Whitespace(" ")] - 6: TS_STRING_LITERAL_TYPE@2113..2127 - 0: JS_STRING_LITERAL@2113..2127 "\"what is this\"" [] [] - 5: SEMICOLON@2127..2128 ";" [] [] - 23: TS_TYPE_ALIAS_DECLARATION@2128..2191 - 0: TYPE_KW@2128..2134 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2134..2137 - 0: IDENT@2134..2137 "T1" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@2137..2139 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2139..2190 - 0: TS_REFERENCE_TYPE@2139..2142 - 0: JS_REFERENCE_IDENTIFIER@2139..2142 - 0: IDENT@2139..2142 "F1" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2142..2150 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@2150..2179 - 0: (empty) - 1: JS_PARAMETERS@2150..2171 - 0: L_PAREN@2150..2151 "(" [] [] - 1: JS_PARAMETER_LIST@2151..2169 - 0: JS_REST_PARAMETER@2151..2169 - 0: JS_DECORATOR_LIST@2151..2151 - 1: DOT3@2151..2154 "..." [] [] - 2: JS_IDENTIFIER_BINDING@2154..2158 - 0: IDENT@2154..2158 "args" [] [] - 3: TS_TYPE_ANNOTATION@2158..2169 - 0: COLON@2158..2160 ":" [] [Whitespace(" ")] - 1: TS_PARENTHESIZED_TYPE@2160..2169 - 0: L_PAREN@2160..2161 "(" [] [] - 1: TS_INFER_TYPE@2161..2168 - 0: INFER_KW@2161..2167 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2167..2168 - 0: IDENT@2167..2168 "T" [] [] - 2: (empty) - 2: R_PAREN@2168..2169 ")" [] [] - 2: R_PAREN@2169..2171 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2171..2174 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@2174..2179 - 0: VOID_KW@2174..2179 "void" [] [Whitespace(" ")] - 3: QUESTION@2179..2181 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2181..2183 - 0: JS_REFERENCE_IDENTIFIER@2181..2183 - 0: IDENT@2181..2183 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@2183..2185 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@2185..2190 - 0: NEVER_KW@2185..2190 "never" [] [] - 5: SEMICOLON@2190..2191 ";" [] [] - 24: TS_TYPE_ALIAS_DECLARATION@2191..2256 - 0: TYPE_KW@2191..2197 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2197..2200 - 0: IDENT@2197..2200 "T2" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@2200..2202 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2202..2255 - 0: TS_REFERENCE_TYPE@2202..2205 - 0: JS_REFERENCE_IDENTIFIER@2202..2205 - 0: IDENT@2202..2205 "F1" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2205..2213 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@2213..2244 - 0: (empty) - 1: JS_PARAMETERS@2213..2236 - 0: L_PAREN@2213..2214 "(" [] [] - 1: JS_PARAMETER_LIST@2214..2234 - 0: JS_FORMAL_PARAMETER@2214..2234 - 0: JS_DECORATOR_LIST@2214..2214 - 1: JS_IDENTIFIER_BINDING@2214..2218 - 0: IDENT@2214..2218 "args" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@2218..2234 - 0: COLON@2218..2220 ":" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@2220..2234 - 0: L_BRACK@2220..2221 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@2221..2233 - 0: TS_REST_TUPLE_TYPE_ELEMENT@2221..2233 - 0: DOT3@2221..2224 "..." [] [] - 1: TS_PARENTHESIZED_TYPE@2224..2233 - 0: L_PAREN@2224..2225 "(" [] [] - 1: TS_INFER_TYPE@2225..2232 - 0: INFER_KW@2225..2231 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2231..2232 - 0: IDENT@2231..2232 "T" [] [] - 2: (empty) - 2: R_PAREN@2232..2233 ")" [] [] - 2: R_BRACK@2233..2234 "]" [] [] - 4: (empty) - 2: R_PAREN@2234..2236 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2236..2239 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@2239..2244 - 0: VOID_KW@2239..2244 "void" [] [Whitespace(" ")] - 3: QUESTION@2244..2246 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2246..2248 - 0: JS_REFERENCE_IDENTIFIER@2246..2248 - 0: IDENT@2246..2248 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@2248..2250 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@2250..2255 - 0: NEVER_KW@2250..2255 "never" [] [] - 5: SEMICOLON@2255..2256 ";" [] [] - 25: TS_TYPE_ALIAS_DECLARATION@2256..2315 - 0: TYPE_KW@2256..2262 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2262..2264 - 0: IDENT@2262..2264 "T3" [] [] - 2: TS_TYPE_PARAMETERS@2264..2268 - 0: L_ANGLE@2264..2265 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@2265..2266 - 0: TS_TYPE_PARAMETER@2265..2266 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2265..2265 - 1: TS_TYPE_PARAMETER_NAME@2265..2266 - 0: IDENT@2265..2266 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@2266..2268 ">" [] [Whitespace(" ")] - 3: EQ@2268..2270 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2270..2314 - 0: TS_REFERENCE_TYPE@2270..2272 - 0: JS_REFERENCE_IDENTIFIER@2270..2272 - 0: IDENT@2270..2272 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2272..2280 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@2280..2300 - 0: JS_REFERENCE_IDENTIFIER@2280..2288 - 0: IDENT@2280..2288 "IsNumber" [] [] - 1: TS_TYPE_ARGUMENTS@2288..2300 - 0: L_ANGLE@2288..2289 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@2289..2298 - 0: TS_PARENTHESIZED_TYPE@2289..2298 - 0: L_PAREN@2289..2290 "(" [] [] - 1: TS_INFER_TYPE@2290..2297 - 0: INFER_KW@2290..2296 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2296..2297 - 0: IDENT@2296..2297 "N" [] [] - 2: (empty) - 2: R_PAREN@2297..2298 ")" [] [] - 2: R_ANGLE@2298..2300 ">" [] [Whitespace(" ")] - 3: QUESTION@2300..2302 "?" [] [Whitespace(" ")] - 4: TS_BOOLEAN_LITERAL_TYPE@2302..2307 - 0: TRUE_KW@2302..2307 "true" [] [Whitespace(" ")] - 5: COLON@2307..2309 ":" [] [Whitespace(" ")] - 6: TS_BOOLEAN_LITERAL_TYPE@2309..2314 - 0: FALSE_KW@2309..2314 "false" [] [] - 5: SEMICOLON@2314..2315 ";" [] [] - 26: TS_TYPE_ALIAS_DECLARATION@2315..2380 - 0: TYPE_KW@2315..2321 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2321..2324 - 0: IDENT@2321..2324 "T4" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@2324..2326 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2326..2379 - 0: TS_REFERENCE_TYPE@2326..2329 - 0: JS_REFERENCE_IDENTIFIER@2326..2329 - 0: IDENT@2326..2329 "F1" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2329..2337 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@2337..2368 - 0: (empty) - 1: JS_PARAMETERS@2337..2360 - 0: L_PAREN@2337..2338 "(" [] [] - 1: JS_PARAMETER_LIST@2338..2358 - 0: JS_REST_PARAMETER@2338..2358 - 0: JS_DECORATOR_LIST@2338..2338 - 1: DOT3@2338..2341 "..." [] [] - 2: JS_IDENTIFIER_BINDING@2341..2345 - 0: IDENT@2341..2345 "args" [] [] - 3: TS_TYPE_ANNOTATION@2345..2358 - 0: COLON@2345..2347 ":" [] [Whitespace(" ")] - 1: TS_PARENTHESIZED_TYPE@2347..2358 - 0: L_PAREN@2347..2348 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2348..2357 - 0: L_PAREN@2348..2349 "(" [] [] - 1: TS_INFER_TYPE@2349..2356 - 0: INFER_KW@2349..2355 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2355..2356 - 0: IDENT@2355..2356 "T" [] [] - 2: (empty) - 2: R_PAREN@2356..2357 ")" [] [] - 2: R_PAREN@2357..2358 ")" [] [] - 2: R_PAREN@2358..2360 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2360..2363 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@2363..2368 - 0: VOID_KW@2363..2368 "void" [] [Whitespace(" ")] - 3: QUESTION@2368..2370 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2370..2372 - 0: JS_REFERENCE_IDENTIFIER@2370..2372 - 0: IDENT@2370..2372 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@2372..2374 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@2374..2379 - 0: NEVER_KW@2374..2379 "never" [] [] - 5: SEMICOLON@2379..2380 ";" [] [] - 27: TS_TYPE_ALIAS_DECLARATION@2380..2447 - 0: TYPE_KW@2380..2386 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2386..2389 - 0: IDENT@2386..2389 "T5" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@2389..2391 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2391..2446 - 0: TS_REFERENCE_TYPE@2391..2394 - 0: JS_REFERENCE_IDENTIFIER@2391..2394 - 0: IDENT@2391..2394 "F1" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2394..2402 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@2402..2435 - 0: (empty) - 1: JS_PARAMETERS@2402..2427 - 0: L_PAREN@2402..2403 "(" [] [] - 1: JS_PARAMETER_LIST@2403..2425 - 0: JS_FORMAL_PARAMETER@2403..2425 - 0: JS_DECORATOR_LIST@2403..2403 - 1: JS_IDENTIFIER_BINDING@2403..2407 - 0: IDENT@2403..2407 "args" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@2407..2425 - 0: COLON@2407..2409 ":" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@2409..2425 - 0: L_BRACK@2409..2410 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@2410..2424 - 0: TS_REST_TUPLE_TYPE_ELEMENT@2410..2424 - 0: DOT3@2410..2413 "..." [] [] - 1: TS_PARENTHESIZED_TYPE@2413..2424 - 0: L_PAREN@2413..2414 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2414..2423 - 0: L_PAREN@2414..2415 "(" [] [] - 1: TS_INFER_TYPE@2415..2422 - 0: INFER_KW@2415..2421 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2421..2422 - 0: IDENT@2421..2422 "T" [] [] - 2: (empty) - 2: R_PAREN@2422..2423 ")" [] [] - 2: R_PAREN@2423..2424 ")" [] [] - 2: R_BRACK@2424..2425 "]" [] [] - 4: (empty) - 2: R_PAREN@2425..2427 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2427..2430 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@2430..2435 - 0: VOID_KW@2430..2435 "void" [] [Whitespace(" ")] - 3: QUESTION@2435..2437 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2437..2439 - 0: JS_REFERENCE_IDENTIFIER@2437..2439 - 0: IDENT@2437..2439 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@2439..2441 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@2441..2446 - 0: NEVER_KW@2441..2446 "never" [] [] - 5: SEMICOLON@2446..2447 ";" [] [] - 28: TS_TYPE_ALIAS_DECLARATION@2447..2508 - 0: TYPE_KW@2447..2453 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2453..2455 - 0: IDENT@2453..2455 "T6" [] [] - 2: TS_TYPE_PARAMETERS@2455..2459 - 0: L_ANGLE@2455..2456 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@2456..2457 - 0: TS_TYPE_PARAMETER@2456..2457 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2456..2456 - 1: TS_TYPE_PARAMETER_NAME@2456..2457 - 0: IDENT@2456..2457 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@2457..2459 ">" [] [Whitespace(" ")] - 3: EQ@2459..2461 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2461..2507 - 0: TS_REFERENCE_TYPE@2461..2463 - 0: JS_REFERENCE_IDENTIFIER@2461..2463 - 0: IDENT@2461..2463 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2463..2471 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@2471..2493 - 0: JS_REFERENCE_IDENTIFIER@2471..2479 - 0: IDENT@2471..2479 "IsNumber" [] [] - 1: TS_TYPE_ARGUMENTS@2479..2493 - 0: L_ANGLE@2479..2480 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@2480..2491 - 0: TS_PARENTHESIZED_TYPE@2480..2491 - 0: L_PAREN@2480..2481 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2481..2490 - 0: L_PAREN@2481..2482 "(" [] [] - 1: TS_INFER_TYPE@2482..2489 - 0: INFER_KW@2482..2488 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2488..2489 - 0: IDENT@2488..2489 "N" [] [] - 2: (empty) - 2: R_PAREN@2489..2490 ")" [] [] - 2: R_PAREN@2490..2491 ")" [] [] - 2: R_ANGLE@2491..2493 ">" [] [Whitespace(" ")] - 3: QUESTION@2493..2495 "?" [] [Whitespace(" ")] - 4: TS_BOOLEAN_LITERAL_TYPE@2495..2500 - 0: TRUE_KW@2495..2500 "true" [] [Whitespace(" ")] - 5: COLON@2500..2502 ":" [] [Whitespace(" ")] - 6: TS_BOOLEAN_LITERAL_TYPE@2502..2507 - 0: FALSE_KW@2502..2507 "false" [] [] - 5: SEMICOLON@2507..2508 ";" [] [] - 29: TS_TYPE_ALIAS_DECLARATION@2508..2577 - 0: TYPE_KW@2508..2514 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2514..2517 - 0: IDENT@2514..2517 "T7" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@2517..2519 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2519..2576 - 0: TS_REFERENCE_TYPE@2519..2522 - 0: JS_REFERENCE_IDENTIFIER@2519..2522 - 0: IDENT@2519..2522 "F1" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2522..2530 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@2530..2565 - 0: (empty) - 1: JS_PARAMETERS@2530..2557 - 0: L_PAREN@2530..2531 "(" [] [] - 1: JS_PARAMETER_LIST@2531..2555 - 0: JS_REST_PARAMETER@2531..2555 - 0: JS_DECORATOR_LIST@2531..2531 - 1: DOT3@2531..2534 "..." [] [] - 2: JS_IDENTIFIER_BINDING@2534..2538 - 0: IDENT@2534..2538 "args" [] [] - 3: TS_TYPE_ANNOTATION@2538..2555 - 0: COLON@2538..2540 ":" [] [Whitespace(" ")] - 1: TS_PARENTHESIZED_TYPE@2540..2555 - 0: L_PAREN@2540..2541 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2541..2554 - 0: L_PAREN@2541..2542 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2542..2553 - 0: L_PAREN@2542..2543 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2543..2552 - 0: L_PAREN@2543..2544 "(" [] [] - 1: TS_INFER_TYPE@2544..2551 - 0: INFER_KW@2544..2550 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2550..2551 - 0: IDENT@2550..2551 "T" [] [] - 2: (empty) - 2: R_PAREN@2551..2552 ")" [] [] - 2: R_PAREN@2552..2553 ")" [] [] - 2: R_PAREN@2553..2554 ")" [] [] - 2: R_PAREN@2554..2555 ")" [] [] - 2: R_PAREN@2555..2557 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2557..2560 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@2560..2565 - 0: VOID_KW@2560..2565 "void" [] [Whitespace(" ")] - 3: QUESTION@2565..2567 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2567..2569 - 0: JS_REFERENCE_IDENTIFIER@2567..2569 - 0: IDENT@2567..2569 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@2569..2571 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@2571..2576 - 0: NEVER_KW@2571..2576 "never" [] [] - 5: SEMICOLON@2576..2577 ";" [] [] - 30: TS_TYPE_ALIAS_DECLARATION@2577..2648 - 0: TYPE_KW@2577..2583 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2583..2586 - 0: IDENT@2583..2586 "T8" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@2586..2588 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2588..2647 - 0: TS_REFERENCE_TYPE@2588..2591 - 0: JS_REFERENCE_IDENTIFIER@2588..2591 - 0: IDENT@2588..2591 "F1" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2591..2599 "extends" [] [Whitespace(" ")] - 2: TS_FUNCTION_TYPE@2599..2636 - 0: (empty) - 1: JS_PARAMETERS@2599..2628 - 0: L_PAREN@2599..2600 "(" [] [] - 1: JS_PARAMETER_LIST@2600..2626 - 0: JS_FORMAL_PARAMETER@2600..2626 - 0: JS_DECORATOR_LIST@2600..2600 - 1: JS_IDENTIFIER_BINDING@2600..2604 - 0: IDENT@2600..2604 "args" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@2604..2626 - 0: COLON@2604..2606 ":" [] [Whitespace(" ")] - 1: TS_TUPLE_TYPE@2606..2626 - 0: L_BRACK@2606..2607 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@2607..2625 - 0: TS_REST_TUPLE_TYPE_ELEMENT@2607..2625 - 0: DOT3@2607..2610 "..." [] [] - 1: TS_PARENTHESIZED_TYPE@2610..2625 - 0: L_PAREN@2610..2611 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2611..2624 - 0: L_PAREN@2611..2612 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2612..2623 - 0: L_PAREN@2612..2613 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2613..2622 - 0: L_PAREN@2613..2614 "(" [] [] - 1: TS_INFER_TYPE@2614..2621 - 0: INFER_KW@2614..2620 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2620..2621 - 0: IDENT@2620..2621 "T" [] [] - 2: (empty) - 2: R_PAREN@2621..2622 ")" [] [] - 2: R_PAREN@2622..2623 ")" [] [] - 2: R_PAREN@2623..2624 ")" [] [] - 2: R_PAREN@2624..2625 ")" [] [] - 2: R_BRACK@2625..2626 "]" [] [] - 4: (empty) - 2: R_PAREN@2626..2628 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2628..2631 "=>" [] [Whitespace(" ")] - 3: TS_VOID_TYPE@2631..2636 - 0: VOID_KW@2631..2636 "void" [] [Whitespace(" ")] - 3: QUESTION@2636..2638 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2638..2640 - 0: JS_REFERENCE_IDENTIFIER@2638..2640 - 0: IDENT@2638..2640 "T" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@2640..2642 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@2642..2647 - 0: NEVER_KW@2642..2647 "never" [] [] - 5: SEMICOLON@2647..2648 ";" [] [] - 31: TS_TYPE_ALIAS_DECLARATION@2648..2713 - 0: TYPE_KW@2648..2654 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2654..2656 - 0: IDENT@2654..2656 "T9" [] [] - 2: TS_TYPE_PARAMETERS@2656..2660 - 0: L_ANGLE@2656..2657 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@2657..2658 - 0: TS_TYPE_PARAMETER@2657..2658 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2657..2657 - 1: TS_TYPE_PARAMETER_NAME@2657..2658 - 0: IDENT@2657..2658 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@2658..2660 ">" [] [Whitespace(" ")] - 3: EQ@2660..2662 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@2662..2712 - 0: TS_REFERENCE_TYPE@2662..2664 - 0: JS_REFERENCE_IDENTIFIER@2662..2664 - 0: IDENT@2662..2664 "T" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@2664..2672 "extends" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@2672..2698 - 0: JS_REFERENCE_IDENTIFIER@2672..2680 - 0: IDENT@2672..2680 "IsNumber" [] [] - 1: TS_TYPE_ARGUMENTS@2680..2698 - 0: L_ANGLE@2680..2681 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@2681..2696 - 0: TS_PARENTHESIZED_TYPE@2681..2696 - 0: L_PAREN@2681..2682 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2682..2695 - 0: L_PAREN@2682..2683 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2683..2694 - 0: L_PAREN@2683..2684 "(" [] [] - 1: TS_PARENTHESIZED_TYPE@2684..2693 - 0: L_PAREN@2684..2685 "(" [] [] - 1: TS_INFER_TYPE@2685..2692 - 0: INFER_KW@2685..2691 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2691..2692 - 0: IDENT@2691..2692 "N" [] [] - 2: (empty) - 2: R_PAREN@2692..2693 ")" [] [] - 2: R_PAREN@2693..2694 ")" [] [] - 2: R_PAREN@2694..2695 ")" [] [] - 2: R_PAREN@2695..2696 ")" [] [] - 2: R_ANGLE@2696..2698 ">" [] [Whitespace(" ")] - 3: QUESTION@2698..2700 "?" [] [Whitespace(" ")] - 4: TS_BOOLEAN_LITERAL_TYPE@2700..2705 - 0: TRUE_KW@2700..2705 "true" [] [Whitespace(" ")] - 5: COLON@2705..2707 ":" [] [Whitespace(" ")] - 6: TS_BOOLEAN_LITERAL_TYPE@2707..2712 - 0: FALSE_KW@2707..2712 "false" [] [] - 5: SEMICOLON@2712..2713 ";" [] [] - 32: TS_TYPE_ALIAS_DECLARATION@2713..2836 - 0: TYPE_KW@2713..2719 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@2719..2726 - 0: IDENT@2719..2726 "Prepend" [] [] - 2: TS_TYPE_PARAMETERS@2726..2747 - 0: L_ANGLE@2726..2727 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@2727..2745 - 0: TS_TYPE_PARAMETER@2727..2728 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2727..2727 - 1: TS_TYPE_PARAMETER_NAME@2727..2728 - 0: IDENT@2727..2728 "E" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@2728..2730 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@2730..2745 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2730..2730 - 1: TS_TYPE_PARAMETER_NAME@2730..2732 - 0: IDENT@2730..2732 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@2732..2745 - 0: EXTENDS_KW@2732..2740 "extends" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@2740..2745 - 0: TS_ANY_TYPE@2740..2743 - 0: ANY_KW@2740..2743 "any" [] [] - 1: L_BRACK@2743..2744 "[" [] [] - 2: R_BRACK@2744..2745 "]" [] [] - 3: (empty) - 2: R_ANGLE@2745..2747 ">" [] [Whitespace(" ")] - 3: EQ@2747..2748 "=" [] [] - 4: TS_CONDITIONAL_TYPE@2748..2835 - 0: TS_PARENTHESIZED_TYPE@2748..2784 - 0: L_PAREN@2748..2754 "(" [Newline("\n"), Whitespace(" ")] [] - 1: TS_FUNCTION_TYPE@2754..2782 - 0: (empty) - 1: JS_PARAMETERS@2754..2776 - 0: L_PAREN@2754..2755 "(" [] [] - 1: JS_PARAMETER_LIST@2755..2774 - 0: JS_FORMAL_PARAMETER@2755..2762 - 0: JS_DECORATOR_LIST@2755..2755 - 1: JS_IDENTIFIER_BINDING@2755..2759 - 0: IDENT@2755..2759 "head" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@2759..2762 - 0: COLON@2759..2761 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@2761..2762 - 0: JS_REFERENCE_IDENTIFIER@2761..2762 - 0: IDENT@2761..2762 "E" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@2762..2764 "," [] [Whitespace(" ")] - 2: JS_REST_PARAMETER@2764..2774 - 0: JS_DECORATOR_LIST@2764..2764 - 1: DOT3@2764..2767 "..." [] [] - 2: JS_IDENTIFIER_BINDING@2767..2771 - 0: IDENT@2767..2771 "args" [] [] - 3: TS_TYPE_ANNOTATION@2771..2774 - 0: COLON@2771..2773 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@2773..2774 - 0: JS_REFERENCE_IDENTIFIER@2773..2774 - 0: IDENT@2773..2774 "T" [] [] - 1: (empty) - 2: R_PAREN@2774..2776 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2776..2779 "=>" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@2779..2782 - 0: ANY_KW@2779..2782 "any" [] [] - 2: R_PAREN@2782..2784 ")" [] [Whitespace(" ")] - 1: EXTENDS_KW@2784..2792 "extends" [] [Whitespace(" ")] - 2: TS_PARENTHESIZED_TYPE@2792..2819 - 0: L_PAREN@2792..2793 "(" [] [] - 1: TS_FUNCTION_TYPE@2793..2818 - 0: (empty) - 1: JS_PARAMETERS@2793..2812 - 0: L_PAREN@2793..2794 "(" [] [] - 1: JS_PARAMETER_LIST@2794..2810 - 0: JS_REST_PARAMETER@2794..2810 - 0: JS_DECORATOR_LIST@2794..2794 - 1: DOT3@2794..2797 "..." [] [] - 2: JS_IDENTIFIER_BINDING@2797..2801 - 0: IDENT@2797..2801 "args" [] [] - 3: TS_TYPE_ANNOTATION@2801..2810 - 0: COLON@2801..2803 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@2803..2810 - 0: INFER_KW@2803..2809 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@2809..2810 - 0: IDENT@2809..2810 "U" [] [] - 2: (empty) - 2: R_PAREN@2810..2812 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@2812..2815 "=>" [] [Whitespace(" ")] - 3: TS_ANY_TYPE@2815..2818 - 0: ANY_KW@2815..2818 "any" [] [] - 2: R_PAREN@2818..2819 ")" [] [] - 3: QUESTION@2819..2826 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@2826..2827 - 0: JS_REFERENCE_IDENTIFIER@2826..2827 - 0: IDENT@2826..2827 "U" [] [] - 1: (empty) - 5: COLON@2827..2834 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 6: TS_REFERENCE_TYPE@2834..2835 - 0: JS_REFERENCE_IDENTIFIER@2834..2835 - 0: IDENT@2834..2835 "T" [] [] - 1: (empty) - 5: SEMICOLON@2835..2836 ";" [] [] - 4: EOF@2836..2837 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast deleted file mode 100644 index 56e0081cc085..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast +++ /dev/null @@ -1,199 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@9..11 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], - extends_type: TsInferType { - infer_token: INFER_KW@19..25 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@25..27 "B" [] [Whitespace(" ")], - }, - constraint: missing (optional), - }, - question_mark_token: QUESTION@27..29 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@29..31 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@31..33 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@33..38 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@39..45 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@45..47 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@47..49 "=" [] [Whitespace(" ")], - ty: TsConditionalType { - check_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@49..51 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - extends_token: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")], - extends_type: TsObjectType { - l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@61..62 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@62..64 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@64..70 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@70..71 "U" [] [], - }, - constraint: missing (optional), - }, - }, - separator_token: SEMICOLON@71..73 ";" [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@73..74 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@74..76 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@76..82 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@82..83 "U" [] [], - }, - constraint: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@83..85 "}" [] [Whitespace(" ")], - }, - question_mark_token: QUESTION@85..87 "?" [] [Whitespace(" ")], - true_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@87..89 "U" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - colon_token: COLON@89..91 ":" [] [Whitespace(" ")], - false_type: TsNeverType { - never_token: NEVER_KW@91..96 "never" [] [], - }, - }, - semicolon_token: SEMICOLON@96..97 ";" [] [], - }, - ], - eof_token: EOF@97..98 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..98 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..97 - 0: TS_TYPE_ALIAS_DECLARATION@0..39 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@9..38 - 0: TS_REFERENCE_TYPE@9..11 - 0: JS_REFERENCE_IDENTIFIER@9..11 - 0: IDENT@9..11 "A" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] - 2: TS_INFER_TYPE@19..27 - 0: INFER_KW@19..25 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@25..27 - 0: IDENT@25..27 "B" [] [Whitespace(" ")] - 2: (empty) - 3: QUESTION@27..29 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@29..31 - 0: JS_REFERENCE_IDENTIFIER@29..31 - 0: IDENT@29..31 "B" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@31..33 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@33..38 - 0: NEVER_KW@33..38 "never" [] [] - 5: SEMICOLON@38..39 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@39..97 - 0: TYPE_KW@39..45 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@45..47 - 0: IDENT@45..47 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@47..49 "=" [] [Whitespace(" ")] - 4: TS_CONDITIONAL_TYPE@49..96 - 0: TS_REFERENCE_TYPE@49..51 - 0: JS_REFERENCE_IDENTIFIER@49..51 - 0: IDENT@49..51 "A" [] [Whitespace(" ")] - 1: (empty) - 1: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@59..85 - 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@61..83 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@61..73 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@61..62 - 0: IDENT@61..62 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@62..71 - 0: COLON@62..64 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@64..71 - 0: INFER_KW@64..70 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@70..71 - 0: IDENT@70..71 "U" [] [] - 2: (empty) - 4: SEMICOLON@71..73 ";" [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@73..83 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@73..74 - 0: IDENT@73..74 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@74..83 - 0: COLON@74..76 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@76..83 - 0: INFER_KW@76..82 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@82..83 - 0: IDENT@82..83 "U" [] [] - 2: (empty) - 4: (empty) - 2: R_CURLY@83..85 "}" [] [Whitespace(" ")] - 3: QUESTION@85..87 "?" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@87..89 - 0: JS_REFERENCE_IDENTIFIER@87..89 - 0: IDENT@87..89 "U" [] [Whitespace(" ")] - 1: (empty) - 5: COLON@89..91 ":" [] [Whitespace(" ")] - 6: TS_NEVER_TYPE@91..96 - 0: NEVER_KW@91..96 "never" [] [] - 5: SEMICOLON@96..97 ";" [] [] - 4: EOF@97..98 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.rast b/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.rast deleted file mode 100644 index 52e83d4193ea..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.rast +++ /dev/null @@ -1,295 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..1 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@1..2 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@2..3 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@3..4 ">" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@4..6 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@6..7 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..8 "c" [] [], - }, - }, - ], - r_paren_token: R_PAREN@8..9 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..12 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@12..13 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@13..14 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@14..15 ">" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@15..17 "?." [] [], - l_brack_token: L_BRACK@17..18 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..19 "c" [] [], - }, - }, - r_brack_token: R_BRACK@19..20 "]" [] [], - }, - semicolon_token: SEMICOLON@20..21 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@21..23 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..24 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@24..25 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@25..26 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@26..27 ">" [] [], - }, - }, - r_paren_token: R_PAREN@27..28 ")" [] [], - }, - operator_token: DOT@28..29 "." [] [], - member: JsName { - value_token: IDENT@29..30 "c" [] [], - }, - }, - semicolon_token: SEMICOLON@30..31 ";" [] [], - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@31..33 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..34 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@34..35 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - }, - r_paren_token: R_PAREN@37..38 ")" [] [], - }, - operator_token: QUESTIONDOT@38..40 "?." [] [], - member: JsName { - value_token: IDENT@40..41 "c" [] [], - }, - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - JsExpressionStatement { - expression: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..45 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@45..46 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@46..47 "b" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@47..48 ">" [] [], - }, - }, - r_paren_token: R_PAREN@48..49 ")" [] [], - }, - optional_chain_token: QUESTIONDOT@49..51 "?." [] [], - l_brack_token: L_BRACK@51..52 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@52..53 "c" [] [], - }, - }, - r_brack_token: R_BRACK@53..54 "]" [] [], - }, - semicolon_token: SEMICOLON@54..55 ";" [] [], - }, - ], - eof_token: EOF@55..56 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..56 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..55 - 0: JS_EXPRESSION_STATEMENT@0..10 - 0: JS_CALL_EXPRESSION@0..9 - 0: TS_INSTANTIATION_EXPRESSION@0..4 - 0: JS_IDENTIFIER_EXPRESSION@0..1 - 0: JS_REFERENCE_IDENTIFIER@0..1 - 0: IDENT@0..1 "f" [] [] - 1: TS_TYPE_ARGUMENTS@1..4 - 0: L_ANGLE@1..2 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@2..3 - 0: TS_REFERENCE_TYPE@2..3 - 0: JS_REFERENCE_IDENTIFIER@2..3 - 0: IDENT@2..3 "b" [] [] - 1: (empty) - 2: R_ANGLE@3..4 ">" [] [] - 1: QUESTIONDOT@4..6 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@6..9 - 0: L_PAREN@6..7 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@7..8 - 0: JS_IDENTIFIER_EXPRESSION@7..8 - 0: JS_REFERENCE_IDENTIFIER@7..8 - 0: IDENT@7..8 "c" [] [] - 2: R_PAREN@8..9 ")" [] [] - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@10..21 - 0: JS_COMPUTED_MEMBER_EXPRESSION@10..20 - 0: TS_INSTANTIATION_EXPRESSION@10..15 - 0: JS_IDENTIFIER_EXPRESSION@10..12 - 0: JS_REFERENCE_IDENTIFIER@10..12 - 0: IDENT@10..12 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@12..15 - 0: L_ANGLE@12..13 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@13..14 - 0: TS_REFERENCE_TYPE@13..14 - 0: JS_REFERENCE_IDENTIFIER@13..14 - 0: IDENT@13..14 "b" [] [] - 1: (empty) - 2: R_ANGLE@14..15 ">" [] [] - 1: QUESTIONDOT@15..17 "?." [] [] - 2: L_BRACK@17..18 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@18..19 - 0: JS_REFERENCE_IDENTIFIER@18..19 - 0: IDENT@18..19 "c" [] [] - 4: R_BRACK@19..20 "]" [] [] - 1: SEMICOLON@20..21 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@21..31 - 0: JS_STATIC_MEMBER_EXPRESSION@21..30 - 0: JS_PARENTHESIZED_EXPRESSION@21..28 - 0: L_PAREN@21..23 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@23..27 - 0: JS_IDENTIFIER_EXPRESSION@23..24 - 0: JS_REFERENCE_IDENTIFIER@23..24 - 0: IDENT@23..24 "f" [] [] - 1: TS_TYPE_ARGUMENTS@24..27 - 0: L_ANGLE@24..25 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@25..26 - 0: TS_REFERENCE_TYPE@25..26 - 0: JS_REFERENCE_IDENTIFIER@25..26 - 0: IDENT@25..26 "b" [] [] - 1: (empty) - 2: R_ANGLE@26..27 ">" [] [] - 2: R_PAREN@27..28 ")" [] [] - 1: DOT@28..29 "." [] [] - 2: JS_NAME@29..30 - 0: IDENT@29..30 "c" [] [] - 1: SEMICOLON@30..31 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@31..42 - 0: JS_STATIC_MEMBER_EXPRESSION@31..41 - 0: JS_PARENTHESIZED_EXPRESSION@31..38 - 0: L_PAREN@31..33 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@33..37 - 0: JS_IDENTIFIER_EXPRESSION@33..34 - 0: JS_REFERENCE_IDENTIFIER@33..34 - 0: IDENT@33..34 "f" [] [] - 1: TS_TYPE_ARGUMENTS@34..37 - 0: L_ANGLE@34..35 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@35..36 - 0: TS_REFERENCE_TYPE@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "b" [] [] - 1: (empty) - 2: R_ANGLE@36..37 ">" [] [] - 2: R_PAREN@37..38 ")" [] [] - 1: QUESTIONDOT@38..40 "?." [] [] - 2: JS_NAME@40..41 - 0: IDENT@40..41 "c" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@42..55 - 0: JS_COMPUTED_MEMBER_EXPRESSION@42..54 - 0: JS_PARENTHESIZED_EXPRESSION@42..49 - 0: L_PAREN@42..44 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@44..48 - 0: JS_IDENTIFIER_EXPRESSION@44..45 - 0: JS_REFERENCE_IDENTIFIER@44..45 - 0: IDENT@44..45 "f" [] [] - 1: TS_TYPE_ARGUMENTS@45..48 - 0: L_ANGLE@45..46 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@46..47 - 0: TS_REFERENCE_TYPE@46..47 - 0: JS_REFERENCE_IDENTIFIER@46..47 - 0: IDENT@46..47 "b" [] [] - 1: (empty) - 2: R_ANGLE@47..48 ">" [] [] - 2: R_PAREN@48..49 ")" [] [] - 1: QUESTIONDOT@49..51 "?." [] [] - 2: L_BRACK@51..52 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@52..53 - 0: JS_REFERENCE_IDENTIFIER@52..53 - 0: IDENT@52..53 "c" [] [] - 4: R_BRACK@53..54 "]" [] [] - 1: SEMICOLON@54..55 ";" [] [] - 4: EOF@55..56 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast b/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast deleted file mode 100644 index 8db2df271ac4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast +++ /dev/null @@ -1,1678 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..7 "f1" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@9..11 "fx" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@11..12 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@12..18 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@18..19 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@19..20 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@25..28 "f2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..32 "fx" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@32..33 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@33..39 "string" [] [], - }, - COMMA@39..41 "," [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@41..47 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@47..48 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@48..49 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@54..57 "f3" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@57..59 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@59..61 "fx" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@61..62 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@62..68 "'test'" [] [], - }, - r_brack_token: R_BRACK@68..69 "]" [] [], - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@69..70 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@70..76 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@76..77 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@77..78 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@78..85 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@85..88 "a2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@88..90 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@90..91 "f" [] [], - }, - }, - operator_token: DOT@91..92 "." [] [], - member: JsName { - value_token: IDENT@92..93 "g" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@93..94 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@94..100 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@100..101 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@101..119 ";" [] [Whitespace(" "), Comments("// () => number")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@119..126 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@126..129 "a5" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@129..131 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@131..132 "f" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@132..133 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@133..136 "'g'" [] [], - }, - r_brack_token: R_BRACK@136..137 "]" [] [], - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@137..138 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@138..144 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@144..145 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@145..163 ";" [] [Whitespace(" "), Comments("// () => number")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@163..170 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@170..173 "a7" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@173..175 "=" [] [Whitespace(" ")], - expression: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@175..176 "(" [] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@176..177 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@177..178 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@178..184 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@184..185 ">" [] [], - }, - }, - r_paren_token: R_PAREN@185..186 ")" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@186..187 "[" [] [], - member: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@187..190 "'g'" [] [], - }, - r_brack_token: R_BRACK@190..191 "]" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@191..192 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@192..199 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@199..202 "a6" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@202..204 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@204..205 "f" [] [], - }, - }, - operator_token: L_ANGLE@205..206 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@206..212 "number" [] [], - }, - }, - }, - operator_token: R_ANGLE@212..213 ">" [] [], - right: JsArrayExpression { - l_brack_token: L_BRACK@213..214 "[" [] [], - elements: JsArrayElementList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@214..217 "'g'" [] [], - }, - ], - r_brack_token: R_BRACK@217..218 "]" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@218..234 ";" [] [Whitespace(" "), Comments("// type Error")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@234..241 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@241..244 "b2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@244..246 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@246..247 "f" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@247..249 "?." [] [], - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@249..250 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@250..256 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@256..257 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@257..258 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@258..259 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@259..260 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@260..267 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@267..270 "b3" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@270..272 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@272..273 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@273..274 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@274..280 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@280..281 ">" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@281..283 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@283..284 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@284..285 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@285..286 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@286..293 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@293..296 "b4" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@296..298 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@298..299 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@299..300 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@300..306 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@306..307 ">" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@307..309 "?." [] [], - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@309..310 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@310..316 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@316..317 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@317..318 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@318..319 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@319..363 ";" [] [Whitespace(" "), Comments("// Type Error, expect ...")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@363..370 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@370..373 "x1" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@373..375 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@375..376 "f" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@376..377 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@377..381 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@381..382 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@382..384 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsBooleanLiteralExpression { - value_token: TRUE_KW@384..388 "true" [] [], - }, - ], - r_paren_token: R_PAREN@388..389 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@389..390 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@390..397 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@397..400 "x2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@400..402 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@402..403 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@403..404 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@404..408 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@408..409 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@409..414 "true" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@414..415 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@415..422 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@422..425 "x3" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@425..427 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@427..428 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@428..429 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@429..433 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@433..434 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@434..435 ";" [] [], - }, - JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@435..440 "true" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@440..441 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@441..443 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@443..444 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@444..445 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@445..446 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@446..447 ">" [] [], - }, - }, - r_paren_token: R_PAREN@447..448 ")" [] [], - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@448..449 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@449..450 "K" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@450..451 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@451..452 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@452..454 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@454..455 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@455..456 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@456..457 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@457..458 ">" [] [], - }, - }, - r_paren_token: R_PAREN@458..459 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@459..460 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@460..461 "K" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@461..462 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@462..463 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@463..464 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@464..465 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: TsInstantiationExpression { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@465..467 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@467..468 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@468..469 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@469..470 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@470..471 ">" [] [], - }, - }, - r_paren_token: R_PAREN@471..472 ")" [] [], - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@472..473 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@473..474 "K" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@474..475 ">" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@475..477 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@477..478 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@478..479 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@479..480 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@480..482 "(" [Newline("\n")] [], - expression: TsInstantiationExpression { - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@482..483 "a" [] [], - }, - }, - operator_token: QUESTIONDOT@483..485 "?." [] [], - member: JsName { - value_token: IDENT@485..486 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@486..487 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@487..488 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@488..489 ">" [] [], - }, - }, - r_paren_token: R_PAREN@489..490 ")" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@490..491 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@491..492 "K" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@492..493 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@493..494 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@494..495 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@495..496 ";" [] [], - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@496..501 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@501..502 "(" [] [], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@502..503 "a" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@503..504 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@504..505 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@505..506 ">" [] [], - }, - }, - r_paren_token: R_PAREN@506..507 ")" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@507..508 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@508..509 "K" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@509..510 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@510..511 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@511..512 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@512..513 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@513..515 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@515..516 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@516..517 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@517..518 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@518..519 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@519..520 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@520..522 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")], - return_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@525..526 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - ], - r_angle_token: R_ANGLE@526..527 ">" [] [], - }, - }, - optional_chain_token: QUESTIONDOT@527..529 "?." [] [], - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@529..530 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@530..531 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@531..532 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@532..534 "f" [Newline("\n")] [], - }, - }, - optional_chain_token: QUESTIONDOT@534..536 "?." [] [], - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@536..537 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@537..538 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@538..539 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@539..540 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@540..541 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@541..543 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@543..546 "=>" [] [Whitespace(" ")], - return_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@546..547 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - ], - r_angle_token: R_ANGLE@547..548 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@548..549 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@549..550 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@550..551 ";" [] [], - }, - JsExpressionStatement { - expression: JsConditionalExpression { - test: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@551..553 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@553..554 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@554..555 "x" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@555..557 ">" [] [Whitespace(" ")], - }, - }, - question_mark_token: QUESTION@557..559 "?" [] [Whitespace(" ")], - consequent: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@559..560 "g" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@560..561 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@561..562 "y" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@562..564 ">" [] [Whitespace(" ")], - }, - }, - colon_token: COLON@564..566 ":" [] [Whitespace(" ")], - alternate: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@566..567 "h" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@567..568 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@568..569 "z" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@569..570 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@570..571 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrayExpression { - l_brack_token: L_BRACK@571..573 "[" [Newline("\n")] [], - elements: JsArrayElementList [ - TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@573..574 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@574..575 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@575..576 "x" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@576..577 ">" [] [], - }, - }, - ], - r_brack_token: R_BRACK@577..578 "]" [] [], - }, - semicolon_token: SEMICOLON@578..579 ";" [] [], - }, - JsBlockStatement { - l_curly_token: L_CURLY@579..582 "{" [Newline("\n")] [Whitespace(" ")], - statements: JsStatementList [ - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@582..583 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@583..584 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@584..585 "x" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@585..587 ">" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@587..588 "}" [] [], - }, - ], - eof_token: EOF@588..589 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..589 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..588 - 0: JS_VARIABLE_STATEMENT@0..20 - 0: JS_VARIABLE_DECLARATION@0..19 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..19 - 0: JS_VARIABLE_DECLARATOR@4..19 - 0: JS_IDENTIFIER_BINDING@4..7 - 0: IDENT@4..7 "f1" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@7..19 - 0: EQ@7..9 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@9..19 - 0: JS_IDENTIFIER_EXPRESSION@9..11 - 0: JS_REFERENCE_IDENTIFIER@9..11 - 0: IDENT@9..11 "fx" [] [] - 1: TS_TYPE_ARGUMENTS@11..19 - 0: L_ANGLE@11..12 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@12..18 - 0: TS_STRING_TYPE@12..18 - 0: STRING_KW@12..18 "string" [] [] - 2: R_ANGLE@18..19 ">" [] [] - 1: SEMICOLON@19..20 ";" [] [] - 1: JS_VARIABLE_STATEMENT@20..49 - 0: JS_VARIABLE_DECLARATION@20..48 - 0: (empty) - 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@25..48 - 0: JS_VARIABLE_DECLARATOR@25..48 - 0: JS_IDENTIFIER_BINDING@25..28 - 0: IDENT@25..28 "f2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@28..48 - 0: EQ@28..30 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@30..48 - 0: JS_IDENTIFIER_EXPRESSION@30..32 - 0: JS_REFERENCE_IDENTIFIER@30..32 - 0: IDENT@30..32 "fx" [] [] - 1: TS_TYPE_ARGUMENTS@32..48 - 0: L_ANGLE@32..33 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@33..47 - 0: TS_STRING_TYPE@33..39 - 0: STRING_KW@33..39 "string" [] [] - 1: COMMA@39..41 "," [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@41..47 - 0: NUMBER_KW@41..47 "number" [] [] - 2: R_ANGLE@47..48 ">" [] [] - 1: SEMICOLON@48..49 ";" [] [] - 2: JS_VARIABLE_STATEMENT@49..78 - 0: JS_VARIABLE_DECLARATION@49..77 - 0: (empty) - 1: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@54..77 - 0: JS_VARIABLE_DECLARATOR@54..77 - 0: JS_IDENTIFIER_BINDING@54..57 - 0: IDENT@54..57 "f3" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@57..77 - 0: EQ@57..59 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@59..77 - 0: JS_COMPUTED_MEMBER_EXPRESSION@59..69 - 0: JS_IDENTIFIER_EXPRESSION@59..61 - 0: JS_REFERENCE_IDENTIFIER@59..61 - 0: IDENT@59..61 "fx" [] [] - 1: (empty) - 2: L_BRACK@61..62 "[" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@62..68 - 0: JS_STRING_LITERAL@62..68 "'test'" [] [] - 4: R_BRACK@68..69 "]" [] [] - 1: TS_TYPE_ARGUMENTS@69..77 - 0: L_ANGLE@69..70 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@70..76 - 0: TS_STRING_TYPE@70..76 - 0: STRING_KW@70..76 "string" [] [] - 2: R_ANGLE@76..77 ">" [] [] - 1: SEMICOLON@77..78 ";" [] [] - 3: JS_VARIABLE_STATEMENT@78..119 - 0: JS_VARIABLE_DECLARATION@78..101 - 0: (empty) - 1: CONST_KW@78..85 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@85..101 - 0: JS_VARIABLE_DECLARATOR@85..101 - 0: JS_IDENTIFIER_BINDING@85..88 - 0: IDENT@85..88 "a2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@88..101 - 0: EQ@88..90 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@90..101 - 0: JS_STATIC_MEMBER_EXPRESSION@90..93 - 0: JS_IDENTIFIER_EXPRESSION@90..91 - 0: JS_REFERENCE_IDENTIFIER@90..91 - 0: IDENT@90..91 "f" [] [] - 1: DOT@91..92 "." [] [] - 2: JS_NAME@92..93 - 0: IDENT@92..93 "g" [] [] - 1: TS_TYPE_ARGUMENTS@93..101 - 0: L_ANGLE@93..94 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@94..100 - 0: TS_NUMBER_TYPE@94..100 - 0: NUMBER_KW@94..100 "number" [] [] - 2: R_ANGLE@100..101 ">" [] [] - 1: SEMICOLON@101..119 ";" [] [Whitespace(" "), Comments("// () => number")] - 4: JS_VARIABLE_STATEMENT@119..163 - 0: JS_VARIABLE_DECLARATION@119..145 - 0: (empty) - 1: CONST_KW@119..126 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@126..145 - 0: JS_VARIABLE_DECLARATOR@126..145 - 0: JS_IDENTIFIER_BINDING@126..129 - 0: IDENT@126..129 "a5" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@129..145 - 0: EQ@129..131 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@131..145 - 0: JS_COMPUTED_MEMBER_EXPRESSION@131..137 - 0: JS_IDENTIFIER_EXPRESSION@131..132 - 0: JS_REFERENCE_IDENTIFIER@131..132 - 0: IDENT@131..132 "f" [] [] - 1: (empty) - 2: L_BRACK@132..133 "[" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@133..136 - 0: JS_STRING_LITERAL@133..136 "'g'" [] [] - 4: R_BRACK@136..137 "]" [] [] - 1: TS_TYPE_ARGUMENTS@137..145 - 0: L_ANGLE@137..138 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@138..144 - 0: TS_NUMBER_TYPE@138..144 - 0: NUMBER_KW@138..144 "number" [] [] - 2: R_ANGLE@144..145 ">" [] [] - 1: SEMICOLON@145..163 ";" [] [Whitespace(" "), Comments("// () => number")] - 5: JS_VARIABLE_STATEMENT@163..192 - 0: JS_VARIABLE_DECLARATION@163..191 - 0: (empty) - 1: CONST_KW@163..170 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@170..191 - 0: JS_VARIABLE_DECLARATOR@170..191 - 0: JS_IDENTIFIER_BINDING@170..173 - 0: IDENT@170..173 "a7" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@173..191 - 0: EQ@173..175 "=" [] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@175..191 - 0: JS_PARENTHESIZED_EXPRESSION@175..186 - 0: L_PAREN@175..176 "(" [] [] - 1: TS_INSTANTIATION_EXPRESSION@176..185 - 0: JS_IDENTIFIER_EXPRESSION@176..177 - 0: JS_REFERENCE_IDENTIFIER@176..177 - 0: IDENT@176..177 "f" [] [] - 1: TS_TYPE_ARGUMENTS@177..185 - 0: L_ANGLE@177..178 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@178..184 - 0: TS_NUMBER_TYPE@178..184 - 0: NUMBER_KW@178..184 "number" [] [] - 2: R_ANGLE@184..185 ">" [] [] - 2: R_PAREN@185..186 ")" [] [] - 1: (empty) - 2: L_BRACK@186..187 "[" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@187..190 - 0: JS_STRING_LITERAL@187..190 "'g'" [] [] - 4: R_BRACK@190..191 "]" [] [] - 1: SEMICOLON@191..192 ";" [] [] - 6: JS_VARIABLE_STATEMENT@192..234 - 0: JS_VARIABLE_DECLARATION@192..218 - 0: (empty) - 1: CONST_KW@192..199 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@199..218 - 0: JS_VARIABLE_DECLARATOR@199..218 - 0: JS_IDENTIFIER_BINDING@199..202 - 0: IDENT@199..202 "a6" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@202..218 - 0: EQ@202..204 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@204..218 - 0: JS_BINARY_EXPRESSION@204..212 - 0: JS_IDENTIFIER_EXPRESSION@204..205 - 0: JS_REFERENCE_IDENTIFIER@204..205 - 0: IDENT@204..205 "f" [] [] - 1: L_ANGLE@205..206 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@206..212 - 0: JS_REFERENCE_IDENTIFIER@206..212 - 0: IDENT@206..212 "number" [] [] - 1: R_ANGLE@212..213 ">" [] [] - 2: JS_ARRAY_EXPRESSION@213..218 - 0: L_BRACK@213..214 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@214..217 - 0: JS_STRING_LITERAL_EXPRESSION@214..217 - 0: JS_STRING_LITERAL@214..217 "'g'" [] [] - 2: R_BRACK@217..218 "]" [] [] - 1: SEMICOLON@218..234 ";" [] [Whitespace(" "), Comments("// type Error")] - 7: JS_VARIABLE_STATEMENT@234..260 - 0: JS_VARIABLE_DECLARATION@234..259 - 0: (empty) - 1: CONST_KW@234..241 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@241..259 - 0: JS_VARIABLE_DECLARATOR@241..259 - 0: JS_IDENTIFIER_BINDING@241..244 - 0: IDENT@241..244 "b2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@244..259 - 0: EQ@244..246 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@246..259 - 0: JS_IDENTIFIER_EXPRESSION@246..247 - 0: JS_REFERENCE_IDENTIFIER@246..247 - 0: IDENT@246..247 "f" [] [] - 1: QUESTIONDOT@247..249 "?." [] [] - 2: TS_TYPE_ARGUMENTS@249..257 - 0: L_ANGLE@249..250 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@250..256 - 0: TS_NUMBER_TYPE@250..256 - 0: NUMBER_KW@250..256 "number" [] [] - 2: R_ANGLE@256..257 ">" [] [] - 3: JS_CALL_ARGUMENTS@257..259 - 0: L_PAREN@257..258 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@258..258 - 2: R_PAREN@258..259 ")" [] [] - 1: SEMICOLON@259..260 ";" [] [] - 8: JS_VARIABLE_STATEMENT@260..286 - 0: JS_VARIABLE_DECLARATION@260..285 - 0: (empty) - 1: CONST_KW@260..267 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@267..285 - 0: JS_VARIABLE_DECLARATOR@267..285 - 0: JS_IDENTIFIER_BINDING@267..270 - 0: IDENT@267..270 "b3" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@270..285 - 0: EQ@270..272 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@272..285 - 0: TS_INSTANTIATION_EXPRESSION@272..281 - 0: JS_IDENTIFIER_EXPRESSION@272..273 - 0: JS_REFERENCE_IDENTIFIER@272..273 - 0: IDENT@272..273 "f" [] [] - 1: TS_TYPE_ARGUMENTS@273..281 - 0: L_ANGLE@273..274 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@274..280 - 0: TS_NUMBER_TYPE@274..280 - 0: NUMBER_KW@274..280 "number" [] [] - 2: R_ANGLE@280..281 ">" [] [] - 1: QUESTIONDOT@281..283 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@283..285 - 0: L_PAREN@283..284 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@284..284 - 2: R_PAREN@284..285 ")" [] [] - 1: SEMICOLON@285..286 ";" [] [] - 9: JS_VARIABLE_STATEMENT@286..363 - 0: JS_VARIABLE_DECLARATION@286..319 - 0: (empty) - 1: CONST_KW@286..293 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@293..319 - 0: JS_VARIABLE_DECLARATOR@293..319 - 0: JS_IDENTIFIER_BINDING@293..296 - 0: IDENT@293..296 "b4" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@296..319 - 0: EQ@296..298 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@298..319 - 0: TS_INSTANTIATION_EXPRESSION@298..307 - 0: JS_IDENTIFIER_EXPRESSION@298..299 - 0: JS_REFERENCE_IDENTIFIER@298..299 - 0: IDENT@298..299 "f" [] [] - 1: TS_TYPE_ARGUMENTS@299..307 - 0: L_ANGLE@299..300 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@300..306 - 0: TS_NUMBER_TYPE@300..306 - 0: NUMBER_KW@300..306 "number" [] [] - 2: R_ANGLE@306..307 ">" [] [] - 1: QUESTIONDOT@307..309 "?." [] [] - 2: TS_TYPE_ARGUMENTS@309..317 - 0: L_ANGLE@309..310 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@310..316 - 0: TS_NUMBER_TYPE@310..316 - 0: NUMBER_KW@310..316 "number" [] [] - 2: R_ANGLE@316..317 ">" [] [] - 3: JS_CALL_ARGUMENTS@317..319 - 0: L_PAREN@317..318 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@318..318 - 2: R_PAREN@318..319 ")" [] [] - 1: SEMICOLON@319..363 ";" [] [Whitespace(" "), Comments("// Type Error, expect ...")] - 10: JS_VARIABLE_STATEMENT@363..390 - 0: JS_VARIABLE_DECLARATION@363..389 - 0: (empty) - 1: CONST_KW@363..370 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@370..389 - 0: JS_VARIABLE_DECLARATOR@370..389 - 0: JS_IDENTIFIER_BINDING@370..373 - 0: IDENT@370..373 "x1" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@373..389 - 0: EQ@373..375 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@375..389 - 0: JS_IDENTIFIER_EXPRESSION@375..376 - 0: JS_REFERENCE_IDENTIFIER@375..376 - 0: IDENT@375..376 "f" [] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@376..382 - 0: L_ANGLE@376..377 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@377..381 - 0: TS_BOOLEAN_LITERAL_TYPE@377..381 - 0: TRUE_KW@377..381 "true" [] [] - 2: R_ANGLE@381..382 ">" [] [] - 3: JS_CALL_ARGUMENTS@382..389 - 0: L_PAREN@382..384 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@384..388 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@384..388 - 0: TRUE_KW@384..388 "true" [] [] - 2: R_PAREN@388..389 ")" [] [] - 1: SEMICOLON@389..390 ";" [] [] - 11: JS_VARIABLE_STATEMENT@390..409 - 0: JS_VARIABLE_DECLARATION@390..409 - 0: (empty) - 1: CONST_KW@390..397 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@397..409 - 0: JS_VARIABLE_DECLARATOR@397..409 - 0: JS_IDENTIFIER_BINDING@397..400 - 0: IDENT@397..400 "x2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@400..409 - 0: EQ@400..402 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@402..409 - 0: JS_IDENTIFIER_EXPRESSION@402..403 - 0: JS_REFERENCE_IDENTIFIER@402..403 - 0: IDENT@402..403 "f" [] [] - 1: TS_TYPE_ARGUMENTS@403..409 - 0: L_ANGLE@403..404 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@404..408 - 0: TS_BOOLEAN_LITERAL_TYPE@404..408 - 0: TRUE_KW@404..408 "true" [] [] - 2: R_ANGLE@408..409 ">" [] [] - 1: (empty) - 12: JS_EXPRESSION_STATEMENT@409..415 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@409..414 - 0: TRUE_KW@409..414 "true" [Newline("\n")] [] - 1: SEMICOLON@414..415 ";" [] [] - 13: JS_VARIABLE_STATEMENT@415..435 - 0: JS_VARIABLE_DECLARATION@415..434 - 0: (empty) - 1: CONST_KW@415..422 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@422..434 - 0: JS_VARIABLE_DECLARATOR@422..434 - 0: JS_IDENTIFIER_BINDING@422..425 - 0: IDENT@422..425 "x3" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@425..434 - 0: EQ@425..427 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@427..434 - 0: JS_IDENTIFIER_EXPRESSION@427..428 - 0: JS_REFERENCE_IDENTIFIER@427..428 - 0: IDENT@427..428 "f" [] [] - 1: TS_TYPE_ARGUMENTS@428..434 - 0: L_ANGLE@428..429 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@429..433 - 0: TS_BOOLEAN_LITERAL_TYPE@429..433 - 0: TRUE_KW@429..433 "true" [] [] - 2: R_ANGLE@433..434 ">" [] [] - 1: SEMICOLON@434..435 ";" [] [] - 14: JS_EXPRESSION_STATEMENT@435..441 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@435..440 - 0: TRUE_KW@435..440 "true" [Newline("\n")] [] - 1: SEMICOLON@440..441 ";" [] [] - 15: JS_EXPRESSION_STATEMENT@441..452 - 0: TS_INSTANTIATION_EXPRESSION@441..451 - 0: JS_PARENTHESIZED_EXPRESSION@441..448 - 0: L_PAREN@441..443 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@443..447 - 0: JS_IDENTIFIER_EXPRESSION@443..444 - 0: JS_REFERENCE_IDENTIFIER@443..444 - 0: IDENT@443..444 "f" [] [] - 1: TS_TYPE_ARGUMENTS@444..447 - 0: L_ANGLE@444..445 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@445..446 - 0: TS_REFERENCE_TYPE@445..446 - 0: JS_REFERENCE_IDENTIFIER@445..446 - 0: IDENT@445..446 "T" [] [] - 1: (empty) - 2: R_ANGLE@446..447 ">" [] [] - 2: R_PAREN@447..448 ")" [] [] - 1: TS_TYPE_ARGUMENTS@448..451 - 0: L_ANGLE@448..449 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@449..450 - 0: TS_REFERENCE_TYPE@449..450 - 0: JS_REFERENCE_IDENTIFIER@449..450 - 0: IDENT@449..450 "K" [] [] - 1: (empty) - 2: R_ANGLE@450..451 ">" [] [] - 1: SEMICOLON@451..452 ";" [] [] - 16: JS_EXPRESSION_STATEMENT@452..465 - 0: JS_CALL_EXPRESSION@452..464 - 0: JS_PARENTHESIZED_EXPRESSION@452..459 - 0: L_PAREN@452..454 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@454..458 - 0: JS_IDENTIFIER_EXPRESSION@454..455 - 0: JS_REFERENCE_IDENTIFIER@454..455 - 0: IDENT@454..455 "f" [] [] - 1: TS_TYPE_ARGUMENTS@455..458 - 0: L_ANGLE@455..456 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@456..457 - 0: TS_REFERENCE_TYPE@456..457 - 0: JS_REFERENCE_IDENTIFIER@456..457 - 0: IDENT@456..457 "T" [] [] - 1: (empty) - 2: R_ANGLE@457..458 ">" [] [] - 2: R_PAREN@458..459 ")" [] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@459..462 - 0: L_ANGLE@459..460 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@460..461 - 0: TS_REFERENCE_TYPE@460..461 - 0: JS_REFERENCE_IDENTIFIER@460..461 - 0: IDENT@460..461 "K" [] [] - 1: (empty) - 2: R_ANGLE@461..462 ">" [] [] - 3: JS_CALL_ARGUMENTS@462..464 - 0: L_PAREN@462..463 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@463..463 - 2: R_PAREN@463..464 ")" [] [] - 1: SEMICOLON@464..465 ";" [] [] - 17: JS_EXPRESSION_STATEMENT@465..480 - 0: JS_CALL_EXPRESSION@465..479 - 0: TS_INSTANTIATION_EXPRESSION@465..475 - 0: JS_PARENTHESIZED_EXPRESSION@465..472 - 0: L_PAREN@465..467 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@467..471 - 0: JS_IDENTIFIER_EXPRESSION@467..468 - 0: JS_REFERENCE_IDENTIFIER@467..468 - 0: IDENT@467..468 "f" [] [] - 1: TS_TYPE_ARGUMENTS@468..471 - 0: L_ANGLE@468..469 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@469..470 - 0: TS_REFERENCE_TYPE@469..470 - 0: JS_REFERENCE_IDENTIFIER@469..470 - 0: IDENT@469..470 "T" [] [] - 1: (empty) - 2: R_ANGLE@470..471 ">" [] [] - 2: R_PAREN@471..472 ")" [] [] - 1: TS_TYPE_ARGUMENTS@472..475 - 0: L_ANGLE@472..473 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@473..474 - 0: TS_REFERENCE_TYPE@473..474 - 0: JS_REFERENCE_IDENTIFIER@473..474 - 0: IDENT@473..474 "K" [] [] - 1: (empty) - 2: R_ANGLE@474..475 ">" [] [] - 1: QUESTIONDOT@475..477 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@477..479 - 0: L_PAREN@477..478 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@478..478 - 2: R_PAREN@478..479 ")" [] [] - 1: SEMICOLON@479..480 ";" [] [] - 18: JS_EXPRESSION_STATEMENT@480..496 - 0: JS_CALL_EXPRESSION@480..495 - 0: JS_PARENTHESIZED_EXPRESSION@480..490 - 0: L_PAREN@480..482 "(" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@482..489 - 0: JS_STATIC_MEMBER_EXPRESSION@482..486 - 0: JS_IDENTIFIER_EXPRESSION@482..483 - 0: JS_REFERENCE_IDENTIFIER@482..483 - 0: IDENT@482..483 "a" [] [] - 1: QUESTIONDOT@483..485 "?." [] [] - 2: JS_NAME@485..486 - 0: IDENT@485..486 "f" [] [] - 1: TS_TYPE_ARGUMENTS@486..489 - 0: L_ANGLE@486..487 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@487..488 - 0: TS_REFERENCE_TYPE@487..488 - 0: JS_REFERENCE_IDENTIFIER@487..488 - 0: IDENT@487..488 "T" [] [] - 1: (empty) - 2: R_ANGLE@488..489 ">" [] [] - 2: R_PAREN@489..490 ")" [] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@490..493 - 0: L_ANGLE@490..491 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@491..492 - 0: TS_REFERENCE_TYPE@491..492 - 0: JS_REFERENCE_IDENTIFIER@491..492 - 0: IDENT@491..492 "K" [] [] - 1: (empty) - 2: R_ANGLE@492..493 ">" [] [] - 3: JS_CALL_ARGUMENTS@493..495 - 0: L_PAREN@493..494 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@494..494 - 2: R_PAREN@494..495 ")" [] [] - 1: SEMICOLON@495..496 ";" [] [] - 19: JS_EXPRESSION_STATEMENT@496..513 - 0: JS_NEW_EXPRESSION@496..512 - 0: NEW_KW@496..501 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@501..507 - 0: L_PAREN@501..502 "(" [] [] - 1: TS_INSTANTIATION_EXPRESSION@502..506 - 0: JS_IDENTIFIER_EXPRESSION@502..503 - 0: JS_REFERENCE_IDENTIFIER@502..503 - 0: IDENT@502..503 "a" [] [] - 1: TS_TYPE_ARGUMENTS@503..506 - 0: L_ANGLE@503..504 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@504..505 - 0: TS_REFERENCE_TYPE@504..505 - 0: JS_REFERENCE_IDENTIFIER@504..505 - 0: IDENT@504..505 "T" [] [] - 1: (empty) - 2: R_ANGLE@505..506 ">" [] [] - 2: R_PAREN@506..507 ")" [] [] - 2: TS_TYPE_ARGUMENTS@507..510 - 0: L_ANGLE@507..508 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@508..509 - 0: TS_REFERENCE_TYPE@508..509 - 0: JS_REFERENCE_IDENTIFIER@508..509 - 0: IDENT@508..509 "K" [] [] - 1: (empty) - 2: R_ANGLE@509..510 ">" [] [] - 3: JS_CALL_ARGUMENTS@510..512 - 0: L_PAREN@510..511 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@511..511 - 2: R_PAREN@511..512 ")" [] [] - 1: SEMICOLON@512..513 ";" [] [] - 20: JS_EXPRESSION_STATEMENT@513..532 - 0: JS_CALL_EXPRESSION@513..531 - 0: TS_INSTANTIATION_EXPRESSION@513..527 - 0: JS_IDENTIFIER_EXPRESSION@513..515 - 0: JS_REFERENCE_IDENTIFIER@513..515 - 0: IDENT@513..515 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@515..527 - 0: L_ANGLE@515..516 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@516..526 - 0: TS_FUNCTION_TYPE@516..526 - 0: TS_TYPE_PARAMETERS@516..519 - 0: L_ANGLE@516..517 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@517..518 - 0: TS_TYPE_PARAMETER@517..518 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@517..517 - 1: TS_TYPE_PARAMETER_NAME@517..518 - 0: IDENT@517..518 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@518..519 ">" [] [] - 1: JS_PARAMETERS@519..522 - 0: L_PAREN@519..520 "(" [] [] - 1: JS_PARAMETER_LIST@520..520 - 2: R_PAREN@520..522 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")] - 3: TS_REFERENCE_TYPE@525..526 - 0: JS_REFERENCE_IDENTIFIER@525..526 - 0: IDENT@525..526 "T" [] [] - 1: (empty) - 2: R_ANGLE@526..527 ">" [] [] - 1: QUESTIONDOT@527..529 "?." [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@529..531 - 0: L_PAREN@529..530 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@530..530 - 2: R_PAREN@530..531 ")" [] [] - 1: SEMICOLON@531..532 ";" [] [] - 21: JS_EXPRESSION_STATEMENT@532..551 - 0: JS_CALL_EXPRESSION@532..550 - 0: JS_IDENTIFIER_EXPRESSION@532..534 - 0: JS_REFERENCE_IDENTIFIER@532..534 - 0: IDENT@532..534 "f" [Newline("\n")] [] - 1: QUESTIONDOT@534..536 "?." [] [] - 2: TS_TYPE_ARGUMENTS@536..548 - 0: L_ANGLE@536..537 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@537..547 - 0: TS_FUNCTION_TYPE@537..547 - 0: TS_TYPE_PARAMETERS@537..540 - 0: L_ANGLE@537..538 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@538..539 - 0: TS_TYPE_PARAMETER@538..539 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@538..538 - 1: TS_TYPE_PARAMETER_NAME@538..539 - 0: IDENT@538..539 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@539..540 ">" [] [] - 1: JS_PARAMETERS@540..543 - 0: L_PAREN@540..541 "(" [] [] - 1: JS_PARAMETER_LIST@541..541 - 2: R_PAREN@541..543 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@543..546 "=>" [] [Whitespace(" ")] - 3: TS_REFERENCE_TYPE@546..547 - 0: JS_REFERENCE_IDENTIFIER@546..547 - 0: IDENT@546..547 "T" [] [] - 1: (empty) - 2: R_ANGLE@547..548 ">" [] [] - 3: JS_CALL_ARGUMENTS@548..550 - 0: L_PAREN@548..549 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@549..549 - 2: R_PAREN@549..550 ")" [] [] - 1: SEMICOLON@550..551 ";" [] [] - 22: JS_EXPRESSION_STATEMENT@551..571 - 0: JS_CONDITIONAL_EXPRESSION@551..570 - 0: TS_INSTANTIATION_EXPRESSION@551..557 - 0: JS_IDENTIFIER_EXPRESSION@551..553 - 0: JS_REFERENCE_IDENTIFIER@551..553 - 0: IDENT@551..553 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@553..557 - 0: L_ANGLE@553..554 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@554..555 - 0: TS_REFERENCE_TYPE@554..555 - 0: JS_REFERENCE_IDENTIFIER@554..555 - 0: IDENT@554..555 "x" [] [] - 1: (empty) - 2: R_ANGLE@555..557 ">" [] [Whitespace(" ")] - 1: QUESTION@557..559 "?" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@559..564 - 0: JS_IDENTIFIER_EXPRESSION@559..560 - 0: JS_REFERENCE_IDENTIFIER@559..560 - 0: IDENT@559..560 "g" [] [] - 1: TS_TYPE_ARGUMENTS@560..564 - 0: L_ANGLE@560..561 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@561..562 - 0: TS_REFERENCE_TYPE@561..562 - 0: JS_REFERENCE_IDENTIFIER@561..562 - 0: IDENT@561..562 "y" [] [] - 1: (empty) - 2: R_ANGLE@562..564 ">" [] [Whitespace(" ")] - 3: COLON@564..566 ":" [] [Whitespace(" ")] - 4: TS_INSTANTIATION_EXPRESSION@566..570 - 0: JS_IDENTIFIER_EXPRESSION@566..567 - 0: JS_REFERENCE_IDENTIFIER@566..567 - 0: IDENT@566..567 "h" [] [] - 1: TS_TYPE_ARGUMENTS@567..570 - 0: L_ANGLE@567..568 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@568..569 - 0: TS_REFERENCE_TYPE@568..569 - 0: JS_REFERENCE_IDENTIFIER@568..569 - 0: IDENT@568..569 "z" [] [] - 1: (empty) - 2: R_ANGLE@569..570 ">" [] [] - 1: SEMICOLON@570..571 ";" [] [] - 23: JS_EXPRESSION_STATEMENT@571..579 - 0: JS_ARRAY_EXPRESSION@571..578 - 0: L_BRACK@571..573 "[" [Newline("\n")] [] - 1: JS_ARRAY_ELEMENT_LIST@573..577 - 0: TS_INSTANTIATION_EXPRESSION@573..577 - 0: JS_IDENTIFIER_EXPRESSION@573..574 - 0: JS_REFERENCE_IDENTIFIER@573..574 - 0: IDENT@573..574 "f" [] [] - 1: TS_TYPE_ARGUMENTS@574..577 - 0: L_ANGLE@574..575 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@575..576 - 0: TS_REFERENCE_TYPE@575..576 - 0: JS_REFERENCE_IDENTIFIER@575..576 - 0: IDENT@575..576 "x" [] [] - 1: (empty) - 2: R_ANGLE@576..577 ">" [] [] - 2: R_BRACK@577..578 "]" [] [] - 1: SEMICOLON@578..579 ";" [] [] - 24: JS_BLOCK_STATEMENT@579..588 - 0: L_CURLY@579..582 "{" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATEMENT_LIST@582..587 - 0: JS_EXPRESSION_STATEMENT@582..587 - 0: TS_INSTANTIATION_EXPRESSION@582..587 - 0: JS_IDENTIFIER_EXPRESSION@582..583 - 0: JS_REFERENCE_IDENTIFIER@582..583 - 0: IDENT@582..583 "f" [] [] - 1: TS_TYPE_ARGUMENTS@583..587 - 0: L_ANGLE@583..584 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@584..585 - 0: TS_REFERENCE_TYPE@584..585 - 0: JS_REFERENCE_IDENTIFIER@584..585 - 0: IDENT@584..585 "x" [] [] - 1: (empty) - 2: R_ANGLE@585..587 ">" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@587..588 "}" [] [] - 4: EOF@588..589 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast b/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast deleted file mode 100644 index 7dd611611a5d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast +++ /dev/null @@ -1,2663 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [], - }, - }, - operator_token: L_ANGLE@31..32 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..33 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@33..35 ">" [] [Whitespace(" ")], - right: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@35..40 "super" [] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@40..41 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@41..42 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - ], - r_curly_token: R_CURLY@43..46 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@46..48 "}" [Newline("\n")] [], - }, - JsExpressionStatement { - expression: JsTemplateExpression { - tag: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@48..50 "f" [Newline("\n")] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@50..51 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@51..71 "TemplateStringsArray" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@71..72 ">" [] [], - }, - l_tick_token: BACKTICK@72..73 "`" [] [], - elements: JsTemplateElementList [], - r_tick_token: BACKTICK@73..74 "`" [] [], - }, - semicolon_token: SEMICOLON@74..75 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@75..77 "f" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@77..78 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@78..79 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@79..80 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@80..81 "(" [] [], - args: JsCallArgumentList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@81..82 "1" [] [], - }, - ], - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..86 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@86..87 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@87..88 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@88..90 ">" [] [Whitespace(" ")], - }, - }, - operator_token: QUESTION2@90..93 "??" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@93..94 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@94..95 ";" [] [], - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@95..97 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@97..98 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@98..99 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@99..101 ">" [] [Whitespace(" ")], - }, - }, - operator_token: PIPE2@101..104 "||" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@104..105 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@105..106 ";" [] [], - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@106..108 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@108..109 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@109..110 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@110..112 ">" [] [Whitespace(" ")], - }, - }, - operator_token: AMP2@112..115 "&&" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@115..116 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@116..117 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@117..119 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@119..120 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@120..121 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@121..123 ">" [] [Whitespace(" ")], - }, - }, - operator_token: PIPE@123..125 "|" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@125..126 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@126..127 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@127..129 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@129..130 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@130..131 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@131..133 ">" [] [Whitespace(" ")], - }, - }, - operator_token: CARET@133..135 "^" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@135..136 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@136..137 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@137..139 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@139..140 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@140..141 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@141..143 ">" [] [Whitespace(" ")], - }, - }, - operator_token: AMP@143..145 "&" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@145..146 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@146..147 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@147..149 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@149..150 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@150..151 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@151..153 ">" [] [Whitespace(" ")], - }, - }, - operator_token: EQ2@153..156 "==" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@156..157 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@157..158 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@158..159 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@159..160 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@160..161 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@161..163 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@163..164 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@164..165 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@165..167 ">" [] [Whitespace(" ")], - }, - }, - operator_token: NEQ@167..170 "!=" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@170..171 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@171..172 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@172..173 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@173..174 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@174..175 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@175..177 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@177..178 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@178..179 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@179..181 ">" [] [Whitespace(" ")], - }, - }, - operator_token: EQ3@181..185 "===" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@185..186 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@186..187 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@187..188 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@188..189 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@189..190 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@190..192 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@192..193 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@193..194 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@194..196 ">" [] [Whitespace(" ")], - }, - }, - operator_token: NEQ2@196..200 "!==" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@200..201 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@201..202 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@202..203 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@203..204 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@204..205 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@205..207 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@207..208 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@208..209 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@209..211 ">" [] [Whitespace(" ")], - }, - }, - operator_token: LTEQ@211..214 "<=" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@214..215 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@215..216 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@216..217 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@217..218 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@218..219 ";" [] [], - }, - JsExpressionStatement { - expression: JsInstanceofExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@219..221 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@221..222 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@222..223 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@223..225 ">" [] [Whitespace(" ")], - }, - }, - instanceof_token: INSTANCEOF_KW@225..236 "instanceof" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@236..237 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@237..238 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@238..239 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@239..240 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@240..241 ";" [] [], - }, - JsExpressionStatement { - expression: JsInExpression { - property: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@241..243 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@243..244 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@244..245 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@245..247 ">" [] [Whitespace(" ")], - }, - }, - in_token: IN_KW@247..250 "in" [] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@250..251 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@251..252 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@252..253 ";" [] [], - }, - JsExpressionStatement { - expression: TsAsExpression { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@253..255 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@255..256 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@256..257 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@257..259 ">" [] [Whitespace(" ")], - }, - }, - as_token: AS_KW@259..262 "as" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@262..263 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@263..264 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@264..265 ";" [] [], - }, - JsExpressionStatement { - expression: TsSatisfiesExpression { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@265..267 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@267..268 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@268..269 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@269..271 ">" [] [Whitespace(" ")], - }, - }, - satisfies_token: SATISFIES_KW@271..281 "satisfies" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@281..282 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@282..283 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@283..284 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@284..286 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@286..287 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@287..288 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@288..290 ">" [] [Whitespace(" ")], - }, - }, - operator_token: STAR@290..292 "*" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@292..293 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@293..294 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@294..295 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@295..296 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@296..297 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@297..299 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@299..300 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@300..301 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@301..303 ">" [] [Whitespace(" ")], - }, - }, - operator_token: SLASH@303..305 "/" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@305..306 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@306..307 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@307..308 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@308..309 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@309..310 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@310..312 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@312..313 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@313..314 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@314..316 ">" [] [Whitespace(" ")], - }, - }, - operator_token: PERCENT@316..318 "%" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@318..319 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@319..320 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@320..321 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@321..322 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@322..323 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@323..325 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@325..326 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@326..327 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@327..329 ">" [] [Whitespace(" ")], - }, - }, - operator_token: STAR2@329..332 "**" [] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@332..333 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@333..334 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@334..335 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@335..336 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@336..337 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@337..340 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@340..342 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@342..344 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@344..346 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: PLUS@346..347 "+" [] [], - argument: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@347..348 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@348..349 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@349..350 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@350..351 ">" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@351..352 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@352..355 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@355..357 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@357..359 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@359..361 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: MINUS@361..362 "-" [] [], - argument: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@362..363 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@363..364 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@364..365 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@365..366 ">" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@366..367 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@367..370 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@370..372 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@372..374 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@374..376 ">" [] [Whitespace(" ")], - right: JsThisExpression { - this_token: THIS_KW@376..380 "this" [] [], - }, - }, - semicolon_token: SEMICOLON@380..381 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@381..384 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@384..386 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@386..388 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@388..390 ">" [] [Whitespace(" ")], - right: JsNullLiteralExpression { - value_token: NULL_KW@390..394 "null" [] [], - }, - }, - semicolon_token: SEMICOLON@394..395 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@395..398 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@398..400 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@400..402 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@402..404 ">" [] [Whitespace(" ")], - right: JsBooleanLiteralExpression { - value_token: TRUE_KW@404..408 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@408..409 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@409..412 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@412..414 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@414..416 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@416..418 ">" [] [Whitespace(" ")], - right: JsBooleanLiteralExpression { - value_token: FALSE_KW@418..423 "false" [] [], - }, - }, - semicolon_token: SEMICOLON@423..424 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@424..427 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@427..429 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@429..431 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@431..433 ">" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@433..434 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@434..435 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@435..438 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@438..440 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@440..442 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@442..444 ">" [] [Whitespace(" ")], - right: JsBigintLiteralExpression { - value_token: JS_BIGINT_LITERAL@444..448 "123n" [] [], - }, - }, - semicolon_token: SEMICOLON@448..449 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@449..452 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@452..454 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@454..456 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@456..458 ">" [] [Whitespace(" ")], - right: JsArrayExpression { - l_brack_token: L_BRACK@458..459 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@459..460 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@460..461 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@461..464 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@464..466 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@466..468 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@468..470 ">" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@470..471 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@471..472 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@472..473 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@476..478 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@478..480 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@480..482 ">" [] [Whitespace(" ")], - right: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@482..491 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@491..495 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@495..496 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@496..498 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@498..499 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@499..500 "}" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@500..501 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@501..504 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@504..506 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@506..508 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@508..510 ">" [] [Whitespace(" ")], - right: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@510..516 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@516..518 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@518..519 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@519..520 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@520..521 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@521..524 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@524..526 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@526..528 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@528..530 ">" [] [Whitespace(" ")], - right: JsNewExpression { - new_token: NEW_KW@530..534 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@534..535 "A" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@535..536 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@536..537 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@537..538 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@538..540 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@540..541 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@541..542 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@542..544 ">" [] [Whitespace(" ")], - }, - }, - operator_token: SLASH@544..546 "/" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@546..547 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@547..548 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@548..551 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@551..553 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@553..555 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@555..557 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: PLUS@557..558 "+" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@558..559 "1" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@559..560 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@563..565 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@565..567 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@567..569 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: MINUS@569..570 "-" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@570..571 "1" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@571..572 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@572..575 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@575..577 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@577..579 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@579..581 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: TILDE@581..582 "~" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@582..583 "1" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@583..584 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@584..587 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@587..589 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@589..591 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@591..593 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: BANG@593..594 "!" [] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@594..595 "1" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@595..596 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@596..599 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@599..601 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@601..603 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@603..605 ">" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@605..619 "someIdentifier" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@619..620 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@620..623 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@623..625 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@625..627 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@627..629 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: DELETE_KW@629..636 "delete" [] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@636..637 "a" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@637..638 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@638..643 "field" [] [], - }, - }, - r_brack_token: R_BRACK@643..644 "]" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@644..645 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@645..648 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@648..650 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@650..652 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@652..654 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: TYPEOF_KW@654..661 "typeof" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@661..668 "MyClass" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@668..669 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@669..672 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@672..674 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@674..676 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@676..678 ">" [] [Whitespace(" ")], - right: JsUnaryExpression { - operator_token: VOID_KW@678..683 "void" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@683..684 "a" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@684..685 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@685..687 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@687..688 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@688..689 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@689..691 ">" [] [Whitespace(" ")], - }, - }, - operator_token: LTEQ@691..694 "<=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@694..695 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@695..696 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@696..699 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@699..701 "<" [] [Whitespace(" ")], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@701..703 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@703..705 ">" [] [Whitespace(" ")], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@705..706 "(" [] [], - args: JsCallArgumentList [ - JsAwaitExpression { - await_token: AWAIT_KW@706..712 "await" [] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@712..713 "1" [] [], - }, - }, - ], - r_paren_token: R_PAREN@713..714 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@714..715 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@715..718 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@718..720 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@720..722 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@722..724 ">" [] [Whitespace(" ")], - right: JsImportMetaExpression { - import_token: IMPORT_KW@724..730 "import" [] [], - dot_token: DOT@730..731 "." [] [], - meta_token: META@731..735 "meta" [] [], - }, - }, - semicolon_token: SEMICOLON@735..736 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@736..739 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@739..741 "<" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@741..743 "T" [] [Whitespace(" ")], - }, - }, - }, - operator_token: R_ANGLE@743..745 ">" [] [Whitespace(" ")], - right: JsImportCallExpression { - import_token: IMPORT_KW@745..751 "import" [] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@751..752 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@752..757 "\"123\"" [] [], - }, - ], - r_paren_token: R_PAREN@757..758 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@758..759 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@759..762 "a" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@762..764 "<" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@764..766 "b" [] [Whitespace(" ")], - }, - }, - operator_token: SHR@766..769 ">>" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@769..770 "c" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@770..771 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@771..774 "f" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@774..776 "=" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@776..778 "h" [] [Whitespace(" ")], - }, - }, - operator_token: USHR@778..782 ">>>" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@782..784 "0" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@784..786 "<" [] [Whitespace(" ")], - right: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@786..788 "j" [] [Whitespace(" ")], - }, - }, - operator_token: USHR@788..792 ">>>" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@792..793 "0" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@793..794 ";" [] [], - }, - ], - eof_token: EOF@794..795 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..795 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..794 - 0: JS_CLASS_DECLARATION@0..48 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..46 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..46 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..22 - 0: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@22..25 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@23..23 - 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@25..46 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..43 - 0: JS_EXPRESSION_STATEMENT@26..43 - 0: JS_BINARY_EXPRESSION@26..42 - 0: JS_BINARY_EXPRESSION@26..33 - 0: JS_IDENTIFIER_EXPRESSION@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [] - 1: L_ANGLE@31..32 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@32..33 - 0: JS_REFERENCE_IDENTIFIER@32..33 - 0: IDENT@32..33 "T" [] [] - 1: R_ANGLE@33..35 ">" [] [Whitespace(" ")] - 2: JS_CALL_EXPRESSION@35..42 - 0: JS_SUPER_EXPRESSION@35..40 - 0: SUPER_KW@35..40 "super" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@40..42 - 0: L_PAREN@40..41 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@41..41 - 2: R_PAREN@41..42 ")" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 3: R_CURLY@43..46 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@46..48 "}" [Newline("\n")] [] - 1: JS_EXPRESSION_STATEMENT@48..75 - 0: JS_TEMPLATE_EXPRESSION@48..74 - 0: JS_IDENTIFIER_EXPRESSION@48..50 - 0: JS_REFERENCE_IDENTIFIER@48..50 - 0: IDENT@48..50 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@50..72 - 0: L_ANGLE@50..51 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@51..71 - 0: TS_REFERENCE_TYPE@51..71 - 0: JS_REFERENCE_IDENTIFIER@51..71 - 0: IDENT@51..71 "TemplateStringsArray" [] [] - 1: (empty) - 2: R_ANGLE@71..72 ">" [] [] - 2: BACKTICK@72..73 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@73..73 - 4: BACKTICK@73..74 "`" [] [] - 1: SEMICOLON@74..75 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@75..84 - 0: JS_CALL_EXPRESSION@75..83 - 0: JS_IDENTIFIER_EXPRESSION@75..77 - 0: JS_REFERENCE_IDENTIFIER@75..77 - 0: IDENT@75..77 "f" [Newline("\n")] [] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@77..80 - 0: L_ANGLE@77..78 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@78..79 - 0: TS_REFERENCE_TYPE@78..79 - 0: JS_REFERENCE_IDENTIFIER@78..79 - 0: IDENT@78..79 "T" [] [] - 1: (empty) - 2: R_ANGLE@79..80 ">" [] [] - 3: JS_CALL_ARGUMENTS@80..83 - 0: L_PAREN@80..81 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@81..82 - 0: JS_NUMBER_LITERAL_EXPRESSION@81..82 - 0: JS_NUMBER_LITERAL@81..82 "1" [] [] - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@84..95 - 0: JS_LOGICAL_EXPRESSION@84..94 - 0: TS_INSTANTIATION_EXPRESSION@84..90 - 0: JS_IDENTIFIER_EXPRESSION@84..86 - 0: JS_REFERENCE_IDENTIFIER@84..86 - 0: IDENT@84..86 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@86..90 - 0: L_ANGLE@86..87 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@87..88 - 0: TS_REFERENCE_TYPE@87..88 - 0: JS_REFERENCE_IDENTIFIER@87..88 - 0: IDENT@87..88 "T" [] [] - 1: (empty) - 2: R_ANGLE@88..90 ">" [] [Whitespace(" ")] - 1: QUESTION2@90..93 "??" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@93..94 - 0: JS_NUMBER_LITERAL@93..94 "1" [] [] - 1: SEMICOLON@94..95 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@95..106 - 0: JS_LOGICAL_EXPRESSION@95..105 - 0: TS_INSTANTIATION_EXPRESSION@95..101 - 0: JS_IDENTIFIER_EXPRESSION@95..97 - 0: JS_REFERENCE_IDENTIFIER@95..97 - 0: IDENT@95..97 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@97..101 - 0: L_ANGLE@97..98 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@98..99 - 0: TS_REFERENCE_TYPE@98..99 - 0: JS_REFERENCE_IDENTIFIER@98..99 - 0: IDENT@98..99 "T" [] [] - 1: (empty) - 2: R_ANGLE@99..101 ">" [] [Whitespace(" ")] - 1: PIPE2@101..104 "||" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@104..105 - 0: JS_NUMBER_LITERAL@104..105 "1" [] [] - 1: SEMICOLON@105..106 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@106..117 - 0: JS_LOGICAL_EXPRESSION@106..116 - 0: TS_INSTANTIATION_EXPRESSION@106..112 - 0: JS_IDENTIFIER_EXPRESSION@106..108 - 0: JS_REFERENCE_IDENTIFIER@106..108 - 0: IDENT@106..108 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@108..112 - 0: L_ANGLE@108..109 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@109..110 - 0: TS_REFERENCE_TYPE@109..110 - 0: JS_REFERENCE_IDENTIFIER@109..110 - 0: IDENT@109..110 "T" [] [] - 1: (empty) - 2: R_ANGLE@110..112 ">" [] [Whitespace(" ")] - 1: AMP2@112..115 "&&" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@115..116 - 0: JS_NUMBER_LITERAL@115..116 "1" [] [] - 1: SEMICOLON@116..117 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@117..127 - 0: JS_BINARY_EXPRESSION@117..126 - 0: TS_INSTANTIATION_EXPRESSION@117..123 - 0: JS_IDENTIFIER_EXPRESSION@117..119 - 0: JS_REFERENCE_IDENTIFIER@117..119 - 0: IDENT@117..119 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@119..123 - 0: L_ANGLE@119..120 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@120..121 - 0: TS_REFERENCE_TYPE@120..121 - 0: JS_REFERENCE_IDENTIFIER@120..121 - 0: IDENT@120..121 "T" [] [] - 1: (empty) - 2: R_ANGLE@121..123 ">" [] [Whitespace(" ")] - 1: PIPE@123..125 "|" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@125..126 - 0: JS_NUMBER_LITERAL@125..126 "1" [] [] - 1: SEMICOLON@126..127 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@127..137 - 0: JS_BINARY_EXPRESSION@127..136 - 0: TS_INSTANTIATION_EXPRESSION@127..133 - 0: JS_IDENTIFIER_EXPRESSION@127..129 - 0: JS_REFERENCE_IDENTIFIER@127..129 - 0: IDENT@127..129 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@129..133 - 0: L_ANGLE@129..130 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@130..131 - 0: TS_REFERENCE_TYPE@130..131 - 0: JS_REFERENCE_IDENTIFIER@130..131 - 0: IDENT@130..131 "T" [] [] - 1: (empty) - 2: R_ANGLE@131..133 ">" [] [Whitespace(" ")] - 1: CARET@133..135 "^" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@135..136 - 0: JS_NUMBER_LITERAL@135..136 "1" [] [] - 1: SEMICOLON@136..137 ";" [] [] - 8: JS_EXPRESSION_STATEMENT@137..147 - 0: JS_BINARY_EXPRESSION@137..146 - 0: TS_INSTANTIATION_EXPRESSION@137..143 - 0: JS_IDENTIFIER_EXPRESSION@137..139 - 0: JS_REFERENCE_IDENTIFIER@137..139 - 0: IDENT@137..139 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@139..143 - 0: L_ANGLE@139..140 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@140..141 - 0: TS_REFERENCE_TYPE@140..141 - 0: JS_REFERENCE_IDENTIFIER@140..141 - 0: IDENT@140..141 "T" [] [] - 1: (empty) - 2: R_ANGLE@141..143 ">" [] [Whitespace(" ")] - 1: AMP@143..145 "&" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@145..146 - 0: JS_NUMBER_LITERAL@145..146 "1" [] [] - 1: SEMICOLON@146..147 ";" [] [] - 9: JS_EXPRESSION_STATEMENT@147..161 - 0: JS_BINARY_EXPRESSION@147..160 - 0: TS_INSTANTIATION_EXPRESSION@147..153 - 0: JS_IDENTIFIER_EXPRESSION@147..149 - 0: JS_REFERENCE_IDENTIFIER@147..149 - 0: IDENT@147..149 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@149..153 - 0: L_ANGLE@149..150 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@150..151 - 0: TS_REFERENCE_TYPE@150..151 - 0: JS_REFERENCE_IDENTIFIER@150..151 - 0: IDENT@150..151 "T" [] [] - 1: (empty) - 2: R_ANGLE@151..153 ">" [] [Whitespace(" ")] - 1: EQ2@153..156 "==" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@156..160 - 0: JS_IDENTIFIER_EXPRESSION@156..157 - 0: JS_REFERENCE_IDENTIFIER@156..157 - 0: IDENT@156..157 "f" [] [] - 1: TS_TYPE_ARGUMENTS@157..160 - 0: L_ANGLE@157..158 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@158..159 - 0: TS_REFERENCE_TYPE@158..159 - 0: JS_REFERENCE_IDENTIFIER@158..159 - 0: IDENT@158..159 "T" [] [] - 1: (empty) - 2: R_ANGLE@159..160 ">" [] [] - 1: SEMICOLON@160..161 ";" [] [] - 10: JS_EXPRESSION_STATEMENT@161..175 - 0: JS_BINARY_EXPRESSION@161..174 - 0: TS_INSTANTIATION_EXPRESSION@161..167 - 0: JS_IDENTIFIER_EXPRESSION@161..163 - 0: JS_REFERENCE_IDENTIFIER@161..163 - 0: IDENT@161..163 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@163..167 - 0: L_ANGLE@163..164 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@164..165 - 0: TS_REFERENCE_TYPE@164..165 - 0: JS_REFERENCE_IDENTIFIER@164..165 - 0: IDENT@164..165 "T" [] [] - 1: (empty) - 2: R_ANGLE@165..167 ">" [] [Whitespace(" ")] - 1: NEQ@167..170 "!=" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@170..174 - 0: JS_IDENTIFIER_EXPRESSION@170..171 - 0: JS_REFERENCE_IDENTIFIER@170..171 - 0: IDENT@170..171 "f" [] [] - 1: TS_TYPE_ARGUMENTS@171..174 - 0: L_ANGLE@171..172 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@172..173 - 0: TS_REFERENCE_TYPE@172..173 - 0: JS_REFERENCE_IDENTIFIER@172..173 - 0: IDENT@172..173 "T" [] [] - 1: (empty) - 2: R_ANGLE@173..174 ">" [] [] - 1: SEMICOLON@174..175 ";" [] [] - 11: JS_EXPRESSION_STATEMENT@175..190 - 0: JS_BINARY_EXPRESSION@175..189 - 0: TS_INSTANTIATION_EXPRESSION@175..181 - 0: JS_IDENTIFIER_EXPRESSION@175..177 - 0: JS_REFERENCE_IDENTIFIER@175..177 - 0: IDENT@175..177 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@177..181 - 0: L_ANGLE@177..178 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@178..179 - 0: TS_REFERENCE_TYPE@178..179 - 0: JS_REFERENCE_IDENTIFIER@178..179 - 0: IDENT@178..179 "T" [] [] - 1: (empty) - 2: R_ANGLE@179..181 ">" [] [Whitespace(" ")] - 1: EQ3@181..185 "===" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@185..189 - 0: JS_IDENTIFIER_EXPRESSION@185..186 - 0: JS_REFERENCE_IDENTIFIER@185..186 - 0: IDENT@185..186 "f" [] [] - 1: TS_TYPE_ARGUMENTS@186..189 - 0: L_ANGLE@186..187 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@187..188 - 0: TS_REFERENCE_TYPE@187..188 - 0: JS_REFERENCE_IDENTIFIER@187..188 - 0: IDENT@187..188 "T" [] [] - 1: (empty) - 2: R_ANGLE@188..189 ">" [] [] - 1: SEMICOLON@189..190 ";" [] [] - 12: JS_EXPRESSION_STATEMENT@190..205 - 0: JS_BINARY_EXPRESSION@190..204 - 0: TS_INSTANTIATION_EXPRESSION@190..196 - 0: JS_IDENTIFIER_EXPRESSION@190..192 - 0: JS_REFERENCE_IDENTIFIER@190..192 - 0: IDENT@190..192 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@192..196 - 0: L_ANGLE@192..193 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@193..194 - 0: TS_REFERENCE_TYPE@193..194 - 0: JS_REFERENCE_IDENTIFIER@193..194 - 0: IDENT@193..194 "T" [] [] - 1: (empty) - 2: R_ANGLE@194..196 ">" [] [Whitespace(" ")] - 1: NEQ2@196..200 "!==" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@200..204 - 0: JS_IDENTIFIER_EXPRESSION@200..201 - 0: JS_REFERENCE_IDENTIFIER@200..201 - 0: IDENT@200..201 "f" [] [] - 1: TS_TYPE_ARGUMENTS@201..204 - 0: L_ANGLE@201..202 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@202..203 - 0: TS_REFERENCE_TYPE@202..203 - 0: JS_REFERENCE_IDENTIFIER@202..203 - 0: IDENT@202..203 "T" [] [] - 1: (empty) - 2: R_ANGLE@203..204 ">" [] [] - 1: SEMICOLON@204..205 ";" [] [] - 13: JS_EXPRESSION_STATEMENT@205..219 - 0: JS_BINARY_EXPRESSION@205..218 - 0: TS_INSTANTIATION_EXPRESSION@205..211 - 0: JS_IDENTIFIER_EXPRESSION@205..207 - 0: JS_REFERENCE_IDENTIFIER@205..207 - 0: IDENT@205..207 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@207..211 - 0: L_ANGLE@207..208 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@208..209 - 0: TS_REFERENCE_TYPE@208..209 - 0: JS_REFERENCE_IDENTIFIER@208..209 - 0: IDENT@208..209 "T" [] [] - 1: (empty) - 2: R_ANGLE@209..211 ">" [] [Whitespace(" ")] - 1: LTEQ@211..214 "<=" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@214..218 - 0: JS_IDENTIFIER_EXPRESSION@214..215 - 0: JS_REFERENCE_IDENTIFIER@214..215 - 0: IDENT@214..215 "f" [] [] - 1: TS_TYPE_ARGUMENTS@215..218 - 0: L_ANGLE@215..216 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@216..217 - 0: TS_REFERENCE_TYPE@216..217 - 0: JS_REFERENCE_IDENTIFIER@216..217 - 0: IDENT@216..217 "T" [] [] - 1: (empty) - 2: R_ANGLE@217..218 ">" [] [] - 1: SEMICOLON@218..219 ";" [] [] - 14: JS_EXPRESSION_STATEMENT@219..241 - 0: JS_INSTANCEOF_EXPRESSION@219..240 - 0: TS_INSTANTIATION_EXPRESSION@219..225 - 0: JS_IDENTIFIER_EXPRESSION@219..221 - 0: JS_REFERENCE_IDENTIFIER@219..221 - 0: IDENT@219..221 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@221..225 - 0: L_ANGLE@221..222 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@222..223 - 0: TS_REFERENCE_TYPE@222..223 - 0: JS_REFERENCE_IDENTIFIER@222..223 - 0: IDENT@222..223 "T" [] [] - 1: (empty) - 2: R_ANGLE@223..225 ">" [] [Whitespace(" ")] - 1: INSTANCEOF_KW@225..236 "instanceof" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@236..240 - 0: JS_IDENTIFIER_EXPRESSION@236..237 - 0: JS_REFERENCE_IDENTIFIER@236..237 - 0: IDENT@236..237 "f" [] [] - 1: TS_TYPE_ARGUMENTS@237..240 - 0: L_ANGLE@237..238 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@238..239 - 0: TS_REFERENCE_TYPE@238..239 - 0: JS_REFERENCE_IDENTIFIER@238..239 - 0: IDENT@238..239 "T" [] [] - 1: (empty) - 2: R_ANGLE@239..240 ">" [] [] - 1: SEMICOLON@240..241 ";" [] [] - 15: JS_EXPRESSION_STATEMENT@241..253 - 0: JS_IN_EXPRESSION@241..252 - 0: TS_INSTANTIATION_EXPRESSION@241..247 - 0: JS_IDENTIFIER_EXPRESSION@241..243 - 0: JS_REFERENCE_IDENTIFIER@241..243 - 0: IDENT@241..243 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@243..247 - 0: L_ANGLE@243..244 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@244..245 - 0: TS_REFERENCE_TYPE@244..245 - 0: JS_REFERENCE_IDENTIFIER@244..245 - 0: IDENT@244..245 "T" [] [] - 1: (empty) - 2: R_ANGLE@245..247 ">" [] [Whitespace(" ")] - 1: IN_KW@247..250 "in" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@250..252 - 0: L_CURLY@250..251 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@251..251 - 2: R_CURLY@251..252 "}" [] [] - 1: SEMICOLON@252..253 ";" [] [] - 16: JS_EXPRESSION_STATEMENT@253..265 - 0: TS_AS_EXPRESSION@253..264 - 0: TS_INSTANTIATION_EXPRESSION@253..259 - 0: JS_IDENTIFIER_EXPRESSION@253..255 - 0: JS_REFERENCE_IDENTIFIER@253..255 - 0: IDENT@253..255 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@255..259 - 0: L_ANGLE@255..256 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@256..257 - 0: TS_REFERENCE_TYPE@256..257 - 0: JS_REFERENCE_IDENTIFIER@256..257 - 0: IDENT@256..257 "T" [] [] - 1: (empty) - 2: R_ANGLE@257..259 ">" [] [Whitespace(" ")] - 1: AS_KW@259..262 "as" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@262..264 - 0: L_CURLY@262..263 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@263..263 - 2: R_CURLY@263..264 "}" [] [] - 1: SEMICOLON@264..265 ";" [] [] - 17: JS_EXPRESSION_STATEMENT@265..284 - 0: TS_SATISFIES_EXPRESSION@265..283 - 0: TS_INSTANTIATION_EXPRESSION@265..271 - 0: JS_IDENTIFIER_EXPRESSION@265..267 - 0: JS_REFERENCE_IDENTIFIER@265..267 - 0: IDENT@265..267 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@267..271 - 0: L_ANGLE@267..268 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@268..269 - 0: TS_REFERENCE_TYPE@268..269 - 0: JS_REFERENCE_IDENTIFIER@268..269 - 0: IDENT@268..269 "T" [] [] - 1: (empty) - 2: R_ANGLE@269..271 ">" [] [Whitespace(" ")] - 1: SATISFIES_KW@271..281 "satisfies" [] [Whitespace(" ")] - 2: TS_OBJECT_TYPE@281..283 - 0: L_CURLY@281..282 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@282..282 - 2: R_CURLY@282..283 "}" [] [] - 1: SEMICOLON@283..284 ";" [] [] - 18: JS_EXPRESSION_STATEMENT@284..297 - 0: JS_BINARY_EXPRESSION@284..296 - 0: TS_INSTANTIATION_EXPRESSION@284..290 - 0: JS_IDENTIFIER_EXPRESSION@284..286 - 0: JS_REFERENCE_IDENTIFIER@284..286 - 0: IDENT@284..286 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@286..290 - 0: L_ANGLE@286..287 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@287..288 - 0: TS_REFERENCE_TYPE@287..288 - 0: JS_REFERENCE_IDENTIFIER@287..288 - 0: IDENT@287..288 "T" [] [] - 1: (empty) - 2: R_ANGLE@288..290 ">" [] [Whitespace(" ")] - 1: STAR@290..292 "*" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@292..296 - 0: JS_IDENTIFIER_EXPRESSION@292..293 - 0: JS_REFERENCE_IDENTIFIER@292..293 - 0: IDENT@292..293 "f" [] [] - 1: TS_TYPE_ARGUMENTS@293..296 - 0: L_ANGLE@293..294 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@294..295 - 0: TS_REFERENCE_TYPE@294..295 - 0: JS_REFERENCE_IDENTIFIER@294..295 - 0: IDENT@294..295 "T" [] [] - 1: (empty) - 2: R_ANGLE@295..296 ">" [] [] - 1: SEMICOLON@296..297 ";" [] [] - 19: JS_EXPRESSION_STATEMENT@297..310 - 0: JS_BINARY_EXPRESSION@297..309 - 0: TS_INSTANTIATION_EXPRESSION@297..303 - 0: JS_IDENTIFIER_EXPRESSION@297..299 - 0: JS_REFERENCE_IDENTIFIER@297..299 - 0: IDENT@297..299 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@299..303 - 0: L_ANGLE@299..300 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@300..301 - 0: TS_REFERENCE_TYPE@300..301 - 0: JS_REFERENCE_IDENTIFIER@300..301 - 0: IDENT@300..301 "T" [] [] - 1: (empty) - 2: R_ANGLE@301..303 ">" [] [Whitespace(" ")] - 1: SLASH@303..305 "/" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@305..309 - 0: JS_IDENTIFIER_EXPRESSION@305..306 - 0: JS_REFERENCE_IDENTIFIER@305..306 - 0: IDENT@305..306 "f" [] [] - 1: TS_TYPE_ARGUMENTS@306..309 - 0: L_ANGLE@306..307 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@307..308 - 0: TS_REFERENCE_TYPE@307..308 - 0: JS_REFERENCE_IDENTIFIER@307..308 - 0: IDENT@307..308 "T" [] [] - 1: (empty) - 2: R_ANGLE@308..309 ">" [] [] - 1: SEMICOLON@309..310 ";" [] [] - 20: JS_EXPRESSION_STATEMENT@310..323 - 0: JS_BINARY_EXPRESSION@310..322 - 0: TS_INSTANTIATION_EXPRESSION@310..316 - 0: JS_IDENTIFIER_EXPRESSION@310..312 - 0: JS_REFERENCE_IDENTIFIER@310..312 - 0: IDENT@310..312 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@312..316 - 0: L_ANGLE@312..313 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@313..314 - 0: TS_REFERENCE_TYPE@313..314 - 0: JS_REFERENCE_IDENTIFIER@313..314 - 0: IDENT@313..314 "T" [] [] - 1: (empty) - 2: R_ANGLE@314..316 ">" [] [Whitespace(" ")] - 1: PERCENT@316..318 "%" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@318..322 - 0: JS_IDENTIFIER_EXPRESSION@318..319 - 0: JS_REFERENCE_IDENTIFIER@318..319 - 0: IDENT@318..319 "f" [] [] - 1: TS_TYPE_ARGUMENTS@319..322 - 0: L_ANGLE@319..320 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@320..321 - 0: TS_REFERENCE_TYPE@320..321 - 0: JS_REFERENCE_IDENTIFIER@320..321 - 0: IDENT@320..321 "T" [] [] - 1: (empty) - 2: R_ANGLE@321..322 ">" [] [] - 1: SEMICOLON@322..323 ";" [] [] - 21: JS_EXPRESSION_STATEMENT@323..337 - 0: JS_BINARY_EXPRESSION@323..336 - 0: TS_INSTANTIATION_EXPRESSION@323..329 - 0: JS_IDENTIFIER_EXPRESSION@323..325 - 0: JS_REFERENCE_IDENTIFIER@323..325 - 0: IDENT@323..325 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@325..329 - 0: L_ANGLE@325..326 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@326..327 - 0: TS_REFERENCE_TYPE@326..327 - 0: JS_REFERENCE_IDENTIFIER@326..327 - 0: IDENT@326..327 "T" [] [] - 1: (empty) - 2: R_ANGLE@327..329 ">" [] [Whitespace(" ")] - 1: STAR2@329..332 "**" [] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@332..336 - 0: JS_IDENTIFIER_EXPRESSION@332..333 - 0: JS_REFERENCE_IDENTIFIER@332..333 - 0: IDENT@332..333 "f" [] [] - 1: TS_TYPE_ARGUMENTS@333..336 - 0: L_ANGLE@333..334 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@334..335 - 0: TS_REFERENCE_TYPE@334..335 - 0: JS_REFERENCE_IDENTIFIER@334..335 - 0: IDENT@334..335 "T" [] [] - 1: (empty) - 2: R_ANGLE@335..336 ">" [] [] - 1: SEMICOLON@336..337 ";" [] [] - 22: JS_EXPRESSION_STATEMENT@337..352 - 0: JS_BINARY_EXPRESSION@337..351 - 0: JS_BINARY_EXPRESSION@337..344 - 0: JS_IDENTIFIER_EXPRESSION@337..340 - 0: JS_REFERENCE_IDENTIFIER@337..340 - 0: IDENT@337..340 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@340..342 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@342..344 - 0: JS_REFERENCE_IDENTIFIER@342..344 - 0: IDENT@342..344 "T" [] [Whitespace(" ")] - 1: R_ANGLE@344..346 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@346..351 - 0: PLUS@346..347 "+" [] [] - 1: TS_INSTANTIATION_EXPRESSION@347..351 - 0: JS_IDENTIFIER_EXPRESSION@347..348 - 0: JS_REFERENCE_IDENTIFIER@347..348 - 0: IDENT@347..348 "f" [] [] - 1: TS_TYPE_ARGUMENTS@348..351 - 0: L_ANGLE@348..349 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@349..350 - 0: TS_REFERENCE_TYPE@349..350 - 0: JS_REFERENCE_IDENTIFIER@349..350 - 0: IDENT@349..350 "T" [] [] - 1: (empty) - 2: R_ANGLE@350..351 ">" [] [] - 1: SEMICOLON@351..352 ";" [] [] - 23: JS_EXPRESSION_STATEMENT@352..367 - 0: JS_BINARY_EXPRESSION@352..366 - 0: JS_BINARY_EXPRESSION@352..359 - 0: JS_IDENTIFIER_EXPRESSION@352..355 - 0: JS_REFERENCE_IDENTIFIER@352..355 - 0: IDENT@352..355 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@355..357 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@357..359 - 0: JS_REFERENCE_IDENTIFIER@357..359 - 0: IDENT@357..359 "T" [] [Whitespace(" ")] - 1: R_ANGLE@359..361 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@361..366 - 0: MINUS@361..362 "-" [] [] - 1: TS_INSTANTIATION_EXPRESSION@362..366 - 0: JS_IDENTIFIER_EXPRESSION@362..363 - 0: JS_REFERENCE_IDENTIFIER@362..363 - 0: IDENT@362..363 "f" [] [] - 1: TS_TYPE_ARGUMENTS@363..366 - 0: L_ANGLE@363..364 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@364..365 - 0: TS_REFERENCE_TYPE@364..365 - 0: JS_REFERENCE_IDENTIFIER@364..365 - 0: IDENT@364..365 "T" [] [] - 1: (empty) - 2: R_ANGLE@365..366 ">" [] [] - 1: SEMICOLON@366..367 ";" [] [] - 24: JS_EXPRESSION_STATEMENT@367..381 - 0: JS_BINARY_EXPRESSION@367..380 - 0: JS_BINARY_EXPRESSION@367..374 - 0: JS_IDENTIFIER_EXPRESSION@367..370 - 0: JS_REFERENCE_IDENTIFIER@367..370 - 0: IDENT@367..370 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@370..372 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@372..374 - 0: JS_REFERENCE_IDENTIFIER@372..374 - 0: IDENT@372..374 "T" [] [Whitespace(" ")] - 1: R_ANGLE@374..376 ">" [] [Whitespace(" ")] - 2: JS_THIS_EXPRESSION@376..380 - 0: THIS_KW@376..380 "this" [] [] - 1: SEMICOLON@380..381 ";" [] [] - 25: JS_EXPRESSION_STATEMENT@381..395 - 0: JS_BINARY_EXPRESSION@381..394 - 0: JS_BINARY_EXPRESSION@381..388 - 0: JS_IDENTIFIER_EXPRESSION@381..384 - 0: JS_REFERENCE_IDENTIFIER@381..384 - 0: IDENT@381..384 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@384..386 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@386..388 - 0: JS_REFERENCE_IDENTIFIER@386..388 - 0: IDENT@386..388 "T" [] [Whitespace(" ")] - 1: R_ANGLE@388..390 ">" [] [Whitespace(" ")] - 2: JS_NULL_LITERAL_EXPRESSION@390..394 - 0: NULL_KW@390..394 "null" [] [] - 1: SEMICOLON@394..395 ";" [] [] - 26: JS_EXPRESSION_STATEMENT@395..409 - 0: JS_BINARY_EXPRESSION@395..408 - 0: JS_BINARY_EXPRESSION@395..402 - 0: JS_IDENTIFIER_EXPRESSION@395..398 - 0: JS_REFERENCE_IDENTIFIER@395..398 - 0: IDENT@395..398 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@398..400 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@400..402 - 0: JS_REFERENCE_IDENTIFIER@400..402 - 0: IDENT@400..402 "T" [] [Whitespace(" ")] - 1: R_ANGLE@402..404 ">" [] [Whitespace(" ")] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@404..408 - 0: TRUE_KW@404..408 "true" [] [] - 1: SEMICOLON@408..409 ";" [] [] - 27: JS_EXPRESSION_STATEMENT@409..424 - 0: JS_BINARY_EXPRESSION@409..423 - 0: JS_BINARY_EXPRESSION@409..416 - 0: JS_IDENTIFIER_EXPRESSION@409..412 - 0: JS_REFERENCE_IDENTIFIER@409..412 - 0: IDENT@409..412 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@412..414 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@414..416 - 0: JS_REFERENCE_IDENTIFIER@414..416 - 0: IDENT@414..416 "T" [] [Whitespace(" ")] - 1: R_ANGLE@416..418 ">" [] [Whitespace(" ")] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@418..423 - 0: FALSE_KW@418..423 "false" [] [] - 1: SEMICOLON@423..424 ";" [] [] - 28: JS_EXPRESSION_STATEMENT@424..435 - 0: JS_BINARY_EXPRESSION@424..434 - 0: JS_BINARY_EXPRESSION@424..431 - 0: JS_IDENTIFIER_EXPRESSION@424..427 - 0: JS_REFERENCE_IDENTIFIER@424..427 - 0: IDENT@424..427 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@427..429 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@429..431 - 0: JS_REFERENCE_IDENTIFIER@429..431 - 0: IDENT@429..431 "T" [] [Whitespace(" ")] - 1: R_ANGLE@431..433 ">" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@433..434 - 0: JS_NUMBER_LITERAL@433..434 "1" [] [] - 1: SEMICOLON@434..435 ";" [] [] - 29: JS_EXPRESSION_STATEMENT@435..449 - 0: JS_BINARY_EXPRESSION@435..448 - 0: JS_BINARY_EXPRESSION@435..442 - 0: JS_IDENTIFIER_EXPRESSION@435..438 - 0: JS_REFERENCE_IDENTIFIER@435..438 - 0: IDENT@435..438 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@438..440 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@440..442 - 0: JS_REFERENCE_IDENTIFIER@440..442 - 0: IDENT@440..442 "T" [] [Whitespace(" ")] - 1: R_ANGLE@442..444 ">" [] [Whitespace(" ")] - 2: JS_BIGINT_LITERAL_EXPRESSION@444..448 - 0: JS_BIGINT_LITERAL@444..448 "123n" [] [] - 1: SEMICOLON@448..449 ";" [] [] - 30: JS_EXPRESSION_STATEMENT@449..461 - 0: JS_BINARY_EXPRESSION@449..460 - 0: JS_BINARY_EXPRESSION@449..456 - 0: JS_IDENTIFIER_EXPRESSION@449..452 - 0: JS_REFERENCE_IDENTIFIER@449..452 - 0: IDENT@449..452 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@452..454 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@454..456 - 0: JS_REFERENCE_IDENTIFIER@454..456 - 0: IDENT@454..456 "T" [] [Whitespace(" ")] - 1: R_ANGLE@456..458 ">" [] [Whitespace(" ")] - 2: JS_ARRAY_EXPRESSION@458..460 - 0: L_BRACK@458..459 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@459..459 - 2: R_BRACK@459..460 "]" [] [] - 1: SEMICOLON@460..461 ";" [] [] - 31: JS_EXPRESSION_STATEMENT@461..473 - 0: JS_BINARY_EXPRESSION@461..472 - 0: JS_BINARY_EXPRESSION@461..468 - 0: JS_IDENTIFIER_EXPRESSION@461..464 - 0: JS_REFERENCE_IDENTIFIER@461..464 - 0: IDENT@461..464 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@464..466 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@466..468 - 0: JS_REFERENCE_IDENTIFIER@466..468 - 0: IDENT@466..468 "T" [] [Whitespace(" ")] - 1: R_ANGLE@468..470 ">" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@470..472 - 0: L_CURLY@470..471 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@471..471 - 2: R_CURLY@471..472 "}" [] [] - 1: SEMICOLON@472..473 ";" [] [] - 32: JS_EXPRESSION_STATEMENT@473..501 - 0: JS_BINARY_EXPRESSION@473..500 - 0: JS_BINARY_EXPRESSION@473..480 - 0: JS_IDENTIFIER_EXPRESSION@473..476 - 0: JS_REFERENCE_IDENTIFIER@473..476 - 0: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@476..478 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@478..480 - 0: JS_REFERENCE_IDENTIFIER@478..480 - 0: IDENT@478..480 "T" [] [Whitespace(" ")] - 1: R_ANGLE@480..482 ">" [] [Whitespace(" ")] - 2: JS_FUNCTION_EXPRESSION@482..500 - 0: (empty) - 1: FUNCTION_KW@482..491 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@491..495 - 0: IDENT@491..495 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@495..498 - 0: L_PAREN@495..496 "(" [] [] - 1: JS_PARAMETER_LIST@496..496 - 2: R_PAREN@496..498 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@498..500 - 0: L_CURLY@498..499 "{" [] [] - 1: JS_DIRECTIVE_LIST@499..499 - 2: JS_STATEMENT_LIST@499..499 - 3: R_CURLY@499..500 "}" [] [] - 1: SEMICOLON@500..501 ";" [] [] - 33: JS_EXPRESSION_STATEMENT@501..521 - 0: JS_BINARY_EXPRESSION@501..520 - 0: JS_BINARY_EXPRESSION@501..508 - 0: JS_IDENTIFIER_EXPRESSION@501..504 - 0: JS_REFERENCE_IDENTIFIER@501..504 - 0: IDENT@501..504 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@504..506 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@506..508 - 0: JS_REFERENCE_IDENTIFIER@506..508 - 0: IDENT@506..508 "T" [] [Whitespace(" ")] - 1: R_ANGLE@508..510 ">" [] [Whitespace(" ")] - 2: JS_CLASS_EXPRESSION@510..520 - 0: JS_DECORATOR_LIST@510..510 - 1: CLASS_KW@510..516 "class" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@516..518 - 0: IDENT@516..518 "A" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: L_CURLY@518..519 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@519..519 - 8: R_CURLY@519..520 "}" [] [] - 1: SEMICOLON@520..521 ";" [] [] - 34: JS_EXPRESSION_STATEMENT@521..538 - 0: JS_BINARY_EXPRESSION@521..537 - 0: JS_BINARY_EXPRESSION@521..528 - 0: JS_IDENTIFIER_EXPRESSION@521..524 - 0: JS_REFERENCE_IDENTIFIER@521..524 - 0: IDENT@521..524 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@524..526 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@526..528 - 0: JS_REFERENCE_IDENTIFIER@526..528 - 0: IDENT@526..528 "T" [] [Whitespace(" ")] - 1: R_ANGLE@528..530 ">" [] [Whitespace(" ")] - 2: JS_NEW_EXPRESSION@530..537 - 0: NEW_KW@530..534 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@534..535 - 0: JS_REFERENCE_IDENTIFIER@534..535 - 0: IDENT@534..535 "A" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@535..537 - 0: L_PAREN@535..536 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@536..536 - 2: R_PAREN@536..537 ")" [] [] - 1: SEMICOLON@537..538 ";" [] [] - 35: JS_EXPRESSION_STATEMENT@538..548 - 0: JS_BINARY_EXPRESSION@538..547 - 0: TS_INSTANTIATION_EXPRESSION@538..544 - 0: JS_IDENTIFIER_EXPRESSION@538..540 - 0: JS_REFERENCE_IDENTIFIER@538..540 - 0: IDENT@538..540 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@540..544 - 0: L_ANGLE@540..541 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@541..542 - 0: TS_REFERENCE_TYPE@541..542 - 0: JS_REFERENCE_IDENTIFIER@541..542 - 0: IDENT@541..542 "T" [] [] - 1: (empty) - 2: R_ANGLE@542..544 ">" [] [Whitespace(" ")] - 1: SLASH@544..546 "/" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@546..547 - 0: JS_NUMBER_LITERAL@546..547 "1" [] [] - 1: SEMICOLON@547..548 ";" [] [] - 36: JS_EXPRESSION_STATEMENT@548..560 - 0: JS_BINARY_EXPRESSION@548..559 - 0: JS_BINARY_EXPRESSION@548..555 - 0: JS_IDENTIFIER_EXPRESSION@548..551 - 0: JS_REFERENCE_IDENTIFIER@548..551 - 0: IDENT@548..551 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@551..553 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@553..555 - 0: JS_REFERENCE_IDENTIFIER@553..555 - 0: IDENT@553..555 "T" [] [Whitespace(" ")] - 1: R_ANGLE@555..557 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@557..559 - 0: PLUS@557..558 "+" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@558..559 - 0: JS_NUMBER_LITERAL@558..559 "1" [] [] - 1: SEMICOLON@559..560 ";" [] [] - 37: JS_EXPRESSION_STATEMENT@560..572 - 0: JS_BINARY_EXPRESSION@560..571 - 0: JS_BINARY_EXPRESSION@560..567 - 0: JS_IDENTIFIER_EXPRESSION@560..563 - 0: JS_REFERENCE_IDENTIFIER@560..563 - 0: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@563..565 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@565..567 - 0: JS_REFERENCE_IDENTIFIER@565..567 - 0: IDENT@565..567 "T" [] [Whitespace(" ")] - 1: R_ANGLE@567..569 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@569..571 - 0: MINUS@569..570 "-" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@570..571 - 0: JS_NUMBER_LITERAL@570..571 "1" [] [] - 1: SEMICOLON@571..572 ";" [] [] - 38: JS_EXPRESSION_STATEMENT@572..584 - 0: JS_BINARY_EXPRESSION@572..583 - 0: JS_BINARY_EXPRESSION@572..579 - 0: JS_IDENTIFIER_EXPRESSION@572..575 - 0: JS_REFERENCE_IDENTIFIER@572..575 - 0: IDENT@572..575 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@575..577 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@577..579 - 0: JS_REFERENCE_IDENTIFIER@577..579 - 0: IDENT@577..579 "T" [] [Whitespace(" ")] - 1: R_ANGLE@579..581 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@581..583 - 0: TILDE@581..582 "~" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@582..583 - 0: JS_NUMBER_LITERAL@582..583 "1" [] [] - 1: SEMICOLON@583..584 ";" [] [] - 39: JS_EXPRESSION_STATEMENT@584..596 - 0: JS_BINARY_EXPRESSION@584..595 - 0: JS_BINARY_EXPRESSION@584..591 - 0: JS_IDENTIFIER_EXPRESSION@584..587 - 0: JS_REFERENCE_IDENTIFIER@584..587 - 0: IDENT@584..587 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@587..589 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@589..591 - 0: JS_REFERENCE_IDENTIFIER@589..591 - 0: IDENT@589..591 "T" [] [Whitespace(" ")] - 1: R_ANGLE@591..593 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@593..595 - 0: BANG@593..594 "!" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@594..595 - 0: JS_NUMBER_LITERAL@594..595 "1" [] [] - 1: SEMICOLON@595..596 ";" [] [] - 40: JS_EXPRESSION_STATEMENT@596..620 - 0: JS_BINARY_EXPRESSION@596..619 - 0: JS_BINARY_EXPRESSION@596..603 - 0: JS_IDENTIFIER_EXPRESSION@596..599 - 0: JS_REFERENCE_IDENTIFIER@596..599 - 0: IDENT@596..599 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@599..601 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@601..603 - 0: JS_REFERENCE_IDENTIFIER@601..603 - 0: IDENT@601..603 "T" [] [Whitespace(" ")] - 1: R_ANGLE@603..605 ">" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@605..619 - 0: JS_REFERENCE_IDENTIFIER@605..619 - 0: IDENT@605..619 "someIdentifier" [] [] - 1: SEMICOLON@619..620 ";" [] [] - 41: JS_EXPRESSION_STATEMENT@620..645 - 0: JS_BINARY_EXPRESSION@620..644 - 0: JS_BINARY_EXPRESSION@620..627 - 0: JS_IDENTIFIER_EXPRESSION@620..623 - 0: JS_REFERENCE_IDENTIFIER@620..623 - 0: IDENT@620..623 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@623..625 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@625..627 - 0: JS_REFERENCE_IDENTIFIER@625..627 - 0: IDENT@625..627 "T" [] [Whitespace(" ")] - 1: R_ANGLE@627..629 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@629..644 - 0: DELETE_KW@629..636 "delete" [] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@636..644 - 0: JS_IDENTIFIER_EXPRESSION@636..637 - 0: JS_REFERENCE_IDENTIFIER@636..637 - 0: IDENT@636..637 "a" [] [] - 1: (empty) - 2: L_BRACK@637..638 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@638..643 - 0: JS_REFERENCE_IDENTIFIER@638..643 - 0: IDENT@638..643 "field" [] [] - 4: R_BRACK@643..644 "]" [] [] - 1: SEMICOLON@644..645 ";" [] [] - 42: JS_EXPRESSION_STATEMENT@645..669 - 0: JS_BINARY_EXPRESSION@645..668 - 0: JS_BINARY_EXPRESSION@645..652 - 0: JS_IDENTIFIER_EXPRESSION@645..648 - 0: JS_REFERENCE_IDENTIFIER@645..648 - 0: IDENT@645..648 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@648..650 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@650..652 - 0: JS_REFERENCE_IDENTIFIER@650..652 - 0: IDENT@650..652 "T" [] [Whitespace(" ")] - 1: R_ANGLE@652..654 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@654..668 - 0: TYPEOF_KW@654..661 "typeof" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@661..668 - 0: JS_REFERENCE_IDENTIFIER@661..668 - 0: IDENT@661..668 "MyClass" [] [] - 1: SEMICOLON@668..669 ";" [] [] - 43: JS_EXPRESSION_STATEMENT@669..685 - 0: JS_BINARY_EXPRESSION@669..684 - 0: JS_BINARY_EXPRESSION@669..676 - 0: JS_IDENTIFIER_EXPRESSION@669..672 - 0: JS_REFERENCE_IDENTIFIER@669..672 - 0: IDENT@669..672 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@672..674 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@674..676 - 0: JS_REFERENCE_IDENTIFIER@674..676 - 0: IDENT@674..676 "T" [] [Whitespace(" ")] - 1: R_ANGLE@676..678 ">" [] [Whitespace(" ")] - 2: JS_UNARY_EXPRESSION@678..684 - 0: VOID_KW@678..683 "void" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@683..684 - 0: JS_REFERENCE_IDENTIFIER@683..684 - 0: IDENT@683..684 "a" [] [] - 1: SEMICOLON@684..685 ";" [] [] - 44: JS_EXPRESSION_STATEMENT@685..696 - 0: JS_BINARY_EXPRESSION@685..695 - 0: TS_INSTANTIATION_EXPRESSION@685..691 - 0: JS_IDENTIFIER_EXPRESSION@685..687 - 0: JS_REFERENCE_IDENTIFIER@685..687 - 0: IDENT@685..687 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@687..691 - 0: L_ANGLE@687..688 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@688..689 - 0: TS_REFERENCE_TYPE@688..689 - 0: JS_REFERENCE_IDENTIFIER@688..689 - 0: IDENT@688..689 "T" [] [] - 1: (empty) - 2: R_ANGLE@689..691 ">" [] [Whitespace(" ")] - 1: LTEQ@691..694 "<=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@694..695 - 0: JS_NUMBER_LITERAL@694..695 "1" [] [] - 1: SEMICOLON@695..696 ";" [] [] - 45: JS_EXPRESSION_STATEMENT@696..715 - 0: JS_CALL_EXPRESSION@696..714 - 0: JS_IDENTIFIER_EXPRESSION@696..699 - 0: JS_REFERENCE_IDENTIFIER@696..699 - 0: IDENT@696..699 "f" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@699..705 - 0: L_ANGLE@699..701 "<" [] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENT_LIST@701..703 - 0: TS_REFERENCE_TYPE@701..703 - 0: JS_REFERENCE_IDENTIFIER@701..703 - 0: IDENT@701..703 "T" [] [Whitespace(" ")] - 1: (empty) - 2: R_ANGLE@703..705 ">" [] [Whitespace(" ")] - 3: JS_CALL_ARGUMENTS@705..714 - 0: L_PAREN@705..706 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@706..713 - 0: JS_AWAIT_EXPRESSION@706..713 - 0: AWAIT_KW@706..712 "await" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@712..713 - 0: JS_NUMBER_LITERAL@712..713 "1" [] [] - 2: R_PAREN@713..714 ")" [] [] - 1: SEMICOLON@714..715 ";" [] [] - 46: JS_EXPRESSION_STATEMENT@715..736 - 0: JS_BINARY_EXPRESSION@715..735 - 0: JS_BINARY_EXPRESSION@715..722 - 0: JS_IDENTIFIER_EXPRESSION@715..718 - 0: JS_REFERENCE_IDENTIFIER@715..718 - 0: IDENT@715..718 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@718..720 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@720..722 - 0: JS_REFERENCE_IDENTIFIER@720..722 - 0: IDENT@720..722 "T" [] [Whitespace(" ")] - 1: R_ANGLE@722..724 ">" [] [Whitespace(" ")] - 2: JS_IMPORT_META_EXPRESSION@724..735 - 0: IMPORT_KW@724..730 "import" [] [] - 1: DOT@730..731 "." [] [] - 2: META@731..735 "meta" [] [] - 1: SEMICOLON@735..736 ";" [] [] - 47: JS_EXPRESSION_STATEMENT@736..759 - 0: JS_BINARY_EXPRESSION@736..758 - 0: JS_BINARY_EXPRESSION@736..743 - 0: JS_IDENTIFIER_EXPRESSION@736..739 - 0: JS_REFERENCE_IDENTIFIER@736..739 - 0: IDENT@736..739 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@739..741 "<" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@741..743 - 0: JS_REFERENCE_IDENTIFIER@741..743 - 0: IDENT@741..743 "T" [] [Whitespace(" ")] - 1: R_ANGLE@743..745 ">" [] [Whitespace(" ")] - 2: JS_IMPORT_CALL_EXPRESSION@745..758 - 0: IMPORT_KW@745..751 "import" [] [] - 1: JS_CALL_ARGUMENTS@751..758 - 0: L_PAREN@751..752 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@752..757 - 0: JS_STRING_LITERAL_EXPRESSION@752..757 - 0: JS_STRING_LITERAL@752..757 "\"123\"" [] [] - 2: R_PAREN@757..758 ")" [] [] - 1: SEMICOLON@758..759 ";" [] [] - 48: JS_EXPRESSION_STATEMENT@759..771 - 0: JS_BINARY_EXPRESSION@759..770 - 0: JS_IDENTIFIER_EXPRESSION@759..762 - 0: JS_REFERENCE_IDENTIFIER@759..762 - 0: IDENT@759..762 "a" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@762..764 "<" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@764..770 - 0: JS_IDENTIFIER_EXPRESSION@764..766 - 0: JS_REFERENCE_IDENTIFIER@764..766 - 0: IDENT@764..766 "b" [] [Whitespace(" ")] - 1: SHR@766..769 ">>" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@769..770 - 0: JS_REFERENCE_IDENTIFIER@769..770 - 0: IDENT@769..770 "c" [] [] - 1: SEMICOLON@770..771 ";" [] [] - 49: JS_EXPRESSION_STATEMENT@771..794 - 0: JS_ASSIGNMENT_EXPRESSION@771..793 - 0: JS_IDENTIFIER_ASSIGNMENT@771..774 - 0: IDENT@771..774 "f" [Newline("\n")] [Whitespace(" ")] - 1: EQ@774..776 "=" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@776..793 - 0: JS_BINARY_EXPRESSION@776..784 - 0: JS_IDENTIFIER_EXPRESSION@776..778 - 0: JS_REFERENCE_IDENTIFIER@776..778 - 0: IDENT@776..778 "h" [] [Whitespace(" ")] - 1: USHR@778..782 ">>>" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@782..784 - 0: JS_NUMBER_LITERAL@782..784 "0" [] [Whitespace(" ")] - 1: L_ANGLE@784..786 "<" [] [Whitespace(" ")] - 2: JS_BINARY_EXPRESSION@786..793 - 0: JS_IDENTIFIER_EXPRESSION@786..788 - 0: JS_REFERENCE_IDENTIFIER@786..788 - 0: IDENT@786..788 "j" [] [Whitespace(" ")] - 1: USHR@788..792 ">>>" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@792..793 - 0: JS_NUMBER_LITERAL@792..793 "0" [] [] - 1: SEMICOLON@793..794 ";" [] [] - 4: EOF@794..795 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast b/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast deleted file mode 100644 index a4469ef0d2d3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast +++ /dev/null @@ -1,1252 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..9 "x5" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@9..11 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@11..12 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@12..13 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@13..17 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@17..18 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@18..23 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@23..26 "yy" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@26..28 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@28..29 "0" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@29..30 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@30..37 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@37..40 "x6" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..43 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@43..44 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@44..48 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@48..49 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@49..60 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@60..62 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@62..63 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@63..64 "}" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@69..73 "x10" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@75..76 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@76..77 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@77..81 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@81..82 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@82..87 "this" [Newline("\n")] [], - }, - operator_token: DOT@87..88 "." [] [], - member: JsName { - value_token: IDENT@88..91 "bar" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@91..92 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@92..93 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@93..98 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@98..102 "x11" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@102..104 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@104..105 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@105..106 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@106..110 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@110..111 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@111..121 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@121..124 "bar" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@124..125 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@125..127 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@127..128 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@128..129 "}" [] [], - }, - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@129..134 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@134..138 "x12" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@138..140 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@140..141 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@141..142 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@142..146 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@146..147 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@147..154 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@154..156 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@156..157 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@157..158 "}" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@158..163 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@163..167 "x13" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@167..169 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@169..170 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@170..171 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@171..175 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@175..176 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@176..180 "bar" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@180..181 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@181..182 ")" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@182..187 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@187..191 "x14" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@191..193 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@193..194 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@194..195 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@195..199 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@199..200 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: VOID_KW@200..206 "void" [Newline("\n")] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@206..209 "bar" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@209..210 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@210..211 ")" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@211..218 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@218..221 "C1" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@221..222 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@222..234 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@234..245 "specialFoo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@245..247 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@247..248 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@248..249 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@249..255 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@255..256 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@256..268 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@268..272 "bar" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@272..274 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@274..277 "123" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@277..279 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@279..286 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@286..289 "C2" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@289..290 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@290..302 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@302..313 "specialFoo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@313..315 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@315..316 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@316..317 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@317..323 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@323..324 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@324..336 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@336..340 "bar" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@340..342 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@342..345 "123" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@345..347 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@347..354 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@354..357 "C3" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@357..358 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@358..371 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@371..382 "specialFoo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@382..384 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@384..385 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@385..386 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@386..392 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@392..393 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@393..406 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@406..410 "bar" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@410..412 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@412..415 "123" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@415..417 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@417..424 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@424..427 "C4" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@427..428 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@428..443 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@443..454 "specialFoo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@454..456 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@456..457 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@457..458 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@458..464 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@464..465 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@465..480 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@480..484 "bar" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@484..486 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@486..489 "123" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@489..491 "}" [Newline("\n")] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@491..498 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@498..501 "C5" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@501..502 "{" [] [], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@502..517 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@517..528 "specialFoo" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@528..530 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@530..531 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@531..532 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@532..538 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@538..539 ">" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@539..545 "#" [Newline("\n"), Whitespace(" ")] [], - id_token: IDENT@545..549 "bar" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@549..551 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@551..554 "123" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@554..556 "}" [Newline("\n")] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@556..563 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@563..567 "Bar" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@567..569 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@569..572 "Foo" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@572..573 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@573..579 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@579..580 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@580..587 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@587..591 "Baz" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@591..593 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@593..596 "123" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@596..597 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..597 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..596 - 0: JS_VARIABLE_STATEMENT@0..18 - 0: JS_VARIABLE_DECLARATION@0..18 - 0: (empty) - 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..18 - 0: JS_VARIABLE_DECLARATOR@6..18 - 0: JS_IDENTIFIER_BINDING@6..9 - 0: IDENT@6..9 "x5" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@9..18 - 0: EQ@9..11 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@11..18 - 0: JS_IDENTIFIER_EXPRESSION@11..12 - 0: JS_REFERENCE_IDENTIFIER@11..12 - 0: IDENT@11..12 "f" [] [] - 1: TS_TYPE_ARGUMENTS@12..18 - 0: L_ANGLE@12..13 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@13..17 - 0: TS_BOOLEAN_LITERAL_TYPE@13..17 - 0: TRUE_KW@13..17 "true" [] [] - 2: R_ANGLE@17..18 ">" [] [] - 1: (empty) - 1: JS_VARIABLE_STATEMENT@18..30 - 0: JS_VARIABLE_DECLARATION@18..29 - 0: (empty) - 1: LET_KW@18..23 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@23..29 - 0: JS_VARIABLE_DECLARATOR@23..29 - 0: JS_IDENTIFIER_BINDING@23..26 - 0: IDENT@23..26 "yy" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@26..29 - 0: EQ@26..28 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@28..29 - 0: JS_NUMBER_LITERAL@28..29 "0" [] [] - 1: SEMICOLON@29..30 ";" [] [] - 2: JS_VARIABLE_STATEMENT@30..49 - 0: JS_VARIABLE_DECLARATION@30..49 - 0: (empty) - 1: CONST_KW@30..37 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@37..49 - 0: JS_VARIABLE_DECLARATOR@37..49 - 0: JS_IDENTIFIER_BINDING@37..40 - 0: IDENT@37..40 "x6" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@40..49 - 0: EQ@40..42 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@42..49 - 0: JS_IDENTIFIER_EXPRESSION@42..43 - 0: JS_REFERENCE_IDENTIFIER@42..43 - 0: IDENT@42..43 "f" [] [] - 1: TS_TYPE_ARGUMENTS@43..49 - 0: L_ANGLE@43..44 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@44..48 - 0: TS_BOOLEAN_LITERAL_TYPE@44..48 - 0: TRUE_KW@44..48 "true" [] [] - 2: R_ANGLE@48..49 ">" [] [] - 1: (empty) - 3: TS_INTERFACE_DECLARATION@49..64 - 0: INTERFACE_KW@49..60 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@60..62 - 0: IDENT@60..62 "I" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@62..63 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@63..63 - 6: R_CURLY@63..64 "}" [] [] - 4: JS_VARIABLE_STATEMENT@64..82 - 0: JS_VARIABLE_DECLARATION@64..82 - 0: (empty) - 1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@69..82 - 0: JS_VARIABLE_DECLARATOR@69..82 - 0: JS_IDENTIFIER_BINDING@69..73 - 0: IDENT@69..73 "x10" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@73..82 - 0: EQ@73..75 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@75..82 - 0: JS_IDENTIFIER_EXPRESSION@75..76 - 0: JS_REFERENCE_IDENTIFIER@75..76 - 0: IDENT@75..76 "f" [] [] - 1: TS_TYPE_ARGUMENTS@76..82 - 0: L_ANGLE@76..77 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@77..81 - 0: TS_BOOLEAN_LITERAL_TYPE@77..81 - 0: TRUE_KW@77..81 "true" [] [] - 2: R_ANGLE@81..82 ">" [] [] - 1: (empty) - 5: JS_EXPRESSION_STATEMENT@82..93 - 0: JS_CALL_EXPRESSION@82..93 - 0: JS_STATIC_MEMBER_EXPRESSION@82..91 - 0: JS_THIS_EXPRESSION@82..87 - 0: THIS_KW@82..87 "this" [Newline("\n")] [] - 1: DOT@87..88 "." [] [] - 2: JS_NAME@88..91 - 0: IDENT@88..91 "bar" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@91..93 - 0: L_PAREN@91..92 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@92..92 - 2: R_PAREN@92..93 ")" [] [] - 1: (empty) - 6: JS_VARIABLE_STATEMENT@93..111 - 0: JS_VARIABLE_DECLARATION@93..111 - 0: (empty) - 1: LET_KW@93..98 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@98..111 - 0: JS_VARIABLE_DECLARATOR@98..111 - 0: JS_IDENTIFIER_BINDING@98..102 - 0: IDENT@98..102 "x11" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@102..111 - 0: EQ@102..104 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@104..111 - 0: JS_IDENTIFIER_EXPRESSION@104..105 - 0: JS_REFERENCE_IDENTIFIER@104..105 - 0: IDENT@104..105 "f" [] [] - 1: TS_TYPE_ARGUMENTS@105..111 - 0: L_ANGLE@105..106 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@106..110 - 0: TS_BOOLEAN_LITERAL_TYPE@106..110 - 0: TRUE_KW@106..110 "true" [] [] - 2: R_ANGLE@110..111 ">" [] [] - 1: (empty) - 7: JS_FUNCTION_DECLARATION@111..129 - 0: (empty) - 1: FUNCTION_KW@111..121 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@121..124 - 0: IDENT@121..124 "bar" [] [] - 4: (empty) - 5: JS_PARAMETERS@124..127 - 0: L_PAREN@124..125 "(" [] [] - 1: JS_PARAMETER_LIST@125..125 - 2: R_PAREN@125..127 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@127..129 - 0: L_CURLY@127..128 "{" [] [] - 1: JS_DIRECTIVE_LIST@128..128 - 2: JS_STATEMENT_LIST@128..128 - 3: R_CURLY@128..129 "}" [] [] - 8: JS_VARIABLE_STATEMENT@129..147 - 0: JS_VARIABLE_DECLARATION@129..147 - 0: (empty) - 1: LET_KW@129..134 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@134..147 - 0: JS_VARIABLE_DECLARATOR@134..147 - 0: JS_IDENTIFIER_BINDING@134..138 - 0: IDENT@134..138 "x12" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@138..147 - 0: EQ@138..140 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@140..147 - 0: JS_IDENTIFIER_EXPRESSION@140..141 - 0: JS_REFERENCE_IDENTIFIER@140..141 - 0: IDENT@140..141 "f" [] [] - 1: TS_TYPE_ARGUMENTS@141..147 - 0: L_ANGLE@141..142 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@142..146 - 0: TS_BOOLEAN_LITERAL_TYPE@142..146 - 0: TRUE_KW@142..146 "true" [] [] - 2: R_ANGLE@146..147 ">" [] [] - 1: (empty) - 9: JS_CLASS_DECLARATION@147..158 - 0: JS_DECORATOR_LIST@147..147 - 1: (empty) - 2: CLASS_KW@147..154 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@154..156 - 0: IDENT@154..156 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@156..157 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@157..157 - 9: R_CURLY@157..158 "}" [] [] - 10: JS_VARIABLE_STATEMENT@158..176 - 0: JS_VARIABLE_DECLARATION@158..176 - 0: (empty) - 1: LET_KW@158..163 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@163..176 - 0: JS_VARIABLE_DECLARATOR@163..176 - 0: JS_IDENTIFIER_BINDING@163..167 - 0: IDENT@163..167 "x13" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@167..176 - 0: EQ@167..169 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@169..176 - 0: JS_IDENTIFIER_EXPRESSION@169..170 - 0: JS_REFERENCE_IDENTIFIER@169..170 - 0: IDENT@169..170 "f" [] [] - 1: TS_TYPE_ARGUMENTS@170..176 - 0: L_ANGLE@170..171 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@171..175 - 0: TS_BOOLEAN_LITERAL_TYPE@171..175 - 0: TRUE_KW@171..175 "true" [] [] - 2: R_ANGLE@175..176 ">" [] [] - 1: (empty) - 11: JS_EXPRESSION_STATEMENT@176..182 - 0: JS_CALL_EXPRESSION@176..182 - 0: JS_IDENTIFIER_EXPRESSION@176..180 - 0: JS_REFERENCE_IDENTIFIER@176..180 - 0: IDENT@176..180 "bar" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@180..182 - 0: L_PAREN@180..181 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@181..181 - 2: R_PAREN@181..182 ")" [] [] - 1: (empty) - 12: JS_VARIABLE_STATEMENT@182..200 - 0: JS_VARIABLE_DECLARATION@182..200 - 0: (empty) - 1: LET_KW@182..187 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@187..200 - 0: JS_VARIABLE_DECLARATOR@187..200 - 0: JS_IDENTIFIER_BINDING@187..191 - 0: IDENT@187..191 "x14" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@191..200 - 0: EQ@191..193 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@193..200 - 0: JS_IDENTIFIER_EXPRESSION@193..194 - 0: JS_REFERENCE_IDENTIFIER@193..194 - 0: IDENT@193..194 "f" [] [] - 1: TS_TYPE_ARGUMENTS@194..200 - 0: L_ANGLE@194..195 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@195..199 - 0: TS_BOOLEAN_LITERAL_TYPE@195..199 - 0: TRUE_KW@195..199 "true" [] [] - 2: R_ANGLE@199..200 ">" [] [] - 1: (empty) - 13: JS_EXPRESSION_STATEMENT@200..211 - 0: JS_UNARY_EXPRESSION@200..211 - 0: VOID_KW@200..206 "void" [Newline("\n")] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@206..211 - 0: JS_IDENTIFIER_EXPRESSION@206..209 - 0: JS_REFERENCE_IDENTIFIER@206..209 - 0: IDENT@206..209 "bar" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@209..211 - 0: L_PAREN@209..210 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@210..210 - 2: R_PAREN@210..211 ")" [] [] - 1: (empty) - 14: JS_CLASS_DECLARATION@211..279 - 0: JS_DECORATOR_LIST@211..211 - 1: (empty) - 2: CLASS_KW@211..218 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@218..221 - 0: IDENT@218..221 "C1" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@221..222 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@222..277 - 0: JS_PROPERTY_CLASS_MEMBER@222..256 - 0: JS_PROPERTY_MODIFIER_LIST@222..234 - 0: JS_STATIC_MODIFIER@222..234 - 0: STATIC_KW@222..234 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@234..245 - 0: IDENT@234..245 "specialFoo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@245..256 - 0: EQ@245..247 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@247..256 - 0: JS_IDENTIFIER_EXPRESSION@247..248 - 0: JS_REFERENCE_IDENTIFIER@247..248 - 0: IDENT@247..248 "f" [] [] - 1: TS_TYPE_ARGUMENTS@248..256 - 0: L_ANGLE@248..249 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@249..255 - 0: TS_STRING_TYPE@249..255 - 0: STRING_KW@249..255 "string" [] [] - 2: R_ANGLE@255..256 ">" [] [] - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@256..277 - 0: JS_PROPERTY_MODIFIER_LIST@256..268 - 0: JS_STATIC_MODIFIER@256..268 - 0: STATIC_KW@256..268 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@268..272 - 0: IDENT@268..272 "bar" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@272..277 - 0: EQ@272..274 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@274..277 - 0: JS_NUMBER_LITERAL@274..277 "123" [] [] - 4: (empty) - 9: R_CURLY@277..279 "}" [Newline("\n")] [] - 15: JS_CLASS_DECLARATION@279..347 - 0: JS_DECORATOR_LIST@279..279 - 1: (empty) - 2: CLASS_KW@279..286 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@286..289 - 0: IDENT@286..289 "C2" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@289..290 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@290..345 - 0: JS_PROPERTY_CLASS_MEMBER@290..324 - 0: JS_PROPERTY_MODIFIER_LIST@290..302 - 0: TS_ACCESSIBILITY_MODIFIER@290..302 - 0: PUBLIC_KW@290..302 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@302..313 - 0: IDENT@302..313 "specialFoo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@313..324 - 0: EQ@313..315 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@315..324 - 0: JS_IDENTIFIER_EXPRESSION@315..316 - 0: JS_REFERENCE_IDENTIFIER@315..316 - 0: IDENT@315..316 "f" [] [] - 1: TS_TYPE_ARGUMENTS@316..324 - 0: L_ANGLE@316..317 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@317..323 - 0: TS_STRING_TYPE@317..323 - 0: STRING_KW@317..323 "string" [] [] - 2: R_ANGLE@323..324 ">" [] [] - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@324..345 - 0: JS_PROPERTY_MODIFIER_LIST@324..336 - 0: TS_ACCESSIBILITY_MODIFIER@324..336 - 0: PUBLIC_KW@324..336 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@336..340 - 0: IDENT@336..340 "bar" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@340..345 - 0: EQ@340..342 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@342..345 - 0: JS_NUMBER_LITERAL@342..345 "123" [] [] - 4: (empty) - 9: R_CURLY@345..347 "}" [Newline("\n")] [] - 16: JS_CLASS_DECLARATION@347..417 - 0: JS_DECORATOR_LIST@347..347 - 1: (empty) - 2: CLASS_KW@347..354 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@354..357 - 0: IDENT@354..357 "C3" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@357..358 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@358..415 - 0: JS_PROPERTY_CLASS_MEMBER@358..393 - 0: JS_PROPERTY_MODIFIER_LIST@358..371 - 0: TS_ACCESSIBILITY_MODIFIER@358..371 - 0: PRIVATE_KW@358..371 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@371..382 - 0: IDENT@371..382 "specialFoo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@382..393 - 0: EQ@382..384 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@384..393 - 0: JS_IDENTIFIER_EXPRESSION@384..385 - 0: JS_REFERENCE_IDENTIFIER@384..385 - 0: IDENT@384..385 "f" [] [] - 1: TS_TYPE_ARGUMENTS@385..393 - 0: L_ANGLE@385..386 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@386..392 - 0: TS_STRING_TYPE@386..392 - 0: STRING_KW@386..392 "string" [] [] - 2: R_ANGLE@392..393 ">" [] [] - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@393..415 - 0: JS_PROPERTY_MODIFIER_LIST@393..406 - 0: TS_ACCESSIBILITY_MODIFIER@393..406 - 0: PRIVATE_KW@393..406 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@406..410 - 0: IDENT@406..410 "bar" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@410..415 - 0: EQ@410..412 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@412..415 - 0: JS_NUMBER_LITERAL@412..415 "123" [] [] - 4: (empty) - 9: R_CURLY@415..417 "}" [Newline("\n")] [] - 17: JS_CLASS_DECLARATION@417..491 - 0: JS_DECORATOR_LIST@417..417 - 1: (empty) - 2: CLASS_KW@417..424 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@424..427 - 0: IDENT@424..427 "C4" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@427..428 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@428..489 - 0: JS_PROPERTY_CLASS_MEMBER@428..465 - 0: JS_PROPERTY_MODIFIER_LIST@428..443 - 0: TS_ACCESSIBILITY_MODIFIER@428..443 - 0: PROTECTED_KW@428..443 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@443..454 - 0: IDENT@443..454 "specialFoo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@454..465 - 0: EQ@454..456 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@456..465 - 0: JS_IDENTIFIER_EXPRESSION@456..457 - 0: JS_REFERENCE_IDENTIFIER@456..457 - 0: IDENT@456..457 "f" [] [] - 1: TS_TYPE_ARGUMENTS@457..465 - 0: L_ANGLE@457..458 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@458..464 - 0: TS_STRING_TYPE@458..464 - 0: STRING_KW@458..464 "string" [] [] - 2: R_ANGLE@464..465 ">" [] [] - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@465..489 - 0: JS_PROPERTY_MODIFIER_LIST@465..480 - 0: TS_ACCESSIBILITY_MODIFIER@465..480 - 0: PROTECTED_KW@465..480 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@480..484 - 0: IDENT@480..484 "bar" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@484..489 - 0: EQ@484..486 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@486..489 - 0: JS_NUMBER_LITERAL@486..489 "123" [] [] - 4: (empty) - 9: R_CURLY@489..491 "}" [Newline("\n")] [] - 18: JS_CLASS_DECLARATION@491..556 - 0: JS_DECORATOR_LIST@491..491 - 1: (empty) - 2: CLASS_KW@491..498 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@498..501 - 0: IDENT@498..501 "C5" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@501..502 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@502..554 - 0: JS_PROPERTY_CLASS_MEMBER@502..539 - 0: JS_PROPERTY_MODIFIER_LIST@502..517 - 0: TS_ACCESSIBILITY_MODIFIER@502..517 - 0: PROTECTED_KW@502..517 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@517..528 - 0: IDENT@517..528 "specialFoo" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@528..539 - 0: EQ@528..530 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@530..539 - 0: JS_IDENTIFIER_EXPRESSION@530..531 - 0: JS_REFERENCE_IDENTIFIER@530..531 - 0: IDENT@530..531 "f" [] [] - 1: TS_TYPE_ARGUMENTS@531..539 - 0: L_ANGLE@531..532 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@532..538 - 0: TS_STRING_TYPE@532..538 - 0: STRING_KW@532..538 "string" [] [] - 2: R_ANGLE@538..539 ">" [] [] - 4: (empty) - 1: JS_PROPERTY_CLASS_MEMBER@539..554 - 0: JS_PROPERTY_MODIFIER_LIST@539..539 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@539..549 - 0: HASH@539..545 "#" [Newline("\n"), Whitespace(" ")] [] - 1: IDENT@545..549 "bar" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@549..554 - 0: EQ@549..551 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@551..554 - 0: JS_NUMBER_LITERAL@551..554 "123" [] [] - 4: (empty) - 9: R_CURLY@554..556 "}" [Newline("\n")] [] - 19: JS_VARIABLE_STATEMENT@556..580 - 0: JS_VARIABLE_DECLARATION@556..580 - 0: (empty) - 1: CONST_KW@556..563 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@563..580 - 0: JS_VARIABLE_DECLARATOR@563..580 - 0: JS_IDENTIFIER_BINDING@563..567 - 0: IDENT@563..567 "Bar" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@567..580 - 0: EQ@567..569 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@569..580 - 0: JS_IDENTIFIER_EXPRESSION@569..572 - 0: JS_REFERENCE_IDENTIFIER@569..572 - 0: IDENT@569..572 "Foo" [] [] - 1: TS_TYPE_ARGUMENTS@572..580 - 0: L_ANGLE@572..573 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@573..579 - 0: TS_STRING_TYPE@573..579 - 0: STRING_KW@573..579 "string" [] [] - 2: R_ANGLE@579..580 ">" [] [] - 1: (empty) - 20: JS_VARIABLE_STATEMENT@580..596 - 0: JS_VARIABLE_DECLARATION@580..596 - 0: (empty) - 1: CONST_KW@580..587 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@587..596 - 0: JS_VARIABLE_DECLARATOR@587..596 - 0: JS_IDENTIFIER_BINDING@587..591 - 0: IDENT@587..591 "Baz" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@591..596 - 0: EQ@591..593 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@593..596 - 0: JS_NUMBER_LITERAL@593..596 "123" [] [] - 1: (empty) - 4: EOF@596..597 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast b/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast deleted file mode 100644 index dbb303989c0b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast +++ /dev/null @@ -1,2637 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@22..23 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@25..26 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@31..32 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@32..33 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@33..34 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsSuperExpression { - super_token: SUPER_KW@34..45 "super" [Newline("\n"), Whitespace(" ")] [], - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@45..46 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@46..47 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - ], - r_curly_token: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@53..63 "function" [Newline("\n")] [Whitespace(" ")], - star_token: STAR@63..64 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@64..65 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@65..66 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@68..69 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@69..80 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@80..82 "f" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@82..84 "=" [] [Whitespace(" ")], - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@84..85 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@85..86 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@86..87 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@87..88 ">" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@88..98 "yield" [Newline("\n"), Whitespace(" ")] [], - argument: missing (optional), - }, - semicolon_token: SEMICOLON@98..99 ";" [] [], - }, - ], - r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], - }, - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@101..103 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@103..104 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@104..105 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@105..106 ">" [] [], - }, - }, - operator_token: QUESTION2@106..110 "??" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@110..111 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@112..114 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@114..115 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@115..116 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@116..117 ">" [] [], - }, - }, - operator_token: PIPE2@117..121 "||" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@121..122 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@122..123 ";" [] [], - }, - JsExpressionStatement { - expression: JsLogicalExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@123..125 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@125..126 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@126..127 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@127..128 ">" [] [], - }, - }, - operator_token: AMP2@128..132 "&&" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@132..133 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@133..134 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@134..136 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@136..137 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@137..138 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@138..139 ">" [] [], - }, - }, - operator_token: PIPE@139..142 "|" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@142..143 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@143..144 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@144..146 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@146..147 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@147..148 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@148..149 ">" [] [], - }, - }, - operator_token: CARET@149..152 "^" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@152..153 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@153..154 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@154..156 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@156..157 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@157..158 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@158..159 ">" [] [], - }, - }, - operator_token: AMP@159..162 "&" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@162..163 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@163..164 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@164..166 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@166..167 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@167..168 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@168..169 ">" [] [], - }, - }, - operator_token: EQ2@169..173 "==" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@173..174 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@174..175 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@175..176 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@176..177 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@177..178 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@178..180 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@180..181 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@181..182 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@182..183 ">" [] [], - }, - }, - operator_token: LTEQ@183..187 "<=" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@187..188 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@188..189 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@189..190 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@190..191 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@191..192 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@192..194 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@194..195 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@195..196 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@196..197 ">" [] [], - }, - }, - operator_token: NEQ@197..201 "!=" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@201..202 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@202..203 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@203..204 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@204..205 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@205..206 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@206..208 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@208..209 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@209..210 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@210..211 ">" [] [], - }, - }, - operator_token: EQ3@211..216 "===" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@216..217 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@217..218 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@218..219 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@219..220 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@220..221 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@221..223 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@223..224 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@224..225 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@225..226 ">" [] [], - }, - }, - operator_token: NEQ2@226..231 "!==" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@231..232 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@232..233 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@233..234 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@234..235 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@235..236 ";" [] [], - }, - JsExpressionStatement { - expression: JsInstanceofExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@236..238 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@238..239 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@239..240 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@240..241 ">" [] [], - }, - }, - instanceof_token: INSTANCEOF_KW@241..253 "instanceof" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@253..254 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@254..255 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@255..256 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@256..257 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@257..258 ";" [] [], - }, - JsExpressionStatement { - expression: JsInExpression { - property: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@258..260 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@260..261 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@261..262 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@262..263 ">" [] [], - }, - }, - in_token: IN_KW@263..267 "in" [Newline("\n")] [Whitespace(" ")], - object: JsObjectExpression { - l_curly_token: L_CURLY@267..268 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@268..269 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@269..270 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@270..272 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@272..273 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@273..274 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@274..275 ">" [] [], - }, - }, - operator_token: STAR@275..278 "*" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@278..279 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@279..280 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@280..281 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@281..282 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@282..283 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@283..285 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@285..286 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@286..287 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@287..288 ">" [] [], - }, - }, - operator_token: SLASH@288..291 "/" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@291..292 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@292..293 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@293..294 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@294..295 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@295..296 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@296..298 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@298..299 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@299..300 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@300..301 ">" [] [], - }, - }, - operator_token: PERCENT@301..304 "%" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@304..305 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@305..306 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@306..307 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@307..308 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@308..309 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@309..311 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@311..312 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@312..313 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@313..314 ">" [] [], - }, - }, - operator_token: STAR2@314..318 "**" [Newline("\n")] [Whitespace(" ")], - right: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@318..319 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@319..320 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@320..321 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@321..322 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@322..323 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@323..326 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@326..327 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@327..328 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@328..329 ">" [] [], - right: JsUnaryExpression { - operator_token: PLUS@329..331 "+" [Newline("\n")] [], - argument: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@331..332 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@332..333 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@333..334 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@334..335 ">" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@335..336 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@336..339 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@339..340 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@340..341 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@341..342 ">" [] [], - right: JsUnaryExpression { - operator_token: MINUS@342..344 "-" [Newline("\n")] [], - argument: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@344..345 "f" [] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@345..346 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@346..347 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@347..348 ">" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@348..349 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@349..352 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@352..353 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@353..354 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@354..355 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsThisExpression { - this_token: THIS_KW@355..360 "this" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@360..361 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@361..364 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@364..365 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@365..366 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@366..367 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNullLiteralExpression { - value_token: NULL_KW@367..372 "null" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@372..373 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@373..376 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@376..377 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@377..378 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@378..379 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@379..384 "true" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@384..385 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@385..388 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@388..389 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@389..390 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@390..391 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBooleanLiteralExpression { - value_token: FALSE_KW@391..397 "false" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@397..398 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@398..401 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@401..402 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@402..403 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@403..404 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@404..406 "1" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@406..407 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@407..410 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@410..411 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@411..412 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@412..413 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsBigintLiteralExpression { - value_token: JS_BIGINT_LITERAL@413..418 "123n" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@418..419 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@419..422 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@422..423 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@423..424 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@424..425 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsBlockStatement { - l_curly_token: L_CURLY@425..427 "{" [Newline("\n")] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@427..428 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@428..429 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@429..432 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@432..433 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@433..434 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@434..435 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@435..445 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@445..449 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@449..450 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@450..452 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@452..453 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@453..454 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@454..455 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@455..458 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@458..459 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@459..460 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@460..461 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@461..468 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@468..470 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@470..471 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@471..472 "}" [] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@472..473 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@476..477 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@477..478 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@478..479 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@479..484 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@484..485 "A" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@485..486 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@486..487 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@487..488 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@488..490 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@490..491 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@491..492 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@492..493 ">" [] [], - }, - }, - operator_token: SLASH@493..496 "/" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@496..497 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@497..498 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@498..501 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@501..502 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@502..503 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@503..504 ">" [] [], - right: JsUnaryExpression { - operator_token: PLUS@504..506 "+" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@506..507 "1" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@507..508 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@508..511 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@511..512 "<" [] [], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@512..513 "T" [] [], - }, - }, - }, - operator_token: R_ANGLE@513..514 ">" [] [], - right: JsUnaryExpression { - operator_token: MINUS@514..516 "-" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@516..517 "1" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@517..518 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@518..521 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@521..522 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@522..523 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@523..524 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: TILDE@524..526 "~" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@526..527 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@527..528 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@528..531 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@531..532 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@532..533 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@533..534 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: BANG@534..536 "!" [Newline("\n")] [], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@536..537 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@537..538 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@538..541 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@541..542 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@542..543 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@543..544 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@544..559 "someIdentifier" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@559..560 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@563..564 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@564..565 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@565..566 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@566..574 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@574..575 "a" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@575..576 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@576..581 "field" [] [], - }, - }, - r_brack_token: R_BRACK@581..582 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@582..583 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@583..586 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@586..587 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@587..588 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@588..589 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: TYPEOF_KW@589..597 "typeof" [Newline("\n")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@597..604 "MyClass" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@604..605 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@605..608 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@608..609 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@609..610 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@610..611 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: VOID_KW@611..617 "void" [Newline("\n")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@617..618 "a" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@618..619 ";" [] [], - }, - JsExpressionStatement { - expression: JsBinaryExpression { - left: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@619..621 "f" [Newline("\n")] [], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@621..622 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@622..623 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@623..624 ">" [] [], - }, - }, - operator_token: LTEQ@624..628 "<=" [Newline("\n")] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@628..629 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@629..630 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@630..633 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@633..634 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@634..635 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@635..636 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@636..638 "(" [Newline("\n")] [], - args: JsCallArgumentList [ - JsAwaitExpression { - await_token: AWAIT_KW@638..644 "await" [] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@644..645 "1" [] [], - }, - }, - ], - r_paren_token: R_PAREN@645..646 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@646..647 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@647..650 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@650..651 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@651..652 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@652..653 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsImportMetaExpression { - import_token: IMPORT_KW@653..660 "import" [Newline("\n")] [], - dot_token: DOT@660..661 "." [] [], - meta_token: META@661..665 "meta" [] [], - }, - semicolon_token: SEMICOLON@665..666 ";" [] [], - }, - JsExpressionStatement { - expression: TsInstantiationExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@666..669 "f" [Newline("\n")] [Whitespace(" ")], - }, - }, - arguments: TsTypeArguments { - l_angle_token: L_ANGLE@669..670 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@670..671 "T" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@671..672 ">" [] [], - }, - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@672..679 "import" [Newline("\n")] [], - arguments: JsCallArguments { - l_paren_token: L_PAREN@679..680 "(" [] [], - args: JsCallArgumentList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@680..685 "\"123\"" [] [], - }, - ], - r_paren_token: R_PAREN@685..686 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@686..687 ";" [] [], - }, - ], - eof_token: EOF@687..688 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..688 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..687 - 0: JS_CLASS_DECLARATION@0..53 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..51 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..51 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 - 1: JS_LITERAL_MEMBER_NAME@9..22 - 0: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@22..25 - 0: L_PAREN@22..23 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@23..23 - 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@25..51 - 0: L_CURLY@25..26 "{" [] [] - 1: JS_DIRECTIVE_LIST@26..26 - 2: JS_STATEMENT_LIST@26..48 - 0: JS_EXPRESSION_STATEMENT@26..34 - 0: TS_INSTANTIATION_EXPRESSION@26..34 - 0: JS_IDENTIFIER_EXPRESSION@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [] - 1: TS_TYPE_ARGUMENTS@31..34 - 0: L_ANGLE@31..32 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@32..33 - 0: TS_REFERENCE_TYPE@32..33 - 0: JS_REFERENCE_IDENTIFIER@32..33 - 0: IDENT@32..33 "T" [] [] - 1: (empty) - 2: R_ANGLE@33..34 ">" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@34..48 - 0: JS_CALL_EXPRESSION@34..47 - 0: JS_SUPER_EXPRESSION@34..45 - 0: SUPER_KW@34..45 "super" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@45..47 - 0: L_PAREN@45..46 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@46..46 - 2: R_PAREN@46..47 ")" [] [] - 1: SEMICOLON@47..48 ";" [] [] - 3: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@51..53 "}" [Newline("\n")] [] - 1: JS_FUNCTION_DECLARATION@53..101 - 0: (empty) - 1: FUNCTION_KW@53..63 "function" [Newline("\n")] [Whitespace(" ")] - 2: STAR@63..64 "*" [] [] - 3: JS_IDENTIFIER_BINDING@64..65 - 0: IDENT@64..65 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@65..68 - 0: L_PAREN@65..66 "(" [] [] - 1: JS_PARAMETER_LIST@66..66 - 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@68..101 - 0: L_CURLY@68..69 "{" [] [] - 1: JS_DIRECTIVE_LIST@69..69 - 2: JS_STATEMENT_LIST@69..99 - 0: JS_VARIABLE_STATEMENT@69..88 - 0: JS_VARIABLE_DECLARATION@69..88 - 0: (empty) - 1: CONST_KW@69..80 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@80..88 - 0: JS_VARIABLE_DECLARATOR@80..88 - 0: JS_IDENTIFIER_BINDING@80..82 - 0: IDENT@80..82 "f" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@82..88 - 0: EQ@82..84 "=" [] [Whitespace(" ")] - 1: TS_INSTANTIATION_EXPRESSION@84..88 - 0: JS_IDENTIFIER_EXPRESSION@84..85 - 0: JS_REFERENCE_IDENTIFIER@84..85 - 0: IDENT@84..85 "f" [] [] - 1: TS_TYPE_ARGUMENTS@85..88 - 0: L_ANGLE@85..86 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@86..87 - 0: TS_REFERENCE_TYPE@86..87 - 0: JS_REFERENCE_IDENTIFIER@86..87 - 0: IDENT@86..87 "T" [] [] - 1: (empty) - 2: R_ANGLE@87..88 ">" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@88..99 - 0: JS_YIELD_EXPRESSION@88..98 - 0: YIELD_KW@88..98 "yield" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 1: SEMICOLON@98..99 ";" [] [] - 3: R_CURLY@99..101 "}" [Newline("\n")] [] - 2: JS_EXPRESSION_STATEMENT@101..112 - 0: JS_LOGICAL_EXPRESSION@101..111 - 0: TS_INSTANTIATION_EXPRESSION@101..106 - 0: JS_IDENTIFIER_EXPRESSION@101..103 - 0: JS_REFERENCE_IDENTIFIER@101..103 - 0: IDENT@101..103 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@103..106 - 0: L_ANGLE@103..104 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@104..105 - 0: TS_REFERENCE_TYPE@104..105 - 0: JS_REFERENCE_IDENTIFIER@104..105 - 0: IDENT@104..105 "T" [] [] - 1: (empty) - 2: R_ANGLE@105..106 ">" [] [] - 1: QUESTION2@106..110 "??" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@110..111 - 0: JS_NUMBER_LITERAL@110..111 "1" [] [] - 1: SEMICOLON@111..112 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@112..123 - 0: JS_LOGICAL_EXPRESSION@112..122 - 0: TS_INSTANTIATION_EXPRESSION@112..117 - 0: JS_IDENTIFIER_EXPRESSION@112..114 - 0: JS_REFERENCE_IDENTIFIER@112..114 - 0: IDENT@112..114 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@114..117 - 0: L_ANGLE@114..115 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@115..116 - 0: TS_REFERENCE_TYPE@115..116 - 0: JS_REFERENCE_IDENTIFIER@115..116 - 0: IDENT@115..116 "T" [] [] - 1: (empty) - 2: R_ANGLE@116..117 ">" [] [] - 1: PIPE2@117..121 "||" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@121..122 - 0: JS_NUMBER_LITERAL@121..122 "1" [] [] - 1: SEMICOLON@122..123 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@123..134 - 0: JS_LOGICAL_EXPRESSION@123..133 - 0: TS_INSTANTIATION_EXPRESSION@123..128 - 0: JS_IDENTIFIER_EXPRESSION@123..125 - 0: JS_REFERENCE_IDENTIFIER@123..125 - 0: IDENT@123..125 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@125..128 - 0: L_ANGLE@125..126 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@126..127 - 0: TS_REFERENCE_TYPE@126..127 - 0: JS_REFERENCE_IDENTIFIER@126..127 - 0: IDENT@126..127 "T" [] [] - 1: (empty) - 2: R_ANGLE@127..128 ">" [] [] - 1: AMP2@128..132 "&&" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@132..133 - 0: JS_NUMBER_LITERAL@132..133 "1" [] [] - 1: SEMICOLON@133..134 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@134..144 - 0: JS_BINARY_EXPRESSION@134..143 - 0: TS_INSTANTIATION_EXPRESSION@134..139 - 0: JS_IDENTIFIER_EXPRESSION@134..136 - 0: JS_REFERENCE_IDENTIFIER@134..136 - 0: IDENT@134..136 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@136..139 - 0: L_ANGLE@136..137 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@137..138 - 0: TS_REFERENCE_TYPE@137..138 - 0: JS_REFERENCE_IDENTIFIER@137..138 - 0: IDENT@137..138 "T" [] [] - 1: (empty) - 2: R_ANGLE@138..139 ">" [] [] - 1: PIPE@139..142 "|" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@142..143 - 0: JS_NUMBER_LITERAL@142..143 "1" [] [] - 1: SEMICOLON@143..144 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@144..154 - 0: JS_BINARY_EXPRESSION@144..153 - 0: TS_INSTANTIATION_EXPRESSION@144..149 - 0: JS_IDENTIFIER_EXPRESSION@144..146 - 0: JS_REFERENCE_IDENTIFIER@144..146 - 0: IDENT@144..146 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@146..149 - 0: L_ANGLE@146..147 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@147..148 - 0: TS_REFERENCE_TYPE@147..148 - 0: JS_REFERENCE_IDENTIFIER@147..148 - 0: IDENT@147..148 "T" [] [] - 1: (empty) - 2: R_ANGLE@148..149 ">" [] [] - 1: CARET@149..152 "^" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@152..153 - 0: JS_NUMBER_LITERAL@152..153 "1" [] [] - 1: SEMICOLON@153..154 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@154..164 - 0: JS_BINARY_EXPRESSION@154..163 - 0: TS_INSTANTIATION_EXPRESSION@154..159 - 0: JS_IDENTIFIER_EXPRESSION@154..156 - 0: JS_REFERENCE_IDENTIFIER@154..156 - 0: IDENT@154..156 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@156..159 - 0: L_ANGLE@156..157 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@157..158 - 0: TS_REFERENCE_TYPE@157..158 - 0: JS_REFERENCE_IDENTIFIER@157..158 - 0: IDENT@157..158 "T" [] [] - 1: (empty) - 2: R_ANGLE@158..159 ">" [] [] - 1: AMP@159..162 "&" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@162..163 - 0: JS_NUMBER_LITERAL@162..163 "1" [] [] - 1: SEMICOLON@163..164 ";" [] [] - 8: JS_EXPRESSION_STATEMENT@164..178 - 0: JS_BINARY_EXPRESSION@164..177 - 0: TS_INSTANTIATION_EXPRESSION@164..169 - 0: JS_IDENTIFIER_EXPRESSION@164..166 - 0: JS_REFERENCE_IDENTIFIER@164..166 - 0: IDENT@164..166 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@166..169 - 0: L_ANGLE@166..167 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@167..168 - 0: TS_REFERENCE_TYPE@167..168 - 0: JS_REFERENCE_IDENTIFIER@167..168 - 0: IDENT@167..168 "T" [] [] - 1: (empty) - 2: R_ANGLE@168..169 ">" [] [] - 1: EQ2@169..173 "==" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@173..177 - 0: JS_IDENTIFIER_EXPRESSION@173..174 - 0: JS_REFERENCE_IDENTIFIER@173..174 - 0: IDENT@173..174 "f" [] [] - 1: TS_TYPE_ARGUMENTS@174..177 - 0: L_ANGLE@174..175 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@175..176 - 0: TS_REFERENCE_TYPE@175..176 - 0: JS_REFERENCE_IDENTIFIER@175..176 - 0: IDENT@175..176 "T" [] [] - 1: (empty) - 2: R_ANGLE@176..177 ">" [] [] - 1: SEMICOLON@177..178 ";" [] [] - 9: JS_EXPRESSION_STATEMENT@178..192 - 0: JS_BINARY_EXPRESSION@178..191 - 0: TS_INSTANTIATION_EXPRESSION@178..183 - 0: JS_IDENTIFIER_EXPRESSION@178..180 - 0: JS_REFERENCE_IDENTIFIER@178..180 - 0: IDENT@178..180 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@180..183 - 0: L_ANGLE@180..181 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@181..182 - 0: TS_REFERENCE_TYPE@181..182 - 0: JS_REFERENCE_IDENTIFIER@181..182 - 0: IDENT@181..182 "T" [] [] - 1: (empty) - 2: R_ANGLE@182..183 ">" [] [] - 1: LTEQ@183..187 "<=" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@187..191 - 0: JS_IDENTIFIER_EXPRESSION@187..188 - 0: JS_REFERENCE_IDENTIFIER@187..188 - 0: IDENT@187..188 "f" [] [] - 1: TS_TYPE_ARGUMENTS@188..191 - 0: L_ANGLE@188..189 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@189..190 - 0: TS_REFERENCE_TYPE@189..190 - 0: JS_REFERENCE_IDENTIFIER@189..190 - 0: IDENT@189..190 "T" [] [] - 1: (empty) - 2: R_ANGLE@190..191 ">" [] [] - 1: SEMICOLON@191..192 ";" [] [] - 10: JS_EXPRESSION_STATEMENT@192..206 - 0: JS_BINARY_EXPRESSION@192..205 - 0: TS_INSTANTIATION_EXPRESSION@192..197 - 0: JS_IDENTIFIER_EXPRESSION@192..194 - 0: JS_REFERENCE_IDENTIFIER@192..194 - 0: IDENT@192..194 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@194..197 - 0: L_ANGLE@194..195 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@195..196 - 0: TS_REFERENCE_TYPE@195..196 - 0: JS_REFERENCE_IDENTIFIER@195..196 - 0: IDENT@195..196 "T" [] [] - 1: (empty) - 2: R_ANGLE@196..197 ">" [] [] - 1: NEQ@197..201 "!=" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@201..205 - 0: JS_IDENTIFIER_EXPRESSION@201..202 - 0: JS_REFERENCE_IDENTIFIER@201..202 - 0: IDENT@201..202 "f" [] [] - 1: TS_TYPE_ARGUMENTS@202..205 - 0: L_ANGLE@202..203 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@203..204 - 0: TS_REFERENCE_TYPE@203..204 - 0: JS_REFERENCE_IDENTIFIER@203..204 - 0: IDENT@203..204 "T" [] [] - 1: (empty) - 2: R_ANGLE@204..205 ">" [] [] - 1: SEMICOLON@205..206 ";" [] [] - 11: JS_EXPRESSION_STATEMENT@206..221 - 0: JS_BINARY_EXPRESSION@206..220 - 0: TS_INSTANTIATION_EXPRESSION@206..211 - 0: JS_IDENTIFIER_EXPRESSION@206..208 - 0: JS_REFERENCE_IDENTIFIER@206..208 - 0: IDENT@206..208 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@208..211 - 0: L_ANGLE@208..209 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@209..210 - 0: TS_REFERENCE_TYPE@209..210 - 0: JS_REFERENCE_IDENTIFIER@209..210 - 0: IDENT@209..210 "T" [] [] - 1: (empty) - 2: R_ANGLE@210..211 ">" [] [] - 1: EQ3@211..216 "===" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@216..220 - 0: JS_IDENTIFIER_EXPRESSION@216..217 - 0: JS_REFERENCE_IDENTIFIER@216..217 - 0: IDENT@216..217 "f" [] [] - 1: TS_TYPE_ARGUMENTS@217..220 - 0: L_ANGLE@217..218 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@218..219 - 0: TS_REFERENCE_TYPE@218..219 - 0: JS_REFERENCE_IDENTIFIER@218..219 - 0: IDENT@218..219 "T" [] [] - 1: (empty) - 2: R_ANGLE@219..220 ">" [] [] - 1: SEMICOLON@220..221 ";" [] [] - 12: JS_EXPRESSION_STATEMENT@221..236 - 0: JS_BINARY_EXPRESSION@221..235 - 0: TS_INSTANTIATION_EXPRESSION@221..226 - 0: JS_IDENTIFIER_EXPRESSION@221..223 - 0: JS_REFERENCE_IDENTIFIER@221..223 - 0: IDENT@221..223 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@223..226 - 0: L_ANGLE@223..224 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@224..225 - 0: TS_REFERENCE_TYPE@224..225 - 0: JS_REFERENCE_IDENTIFIER@224..225 - 0: IDENT@224..225 "T" [] [] - 1: (empty) - 2: R_ANGLE@225..226 ">" [] [] - 1: NEQ2@226..231 "!==" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@231..235 - 0: JS_IDENTIFIER_EXPRESSION@231..232 - 0: JS_REFERENCE_IDENTIFIER@231..232 - 0: IDENT@231..232 "f" [] [] - 1: TS_TYPE_ARGUMENTS@232..235 - 0: L_ANGLE@232..233 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@233..234 - 0: TS_REFERENCE_TYPE@233..234 - 0: JS_REFERENCE_IDENTIFIER@233..234 - 0: IDENT@233..234 "T" [] [] - 1: (empty) - 2: R_ANGLE@234..235 ">" [] [] - 1: SEMICOLON@235..236 ";" [] [] - 13: JS_EXPRESSION_STATEMENT@236..258 - 0: JS_INSTANCEOF_EXPRESSION@236..257 - 0: TS_INSTANTIATION_EXPRESSION@236..241 - 0: JS_IDENTIFIER_EXPRESSION@236..238 - 0: JS_REFERENCE_IDENTIFIER@236..238 - 0: IDENT@236..238 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@238..241 - 0: L_ANGLE@238..239 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@239..240 - 0: TS_REFERENCE_TYPE@239..240 - 0: JS_REFERENCE_IDENTIFIER@239..240 - 0: IDENT@239..240 "T" [] [] - 1: (empty) - 2: R_ANGLE@240..241 ">" [] [] - 1: INSTANCEOF_KW@241..253 "instanceof" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@253..257 - 0: JS_IDENTIFIER_EXPRESSION@253..254 - 0: JS_REFERENCE_IDENTIFIER@253..254 - 0: IDENT@253..254 "f" [] [] - 1: TS_TYPE_ARGUMENTS@254..257 - 0: L_ANGLE@254..255 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@255..256 - 0: TS_REFERENCE_TYPE@255..256 - 0: JS_REFERENCE_IDENTIFIER@255..256 - 0: IDENT@255..256 "T" [] [] - 1: (empty) - 2: R_ANGLE@256..257 ">" [] [] - 1: SEMICOLON@257..258 ";" [] [] - 14: JS_EXPRESSION_STATEMENT@258..270 - 0: JS_IN_EXPRESSION@258..269 - 0: TS_INSTANTIATION_EXPRESSION@258..263 - 0: JS_IDENTIFIER_EXPRESSION@258..260 - 0: JS_REFERENCE_IDENTIFIER@258..260 - 0: IDENT@258..260 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@260..263 - 0: L_ANGLE@260..261 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@261..262 - 0: TS_REFERENCE_TYPE@261..262 - 0: JS_REFERENCE_IDENTIFIER@261..262 - 0: IDENT@261..262 "T" [] [] - 1: (empty) - 2: R_ANGLE@262..263 ">" [] [] - 1: IN_KW@263..267 "in" [Newline("\n")] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@267..269 - 0: L_CURLY@267..268 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@268..268 - 2: R_CURLY@268..269 "}" [] [] - 1: SEMICOLON@269..270 ";" [] [] - 15: JS_EXPRESSION_STATEMENT@270..283 - 0: JS_BINARY_EXPRESSION@270..282 - 0: TS_INSTANTIATION_EXPRESSION@270..275 - 0: JS_IDENTIFIER_EXPRESSION@270..272 - 0: JS_REFERENCE_IDENTIFIER@270..272 - 0: IDENT@270..272 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@272..275 - 0: L_ANGLE@272..273 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@273..274 - 0: TS_REFERENCE_TYPE@273..274 - 0: JS_REFERENCE_IDENTIFIER@273..274 - 0: IDENT@273..274 "T" [] [] - 1: (empty) - 2: R_ANGLE@274..275 ">" [] [] - 1: STAR@275..278 "*" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@278..282 - 0: JS_IDENTIFIER_EXPRESSION@278..279 - 0: JS_REFERENCE_IDENTIFIER@278..279 - 0: IDENT@278..279 "f" [] [] - 1: TS_TYPE_ARGUMENTS@279..282 - 0: L_ANGLE@279..280 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@280..281 - 0: TS_REFERENCE_TYPE@280..281 - 0: JS_REFERENCE_IDENTIFIER@280..281 - 0: IDENT@280..281 "T" [] [] - 1: (empty) - 2: R_ANGLE@281..282 ">" [] [] - 1: SEMICOLON@282..283 ";" [] [] - 16: JS_EXPRESSION_STATEMENT@283..296 - 0: JS_BINARY_EXPRESSION@283..295 - 0: TS_INSTANTIATION_EXPRESSION@283..288 - 0: JS_IDENTIFIER_EXPRESSION@283..285 - 0: JS_REFERENCE_IDENTIFIER@283..285 - 0: IDENT@283..285 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@285..288 - 0: L_ANGLE@285..286 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@286..287 - 0: TS_REFERENCE_TYPE@286..287 - 0: JS_REFERENCE_IDENTIFIER@286..287 - 0: IDENT@286..287 "T" [] [] - 1: (empty) - 2: R_ANGLE@287..288 ">" [] [] - 1: SLASH@288..291 "/" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@291..295 - 0: JS_IDENTIFIER_EXPRESSION@291..292 - 0: JS_REFERENCE_IDENTIFIER@291..292 - 0: IDENT@291..292 "f" [] [] - 1: TS_TYPE_ARGUMENTS@292..295 - 0: L_ANGLE@292..293 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@293..294 - 0: TS_REFERENCE_TYPE@293..294 - 0: JS_REFERENCE_IDENTIFIER@293..294 - 0: IDENT@293..294 "T" [] [] - 1: (empty) - 2: R_ANGLE@294..295 ">" [] [] - 1: SEMICOLON@295..296 ";" [] [] - 17: JS_EXPRESSION_STATEMENT@296..309 - 0: JS_BINARY_EXPRESSION@296..308 - 0: TS_INSTANTIATION_EXPRESSION@296..301 - 0: JS_IDENTIFIER_EXPRESSION@296..298 - 0: JS_REFERENCE_IDENTIFIER@296..298 - 0: IDENT@296..298 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@298..301 - 0: L_ANGLE@298..299 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@299..300 - 0: TS_REFERENCE_TYPE@299..300 - 0: JS_REFERENCE_IDENTIFIER@299..300 - 0: IDENT@299..300 "T" [] [] - 1: (empty) - 2: R_ANGLE@300..301 ">" [] [] - 1: PERCENT@301..304 "%" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@304..308 - 0: JS_IDENTIFIER_EXPRESSION@304..305 - 0: JS_REFERENCE_IDENTIFIER@304..305 - 0: IDENT@304..305 "f" [] [] - 1: TS_TYPE_ARGUMENTS@305..308 - 0: L_ANGLE@305..306 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@306..307 - 0: TS_REFERENCE_TYPE@306..307 - 0: JS_REFERENCE_IDENTIFIER@306..307 - 0: IDENT@306..307 "T" [] [] - 1: (empty) - 2: R_ANGLE@307..308 ">" [] [] - 1: SEMICOLON@308..309 ";" [] [] - 18: JS_EXPRESSION_STATEMENT@309..323 - 0: JS_BINARY_EXPRESSION@309..322 - 0: TS_INSTANTIATION_EXPRESSION@309..314 - 0: JS_IDENTIFIER_EXPRESSION@309..311 - 0: JS_REFERENCE_IDENTIFIER@309..311 - 0: IDENT@309..311 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@311..314 - 0: L_ANGLE@311..312 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@312..313 - 0: TS_REFERENCE_TYPE@312..313 - 0: JS_REFERENCE_IDENTIFIER@312..313 - 0: IDENT@312..313 "T" [] [] - 1: (empty) - 2: R_ANGLE@313..314 ">" [] [] - 1: STAR2@314..318 "**" [Newline("\n")] [Whitespace(" ")] - 2: TS_INSTANTIATION_EXPRESSION@318..322 - 0: JS_IDENTIFIER_EXPRESSION@318..319 - 0: JS_REFERENCE_IDENTIFIER@318..319 - 0: IDENT@318..319 "f" [] [] - 1: TS_TYPE_ARGUMENTS@319..322 - 0: L_ANGLE@319..320 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@320..321 - 0: TS_REFERENCE_TYPE@320..321 - 0: JS_REFERENCE_IDENTIFIER@320..321 - 0: IDENT@320..321 "T" [] [] - 1: (empty) - 2: R_ANGLE@321..322 ">" [] [] - 1: SEMICOLON@322..323 ";" [] [] - 19: JS_EXPRESSION_STATEMENT@323..336 - 0: JS_BINARY_EXPRESSION@323..335 - 0: JS_BINARY_EXPRESSION@323..328 - 0: JS_IDENTIFIER_EXPRESSION@323..326 - 0: JS_REFERENCE_IDENTIFIER@323..326 - 0: IDENT@323..326 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@326..327 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@327..328 - 0: JS_REFERENCE_IDENTIFIER@327..328 - 0: IDENT@327..328 "T" [] [] - 1: R_ANGLE@328..329 ">" [] [] - 2: JS_UNARY_EXPRESSION@329..335 - 0: PLUS@329..331 "+" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@331..335 - 0: JS_IDENTIFIER_EXPRESSION@331..332 - 0: JS_REFERENCE_IDENTIFIER@331..332 - 0: IDENT@331..332 "f" [] [] - 1: TS_TYPE_ARGUMENTS@332..335 - 0: L_ANGLE@332..333 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@333..334 - 0: TS_REFERENCE_TYPE@333..334 - 0: JS_REFERENCE_IDENTIFIER@333..334 - 0: IDENT@333..334 "T" [] [] - 1: (empty) - 2: R_ANGLE@334..335 ">" [] [] - 1: SEMICOLON@335..336 ";" [] [] - 20: JS_EXPRESSION_STATEMENT@336..349 - 0: JS_BINARY_EXPRESSION@336..348 - 0: JS_BINARY_EXPRESSION@336..341 - 0: JS_IDENTIFIER_EXPRESSION@336..339 - 0: JS_REFERENCE_IDENTIFIER@336..339 - 0: IDENT@336..339 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@339..340 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@340..341 - 0: JS_REFERENCE_IDENTIFIER@340..341 - 0: IDENT@340..341 "T" [] [] - 1: R_ANGLE@341..342 ">" [] [] - 2: JS_UNARY_EXPRESSION@342..348 - 0: MINUS@342..344 "-" [Newline("\n")] [] - 1: TS_INSTANTIATION_EXPRESSION@344..348 - 0: JS_IDENTIFIER_EXPRESSION@344..345 - 0: JS_REFERENCE_IDENTIFIER@344..345 - 0: IDENT@344..345 "f" [] [] - 1: TS_TYPE_ARGUMENTS@345..348 - 0: L_ANGLE@345..346 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@346..347 - 0: TS_REFERENCE_TYPE@346..347 - 0: JS_REFERENCE_IDENTIFIER@346..347 - 0: IDENT@346..347 "T" [] [] - 1: (empty) - 2: R_ANGLE@347..348 ">" [] [] - 1: SEMICOLON@348..349 ";" [] [] - 21: JS_EXPRESSION_STATEMENT@349..355 - 0: TS_INSTANTIATION_EXPRESSION@349..355 - 0: JS_IDENTIFIER_EXPRESSION@349..352 - 0: JS_REFERENCE_IDENTIFIER@349..352 - 0: IDENT@349..352 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@352..355 - 0: L_ANGLE@352..353 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@353..354 - 0: TS_REFERENCE_TYPE@353..354 - 0: JS_REFERENCE_IDENTIFIER@353..354 - 0: IDENT@353..354 "T" [] [] - 1: (empty) - 2: R_ANGLE@354..355 ">" [] [] - 1: (empty) - 22: JS_EXPRESSION_STATEMENT@355..361 - 0: JS_THIS_EXPRESSION@355..360 - 0: THIS_KW@355..360 "this" [Newline("\n")] [] - 1: SEMICOLON@360..361 ";" [] [] - 23: JS_EXPRESSION_STATEMENT@361..367 - 0: TS_INSTANTIATION_EXPRESSION@361..367 - 0: JS_IDENTIFIER_EXPRESSION@361..364 - 0: JS_REFERENCE_IDENTIFIER@361..364 - 0: IDENT@361..364 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@364..367 - 0: L_ANGLE@364..365 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@365..366 - 0: TS_REFERENCE_TYPE@365..366 - 0: JS_REFERENCE_IDENTIFIER@365..366 - 0: IDENT@365..366 "T" [] [] - 1: (empty) - 2: R_ANGLE@366..367 ">" [] [] - 1: (empty) - 24: JS_EXPRESSION_STATEMENT@367..373 - 0: JS_NULL_LITERAL_EXPRESSION@367..372 - 0: NULL_KW@367..372 "null" [Newline("\n")] [] - 1: SEMICOLON@372..373 ";" [] [] - 25: JS_EXPRESSION_STATEMENT@373..379 - 0: TS_INSTANTIATION_EXPRESSION@373..379 - 0: JS_IDENTIFIER_EXPRESSION@373..376 - 0: JS_REFERENCE_IDENTIFIER@373..376 - 0: IDENT@373..376 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@376..379 - 0: L_ANGLE@376..377 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@377..378 - 0: TS_REFERENCE_TYPE@377..378 - 0: JS_REFERENCE_IDENTIFIER@377..378 - 0: IDENT@377..378 "T" [] [] - 1: (empty) - 2: R_ANGLE@378..379 ">" [] [] - 1: (empty) - 26: JS_EXPRESSION_STATEMENT@379..385 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@379..384 - 0: TRUE_KW@379..384 "true" [Newline("\n")] [] - 1: SEMICOLON@384..385 ";" [] [] - 27: JS_EXPRESSION_STATEMENT@385..391 - 0: TS_INSTANTIATION_EXPRESSION@385..391 - 0: JS_IDENTIFIER_EXPRESSION@385..388 - 0: JS_REFERENCE_IDENTIFIER@385..388 - 0: IDENT@385..388 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@388..391 - 0: L_ANGLE@388..389 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@389..390 - 0: TS_REFERENCE_TYPE@389..390 - 0: JS_REFERENCE_IDENTIFIER@389..390 - 0: IDENT@389..390 "T" [] [] - 1: (empty) - 2: R_ANGLE@390..391 ">" [] [] - 1: (empty) - 28: JS_EXPRESSION_STATEMENT@391..398 - 0: JS_BOOLEAN_LITERAL_EXPRESSION@391..397 - 0: FALSE_KW@391..397 "false" [Newline("\n")] [] - 1: SEMICOLON@397..398 ";" [] [] - 29: JS_EXPRESSION_STATEMENT@398..404 - 0: TS_INSTANTIATION_EXPRESSION@398..404 - 0: JS_IDENTIFIER_EXPRESSION@398..401 - 0: JS_REFERENCE_IDENTIFIER@398..401 - 0: IDENT@398..401 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@401..404 - 0: L_ANGLE@401..402 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@402..403 - 0: TS_REFERENCE_TYPE@402..403 - 0: JS_REFERENCE_IDENTIFIER@402..403 - 0: IDENT@402..403 "T" [] [] - 1: (empty) - 2: R_ANGLE@403..404 ">" [] [] - 1: (empty) - 30: JS_EXPRESSION_STATEMENT@404..407 - 0: JS_NUMBER_LITERAL_EXPRESSION@404..406 - 0: JS_NUMBER_LITERAL@404..406 "1" [Newline("\n")] [] - 1: SEMICOLON@406..407 ";" [] [] - 31: JS_EXPRESSION_STATEMENT@407..413 - 0: TS_INSTANTIATION_EXPRESSION@407..413 - 0: JS_IDENTIFIER_EXPRESSION@407..410 - 0: JS_REFERENCE_IDENTIFIER@407..410 - 0: IDENT@407..410 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@410..413 - 0: L_ANGLE@410..411 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@411..412 - 0: TS_REFERENCE_TYPE@411..412 - 0: JS_REFERENCE_IDENTIFIER@411..412 - 0: IDENT@411..412 "T" [] [] - 1: (empty) - 2: R_ANGLE@412..413 ">" [] [] - 1: (empty) - 32: JS_EXPRESSION_STATEMENT@413..419 - 0: JS_BIGINT_LITERAL_EXPRESSION@413..418 - 0: JS_BIGINT_LITERAL@413..418 "123n" [Newline("\n")] [] - 1: SEMICOLON@418..419 ";" [] [] - 33: JS_EXPRESSION_STATEMENT@419..425 - 0: TS_INSTANTIATION_EXPRESSION@419..425 - 0: JS_IDENTIFIER_EXPRESSION@419..422 - 0: JS_REFERENCE_IDENTIFIER@419..422 - 0: IDENT@419..422 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@422..425 - 0: L_ANGLE@422..423 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@423..424 - 0: TS_REFERENCE_TYPE@423..424 - 0: JS_REFERENCE_IDENTIFIER@423..424 - 0: IDENT@423..424 "T" [] [] - 1: (empty) - 2: R_ANGLE@424..425 ">" [] [] - 1: (empty) - 34: JS_BLOCK_STATEMENT@425..428 - 0: L_CURLY@425..427 "{" [Newline("\n")] [] - 1: JS_STATEMENT_LIST@427..427 - 2: R_CURLY@427..428 "}" [] [] - 35: JS_EMPTY_STATEMENT@428..429 - 0: SEMICOLON@428..429 ";" [] [] - 36: JS_EXPRESSION_STATEMENT@429..435 - 0: TS_INSTANTIATION_EXPRESSION@429..435 - 0: JS_IDENTIFIER_EXPRESSION@429..432 - 0: JS_REFERENCE_IDENTIFIER@429..432 - 0: IDENT@429..432 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@432..435 - 0: L_ANGLE@432..433 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@433..434 - 0: TS_REFERENCE_TYPE@433..434 - 0: JS_REFERENCE_IDENTIFIER@433..434 - 0: IDENT@433..434 "T" [] [] - 1: (empty) - 2: R_ANGLE@434..435 ">" [] [] - 1: (empty) - 37: JS_FUNCTION_DECLARATION@435..454 - 0: (empty) - 1: FUNCTION_KW@435..445 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@445..449 - 0: IDENT@445..449 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@449..452 - 0: L_PAREN@449..450 "(" [] [] - 1: JS_PARAMETER_LIST@450..450 - 2: R_PAREN@450..452 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@452..454 - 0: L_CURLY@452..453 "{" [] [] - 1: JS_DIRECTIVE_LIST@453..453 - 2: JS_STATEMENT_LIST@453..453 - 3: R_CURLY@453..454 "}" [] [] - 38: JS_EMPTY_STATEMENT@454..455 - 0: SEMICOLON@454..455 ";" [] [] - 39: JS_EXPRESSION_STATEMENT@455..461 - 0: TS_INSTANTIATION_EXPRESSION@455..461 - 0: JS_IDENTIFIER_EXPRESSION@455..458 - 0: JS_REFERENCE_IDENTIFIER@455..458 - 0: IDENT@455..458 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@458..461 - 0: L_ANGLE@458..459 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@459..460 - 0: TS_REFERENCE_TYPE@459..460 - 0: JS_REFERENCE_IDENTIFIER@459..460 - 0: IDENT@459..460 "T" [] [] - 1: (empty) - 2: R_ANGLE@460..461 ">" [] [] - 1: (empty) - 40: JS_CLASS_DECLARATION@461..472 - 0: JS_DECORATOR_LIST@461..461 - 1: (empty) - 2: CLASS_KW@461..468 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@468..470 - 0: IDENT@468..470 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@470..471 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@471..471 - 9: R_CURLY@471..472 "}" [] [] - 41: JS_EMPTY_STATEMENT@472..473 - 0: SEMICOLON@472..473 ";" [] [] - 42: JS_EXPRESSION_STATEMENT@473..479 - 0: TS_INSTANTIATION_EXPRESSION@473..479 - 0: JS_IDENTIFIER_EXPRESSION@473..476 - 0: JS_REFERENCE_IDENTIFIER@473..476 - 0: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@476..479 - 0: L_ANGLE@476..477 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@477..478 - 0: TS_REFERENCE_TYPE@477..478 - 0: JS_REFERENCE_IDENTIFIER@477..478 - 0: IDENT@477..478 "T" [] [] - 1: (empty) - 2: R_ANGLE@478..479 ">" [] [] - 1: (empty) - 43: JS_EXPRESSION_STATEMENT@479..488 - 0: JS_NEW_EXPRESSION@479..487 - 0: NEW_KW@479..484 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@484..485 - 0: JS_REFERENCE_IDENTIFIER@484..485 - 0: IDENT@484..485 "A" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@485..487 - 0: L_PAREN@485..486 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@486..486 - 2: R_PAREN@486..487 ")" [] [] - 1: SEMICOLON@487..488 ";" [] [] - 44: JS_EXPRESSION_STATEMENT@488..498 - 0: JS_BINARY_EXPRESSION@488..497 - 0: TS_INSTANTIATION_EXPRESSION@488..493 - 0: JS_IDENTIFIER_EXPRESSION@488..490 - 0: JS_REFERENCE_IDENTIFIER@488..490 - 0: IDENT@488..490 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@490..493 - 0: L_ANGLE@490..491 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@491..492 - 0: TS_REFERENCE_TYPE@491..492 - 0: JS_REFERENCE_IDENTIFIER@491..492 - 0: IDENT@491..492 "T" [] [] - 1: (empty) - 2: R_ANGLE@492..493 ">" [] [] - 1: SLASH@493..496 "/" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@496..497 - 0: JS_NUMBER_LITERAL@496..497 "1" [] [] - 1: SEMICOLON@497..498 ";" [] [] - 45: JS_EXPRESSION_STATEMENT@498..508 - 0: JS_BINARY_EXPRESSION@498..507 - 0: JS_BINARY_EXPRESSION@498..503 - 0: JS_IDENTIFIER_EXPRESSION@498..501 - 0: JS_REFERENCE_IDENTIFIER@498..501 - 0: IDENT@498..501 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@501..502 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@502..503 - 0: JS_REFERENCE_IDENTIFIER@502..503 - 0: IDENT@502..503 "T" [] [] - 1: R_ANGLE@503..504 ">" [] [] - 2: JS_UNARY_EXPRESSION@504..507 - 0: PLUS@504..506 "+" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@506..507 - 0: JS_NUMBER_LITERAL@506..507 "1" [] [] - 1: SEMICOLON@507..508 ";" [] [] - 46: JS_EXPRESSION_STATEMENT@508..518 - 0: JS_BINARY_EXPRESSION@508..517 - 0: JS_BINARY_EXPRESSION@508..513 - 0: JS_IDENTIFIER_EXPRESSION@508..511 - 0: JS_REFERENCE_IDENTIFIER@508..511 - 0: IDENT@508..511 "f" [Newline("\n")] [Whitespace(" ")] - 1: L_ANGLE@511..512 "<" [] [] - 2: JS_IDENTIFIER_EXPRESSION@512..513 - 0: JS_REFERENCE_IDENTIFIER@512..513 - 0: IDENT@512..513 "T" [] [] - 1: R_ANGLE@513..514 ">" [] [] - 2: JS_UNARY_EXPRESSION@514..517 - 0: MINUS@514..516 "-" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@516..517 - 0: JS_NUMBER_LITERAL@516..517 "1" [] [] - 1: SEMICOLON@517..518 ";" [] [] - 47: JS_EXPRESSION_STATEMENT@518..524 - 0: TS_INSTANTIATION_EXPRESSION@518..524 - 0: JS_IDENTIFIER_EXPRESSION@518..521 - 0: JS_REFERENCE_IDENTIFIER@518..521 - 0: IDENT@518..521 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@521..524 - 0: L_ANGLE@521..522 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@522..523 - 0: TS_REFERENCE_TYPE@522..523 - 0: JS_REFERENCE_IDENTIFIER@522..523 - 0: IDENT@522..523 "T" [] [] - 1: (empty) - 2: R_ANGLE@523..524 ">" [] [] - 1: (empty) - 48: JS_EXPRESSION_STATEMENT@524..528 - 0: JS_UNARY_EXPRESSION@524..527 - 0: TILDE@524..526 "~" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@526..527 - 0: JS_NUMBER_LITERAL@526..527 "1" [] [] - 1: SEMICOLON@527..528 ";" [] [] - 49: JS_EXPRESSION_STATEMENT@528..534 - 0: TS_INSTANTIATION_EXPRESSION@528..534 - 0: JS_IDENTIFIER_EXPRESSION@528..531 - 0: JS_REFERENCE_IDENTIFIER@528..531 - 0: IDENT@528..531 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@531..534 - 0: L_ANGLE@531..532 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@532..533 - 0: TS_REFERENCE_TYPE@532..533 - 0: JS_REFERENCE_IDENTIFIER@532..533 - 0: IDENT@532..533 "T" [] [] - 1: (empty) - 2: R_ANGLE@533..534 ">" [] [] - 1: (empty) - 50: JS_EXPRESSION_STATEMENT@534..538 - 0: JS_UNARY_EXPRESSION@534..537 - 0: BANG@534..536 "!" [Newline("\n")] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@536..537 - 0: JS_NUMBER_LITERAL@536..537 "1" [] [] - 1: SEMICOLON@537..538 ";" [] [] - 51: JS_EXPRESSION_STATEMENT@538..544 - 0: TS_INSTANTIATION_EXPRESSION@538..544 - 0: JS_IDENTIFIER_EXPRESSION@538..541 - 0: JS_REFERENCE_IDENTIFIER@538..541 - 0: IDENT@538..541 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@541..544 - 0: L_ANGLE@541..542 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@542..543 - 0: TS_REFERENCE_TYPE@542..543 - 0: JS_REFERENCE_IDENTIFIER@542..543 - 0: IDENT@542..543 "T" [] [] - 1: (empty) - 2: R_ANGLE@543..544 ">" [] [] - 1: (empty) - 52: JS_EXPRESSION_STATEMENT@544..560 - 0: JS_IDENTIFIER_EXPRESSION@544..559 - 0: JS_REFERENCE_IDENTIFIER@544..559 - 0: IDENT@544..559 "someIdentifier" [Newline("\n")] [] - 1: SEMICOLON@559..560 ";" [] [] - 53: JS_EXPRESSION_STATEMENT@560..566 - 0: TS_INSTANTIATION_EXPRESSION@560..566 - 0: JS_IDENTIFIER_EXPRESSION@560..563 - 0: JS_REFERENCE_IDENTIFIER@560..563 - 0: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@563..566 - 0: L_ANGLE@563..564 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@564..565 - 0: TS_REFERENCE_TYPE@564..565 - 0: JS_REFERENCE_IDENTIFIER@564..565 - 0: IDENT@564..565 "T" [] [] - 1: (empty) - 2: R_ANGLE@565..566 ">" [] [] - 1: (empty) - 54: JS_EXPRESSION_STATEMENT@566..583 - 0: JS_UNARY_EXPRESSION@566..582 - 0: DELETE_KW@566..574 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@574..582 - 0: JS_IDENTIFIER_EXPRESSION@574..575 - 0: JS_REFERENCE_IDENTIFIER@574..575 - 0: IDENT@574..575 "a" [] [] - 1: (empty) - 2: L_BRACK@575..576 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@576..581 - 0: JS_REFERENCE_IDENTIFIER@576..581 - 0: IDENT@576..581 "field" [] [] - 4: R_BRACK@581..582 "]" [] [] - 1: SEMICOLON@582..583 ";" [] [] - 55: JS_EXPRESSION_STATEMENT@583..589 - 0: TS_INSTANTIATION_EXPRESSION@583..589 - 0: JS_IDENTIFIER_EXPRESSION@583..586 - 0: JS_REFERENCE_IDENTIFIER@583..586 - 0: IDENT@583..586 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@586..589 - 0: L_ANGLE@586..587 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@587..588 - 0: TS_REFERENCE_TYPE@587..588 - 0: JS_REFERENCE_IDENTIFIER@587..588 - 0: IDENT@587..588 "T" [] [] - 1: (empty) - 2: R_ANGLE@588..589 ">" [] [] - 1: (empty) - 56: JS_EXPRESSION_STATEMENT@589..605 - 0: JS_UNARY_EXPRESSION@589..604 - 0: TYPEOF_KW@589..597 "typeof" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@597..604 - 0: JS_REFERENCE_IDENTIFIER@597..604 - 0: IDENT@597..604 "MyClass" [] [] - 1: SEMICOLON@604..605 ";" [] [] - 57: JS_EXPRESSION_STATEMENT@605..611 - 0: TS_INSTANTIATION_EXPRESSION@605..611 - 0: JS_IDENTIFIER_EXPRESSION@605..608 - 0: JS_REFERENCE_IDENTIFIER@605..608 - 0: IDENT@605..608 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@608..611 - 0: L_ANGLE@608..609 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@609..610 - 0: TS_REFERENCE_TYPE@609..610 - 0: JS_REFERENCE_IDENTIFIER@609..610 - 0: IDENT@609..610 "T" [] [] - 1: (empty) - 2: R_ANGLE@610..611 ">" [] [] - 1: (empty) - 58: JS_EXPRESSION_STATEMENT@611..619 - 0: JS_UNARY_EXPRESSION@611..618 - 0: VOID_KW@611..617 "void" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@617..618 - 0: JS_REFERENCE_IDENTIFIER@617..618 - 0: IDENT@617..618 "a" [] [] - 1: SEMICOLON@618..619 ";" [] [] - 59: JS_EXPRESSION_STATEMENT@619..630 - 0: JS_BINARY_EXPRESSION@619..629 - 0: TS_INSTANTIATION_EXPRESSION@619..624 - 0: JS_IDENTIFIER_EXPRESSION@619..621 - 0: JS_REFERENCE_IDENTIFIER@619..621 - 0: IDENT@619..621 "f" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@621..624 - 0: L_ANGLE@621..622 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@622..623 - 0: TS_REFERENCE_TYPE@622..623 - 0: JS_REFERENCE_IDENTIFIER@622..623 - 0: IDENT@622..623 "T" [] [] - 1: (empty) - 2: R_ANGLE@623..624 ">" [] [] - 1: LTEQ@624..628 "<=" [Newline("\n")] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@628..629 - 0: JS_NUMBER_LITERAL@628..629 "1" [] [] - 1: SEMICOLON@629..630 ";" [] [] - 60: JS_EXPRESSION_STATEMENT@630..647 - 0: JS_CALL_EXPRESSION@630..646 - 0: JS_IDENTIFIER_EXPRESSION@630..633 - 0: JS_REFERENCE_IDENTIFIER@630..633 - 0: IDENT@630..633 "f" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: TS_TYPE_ARGUMENTS@633..636 - 0: L_ANGLE@633..634 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@634..635 - 0: TS_REFERENCE_TYPE@634..635 - 0: JS_REFERENCE_IDENTIFIER@634..635 - 0: IDENT@634..635 "T" [] [] - 1: (empty) - 2: R_ANGLE@635..636 ">" [] [] - 3: JS_CALL_ARGUMENTS@636..646 - 0: L_PAREN@636..638 "(" [Newline("\n")] [] - 1: JS_CALL_ARGUMENT_LIST@638..645 - 0: JS_AWAIT_EXPRESSION@638..645 - 0: AWAIT_KW@638..644 "await" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@644..645 - 0: JS_NUMBER_LITERAL@644..645 "1" [] [] - 2: R_PAREN@645..646 ")" [] [] - 1: SEMICOLON@646..647 ";" [] [] - 61: JS_EXPRESSION_STATEMENT@647..653 - 0: TS_INSTANTIATION_EXPRESSION@647..653 - 0: JS_IDENTIFIER_EXPRESSION@647..650 - 0: JS_REFERENCE_IDENTIFIER@647..650 - 0: IDENT@647..650 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@650..653 - 0: L_ANGLE@650..651 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@651..652 - 0: TS_REFERENCE_TYPE@651..652 - 0: JS_REFERENCE_IDENTIFIER@651..652 - 0: IDENT@651..652 "T" [] [] - 1: (empty) - 2: R_ANGLE@652..653 ">" [] [] - 1: (empty) - 62: JS_EXPRESSION_STATEMENT@653..666 - 0: JS_IMPORT_META_EXPRESSION@653..665 - 0: IMPORT_KW@653..660 "import" [Newline("\n")] [] - 1: DOT@660..661 "." [] [] - 2: META@661..665 "meta" [] [] - 1: SEMICOLON@665..666 ";" [] [] - 63: JS_EXPRESSION_STATEMENT@666..672 - 0: TS_INSTANTIATION_EXPRESSION@666..672 - 0: JS_IDENTIFIER_EXPRESSION@666..669 - 0: JS_REFERENCE_IDENTIFIER@666..669 - 0: IDENT@666..669 "f" [Newline("\n")] [Whitespace(" ")] - 1: TS_TYPE_ARGUMENTS@669..672 - 0: L_ANGLE@669..670 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@670..671 - 0: TS_REFERENCE_TYPE@670..671 - 0: JS_REFERENCE_IDENTIFIER@670..671 - 0: IDENT@670..671 "T" [] [] - 1: (empty) - 2: R_ANGLE@671..672 ">" [] [] - 1: (empty) - 64: JS_EXPRESSION_STATEMENT@672..687 - 0: JS_IMPORT_CALL_EXPRESSION@672..686 - 0: IMPORT_KW@672..679 "import" [Newline("\n")] [] - 1: JS_CALL_ARGUMENTS@679..686 - 0: L_PAREN@679..680 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@680..685 - 0: JS_STRING_LITERAL_EXPRESSION@680..685 - 0: JS_STRING_LITERAL@680..685 "\"123\"" [] [] - 2: R_PAREN@685..686 ")" [] [] - 1: SEMICOLON@686..687 ";" [] [] - 4: EOF@687..688 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface.rast b/crates/biome_js_parser/test_data/inline/ok/ts_interface.rast deleted file mode 100644 index 973150ee25a2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_interface.rast +++ /dev/null @@ -1,185 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@12..13 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@13..14 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@25..27 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@29..33 "prop" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@33..35 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@35..41 "string" [] [], - }, - }, - separator_token: COMMA@41..43 "," [] [Whitespace(" ")], - }, - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@43..49 "method" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@49..50 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@50..51 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@51..53 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@53..59 "string" [] [], - }, - }, - separator_token: COMMA@59..61 "," [] [Whitespace(" ")], - }, - TsIndexSignatureTypeMember { - readonly_token: missing (optional), - l_brack_token: L_BRACK@61..62 "[" [] [], - parameter: TsIndexSignatureParameter { - binding: JsIdentifierBinding { - name_token: IDENT@62..67 "index" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@67..69 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@69..75 "number" [] [], - }, - }, - }, - r_brack_token: R_BRACK@75..76 "]" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@76..78 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@78..84 "string" [] [], - }, - }, - separator_token: COMMA@84..86 "," [] [Whitespace(" ")], - }, - TsConstructSignatureTypeMember { - new_token: NEW_KW@86..89 "new" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@89..90 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@90..91 ")" [] [], - }, - type_annotation: TsTypeAnnotation { - colon_token: COLON@91..93 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@93..95 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@95..96 "}" [] [], - }, - ], - eof_token: EOF@96..97 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..97 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..96 - 0: TS_INTERFACE_DECLARATION@0..14 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@12..13 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@13..13 - 6: R_CURLY@13..14 "}" [] [] - 1: TS_INTERFACE_DECLARATION@14..96 - 0: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..27 - 0: IDENT@25..27 "B" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@29..95 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@29..43 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@29..33 - 0: IDENT@29..33 "prop" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@33..41 - 0: COLON@33..35 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@35..41 - 0: STRING_KW@35..41 "string" [] [] - 4: COMMA@41..43 "," [] [Whitespace(" ")] - 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@43..61 - 0: JS_LITERAL_MEMBER_NAME@43..49 - 0: IDENT@43..49 "method" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@49..51 - 0: L_PAREN@49..50 "(" [] [] - 1: JS_PARAMETER_LIST@50..50 - 2: R_PAREN@50..51 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@51..59 - 0: COLON@51..53 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@53..59 - 0: STRING_KW@53..59 "string" [] [] - 5: COMMA@59..61 "," [] [Whitespace(" ")] - 2: TS_INDEX_SIGNATURE_TYPE_MEMBER@61..86 - 0: (empty) - 1: L_BRACK@61..62 "[" [] [] - 2: TS_INDEX_SIGNATURE_PARAMETER@62..75 - 0: JS_IDENTIFIER_BINDING@62..67 - 0: IDENT@62..67 "index" [] [] - 1: TS_TYPE_ANNOTATION@67..75 - 0: COLON@67..69 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@69..75 - 0: NUMBER_KW@69..75 "number" [] [] - 3: R_BRACK@75..76 "]" [] [] - 4: TS_TYPE_ANNOTATION@76..84 - 0: COLON@76..78 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@78..84 - 0: STRING_KW@78..84 "string" [] [] - 5: COMMA@84..86 "," [] [Whitespace(" ")] - 3: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@86..95 - 0: NEW_KW@86..89 "new" [] [] - 1: (empty) - 2: JS_PARAMETERS@89..91 - 0: L_PAREN@89..90 "(" [] [] - 1: JS_PARAMETER_LIST@90..90 - 2: R_PAREN@90..91 ")" [] [] - 3: TS_TYPE_ANNOTATION@91..95 - 0: COLON@91..93 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@93..95 - 0: JS_REFERENCE_IDENTIFIER@93..95 - 0: IDENT@93..95 "B" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 6: R_CURLY@95..96 "}" [] [] - 4: EOF@96..97 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast b/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast deleted file mode 100644 index a4117b26abe6..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast +++ /dev/null @@ -1,197 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..11 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@11..12 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@12..16 "Prop" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@16..18 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@20..24 "prop" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "Prop" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@32..43 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@43..45 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: TsExtendsClause { - extends_token: EXTENDS_KW@45..53 "extends" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@53..54 "A" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@54..55 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@55..61 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@61..63 ">" [] [Whitespace(" ")], - }, - }, - ], - }, - l_curly_token: L_CURLY@63..64 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@64..65 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@65..76 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@76..78 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: TsExtendsClause { - extends_token: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")], - types: TsTypeList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@86..87 "A" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@87..88 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@88..94 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@94..95 ">" [] [], - }, - }, - COMMA@95..97 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@97..99 "B" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - l_curly_token: L_CURLY@99..100 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@100..101 "}" [] [], - }, - ], - eof_token: EOF@101..102 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..102 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..101 - 0: TS_INTERFACE_DECLARATION@0..32 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..11 - 0: IDENT@10..11 "A" [] [] - 2: TS_TYPE_PARAMETERS@11..18 - 0: L_ANGLE@11..12 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@12..16 - 0: TS_TYPE_PARAMETER@12..16 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@12..12 - 1: TS_TYPE_PARAMETER_NAME@12..16 - 0: IDENT@12..16 "Prop" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@16..18 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@18..20 "{" [] [Whitespace(" ")] - 5: TS_TYPE_MEMBER_LIST@20..31 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@20..31 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@20..24 - 0: IDENT@20..24 "prop" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@24..31 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "Prop" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 6: R_CURLY@31..32 "}" [] [] - 1: TS_INTERFACE_DECLARATION@32..65 - 0: INTERFACE_KW@32..43 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "B" [] [Whitespace(" ")] - 2: (empty) - 3: TS_EXTENDS_CLAUSE@45..63 - 0: EXTENDS_KW@45..53 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@53..63 - 0: TS_REFERENCE_TYPE@53..63 - 0: JS_REFERENCE_IDENTIFIER@53..54 - 0: IDENT@53..54 "A" [] [] - 1: TS_TYPE_ARGUMENTS@54..63 - 0: L_ANGLE@54..55 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@55..61 - 0: TS_STRING_TYPE@55..61 - 0: STRING_KW@55..61 "string" [] [] - 2: R_ANGLE@61..63 ">" [] [Whitespace(" ")] - 4: L_CURLY@63..64 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@64..64 - 6: R_CURLY@64..65 "}" [] [] - 2: TS_INTERFACE_DECLARATION@65..101 - 0: INTERFACE_KW@65..76 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@76..78 - 0: IDENT@76..78 "C" [] [Whitespace(" ")] - 2: (empty) - 3: TS_EXTENDS_CLAUSE@78..99 - 0: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_LIST@86..99 - 0: TS_REFERENCE_TYPE@86..95 - 0: JS_REFERENCE_IDENTIFIER@86..87 - 0: IDENT@86..87 "A" [] [] - 1: TS_TYPE_ARGUMENTS@87..95 - 0: L_ANGLE@87..88 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@88..94 - 0: TS_NUMBER_TYPE@88..94 - 0: NUMBER_KW@88..94 "number" [] [] - 2: R_ANGLE@94..95 ">" [] [] - 1: COMMA@95..97 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@97..99 - 0: JS_REFERENCE_IDENTIFIER@97..99 - 0: IDENT@97..99 "B" [] [Whitespace(" ")] - 1: (empty) - 4: L_CURLY@99..100 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@100..100 - 6: R_CURLY@100..101 "}" [] [] - 4: EOF@101..102 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.rast deleted file mode 100644 index ab6b42e1fd2b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.rast +++ /dev/null @@ -1,99 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsIntersectionType { - leading_separator_token: missing (optional), - types: TsIntersectionTypeElementList [ - TsStringType { - string_token: STRING_KW@9..16 "string" [] [Whitespace(" ")], - }, - AMP@16..18 "&" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@18..24 "number" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@31..33 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@33..35 "=" [] [Whitespace(" ")], - ty: TsIntersectionType { - leading_separator_token: AMP@35..37 "&" [] [Whitespace(" ")], - types: TsIntersectionTypeElementList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@37..39 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - AMP@39..41 "&" [] [Whitespace(" ")], - TsVoidType { - void_token: VOID_KW@41..46 "void" [] [Whitespace(" ")], - }, - AMP@46..48 "&" [] [Whitespace(" ")], - TsNullLiteralType { - literal_token: NULL_KW@48..52 "null" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@52..53 ";" [] [], - }, - ], - eof_token: EOF@53..54 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..54 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..53 - 0: TS_TYPE_ALIAS_DECLARATION@0..25 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_INTERSECTION_TYPE@9..24 - 0: (empty) - 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@9..24 - 0: TS_STRING_TYPE@9..16 - 0: STRING_KW@9..16 "string" [] [Whitespace(" ")] - 1: AMP@16..18 "&" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@18..24 - 0: NUMBER_KW@18..24 "number" [] [] - 5: SEMICOLON@24..25 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@25..53 - 0: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@33..35 "=" [] [Whitespace(" ")] - 4: TS_INTERSECTION_TYPE@35..52 - 0: AMP@35..37 "&" [] [Whitespace(" ")] - 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@37..52 - 0: TS_REFERENCE_TYPE@37..39 - 0: JS_REFERENCE_IDENTIFIER@37..39 - 0: IDENT@37..39 "A" [] [Whitespace(" ")] - 1: (empty) - 1: AMP@39..41 "&" [] [Whitespace(" ")] - 2: TS_VOID_TYPE@41..46 - 0: VOID_KW@41..46 "void" [] [Whitespace(" ")] - 3: AMP@46..48 "&" [] [Whitespace(" ")] - 4: TS_NULL_LITERAL_TYPE@48..52 - 0: NULL_KW@48..52 "null" [] [] - 5: SEMICOLON@52..53 ";" [] [] - 4: EOF@53..54 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.rast b/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.rast deleted file mode 100644 index 096ccff7f742..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.rast +++ /dev/null @@ -1,135 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@0..8 "declare" [] [Whitespace(" ")], - }, - operator_token: EQ@8..10 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@10..11 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@12..22 "abstract" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@22..24 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@24..25 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@26..37 "namespace" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@37..39 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@39..40 "3" [] [], - }, - }, - semicolon_token: SEMICOLON@40..41 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@41..47 "type" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@47..49 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@49..50 "4" [] [], - }, - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@51..59 "module" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@59..61 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@61..62 "5" [] [], - }, - }, - semicolon_token: SEMICOLON@62..63 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@63..71 "global" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@71..73 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@73..74 "6" [] [], - }, - }, - semicolon_token: SEMICOLON@74..75 ";" [] [], - }, - ], - eof_token: EOF@75..76 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..76 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..75 - 0: JS_EXPRESSION_STATEMENT@0..12 - 0: JS_ASSIGNMENT_EXPRESSION@0..11 - 0: JS_IDENTIFIER_ASSIGNMENT@0..8 - 0: IDENT@0..8 "declare" [] [Whitespace(" ")] - 1: EQ@8..10 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@10..11 - 0: JS_NUMBER_LITERAL@10..11 "1" [] [] - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@12..26 - 0: JS_ASSIGNMENT_EXPRESSION@12..25 - 0: JS_IDENTIFIER_ASSIGNMENT@12..22 - 0: IDENT@12..22 "abstract" [Newline("\n")] [Whitespace(" ")] - 1: EQ@22..24 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@24..25 - 0: JS_NUMBER_LITERAL@24..25 "2" [] [] - 1: SEMICOLON@25..26 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@26..41 - 0: JS_ASSIGNMENT_EXPRESSION@26..40 - 0: JS_IDENTIFIER_ASSIGNMENT@26..37 - 0: IDENT@26..37 "namespace" [Newline("\n")] [Whitespace(" ")] - 1: EQ@37..39 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@39..40 - 0: JS_NUMBER_LITERAL@39..40 "3" [] [] - 1: SEMICOLON@40..41 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@41..51 - 0: JS_ASSIGNMENT_EXPRESSION@41..50 - 0: JS_IDENTIFIER_ASSIGNMENT@41..47 - 0: IDENT@41..47 "type" [Newline("\n")] [Whitespace(" ")] - 1: EQ@47..49 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@49..50 - 0: JS_NUMBER_LITERAL@49..50 "4" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@51..63 - 0: JS_ASSIGNMENT_EXPRESSION@51..62 - 0: JS_IDENTIFIER_ASSIGNMENT@51..59 - 0: IDENT@51..59 "module" [Newline("\n")] [Whitespace(" ")] - 1: EQ@59..61 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@61..62 - 0: JS_NUMBER_LITERAL@61..62 "5" [] [] - 1: SEMICOLON@62..63 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@63..75 - 0: JS_ASSIGNMENT_EXPRESSION@63..74 - 0: JS_IDENTIFIER_ASSIGNMENT@63..71 - 0: IDENT@63..71 "global" [Newline("\n")] [Whitespace(" ")] - 1: EQ@71..73 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@73..74 - 0: JS_NUMBER_LITERAL@73..74 "6" [] [] - 1: SEMICOLON@74..75 ";" [] [] - 4: EOF@75..76 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.rast b/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.rast deleted file mode 100644 index e73c514167a3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@0..20 "interface" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@20..22 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@22..23 "1" [] [], - }, - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@24..33 "private" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@33..35 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@35..36 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@37..48 "protected" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@48..50 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@50..51 "3" [] [], - }, - }, - semicolon_token: SEMICOLON@51..52 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@52..60 "public" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@60..62 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@62..63 "4" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@64..76 "implements" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@76..78 "=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@78..79 "5" [] [], - }, - }, - semicolon_token: SEMICOLON@79..80 ";" [] [], - }, - ], - eof_token: EOF@80..81 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..81 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..80 - 0: JS_EXPRESSION_STATEMENT@0..24 - 0: JS_ASSIGNMENT_EXPRESSION@0..23 - 0: JS_IDENTIFIER_ASSIGNMENT@0..20 - 0: IDENT@0..20 "interface" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 1: EQ@20..22 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@22..23 - 0: JS_NUMBER_LITERAL@22..23 "1" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@24..37 - 0: JS_ASSIGNMENT_EXPRESSION@24..36 - 0: JS_IDENTIFIER_ASSIGNMENT@24..33 - 0: IDENT@24..33 "private" [Newline("\n")] [Whitespace(" ")] - 1: EQ@33..35 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@35..36 - 0: JS_NUMBER_LITERAL@35..36 "2" [] [] - 1: SEMICOLON@36..37 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@37..52 - 0: JS_ASSIGNMENT_EXPRESSION@37..51 - 0: JS_IDENTIFIER_ASSIGNMENT@37..48 - 0: IDENT@37..48 "protected" [Newline("\n")] [Whitespace(" ")] - 1: EQ@48..50 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@50..51 - 0: JS_NUMBER_LITERAL@50..51 "3" [] [] - 1: SEMICOLON@51..52 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@52..64 - 0: JS_ASSIGNMENT_EXPRESSION@52..63 - 0: JS_IDENTIFIER_ASSIGNMENT@52..60 - 0: IDENT@52..60 "public" [Newline("\n")] [Whitespace(" ")] - 1: EQ@60..62 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@62..63 - 0: JS_NUMBER_LITERAL@62..63 "4" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@64..80 - 0: JS_ASSIGNMENT_EXPRESSION@64..79 - 0: JS_IDENTIFIER_ASSIGNMENT@64..76 - 0: IDENT@64..76 "implements" [Newline("\n")] [Whitespace(" ")] - 1: EQ@76..78 "=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@78..79 - 0: JS_NUMBER_LITERAL@78..79 "5" [] [] - 1: SEMICOLON@79..80 ";" [] [] - 4: EOF@80..81 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.rast deleted file mode 100644 index a9276cd3ecea..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.rast +++ /dev/null @@ -1,191 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@9..10 "5" [] [], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@17..19 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@19..21 "=" [] [Whitespace(" ")], - ty: TsNumberLiteralType { - minus_token: MINUS@21..22 "-" [] [], - literal_token: JS_NUMBER_LITERAL@22..23 "5" [] [], - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@30..32 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@32..34 "=" [] [Whitespace(" ")], - ty: TsBigintLiteralType { - minus_token: missing (optional), - literal_token: JS_BIGINT_LITERAL@34..36 "5n" [] [], - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@43..45 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - ty: TsBigintLiteralType { - minus_token: MINUS@47..48 "-" [] [], - literal_token: JS_BIGINT_LITERAL@48..50 "5n" [] [], - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@51..57 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@57..59 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@59..61 "=" [] [Whitespace(" ")], - ty: TsStringLiteralType { - literal_token: JS_STRING_LITERAL@61..68 "\"abvcd\"" [] [], - }, - semicolon_token: SEMICOLON@68..69 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@75..77 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@77..79 "=" [] [Whitespace(" ")], - ty: TsBooleanLiteralType { - literal: TRUE_KW@79..83 "true" [] [], - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@84..90 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@90..92 "G" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@92..94 "=" [] [Whitespace(" ")], - ty: TsBooleanLiteralType { - literal: FALSE_KW@94..99 "false" [] [], - }, - semicolon_token: SEMICOLON@99..100 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@106..108 "H" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@108..110 "=" [] [Whitespace(" ")], - ty: TsNullLiteralType { - literal_token: NULL_KW@110..114 "null" [] [], - }, - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - ], - eof_token: EOF@115..116 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..116 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..115 - 0: TS_TYPE_ALIAS_DECLARATION@0..11 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_NUMBER_LITERAL_TYPE@9..10 - 0: (empty) - 1: JS_NUMBER_LITERAL@9..10 "5" [] [] - 5: SEMICOLON@10..11 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@11..24 - 0: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@17..19 - 0: IDENT@17..19 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@19..21 "=" [] [Whitespace(" ")] - 4: TS_NUMBER_LITERAL_TYPE@21..23 - 0: MINUS@21..22 "-" [] [] - 1: JS_NUMBER_LITERAL@22..23 "5" [] [] - 5: SEMICOLON@23..24 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@24..37 - 0: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@30..32 - 0: IDENT@30..32 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@32..34 "=" [] [Whitespace(" ")] - 4: TS_BIGINT_LITERAL_TYPE@34..36 - 0: (empty) - 1: JS_BIGINT_LITERAL@34..36 "5n" [] [] - 5: SEMICOLON@36..37 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@37..51 - 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@45..47 "=" [] [Whitespace(" ")] - 4: TS_BIGINT_LITERAL_TYPE@47..50 - 0: MINUS@47..48 "-" [] [] - 1: JS_BIGINT_LITERAL@48..50 "5n" [] [] - 5: SEMICOLON@50..51 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@51..69 - 0: TYPE_KW@51..57 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@57..59 - 0: IDENT@57..59 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@59..61 "=" [] [Whitespace(" ")] - 4: TS_STRING_LITERAL_TYPE@61..68 - 0: JS_STRING_LITERAL@61..68 "\"abvcd\"" [] [] - 5: SEMICOLON@68..69 ";" [] [] - 5: TS_TYPE_ALIAS_DECLARATION@69..84 - 0: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@75..77 - 0: IDENT@75..77 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@77..79 "=" [] [Whitespace(" ")] - 4: TS_BOOLEAN_LITERAL_TYPE@79..83 - 0: TRUE_KW@79..83 "true" [] [] - 5: SEMICOLON@83..84 ";" [] [] - 6: TS_TYPE_ALIAS_DECLARATION@84..100 - 0: TYPE_KW@84..90 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@90..92 - 0: IDENT@90..92 "G" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@92..94 "=" [] [Whitespace(" ")] - 4: TS_BOOLEAN_LITERAL_TYPE@94..99 - 0: FALSE_KW@94..99 "false" [] [] - 5: SEMICOLON@99..100 ";" [] [] - 7: TS_TYPE_ALIAS_DECLARATION@100..115 - 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@106..108 - 0: IDENT@106..108 "H" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@108..110 "=" [] [Whitespace(" ")] - 4: TS_NULL_LITERAL_TYPE@110..114 - 0: NULL_KW@110..114 "null" [] [] - 5: SEMICOLON@114..115 ";" [] [] - 4: EOF@115..116 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.rast deleted file mode 100644 index e189e407546b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.rast +++ /dev/null @@ -1,595 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@11..12 "[" [] [], - property_name: TsTypeParameterName { - ident_token: IDENT@12..17 "test" [] [Whitespace(" ")], - }, - in_token: IN_KW@17..20 "in" [] [Whitespace(" ")], - keys_type: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringLiteralType { - literal_token: JS_STRING_LITERAL@20..24 "\"a\"" [] [Whitespace(" ")], - }, - PIPE@24..26 "|" [] [Whitespace(" ")], - TsStringLiteralType { - literal_token: JS_STRING_LITERAL@26..29 "\"b\"" [] [], - }, - ], - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@29..31 "]" [] [Whitespace(" ")], - optional_modifier: missing (optional), - mapped_type: missing (optional), - semicolon_token: missing (optional), - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@38..50 "OptionsFlags" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@50..51 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@51..55 "Type" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@55..57 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@57..59 "=" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@59..60 "{" [] [], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@60..64 "[" [Newline("\n"), Whitespace(" ")] [], - property_name: TsTypeParameterName { - ident_token: IDENT@64..73 "Property" [] [Whitespace(" ")], - }, - in_token: IN_KW@73..76 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@76..82 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@82..86 "Type" [] [], - }, - type_arguments: missing (optional), - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@86..87 "]" [] [], - optional_modifier: missing (optional), - mapped_type: TsTypeAnnotation { - colon_token: COLON@87..89 ":" [] [Whitespace(" ")], - ty: TsBooleanType { - boolean_token: BOOLEAN_KW@89..96 "boolean" [] [], - }, - }, - semicolon_token: SEMICOLON@96..97 ";" [] [], - r_curly_token: R_CURLY@97..99 "}" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@99..100 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@106..119 "CreateMutable" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@119..120 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@120..124 "Type" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@124..126 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@126..128 "=" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@128..129 "{" [] [], - readonly_modifier: TsMappedTypeReadonlyModifierClause { - operator_token: MINUS@129..132 "-" [Newline("\n"), Whitespace("\t")] [], - readonly_token: READONLY_KW@132..141 "readonly" [] [Whitespace(" ")], - }, - l_brack_token: L_BRACK@141..142 "[" [] [], - property_name: TsTypeParameterName { - ident_token: IDENT@142..151 "Property" [] [Whitespace(" ")], - }, - in_token: IN_KW@151..154 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@154..160 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@160..164 "Type" [] [], - }, - type_arguments: missing (optional), - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@164..165 "]" [] [], - optional_modifier: missing (optional), - mapped_type: TsTypeAnnotation { - colon_token: COLON@165..167 ":" [] [Whitespace(" ")], - ty: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@167..171 "Type" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@171..172 "[" [] [], - index_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@172..180 "Property" [] [], - }, - type_arguments: missing (optional), - }, - r_brack_token: R_BRACK@180..181 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@181..182 ";" [] [], - r_curly_token: R_CURLY@182..184 "}" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@184..185 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@185..191 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@191..199 "Concrete" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@199..200 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@200..204 "Type" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@204..206 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@206..208 "=" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@208..209 "{" [] [], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@209..213 "[" [Newline("\n"), Whitespace(" ")] [], - property_name: TsTypeParameterName { - ident_token: IDENT@213..222 "Property" [] [Whitespace(" ")], - }, - in_token: IN_KW@222..225 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@225..231 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@231..235 "Type" [] [], - }, - type_arguments: missing (optional), - }, - }, - as_clause: missing (optional), - r_brack_token: R_BRACK@235..236 "]" [] [], - optional_modifier: TsMappedTypeOptionalModifierClause { - operator_token: MINUS@236..237 "-" [] [], - question_mark_token: QUESTION@237..238 "?" [] [], - }, - mapped_type: TsTypeAnnotation { - colon_token: COLON@238..240 ":" [] [Whitespace(" ")], - ty: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@240..244 "Type" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@244..245 "[" [] [], - index_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@245..253 "Property" [] [], - }, - type_arguments: missing (optional), - }, - r_brack_token: R_BRACK@253..254 "]" [] [], - }, - }, - semicolon_token: missing (optional), - r_curly_token: R_CURLY@254..256 "}" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@256..257 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@257..263 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@263..270 "Getters" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@270..271 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@271..275 "Type" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@275..277 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@277..279 "=" [] [Whitespace(" ")], - ty: TsMappedType { - l_curly_token: L_CURLY@279..280 "{" [] [], - readonly_modifier: missing (optional), - l_brack_token: L_BRACK@280..286 "[" [Newline("\n"), Whitespace(" ")] [], - property_name: TsTypeParameterName { - ident_token: IDENT@286..295 "Property" [] [Whitespace(" ")], - }, - in_token: IN_KW@295..298 "in" [] [Whitespace(" ")], - keys_type: TsTypeOperatorType { - operator_token: KEYOF_KW@298..304 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@304..309 "Type" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - as_clause: TsMappedTypeAsClause { - as_token: AS_KW@309..312 "as" [] [Whitespace(" ")], - ty: TsTemplateLiteralType { - l_tick_token: BACKTICK@312..313 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@313..316 "get" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@316..318 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@318..328 "Capitalize" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@328..329 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsIntersectionType { - leading_separator_token: missing (optional), - types: TsIntersectionTypeElementList [ - TsStringType { - string_token: STRING_KW@329..336 "string" [] [Whitespace(" ")], - }, - AMP@336..338 "&" [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@338..346 "Property" [] [], - }, - type_arguments: missing (optional), - }, - ], - }, - ], - r_angle_token: R_ANGLE@346..347 ">" [] [], - }, - }, - r_curly_token: R_CURLY@347..348 "}" [] [], - }, - ], - r_tick_token: BACKTICK@348..349 "`" [] [], - }, - }, - r_brack_token: R_BRACK@349..350 "]" [] [], - optional_modifier: missing (optional), - mapped_type: TsTypeAnnotation { - colon_token: COLON@350..352 ":" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@352..353 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@353..355 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@355..358 "=>" [] [Whitespace(" ")], - return_type: TsIndexedAccessType { - object_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@358..362 "Type" [] [], - }, - type_arguments: missing (optional), - }, - l_brack_token: L_BRACK@362..363 "[" [] [], - index_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@363..371 "Property" [] [], - }, - type_arguments: missing (optional), - }, - r_brack_token: R_BRACK@371..372 "]" [] [], - }, - }, - }, - semicolon_token: missing (optional), - r_curly_token: R_CURLY@372..374 "}" [Newline("\n")] [], - }, - semicolon_token: SEMICOLON@374..375 ";" [] [], - }, - ], - eof_token: EOF@375..376 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..376 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..375 - 0: TS_TYPE_ALIAS_DECLARATION@0..32 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_MAPPED_TYPE@9..32 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: (empty) - 2: L_BRACK@11..12 "[" [] [] - 3: TS_TYPE_PARAMETER_NAME@12..17 - 0: IDENT@12..17 "test" [] [Whitespace(" ")] - 4: IN_KW@17..20 "in" [] [Whitespace(" ")] - 5: TS_UNION_TYPE@20..29 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@20..29 - 0: TS_STRING_LITERAL_TYPE@20..24 - 0: JS_STRING_LITERAL@20..24 "\"a\"" [] [Whitespace(" ")] - 1: PIPE@24..26 "|" [] [Whitespace(" ")] - 2: TS_STRING_LITERAL_TYPE@26..29 - 0: JS_STRING_LITERAL@26..29 "\"b\"" [] [] - 6: (empty) - 7: R_BRACK@29..31 "]" [] [Whitespace(" ")] - 8: (empty) - 9: (empty) - 10: (empty) - 11: R_CURLY@31..32 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@32..100 - 0: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@38..50 - 0: IDENT@38..50 "OptionsFlags" [] [] - 2: TS_TYPE_PARAMETERS@50..57 - 0: L_ANGLE@50..51 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@51..55 - 0: TS_TYPE_PARAMETER@51..55 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@51..51 - 1: TS_TYPE_PARAMETER_NAME@51..55 - 0: IDENT@51..55 "Type" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@55..57 ">" [] [Whitespace(" ")] - 3: EQ@57..59 "=" [] [Whitespace(" ")] - 4: TS_MAPPED_TYPE@59..99 - 0: L_CURLY@59..60 "{" [] [] - 1: (empty) - 2: L_BRACK@60..64 "[" [Newline("\n"), Whitespace(" ")] [] - 3: TS_TYPE_PARAMETER_NAME@64..73 - 0: IDENT@64..73 "Property" [] [Whitespace(" ")] - 4: IN_KW@73..76 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@76..86 - 0: KEYOF_KW@76..82 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@82..86 - 0: JS_REFERENCE_IDENTIFIER@82..86 - 0: IDENT@82..86 "Type" [] [] - 1: (empty) - 6: (empty) - 7: R_BRACK@86..87 "]" [] [] - 8: (empty) - 9: TS_TYPE_ANNOTATION@87..96 - 0: COLON@87..89 ":" [] [Whitespace(" ")] - 1: TS_BOOLEAN_TYPE@89..96 - 0: BOOLEAN_KW@89..96 "boolean" [] [] - 10: SEMICOLON@96..97 ";" [] [] - 11: R_CURLY@97..99 "}" [Newline("\n")] [] - 5: SEMICOLON@99..100 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@100..185 - 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@106..119 - 0: IDENT@106..119 "CreateMutable" [] [] - 2: TS_TYPE_PARAMETERS@119..126 - 0: L_ANGLE@119..120 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@120..124 - 0: TS_TYPE_PARAMETER@120..124 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@120..120 - 1: TS_TYPE_PARAMETER_NAME@120..124 - 0: IDENT@120..124 "Type" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@124..126 ">" [] [Whitespace(" ")] - 3: EQ@126..128 "=" [] [Whitespace(" ")] - 4: TS_MAPPED_TYPE@128..184 - 0: L_CURLY@128..129 "{" [] [] - 1: TS_MAPPED_TYPE_READONLY_MODIFIER_CLAUSE@129..141 - 0: MINUS@129..132 "-" [Newline("\n"), Whitespace("\t")] [] - 1: READONLY_KW@132..141 "readonly" [] [Whitespace(" ")] - 2: L_BRACK@141..142 "[" [] [] - 3: TS_TYPE_PARAMETER_NAME@142..151 - 0: IDENT@142..151 "Property" [] [Whitespace(" ")] - 4: IN_KW@151..154 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@154..164 - 0: KEYOF_KW@154..160 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@160..164 - 0: JS_REFERENCE_IDENTIFIER@160..164 - 0: IDENT@160..164 "Type" [] [] - 1: (empty) - 6: (empty) - 7: R_BRACK@164..165 "]" [] [] - 8: (empty) - 9: TS_TYPE_ANNOTATION@165..181 - 0: COLON@165..167 ":" [] [Whitespace(" ")] - 1: TS_INDEXED_ACCESS_TYPE@167..181 - 0: TS_REFERENCE_TYPE@167..171 - 0: JS_REFERENCE_IDENTIFIER@167..171 - 0: IDENT@167..171 "Type" [] [] - 1: (empty) - 1: L_BRACK@171..172 "[" [] [] - 2: TS_REFERENCE_TYPE@172..180 - 0: JS_REFERENCE_IDENTIFIER@172..180 - 0: IDENT@172..180 "Property" [] [] - 1: (empty) - 3: R_BRACK@180..181 "]" [] [] - 10: SEMICOLON@181..182 ";" [] [] - 11: R_CURLY@182..184 "}" [Newline("\n")] [] - 5: SEMICOLON@184..185 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@185..257 - 0: TYPE_KW@185..191 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@191..199 - 0: IDENT@191..199 "Concrete" [] [] - 2: TS_TYPE_PARAMETERS@199..206 - 0: L_ANGLE@199..200 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@200..204 - 0: TS_TYPE_PARAMETER@200..204 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@200..200 - 1: TS_TYPE_PARAMETER_NAME@200..204 - 0: IDENT@200..204 "Type" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@204..206 ">" [] [Whitespace(" ")] - 3: EQ@206..208 "=" [] [Whitespace(" ")] - 4: TS_MAPPED_TYPE@208..256 - 0: L_CURLY@208..209 "{" [] [] - 1: (empty) - 2: L_BRACK@209..213 "[" [Newline("\n"), Whitespace(" ")] [] - 3: TS_TYPE_PARAMETER_NAME@213..222 - 0: IDENT@213..222 "Property" [] [Whitespace(" ")] - 4: IN_KW@222..225 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@225..235 - 0: KEYOF_KW@225..231 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@231..235 - 0: JS_REFERENCE_IDENTIFIER@231..235 - 0: IDENT@231..235 "Type" [] [] - 1: (empty) - 6: (empty) - 7: R_BRACK@235..236 "]" [] [] - 8: TS_MAPPED_TYPE_OPTIONAL_MODIFIER_CLAUSE@236..238 - 0: MINUS@236..237 "-" [] [] - 1: QUESTION@237..238 "?" [] [] - 9: TS_TYPE_ANNOTATION@238..254 - 0: COLON@238..240 ":" [] [Whitespace(" ")] - 1: TS_INDEXED_ACCESS_TYPE@240..254 - 0: TS_REFERENCE_TYPE@240..244 - 0: JS_REFERENCE_IDENTIFIER@240..244 - 0: IDENT@240..244 "Type" [] [] - 1: (empty) - 1: L_BRACK@244..245 "[" [] [] - 2: TS_REFERENCE_TYPE@245..253 - 0: JS_REFERENCE_IDENTIFIER@245..253 - 0: IDENT@245..253 "Property" [] [] - 1: (empty) - 3: R_BRACK@253..254 "]" [] [] - 10: (empty) - 11: R_CURLY@254..256 "}" [Newline("\n")] [] - 5: SEMICOLON@256..257 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@257..375 - 0: TYPE_KW@257..263 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@263..270 - 0: IDENT@263..270 "Getters" [] [] - 2: TS_TYPE_PARAMETERS@270..277 - 0: L_ANGLE@270..271 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@271..275 - 0: TS_TYPE_PARAMETER@271..275 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@271..271 - 1: TS_TYPE_PARAMETER_NAME@271..275 - 0: IDENT@271..275 "Type" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@275..277 ">" [] [Whitespace(" ")] - 3: EQ@277..279 "=" [] [Whitespace(" ")] - 4: TS_MAPPED_TYPE@279..374 - 0: L_CURLY@279..280 "{" [] [] - 1: (empty) - 2: L_BRACK@280..286 "[" [Newline("\n"), Whitespace(" ")] [] - 3: TS_TYPE_PARAMETER_NAME@286..295 - 0: IDENT@286..295 "Property" [] [Whitespace(" ")] - 4: IN_KW@295..298 "in" [] [Whitespace(" ")] - 5: TS_TYPE_OPERATOR_TYPE@298..309 - 0: KEYOF_KW@298..304 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@304..309 - 0: JS_REFERENCE_IDENTIFIER@304..309 - 0: IDENT@304..309 "Type" [] [Whitespace(" ")] - 1: (empty) - 6: TS_MAPPED_TYPE_AS_CLAUSE@309..349 - 0: AS_KW@309..312 "as" [] [Whitespace(" ")] - 1: TS_TEMPLATE_LITERAL_TYPE@312..349 - 0: BACKTICK@312..313 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@313..348 - 0: TS_TEMPLATE_CHUNK_ELEMENT@313..316 - 0: TEMPLATE_CHUNK@313..316 "get" [] [] - 1: TS_TEMPLATE_ELEMENT@316..348 - 0: DOLLAR_CURLY@316..318 "${" [] [] - 1: TS_REFERENCE_TYPE@318..347 - 0: JS_REFERENCE_IDENTIFIER@318..328 - 0: IDENT@318..328 "Capitalize" [] [] - 1: TS_TYPE_ARGUMENTS@328..347 - 0: L_ANGLE@328..329 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@329..346 - 0: TS_INTERSECTION_TYPE@329..346 - 0: (empty) - 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@329..346 - 0: TS_STRING_TYPE@329..336 - 0: STRING_KW@329..336 "string" [] [Whitespace(" ")] - 1: AMP@336..338 "&" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@338..346 - 0: JS_REFERENCE_IDENTIFIER@338..346 - 0: IDENT@338..346 "Property" [] [] - 1: (empty) - 2: R_ANGLE@346..347 ">" [] [] - 2: R_CURLY@347..348 "}" [] [] - 2: BACKTICK@348..349 "`" [] [] - 7: R_BRACK@349..350 "]" [] [] - 8: (empty) - 9: TS_TYPE_ANNOTATION@350..372 - 0: COLON@350..352 ":" [] [Whitespace(" ")] - 1: TS_FUNCTION_TYPE@352..372 - 0: (empty) - 1: JS_PARAMETERS@352..355 - 0: L_PAREN@352..353 "(" [] [] - 1: JS_PARAMETER_LIST@353..353 - 2: R_PAREN@353..355 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@355..358 "=>" [] [Whitespace(" ")] - 3: TS_INDEXED_ACCESS_TYPE@358..372 - 0: TS_REFERENCE_TYPE@358..362 - 0: JS_REFERENCE_IDENTIFIER@358..362 - 0: IDENT@358..362 "Type" [] [] - 1: (empty) - 1: L_BRACK@362..363 "[" [] [] - 2: TS_REFERENCE_TYPE@363..371 - 0: JS_REFERENCE_IDENTIFIER@363..371 - 0: IDENT@363..371 "Property" [] [] - 1: (empty) - 3: R_BRACK@371..372 "]" [] [] - 10: (empty) - 11: R_CURLY@372..374 "}" [Newline("\n")] [] - 5: SEMICOLON@374..375 ";" [] [] - 4: EOF@375..376 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.rast b/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.rast deleted file mode 100644 index 2d7a18d173f4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.rast +++ /dev/null @@ -1,438 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - TsConstructorSignatureClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@29..30 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@30..31 ")" [] [], - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - TsConstructorSignatureClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@32..49 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@49..50 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@50..51 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@51..53 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@53..59 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@59..67 ")" [] [Whitespace(" "), Comments("// ASI")], - }, - semicolon_token: missing (optional), - }, - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@67..84 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@84..85 "(" [] [], - parameters: JsConstructorParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@85..86 "a" [] [], - }, - question_mark_token: QUESTION@86..87 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@87..89 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@89..95 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@95..97 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@97..98 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@98..99 "}" [] [], - }, - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: ASYNC_KW@99..111 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@111..117 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@117..118 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@118..119 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@119..121 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@121..128 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@128..129 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@129..135 "String" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@135..136 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@136..137 ";" [] [], - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@137..149 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@149..150 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@150..151 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@151..153 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@153..159 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@159..160 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@160..162 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@162..169 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@169..170 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@170..176 "String" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@176..184 ">" [] [Whitespace(" "), Comments("// ASI")], - }, - }, - }, - semicolon_token: missing (optional), - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: ASYNC_KW@184..196 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@196..202 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@202..203 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@203..204 "a" [] [], - }, - question_mark_token: QUESTION@204..205 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@205..207 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@207..213 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@213..214 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@214..216 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@216..223 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@223..224 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@224..230 "String" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@230..232 ">" [] [Whitespace(" ")], - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@232..234 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@234..241 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@241..248 "\"test\"" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@248..249 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@249..251 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@251..252 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..252 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..251 - 0: JS_CLASS_DECLARATION@0..251 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..249 - 0: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@12..32 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@12..12 - 1: JS_LITERAL_MEMBER_NAME@12..29 - 0: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@29..31 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@30..30 - 2: R_PAREN@30..31 ")" [] [] - 3: SEMICOLON@31..32 ";" [] [] - 1: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@32..67 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@32..32 - 1: JS_LITERAL_MEMBER_NAME@32..49 - 0: IDENT@32..49 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@49..67 - 0: L_PAREN@49..50 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@50..59 - 0: JS_FORMAL_PARAMETER@50..59 - 0: JS_DECORATOR_LIST@50..50 - 1: JS_IDENTIFIER_BINDING@50..51 - 0: IDENT@50..51 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@51..59 - 0: COLON@51..53 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@53..59 - 0: JS_REFERENCE_IDENTIFIER@53..59 - 0: IDENT@53..59 "String" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@59..67 ")" [] [Whitespace(" "), Comments("// ASI")] - 3: (empty) - 2: JS_CONSTRUCTOR_CLASS_MEMBER@67..99 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@67..67 - 1: JS_LITERAL_MEMBER_NAME@67..84 - 0: IDENT@67..84 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@84..97 - 0: L_PAREN@84..85 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@85..95 - 0: JS_FORMAL_PARAMETER@85..95 - 0: JS_DECORATOR_LIST@85..85 - 1: JS_IDENTIFIER_BINDING@85..86 - 0: IDENT@85..86 "a" [] [] - 2: QUESTION@86..87 "?" [] [] - 3: TS_TYPE_ANNOTATION@87..95 - 0: COLON@87..89 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@89..95 - 0: JS_REFERENCE_IDENTIFIER@89..95 - 0: IDENT@89..95 "String" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@95..97 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@97..99 - 0: L_CURLY@97..98 "{" [] [] - 1: JS_DIRECTIVE_LIST@98..98 - 2: JS_STATEMENT_LIST@98..98 - 3: R_CURLY@98..99 "}" [] [] - 3: TS_METHOD_SIGNATURE_CLASS_MEMBER@99..137 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@99..99 - 1: ASYNC_KW@99..111 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@111..117 - 0: IDENT@111..117 "method" [] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@117..119 - 0: L_PAREN@117..118 "(" [] [] - 1: JS_PARAMETER_LIST@118..118 - 2: R_PAREN@118..119 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@119..136 - 0: COLON@119..121 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@121..136 - 0: JS_REFERENCE_IDENTIFIER@121..128 - 0: IDENT@121..128 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@128..136 - 0: L_ANGLE@128..129 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@129..135 - 0: TS_REFERENCE_TYPE@129..135 - 0: JS_REFERENCE_IDENTIFIER@129..135 - 0: IDENT@129..135 "String" [] [] - 1: (empty) - 2: R_ANGLE@135..136 ">" [] [] - 7: SEMICOLON@136..137 ";" [] [] - 4: TS_METHOD_SIGNATURE_CLASS_MEMBER@137..184 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@137..137 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@137..149 - 0: IDENT@137..149 "method" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@149..160 - 0: L_PAREN@149..150 "(" [] [] - 1: JS_PARAMETER_LIST@150..159 - 0: JS_FORMAL_PARAMETER@150..159 - 0: JS_DECORATOR_LIST@150..150 - 1: JS_IDENTIFIER_BINDING@150..151 - 0: IDENT@150..151 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@151..159 - 0: COLON@151..153 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@153..159 - 0: JS_REFERENCE_IDENTIFIER@153..159 - 0: IDENT@153..159 "String" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@159..160 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@160..184 - 0: COLON@160..162 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@162..184 - 0: JS_REFERENCE_IDENTIFIER@162..169 - 0: IDENT@162..169 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@169..184 - 0: L_ANGLE@169..170 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@170..176 - 0: TS_REFERENCE_TYPE@170..176 - 0: JS_REFERENCE_IDENTIFIER@170..176 - 0: IDENT@170..176 "String" [] [] - 1: (empty) - 2: R_ANGLE@176..184 ">" [] [Whitespace(" "), Comments("// ASI")] - 7: (empty) - 5: JS_METHOD_CLASS_MEMBER@184..249 - 0: JS_METHOD_MODIFIER_LIST@184..184 - 1: ASYNC_KW@184..196 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@196..202 - 0: IDENT@196..202 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@202..214 - 0: L_PAREN@202..203 "(" [] [] - 1: JS_PARAMETER_LIST@203..213 - 0: JS_FORMAL_PARAMETER@203..213 - 0: JS_DECORATOR_LIST@203..203 - 1: JS_IDENTIFIER_BINDING@203..204 - 0: IDENT@203..204 "a" [] [] - 2: QUESTION@204..205 "?" [] [] - 3: TS_TYPE_ANNOTATION@205..213 - 0: COLON@205..207 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@207..213 - 0: JS_REFERENCE_IDENTIFIER@207..213 - 0: IDENT@207..213 "String" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@213..214 ")" [] [] - 7: TS_RETURN_TYPE_ANNOTATION@214..232 - 0: COLON@214..216 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@216..232 - 0: JS_REFERENCE_IDENTIFIER@216..223 - 0: IDENT@216..223 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@223..232 - 0: L_ANGLE@223..224 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@224..230 - 0: TS_REFERENCE_TYPE@224..230 - 0: JS_REFERENCE_IDENTIFIER@224..230 - 0: IDENT@224..230 "String" [] [] - 1: (empty) - 2: R_ANGLE@230..232 ">" [] [Whitespace(" ")] - 8: JS_FUNCTION_BODY@232..249 - 0: L_CURLY@232..234 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@234..234 - 2: JS_STATEMENT_LIST@234..248 - 0: JS_RETURN_STATEMENT@234..248 - 0: RETURN_KW@234..241 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@241..248 - 0: JS_STRING_LITERAL@241..248 "\"test\"" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@248..249 "}" [] [] - 9: R_CURLY@249..251 "}" [Newline("\n")] [] - 4: EOF@251..252 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.rast deleted file mode 100644 index 7e8ab830d8b5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.rast +++ /dev/null @@ -1,223 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@11..12 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@12..19 "test" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@19..20 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@20..21 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@21..23 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@23..25 "B" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@25..33 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@33..34 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - COMMA@34..36 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@36..37 "R" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@37..38 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@39..40 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@40..42 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@42..43 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@43..45 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@45..46 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@46..48 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@48..49 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@49..50 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@50..52 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@52..54 "R" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@54..55 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@55..56 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@56..58 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@58..59 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..59 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..58 - 0: JS_CLASS_DECLARATION@0..58 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..11 - 0: IDENT@6..11 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@11..12 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@12..56 - 0: JS_METHOD_CLASS_MEMBER@12..56 - 0: JS_METHOD_MODIFIER_LIST@12..12 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@12..19 - 0: IDENT@12..19 "test" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: TS_TYPE_PARAMETERS@19..38 - 0: L_ANGLE@19..20 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@20..37 - 0: TS_TYPE_PARAMETER@20..21 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@20..20 - 1: TS_TYPE_PARAMETER_NAME@20..21 - 0: IDENT@20..21 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@21..23 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@23..34 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@23..23 - 1: TS_TYPE_PARAMETER_NAME@23..25 - 0: IDENT@23..25 "B" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@25..34 - 0: EXTENDS_KW@25..33 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@33..34 - 0: JS_REFERENCE_IDENTIFIER@33..34 - 0: IDENT@33..34 "A" [] [] - 1: (empty) - 3: (empty) - 3: COMMA@34..36 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@36..37 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@36..36 - 1: TS_TYPE_PARAMETER_NAME@36..37 - 0: IDENT@36..37 "R" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@37..38 ">" [] [] - 6: JS_PARAMETERS@38..50 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..49 - 0: JS_FORMAL_PARAMETER@39..43 - 0: JS_DECORATOR_LIST@39..39 - 1: JS_IDENTIFIER_BINDING@39..40 - 0: IDENT@39..40 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@40..43 - 0: COLON@40..42 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@42..43 - 0: JS_REFERENCE_IDENTIFIER@42..43 - 0: IDENT@42..43 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@43..45 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@45..49 - 0: JS_DECORATOR_LIST@45..45 - 1: JS_IDENTIFIER_BINDING@45..46 - 0: IDENT@45..46 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@46..49 - 0: COLON@46..48 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@48..49 - 0: JS_REFERENCE_IDENTIFIER@48..49 - 0: IDENT@48..49 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@49..50 ")" [] [] - 7: TS_RETURN_TYPE_ANNOTATION@50..54 - 0: COLON@50..52 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@52..54 - 0: JS_REFERENCE_IDENTIFIER@52..54 - 0: IDENT@52..54 "R" [] [Whitespace(" ")] - 1: (empty) - 8: JS_FUNCTION_BODY@54..56 - 0: L_CURLY@54..55 "{" [] [] - 1: JS_DIRECTIVE_LIST@55..55 - 2: JS_STATEMENT_LIST@55..55 - 3: R_CURLY@55..56 "}" [] [] - 9: R_CURLY@56..58 "}" [Newline("\n")] [] - 4: EOF@58..59 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast b/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast deleted file mode 100644 index 574cfcdffc6c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast +++ /dev/null @@ -1,410 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1..2 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@8..9 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@9..10 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@11..12 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@12..18 "maybeA" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@20..23 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@23..24 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@24..26 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@26..33 "maybeA" [] [Whitespace(" ")], - }, - is_token: IS_KW@33..36 "is" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@36..38 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@40..47 "return" [] [Whitespace(" ")], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@47..52 "true" [] [Whitespace(" ")], - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@52..53 "}" [] [], - }, - }, - COMMA@53..54 "," [] [], - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@54..60 "y" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@60..61 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@61..62 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@62..64 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@64..70 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@70..71 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@71..73 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@73..80 "string" [] [Whitespace(" ")], - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@82..89 "return" [] [Whitespace(" ")], - argument: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@89..97 "\"string\"" [] [], - }, - semicolon_token: SEMICOLON@97..99 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@99..100 "}" [] [], - }, - }, - COMMA@100..101 "," [] [], - JsMethodObjectMember { - async_token: ASYNC_KW@101..112 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - star_token: STAR@112..113 "*" [] [], - name: JsLiteralMemberName { - value: IDENT@113..115 "id" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@115..116 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@116..117 "R" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@117..118 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@118..119 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@119..124 "param" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@124..126 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@126..133 "Promise" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@133..134 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@134..135 "R" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@135..136 ">" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@136..137 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@137..139 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@139..160 "AsyncIterableIterator" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@160..161 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@161..162 "R" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@162..164 ">" [] [Whitespace(" ")], - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@164..166 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@166..172 "yield" [] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: missing (optional), - expression: JsAwaitExpression { - await_token: AWAIT_KW@172..178 "await" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@178..184 "param" [] [Whitespace(" ")], - }, - }, - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@184..185 "}" [] [], - }, - }, - COMMA@185..186 "," [] [], - ], - r_curly_token: R_CURLY@186..188 "}" [Newline("\n")] [], - }, - r_paren_token: R_PAREN@188..189 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@189..190 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..190 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..189 - 0: JS_EXPRESSION_STATEMENT@0..189 - 0: JS_PARENTHESIZED_EXPRESSION@0..189 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_OBJECT_EXPRESSION@1..188 - 0: L_CURLY@1..2 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@2..186 - 0: JS_METHOD_OBJECT_MEMBER@2..53 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@2..8 - 0: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [] - 3: TS_TYPE_PARAMETERS@8..11 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@9..10 - 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 - 1: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@10..11 ">" [] [] - 4: JS_PARAMETERS@11..24 - 0: L_PAREN@11..12 "(" [] [] - 1: JS_PARAMETER_LIST@12..23 - 0: JS_FORMAL_PARAMETER@12..23 - 0: JS_DECORATOR_LIST@12..12 - 1: JS_IDENTIFIER_BINDING@12..18 - 0: IDENT@12..18 "maybeA" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@18..23 - 0: COLON@18..20 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@20..23 - 0: ANY_KW@20..23 "any" [] [] - 4: (empty) - 2: R_PAREN@23..24 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@24..38 - 0: COLON@24..26 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@26..38 - 0: JS_REFERENCE_IDENTIFIER@26..33 - 0: IDENT@26..33 "maybeA" [] [Whitespace(" ")] - 1: IS_KW@33..36 "is" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@36..38 - 0: JS_REFERENCE_IDENTIFIER@36..38 - 0: IDENT@36..38 "A" [] [Whitespace(" ")] - 1: (empty) - 6: JS_FUNCTION_BODY@38..53 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..52 - 0: JS_RETURN_STATEMENT@40..52 - 0: RETURN_KW@40..47 "return" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@47..52 - 0: TRUE_KW@47..52 "true" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@52..53 "}" [] [] - 1: COMMA@53..54 "," [] [] - 2: JS_METHOD_OBJECT_MEMBER@54..100 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@54..60 - 0: IDENT@54..60 "y" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: JS_PARAMETERS@60..71 - 0: L_PAREN@60..61 "(" [] [] - 1: JS_PARAMETER_LIST@61..70 - 0: JS_FORMAL_PARAMETER@61..70 - 0: JS_DECORATOR_LIST@61..61 - 1: JS_IDENTIFIER_BINDING@61..62 - 0: IDENT@61..62 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@62..70 - 0: COLON@62..64 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@64..70 - 0: STRING_KW@64..70 "string" [] [] - 4: (empty) - 2: R_PAREN@70..71 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@71..80 - 0: COLON@71..73 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@73..80 - 0: STRING_KW@73..80 "string" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@80..100 - 0: L_CURLY@80..82 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@82..82 - 2: JS_STATEMENT_LIST@82..99 - 0: JS_RETURN_STATEMENT@82..99 - 0: RETURN_KW@82..89 "return" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@89..97 - 0: JS_STRING_LITERAL@89..97 "\"string\"" [] [] - 2: SEMICOLON@97..99 ";" [] [Whitespace(" ")] - 3: R_CURLY@99..100 "}" [] [] - 3: COMMA@100..101 "," [] [] - 4: JS_METHOD_OBJECT_MEMBER@101..185 - 0: ASYNC_KW@101..112 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: STAR@112..113 "*" [] [] - 2: JS_LITERAL_MEMBER_NAME@113..115 - 0: IDENT@113..115 "id" [] [] - 3: TS_TYPE_PARAMETERS@115..118 - 0: L_ANGLE@115..116 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@116..117 - 0: TS_TYPE_PARAMETER@116..117 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@116..116 - 1: TS_TYPE_PARAMETER_NAME@116..117 - 0: IDENT@116..117 "R" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@117..118 ">" [] [] - 4: JS_PARAMETERS@118..137 - 0: L_PAREN@118..119 "(" [] [] - 1: JS_PARAMETER_LIST@119..136 - 0: JS_FORMAL_PARAMETER@119..136 - 0: JS_DECORATOR_LIST@119..119 - 1: JS_IDENTIFIER_BINDING@119..124 - 0: IDENT@119..124 "param" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@124..136 - 0: COLON@124..126 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@126..136 - 0: JS_REFERENCE_IDENTIFIER@126..133 - 0: IDENT@126..133 "Promise" [] [] - 1: TS_TYPE_ARGUMENTS@133..136 - 0: L_ANGLE@133..134 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@134..135 - 0: TS_REFERENCE_TYPE@134..135 - 0: JS_REFERENCE_IDENTIFIER@134..135 - 0: IDENT@134..135 "R" [] [] - 1: (empty) - 2: R_ANGLE@135..136 ">" [] [] - 4: (empty) - 2: R_PAREN@136..137 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@137..164 - 0: COLON@137..139 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@139..164 - 0: JS_REFERENCE_IDENTIFIER@139..160 - 0: IDENT@139..160 "AsyncIterableIterator" [] [] - 1: TS_TYPE_ARGUMENTS@160..164 - 0: L_ANGLE@160..161 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@161..162 - 0: TS_REFERENCE_TYPE@161..162 - 0: JS_REFERENCE_IDENTIFIER@161..162 - 0: IDENT@161..162 "R" [] [] - 1: (empty) - 2: R_ANGLE@162..164 ">" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@164..185 - 0: L_CURLY@164..166 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@166..166 - 2: JS_STATEMENT_LIST@166..184 - 0: JS_EXPRESSION_STATEMENT@166..184 - 0: JS_YIELD_EXPRESSION@166..184 - 0: YIELD_KW@166..172 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@172..184 - 0: (empty) - 1: JS_AWAIT_EXPRESSION@172..184 - 0: AWAIT_KW@172..178 "await" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@178..184 - 0: JS_REFERENCE_IDENTIFIER@178..184 - 0: IDENT@178..184 "param" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@184..185 "}" [] [] - 5: COMMA@185..186 "," [] [] - 2: R_CURLY@186..188 "}" [Newline("\n")] [] - 2: R_PAREN@188..189 ")" [] [] - 1: (empty) - 4: EOF@189..190 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.rast deleted file mode 100644 index 628265cf0488..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.rast +++ /dev/null @@ -1,182 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@15..17 "a" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@17..18 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@28..35 "module" [] [Whitespace(" ")], - name: TsQualifiedModuleName { - left: TsQualifiedModuleName { - left: TsQualifiedModuleName { - left: TsIdentifierBinding { - name_token: IDENT@35..36 "a" [] [], - }, - dot_token: DOT@36..37 "." [] [], - right: JsName { - value_token: IDENT@37..38 "b" [] [], - }, - }, - dot_token: DOT@38..39 "." [] [], - right: JsName { - value_token: IDENT@39..40 "c" [] [], - }, - }, - dot_token: DOT@40..41 "." [] [], - right: JsName { - value_token: IDENT@41..43 "d" [] [Whitespace(" ")], - }, - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@43..44 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@44..45 "}" [] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@45..54 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@54..61 "module" [] [Whitespace(" ")], - name: TsQualifiedModuleName { - left: TsIdentifierBinding { - name_token: IDENT@61..62 "a" [] [], - }, - dot_token: DOT@62..63 "." [] [], - right: JsName { - value_token: IDENT@63..65 "b" [] [Whitespace(" ")], - }, - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@65..67 "{" [] [Whitespace(" ")], - items: JsModuleItemList [ - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@67..76 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@76..80 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@80..81 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@81..82 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@82..84 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@84..91 "string" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@91..92 "}" [] [], - }, - }, - }, - TsModuleDeclaration { - module_or_namespace: MODULE_KW@92..100 "module" [Newline("\n")] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@100..102 "X" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@102..103 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@103..104 "}" [] [], - }, - }, - ], - eof_token: EOF@104..105 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..105 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..104 - 0: TS_DECLARE_STATEMENT@0..19 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..19 - 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "a" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@17..19 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_MODULE_ITEM_LIST@18..18 - 2: R_CURLY@18..19 "}" [] [] - 1: TS_DECLARE_STATEMENT@19..45 - 0: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@28..45 - 0: MODULE_KW@28..35 "module" [] [Whitespace(" ")] - 1: TS_QUALIFIED_MODULE_NAME@35..43 - 0: TS_QUALIFIED_MODULE_NAME@35..40 - 0: TS_QUALIFIED_MODULE_NAME@35..38 - 0: TS_IDENTIFIER_BINDING@35..36 - 0: IDENT@35..36 "a" [] [] - 1: DOT@36..37 "." [] [] - 2: JS_NAME@37..38 - 0: IDENT@37..38 "b" [] [] - 1: DOT@38..39 "." [] [] - 2: JS_NAME@39..40 - 0: IDENT@39..40 "c" [] [] - 1: DOT@40..41 "." [] [] - 2: JS_NAME@41..43 - 0: IDENT@41..43 "d" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@43..45 - 0: L_CURLY@43..44 "{" [] [] - 1: JS_MODULE_ITEM_LIST@44..44 - 2: R_CURLY@44..45 "}" [] [] - 2: TS_DECLARE_STATEMENT@45..92 - 0: DECLARE_KW@45..54 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@54..92 - 0: MODULE_KW@54..61 "module" [] [Whitespace(" ")] - 1: TS_QUALIFIED_MODULE_NAME@61..65 - 0: TS_IDENTIFIER_BINDING@61..62 - 0: IDENT@61..62 "a" [] [] - 1: DOT@62..63 "." [] [] - 2: JS_NAME@63..65 - 0: IDENT@63..65 "b" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@65..92 - 0: L_CURLY@65..67 "{" [] [Whitespace(" ")] - 1: JS_MODULE_ITEM_LIST@67..91 - 0: TS_DECLARE_FUNCTION_DECLARATION@67..91 - 0: (empty) - 1: FUNCTION_KW@67..76 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@76..80 - 0: IDENT@76..80 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@80..82 - 0: L_PAREN@80..81 "(" [] [] - 1: JS_PARAMETER_LIST@81..81 - 2: R_PAREN@81..82 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@82..91 - 0: COLON@82..84 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@84..91 - 0: STRING_KW@84..91 "string" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@91..92 "}" [] [] - 3: TS_MODULE_DECLARATION@92..104 - 0: MODULE_KW@92..100 "module" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@100..102 - 0: IDENT@100..102 "X" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@102..104 - 0: L_CURLY@102..103 "{" [] [] - 1: JS_MODULE_ITEM_LIST@103..103 - 2: R_CURLY@103..104 "}" [] [] - 4: EOF@104..105 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.rast deleted file mode 100644 index 45b198d49c43..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.rast +++ /dev/null @@ -1,260 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsShorthandNamedImportSpecifier { - type_token: missing (optional), - local_name: JsIdentifierBinding { - name_token: IDENT@9..13 "type" [] [], - }, - }, - COMMA@13..15 "," [] [Whitespace(" ")], - JsShorthandNamedImportSpecifier { - type_token: TYPE_KW@15..20 "type" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@20..23 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@23..25 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@25..30 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@30..37 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@38..46 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@48..53 "type" [] [Whitespace(" ")], - }, - as_token: AS_KW@53..56 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@56..62 "other" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@62..64 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@64..69 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@69..76 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@84..86 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: missing (optional), - name: JsLiteralExportName { - value: IDENT@86..91 "type" [] [Whitespace(" ")], - }, - as_token: AS_KW@91..94 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@94..97 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@97..99 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@99..104 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@104..111 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@111..112 ";" [] [], - }, - JsImport { - import_token: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@120..122 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: TYPE_KW@122..127 "type" [] [Whitespace(" ")], - name: JsLiteralExportName { - value: IDENT@127..130 "as" [] [Whitespace(" ")], - }, - as_token: AS_KW@130..133 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@133..136 "as" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@136..138 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@138..143 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@143..150 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsImport { - import_token: IMPORT_KW@150..158 "import" [Newline("\n")] [Whitespace(" ")], - import_clause: JsImportNamedClause { - type_token: missing (optional), - named_specifiers: JsNamedImportSpecifiers { - l_curly_token: L_CURLY@158..160 "{" [] [Whitespace(" ")], - specifiers: JsNamedImportSpecifierList [ - JsNamedImportSpecifier { - type_token: TYPE_KW@160..165 "type" [] [Whitespace(" ")], - name: JsLiteralExportName { - value: JS_STRING_LITERAL@165..177 "\"test-abcd\"" [] [Whitespace(" ")], - }, - as_token: AS_KW@177..180 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@180..185 "test" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@185..187 "}" [] [Whitespace(" ")], - }, - from_token: FROM_KW@187..192 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@192..199 "\"./mod\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@199..200 ";" [] [], - }, - ], - eof_token: EOF@200..201 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..201 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..200 - 0: JS_IMPORT@0..38 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@7..37 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@7..25 - 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..23 - 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@9..13 - 0: (empty) - 1: JS_IDENTIFIER_BINDING@9..13 - 0: IDENT@9..13 "type" [] [] - 1: COMMA@13..15 "," [] [Whitespace(" ")] - 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@15..23 - 0: TYPE_KW@15..20 "type" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_BINDING@20..23 - 0: IDENT@20..23 "as" [] [Whitespace(" ")] - 2: R_CURLY@23..25 "}" [] [Whitespace(" ")] - 2: FROM_KW@25..30 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@30..37 - 0: JS_STRING_LITERAL@30..37 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@37..38 ";" [] [] - 1: JS_IMPORT@38..76 - 0: IMPORT_KW@38..46 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@46..76 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@46..64 - 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@48..62 - 0: JS_NAMED_IMPORT_SPECIFIER@48..62 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@48..53 - 0: IDENT@48..53 "type" [] [Whitespace(" ")] - 2: AS_KW@53..56 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@56..62 - 0: IDENT@56..62 "other" [] [Whitespace(" ")] - 2: R_CURLY@62..64 "}" [] [Whitespace(" ")] - 2: FROM_KW@64..69 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@69..76 - 0: JS_STRING_LITERAL@69..76 "\"./mod\"" [] [] - 4: (empty) - 2: (empty) - 2: JS_IMPORT@76..112 - 0: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@84..111 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@84..99 - 0: L_CURLY@84..86 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@86..97 - 0: JS_NAMED_IMPORT_SPECIFIER@86..97 - 0: (empty) - 1: JS_LITERAL_EXPORT_NAME@86..91 - 0: IDENT@86..91 "type" [] [Whitespace(" ")] - 2: AS_KW@91..94 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@94..97 - 0: IDENT@94..97 "as" [] [Whitespace(" ")] - 2: R_CURLY@97..99 "}" [] [Whitespace(" ")] - 2: FROM_KW@99..104 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@104..111 - 0: JS_STRING_LITERAL@104..111 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@111..112 ";" [] [] - 3: JS_IMPORT@112..150 - 0: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@120..150 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@120..138 - 0: L_CURLY@120..122 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@122..136 - 0: JS_NAMED_IMPORT_SPECIFIER@122..136 - 0: TYPE_KW@122..127 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@127..130 - 0: IDENT@127..130 "as" [] [Whitespace(" ")] - 2: AS_KW@130..133 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@133..136 - 0: IDENT@133..136 "as" [] [Whitespace(" ")] - 2: R_CURLY@136..138 "}" [] [Whitespace(" ")] - 2: FROM_KW@138..143 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@143..150 - 0: JS_STRING_LITERAL@143..150 "\"./mod\"" [] [] - 4: (empty) - 2: (empty) - 4: JS_IMPORT@150..200 - 0: IMPORT_KW@150..158 "import" [Newline("\n")] [Whitespace(" ")] - 1: JS_IMPORT_NAMED_CLAUSE@158..199 - 0: (empty) - 1: JS_NAMED_IMPORT_SPECIFIERS@158..187 - 0: L_CURLY@158..160 "{" [] [Whitespace(" ")] - 1: JS_NAMED_IMPORT_SPECIFIER_LIST@160..185 - 0: JS_NAMED_IMPORT_SPECIFIER@160..185 - 0: TYPE_KW@160..165 "type" [] [Whitespace(" ")] - 1: JS_LITERAL_EXPORT_NAME@165..177 - 0: JS_STRING_LITERAL@165..177 "\"test-abcd\"" [] [Whitespace(" ")] - 2: AS_KW@177..180 "as" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@180..185 - 0: IDENT@180..185 "test" [] [Whitespace(" ")] - 2: R_CURLY@185..187 "}" [] [Whitespace(" ")] - 2: FROM_KW@187..192 "from" [] [Whitespace(" ")] - 3: JS_MODULE_SOURCE@192..199 - 0: JS_STRING_LITERAL@192..199 "\"./mod\"" [] [] - 4: (empty) - 2: SEMICOLON@199..200 ";" [] [] - 4: EOF@200..201 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.rast b/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.rast deleted file mode 100644 index cc198eac0beb..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.rast +++ /dev/null @@ -1,182 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@18..20 "a" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@20..21 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@22..31 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@31..41 "namespace" [] [Whitespace(" ")], - name: TsQualifiedModuleName { - left: TsQualifiedModuleName { - left: TsQualifiedModuleName { - left: TsIdentifierBinding { - name_token: IDENT@41..42 "a" [] [], - }, - dot_token: DOT@42..43 "." [] [], - right: JsName { - value_token: IDENT@43..44 "b" [] [], - }, - }, - dot_token: DOT@44..45 "." [] [], - right: JsName { - value_token: IDENT@45..46 "c" [] [], - }, - }, - dot_token: DOT@46..47 "." [] [], - right: JsName { - value_token: IDENT@47..49 "d" [] [Whitespace(" ")], - }, - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@49..50 "{" [] [], - items: JsModuleItemList [], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@51..60 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@60..70 "namespace" [] [Whitespace(" ")], - name: TsQualifiedModuleName { - left: TsIdentifierBinding { - name_token: IDENT@70..71 "a" [] [], - }, - dot_token: DOT@71..72 "." [] [], - right: JsName { - value_token: IDENT@72..74 "b" [] [Whitespace(" ")], - }, - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@74..76 "{" [] [Whitespace(" ")], - items: JsModuleItemList [ - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@76..85 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@85..89 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@89..90 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@90..91 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@91..93 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@93..100 "string" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@100..101 "}" [] [], - }, - }, - }, - TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@101..112 "namespace" [Newline("\n")] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@112..114 "X" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@114..116 "{" [] [Whitespace(" ")], - items: JsModuleItemList [], - r_curly_token: R_CURLY@116..117 "}" [] [], - }, - }, - ], - eof_token: EOF@117..118 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..118 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..117 - 0: TS_DECLARE_STATEMENT@0..22 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..22 - 0: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@18..20 - 0: IDENT@18..20 "a" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@20..22 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_MODULE_ITEM_LIST@21..21 - 2: R_CURLY@21..22 "}" [] [] - 1: TS_DECLARE_STATEMENT@22..51 - 0: DECLARE_KW@22..31 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@31..51 - 0: NAMESPACE_KW@31..41 "namespace" [] [Whitespace(" ")] - 1: TS_QUALIFIED_MODULE_NAME@41..49 - 0: TS_QUALIFIED_MODULE_NAME@41..46 - 0: TS_QUALIFIED_MODULE_NAME@41..44 - 0: TS_IDENTIFIER_BINDING@41..42 - 0: IDENT@41..42 "a" [] [] - 1: DOT@42..43 "." [] [] - 2: JS_NAME@43..44 - 0: IDENT@43..44 "b" [] [] - 1: DOT@44..45 "." [] [] - 2: JS_NAME@45..46 - 0: IDENT@45..46 "c" [] [] - 1: DOT@46..47 "." [] [] - 2: JS_NAME@47..49 - 0: IDENT@47..49 "d" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@49..51 - 0: L_CURLY@49..50 "{" [] [] - 1: JS_MODULE_ITEM_LIST@50..50 - 2: R_CURLY@50..51 "}" [] [] - 2: TS_DECLARE_STATEMENT@51..101 - 0: DECLARE_KW@51..60 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@60..101 - 0: NAMESPACE_KW@60..70 "namespace" [] [Whitespace(" ")] - 1: TS_QUALIFIED_MODULE_NAME@70..74 - 0: TS_IDENTIFIER_BINDING@70..71 - 0: IDENT@70..71 "a" [] [] - 1: DOT@71..72 "." [] [] - 2: JS_NAME@72..74 - 0: IDENT@72..74 "b" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@74..101 - 0: L_CURLY@74..76 "{" [] [Whitespace(" ")] - 1: JS_MODULE_ITEM_LIST@76..100 - 0: TS_DECLARE_FUNCTION_DECLARATION@76..100 - 0: (empty) - 1: FUNCTION_KW@76..85 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@85..89 - 0: IDENT@85..89 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@89..91 - 0: L_PAREN@89..90 "(" [] [] - 1: JS_PARAMETER_LIST@90..90 - 2: R_PAREN@90..91 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@91..100 - 0: COLON@91..93 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@93..100 - 0: STRING_KW@93..100 "string" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@100..101 "}" [] [] - 3: TS_MODULE_DECLARATION@101..117 - 0: NAMESPACE_KW@101..112 "namespace" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@112..114 - 0: IDENT@112..114 "X" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@114..117 - 0: L_CURLY@114..116 "{" [] [Whitespace(" ")] - 1: JS_MODULE_ITEM_LIST@116..116 - 2: R_CURLY@116..117 "}" [] [] - 4: EOF@117..118 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.rast b/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.rast deleted file mode 100644 index 3d721171ba7c..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.rast +++ /dev/null @@ -1,243 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..7 "c2" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - expression: JsNewExpression { - new_token: NEW_KW@9..13 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@13..14 "T" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@14..15 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@15..21 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@21..22 ">" [] [], - }, - arguments: missing (optional), - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@22..30 ";" [] [Whitespace(" "), Comments("// Ok")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@30..35 "var" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@35..38 "x1" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - expression: JsNewExpression { - new_token: NEW_KW@40..44 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@44..46 "SS" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@46..47 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsNumberType { - number_token: NUMBER_KW@47..53 "number" [] [], - }, - ], - r_angle_token: R_ANGLE@53..54 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@54..55 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@55..56 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@56..63 ";" [] [Whitespace(" "), Comments("// OK")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@63..68 "var" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@68..71 "x3" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@71..73 "=" [] [Whitespace(" ")], - expression: JsNewExpression { - new_token: NEW_KW@73..77 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@77..79 "SS" [] [], - }, - }, - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@79..80 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@80..81 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@81..96 ";" [] [Whitespace(" "), Comments("// OK")], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@96..101 "var" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@101..104 "x4" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@104..106 "=" [] [Whitespace(" ")], - expression: JsNewExpression { - new_token: NEW_KW@106..110 "new" [] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@110..112 "SS" [] [], - }, - }, - type_arguments: missing (optional), - arguments: missing (optional), - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@112..129 ";" [] [Whitespace(" "), Comments("// OK")], - }, - ], - eof_token: EOF@129..130 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..130 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..129 - 0: JS_VARIABLE_STATEMENT@0..30 - 0: JS_VARIABLE_DECLARATION@0..22 - 0: (empty) - 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..22 - 0: JS_VARIABLE_DECLARATOR@4..22 - 0: JS_IDENTIFIER_BINDING@4..7 - 0: IDENT@4..7 "c2" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@7..22 - 0: EQ@7..9 "=" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@9..22 - 0: NEW_KW@9..13 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@13..14 - 0: JS_REFERENCE_IDENTIFIER@13..14 - 0: IDENT@13..14 "T" [] [] - 2: TS_TYPE_ARGUMENTS@14..22 - 0: L_ANGLE@14..15 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@15..21 - 0: TS_STRING_TYPE@15..21 - 0: STRING_KW@15..21 "string" [] [] - 2: R_ANGLE@21..22 ">" [] [] - 3: (empty) - 1: SEMICOLON@22..30 ";" [] [Whitespace(" "), Comments("// Ok")] - 1: JS_VARIABLE_STATEMENT@30..63 - 0: JS_VARIABLE_DECLARATION@30..56 - 0: (empty) - 1: VAR_KW@30..35 "var" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@35..56 - 0: JS_VARIABLE_DECLARATOR@35..56 - 0: JS_IDENTIFIER_BINDING@35..38 - 0: IDENT@35..38 "x1" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@38..56 - 0: EQ@38..40 "=" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@40..56 - 0: NEW_KW@40..44 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@44..46 - 0: JS_REFERENCE_IDENTIFIER@44..46 - 0: IDENT@44..46 "SS" [] [] - 2: TS_TYPE_ARGUMENTS@46..54 - 0: L_ANGLE@46..47 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@47..53 - 0: TS_NUMBER_TYPE@47..53 - 0: NUMBER_KW@47..53 "number" [] [] - 2: R_ANGLE@53..54 ">" [] [] - 3: JS_CALL_ARGUMENTS@54..56 - 0: L_PAREN@54..55 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@55..55 - 2: R_PAREN@55..56 ")" [] [] - 1: SEMICOLON@56..63 ";" [] [Whitespace(" "), Comments("// OK")] - 2: JS_VARIABLE_STATEMENT@63..96 - 0: JS_VARIABLE_DECLARATION@63..81 - 0: (empty) - 1: VAR_KW@63..68 "var" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@68..81 - 0: JS_VARIABLE_DECLARATOR@68..81 - 0: JS_IDENTIFIER_BINDING@68..71 - 0: IDENT@68..71 "x3" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@71..81 - 0: EQ@71..73 "=" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@73..81 - 0: NEW_KW@73..77 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@77..79 - 0: JS_REFERENCE_IDENTIFIER@77..79 - 0: IDENT@77..79 "SS" [] [] - 2: (empty) - 3: JS_CALL_ARGUMENTS@79..81 - 0: L_PAREN@79..80 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@80..80 - 2: R_PAREN@80..81 ")" [] [] - 1: SEMICOLON@81..96 ";" [] [Whitespace(" "), Comments("// OK")] - 3: JS_VARIABLE_STATEMENT@96..129 - 0: JS_VARIABLE_DECLARATION@96..112 - 0: (empty) - 1: VAR_KW@96..101 "var" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@101..112 - 0: JS_VARIABLE_DECLARATOR@101..112 - 0: JS_IDENTIFIER_BINDING@101..104 - 0: IDENT@101..104 "x4" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@104..112 - 0: EQ@104..106 "=" [] [Whitespace(" ")] - 1: JS_NEW_EXPRESSION@106..112 - 0: NEW_KW@106..110 "new" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@110..112 - 0: JS_REFERENCE_IDENTIFIER@110..112 - 0: IDENT@110..112 "SS" [] [] - 2: (empty) - 3: (empty) - 1: SEMICOLON@112..129 ";" [] [Whitespace(" "), Comments("// OK")] - 4: EOF@129..130 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast b/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast deleted file mode 100644 index f12101a56256..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast +++ /dev/null @@ -1,166 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..10 "Test" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@10..11 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@11..12 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@12..14 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@14..15 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@15..17 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@17..18 "C" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@18..20 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@20..21 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - JsExpressionStatement { - expression: JsNewExpression { - new_token: NEW_KW@22..27 "new" [Newline("\n")] [Whitespace(" ")], - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@27..31 "Test" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@31..32 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@32..33 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@33..35 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@35..36 "B" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@36..38 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@38..39 "C" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@39..40 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@40..41 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@41..42 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - ], - eof_token: EOF@43..44 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..44 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..43 - 0: JS_CLASS_DECLARATION@0..22 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..10 - 0: IDENT@6..10 "Test" [] [] - 4: TS_TYPE_PARAMETERS@10..20 - 0: L_ANGLE@10..11 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@11..18 - 0: TS_TYPE_PARAMETER@11..12 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@11..11 - 1: TS_TYPE_PARAMETER_NAME@11..12 - 0: IDENT@11..12 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@12..14 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@14..15 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@14..14 - 1: TS_TYPE_PARAMETER_NAME@14..15 - 0: IDENT@14..15 "B" [] [] - 2: (empty) - 3: (empty) - 3: COMMA@15..17 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@17..18 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@17..17 - 1: TS_TYPE_PARAMETER_NAME@17..18 - 0: IDENT@17..18 "C" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@18..20 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@20..21 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@21..21 - 9: R_CURLY@21..22 "}" [] [] - 1: JS_EXPRESSION_STATEMENT@22..43 - 0: JS_NEW_EXPRESSION@22..42 - 0: NEW_KW@22..27 "new" [Newline("\n")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@27..31 - 0: JS_REFERENCE_IDENTIFIER@27..31 - 0: IDENT@27..31 "Test" [] [] - 2: TS_TYPE_ARGUMENTS@31..40 - 0: L_ANGLE@31..32 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@32..39 - 0: TS_REFERENCE_TYPE@32..33 - 0: JS_REFERENCE_IDENTIFIER@32..33 - 0: IDENT@32..33 "A" [] [] - 1: (empty) - 1: COMMA@33..35 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@35..36 - 0: JS_REFERENCE_IDENTIFIER@35..36 - 0: IDENT@35..36 "B" [] [] - 1: (empty) - 3: COMMA@36..38 "," [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@38..39 - 0: JS_REFERENCE_IDENTIFIER@38..39 - 0: IDENT@38..39 "C" [] [] - 1: (empty) - 2: R_ANGLE@39..40 ">" [] [] - 3: JS_CALL_ARGUMENTS@40..42 - 0: L_PAREN@40..41 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@41..41 - 2: R_PAREN@41..42 ")" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 4: EOF@43..44 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast b/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast deleted file mode 100644 index 0ad969e41570..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast +++ /dev/null @@ -1,245 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@10..11 "b" [] [], - }, - colon_token: COLON@11..13 ":" [] [Whitespace(" ")], - value: JsObjectExpression { - l_curly_token: L_CURLY@13..14 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@16..17 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - JsExpressionStatement { - expression: TsNonNullAssertionExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@18..20 "a" [Newline("\n")] [], - }, - }, - excl_token: BANG@20..21 "!" [] [], - }, - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@22..32 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@32..36 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@39..40 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@40..41 "}" [] [], - }, - }, - JsExpressionStatement { - expression: TsNonNullAssertionExpression { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..46 "test" [Newline("\n")] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@46..47 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@47..48 ")" [] [], - }, - }, - excl_token: BANG@48..49 "!" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: TsNonNullAssertionExpression { - expression: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@49..52 "a" [Newline("\n"), Whitespace("\t")] [], - }, - }, - operator_token: DOT@52..53 "." [] [], - member: JsName { - value_token: IDENT@53..54 "b" [] [], - }, - }, - operator_token: DOT@54..55 "." [] [], - member: JsName { - value_token: IDENT@55..56 "c" [] [], - }, - }, - excl_token: BANG@56..57 "!" [] [], - }, - semicolon_token: SEMICOLON@57..58 ";" [] [], - }, - JsExpressionStatement { - expression: TsNonNullAssertionExpression { - expression: TsNonNullAssertionExpression { - expression: TsNonNullAssertionExpression { - expression: TsNonNullAssertionExpression { - expression: TsNonNullAssertionExpression { - expression: TsNonNullAssertionExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@58..60 "a" [Newline("\n")] [], - }, - }, - excl_token: BANG@60..61 "!" [] [], - }, - excl_token: BANG@61..62 "!" [] [], - }, - excl_token: BANG@62..63 "!" [] [], - }, - excl_token: BANG@63..64 "!" [] [], - }, - excl_token: BANG@64..65 "!" [] [], - }, - excl_token: BANG@65..66 "!" [] [], - }, - semicolon_token: SEMICOLON@66..67 ";" [] [], - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: JS_VARIABLE_STATEMENT@0..18 - 0: JS_VARIABLE_DECLARATION@0..17 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..17 - 0: JS_VARIABLE_DECLARATOR@4..17 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..17 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..17 - 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@10..16 - 0: JS_PROPERTY_OBJECT_MEMBER@10..16 - 0: JS_LITERAL_MEMBER_NAME@10..11 - 0: IDENT@10..11 "b" [] [] - 1: COLON@11..13 ":" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@13..16 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@14..14 - 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] - 2: R_CURLY@16..17 "}" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@18..22 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@18..21 - 0: JS_IDENTIFIER_EXPRESSION@18..20 - 0: JS_REFERENCE_IDENTIFIER@18..20 - 0: IDENT@18..20 "a" [Newline("\n")] [] - 1: BANG@20..21 "!" [] [] - 1: SEMICOLON@21..22 ";" [] [] - 2: JS_FUNCTION_DECLARATION@22..41 - 0: (empty) - 1: FUNCTION_KW@22..32 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@32..36 - 0: IDENT@32..36 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@36..39 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_PARAMETER_LIST@37..37 - 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@39..41 - 0: L_CURLY@39..40 "{" [] [] - 1: JS_DIRECTIVE_LIST@40..40 - 2: JS_STATEMENT_LIST@40..40 - 3: R_CURLY@40..41 "}" [] [] - 3: JS_EXPRESSION_STATEMENT@41..49 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@41..49 - 0: JS_CALL_EXPRESSION@41..48 - 0: JS_IDENTIFIER_EXPRESSION@41..46 - 0: JS_REFERENCE_IDENTIFIER@41..46 - 0: IDENT@41..46 "test" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@46..48 - 0: L_PAREN@46..47 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@47..47 - 2: R_PAREN@47..48 ")" [] [] - 1: BANG@48..49 "!" [] [] - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@49..58 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@49..57 - 0: JS_STATIC_MEMBER_EXPRESSION@49..56 - 0: JS_STATIC_MEMBER_EXPRESSION@49..54 - 0: JS_IDENTIFIER_EXPRESSION@49..52 - 0: JS_REFERENCE_IDENTIFIER@49..52 - 0: IDENT@49..52 "a" [Newline("\n"), Whitespace("\t")] [] - 1: DOT@52..53 "." [] [] - 2: JS_NAME@53..54 - 0: IDENT@53..54 "b" [] [] - 1: DOT@54..55 "." [] [] - 2: JS_NAME@55..56 - 0: IDENT@55..56 "c" [] [] - 1: BANG@56..57 "!" [] [] - 1: SEMICOLON@57..58 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@58..67 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..66 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..65 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..64 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..63 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..62 - 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..61 - 0: JS_IDENTIFIER_EXPRESSION@58..60 - 0: JS_REFERENCE_IDENTIFIER@58..60 - 0: IDENT@58..60 "a" [Newline("\n")] [] - 1: BANG@60..61 "!" [] [] - 1: BANG@61..62 "!" [] [] - 1: BANG@62..63 "!" [] [] - 1: BANG@63..64 "!" [] [] - 1: BANG@64..65 "!" [] [] - 1: BANG@65..66 "!" [] [] - 1: SEMICOLON@66..67 ";" [] [] - 4: EOF@67..68 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast b/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast deleted file mode 100644 index e4283b6a4a29..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast +++ /dev/null @@ -1,160 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@5..6 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: TsNonNullAssertionAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@6..8 "a" [Newline("\n")] [], - }, - excl_token: BANG@8..10 "!" [] [Whitespace(" ")], - }, - operator_token: AMPEQ@10..13 "&=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..14 "2" [] [], - }, - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@20..22 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@26..27 "a" [] [], - }, - colon_token: COLON@27..29 ":" [] [Whitespace(" ")], - value: JsNullLiteralExpression { - value_token: NULL_KW@29..34 "null" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@34..35 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: TsNonNullAssertionAssignment { - assignment: JsStaticMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@36..38 "b" [Newline("\n")] [], - }, - }, - dot_token: DOT@38..39 "." [] [], - member: JsName { - value_token: IDENT@39..40 "a" [] [], - }, - }, - excl_token: BANG@40..42 "!" [] [Whitespace(" ")], - }, - operator_token: AMPEQ@42..45 "&=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@45..46 "5" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@46..47 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_VARIABLE_STATEMENT@0..6 - 0: JS_VARIABLE_DECLARATION@0..5 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..5 - 0: JS_VARIABLE_DECLARATOR@4..5 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@5..6 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@6..15 - 0: JS_ASSIGNMENT_EXPRESSION@6..14 - 0: TS_NON_NULL_ASSERTION_ASSIGNMENT@6..10 - 0: JS_IDENTIFIER_ASSIGNMENT@6..8 - 0: IDENT@6..8 "a" [Newline("\n")] [] - 1: BANG@8..10 "!" [] [Whitespace(" ")] - 1: AMPEQ@10..13 "&=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@13..14 - 0: JS_NUMBER_LITERAL@13..14 "2" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 2: JS_VARIABLE_STATEMENT@15..36 - 0: JS_VARIABLE_DECLARATION@15..35 - 0: (empty) - 1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@20..35 - 0: JS_VARIABLE_DECLARATOR@20..35 - 0: JS_IDENTIFIER_BINDING@20..22 - 0: IDENT@20..22 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@22..35 - 0: EQ@22..24 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@24..35 - 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@26..34 - 0: JS_PROPERTY_OBJECT_MEMBER@26..34 - 0: JS_LITERAL_MEMBER_NAME@26..27 - 0: IDENT@26..27 "a" [] [] - 1: COLON@27..29 ":" [] [Whitespace(" ")] - 2: JS_NULL_LITERAL_EXPRESSION@29..34 - 0: NULL_KW@29..34 "null" [] [Whitespace(" ")] - 2: R_CURLY@34..35 "}" [] [] - 1: SEMICOLON@35..36 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@36..46 - 0: JS_ASSIGNMENT_EXPRESSION@36..46 - 0: TS_NON_NULL_ASSERTION_ASSIGNMENT@36..42 - 0: JS_STATIC_MEMBER_ASSIGNMENT@36..40 - 0: JS_IDENTIFIER_EXPRESSION@36..38 - 0: JS_REFERENCE_IDENTIFIER@36..38 - 0: IDENT@36..38 "b" [Newline("\n")] [] - 1: DOT@38..39 "." [] [] - 2: JS_NAME@39..40 - 0: IDENT@39..40 "a" [] [] - 1: BANG@40..42 "!" [] [Whitespace(" ")] - 1: AMPEQ@42..45 "&=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@45..46 - 0: JS_NUMBER_LITERAL@45..46 "5" [] [] - 1: (empty) - 4: EOF@46..47 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_object_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_object_type.rast deleted file mode 100644 index 8573de5b9061..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_object_type.rast +++ /dev/null @@ -1,335 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@11..12 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@12..14 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@14..20 "string" [] [], - }, - }, - separator_token: COMMA@20..22 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@22..23 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@25..32 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@40..42 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@46..47 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@47..49 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@49..55 "string" [] [], - }, - }, - separator_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@57..58 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@58..60 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@60..67 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@67..68 "}" [] [], - }, - semicolon_token: SEMICOLON@68..69 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@75..77 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@77..79 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@79..81 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@81..82 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@82..84 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@84..90 "string" [] [], - }, - }, - separator_token: COMMA@90..92 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@92..93 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@93..95 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@95..101 "number" [] [], - }, - }, - separator_token: SEMICOLON@101..103 ";" [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@103..104 "c" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@104..106 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@106..113 "string" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@113..114 "}" [] [], - }, - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@121..123 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@123..125 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@125..126 "{" [] [], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@126..129 "a" [Newline("\n"), Whitespace("\t")] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@129..131 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@131..137 "string" [] [], - }, - }, - separator_token: missing (optional), - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@137..140 "b" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@140..142 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@142..148 "number" [] [], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@148..150 "}" [Newline("\n")] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@150..151 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..151 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..150 - 0: TS_TYPE_ALIAS_DECLARATION@0..34 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..33 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..32 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@11..22 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@11..12 - 0: IDENT@11..12 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@12..20 - 0: COLON@12..14 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@14..20 - 0: STRING_KW@14..20 "string" [] [] - 4: COMMA@20..22 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@22..32 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@22..23 - 0: IDENT@22..23 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@23..32 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@25..32 - 0: NUMBER_KW@25..32 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@32..33 "}" [] [] - 5: SEMICOLON@33..34 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@34..69 - 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@42..44 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@44..68 - 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@46..67 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@46..57 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@46..47 - 0: IDENT@46..47 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@47..55 - 0: COLON@47..49 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@49..55 - 0: STRING_KW@49..55 "string" [] [] - 4: SEMICOLON@55..57 ";" [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@57..67 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@57..58 - 0: IDENT@57..58 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@58..67 - 0: COLON@58..60 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@60..67 - 0: NUMBER_KW@60..67 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@67..68 "}" [] [] - 5: SEMICOLON@68..69 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@69..115 - 0: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@75..77 - 0: IDENT@75..77 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@77..79 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@79..114 - 0: L_CURLY@79..81 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@81..113 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@81..92 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@81..82 - 0: IDENT@81..82 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@82..90 - 0: COLON@82..84 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@84..90 - 0: STRING_KW@84..90 "string" [] [] - 4: COMMA@90..92 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@92..103 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@92..93 - 0: IDENT@92..93 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@93..101 - 0: COLON@93..95 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@95..101 - 0: NUMBER_KW@95..101 "number" [] [] - 4: SEMICOLON@101..103 ";" [] [Whitespace(" ")] - 2: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@103..113 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@103..104 - 0: IDENT@103..104 "c" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@104..113 - 0: COLON@104..106 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@106..113 - 0: STRING_KW@106..113 "string" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@113..114 "}" [] [] - 5: SEMICOLON@114..115 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@115..150 - 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@121..123 - 0: IDENT@121..123 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@123..125 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@125..150 - 0: L_CURLY@125..126 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@126..148 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@126..137 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@126..129 - 0: IDENT@126..129 "a" [Newline("\n"), Whitespace("\t")] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@129..137 - 0: COLON@129..131 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@131..137 - 0: STRING_KW@131..137 "string" [] [] - 4: (empty) - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@137..148 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@137..140 - 0: IDENT@137..140 "b" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@140..148 - 0: COLON@140..142 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@142..148 - 0: NUMBER_KW@142..148 "number" [] [] - 4: (empty) - 2: R_CURLY@148..150 "}" [Newline("\n")] [] - 5: (empty) - 4: EOF@150..151 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast b/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast deleted file mode 100644 index 658ceb6858e4..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast +++ /dev/null @@ -1,142 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1..2 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@2..3 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@3..5 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@5..6 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@6..7 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@7..8 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@10..13 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@13..14 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@14..15 "}" [] [], - }, - }, - r_paren_token: R_PAREN@15..16 ")" [] [], - }, - optional_chain_token: QUESTIONDOT@16..18 "?." [] [], - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@18..19 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@19..20 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@20..22 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@22..23 "B" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@23..24 ">" [] [], - }, - arguments: JsCallArguments { - l_paren_token: L_PAREN@24..25 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@25..26 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - ], - eof_token: EOF@27..28 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..28 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..27 - 0: JS_EXPRESSION_STATEMENT@0..27 - 0: JS_CALL_EXPRESSION@0..26 - 0: JS_PARENTHESIZED_EXPRESSION@0..16 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@1..15 - 0: (empty) - 1: TS_TYPE_PARAMETERS@1..7 - 0: L_ANGLE@1..2 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@2..6 - 0: TS_TYPE_PARAMETER@2..3 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2..2 - 1: TS_TYPE_PARAMETER_NAME@2..3 - 0: IDENT@2..3 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@3..5 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@5..6 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@5..5 - 1: TS_TYPE_PARAMETER_NAME@5..6 - 0: IDENT@5..6 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@6..7 ">" [] [] - 2: JS_PARAMETERS@7..10 - 0: L_PAREN@7..8 "(" [] [] - 1: JS_PARAMETER_LIST@8..8 - 2: R_PAREN@8..10 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@10..13 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@13..15 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_DIRECTIVE_LIST@14..14 - 2: JS_STATEMENT_LIST@14..14 - 3: R_CURLY@14..15 "}" [] [] - 2: R_PAREN@15..16 ")" [] [] - 1: QUESTIONDOT@16..18 "?." [] [] - 2: TS_TYPE_ARGUMENTS@18..24 - 0: L_ANGLE@18..19 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@19..23 - 0: TS_REFERENCE_TYPE@19..20 - 0: JS_REFERENCE_IDENTIFIER@19..20 - 0: IDENT@19..20 "A" [] [] - 1: (empty) - 1: COMMA@20..22 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@22..23 - 0: JS_REFERENCE_IDENTIFIER@22..23 - 0: IDENT@22..23 "B" [] [] - 1: (empty) - 2: R_ANGLE@23..24 ">" [] [] - 3: JS_CALL_ARGUMENTS@24..26 - 0: L_PAREN@24..25 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@25..25 - 2: R_PAREN@25..26 ")" [] [] - 1: SEMICOLON@26..27 ";" [] [] - 4: EOF@27..28 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.rast deleted file mode 100644 index 897b117190ad..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.rast +++ /dev/null @@ -1,82 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@10..14 "test" [] [], - }, - question_mark_token: QUESTION@14..15 "?" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@15..16 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@18..19 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@19..21 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@21..22 "}" [] [], - }, - ], - eof_token: EOF@22..23 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..23 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..22 - 0: JS_CLASS_DECLARATION@0..22 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..21 - 0: JS_METHOD_CLASS_MEMBER@10..21 - 0: JS_METHOD_MODIFIER_LIST@10..10 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@10..14 - 0: IDENT@10..14 "test" [] [] - 4: QUESTION@14..15 "?" [] [] - 5: (empty) - 6: JS_PARAMETERS@15..18 - 0: L_PAREN@15..16 "(" [] [] - 1: JS_PARAMETER_LIST@16..16 - 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@18..21 - 0: L_CURLY@18..19 "{" [] [] - 1: JS_DIRECTIVE_LIST@19..19 - 2: JS_STATEMENT_LIST@19..19 - 3: R_CURLY@19..21 "}" [] [Whitespace(" ")] - 9: R_CURLY@21..22 "}" [] [] - 4: EOF@22..23 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.rast b/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.rast deleted file mode 100644 index 4b5130716c95..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.rast +++ /dev/null @@ -1,223 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@18..20 "A" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@20..21 "{" [] [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@21..31 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - export_clause: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@31..37 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@37..41 "Ajv" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@41..42 "{" [] [], - members: JsClassMemberList [ - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@42..57 "errorsText" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@57..58 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@58..64 "errors" [] [], - }, - question_mark_token: QUESTION@64..65 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@65..67 ":" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsArrayType { - element_type: TsStringType { - string_token: STRING_KW@67..73 "string" [] [], - }, - l_brack_token: L_BRACK@73..74 "[" [] [], - r_brack_token: R_BRACK@74..76 "]" [] [Whitespace(" ")], - }, - PIPE@76..78 "|" [] [Whitespace(" ")], - TsNullLiteralType { - literal_token: NULL_KW@78..83 "null" [] [Whitespace(" ")], - }, - PIPE@83..85 "|" [] [Whitespace(" ")], - TsUndefinedType { - undefined_token: UNDEFINED_KW@85..94 "undefined" [] [], - }, - ], - }, - }, - initializer: missing (optional), - }, - COMMA@94..96 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsObjectBindingPattern { - l_curly_token: L_CURLY@96..98 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@98..107 "separator" [] [], - }, - init: missing (optional), - }, - COMMA@107..109 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@109..117 "dataVar" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@117..118 "}" [] [], - }, - question_mark_token: QUESTION@118..119 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@119..121 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@121..138 "ErrorsTextOptions" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@138..139 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@139..141 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@141..147 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@147..148 ";" [] [], - }, - ], - r_curly_token: R_CURLY@148..152 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@152..154 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@154..155 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..155 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..154 - 0: TS_DECLARE_STATEMENT@0..154 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@8..154 - 0: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@18..20 - 0: IDENT@18..20 "A" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@20..154 - 0: L_CURLY@20..21 "{" [] [] - 1: JS_MODULE_ITEM_LIST@21..152 - 0: JS_EXPORT@21..152 - 0: JS_DECORATOR_LIST@21..21 - 1: EXPORT_KW@21..31 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_CLASS_DECLARATION@31..152 - 0: JS_DECORATOR_LIST@31..31 - 1: (empty) - 2: CLASS_KW@31..37 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@37..41 - 0: IDENT@37..41 "Ajv" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@41..42 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@42..148 - 0: TS_METHOD_SIGNATURE_CLASS_MEMBER@42..148 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@42..42 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@42..57 - 0: IDENT@42..57 "errorsText" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@57..139 - 0: L_PAREN@57..58 "(" [] [] - 1: JS_PARAMETER_LIST@58..138 - 0: JS_FORMAL_PARAMETER@58..94 - 0: JS_DECORATOR_LIST@58..58 - 1: JS_IDENTIFIER_BINDING@58..64 - 0: IDENT@58..64 "errors" [] [] - 2: QUESTION@64..65 "?" [] [] - 3: TS_TYPE_ANNOTATION@65..94 - 0: COLON@65..67 ":" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@67..94 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@67..94 - 0: TS_ARRAY_TYPE@67..76 - 0: TS_STRING_TYPE@67..73 - 0: STRING_KW@67..73 "string" [] [] - 1: L_BRACK@73..74 "[" [] [] - 2: R_BRACK@74..76 "]" [] [Whitespace(" ")] - 1: PIPE@76..78 "|" [] [Whitespace(" ")] - 2: TS_NULL_LITERAL_TYPE@78..83 - 0: NULL_KW@78..83 "null" [] [Whitespace(" ")] - 3: PIPE@83..85 "|" [] [Whitespace(" ")] - 4: TS_UNDEFINED_TYPE@85..94 - 0: UNDEFINED_KW@85..94 "undefined" [] [] - 4: (empty) - 1: COMMA@94..96 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@96..138 - 0: JS_DECORATOR_LIST@96..96 - 1: JS_OBJECT_BINDING_PATTERN@96..118 - 0: L_CURLY@96..98 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@98..117 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@98..107 - 0: JS_IDENTIFIER_BINDING@98..107 - 0: IDENT@98..107 "separator" [] [] - 1: (empty) - 1: COMMA@107..109 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@109..117 - 0: JS_IDENTIFIER_BINDING@109..117 - 0: IDENT@109..117 "dataVar" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@117..118 "}" [] [] - 2: QUESTION@118..119 "?" [] [] - 3: TS_TYPE_ANNOTATION@119..138 - 0: COLON@119..121 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@121..138 - 0: JS_REFERENCE_IDENTIFIER@121..138 - 0: IDENT@121..138 "ErrorsTextOptions" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@138..139 ")" [] [] - 6: TS_RETURN_TYPE_ANNOTATION@139..147 - 0: COLON@139..141 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@141..147 - 0: STRING_KW@141..147 "string" [] [] - 7: SEMICOLON@147..148 ";" [] [] - 9: R_CURLY@148..152 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@152..154 "}" [Newline("\n")] [] - 4: EOF@154..155 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.rast deleted file mode 100644 index 7a85ce3d5065..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.rast +++ /dev/null @@ -1,43 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsParenthesizedType { - l_paren_token: L_PAREN@9..10 "(" [] [], - ty: TsStringType { - string_token: STRING_KW@10..16 "string" [] [], - }, - r_paren_token: R_PAREN@16..17 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@17..18 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..18 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..17 - 0: TS_TYPE_ALIAS_DECLARATION@0..17 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_PARENTHESIZED_TYPE@9..17 - 0: L_PAREN@9..10 "(" [] [] - 1: TS_STRING_TYPE@10..16 - 0: STRING_KW@10..16 "string" [] [] - 2: R_PAREN@16..17 ")" [] [] - 5: (empty) - 4: EOF@17..18 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.rast deleted file mode 100644 index 0e779f2756c2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.rast +++ /dev/null @@ -1,246 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@9..12 "any" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@12..18 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@18..20 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@20..22 "=" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@22..28 "number" [] [], - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@35..37 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@37..39 "=" [] [Whitespace(" ")], - ty: TsNonPrimitiveType { - object_token: OBJECT_KW@39..45 "object" [] [], - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@46..52 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@52..54 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@54..56 "=" [] [Whitespace(" ")], - ty: TsBooleanType { - boolean_token: BOOLEAN_KW@56..63 "boolean" [] [], - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@70..72 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@72..74 "=" [] [Whitespace(" ")], - ty: TsBigintType { - bigint_token: BIGINT_KW@74..80 "bigint" [] [], - }, - semicolon_token: SEMICOLON@80..81 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@87..89 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@89..91 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@91..97 "string" [] [], - }, - semicolon_token: SEMICOLON@97..98 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@98..104 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@104..106 "G" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@106..108 "=" [] [Whitespace(" ")], - ty: TsSymbolType { - symbol_token: SYMBOL_KW@108..114 "symbol" [] [], - }, - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@121..123 "H" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@123..125 "=" [] [Whitespace(" ")], - ty: TsVoidType { - void_token: VOID_KW@125..129 "void" [] [], - }, - semicolon_token: SEMICOLON@129..130 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@136..138 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@138..140 "=" [] [Whitespace(" ")], - ty: TsUndefinedType { - undefined_token: UNDEFINED_KW@140..149 "undefined" [] [], - }, - semicolon_token: SEMICOLON@149..150 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@150..156 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@156..158 "J" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@158..160 "=" [] [Whitespace(" ")], - ty: TsNullLiteralType { - literal_token: NULL_KW@160..164 "null" [] [], - }, - semicolon_token: SEMICOLON@164..165 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@165..171 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@171..173 "K" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@173..175 "=" [] [Whitespace(" ")], - ty: TsNeverType { - never_token: NEVER_KW@175..180 "never" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@180..181 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..181 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..180 - 0: TS_TYPE_ALIAS_DECLARATION@0..12 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_ANY_TYPE@9..12 - 0: ANY_KW@9..12 "any" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@12..29 - 0: TYPE_KW@12..18 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@18..20 - 0: IDENT@18..20 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@20..22 "=" [] [Whitespace(" ")] - 4: TS_NUMBER_TYPE@22..28 - 0: NUMBER_KW@22..28 "number" [] [] - 5: SEMICOLON@28..29 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@29..46 - 0: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@35..37 - 0: IDENT@35..37 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@37..39 "=" [] [Whitespace(" ")] - 4: TS_NON_PRIMITIVE_TYPE@39..45 - 0: OBJECT_KW@39..45 "object" [] [] - 5: SEMICOLON@45..46 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@46..64 - 0: TYPE_KW@46..52 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@52..54 - 0: IDENT@52..54 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@54..56 "=" [] [Whitespace(" ")] - 4: TS_BOOLEAN_TYPE@56..63 - 0: BOOLEAN_KW@56..63 "boolean" [] [] - 5: SEMICOLON@63..64 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@64..81 - 0: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@70..72 - 0: IDENT@70..72 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@72..74 "=" [] [Whitespace(" ")] - 4: TS_BIGINT_TYPE@74..80 - 0: BIGINT_KW@74..80 "bigint" [] [] - 5: SEMICOLON@80..81 ";" [] [] - 5: TS_TYPE_ALIAS_DECLARATION@81..98 - 0: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@87..89 - 0: IDENT@87..89 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@89..91 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@91..97 - 0: STRING_KW@91..97 "string" [] [] - 5: SEMICOLON@97..98 ";" [] [] - 6: TS_TYPE_ALIAS_DECLARATION@98..115 - 0: TYPE_KW@98..104 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@104..106 - 0: IDENT@104..106 "G" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@106..108 "=" [] [Whitespace(" ")] - 4: TS_SYMBOL_TYPE@108..114 - 0: SYMBOL_KW@108..114 "symbol" [] [] - 5: SEMICOLON@114..115 ";" [] [] - 7: TS_TYPE_ALIAS_DECLARATION@115..130 - 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@121..123 - 0: IDENT@121..123 "H" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@123..125 "=" [] [Whitespace(" ")] - 4: TS_VOID_TYPE@125..129 - 0: VOID_KW@125..129 "void" [] [] - 5: SEMICOLON@129..130 ";" [] [] - 8: TS_TYPE_ALIAS_DECLARATION@130..150 - 0: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@136..138 - 0: IDENT@136..138 "I" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@138..140 "=" [] [Whitespace(" ")] - 4: TS_UNDEFINED_TYPE@140..149 - 0: UNDEFINED_KW@140..149 "undefined" [] [] - 5: SEMICOLON@149..150 ";" [] [] - 9: TS_TYPE_ALIAS_DECLARATION@150..165 - 0: TYPE_KW@150..156 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@156..158 - 0: IDENT@156..158 "J" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@158..160 "=" [] [Whitespace(" ")] - 4: TS_NULL_LITERAL_TYPE@160..164 - 0: NULL_KW@160..164 "null" [] [] - 5: SEMICOLON@164..165 ";" [] [] - 10: TS_TYPE_ALIAS_DECLARATION@165..180 - 0: TYPE_KW@165..171 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@171..173 - 0: IDENT@171..173 "K" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@173..175 "=" [] [Whitespace(" ")] - 4: TS_NEVER_TYPE@175..180 - 0: NEVER_KW@175..180 "never" [] [] - 5: (empty) - 4: EOF@180..181 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast b/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast deleted file mode 100644 index f4bd3f0c1b8e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast +++ /dev/null @@ -1,100 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..13 "set" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@15..21 "String" [] [], - }, - type_arguments: missing (optional), - }, - }, - value: missing (optional), - semicolon_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], - }, - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsLiteralMemberName { - value: IDENT@23..26 "get" [] [], - }, - property_annotation: TsTypeAnnotation { - colon_token: COLON@26..28 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@28..35 "Number" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - value: missing (optional), - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@35..36 "}" [] [], - }, - ], - eof_token: EOF@36..37 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..37 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..36 - 0: JS_CLASS_DECLARATION@0..36 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..35 - 0: JS_PROPERTY_CLASS_MEMBER@10..23 - 0: JS_PROPERTY_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..13 - 0: IDENT@10..13 "set" [] [] - 2: TS_TYPE_ANNOTATION@13..21 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@15..21 - 0: JS_REFERENCE_IDENTIFIER@15..21 - 0: IDENT@15..21 "String" [] [] - 1: (empty) - 3: (empty) - 4: SEMICOLON@21..23 ";" [] [Whitespace(" ")] - 1: JS_PROPERTY_CLASS_MEMBER@23..35 - 0: JS_PROPERTY_MODIFIER_LIST@23..23 - 1: JS_LITERAL_MEMBER_NAME@23..26 - 0: IDENT@23..26 "get" [] [] - 2: TS_TYPE_ANNOTATION@26..35 - 0: COLON@26..28 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@28..35 - 0: JS_REFERENCE_IDENTIFIER@28..35 - 0: IDENT@28..35 "Number" [] [Whitespace(" ")] - 1: (empty) - 3: (empty) - 4: (empty) - 9: R_CURLY@35..36 "}" [] [] - 4: EOF@36..37 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast deleted file mode 100644 index 076d49985a0b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast +++ /dev/null @@ -1,666 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@11..12 "a" [] [], - }, - optional_token: QUESTION@12..13 "?" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@13..15 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@15..21 "string" [] [], - }, - }, - separator_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], - }, - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@23..24 "b" [] [], - }, - optional_token: QUESTION@24..25 "?" [] [], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@25..26 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@26..27 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@27..29 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@29..36 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@36..37 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@43..45 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@45..47 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@47..49 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@49..50 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@50..52 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@52..58 "string" [] [], - }, - }, - separator_token: COMMA@58..60 "," [] [Whitespace(" ")], - }, - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@60..61 "b" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@61..62 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@62..63 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@63..65 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@65..72 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@72..73 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@73..79 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@79..81 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@81..83 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@83..85 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@85..86 "m" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@86..87 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@87..88 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@88..90 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@90..96 "string" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@96..98 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@98..99 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@99..101 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@101..107 "number" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@107..109 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@109..110 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@110..112 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@112..118 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@118..119 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@119..121 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@121..125 "any" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@126..132 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@132..134 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@134..136 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@136..138 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@138..146 "readonly" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@146..148 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@148..154 "string" [] [], - }, - }, - separator_token: COMMA@154..156 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: READONLY_KW@156..165 "readonly" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@165..166 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@166..168 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@168..175 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@175..176 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@176..182 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@182..184 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@184..186 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@186..188 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@188..189 "m" [] [], - }, - optional_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@189..190 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@190..191 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@191..193 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@193..194 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@194..195 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@195..196 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@196..197 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@197..199 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@199..200 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - COMMA@200..202 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@202..203 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@203..205 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@205..206 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@206..207 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@207..209 ":" [] [Whitespace(" ")], - ty: TsNeverType { - never_token: NEVER_KW@209..215 "never" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@215..216 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@222..224 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@224..226 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@226..228 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@228..229 "m" [] [], - }, - optional_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@229..230 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@230..236 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@236..237 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@237..238 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@238..239 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@239..240 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@240..242 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@242..243 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@243..244 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@244..246 ":" [] [Whitespace(" ")], - ty: TsNeverType { - never_token: NEVER_KW@246..252 "never" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@252..253 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@253..254 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..254 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..253 - 0: TS_TYPE_ALIAS_DECLARATION@0..37 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..37 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..36 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@11..23 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@11..12 - 0: IDENT@11..12 "a" [] [] - 2: QUESTION@12..13 "?" [] [] - 3: TS_TYPE_ANNOTATION@13..21 - 0: COLON@13..15 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@15..21 - 0: STRING_KW@15..21 "string" [] [] - 4: SEMICOLON@21..23 ";" [] [Whitespace(" ")] - 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@23..36 - 0: JS_LITERAL_MEMBER_NAME@23..24 - 0: IDENT@23..24 "b" [] [] - 1: QUESTION@24..25 "?" [] [] - 2: (empty) - 3: JS_PARAMETERS@25..27 - 0: L_PAREN@25..26 "(" [] [] - 1: JS_PARAMETER_LIST@26..26 - 2: R_PAREN@26..27 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@27..36 - 0: COLON@27..29 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@29..36 - 0: NUMBER_KW@29..36 "number" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@36..37 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@37..73 - 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@43..45 - 0: IDENT@43..45 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@45..47 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@47..73 - 0: L_CURLY@47..49 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@49..72 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@49..60 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@49..50 - 0: IDENT@49..50 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@50..58 - 0: COLON@50..52 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@52..58 - 0: STRING_KW@52..58 "string" [] [] - 4: COMMA@58..60 "," [] [Whitespace(" ")] - 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@60..72 - 0: JS_LITERAL_MEMBER_NAME@60..61 - 0: IDENT@60..61 "b" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@61..63 - 0: L_PAREN@61..62 "(" [] [] - 1: JS_PARAMETER_LIST@62..62 - 2: R_PAREN@62..63 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@63..72 - 0: COLON@63..65 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@65..72 - 0: NUMBER_KW@65..72 "number" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@72..73 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@73..126 - 0: TYPE_KW@73..79 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@79..81 - 0: IDENT@79..81 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@81..83 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@83..126 - 0: L_CURLY@83..85 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@85..125 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@85..125 - 0: JS_LITERAL_MEMBER_NAME@85..86 - 0: IDENT@85..86 "m" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@86..119 - 0: L_PAREN@86..87 "(" [] [] - 1: JS_PARAMETER_LIST@87..118 - 0: JS_FORMAL_PARAMETER@87..96 - 0: JS_DECORATOR_LIST@87..87 - 1: JS_IDENTIFIER_BINDING@87..88 - 0: IDENT@87..88 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@88..96 - 0: COLON@88..90 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@90..96 - 0: STRING_KW@90..96 "string" [] [] - 4: (empty) - 1: COMMA@96..98 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@98..107 - 0: JS_DECORATOR_LIST@98..98 - 1: JS_IDENTIFIER_BINDING@98..99 - 0: IDENT@98..99 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@99..107 - 0: COLON@99..101 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@101..107 - 0: NUMBER_KW@101..107 "number" [] [] - 4: (empty) - 3: COMMA@107..109 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@109..118 - 0: JS_DECORATOR_LIST@109..109 - 1: JS_IDENTIFIER_BINDING@109..110 - 0: IDENT@109..110 "c" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@110..118 - 0: COLON@110..112 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@112..118 - 0: STRING_KW@112..118 "string" [] [] - 4: (empty) - 2: R_PAREN@118..119 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@119..125 - 0: COLON@119..121 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@121..125 - 0: ANY_KW@121..125 "any" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@125..126 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@126..176 - 0: TYPE_KW@126..132 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@132..134 - 0: IDENT@132..134 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@134..136 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@136..176 - 0: L_CURLY@136..138 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@138..175 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@138..156 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@138..146 - 0: IDENT@138..146 "readonly" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@146..154 - 0: COLON@146..148 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@148..154 - 0: STRING_KW@148..154 "string" [] [] - 4: COMMA@154..156 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@156..175 - 0: READONLY_KW@156..165 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@165..166 - 0: IDENT@165..166 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@166..175 - 0: COLON@166..168 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@168..175 - 0: NUMBER_KW@168..175 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@175..176 "}" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@176..216 - 0: TYPE_KW@176..182 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@182..184 - 0: IDENT@182..184 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@184..186 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@186..216 - 0: L_CURLY@186..188 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@188..215 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@188..215 - 0: JS_LITERAL_MEMBER_NAME@188..189 - 0: IDENT@188..189 "m" [] [] - 1: (empty) - 2: TS_TYPE_PARAMETERS@189..195 - 0: L_ANGLE@189..190 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@190..194 - 0: TS_TYPE_PARAMETER@190..191 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@190..190 - 1: TS_TYPE_PARAMETER_NAME@190..191 - 0: IDENT@190..191 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@191..193 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@193..194 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@193..193 - 1: TS_TYPE_PARAMETER_NAME@193..194 - 0: IDENT@193..194 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@194..195 ">" [] [] - 3: JS_PARAMETERS@195..207 - 0: L_PAREN@195..196 "(" [] [] - 1: JS_PARAMETER_LIST@196..206 - 0: JS_FORMAL_PARAMETER@196..200 - 0: JS_DECORATOR_LIST@196..196 - 1: JS_IDENTIFIER_BINDING@196..197 - 0: IDENT@196..197 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@197..200 - 0: COLON@197..199 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@199..200 - 0: JS_REFERENCE_IDENTIFIER@199..200 - 0: IDENT@199..200 "A" [] [] - 1: (empty) - 4: (empty) - 1: COMMA@200..202 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@202..206 - 0: JS_DECORATOR_LIST@202..202 - 1: JS_IDENTIFIER_BINDING@202..203 - 0: IDENT@202..203 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@203..206 - 0: COLON@203..205 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@205..206 - 0: JS_REFERENCE_IDENTIFIER@205..206 - 0: IDENT@205..206 "B" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@206..207 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@207..215 - 0: COLON@207..209 ":" [] [Whitespace(" ")] - 1: TS_NEVER_TYPE@209..215 - 0: NEVER_KW@209..215 "never" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@215..216 "}" [] [] - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@216..253 - 0: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@222..224 - 0: IDENT@222..224 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@224..226 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@226..253 - 0: L_CURLY@226..228 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@228..252 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@228..252 - 0: JS_LITERAL_MEMBER_NAME@228..229 - 0: IDENT@228..229 "m" [] [] - 1: (empty) - 2: TS_TYPE_PARAMETERS@229..238 - 0: L_ANGLE@229..230 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@230..237 - 0: TS_TYPE_PARAMETER@230..237 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@230..236 - 0: TS_CONST_MODIFIER@230..236 - 0: CONST_KW@230..236 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@236..237 - 0: IDENT@236..237 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@237..238 ">" [] [] - 3: JS_PARAMETERS@238..244 - 0: L_PAREN@238..239 "(" [] [] - 1: JS_PARAMETER_LIST@239..243 - 0: JS_FORMAL_PARAMETER@239..243 - 0: JS_DECORATOR_LIST@239..239 - 1: JS_IDENTIFIER_BINDING@239..240 - 0: IDENT@239..240 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@240..243 - 0: COLON@240..242 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@242..243 - 0: JS_REFERENCE_IDENTIFIER@242..243 - 0: IDENT@242..243 "A" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@243..244 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@244..252 - 0: COLON@244..246 ":" [] [Whitespace(" ")] - 1: TS_NEVER_TYPE@246..252 - 0: NEVER_KW@246..252 "never" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@252..253 "}" [] [] - 5: (empty) - 4: EOF@253..254 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.rast b/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.rast deleted file mode 100644 index 3a1e34c8fa54..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.rast +++ /dev/null @@ -1,527 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@10..21 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@21..22 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@30..31 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - COMMA@31..33 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@33..43 "protected" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@43..44 "y" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - COMMA@44..46 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@46..53 "public" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@53..54 "z" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@56..57 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@57..59 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@59..60 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@60..67 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@67..69 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@69..71 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@71..82 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@82..83 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@83..92 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@92..93 "w" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - COMMA@93..95 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@95..103 "private" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@103..112 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@112..113 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - COMMA@113..115 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PROTECTED_KW@115..125 "protected" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@125..134 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@134..135 "y" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - COMMA@135..137 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PUBLIC_KW@137..144 "public" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@144..153 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@153..154 "z" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - ], - r_paren_token: R_PAREN@154..156 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@156..157 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@157..159 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@159..160 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@167..169 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@169..171 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsConstructorClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@171..182 "constructor" [] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@182..183 "(" [] [], - parameters: JsConstructorParameterList [ - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@183..191 "private" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@191..192 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@192..194 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@194..200 "string" [] [], - }, - }, - initializer: missing (optional), - }, - }, - COMMA@200..202 "," [] [Whitespace(" ")], - TsPropertyParameter { - decorators: JsDecoratorList [], - modifiers: TsPropertyParameterModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@202..211 "readonly" [] [Whitespace(" ")], - }, - ], - formal_parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@211..212 "y" [] [], - }, - question_mark_token: QUESTION@212..213 "?" [] [], - type_annotation: missing (optional), - initializer: missing (optional), - }, - }, - COMMA@213..215 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@215..217 "z" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@217..219 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@219..228 "\"default\"" [] [], - }, - }, - }, - COMMA@228..230 "," [] [Whitespace(" ")], - JsRestParameter { - decorators: JsDecoratorList [], - dotdotdot_token: DOT3@230..233 "..." [] [], - binding: JsIdentifierBinding { - name_token: IDENT@233..237 "rest" [] [], - }, - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@237..239 ")" [] [Whitespace(" ")], - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@239..240 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@240..242 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@242..243 "}" [] [], - }, - ], - eof_token: EOF@243..244 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..244 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..243 - 0: JS_CLASS_DECLARATION@0..60 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@10..59 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..59 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 - 1: JS_LITERAL_MEMBER_NAME@10..21 - 0: IDENT@10..21 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@21..56 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..54 - 0: TS_PROPERTY_PARAMETER@22..31 - 0: JS_DECORATOR_LIST@22..22 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..30 - 0: TS_ACCESSIBILITY_MODIFIER@22..30 - 0: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@30..31 - 0: JS_DECORATOR_LIST@30..30 - 1: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@31..33 "," [] [Whitespace(" ")] - 2: TS_PROPERTY_PARAMETER@33..44 - 0: JS_DECORATOR_LIST@33..33 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@33..43 - 0: TS_ACCESSIBILITY_MODIFIER@33..43 - 0: PROTECTED_KW@33..43 "protected" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@43..44 - 0: JS_DECORATOR_LIST@43..43 - 1: JS_IDENTIFIER_BINDING@43..44 - 0: IDENT@43..44 "y" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@44..46 "," [] [Whitespace(" ")] - 4: TS_PROPERTY_PARAMETER@46..54 - 0: JS_DECORATOR_LIST@46..46 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@46..53 - 0: TS_ACCESSIBILITY_MODIFIER@46..53 - 0: PUBLIC_KW@46..53 "public" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@53..54 - 0: JS_DECORATOR_LIST@53..53 - 1: JS_IDENTIFIER_BINDING@53..54 - 0: IDENT@53..54 "z" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@56..59 - 0: L_CURLY@56..57 "{" [] [] - 1: JS_DIRECTIVE_LIST@57..57 - 2: JS_STATEMENT_LIST@57..57 - 3: R_CURLY@57..59 "}" [] [Whitespace(" ")] - 9: R_CURLY@59..60 "}" [] [] - 1: JS_CLASS_DECLARATION@60..160 - 0: JS_DECORATOR_LIST@60..60 - 1: (empty) - 2: CLASS_KW@60..67 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@67..69 - 0: IDENT@67..69 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@69..71 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@71..159 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@71..159 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@71..71 - 1: JS_LITERAL_MEMBER_NAME@71..82 - 0: IDENT@71..82 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@82..156 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@83..154 - 0: TS_PROPERTY_PARAMETER@83..93 - 0: JS_DECORATOR_LIST@83..83 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@83..92 - 0: TS_READONLY_MODIFIER@83..92 - 0: READONLY_KW@83..92 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@92..93 - 0: JS_DECORATOR_LIST@92..92 - 1: JS_IDENTIFIER_BINDING@92..93 - 0: IDENT@92..93 "w" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@93..95 "," [] [Whitespace(" ")] - 2: TS_PROPERTY_PARAMETER@95..113 - 0: JS_DECORATOR_LIST@95..95 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@95..112 - 0: TS_ACCESSIBILITY_MODIFIER@95..103 - 0: PRIVATE_KW@95..103 "private" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@103..112 - 0: READONLY_KW@103..112 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@112..113 - 0: JS_DECORATOR_LIST@112..112 - 1: JS_IDENTIFIER_BINDING@112..113 - 0: IDENT@112..113 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 3: COMMA@113..115 "," [] [Whitespace(" ")] - 4: TS_PROPERTY_PARAMETER@115..135 - 0: JS_DECORATOR_LIST@115..115 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@115..134 - 0: TS_ACCESSIBILITY_MODIFIER@115..125 - 0: PROTECTED_KW@115..125 "protected" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@125..134 - 0: READONLY_KW@125..134 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@134..135 - 0: JS_DECORATOR_LIST@134..134 - 1: JS_IDENTIFIER_BINDING@134..135 - 0: IDENT@134..135 "y" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: COMMA@135..137 "," [] [Whitespace(" ")] - 6: TS_PROPERTY_PARAMETER@137..154 - 0: JS_DECORATOR_LIST@137..137 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@137..153 - 0: TS_ACCESSIBILITY_MODIFIER@137..144 - 0: PUBLIC_KW@137..144 "public" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@144..153 - 0: READONLY_KW@144..153 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@153..154 - 0: JS_DECORATOR_LIST@153..153 - 1: JS_IDENTIFIER_BINDING@153..154 - 0: IDENT@153..154 "z" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@154..156 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@156..159 - 0: L_CURLY@156..157 "{" [] [] - 1: JS_DIRECTIVE_LIST@157..157 - 2: JS_STATEMENT_LIST@157..157 - 3: R_CURLY@157..159 "}" [] [Whitespace(" ")] - 9: R_CURLY@159..160 "}" [] [] - 2: JS_CLASS_DECLARATION@160..243 - 0: JS_DECORATOR_LIST@160..160 - 1: (empty) - 2: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@167..169 - 0: IDENT@167..169 "C" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@169..171 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@171..242 - 0: JS_CONSTRUCTOR_CLASS_MEMBER@171..242 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@171..171 - 1: JS_LITERAL_MEMBER_NAME@171..182 - 0: IDENT@171..182 "constructor" [] [] - 2: JS_CONSTRUCTOR_PARAMETERS@182..239 - 0: L_PAREN@182..183 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@183..237 - 0: TS_PROPERTY_PARAMETER@183..200 - 0: JS_DECORATOR_LIST@183..183 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@183..191 - 0: TS_ACCESSIBILITY_MODIFIER@183..191 - 0: PRIVATE_KW@183..191 "private" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@191..200 - 0: JS_DECORATOR_LIST@191..191 - 1: JS_IDENTIFIER_BINDING@191..192 - 0: IDENT@191..192 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@192..200 - 0: COLON@192..194 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@194..200 - 0: STRING_KW@194..200 "string" [] [] - 4: (empty) - 1: COMMA@200..202 "," [] [Whitespace(" ")] - 2: TS_PROPERTY_PARAMETER@202..213 - 0: JS_DECORATOR_LIST@202..202 - 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@202..211 - 0: TS_READONLY_MODIFIER@202..211 - 0: READONLY_KW@202..211 "readonly" [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@211..213 - 0: JS_DECORATOR_LIST@211..211 - 1: JS_IDENTIFIER_BINDING@211..212 - 0: IDENT@211..212 "y" [] [] - 2: QUESTION@212..213 "?" [] [] - 3: (empty) - 4: (empty) - 3: COMMA@213..215 "," [] [Whitespace(" ")] - 4: JS_FORMAL_PARAMETER@215..228 - 0: JS_DECORATOR_LIST@215..215 - 1: JS_IDENTIFIER_BINDING@215..217 - 0: IDENT@215..217 "z" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: JS_INITIALIZER_CLAUSE@217..228 - 0: EQ@217..219 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@219..228 - 0: JS_STRING_LITERAL@219..228 "\"default\"" [] [] - 5: COMMA@228..230 "," [] [Whitespace(" ")] - 6: JS_REST_PARAMETER@230..237 - 0: JS_DECORATOR_LIST@230..230 - 1: DOT3@230..233 "..." [] [] - 2: JS_IDENTIFIER_BINDING@233..237 - 0: IDENT@233..237 "rest" [] [] - 3: (empty) - 2: R_PAREN@237..239 ")" [] [Whitespace(" ")] - 3: JS_FUNCTION_BODY@239..242 - 0: L_CURLY@239..240 "{" [] [] - 1: JS_DIRECTIVE_LIST@240..240 - 2: JS_STATEMENT_LIST@240..240 - 3: R_CURLY@240..242 "}" [] [Whitespace(" ")] - 9: R_CURLY@242..243 "}" [] [] - 4: EOF@243..244 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast b/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast deleted file mode 100644 index 84ea57a3d423..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast +++ /dev/null @@ -1,407 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..16 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsReadonlyModifier { - modifier_token: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@27..32 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@32..34 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@34..40 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@40..42 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@42..43 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@50..52 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@52..54 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@54..62 "declare" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@71..76 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@76..78 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@78..84 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@84..86 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@86..87 "}" [] [], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@87..96 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@96..102 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@102..104 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@104..106 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@106..114 "private" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@114..123 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@123..128 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@128..130 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@130..136 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@136..138 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@138..139 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@146..148 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@148..150 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@150..158 "declare" [] [Whitespace(" ")], - }, - TsAccessibilityModifier { - modifier_token: PRIVATE_KW@158..166 "private" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@166..175 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@175..180 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@180..182 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@182..188 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@188..190 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@190..191 "}" [] [], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@191..200 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@200..206 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@206..208 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@208..210 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - JsStaticModifier { - modifier_token: STATIC_KW@210..217 "static" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@217..226 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@226..231 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@231..233 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@233..239 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@239..241 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@241..242 "}" [] [], - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@242..249 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@249..251 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@251..253 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - TsInitializedPropertySignatureClassMember { - modifiers: TsPropertySignatureModifierList [ - TsDeclareModifier { - modifier_token: DECLARE_KW@253..261 "declare" [] [Whitespace(" ")], - }, - JsStaticModifier { - modifier_token: STATIC_KW@261..268 "static" [] [Whitespace(" ")], - }, - TsReadonlyModifier { - modifier_token: READONLY_KW@268..277 "readonly" [] [Whitespace(" ")], - }, - ], - name: JsLiteralMemberName { - value: IDENT@277..282 "prop" [] [Whitespace(" ")], - }, - question_mark_token: missing (optional), - value: JsInitializerClause { - eq_token: EQ@282..284 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@284..290 "\"test\"" [] [], - }, - }, - semicolon_token: SEMICOLON@290..292 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@292..293 "}" [] [], - }, - ], - eof_token: EOF@293..294 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..294 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..293 - 0: TS_DECLARE_STATEMENT@0..43 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..43 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..16 - 0: IDENT@14..16 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..42 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@18..42 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..27 - 0: TS_READONLY_MODIFIER@18..27 - 0: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@27..32 - 0: IDENT@27..32 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@32..40 - 0: EQ@32..34 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@34..40 - 0: JS_STRING_LITERAL@34..40 "\"test\"" [] [] - 4: SEMICOLON@40..42 ";" [] [Whitespace(" ")] - 9: R_CURLY@42..43 "}" [] [] - 1: JS_CLASS_DECLARATION@43..87 - 0: JS_DECORATOR_LIST@43..43 - 1: (empty) - 2: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@50..52 - 0: IDENT@50..52 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@52..54 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@54..86 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@54..86 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@54..71 - 0: TS_DECLARE_MODIFIER@54..62 - 0: DECLARE_KW@54..62 "declare" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@62..71 - 0: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@71..76 - 0: IDENT@71..76 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@76..84 - 0: EQ@76..78 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@78..84 - 0: JS_STRING_LITERAL@78..84 "\"test\"" [] [] - 4: SEMICOLON@84..86 ";" [] [Whitespace(" ")] - 9: R_CURLY@86..87 "}" [] [] - 2: TS_DECLARE_STATEMENT@87..139 - 0: DECLARE_KW@87..96 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@96..139 - 0: JS_DECORATOR_LIST@96..96 - 1: (empty) - 2: CLASS_KW@96..102 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@102..104 - 0: IDENT@102..104 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@104..106 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@106..138 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@106..138 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@106..123 - 0: TS_ACCESSIBILITY_MODIFIER@106..114 - 0: PRIVATE_KW@106..114 "private" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@114..123 - 0: READONLY_KW@114..123 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@123..128 - 0: IDENT@123..128 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@128..136 - 0: EQ@128..130 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@130..136 - 0: JS_STRING_LITERAL@130..136 "\"test\"" [] [] - 4: SEMICOLON@136..138 ";" [] [Whitespace(" ")] - 9: R_CURLY@138..139 "}" [] [] - 3: JS_CLASS_DECLARATION@139..191 - 0: JS_DECORATOR_LIST@139..139 - 1: (empty) - 2: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@146..148 - 0: IDENT@146..148 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@148..150 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@150..190 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@150..190 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@150..175 - 0: TS_DECLARE_MODIFIER@150..158 - 0: DECLARE_KW@150..158 "declare" [] [Whitespace(" ")] - 1: TS_ACCESSIBILITY_MODIFIER@158..166 - 0: PRIVATE_KW@158..166 "private" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@166..175 - 0: READONLY_KW@166..175 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@175..180 - 0: IDENT@175..180 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@180..188 - 0: EQ@180..182 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@182..188 - 0: JS_STRING_LITERAL@182..188 "\"test\"" [] [] - 4: SEMICOLON@188..190 ";" [] [Whitespace(" ")] - 9: R_CURLY@190..191 "}" [] [] - 4: TS_DECLARE_STATEMENT@191..242 - 0: DECLARE_KW@191..200 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@200..242 - 0: JS_DECORATOR_LIST@200..200 - 1: (empty) - 2: CLASS_KW@200..206 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@206..208 - 0: IDENT@206..208 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@208..210 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@210..241 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@210..241 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@210..226 - 0: JS_STATIC_MODIFIER@210..217 - 0: STATIC_KW@210..217 "static" [] [Whitespace(" ")] - 1: TS_READONLY_MODIFIER@217..226 - 0: READONLY_KW@217..226 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@226..231 - 0: IDENT@226..231 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@231..239 - 0: EQ@231..233 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@233..239 - 0: JS_STRING_LITERAL@233..239 "\"test\"" [] [] - 4: SEMICOLON@239..241 ";" [] [Whitespace(" ")] - 9: R_CURLY@241..242 "}" [] [] - 5: JS_CLASS_DECLARATION@242..293 - 0: JS_DECORATOR_LIST@242..242 - 1: (empty) - 2: CLASS_KW@242..249 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@249..251 - 0: IDENT@249..251 "B" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@251..253 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@253..292 - 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@253..292 - 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@253..277 - 0: TS_DECLARE_MODIFIER@253..261 - 0: DECLARE_KW@253..261 "declare" [] [Whitespace(" ")] - 1: JS_STATIC_MODIFIER@261..268 - 0: STATIC_KW@261..268 "static" [] [Whitespace(" ")] - 2: TS_READONLY_MODIFIER@268..277 - 0: READONLY_KW@268..277 "readonly" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@277..282 - 0: IDENT@277..282 "prop" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@282..290 - 0: EQ@282..284 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@284..290 - 0: JS_STRING_LITERAL@284..290 "\"test\"" [] [] - 4: SEMICOLON@290..292 ";" [] [Whitespace(" ")] - 9: R_CURLY@292..293 "}" [] [] - 4: EOF@293..294 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.rast deleted file mode 100644 index d18bbdadee0e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.rast +++ /dev/null @@ -1,175 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsNonPrimitiveType { - object_token: OBJECT_KW@9..15 "object" [] [], - }, - semicolon_token: SEMICOLON@15..16 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@22..24 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@24..26 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@26..32 "string" [] [], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@33..39 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@39..41 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@41..43 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@43..44 "A" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@44..45 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@51..53 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@53..55 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@55..56 "B" [] [], - }, - dot_token: DOT@56..57 "." [] [], - right: JsName { - value_token: IDENT@57..58 "a" [] [], - }, - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@58..59 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@65..67 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@67..69 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: TsQualifiedName { - left: TsQualifiedName { - left: TsQualifiedName { - left: JsReferenceIdentifier { - value_token: IDENT@69..70 "D" [] [], - }, - dot_token: DOT@70..71 "." [] [], - right: JsName { - value_token: IDENT@71..72 "c" [] [], - }, - }, - dot_token: DOT@72..73 "." [] [], - right: JsName { - value_token: IDENT@73..74 "b" [] [], - }, - }, - dot_token: DOT@74..75 "." [] [], - right: JsName { - value_token: IDENT@75..76 "a" [] [], - }, - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@76..77 ";" [] [], - }, - ], - eof_token: EOF@77..78 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..78 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..77 - 0: TS_TYPE_ALIAS_DECLARATION@0..16 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_NON_PRIMITIVE_TYPE@9..15 - 0: OBJECT_KW@9..15 "object" [] [] - 5: SEMICOLON@15..16 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@16..33 - 0: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@22..24 - 0: IDENT@22..24 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@24..26 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@26..32 - 0: STRING_KW@26..32 "string" [] [] - 5: SEMICOLON@32..33 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@33..45 - 0: TYPE_KW@33..39 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@39..41 - 0: IDENT@39..41 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@41..43 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@43..44 - 0: JS_REFERENCE_IDENTIFIER@43..44 - 0: IDENT@43..44 "A" [] [] - 1: (empty) - 5: SEMICOLON@44..45 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@45..59 - 0: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@51..53 - 0: IDENT@51..53 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@53..55 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@55..58 - 0: TS_QUALIFIED_NAME@55..58 - 0: JS_REFERENCE_IDENTIFIER@55..56 - 0: IDENT@55..56 "B" [] [] - 1: DOT@56..57 "." [] [] - 2: JS_NAME@57..58 - 0: IDENT@57..58 "a" [] [] - 1: (empty) - 5: SEMICOLON@58..59 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@59..77 - 0: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@65..67 - 0: IDENT@65..67 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@67..69 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@69..76 - 0: TS_QUALIFIED_NAME@69..76 - 0: TS_QUALIFIED_NAME@69..74 - 0: TS_QUALIFIED_NAME@69..72 - 0: JS_REFERENCE_IDENTIFIER@69..70 - 0: IDENT@69..70 "D" [] [] - 1: DOT@70..71 "." [] [] - 2: JS_NAME@71..72 - 0: IDENT@71..72 "c" [] [] - 1: DOT@72..73 "." [] [] - 2: JS_NAME@73..74 - 0: IDENT@73..74 "b" [] [] - 1: DOT@74..75 "." [] [] - 2: JS_NAME@75..76 - 0: IDENT@75..76 "a" [] [] - 1: (empty) - 5: SEMICOLON@76..77 ";" [] [] - 4: EOF@77..78 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast b/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast deleted file mode 100644 index 7f613cede4dc..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast +++ /dev/null @@ -1,519 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@9..10 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@10..11 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], - return_type: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@16..18 "a" [] [Whitespace(" ")], - }, - is_token: IS_KW@18..21 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@21..27 "string" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@34..36 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@40..44 "test" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@44..45 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@45..46 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@46..47 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@47..49 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@49..51 "a" [] [Whitespace(" ")], - }, - is_token: IS_KW@51..54 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@54..61 "string" [] [Whitespace(" ")], - }, - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@61..62 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@62..68 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@68..70 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@70..72 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@72..74 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsCallSignatureTypeMember { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@74..75 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@75..76 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@76..77 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@77..79 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@79..81 "a" [] [Whitespace(" ")], - }, - is_token: IS_KW@81..84 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@84..91 "string" [] [Whitespace(" ")], - }, - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@91..92 "}" [] [], - }, - semicolon_token: missing (optional), - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@92..99 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@99..101 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@101..103 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@103..105 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@105..109 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@109..110 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@110..111 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@111..112 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@112..114 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@114..116 "x" [] [Whitespace(" ")], - }, - is_token: IS_KW@116..119 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@119..126 "string" [] [Whitespace(" ")], - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@126..128 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@128..135 "return" [] [Whitespace(" ")], - argument: JsBinaryExpression { - left: JsUnaryExpression { - operator_token: TYPEOF_KW@135..142 "typeof" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@142..144 "x" [] [Whitespace(" ")], - }, - }, - }, - operator_token: EQ3@144..148 "===" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@148..157 "\"string\"" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@157..159 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@159..160 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@167..169 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@169..171 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@171..175 "test" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@175..176 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@176..177 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@177..178 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@178..180 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@180..182 "x" [] [Whitespace(" ")], - }, - is_token: IS_KW@182..185 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@185..192 "string" [] [Whitespace(" ")], - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@192..194 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@194..201 "return" [] [Whitespace(" ")], - argument: JsBinaryExpression { - left: JsUnaryExpression { - operator_token: TYPEOF_KW@201..208 "typeof" [] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@208..210 "x" [] [Whitespace(" ")], - }, - }, - }, - operator_token: EQ3@210..214 "===" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@214..222 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@222..224 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@224..226 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@226..227 "}" [] [], - }, - ], - eof_token: EOF@227..228 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..228 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..227 - 0: TS_TYPE_ALIAS_DECLARATION@0..28 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@9..27 - 0: (empty) - 1: JS_PARAMETERS@9..13 - 0: L_PAREN@9..10 "(" [] [] - 1: JS_PARAMETER_LIST@10..11 - 0: JS_FORMAL_PARAMETER@10..11 - 0: JS_DECORATOR_LIST@10..10 - 1: JS_IDENTIFIER_BINDING@10..11 - 0: IDENT@10..11 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] - 3: TS_PREDICATE_RETURN_TYPE@16..27 - 0: JS_REFERENCE_IDENTIFIER@16..18 - 0: IDENT@16..18 "a" [] [Whitespace(" ")] - 1: IS_KW@18..21 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@21..27 - 0: STRING_KW@21..27 "string" [] [] - 5: SEMICOLON@27..28 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@28..62 - 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@36..38 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@38..62 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@40..61 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@40..61 - 0: JS_LITERAL_MEMBER_NAME@40..44 - 0: IDENT@40..44 "test" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@44..47 - 0: L_PAREN@44..45 "(" [] [] - 1: JS_PARAMETER_LIST@45..46 - 0: JS_FORMAL_PARAMETER@45..46 - 0: JS_DECORATOR_LIST@45..45 - 1: JS_IDENTIFIER_BINDING@45..46 - 0: IDENT@45..46 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@46..47 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@47..61 - 0: COLON@47..49 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@49..61 - 0: JS_REFERENCE_IDENTIFIER@49..51 - 0: IDENT@49..51 "a" [] [Whitespace(" ")] - 1: IS_KW@51..54 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@54..61 - 0: STRING_KW@54..61 "string" [] [Whitespace(" ")] - 5: (empty) - 2: R_CURLY@61..62 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@62..92 - 0: TYPE_KW@62..68 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@68..70 - 0: IDENT@68..70 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@70..72 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@72..92 - 0: L_CURLY@72..74 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@74..91 - 0: TS_CALL_SIGNATURE_TYPE_MEMBER@74..91 - 0: (empty) - 1: JS_PARAMETERS@74..77 - 0: L_PAREN@74..75 "(" [] [] - 1: JS_PARAMETER_LIST@75..76 - 0: JS_FORMAL_PARAMETER@75..76 - 0: JS_DECORATOR_LIST@75..75 - 1: JS_IDENTIFIER_BINDING@75..76 - 0: IDENT@75..76 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@76..77 ")" [] [] - 2: TS_RETURN_TYPE_ANNOTATION@77..91 - 0: COLON@77..79 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@79..91 - 0: JS_REFERENCE_IDENTIFIER@79..81 - 0: IDENT@79..81 "a" [] [Whitespace(" ")] - 1: IS_KW@81..84 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@84..91 - 0: STRING_KW@84..91 "string" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@91..92 "}" [] [] - 5: (empty) - 3: JS_VARIABLE_STATEMENT@92..160 - 0: JS_VARIABLE_DECLARATION@92..160 - 0: (empty) - 1: CONST_KW@92..99 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@99..160 - 0: JS_VARIABLE_DECLARATOR@99..160 - 0: JS_IDENTIFIER_BINDING@99..101 - 0: IDENT@99..101 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@101..160 - 0: EQ@101..103 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@103..160 - 0: L_CURLY@103..105 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@105..159 - 0: JS_METHOD_OBJECT_MEMBER@105..159 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@105..109 - 0: IDENT@105..109 "test" [] [] - 3: (empty) - 4: JS_PARAMETERS@109..112 - 0: L_PAREN@109..110 "(" [] [] - 1: JS_PARAMETER_LIST@110..111 - 0: JS_FORMAL_PARAMETER@110..111 - 0: JS_DECORATOR_LIST@110..110 - 1: JS_IDENTIFIER_BINDING@110..111 - 0: IDENT@110..111 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@111..112 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@112..126 - 0: COLON@112..114 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@114..126 - 0: JS_REFERENCE_IDENTIFIER@114..116 - 0: IDENT@114..116 "x" [] [Whitespace(" ")] - 1: IS_KW@116..119 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@119..126 - 0: STRING_KW@119..126 "string" [] [Whitespace(" ")] - 6: JS_FUNCTION_BODY@126..159 - 0: L_CURLY@126..128 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@128..128 - 2: JS_STATEMENT_LIST@128..157 - 0: JS_RETURN_STATEMENT@128..157 - 0: RETURN_KW@128..135 "return" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@135..157 - 0: JS_UNARY_EXPRESSION@135..144 - 0: TYPEOF_KW@135..142 "typeof" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@142..144 - 0: JS_REFERENCE_IDENTIFIER@142..144 - 0: IDENT@142..144 "x" [] [Whitespace(" ")] - 1: EQ3@144..148 "===" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@148..157 - 0: JS_STRING_LITERAL@148..157 "\"string\"" [] [Whitespace(" ")] - 2: (empty) - 3: R_CURLY@157..159 "}" [] [Whitespace(" ")] - 2: R_CURLY@159..160 "}" [] [] - 1: (empty) - 4: JS_CLASS_DECLARATION@160..227 - 0: JS_DECORATOR_LIST@160..160 - 1: (empty) - 2: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@167..169 - 0: IDENT@167..169 "D" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@169..171 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@171..226 - 0: JS_METHOD_CLASS_MEMBER@171..226 - 0: JS_METHOD_MODIFIER_LIST@171..171 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@171..175 - 0: IDENT@171..175 "test" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@175..178 - 0: L_PAREN@175..176 "(" [] [] - 1: JS_PARAMETER_LIST@176..177 - 0: JS_FORMAL_PARAMETER@176..177 - 0: JS_DECORATOR_LIST@176..176 - 1: JS_IDENTIFIER_BINDING@176..177 - 0: IDENT@176..177 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@177..178 ")" [] [] - 7: TS_RETURN_TYPE_ANNOTATION@178..192 - 0: COLON@178..180 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@180..192 - 0: JS_REFERENCE_IDENTIFIER@180..182 - 0: IDENT@180..182 "x" [] [Whitespace(" ")] - 1: IS_KW@182..185 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@185..192 - 0: STRING_KW@185..192 "string" [] [Whitespace(" ")] - 8: JS_FUNCTION_BODY@192..226 - 0: L_CURLY@192..194 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@194..194 - 2: JS_STATEMENT_LIST@194..224 - 0: JS_RETURN_STATEMENT@194..224 - 0: RETURN_KW@194..201 "return" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@201..222 - 0: JS_UNARY_EXPRESSION@201..210 - 0: TYPEOF_KW@201..208 "typeof" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@208..210 - 0: JS_REFERENCE_IDENTIFIER@208..210 - 0: IDENT@208..210 "x" [] [Whitespace(" ")] - 1: EQ3@210..214 "===" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@214..222 - 0: JS_STRING_LITERAL@214..222 "\"string\"" [] [] - 2: SEMICOLON@222..224 ";" [] [Whitespace(" ")] - 3: R_CURLY@224..226 "}" [] [Whitespace(" ")] - 9: R_CURLY@226..227 "}" [] [] - 4: EOF@227..228 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.rast b/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.rast deleted file mode 100644 index b336c0792dbc..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.rast +++ /dev/null @@ -1,228 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..12 "I" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@12..13 "{" [] [], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@13..18 "foo" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@18..19 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@19..23 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@25..31 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@31..32 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@32..34 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@34..35 "I" [] [], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@35..39 "is" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@39..40 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@40..41 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@41..43 ":" [] [Whitespace(" ")], - ty: TsBooleanType { - boolean_token: BOOLEAN_KW@43..50 "boolean" [] [], - }, - }, - separator_token: SEMICOLON@50..51 ";" [] [], - }, - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@51..56 "bar" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@56..57 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@57..61 "test" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@61..63 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@63..69 "string" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@69..70 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@70..72 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@72..73 "I" [] [], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@73..82 "asserts" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@82..83 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@83..84 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@84..86 ":" [] [Whitespace(" ")], - ty: TsBooleanType { - boolean_token: BOOLEAN_KW@86..93 "boolean" [] [], - }, - }, - separator_token: SEMICOLON@93..94 ";" [] [], - }, - ], - r_curly_token: R_CURLY@94..96 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@96..97 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..97 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..96 - 0: TS_INTERFACE_DECLARATION@0..96 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "I" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@12..13 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@13..94 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@13..35 - 0: JS_LITERAL_MEMBER_NAME@13..18 - 0: IDENT@13..18 "foo" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@18..32 - 0: L_PAREN@18..19 "(" [] [] - 1: JS_PARAMETER_LIST@19..31 - 0: JS_FORMAL_PARAMETER@19..31 - 0: JS_DECORATOR_LIST@19..19 - 1: JS_IDENTIFIER_BINDING@19..23 - 0: IDENT@19..23 "test" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@23..31 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@25..31 - 0: STRING_KW@25..31 "string" [] [] - 4: (empty) - 2: R_PAREN@31..32 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@32..35 - 0: COLON@32..34 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@34..35 - 0: JS_REFERENCE_IDENTIFIER@34..35 - 0: IDENT@34..35 "I" [] [] - 1: (empty) - 5: (empty) - 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@35..51 - 0: JS_LITERAL_MEMBER_NAME@35..39 - 0: IDENT@35..39 "is" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@39..41 - 0: L_PAREN@39..40 "(" [] [] - 1: JS_PARAMETER_LIST@40..40 - 2: R_PAREN@40..41 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@41..50 - 0: COLON@41..43 ":" [] [Whitespace(" ")] - 1: TS_BOOLEAN_TYPE@43..50 - 0: BOOLEAN_KW@43..50 "boolean" [] [] - 5: SEMICOLON@50..51 ";" [] [] - 2: TS_METHOD_SIGNATURE_TYPE_MEMBER@51..73 - 0: JS_LITERAL_MEMBER_NAME@51..56 - 0: IDENT@51..56 "bar" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@56..70 - 0: L_PAREN@56..57 "(" [] [] - 1: JS_PARAMETER_LIST@57..69 - 0: JS_FORMAL_PARAMETER@57..69 - 0: JS_DECORATOR_LIST@57..57 - 1: JS_IDENTIFIER_BINDING@57..61 - 0: IDENT@57..61 "test" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@61..69 - 0: COLON@61..63 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@63..69 - 0: STRING_KW@63..69 "string" [] [] - 4: (empty) - 2: R_PAREN@69..70 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@70..73 - 0: COLON@70..72 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@72..73 - 0: JS_REFERENCE_IDENTIFIER@72..73 - 0: IDENT@72..73 "I" [] [] - 1: (empty) - 5: (empty) - 3: TS_METHOD_SIGNATURE_TYPE_MEMBER@73..94 - 0: JS_LITERAL_MEMBER_NAME@73..82 - 0: IDENT@73..82 "asserts" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@82..84 - 0: L_PAREN@82..83 "(" [] [] - 1: JS_PARAMETER_LIST@83..83 - 2: R_PAREN@83..84 ")" [] [] - 4: TS_RETURN_TYPE_ANNOTATION@84..93 - 0: COLON@84..86 ":" [] [Whitespace(" ")] - 1: TS_BOOLEAN_TYPE@86..93 - 0: BOOLEAN_KW@86..93 "boolean" [] [] - 5: SEMICOLON@93..94 ";" [] [] - 6: R_CURLY@94..96 "}" [Newline("\n")] [] - 4: EOF@96..97 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast b/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast deleted file mode 100644 index d3e5cb7805ec..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast +++ /dev/null @@ -1,478 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@7..10 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@10..11 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@17..18 "B" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@18..19 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@19..20 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@26..27 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@27..29 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@29..31 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@33..35 "(" [Newline("\n")] [], - assignment: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@35..37 "a" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@37..47 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@47..53 "string" [] [], - }, - }, - r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@55..57 "=" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@57..65 "\"string\"" [] [], - }, - }, - semicolon_token: SEMICOLON@65..66 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@66..68 "(" [Newline("\n")] [], - assignment: TsSatisfiesAssignment { - assignment: JsParenthesizedAssignment { - l_paren_token: L_PAREN@68..69 "(" [] [], - assignment: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@69..71 "a" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@71..81 "satisfies" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@81..84 "any" [] [], - }, - }, - r_paren_token: R_PAREN@84..86 ")" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@86..96 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@96..102 "string" [] [], - }, - }, - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@104..106 "=" [] [Whitespace(" ")], - right: JsNullLiteralExpression { - value_token: NULL_KW@106..110 "null" [] [], - }, - }, - semicolon_token: SEMICOLON@110..111 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@111..113 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsObjectAssignmentPattern { - l_curly_token: L_CURLY@113..115 "{" [] [Whitespace(" ")], - properties: JsObjectAssignmentPatternPropertyList [ - JsObjectAssignmentPatternProperty { - member: JsLiteralMemberName { - value: IDENT@115..116 "b" [] [], - }, - colon_token: COLON@116..118 ":" [] [Whitespace(" ")], - pattern: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@118..120 "a" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@120..130 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@130..137 "string" [] [Whitespace(" ")], - }, - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@137..139 "}" [] [Whitespace(" ")], - }, - operator_token: EQ@139..141 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@141..143 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@143..144 "b" [] [], - }, - colon_token: COLON@144..146 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@146..153 "\"test\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@153..154 "}" [] [], - }, - }, - r_paren_token: R_PAREN@154..155 ")" [] [], - }, - semicolon_token: SEMICOLON@155..156 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@156..158 "(" [Newline("\n")] [], - expression: JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@158..160 "[" [] [Whitespace(" ")], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@160..162 "a" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@162..172 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@172..179 "string" [] [Whitespace(" ")], - }, - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@179..181 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@181..183 "=" [] [Whitespace(" ")], - right: JsArrayExpression { - l_brack_token: L_BRACK@183..185 "[" [] [Whitespace(" ")], - elements: JsArrayElementList [ - JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@185..192 "\"test\"" [] [Whitespace(" ")], - }, - ], - r_brack_token: R_BRACK@192..193 "]" [] [], - }, - }, - r_paren_token: R_PAREN@193..194 ")" [] [], - }, - semicolon_token: SEMICOLON@194..195 ";" [] [], - }, - JsForInStatement { - for_token: FOR_KW@195..200 "for" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@200..201 "(" [] [], - initializer: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@201..203 "a" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@203..213 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@213..220 "string" [] [Whitespace(" ")], - }, - }, - in_token: IN_KW@220..223 "in" [] [Whitespace(" ")], - expression: JsArrayExpression { - l_brack_token: L_BRACK@223..224 "[" [] [], - elements: JsArrayElementList [], - r_brack_token: R_BRACK@224..225 "]" [] [], - }, - r_paren_token: R_PAREN@225..227 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@227..228 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@228..229 "}" [] [], - }, - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsParenthesizedAssignment { - l_paren_token: L_PAREN@229..231 "(" [Newline("\n")] [], - assignment: TsSatisfiesAssignment { - assignment: JsIdentifierAssignment { - name_token: IDENT@231..233 "a" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@233..243 "satisfies" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@243..244 "B" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@244..245 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@245..251 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@251..252 ">" [] [], - }, - }, - }, - r_paren_token: R_PAREN@252..254 ")" [] [Whitespace(" ")], - }, - operator_token: EQ@254..256 "=" [] [Whitespace(" ")], - right: JsObjectExpression { - l_curly_token: L_CURLY@256..258 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@258..259 "a" [] [], - }, - colon_token: COLON@259..261 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@261..268 "\"test\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@268..269 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@269..270 ";" [] [], - }, - ], - eof_token: EOF@270..271 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..271 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..270 - 0: JS_VARIABLE_STATEMENT@0..11 - 0: JS_VARIABLE_DECLARATION@0..10 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..10 - 0: JS_VARIABLE_DECLARATOR@4..10 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_TYPE_ANNOTATION@5..10 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@7..10 - 0: ANY_KW@7..10 "any" [] [] - 2: (empty) - 1: SEMICOLON@10..11 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@11..33 - 0: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@17..18 - 0: IDENT@17..18 "B" [] [] - 2: TS_TYPE_PARAMETERS@18..22 - 0: L_ANGLE@18..19 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@19..20 - 0: TS_TYPE_PARAMETER@19..20 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 - 1: TS_TYPE_PARAMETER_NAME@19..20 - 0: IDENT@19..20 "A" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] - 3: EQ@22..24 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@24..32 - 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@26..31 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@26..31 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@26..27 - 0: IDENT@26..27 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@27..31 - 0: COLON@27..29 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@29..31 - 0: JS_REFERENCE_IDENTIFIER@29..31 - 0: IDENT@29..31 "A" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 2: R_CURLY@31..32 "}" [] [] - 5: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..66 - 0: JS_ASSIGNMENT_EXPRESSION@33..65 - 0: JS_PARENTHESIZED_ASSIGNMENT@33..55 - 0: L_PAREN@33..35 "(" [Newline("\n")] [] - 1: TS_SATISFIES_ASSIGNMENT@35..53 - 0: JS_IDENTIFIER_ASSIGNMENT@35..37 - 0: IDENT@35..37 "a" [] [Whitespace(" ")] - 1: SATISFIES_KW@37..47 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@47..53 - 0: STRING_KW@47..53 "string" [] [] - 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] - 1: EQ@55..57 "=" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@57..65 - 0: JS_STRING_LITERAL@57..65 "\"string\"" [] [] - 1: SEMICOLON@65..66 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@66..111 - 0: JS_ASSIGNMENT_EXPRESSION@66..110 - 0: JS_PARENTHESIZED_ASSIGNMENT@66..104 - 0: L_PAREN@66..68 "(" [Newline("\n")] [] - 1: TS_SATISFIES_ASSIGNMENT@68..102 - 0: JS_PARENTHESIZED_ASSIGNMENT@68..86 - 0: L_PAREN@68..69 "(" [] [] - 1: TS_SATISFIES_ASSIGNMENT@69..84 - 0: JS_IDENTIFIER_ASSIGNMENT@69..71 - 0: IDENT@69..71 "a" [] [Whitespace(" ")] - 1: SATISFIES_KW@71..81 "satisfies" [] [Whitespace(" ")] - 2: TS_ANY_TYPE@81..84 - 0: ANY_KW@81..84 "any" [] [] - 2: R_PAREN@84..86 ")" [] [Whitespace(" ")] - 1: SATISFIES_KW@86..96 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@96..102 - 0: STRING_KW@96..102 "string" [] [] - 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 1: EQ@104..106 "=" [] [Whitespace(" ")] - 2: JS_NULL_LITERAL_EXPRESSION@106..110 - 0: NULL_KW@106..110 "null" [] [] - 1: SEMICOLON@110..111 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@111..156 - 0: JS_PARENTHESIZED_EXPRESSION@111..155 - 0: L_PAREN@111..113 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@113..154 - 0: JS_OBJECT_ASSIGNMENT_PATTERN@113..139 - 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@115..137 - 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@115..137 - 0: JS_LITERAL_MEMBER_NAME@115..116 - 0: IDENT@115..116 "b" [] [] - 1: COLON@116..118 ":" [] [Whitespace(" ")] - 2: TS_SATISFIES_ASSIGNMENT@118..137 - 0: JS_IDENTIFIER_ASSIGNMENT@118..120 - 0: IDENT@118..120 "a" [] [Whitespace(" ")] - 1: SATISFIES_KW@120..130 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@130..137 - 0: STRING_KW@130..137 "string" [] [Whitespace(" ")] - 3: (empty) - 2: R_CURLY@137..139 "}" [] [Whitespace(" ")] - 1: EQ@139..141 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@141..154 - 0: L_CURLY@141..143 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@143..153 - 0: JS_PROPERTY_OBJECT_MEMBER@143..153 - 0: JS_LITERAL_MEMBER_NAME@143..144 - 0: IDENT@143..144 "b" [] [] - 1: COLON@144..146 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@146..153 - 0: JS_STRING_LITERAL@146..153 "\"test\"" [] [Whitespace(" ")] - 2: R_CURLY@153..154 "}" [] [] - 2: R_PAREN@154..155 ")" [] [] - 1: SEMICOLON@155..156 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@156..195 - 0: JS_PARENTHESIZED_EXPRESSION@156..194 - 0: L_PAREN@156..158 "(" [Newline("\n")] [] - 1: JS_ASSIGNMENT_EXPRESSION@158..193 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@158..181 - 0: L_BRACK@158..160 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@160..179 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@160..179 - 0: TS_SATISFIES_ASSIGNMENT@160..179 - 0: JS_IDENTIFIER_ASSIGNMENT@160..162 - 0: IDENT@160..162 "a" [] [Whitespace(" ")] - 1: SATISFIES_KW@162..172 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@172..179 - 0: STRING_KW@172..179 "string" [] [Whitespace(" ")] - 1: (empty) - 2: R_BRACK@179..181 "]" [] [Whitespace(" ")] - 1: EQ@181..183 "=" [] [Whitespace(" ")] - 2: JS_ARRAY_EXPRESSION@183..193 - 0: L_BRACK@183..185 "[" [] [Whitespace(" ")] - 1: JS_ARRAY_ELEMENT_LIST@185..192 - 0: JS_STRING_LITERAL_EXPRESSION@185..192 - 0: JS_STRING_LITERAL@185..192 "\"test\"" [] [Whitespace(" ")] - 2: R_BRACK@192..193 "]" [] [] - 2: R_PAREN@193..194 ")" [] [] - 1: SEMICOLON@194..195 ";" [] [] - 6: JS_FOR_IN_STATEMENT@195..229 - 0: FOR_KW@195..200 "for" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@200..201 "(" [] [] - 2: TS_SATISFIES_ASSIGNMENT@201..220 - 0: JS_IDENTIFIER_ASSIGNMENT@201..203 - 0: IDENT@201..203 "a" [] [Whitespace(" ")] - 1: SATISFIES_KW@203..213 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@213..220 - 0: STRING_KW@213..220 "string" [] [Whitespace(" ")] - 3: IN_KW@220..223 "in" [] [Whitespace(" ")] - 4: JS_ARRAY_EXPRESSION@223..225 - 0: L_BRACK@223..224 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@224..224 - 2: R_BRACK@224..225 "]" [] [] - 5: R_PAREN@225..227 ")" [] [Whitespace(" ")] - 6: JS_BLOCK_STATEMENT@227..229 - 0: L_CURLY@227..228 "{" [] [] - 1: JS_STATEMENT_LIST@228..228 - 2: R_CURLY@228..229 "}" [] [] - 7: JS_EXPRESSION_STATEMENT@229..270 - 0: JS_ASSIGNMENT_EXPRESSION@229..269 - 0: JS_PARENTHESIZED_ASSIGNMENT@229..254 - 0: L_PAREN@229..231 "(" [Newline("\n")] [] - 1: TS_SATISFIES_ASSIGNMENT@231..252 - 0: JS_IDENTIFIER_ASSIGNMENT@231..233 - 0: IDENT@231..233 "a" [] [Whitespace(" ")] - 1: SATISFIES_KW@233..243 "satisfies" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@243..252 - 0: JS_REFERENCE_IDENTIFIER@243..244 - 0: IDENT@243..244 "B" [] [] - 1: TS_TYPE_ARGUMENTS@244..252 - 0: L_ANGLE@244..245 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@245..251 - 0: TS_STRING_TYPE@245..251 - 0: STRING_KW@245..251 "string" [] [] - 2: R_ANGLE@251..252 ">" [] [] - 2: R_PAREN@252..254 ")" [] [Whitespace(" ")] - 1: EQ@254..256 "=" [] [Whitespace(" ")] - 2: JS_OBJECT_EXPRESSION@256..269 - 0: L_CURLY@256..258 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@258..268 - 0: JS_PROPERTY_OBJECT_MEMBER@258..268 - 0: JS_LITERAL_MEMBER_NAME@258..259 - 0: IDENT@258..259 "a" [] [] - 1: COLON@259..261 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@261..268 - 0: JS_STRING_LITERAL@261..268 "\"test\"" [] [Whitespace(" ")] - 2: R_CURLY@268..269 "}" [] [] - 1: SEMICOLON@269..270 ";" [] [] - 4: EOF@270..271 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast b/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast deleted file mode 100644 index c17f3fda15f3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast +++ /dev/null @@ -1,398 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@10..12 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - l_curly_token: L_CURLY@12..13 "{" [] [], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@13..18 "a" [Newline("\n"), Whitespace(" ")] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@20..26 "string" [] [], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@26..28 "}" [Newline("\n")] [], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@34..36 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - expression: TsSatisfiesExpression { - expression: JsObjectExpression { - l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@40..41 "a" [] [], - }, - colon_token: COLON@41..43 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@43..50 "'test'" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@50..52 "}" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@52..62 "satisfies" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@62..63 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@69..71 "y" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@71..73 "=" [] [Whitespace(" ")], - expression: TsSatisfiesExpression { - expression: JsObjectExpression { - l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@75..76 "a" [] [], - }, - colon_token: COLON@76..78 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@78..84 "'test'" [] [], - }, - }, - COMMA@84..86 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@86..87 "b" [] [], - }, - colon_token: COLON@87..89 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@89..96 "'test'" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@96..98 "}" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@98..108 "satisfies" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@108..109 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@109..110 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@110..117 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@117..119 "z" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@119..121 "=" [] [Whitespace(" ")], - expression: TsSatisfiesExpression { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@121..131 "undefined" [] [Whitespace(" ")], - }, - }, - satisfies_token: SATISFIES_KW@131..141 "satisfies" [] [Whitespace(" ")], - ty: TsNumberLiteralType { - minus_token: missing (optional), - literal_token: JS_NUMBER_LITERAL@141..142 "1" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@142..143 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@143..148 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@148..175 "not_a_satisfies_expression" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@175..177 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@177..186 "undefined" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@186..196 "satisfies" [Newline("\n")] [], - }, - }, - semicolon_token: SEMICOLON@196..197 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@197..202 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@202..213 "precedence" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@213..215 "=" [] [Whitespace(" ")], - expression: TsSatisfiesExpression { - expression: TsSatisfiesExpression { - expression: JsBinaryExpression { - left: TsSatisfiesExpression { - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@215..223 "\"hello\"" [] [Whitespace(" ")], - }, - satisfies_token: SATISFIES_KW@223..233 "satisfies" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@233..240 "string" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@240..242 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@242..244 "3" [] [Whitespace(" ")], - }, - }, - satisfies_token: SATISFIES_KW@244..254 "satisfies" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@254..261 "number" [] [Whitespace(" ")], - }, - }, - satisfies_token: SATISFIES_KW@261..271 "satisfies" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@271..277 "number" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@277..278 ";" [] [], - }, - ], - eof_token: EOF@278..279 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..279 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..278 - 0: TS_INTERFACE_DECLARATION@0..28 - 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@10..12 - 0: IDENT@10..12 "A" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: L_CURLY@12..13 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@13..26 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@13..26 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@13..18 - 0: IDENT@13..18 "a" [Newline("\n"), Whitespace(" ")] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@18..26 - 0: COLON@18..20 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@20..26 - 0: STRING_KW@20..26 "string" [] [] - 4: (empty) - 6: R_CURLY@26..28 "}" [Newline("\n")] [] - 1: JS_EMPTY_STATEMENT@28..29 - 0: SEMICOLON@28..29 ";" [] [] - 2: JS_VARIABLE_STATEMENT@29..64 - 0: JS_VARIABLE_DECLARATION@29..63 - 0: (empty) - 1: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@34..63 - 0: JS_VARIABLE_DECLARATOR@34..63 - 0: JS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@36..63 - 0: EQ@36..38 "=" [] [Whitespace(" ")] - 1: TS_SATISFIES_EXPRESSION@38..63 - 0: JS_OBJECT_EXPRESSION@38..52 - 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@40..50 - 0: JS_PROPERTY_OBJECT_MEMBER@40..50 - 0: JS_LITERAL_MEMBER_NAME@40..41 - 0: IDENT@40..41 "a" [] [] - 1: COLON@41..43 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@43..50 - 0: JS_STRING_LITERAL@43..50 "'test'" [] [Whitespace(" ")] - 2: R_CURLY@50..52 "}" [] [Whitespace(" ")] - 1: SATISFIES_KW@52..62 "satisfies" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@62..63 - 0: JS_REFERENCE_IDENTIFIER@62..63 - 0: IDENT@62..63 "A" [] [] - 1: (empty) - 1: SEMICOLON@63..64 ";" [] [] - 3: JS_VARIABLE_STATEMENT@64..110 - 0: JS_VARIABLE_DECLARATION@64..109 - 0: (empty) - 1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@69..109 - 0: JS_VARIABLE_DECLARATOR@69..109 - 0: JS_IDENTIFIER_BINDING@69..71 - 0: IDENT@69..71 "y" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@71..109 - 0: EQ@71..73 "=" [] [Whitespace(" ")] - 1: TS_SATISFIES_EXPRESSION@73..109 - 0: JS_OBJECT_EXPRESSION@73..98 - 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@75..96 - 0: JS_PROPERTY_OBJECT_MEMBER@75..84 - 0: JS_LITERAL_MEMBER_NAME@75..76 - 0: IDENT@75..76 "a" [] [] - 1: COLON@76..78 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@78..84 - 0: JS_STRING_LITERAL@78..84 "'test'" [] [] - 1: COMMA@84..86 "," [] [Whitespace(" ")] - 2: JS_PROPERTY_OBJECT_MEMBER@86..96 - 0: JS_LITERAL_MEMBER_NAME@86..87 - 0: IDENT@86..87 "b" [] [] - 1: COLON@87..89 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@89..96 - 0: JS_STRING_LITERAL@89..96 "'test'" [] [Whitespace(" ")] - 2: R_CURLY@96..98 "}" [] [Whitespace(" ")] - 1: SATISFIES_KW@98..108 "satisfies" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@108..109 - 0: JS_REFERENCE_IDENTIFIER@108..109 - 0: IDENT@108..109 "A" [] [] - 1: (empty) - 1: SEMICOLON@109..110 ";" [] [] - 4: JS_VARIABLE_STATEMENT@110..143 - 0: JS_VARIABLE_DECLARATION@110..142 - 0: (empty) - 1: CONST_KW@110..117 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@117..142 - 0: JS_VARIABLE_DECLARATOR@117..142 - 0: JS_IDENTIFIER_BINDING@117..119 - 0: IDENT@117..119 "z" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@119..142 - 0: EQ@119..121 "=" [] [Whitespace(" ")] - 1: TS_SATISFIES_EXPRESSION@121..142 - 0: JS_IDENTIFIER_EXPRESSION@121..131 - 0: JS_REFERENCE_IDENTIFIER@121..131 - 0: IDENT@121..131 "undefined" [] [Whitespace(" ")] - 1: SATISFIES_KW@131..141 "satisfies" [] [Whitespace(" ")] - 2: TS_NUMBER_LITERAL_TYPE@141..142 - 0: (empty) - 1: JS_NUMBER_LITERAL@141..142 "1" [] [] - 1: SEMICOLON@142..143 ";" [] [] - 5: JS_VARIABLE_STATEMENT@143..186 - 0: JS_VARIABLE_DECLARATION@143..186 - 0: (empty) - 1: LET_KW@143..148 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@148..186 - 0: JS_VARIABLE_DECLARATOR@148..186 - 0: JS_IDENTIFIER_BINDING@148..175 - 0: IDENT@148..175 "not_a_satisfies_expression" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@175..186 - 0: EQ@175..177 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@177..186 - 0: JS_REFERENCE_IDENTIFIER@177..186 - 0: IDENT@177..186 "undefined" [] [] - 1: (empty) - 6: JS_EXPRESSION_STATEMENT@186..197 - 0: JS_IDENTIFIER_EXPRESSION@186..196 - 0: JS_REFERENCE_IDENTIFIER@186..196 - 0: IDENT@186..196 "satisfies" [Newline("\n")] [] - 1: SEMICOLON@196..197 ";" [] [] - 7: JS_VARIABLE_STATEMENT@197..278 - 0: JS_VARIABLE_DECLARATION@197..277 - 0: (empty) - 1: LET_KW@197..202 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@202..277 - 0: JS_VARIABLE_DECLARATOR@202..277 - 0: JS_IDENTIFIER_BINDING@202..213 - 0: IDENT@202..213 "precedence" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@213..277 - 0: EQ@213..215 "=" [] [Whitespace(" ")] - 1: TS_SATISFIES_EXPRESSION@215..277 - 0: TS_SATISFIES_EXPRESSION@215..261 - 0: JS_BINARY_EXPRESSION@215..244 - 0: TS_SATISFIES_EXPRESSION@215..240 - 0: JS_STRING_LITERAL_EXPRESSION@215..223 - 0: JS_STRING_LITERAL@215..223 "\"hello\"" [] [Whitespace(" ")] - 1: SATISFIES_KW@223..233 "satisfies" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@233..240 - 0: STRING_KW@233..240 "string" [] [Whitespace(" ")] - 1: PLUS@240..242 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@242..244 - 0: JS_NUMBER_LITERAL@242..244 "3" [] [Whitespace(" ")] - 1: SATISFIES_KW@244..254 "satisfies" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@254..261 - 0: NUMBER_KW@254..261 "number" [] [Whitespace(" ")] - 1: SATISFIES_KW@261..271 "satisfies" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@271..277 - 0: NUMBER_KW@271..277 "number" [] [] - 1: SEMICOLON@277..278 ";" [] [] - 4: EOF@278..279 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.rast b/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.rast deleted file mode 100644 index 850a0a28f36f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.rast +++ /dev/null @@ -1,511 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@11..15 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..16 "a" [] [], - }, - l_paren_token: L_PAREN@16..17 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@17..18 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@18..20 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@20..26 "number" [] [], - }, - }, - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@35..37 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@37..39 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@39..41 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@41..45 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@45..46 "a" [] [], - }, - l_paren_token: L_PAREN@46..47 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@47..48 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@50..51 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@51..110 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@110..112 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@112..114 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@114..116 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@116..119 "set" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@119..120 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@120..121 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@121..123 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@123..124 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@124..130 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@130..132 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@132..134 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@134..136 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@136..139 "set" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@139..141 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@141..148 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@148..149 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@149..155 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@155..157 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@157..159 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@159..161 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@161..165 "set" [] [Whitespace(" ")], - }, - optional_token: missing (optional), - type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@165..166 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@166..172 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@172..174 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@174..176 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@176..178 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@178..181 "set" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@181..182 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@182..183 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@183..185 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@185..191 "number" [] [], - }, - }, - initializer: missing (optional), - }, - COMMA@191..192 "," [] [], - ], - r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@194..195 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@195..201 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@201..203 "G" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@203..205 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@205..206 "{" [] [], - members: TsTypeMemberList [ - TsSetterSignatureTypeMember { - set_token: SET_KW@206..210 "set" [] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@210..211 "a" [] [], - }, - l_paren_token: L_PAREN@211..212 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@212..213 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: COMMA@213..214 "," [] [], - r_paren_token: R_PAREN@214..215 ")" [] [], - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@215..216 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@222..224 "H" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@224..226 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@226..227 "{" [] [], - members: TsTypeMemberList [ - TsMethodSignatureTypeMember { - name: JsLiteralMemberName { - value: IDENT@227..230 "set" [] [], - }, - optional_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@230..231 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@231..232 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@232..234 "," [] [Whitespace(" ")], - ], - r_paren_token: R_PAREN@234..236 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@236..237 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@237..238 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..238 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..237 - 0: TS_TYPE_ALIAS_DECLARATION@0..29 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..29 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..28 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@11..28 - 0: SET_KW@11..15 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..16 - 0: IDENT@15..16 "a" [] [] - 2: L_PAREN@16..17 "(" [] [] - 3: JS_FORMAL_PARAMETER@17..26 - 0: JS_DECORATOR_LIST@17..17 - 1: JS_IDENTIFIER_BINDING@17..18 - 0: IDENT@17..18 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@18..26 - 0: COLON@18..20 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@20..26 - 0: NUMBER_KW@20..26 "number" [] [] - 4: (empty) - 4: (empty) - 5: R_PAREN@26..28 ")" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@28..29 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@29..51 - 0: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@35..37 - 0: IDENT@35..37 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@37..39 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@39..51 - 0: L_CURLY@39..41 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@41..50 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@41..50 - 0: SET_KW@41..45 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@45..46 - 0: IDENT@45..46 "a" [] [] - 2: L_PAREN@46..47 "(" [] [] - 3: JS_FORMAL_PARAMETER@47..48 - 0: JS_DECORATOR_LIST@47..47 - 1: JS_IDENTIFIER_BINDING@47..48 - 0: IDENT@47..48 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: (empty) - 5: R_PAREN@48..50 ")" [] [Whitespace(" ")] - 6: (empty) - 2: R_CURLY@50..51 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@51..124 - 0: TYPE_KW@51..110 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@110..112 - 0: IDENT@110..112 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@112..114 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@114..124 - 0: L_CURLY@114..116 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@116..123 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@116..123 - 0: JS_LITERAL_MEMBER_NAME@116..119 - 0: IDENT@116..119 "set" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@119..123 - 0: L_PAREN@119..120 "(" [] [] - 1: JS_PARAMETER_LIST@120..121 - 0: JS_FORMAL_PARAMETER@120..121 - 0: JS_DECORATOR_LIST@120..120 - 1: JS_IDENTIFIER_BINDING@120..121 - 0: IDENT@120..121 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@121..123 ")" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 2: R_CURLY@123..124 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@124..149 - 0: TYPE_KW@124..130 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@130..132 - 0: IDENT@130..132 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@132..134 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@134..149 - 0: L_CURLY@134..136 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@136..148 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@136..148 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@136..139 - 0: IDENT@136..139 "set" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@139..148 - 0: COLON@139..141 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@141..148 - 0: NUMBER_KW@141..148 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@148..149 "}" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@149..166 - 0: TYPE_KW@149..155 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@155..157 - 0: IDENT@155..157 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@157..159 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@159..166 - 0: L_CURLY@159..161 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@161..165 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@161..165 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@161..165 - 0: IDENT@161..165 "set" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_CURLY@165..166 "}" [] [] - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@166..195 - 0: TYPE_KW@166..172 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@172..174 - 0: IDENT@172..174 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@174..176 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@176..195 - 0: L_CURLY@176..178 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@178..194 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@178..194 - 0: JS_LITERAL_MEMBER_NAME@178..181 - 0: IDENT@178..181 "set" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@181..194 - 0: L_PAREN@181..182 "(" [] [] - 1: JS_PARAMETER_LIST@182..192 - 0: JS_FORMAL_PARAMETER@182..191 - 0: JS_DECORATOR_LIST@182..182 - 1: JS_IDENTIFIER_BINDING@182..183 - 0: IDENT@182..183 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@183..191 - 0: COLON@183..185 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@185..191 - 0: NUMBER_KW@185..191 "number" [] [] - 4: (empty) - 1: COMMA@191..192 "," [] [] - 2: R_PAREN@192..194 ")" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 2: R_CURLY@194..195 "}" [] [] - 5: (empty) - 6: TS_TYPE_ALIAS_DECLARATION@195..216 - 0: TYPE_KW@195..201 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@201..203 - 0: IDENT@201..203 "G" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@203..205 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@205..216 - 0: L_CURLY@205..206 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@206..215 - 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@206..215 - 0: SET_KW@206..210 "set" [] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@210..211 - 0: IDENT@210..211 "a" [] [] - 2: L_PAREN@211..212 "(" [] [] - 3: JS_FORMAL_PARAMETER@212..213 - 0: JS_DECORATOR_LIST@212..212 - 1: JS_IDENTIFIER_BINDING@212..213 - 0: IDENT@212..213 "b" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 4: COMMA@213..214 "," [] [] - 5: R_PAREN@214..215 ")" [] [] - 6: (empty) - 2: R_CURLY@215..216 "}" [] [] - 5: (empty) - 7: TS_TYPE_ALIAS_DECLARATION@216..237 - 0: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@222..224 - 0: IDENT@222..224 "H" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@224..226 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@226..237 - 0: L_CURLY@226..227 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@227..236 - 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@227..236 - 0: JS_LITERAL_MEMBER_NAME@227..230 - 0: IDENT@227..230 "set" [] [] - 1: (empty) - 2: (empty) - 3: JS_PARAMETERS@230..236 - 0: L_PAREN@230..231 "(" [] [] - 1: JS_PARAMETER_LIST@231..234 - 0: JS_FORMAL_PARAMETER@231..232 - 0: JS_DECORATOR_LIST@231..231 - 1: JS_IDENTIFIER_BINDING@231..232 - 0: IDENT@231..232 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@232..234 "," [] [Whitespace(" ")] - 2: R_PAREN@234..236 ")" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 2: R_CURLY@236..237 "}" [] [] - 5: (empty) - 4: EOF@237..238 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.rast b/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.rast deleted file mode 100644 index 096a403bdaba..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.rast +++ /dev/null @@ -1,145 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsTemplateExpression { - tag: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@0..4 "html" [] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@4..5 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@5..6 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@6..8 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@8..9 "B" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@9..10 ">" [] [], - }, - l_tick_token: BACKTICK@10..11 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@11..15 "abcd" [] [], - }, - ], - r_tick_token: BACKTICK@15..16 "`" [] [], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsTemplateExpression { - tag: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..21 "html" [Newline("\n")] [], - }, - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@21..22 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@22..23 "A" [] [], - }, - type_arguments: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@25..26 "B" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@26..27 ">" [] [], - }, - l_tick_token: BACKTICK@27..28 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@28..32 "abcd" [] [], - }, - ], - r_tick_token: BACKTICK@32..33 "`" [] [], - }, - operator_token: DOT@33..34 "." [] [], - member: JsName { - value_token: IDENT@34..41 "_string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@41..42 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..42 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..41 - 0: JS_EXPRESSION_STATEMENT@0..16 - 0: JS_TEMPLATE_EXPRESSION@0..16 - 0: JS_IDENTIFIER_EXPRESSION@0..4 - 0: JS_REFERENCE_IDENTIFIER@0..4 - 0: IDENT@0..4 "html" [] [] - 1: TS_TYPE_ARGUMENTS@4..10 - 0: L_ANGLE@4..5 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@5..9 - 0: TS_REFERENCE_TYPE@5..6 - 0: JS_REFERENCE_IDENTIFIER@5..6 - 0: IDENT@5..6 "A" [] [] - 1: (empty) - 1: COMMA@6..8 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@8..9 - 0: JS_REFERENCE_IDENTIFIER@8..9 - 0: IDENT@8..9 "B" [] [] - 1: (empty) - 2: R_ANGLE@9..10 ">" [] [] - 2: BACKTICK@10..11 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@11..15 - 0: JS_TEMPLATE_CHUNK_ELEMENT@11..15 - 0: TEMPLATE_CHUNK@11..15 "abcd" [] [] - 4: BACKTICK@15..16 "`" [] [] - 1: (empty) - 1: JS_EXPRESSION_STATEMENT@16..41 - 0: JS_STATIC_MEMBER_EXPRESSION@16..41 - 0: JS_TEMPLATE_EXPRESSION@16..33 - 0: JS_IDENTIFIER_EXPRESSION@16..21 - 0: JS_REFERENCE_IDENTIFIER@16..21 - 0: IDENT@16..21 "html" [Newline("\n")] [] - 1: TS_TYPE_ARGUMENTS@21..27 - 0: L_ANGLE@21..22 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@22..26 - 0: TS_REFERENCE_TYPE@22..23 - 0: JS_REFERENCE_IDENTIFIER@22..23 - 0: IDENT@22..23 "A" [] [] - 1: (empty) - 1: COMMA@23..25 "," [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@25..26 - 0: JS_REFERENCE_IDENTIFIER@25..26 - 0: IDENT@25..26 "B" [] [] - 1: (empty) - 2: R_ANGLE@26..27 ">" [] [] - 2: BACKTICK@27..28 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@28..32 - 0: JS_TEMPLATE_CHUNK_ELEMENT@28..32 - 0: TEMPLATE_CHUNK@28..32 "abcd" [] [] - 4: BACKTICK@32..33 "`" [] [] - 1: DOT@33..34 "." [] [] - 2: JS_NAME@34..41 - 0: IDENT@34..41 "_string" [] [] - 1: (empty) - 4: EOF@41..42 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.rast deleted file mode 100644 index c817915525fd..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.rast +++ /dev/null @@ -1,172 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsTemplateLiteralType { - l_tick_token: BACKTICK@9..10 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@10..14 "abcd" [] [], - }, - ], - r_tick_token: BACKTICK@14..15 "`" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@21..23 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@23..25 "=" [] [Whitespace(" ")], - ty: TsTemplateLiteralType { - l_tick_token: BACKTICK@25..26 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@26..27 "a" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@27..29 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@29..30 "A" [] [], - }, - type_arguments: missing (optional), - }, - r_curly_token: R_CURLY@30..31 "}" [] [], - }, - ], - r_tick_token: BACKTICK@31..32 "`" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@38..39 "C" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@39..40 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@40..42 "X" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@42..50 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@50..56 "string" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@56..58 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@58..60 "=" [] [Whitespace(" ")], - ty: TsTemplateLiteralType { - l_tick_token: BACKTICK@60..61 "`" [] [], - elements: TsTemplateElementList [ - TsTemplateChunkElement { - template_chunk_token: TEMPLATE_CHUNK@61..62 "c" [] [], - }, - TsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@62..64 "${" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@64..65 "X" [] [], - }, - type_arguments: missing (optional), - }, - r_curly_token: R_CURLY@65..66 "}" [] [], - }, - ], - r_tick_token: BACKTICK@66..67 "`" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..67 - 0: TS_TYPE_ALIAS_DECLARATION@0..15 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_TEMPLATE_LITERAL_TYPE@9..15 - 0: BACKTICK@9..10 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@10..14 - 0: TS_TEMPLATE_CHUNK_ELEMENT@10..14 - 0: TEMPLATE_CHUNK@10..14 "abcd" [] [] - 2: BACKTICK@14..15 "`" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@15..32 - 0: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@21..23 - 0: IDENT@21..23 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@23..25 "=" [] [Whitespace(" ")] - 4: TS_TEMPLATE_LITERAL_TYPE@25..32 - 0: BACKTICK@25..26 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@26..31 - 0: TS_TEMPLATE_CHUNK_ELEMENT@26..27 - 0: TEMPLATE_CHUNK@26..27 "a" [] [] - 1: TS_TEMPLATE_ELEMENT@27..31 - 0: DOLLAR_CURLY@27..29 "${" [] [] - 1: TS_REFERENCE_TYPE@29..30 - 0: JS_REFERENCE_IDENTIFIER@29..30 - 0: IDENT@29..30 "A" [] [] - 1: (empty) - 2: R_CURLY@30..31 "}" [] [] - 2: BACKTICK@31..32 "`" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@32..67 - 0: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@38..39 - 0: IDENT@38..39 "C" [] [] - 2: TS_TYPE_PARAMETERS@39..58 - 0: L_ANGLE@39..40 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@40..56 - 0: TS_TYPE_PARAMETER@40..56 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@40..40 - 1: TS_TYPE_PARAMETER_NAME@40..42 - 0: IDENT@40..42 "X" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@42..56 - 0: EXTENDS_KW@42..50 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@50..56 - 0: STRING_KW@50..56 "string" [] [] - 3: (empty) - 2: R_ANGLE@56..58 ">" [] [Whitespace(" ")] - 3: EQ@58..60 "=" [] [Whitespace(" ")] - 4: TS_TEMPLATE_LITERAL_TYPE@60..67 - 0: BACKTICK@60..61 "`" [] [] - 1: TS_TEMPLATE_ELEMENT_LIST@61..66 - 0: TS_TEMPLATE_CHUNK_ELEMENT@61..62 - 0: TEMPLATE_CHUNK@61..62 "c" [] [] - 1: TS_TEMPLATE_ELEMENT@62..66 - 0: DOLLAR_CURLY@62..64 "${" [] [] - 1: TS_REFERENCE_TYPE@64..65 - 0: JS_REFERENCE_IDENTIFIER@64..65 - 0: IDENT@64..65 "X" [] [] - 1: (empty) - 2: R_CURLY@65..66 "}" [] [] - 2: BACKTICK@66..67 "`" [] [] - 5: (empty) - 4: EOF@67..68 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.rast b/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.rast deleted file mode 100644 index 3981d132a8f8..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.rast +++ /dev/null @@ -1,115 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@9..10 "a" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@10..11 "(" [] [], - items: JsParameterList [ - TsThisParameter { - this_token: THIS_KW@11..15 "this" [] [], - type_annotation: missing (optional), - }, - ], - r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@17..18 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@19..29 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@29..30 "b" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@30..31 "(" [] [], - items: JsParameterList [ - TsThisParameter { - this_token: THIS_KW@31..35 "this" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@35..37 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@37..43 "string" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@45..46 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@46..47 "}" [] [], - }, - }, - ], - eof_token: EOF@47..48 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..48 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..47 - 0: JS_FUNCTION_DECLARATION@0..19 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@9..10 - 0: IDENT@9..10 "a" [] [] - 4: (empty) - 5: JS_PARAMETERS@10..17 - 0: L_PAREN@10..11 "(" [] [] - 1: JS_PARAMETER_LIST@11..15 - 0: TS_THIS_PARAMETER@11..15 - 0: THIS_KW@11..15 "this" [] [] - 1: (empty) - 2: R_PAREN@15..17 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@17..19 - 0: L_CURLY@17..18 "{" [] [] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..18 - 3: R_CURLY@18..19 "}" [] [] - 1: JS_FUNCTION_DECLARATION@19..47 - 0: (empty) - 1: FUNCTION_KW@19..29 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@29..30 - 0: IDENT@29..30 "b" [] [] - 4: (empty) - 5: JS_PARAMETERS@30..45 - 0: L_PAREN@30..31 "(" [] [] - 1: JS_PARAMETER_LIST@31..43 - 0: TS_THIS_PARAMETER@31..43 - 0: THIS_KW@31..35 "this" [] [] - 1: TS_TYPE_ANNOTATION@35..43 - 0: COLON@35..37 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@37..43 - 0: STRING_KW@37..43 "string" [] [] - 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@45..47 - 0: L_CURLY@45..46 "{" [] [] - 1: JS_DIRECTIVE_LIST@46..46 - 2: JS_STATEMENT_LIST@46..46 - 3: R_CURLY@46..47 "}" [] [] - 4: EOF@47..48 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_this_type.rast deleted file mode 100644 index a38208a681a0..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_this_type.rast +++ /dev/null @@ -1,190 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..8 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@23..24 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@24..38 "type" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@38..40 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@40..42 "=" [] [Whitespace(" ")], - ty: TsThisType { - this_token: THIS_KW@42..46 "this" [] [], - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - ], - r_curly_token: R_CURLY@47..53 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@53..67 "predicate" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@67..68 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@68..69 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: TsThisType { - this_token: THIS_KW@71..76 "this" [] [Whitespace(" ")], - }, - is_token: IS_KW@76..79 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@79..86 "string" [] [Whitespace(" ")], - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@86..87 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@87..103 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsBinaryExpression { - left: JsUnaryExpression { - operator_token: TYPEOF_KW@103..110 "typeof" [] [Whitespace(" ")], - argument: JsThisExpression { - this_token: THIS_KW@110..115 "this" [] [Whitespace(" ")], - }, - }, - operator_token: EQ3@115..119 "===" [] [Whitespace(" ")], - right: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@119..127 "\"string\"" [] [], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@127..133 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@133..135 "}" [Newline("\n")] [], - }, - ], - eof_token: EOF@135..136 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..136 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..135 - 0: JS_CLASS_DECLARATION@0..135 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "A" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@8..9 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@9..133 - 0: JS_METHOD_CLASS_MEMBER@9..53 - 0: JS_METHOD_MODIFIER_LIST@9..9 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@9..20 - 0: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@20..23 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..21 - 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@23..53 - 0: L_CURLY@23..24 "{" [] [] - 1: JS_DIRECTIVE_LIST@24..24 - 2: JS_STATEMENT_LIST@24..47 - 0: TS_TYPE_ALIAS_DECLARATION@24..47 - 0: TYPE_KW@24..38 "type" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@38..40 - 0: IDENT@38..40 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@40..42 "=" [] [Whitespace(" ")] - 4: TS_THIS_TYPE@42..46 - 0: THIS_KW@42..46 "this" [] [] - 5: SEMICOLON@46..47 ";" [] [] - 3: R_CURLY@47..53 "}" [Newline("\n"), Whitespace(" ")] [] - 1: JS_METHOD_CLASS_MEMBER@53..133 - 0: JS_METHOD_MODIFIER_LIST@53..53 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@53..67 - 0: IDENT@53..67 "predicate" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@67..69 - 0: L_PAREN@67..68 "(" [] [] - 1: JS_PARAMETER_LIST@68..68 - 2: R_PAREN@68..69 ")" [] [] - 7: TS_RETURN_TYPE_ANNOTATION@69..86 - 0: COLON@69..71 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@71..86 - 0: TS_THIS_TYPE@71..76 - 0: THIS_KW@71..76 "this" [] [Whitespace(" ")] - 1: IS_KW@76..79 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@79..86 - 0: STRING_KW@79..86 "string" [] [Whitespace(" ")] - 8: JS_FUNCTION_BODY@86..133 - 0: L_CURLY@86..87 "{" [] [] - 1: JS_DIRECTIVE_LIST@87..87 - 2: JS_STATEMENT_LIST@87..127 - 0: JS_RETURN_STATEMENT@87..127 - 0: RETURN_KW@87..103 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@103..127 - 0: JS_UNARY_EXPRESSION@103..115 - 0: TYPEOF_KW@103..110 "typeof" [] [Whitespace(" ")] - 1: JS_THIS_EXPRESSION@110..115 - 0: THIS_KW@110..115 "this" [] [Whitespace(" ")] - 1: EQ3@115..119 "===" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@119..127 - 0: JS_STRING_LITERAL@119..127 "\"string\"" [] [] - 2: (empty) - 3: R_CURLY@127..133 "}" [Newline("\n"), Whitespace(" ")] [] - 9: R_CURLY@133..135 "}" [Newline("\n")] [] - 4: EOF@135..136 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.rast deleted file mode 100644 index 1f94f0f97414..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.rast +++ /dev/null @@ -1,365 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@9..10 "[" [] [], - elements: TsTupleTypeElementList [ - TsStringType { - string_token: STRING_KW@10..16 "string" [] [], - }, - COMMA@16..18 "," [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@18..24 "number" [] [], - }, - COMMA@24..26 "," [] [Whitespace(" ")], - TsAnyType { - any_token: ANY_KW@26..29 "any" [] [], - }, - ], - r_brack_token: R_BRACK@29..30 "]" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@30..36 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@36..38 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@38..40 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@40..41 "[" [] [], - elements: TsTupleTypeElementList [ - TsNamedTupleTypeElement { - dotdotdot_token: missing (optional), - name: JsName { - value_token: IDENT@41..42 "a" [] [], - }, - question_mark_token: missing (optional), - colon_token: COLON@42..44 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@44..50 "string" [] [], - }, - }, - COMMA@50..52 "," [] [Whitespace(" ")], - TsNamedTupleTypeElement { - dotdotdot_token: missing (optional), - name: JsName { - value_token: IDENT@52..53 "b" [] [], - }, - question_mark_token: missing (optional), - colon_token: COLON@53..55 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@55..61 "number" [] [], - }, - }, - COMMA@61..63 "," [] [Whitespace(" ")], - TsNamedTupleTypeElement { - dotdotdot_token: missing (optional), - name: JsName { - value_token: IDENT@63..64 "c" [] [], - }, - question_mark_token: missing (optional), - colon_token: COLON@64..66 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@66..69 "any" [] [], - }, - }, - ], - r_brack_token: R_BRACK@69..70 "]" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@70..76 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@76..78 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@78..80 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@80..81 "[" [] [], - elements: TsTupleTypeElementList [ - TsNamedTupleTypeElement { - dotdotdot_token: missing (optional), - name: JsName { - value_token: IDENT@81..82 "a" [] [], - }, - question_mark_token: missing (optional), - colon_token: COLON@82..84 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@84..90 "string" [] [], - }, - }, - COMMA@90..92 "," [] [Whitespace(" ")], - TsNamedTupleTypeElement { - dotdotdot_token: missing (optional), - name: JsName { - value_token: IDENT@92..93 "b" [] [], - }, - question_mark_token: missing (optional), - colon_token: COLON@93..95 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@95..101 "number" [] [], - }, - }, - COMMA@101..103 "," [] [Whitespace(" ")], - TsNamedTupleTypeElement { - dotdotdot_token: DOT3@103..106 "..." [] [], - name: JsName { - value_token: IDENT@106..107 "c" [] [], - }, - question_mark_token: missing (optional), - colon_token: COLON@107..109 ":" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsAnyType { - any_token: ANY_KW@109..112 "any" [] [], - }, - l_brack_token: L_BRACK@112..113 "[" [] [], - r_brack_token: R_BRACK@113..114 "]" [] [], - }, - }, - ], - r_brack_token: R_BRACK@114..115 "]" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@121..123 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@123..125 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@125..126 "[" [] [], - elements: TsTupleTypeElementList [ - TsNamedTupleTypeElement { - dotdotdot_token: missing (optional), - name: JsName { - value_token: IDENT@126..127 "a" [] [], - }, - question_mark_token: QUESTION@127..128 "?" [] [], - colon_token: COLON@128..130 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@130..136 "string" [] [], - }, - }, - ], - r_brack_token: R_BRACK@136..137 "]" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@137..143 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@143..145 "E" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@145..147 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@147..148 "[" [] [], - elements: TsTupleTypeElementList [ - TsRestTupleTypeElement { - dotdotdot_token: DOT3@148..151 "..." [] [], - ty: TsArrayType { - element_type: TsStringType { - string_token: STRING_KW@151..157 "string" [] [], - }, - l_brack_token: L_BRACK@157..158 "[" [] [], - r_brack_token: R_BRACK@158..159 "]" [] [], - }, - }, - ], - r_brack_token: R_BRACK@159..160 "]" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@160..166 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@166..168 "F" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@168..170 "=" [] [Whitespace(" ")], - ty: TsTupleType { - l_brack_token: L_BRACK@170..171 "[" [] [], - elements: TsTupleTypeElementList [ - TsOptionalTupleTypeElement { - ty: TsStringType { - string_token: STRING_KW@171..177 "string" [] [], - }, - question_mark_token: QUESTION@177..178 "?" [] [], - }, - ], - r_brack_token: R_BRACK@178..179 "]" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@179..180 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..180 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..179 - 0: TS_TYPE_ALIAS_DECLARATION@0..30 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@9..30 - 0: L_BRACK@9..10 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@10..29 - 0: TS_STRING_TYPE@10..16 - 0: STRING_KW@10..16 "string" [] [] - 1: COMMA@16..18 "," [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@18..24 - 0: NUMBER_KW@18..24 "number" [] [] - 3: COMMA@24..26 "," [] [Whitespace(" ")] - 4: TS_ANY_TYPE@26..29 - 0: ANY_KW@26..29 "any" [] [] - 2: R_BRACK@29..30 "]" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@30..70 - 0: TYPE_KW@30..36 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@36..38 - 0: IDENT@36..38 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@38..40 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@40..70 - 0: L_BRACK@40..41 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@41..69 - 0: TS_NAMED_TUPLE_TYPE_ELEMENT@41..50 - 0: (empty) - 1: JS_NAME@41..42 - 0: IDENT@41..42 "a" [] [] - 2: (empty) - 3: COLON@42..44 ":" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@44..50 - 0: STRING_KW@44..50 "string" [] [] - 1: COMMA@50..52 "," [] [Whitespace(" ")] - 2: TS_NAMED_TUPLE_TYPE_ELEMENT@52..61 - 0: (empty) - 1: JS_NAME@52..53 - 0: IDENT@52..53 "b" [] [] - 2: (empty) - 3: COLON@53..55 ":" [] [Whitespace(" ")] - 4: TS_NUMBER_TYPE@55..61 - 0: NUMBER_KW@55..61 "number" [] [] - 3: COMMA@61..63 "," [] [Whitespace(" ")] - 4: TS_NAMED_TUPLE_TYPE_ELEMENT@63..69 - 0: (empty) - 1: JS_NAME@63..64 - 0: IDENT@63..64 "c" [] [] - 2: (empty) - 3: COLON@64..66 ":" [] [Whitespace(" ")] - 4: TS_ANY_TYPE@66..69 - 0: ANY_KW@66..69 "any" [] [] - 2: R_BRACK@69..70 "]" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@70..115 - 0: TYPE_KW@70..76 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@76..78 - 0: IDENT@76..78 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@78..80 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@80..115 - 0: L_BRACK@80..81 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@81..114 - 0: TS_NAMED_TUPLE_TYPE_ELEMENT@81..90 - 0: (empty) - 1: JS_NAME@81..82 - 0: IDENT@81..82 "a" [] [] - 2: (empty) - 3: COLON@82..84 ":" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@84..90 - 0: STRING_KW@84..90 "string" [] [] - 1: COMMA@90..92 "," [] [Whitespace(" ")] - 2: TS_NAMED_TUPLE_TYPE_ELEMENT@92..101 - 0: (empty) - 1: JS_NAME@92..93 - 0: IDENT@92..93 "b" [] [] - 2: (empty) - 3: COLON@93..95 ":" [] [Whitespace(" ")] - 4: TS_NUMBER_TYPE@95..101 - 0: NUMBER_KW@95..101 "number" [] [] - 3: COMMA@101..103 "," [] [Whitespace(" ")] - 4: TS_NAMED_TUPLE_TYPE_ELEMENT@103..114 - 0: DOT3@103..106 "..." [] [] - 1: JS_NAME@106..107 - 0: IDENT@106..107 "c" [] [] - 2: (empty) - 3: COLON@107..109 ":" [] [Whitespace(" ")] - 4: TS_ARRAY_TYPE@109..114 - 0: TS_ANY_TYPE@109..112 - 0: ANY_KW@109..112 "any" [] [] - 1: L_BRACK@112..113 "[" [] [] - 2: R_BRACK@113..114 "]" [] [] - 2: R_BRACK@114..115 "]" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@115..137 - 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@121..123 - 0: IDENT@121..123 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@123..125 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@125..137 - 0: L_BRACK@125..126 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@126..136 - 0: TS_NAMED_TUPLE_TYPE_ELEMENT@126..136 - 0: (empty) - 1: JS_NAME@126..127 - 0: IDENT@126..127 "a" [] [] - 2: QUESTION@127..128 "?" [] [] - 3: COLON@128..130 ":" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@130..136 - 0: STRING_KW@130..136 "string" [] [] - 2: R_BRACK@136..137 "]" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@137..160 - 0: TYPE_KW@137..143 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@143..145 - 0: IDENT@143..145 "E" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@145..147 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@147..160 - 0: L_BRACK@147..148 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@148..159 - 0: TS_REST_TUPLE_TYPE_ELEMENT@148..159 - 0: DOT3@148..151 "..." [] [] - 1: TS_ARRAY_TYPE@151..159 - 0: TS_STRING_TYPE@151..157 - 0: STRING_KW@151..157 "string" [] [] - 1: L_BRACK@157..158 "[" [] [] - 2: R_BRACK@158..159 "]" [] [] - 2: R_BRACK@159..160 "]" [] [] - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@160..179 - 0: TYPE_KW@160..166 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@166..168 - 0: IDENT@166..168 "F" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@168..170 "=" [] [Whitespace(" ")] - 4: TS_TUPLE_TYPE@170..179 - 0: L_BRACK@170..171 "[" [] [] - 1: TS_TUPLE_TYPE_ELEMENT_LIST@171..178 - 0: TS_OPTIONAL_TUPLE_TYPE_ELEMENT@171..178 - 0: TS_STRING_TYPE@171..177 - 0: STRING_KW@171..177 "string" [] [] - 1: QUESTION@177..178 "?" [] [] - 2: R_BRACK@178..179 "]" [] [] - 5: (empty) - 4: EOF@179..180 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast deleted file mode 100644 index 34898894824f..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast +++ /dev/null @@ -1,170 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..6 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@6..7 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@7..8 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@8..10 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@10..12 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@12..13 "T" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@13..14 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@14..20 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@20..22 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@22..24 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@24..25 "A" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@25..26 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsFunctionType { - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@26..27 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@27..28 "C" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@28..29 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@29..30 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@30..31 "c" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@31..33 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@33..34 "C" [] [], - }, - type_arguments: missing (optional), - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@36..39 "=>" [] [Whitespace(" ")], - return_type: TsUndefinedType { - undefined_token: UNDEFINED_KW@39..48 "undefined" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@48..49 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@49..50 ";" [] [], - }, - ], - eof_token: EOF@50..51 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..51 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..50 - 0: TS_TYPE_ALIAS_DECLARATION@0..14 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..6 - 0: IDENT@5..6 "A" [] [] - 2: TS_TYPE_PARAMETERS@6..10 - 0: L_ANGLE@6..7 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@7..8 - 0: TS_TYPE_PARAMETER@7..8 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 - 1: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@8..10 ">" [] [Whitespace(" ")] - 3: EQ@10..12 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@12..13 - 0: JS_REFERENCE_IDENTIFIER@12..13 - 0: IDENT@12..13 "T" [] [] - 1: (empty) - 5: SEMICOLON@13..14 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@14..50 - 0: TYPE_KW@14..20 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@20..22 - 0: IDENT@20..22 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@22..24 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@24..49 - 0: JS_REFERENCE_IDENTIFIER@24..25 - 0: IDENT@24..25 "A" [] [] - 1: TS_TYPE_ARGUMENTS@25..49 - 0: L_ANGLE@25..26 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@26..48 - 0: TS_FUNCTION_TYPE@26..48 - 0: TS_TYPE_PARAMETERS@26..29 - 0: L_ANGLE@26..27 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@27..28 - 0: TS_TYPE_PARAMETER@27..28 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@27..27 - 1: TS_TYPE_PARAMETER_NAME@27..28 - 0: IDENT@27..28 "C" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@28..29 ">" [] [] - 1: JS_PARAMETERS@29..36 - 0: L_PAREN@29..30 "(" [] [] - 1: JS_PARAMETER_LIST@30..34 - 0: JS_FORMAL_PARAMETER@30..34 - 0: JS_DECORATOR_LIST@30..30 - 1: JS_IDENTIFIER_BINDING@30..31 - 0: IDENT@30..31 "c" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@31..34 - 0: COLON@31..33 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@33..34 - 0: JS_REFERENCE_IDENTIFIER@33..34 - 0: IDENT@33..34 "C" [] [] - 1: (empty) - 4: (empty) - 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@36..39 "=>" [] [Whitespace(" ")] - 3: TS_UNDEFINED_TYPE@39..48 - 0: UNDEFINED_KW@39..48 "undefined" [] [] - 2: R_ANGLE@48..49 ">" [] [] - 5: SEMICOLON@49..50 ";" [] [] - 4: EOF@50..51 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.rast deleted file mode 100644 index de3aacba23b2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.rast +++ /dev/null @@ -1,52 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@0..2 "0" [] [Whitespace(" ")], - }, - operator_token: L_ANGLE@2..4 "<" [] [Whitespace(" ")], - right: JsParenthesizedExpression { - l_paren_token: L_PAREN@4..5 "(" [] [], - expression: JsBinaryExpression { - left: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@5..7 "0" [] [Whitespace(" ")], - }, - operator_token: GTEQ@7..10 ">=" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@10..11 "1" [] [], - }, - }, - r_paren_token: R_PAREN@11..12 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - ], - eof_token: EOF@13..14 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..14 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..13 - 0: JS_EXPRESSION_STATEMENT@0..13 - 0: JS_BINARY_EXPRESSION@0..12 - 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 - 0: JS_NUMBER_LITERAL@0..2 "0" [] [Whitespace(" ")] - 1: L_ANGLE@2..4 "<" [] [Whitespace(" ")] - 2: JS_PARENTHESIZED_EXPRESSION@4..12 - 0: L_PAREN@4..5 "(" [] [] - 1: JS_BINARY_EXPRESSION@5..11 - 0: JS_NUMBER_LITERAL_EXPRESSION@5..7 - 0: JS_NUMBER_LITERAL@5..7 "0" [] [Whitespace(" ")] - 1: GTEQ@7..10 ">=" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@10..11 - 0: JS_NUMBER_LITERAL@10..11 "1" [] [] - 2: R_PAREN@11..12 ")" [] [] - 1: SEMICOLON@12..13 ";" [] [] - 4: EOF@13..14 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.rast deleted file mode 100644 index b64bc10f1cbb..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@8..9 "<" [] [], - ty: TsNumberType { - number_token: NUMBER_KW@9..15 "number" [] [], - }, - r_angle_token: R_ANGLE@15..16 ">" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "b" [] [], - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@17..18 ";" [] [], - }, - ], - eof_token: EOF@18..19 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..19 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..18 - 0: JS_VARIABLE_STATEMENT@0..18 - 0: JS_VARIABLE_DECLARATION@0..17 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..17 - 0: JS_VARIABLE_DECLARATOR@4..17 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..17 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: TS_TYPE_ASSERTION_EXPRESSION@8..17 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_NUMBER_TYPE@9..15 - 0: NUMBER_KW@9..15 "number" [] [] - 2: R_ANGLE@15..16 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "b" [] [] - 1: SEMICOLON@17..18 ";" [] [] - 4: EOF@18..19 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast deleted file mode 100644 index 0688d3081053..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast +++ /dev/null @@ -1,213 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@8..9 "<" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@9..14 "const" [] [], - }, - type_arguments: missing (optional), - }, - r_angle_token: R_ANGLE@14..15 ">" [] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@15..22 "\"hello\"" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@22..23 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@28..30 "y" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@30..32 "=" [] [Whitespace(" ")], - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@32..33 "<" [] [], - ty: TsStringType { - string_token: STRING_KW@33..39 "string" [] [], - }, - r_angle_token: R_ANGLE@39..41 ">" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..42 "x" [] [], - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@43..48 "var" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@48..50 "d" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@50..52 "=" [] [Whitespace(" ")], - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@52..53 "<" [] [], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@53..58 "Error" [] [], - }, - type_arguments: missing (optional), - }, - r_angle_token: R_ANGLE@58..59 ">" [] [], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@59..60 "(" [] [], - expression: JsObjectExpression { - l_curly_token: L_CURLY@60..62 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@62..66 "name" [] [], - }, - colon_token: COLON@66..68 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@68..73 "\"foo\"" [] [], - }, - }, - COMMA@73..75 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@75..82 "message" [] [], - }, - colon_token: COLON@82..84 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@84..90 "\"bar\"" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@90..91 "}" [] [], - }, - r_paren_token: R_PAREN@91..92 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@92..93 ";" [] [], - }, - ], - eof_token: EOF@93..94 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..94 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..93 - 0: JS_VARIABLE_STATEMENT@0..23 - 0: JS_VARIABLE_DECLARATION@0..22 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..22 - 0: JS_VARIABLE_DECLARATOR@4..22 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..22 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: TS_TYPE_ASSERTION_EXPRESSION@8..22 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_REFERENCE_TYPE@9..14 - 0: JS_REFERENCE_IDENTIFIER@9..14 - 0: IDENT@9..14 "const" [] [] - 1: (empty) - 2: R_ANGLE@14..15 ">" [] [] - 3: JS_STRING_LITERAL_EXPRESSION@15..22 - 0: JS_STRING_LITERAL@15..22 "\"hello\"" [] [] - 1: SEMICOLON@22..23 ";" [] [] - 1: JS_VARIABLE_STATEMENT@23..43 - 0: JS_VARIABLE_DECLARATION@23..42 - 0: (empty) - 1: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@28..42 - 0: JS_VARIABLE_DECLARATOR@28..42 - 0: JS_IDENTIFIER_BINDING@28..30 - 0: IDENT@28..30 "y" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@30..42 - 0: EQ@30..32 "=" [] [Whitespace(" ")] - 1: TS_TYPE_ASSERTION_EXPRESSION@32..42 - 0: L_ANGLE@32..33 "<" [] [] - 1: TS_STRING_TYPE@33..39 - 0: STRING_KW@33..39 "string" [] [] - 2: R_ANGLE@39..41 ">" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_EXPRESSION@41..42 - 0: JS_REFERENCE_IDENTIFIER@41..42 - 0: IDENT@41..42 "x" [] [] - 1: SEMICOLON@42..43 ";" [] [] - 2: JS_VARIABLE_STATEMENT@43..93 - 0: JS_VARIABLE_DECLARATION@43..92 - 0: (empty) - 1: VAR_KW@43..48 "var" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@48..92 - 0: JS_VARIABLE_DECLARATOR@48..92 - 0: JS_IDENTIFIER_BINDING@48..50 - 0: IDENT@48..50 "d" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@50..92 - 0: EQ@50..52 "=" [] [Whitespace(" ")] - 1: TS_TYPE_ASSERTION_EXPRESSION@52..92 - 0: L_ANGLE@52..53 "<" [] [] - 1: TS_REFERENCE_TYPE@53..58 - 0: JS_REFERENCE_IDENTIFIER@53..58 - 0: IDENT@53..58 "Error" [] [] - 1: (empty) - 2: R_ANGLE@58..59 ">" [] [] - 3: JS_PARENTHESIZED_EXPRESSION@59..92 - 0: L_PAREN@59..60 "(" [] [] - 1: JS_OBJECT_EXPRESSION@60..91 - 0: L_CURLY@60..62 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@62..90 - 0: JS_PROPERTY_OBJECT_MEMBER@62..73 - 0: JS_LITERAL_MEMBER_NAME@62..66 - 0: IDENT@62..66 "name" [] [] - 1: COLON@66..68 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@68..73 - 0: JS_STRING_LITERAL@68..73 "\"foo\"" [] [] - 1: COMMA@73..75 "," [] [Whitespace(" ")] - 2: JS_PROPERTY_OBJECT_MEMBER@75..90 - 0: JS_LITERAL_MEMBER_NAME@75..82 - 0: IDENT@75..82 "message" [] [] - 1: COLON@82..84 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@84..90 - 0: JS_STRING_LITERAL@84..90 "\"bar\"" [] [Whitespace(" ")] - 2: R_CURLY@90..91 "}" [] [] - 2: R_PAREN@91..92 ")" [] [] - 1: SEMICOLON@92..93 ";" [] [] - 4: EOF@93..94 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast deleted file mode 100644 index 577bde6eda1d..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast +++ /dev/null @@ -1,171 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..6 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@6..7 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@7..9 "X" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@17..23 "number" [] [], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@23..25 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@25..27 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@27..28 "X" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@35..36 "B" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@36..37 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@37..39 "X" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsNumberType { - number_token: NUMBER_KW@47..54 "number" [] [Whitespace(" ")], - }, - PIPE@54..56 "|" [] [Whitespace(" ")], - TsStringType { - string_token: STRING_KW@56..62 "string" [] [], - }, - ], - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@62..64 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@64..66 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@68..69 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@69..71 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@71..73 "X" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@73..74 "}" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..74 - 0: TS_TYPE_ALIAS_DECLARATION@0..29 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..6 - 0: IDENT@5..6 "A" [] [] - 2: TS_TYPE_PARAMETERS@6..25 - 0: L_ANGLE@6..7 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@7..23 - 0: TS_TYPE_PARAMETER@7..23 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 - 1: TS_TYPE_PARAMETER_NAME@7..9 - 0: IDENT@7..9 "X" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@9..23 - 0: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@17..23 - 0: NUMBER_KW@17..23 "number" [] [] - 3: (empty) - 2: R_ANGLE@23..25 ">" [] [Whitespace(" ")] - 3: EQ@25..27 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@27..28 - 0: JS_REFERENCE_IDENTIFIER@27..28 - 0: IDENT@27..28 "X" [] [] - 1: (empty) - 5: SEMICOLON@28..29 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@29..74 - 0: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@35..36 - 0: IDENT@35..36 "B" [] [] - 2: TS_TYPE_PARAMETERS@36..64 - 0: L_ANGLE@36..37 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@37..62 - 0: TS_TYPE_PARAMETER@37..62 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@37..37 - 1: TS_TYPE_PARAMETER_NAME@37..39 - 0: IDENT@37..39 "X" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@39..62 - 0: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@47..62 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@47..62 - 0: TS_NUMBER_TYPE@47..54 - 0: NUMBER_KW@47..54 "number" [] [Whitespace(" ")] - 1: PIPE@54..56 "|" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@56..62 - 0: STRING_KW@56..62 "string" [] [] - 3: (empty) - 2: R_ANGLE@62..64 ">" [] [Whitespace(" ")] - 3: EQ@64..66 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@66..74 - 0: L_CURLY@66..68 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@68..73 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@68..73 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@68..69 - 0: IDENT@68..69 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@69..73 - 0: COLON@69..71 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@71..73 - 0: JS_REFERENCE_IDENTIFIER@71..73 - 0: IDENT@71..73 "X" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 2: R_CURLY@73..74 "}" [] [] - 5: (empty) - 4: EOF@74..75 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.rast deleted file mode 100644 index c99947ec60ad..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.rast +++ /dev/null @@ -1,54 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..15 "StringBox" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@15..17 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@17..20 "Box" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@20..21 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@21..27 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@27..28 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - ], - eof_token: EOF@29..30 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..30 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..29 - 0: TS_TYPE_ALIAS_DECLARATION@0..29 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..15 - 0: IDENT@5..15 "StringBox" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@15..17 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@17..28 - 0: JS_REFERENCE_IDENTIFIER@17..20 - 0: IDENT@17..20 "Box" [] [] - 1: TS_TYPE_ARGUMENTS@20..28 - 0: L_ANGLE@20..21 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@21..27 - 0: TS_STRING_TYPE@21..27 - 0: STRING_KW@21..27 "string" [] [] - 2: R_ANGLE@27..28 ">" [] [] - 5: SEMICOLON@28..29 ";" [] [] - 4: EOF@29..30 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.rast deleted file mode 100644 index d3df2784c826..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.rast +++ /dev/null @@ -1,220 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@11..12 "x" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@12..14 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@14..20 "string" [] [], - }, - }, - separator_token: COMMA@20..22 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@22..23 "y" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@25..32 "number" [] [Whitespace(" ")], - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@32..33 "}" [] [], - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@40..42 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@42..44 "=" [] [Whitespace(" ")], - ty: TsTypeOperatorType { - operator_token: KEYOF_KW@44..50 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@50..51 "A" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@51..52 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@52..58 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@58..60 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@60..62 "=" [] [Whitespace(" ")], - ty: TsTypeOperatorType { - operator_token: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")], - ty: TsArrayType { - element_type: TsStringType { - string_token: STRING_KW@71..77 "string" [] [], - }, - l_brack_token: L_BRACK@77..78 "[" [] [], - r_brack_token: R_BRACK@78..79 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@79..80 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@80..87 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@87..88 "d" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@88..90 ":" [] [Whitespace(" ")], - ty: TsTypeOperatorType { - operator_token: UNIQUE_KW@90..97 "unique" [] [Whitespace(" ")], - ty: TsSymbolType { - symbol_token: SYMBOL_KW@97..104 "symbol" [] [Whitespace(" ")], - }, - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@104..106 "=" [] [Whitespace(" ")], - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@106..112 "Symbol" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@112..113 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@113..114 ")" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - ], - eof_token: EOF@115..116 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..116 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..115 - 0: TS_TYPE_ALIAS_DECLARATION@0..34 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@9..33 - 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@11..32 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@11..22 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@11..12 - 0: IDENT@11..12 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@12..20 - 0: COLON@12..14 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@14..20 - 0: STRING_KW@14..20 "string" [] [] - 4: COMMA@20..22 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@22..32 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@22..23 - 0: IDENT@22..23 "y" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@23..32 - 0: COLON@23..25 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@25..32 - 0: NUMBER_KW@25..32 "number" [] [Whitespace(" ")] - 4: (empty) - 2: R_CURLY@32..33 "}" [] [] - 5: SEMICOLON@33..34 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@34..52 - 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@42..44 "=" [] [Whitespace(" ")] - 4: TS_TYPE_OPERATOR_TYPE@44..51 - 0: KEYOF_KW@44..50 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@50..51 - 0: JS_REFERENCE_IDENTIFIER@50..51 - 0: IDENT@50..51 "A" [] [] - 1: (empty) - 5: SEMICOLON@51..52 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@52..80 - 0: TYPE_KW@52..58 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@58..60 - 0: IDENT@58..60 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@60..62 "=" [] [Whitespace(" ")] - 4: TS_TYPE_OPERATOR_TYPE@62..79 - 0: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")] - 1: TS_ARRAY_TYPE@71..79 - 0: TS_STRING_TYPE@71..77 - 0: STRING_KW@71..77 "string" [] [] - 1: L_BRACK@77..78 "[" [] [] - 2: R_BRACK@78..79 "]" [] [] - 5: SEMICOLON@79..80 ";" [] [] - 3: JS_VARIABLE_STATEMENT@80..115 - 0: JS_VARIABLE_DECLARATION@80..114 - 0: (empty) - 1: CONST_KW@80..87 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@87..114 - 0: JS_VARIABLE_DECLARATOR@87..114 - 0: JS_IDENTIFIER_BINDING@87..88 - 0: IDENT@87..88 "d" [] [] - 1: TS_TYPE_ANNOTATION@88..104 - 0: COLON@88..90 ":" [] [Whitespace(" ")] - 1: TS_TYPE_OPERATOR_TYPE@90..104 - 0: UNIQUE_KW@90..97 "unique" [] [Whitespace(" ")] - 1: TS_SYMBOL_TYPE@97..104 - 0: SYMBOL_KW@97..104 "symbol" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@104..114 - 0: EQ@104..106 "=" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@106..114 - 0: JS_IDENTIFIER_EXPRESSION@106..112 - 0: JS_REFERENCE_IDENTIFIER@106..112 - 0: IDENT@106..112 "Symbol" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@112..114 - 0: L_PAREN@112..113 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@113..113 - 2: R_PAREN@113..114 ")" [] [] - 1: SEMICOLON@114..115 ";" [] [] - 4: EOF@115..116 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.rast deleted file mode 100644 index bd1217a1a84e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.rast +++ /dev/null @@ -1,288 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..6 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@6..7 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@7..9 "X" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@17..23 "string" [] [], - }, - }, - default: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@25..27 "Y" [] [Whitespace(" ")], - }, - constraint: missing (optional), - default: TsDefaultTypeClause { - eq_token: EQ@27..29 "=" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@29..35 "number" [] [], - }, - }, - }, - COMMA@35..37 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@37..39 "Z" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@47..54 "string" [] [Whitespace(" ")], - }, - PIPE@54..56 "|" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@56..63 "number" [] [Whitespace(" ")], - }, - ], - }, - }, - default: TsDefaultTypeClause { - eq_token: EQ@63..65 "=" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@65..71 "number" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@71..73 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@75..77 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@77..78 "x" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@78..80 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@80..81 "X" [] [], - }, - type_arguments: missing (optional), - }, - }, - separator_token: COMMA@81..83 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@83..84 "y" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@84..86 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@86..87 "Y" [] [], - }, - type_arguments: missing (optional), - }, - }, - separator_token: COMMA@87..89 "," [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@89..90 "z" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@90..92 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@92..94 "Z" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - separator_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@94..95 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@101..102 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@102..103 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@103..105 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@105..107 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@107..108 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@108..109 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@109..120 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@120..121 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@121..122 "<" [] [], - items: TsTypeParameterList [], - r_angle_token: R_ANGLE@122..124 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@124..125 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@125..126 "}" [] [], - }, - ], - eof_token: EOF@126..127 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..127 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..126 - 0: TS_TYPE_ALIAS_DECLARATION@0..95 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..6 - 0: IDENT@5..6 "A" [] [] - 2: TS_TYPE_PARAMETERS@6..73 - 0: L_ANGLE@6..7 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@7..71 - 0: TS_TYPE_PARAMETER@7..23 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 - 1: TS_TYPE_PARAMETER_NAME@7..9 - 0: IDENT@7..9 "X" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@9..23 - 0: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@17..23 - 0: STRING_KW@17..23 "string" [] [] - 3: (empty) - 1: COMMA@23..25 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@25..35 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@25..25 - 1: TS_TYPE_PARAMETER_NAME@25..27 - 0: IDENT@25..27 "Y" [] [Whitespace(" ")] - 2: (empty) - 3: TS_DEFAULT_TYPE_CLAUSE@27..35 - 0: EQ@27..29 "=" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@29..35 - 0: NUMBER_KW@29..35 "number" [] [] - 3: COMMA@35..37 "," [] [Whitespace(" ")] - 4: TS_TYPE_PARAMETER@37..71 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@37..37 - 1: TS_TYPE_PARAMETER_NAME@37..39 - 0: IDENT@37..39 "Z" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@39..63 - 0: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")] - 1: TS_UNION_TYPE@47..63 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@47..63 - 0: TS_STRING_TYPE@47..54 - 0: STRING_KW@47..54 "string" [] [Whitespace(" ")] - 1: PIPE@54..56 "|" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@56..63 - 0: NUMBER_KW@56..63 "number" [] [Whitespace(" ")] - 3: TS_DEFAULT_TYPE_CLAUSE@63..71 - 0: EQ@63..65 "=" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@65..71 - 0: NUMBER_KW@65..71 "number" [] [] - 2: R_ANGLE@71..73 ">" [] [Whitespace(" ")] - 3: EQ@73..75 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@75..95 - 0: L_CURLY@75..77 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@77..94 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@77..83 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@77..78 - 0: IDENT@77..78 "x" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@78..81 - 0: COLON@78..80 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@80..81 - 0: JS_REFERENCE_IDENTIFIER@80..81 - 0: IDENT@80..81 "X" [] [] - 1: (empty) - 4: COMMA@81..83 "," [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@83..89 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@83..84 - 0: IDENT@83..84 "y" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@84..87 - 0: COLON@84..86 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@86..87 - 0: JS_REFERENCE_IDENTIFIER@86..87 - 0: IDENT@86..87 "Y" [] [] - 1: (empty) - 4: COMMA@87..89 "," [] [Whitespace(" ")] - 2: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@89..94 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@89..90 - 0: IDENT@89..90 "z" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@90..94 - 0: COLON@90..92 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@92..94 - 0: JS_REFERENCE_IDENTIFIER@92..94 - 0: IDENT@92..94 "Z" [] [Whitespace(" ")] - 1: (empty) - 4: (empty) - 2: R_CURLY@94..95 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@95..109 - 0: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@101..102 - 0: IDENT@101..102 "A" [] [] - 2: TS_TYPE_PARAMETERS@102..105 - 0: L_ANGLE@102..103 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@103..103 - 2: R_ANGLE@103..105 ">" [] [Whitespace(" ")] - 3: EQ@105..107 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@107..109 - 0: L_CURLY@107..108 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@108..108 - 2: R_CURLY@108..109 "}" [] [] - 5: (empty) - 2: TS_INTERFACE_DECLARATION@109..126 - 0: INTERFACE_KW@109..120 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@120..121 - 0: IDENT@120..121 "A" [] [] - 2: TS_TYPE_PARAMETERS@121..124 - 0: L_ANGLE@121..122 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@122..122 - 2: R_ANGLE@122..124 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@124..125 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@125..125 - 6: R_CURLY@125..126 "}" [] [] - 4: EOF@126..127 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.rast deleted file mode 100644 index 1c9f65e59d01..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.rast +++ /dev/null @@ -1,272 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@9..10 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@10..11 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], - return_type: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@16..18 "a" [] [Whitespace(" ")], - }, - is_token: IS_KW@18..21 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@21..27 "string" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@27..28 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@34..36 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@36..38 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@39..40 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")], - return_type: TsAssertsReturnType { - asserts_token: ASSERTS_KW@45..53 "asserts" [] [Whitespace(" ")], - parameter_name: JsReferenceIdentifier { - value_token: IDENT@53..55 "a" [] [Whitespace(" ")], - }, - predicate: TsAssertsCondition { - is_token: IS_KW@55..58 "is" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@58..64 "string" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@64..65 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@71..73 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@73..75 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@75..76 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@76..77 "a" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@77..79 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")], - return_type: TsAssertsReturnType { - asserts_token: ASSERTS_KW@82..90 "asserts" [] [Whitespace(" ")], - parameter_name: JsReferenceIdentifier { - value_token: IDENT@90..91 "a" [] [], - }, - predicate: missing (optional), - }, - }, - semicolon_token: SEMICOLON@91..92 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@92..98 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@98..106 "asserts" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@106..108 "=" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@108..114 "string" [] [], - }, - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@121..123 "D" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@123..125 "=" [] [Whitespace(" ")], - ty: TsFunctionType { - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@125..126 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@126..128 ")" [] [Whitespace(" ")], - }, - fat_arrow_token: FAT_ARROW@128..131 "=>" [] [Whitespace(" ")], - return_type: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@131..138 "asserts" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@138..139 ";" [] [], - }, - ], - eof_token: EOF@139..140 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..140 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..139 - 0: TS_TYPE_ALIAS_DECLARATION@0..28 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@9..27 - 0: (empty) - 1: JS_PARAMETERS@9..13 - 0: L_PAREN@9..10 "(" [] [] - 1: JS_PARAMETER_LIST@10..11 - 0: JS_FORMAL_PARAMETER@10..11 - 0: JS_DECORATOR_LIST@10..10 - 1: JS_IDENTIFIER_BINDING@10..11 - 0: IDENT@10..11 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] - 3: TS_PREDICATE_RETURN_TYPE@16..27 - 0: JS_REFERENCE_IDENTIFIER@16..18 - 0: IDENT@16..18 "a" [] [Whitespace(" ")] - 1: IS_KW@18..21 "is" [] [Whitespace(" ")] - 2: TS_STRING_TYPE@21..27 - 0: STRING_KW@21..27 "string" [] [] - 5: SEMICOLON@27..28 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@28..65 - 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@34..36 - 0: IDENT@34..36 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@36..38 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@38..64 - 0: (empty) - 1: JS_PARAMETERS@38..42 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..40 - 0: JS_FORMAL_PARAMETER@39..40 - 0: JS_DECORATOR_LIST@39..39 - 1: JS_IDENTIFIER_BINDING@39..40 - 0: IDENT@39..40 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")] - 3: TS_ASSERTS_RETURN_TYPE@45..64 - 0: ASSERTS_KW@45..53 "asserts" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@53..55 - 0: IDENT@53..55 "a" [] [Whitespace(" ")] - 2: TS_ASSERTS_CONDITION@55..64 - 0: IS_KW@55..58 "is" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@58..64 - 0: STRING_KW@58..64 "string" [] [] - 5: SEMICOLON@64..65 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@65..92 - 0: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@71..73 - 0: IDENT@71..73 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@73..75 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@75..91 - 0: (empty) - 1: JS_PARAMETERS@75..79 - 0: L_PAREN@75..76 "(" [] [] - 1: JS_PARAMETER_LIST@76..77 - 0: JS_FORMAL_PARAMETER@76..77 - 0: JS_DECORATOR_LIST@76..76 - 1: JS_IDENTIFIER_BINDING@76..77 - 0: IDENT@76..77 "a" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@77..79 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")] - 3: TS_ASSERTS_RETURN_TYPE@82..91 - 0: ASSERTS_KW@82..90 "asserts" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@90..91 - 0: IDENT@90..91 "a" [] [] - 2: (empty) - 5: SEMICOLON@91..92 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@92..115 - 0: TYPE_KW@92..98 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@98..106 - 0: IDENT@98..106 "asserts" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@106..108 "=" [] [Whitespace(" ")] - 4: TS_STRING_TYPE@108..114 - 0: STRING_KW@108..114 "string" [] [] - 5: SEMICOLON@114..115 ";" [] [] - 4: TS_TYPE_ALIAS_DECLARATION@115..139 - 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@121..123 - 0: IDENT@121..123 "D" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@123..125 "=" [] [Whitespace(" ")] - 4: TS_FUNCTION_TYPE@125..138 - 0: (empty) - 1: JS_PARAMETERS@125..128 - 0: L_PAREN@125..126 "(" [] [] - 1: JS_PARAMETER_LIST@126..126 - 2: R_PAREN@126..128 ")" [] [Whitespace(" ")] - 2: FAT_ARROW@128..131 "=>" [] [Whitespace(" ")] - 3: TS_REFERENCE_TYPE@131..138 - 0: JS_REFERENCE_IDENTIFIER@131..138 - 0: IDENT@131..138 "asserts" [] [] - 1: (empty) - 5: SEMICOLON@138..139 ";" [] [] - 4: EOF@139..140 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.rast deleted file mode 100644 index c57f416e50ca..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.rast +++ /dev/null @@ -1,130 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "type" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@8..9 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsIdentifierAssignment { - name_token: IDENT@9..15 "type" [Newline("\n")] [Whitespace(" ")], - }, - operator_token: EQ@15..17 "=" [] [Whitespace(" ")], - right: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..41 "getFlowTypeInConstructor" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@41..42 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@42..48 "symbol" [] [], - }, - }, - COMMA@48..50 "," [] [Whitespace(" ")], - TsNonNullAssertionExpression { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@50..73 "getDeclaringConstructor" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@73..74 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..80 "symbol" [] [], - }, - }, - ], - r_paren_token: R_PAREN@80..81 ")" [] [], - }, - }, - excl_token: BANG@81..82 "!" [] [], - }, - ], - r_paren_token: R_PAREN@82..83 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@83..84 ";" [] [], - }, - ], - eof_token: EOF@84..85 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..85 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..84 - 0: JS_VARIABLE_STATEMENT@0..9 - 0: JS_VARIABLE_DECLARATION@0..8 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..8 - 0: JS_VARIABLE_DECLARATOR@4..8 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "type" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@8..9 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@9..84 - 0: JS_ASSIGNMENT_EXPRESSION@9..83 - 0: JS_IDENTIFIER_ASSIGNMENT@9..15 - 0: IDENT@9..15 "type" [Newline("\n")] [Whitespace(" ")] - 1: EQ@15..17 "=" [] [Whitespace(" ")] - 2: JS_CALL_EXPRESSION@17..83 - 0: JS_IDENTIFIER_EXPRESSION@17..41 - 0: JS_REFERENCE_IDENTIFIER@17..41 - 0: IDENT@17..41 "getFlowTypeInConstructor" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@41..83 - 0: L_PAREN@41..42 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@42..82 - 0: JS_IDENTIFIER_EXPRESSION@42..48 - 0: JS_REFERENCE_IDENTIFIER@42..48 - 0: IDENT@42..48 "symbol" [] [] - 1: COMMA@48..50 "," [] [Whitespace(" ")] - 2: TS_NON_NULL_ASSERTION_EXPRESSION@50..82 - 0: JS_CALL_EXPRESSION@50..81 - 0: JS_IDENTIFIER_EXPRESSION@50..73 - 0: JS_REFERENCE_IDENTIFIER@50..73 - 0: IDENT@50..73 "getDeclaringConstructor" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@73..81 - 0: L_PAREN@73..74 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@74..80 - 0: JS_IDENTIFIER_EXPRESSION@74..80 - 0: JS_REFERENCE_IDENTIFIER@74..80 - 0: IDENT@74..80 "symbol" [] [] - 2: R_PAREN@80..81 ")" [] [] - 1: BANG@81..82 "!" [] [] - 2: R_PAREN@82..83 ")" [] [] - 1: SEMICOLON@83..84 ";" [] [] - 4: EOF@84..85 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast b/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast deleted file mode 100644 index 4a1f4211b785..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast +++ /dev/null @@ -1,160 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..5 "a" [] [], - }, - variable_annotation: TsTypeAnnotation { - colon_token: COLON@5..7 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@7..14 "string" [] [Whitespace(" ")], - }, - }, - initializer: JsInitializerClause { - eq_token: EQ@14..16 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@16..22 "\"test\"" [] [], - }, - }, - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@24..25 "b" [] [], - }, - variable_annotation: TsDefiniteVariableAnnotation { - excl_token: BANG@25..26 "!" [] [], - type_annotation: TsTypeAnnotation { - colon_token: COLON@26..28 ":" [] [Whitespace(" ")], - ty: TsNumberType { - number_token: NUMBER_KW@28..34 "number" [] [], - }, - }, - }, - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@40..48 "a" [] [Whitespace(" "), Comments("// ASI")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: BANG@48..50 "!" [Newline("\n")] [], - argument: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@50..59 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@59..63 "test" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@63..64 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@66..67 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@67..68 "}" [] [], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@68..69 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..69 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..68 - 0: JS_VARIABLE_STATEMENT@0..35 - 0: JS_VARIABLE_DECLARATION@0..34 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..34 - 0: JS_VARIABLE_DECLARATOR@4..22 - 0: JS_IDENTIFIER_BINDING@4..5 - 0: IDENT@4..5 "a" [] [] - 1: TS_TYPE_ANNOTATION@5..14 - 0: COLON@5..7 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@7..14 - 0: STRING_KW@7..14 "string" [] [Whitespace(" ")] - 2: JS_INITIALIZER_CLAUSE@14..22 - 0: EQ@14..16 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@16..22 - 0: JS_STRING_LITERAL@16..22 "\"test\"" [] [] - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@24..34 - 0: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "b" [] [] - 1: TS_DEFINITE_VARIABLE_ANNOTATION@25..34 - 0: BANG@25..26 "!" [] [] - 1: TS_TYPE_ANNOTATION@26..34 - 0: COLON@26..28 ":" [] [Whitespace(" ")] - 1: TS_NUMBER_TYPE@28..34 - 0: NUMBER_KW@28..34 "number" [] [] - 2: (empty) - 1: SEMICOLON@34..35 ";" [] [] - 1: JS_VARIABLE_STATEMENT@35..48 - 0: JS_VARIABLE_DECLARATION@35..48 - 0: (empty) - 1: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@40..48 - 0: JS_VARIABLE_DECLARATOR@40..48 - 0: JS_IDENTIFIER_BINDING@40..48 - 0: IDENT@40..48 "a" [] [Whitespace(" "), Comments("// ASI")] - 1: (empty) - 2: (empty) - 1: (empty) - 2: JS_EXPRESSION_STATEMENT@48..68 - 0: JS_UNARY_EXPRESSION@48..68 - 0: BANG@48..50 "!" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@50..68 - 0: (empty) - 1: FUNCTION_KW@50..59 "function" [] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@59..63 - 0: IDENT@59..63 "test" [] [] - 4: (empty) - 5: JS_PARAMETERS@63..66 - 0: L_PAREN@63..64 "(" [] [] - 1: JS_PARAMETER_LIST@64..64 - 2: R_PAREN@64..66 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@66..68 - 0: L_CURLY@66..67 "{" [] [] - 1: JS_DIRECTIVE_LIST@67..67 - 2: JS_STATEMENT_LIST@67..67 - 3: R_CURLY@67..68 "}" [] [] - 1: (empty) - 4: EOF@68..69 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.rast deleted file mode 100644 index c0e149776a4a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.rast +++ /dev/null @@ -1,205 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@8..14 "\"test\"" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@21..23 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@23..25 "=" [] [Whitespace(" ")], - ty: TsTypeofType { - typeof_token: TYPEOF_KW@25..32 "typeof" [] [Whitespace(" ")], - expression_name: JsReferenceIdentifier { - value_token: IDENT@32..33 "a" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@40..44 "T21" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@44..46 "=" [] [Whitespace(" ")], - ty: TsTypeofType { - typeof_token: TYPEOF_KW@46..53 "typeof" [] [Whitespace(" ")], - expression_name: JsReferenceIdentifier { - value_token: IDENT@53..58 "Array" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@58..59 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsStringType { - string_token: STRING_KW@59..65 "string" [] [], - }, - ], - r_angle_token: R_ANGLE@65..66 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@66..67 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@67..73 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@73..74 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@74..75 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@75..76 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@76..78 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@78..80 "=" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@80..92 "InstanceType" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@92..93 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsTypeofType { - typeof_token: TYPEOF_KW@93..100 "typeof" [] [Whitespace(" ")], - expression_name: JsReferenceIdentifier { - value_token: IDENT@100..105 "Array" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@105..106 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@106..107 "U" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@107..108 ">" [] [], - }, - }, - ], - r_angle_token: R_ANGLE@108..109 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@109..110 ";" [] [], - }, - ], - eof_token: EOF@110..111 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..111 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..110 - 0: JS_VARIABLE_STATEMENT@0..15 - 0: JS_VARIABLE_DECLARATION@0..14 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..14 - 0: JS_VARIABLE_DECLARATOR@4..14 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..14 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@8..14 - 0: JS_STRING_LITERAL@8..14 "\"test\"" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@15..34 - 0: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@21..23 - 0: IDENT@21..23 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@23..25 "=" [] [Whitespace(" ")] - 4: TS_TYPEOF_TYPE@25..33 - 0: TYPEOF_KW@25..32 "typeof" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@32..33 - 0: IDENT@32..33 "a" [] [] - 2: (empty) - 5: SEMICOLON@33..34 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@34..67 - 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@40..44 - 0: IDENT@40..44 "T21" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@44..46 "=" [] [Whitespace(" ")] - 4: TS_TYPEOF_TYPE@46..66 - 0: TYPEOF_KW@46..53 "typeof" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@53..58 - 0: IDENT@53..58 "Array" [] [] - 2: TS_TYPE_ARGUMENTS@58..66 - 0: L_ANGLE@58..59 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@59..65 - 0: TS_STRING_TYPE@59..65 - 0: STRING_KW@59..65 "string" [] [] - 2: R_ANGLE@65..66 ">" [] [] - 5: SEMICOLON@66..67 ";" [] [] - 3: TS_TYPE_ALIAS_DECLARATION@67..110 - 0: TYPE_KW@67..73 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@73..74 - 0: IDENT@73..74 "A" [] [] - 2: TS_TYPE_PARAMETERS@74..78 - 0: L_ANGLE@74..75 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@75..76 - 0: TS_TYPE_PARAMETER@75..76 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@75..75 - 1: TS_TYPE_PARAMETER_NAME@75..76 - 0: IDENT@75..76 "U" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@76..78 ">" [] [Whitespace(" ")] - 3: EQ@78..80 "=" [] [Whitespace(" ")] - 4: TS_REFERENCE_TYPE@80..109 - 0: JS_REFERENCE_IDENTIFIER@80..92 - 0: IDENT@80..92 "InstanceType" [] [] - 1: TS_TYPE_ARGUMENTS@92..109 - 0: L_ANGLE@92..93 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@93..108 - 0: TS_TYPEOF_TYPE@93..108 - 0: TYPEOF_KW@93..100 "typeof" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@100..105 - 0: IDENT@100..105 "Array" [] [] - 2: TS_TYPE_ARGUMENTS@105..108 - 0: L_ANGLE@105..106 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@106..107 - 0: TS_REFERENCE_TYPE@106..107 - 0: JS_REFERENCE_IDENTIFIER@106..107 - 0: IDENT@106..107 "U" [] [] - 1: (empty) - 2: R_ANGLE@107..108 ">" [] [] - 2: R_ANGLE@108..109 ">" [] [] - 5: SEMICOLON@109..110 ";" [] [] - 4: EOF@110..111 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.rast b/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.rast deleted file mode 100644 index a34111392102..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.rast +++ /dev/null @@ -1,92 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "X" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsTypeofType { - typeof_token: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")], - expression_name: JsReferenceIdentifier { - value_token: IDENT@16..21 "Array" [] [], - }, - type_arguments: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@21..23 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@23..26 "div" [] [], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@26..27 ">" [] [], - }, - children: JsxChildList [ - JsxText { - value_token: JSX_TEXT_LITERAL@27..28 "a" [] [], - }, - ], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@28..29 "<" [] [], - slash_token: SLASH@29..30 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@30..33 "div" [] [], - }, - r_angle_token: R_ANGLE@33..34 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@34..35 ";" [] [], - }, - ], - eof_token: EOF@35..36 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..36 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..35 - 0: TS_TYPE_ALIAS_DECLARATION@0..21 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "X" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_TYPEOF_TYPE@9..21 - 0: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")] - 1: JS_REFERENCE_IDENTIFIER@16..21 - 0: IDENT@16..21 "Array" [] [] - 2: (empty) - 5: (empty) - 1: JS_EXPRESSION_STATEMENT@21..35 - 0: JSX_TAG_EXPRESSION@21..34 - 0: JSX_ELEMENT@21..34 - 0: JSX_OPENING_ELEMENT@21..27 - 0: L_ANGLE@21..23 "<" [Newline("\n")] [] - 1: JSX_NAME@23..26 - 0: JSX_IDENT@23..26 "div" [] [] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@26..26 - 4: R_ANGLE@26..27 ">" [] [] - 1: JSX_CHILD_LIST@27..28 - 0: JSX_TEXT@27..28 - 0: JSX_TEXT_LITERAL@27..28 "a" [] [] - 2: JSX_CLOSING_ELEMENT@28..34 - 0: L_ANGLE@28..29 "<" [] [] - 1: SLASH@29..30 "/" [] [] - 2: JSX_NAME@30..33 - 0: JSX_IDENT@30..33 "div" [] [] - 3: R_ANGLE@33..34 ">" [] [] - 1: SEMICOLON@34..35 ";" [] [] - 4: EOF@35..36 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_union_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_union_type.rast deleted file mode 100644 index 6787b0d3baf5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_union_type.rast +++ /dev/null @@ -1,165 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsStringType { - string_token: STRING_KW@9..16 "string" [] [Whitespace(" ")], - }, - PIPE@16..18 "|" [] [Whitespace(" ")], - TsNumberType { - number_token: NUMBER_KW@18..24 "number" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@24..25 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@31..33 "B" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@33..35 "=" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: PIPE@35..37 "|" [] [Whitespace(" ")], - types: TsUnionTypeVariantList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@37..39 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - PIPE@39..41 "|" [] [Whitespace(" ")], - TsVoidType { - void_token: VOID_KW@41..46 "void" [] [Whitespace(" ")], - }, - PIPE@46..48 "|" [] [Whitespace(" ")], - TsNullLiteralType { - literal_token: NULL_KW@48..52 "null" [] [], - }, - ], - }, - semicolon_token: SEMICOLON@52..53 ";" [] [], - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@53..59 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@59..61 "C" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - eq_token: EQ@61..63 "=" [] [Whitespace(" ")], - ty: TsUnionType { - leading_separator_token: missing (optional), - types: TsUnionTypeVariantList [ - TsIntersectionType { - leading_separator_token: missing (optional), - types: TsIntersectionTypeElementList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@63..65 "A" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - AMP@65..67 "&" [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@67..69 "C" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - ], - }, - PIPE@69..71 "|" [] [Whitespace(" ")], - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@71..72 "C" [] [], - }, - type_arguments: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@72..73 ";" [] [], - }, - ], - eof_token: EOF@73..74 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..74 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..73 - 0: TS_TYPE_ALIAS_DECLARATION@0..25 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_UNION_TYPE@9..24 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@9..24 - 0: TS_STRING_TYPE@9..16 - 0: STRING_KW@9..16 "string" [] [Whitespace(" ")] - 1: PIPE@16..18 "|" [] [Whitespace(" ")] - 2: TS_NUMBER_TYPE@18..24 - 0: NUMBER_KW@18..24 "number" [] [] - 5: SEMICOLON@24..25 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@25..53 - 0: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@31..33 - 0: IDENT@31..33 "B" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@33..35 "=" [] [Whitespace(" ")] - 4: TS_UNION_TYPE@35..52 - 0: PIPE@35..37 "|" [] [Whitespace(" ")] - 1: TS_UNION_TYPE_VARIANT_LIST@37..52 - 0: TS_REFERENCE_TYPE@37..39 - 0: JS_REFERENCE_IDENTIFIER@37..39 - 0: IDENT@37..39 "A" [] [Whitespace(" ")] - 1: (empty) - 1: PIPE@39..41 "|" [] [Whitespace(" ")] - 2: TS_VOID_TYPE@41..46 - 0: VOID_KW@41..46 "void" [] [Whitespace(" ")] - 3: PIPE@46..48 "|" [] [Whitespace(" ")] - 4: TS_NULL_LITERAL_TYPE@48..52 - 0: NULL_KW@48..52 "null" [] [] - 5: SEMICOLON@52..53 ";" [] [] - 2: TS_TYPE_ALIAS_DECLARATION@53..73 - 0: TYPE_KW@53..59 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@59..61 - 0: IDENT@59..61 "C" [] [Whitespace(" ")] - 2: (empty) - 3: EQ@61..63 "=" [] [Whitespace(" ")] - 4: TS_UNION_TYPE@63..72 - 0: (empty) - 1: TS_UNION_TYPE_VARIANT_LIST@63..72 - 0: TS_INTERSECTION_TYPE@63..69 - 0: (empty) - 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@63..69 - 0: TS_REFERENCE_TYPE@63..65 - 0: JS_REFERENCE_IDENTIFIER@63..65 - 0: IDENT@63..65 "A" [] [Whitespace(" ")] - 1: (empty) - 1: AMP@65..67 "&" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@67..69 - 0: JS_REFERENCE_IDENTIFIER@67..69 - 0: IDENT@67..69 "C" [] [Whitespace(" ")] - 1: (empty) - 1: PIPE@69..71 "|" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@71..72 - 0: JS_REFERENCE_IDENTIFIER@71..72 - 0: IDENT@71..72 "C" [] [] - 1: (empty) - 5: SEMICOLON@72..73 ";" [] [] - 4: EOF@73..74 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.rast b/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.rast deleted file mode 100644 index a53d64d5b011..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.rast +++ /dev/null @@ -1,136 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@1..12 "NonGeneric" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [], - slash_token: SLASH@12..13 "/" [] [], - r_angle_token: R_ANGLE@13..14 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@15..17 "<" [Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@17..24 "Generic" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@24..25 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@25..29 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@29..31 ">" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [], - slash_token: SLASH@31..32 "/" [] [], - r_angle_token: R_ANGLE@32..33 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@33..34 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@34..36 "<" [Newline("\n")] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@36..43 "Generic" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@43..44 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsBooleanLiteralType { - literal: TRUE_KW@44..48 "true" [] [], - }, - ], - r_angle_token: R_ANGLE@48..49 ">" [] [], - }, - attributes: JsxAttributeList [], - r_angle_token: R_ANGLE@49..50 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@50..51 "<" [] [], - slash_token: SLASH@51..52 "/" [] [], - name: JsxReferenceIdentifier { - value_token: JSX_IDENT@52..59 "Generic" [] [], - }, - r_angle_token: R_ANGLE@59..60 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - ], - eof_token: EOF@61..62 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..62 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..61 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JSX_TAG_EXPRESSION@0..14 - 0: JSX_SELF_CLOSING_ELEMENT@0..14 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_REFERENCE_IDENTIFIER@1..12 - 0: JSX_IDENT@1..12 "NonGeneric" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@12..12 - 4: SLASH@12..13 "/" [] [] - 5: R_ANGLE@13..14 ">" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@15..34 - 0: JSX_TAG_EXPRESSION@15..33 - 0: JSX_SELF_CLOSING_ELEMENT@15..33 - 0: L_ANGLE@15..17 "<" [Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@17..24 - 0: JSX_IDENT@17..24 "Generic" [] [] - 2: TS_TYPE_ARGUMENTS@24..31 - 0: L_ANGLE@24..25 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@25..29 - 0: TS_BOOLEAN_LITERAL_TYPE@25..29 - 0: TRUE_KW@25..29 "true" [] [] - 2: R_ANGLE@29..31 ">" [] [Whitespace(" ")] - 3: JSX_ATTRIBUTE_LIST@31..31 - 4: SLASH@31..32 "/" [] [] - 5: R_ANGLE@32..33 ">" [] [] - 1: SEMICOLON@33..34 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@34..61 - 0: JSX_TAG_EXPRESSION@34..60 - 0: JSX_ELEMENT@34..60 - 0: JSX_OPENING_ELEMENT@34..50 - 0: L_ANGLE@34..36 "<" [Newline("\n")] [] - 1: JSX_REFERENCE_IDENTIFIER@36..43 - 0: JSX_IDENT@36..43 "Generic" [] [] - 2: TS_TYPE_ARGUMENTS@43..49 - 0: L_ANGLE@43..44 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@44..48 - 0: TS_BOOLEAN_LITERAL_TYPE@44..48 - 0: TRUE_KW@44..48 "true" [] [] - 2: R_ANGLE@48..49 ">" [] [] - 3: JSX_ATTRIBUTE_LIST@49..49 - 4: R_ANGLE@49..50 ">" [] [] - 1: JSX_CHILD_LIST@50..50 - 2: JSX_CLOSING_ELEMENT@50..60 - 0: L_ANGLE@50..51 "<" [] [] - 1: SLASH@51..52 "/" [] [] - 2: JSX_REFERENCE_IDENTIFIER@52..59 - 0: JSX_IDENT@52..59 "Generic" [] [] - 3: R_ANGLE@59..60 ">" [] [] - 1: SEMICOLON@60..61 ";" [] [] - 4: EOF@61..62 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.rast b/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.rast deleted file mode 100644 index 0b4bf787949b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.rast +++ /dev/null @@ -1,441 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@0..35 "<" [Comments("// These are valid ty ..."), Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@35..36 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@36..37 "," [] [], - ], - r_angle_token: R_ANGLE@37..38 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@38..39 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@44..45 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@45..46 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@47..49 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@49..55 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@55..56 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@56..57 "," [] [], - ], - r_angle_token: R_ANGLE@57..58 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@58..59 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@61..64 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@64..65 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@65..66 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@66..67 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@67..69 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@69..71 "A" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@71..79 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@79..80 "B" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@80..81 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@81..82 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@87..88 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@88..89 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@89..90 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@90..92 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@92..93 "A" [] [], - }, - constraint: missing (optional), - default: TsDefaultTypeClause { - eq_token: EQ@93..94 "=" [] [], - ty: TsStringType { - string_token: STRING_KW@94..100 "string" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@100..101 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@101..102 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@107..108 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@108..109 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@109..110 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@110..112 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@112..113 "A" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@113..115 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@115..116 "B" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@116..117 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@117..118 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@118..120 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@120..123 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@123..124 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@124..125 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@125..126 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@126..128 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@128..130 "A" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@130..138 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@138..139 "B" [] [], - }, - type_arguments: TsTypeArguments { - l_angle_token: L_ANGLE@139..140 "<" [] [], - ts_type_argument_list: TsTypeArgumentList [ - TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@140..141 "C" [] [], - }, - type_arguments: missing (optional), - }, - ], - r_angle_token: R_ANGLE@141..142 ">" [] [], - }, - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@142..143 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@143..144 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@144..146 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@146..149 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@149..150 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@150..151 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@151..152 ";" [] [], - }, - ], - eof_token: EOF@152..153 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..153 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..152 - 0: JS_EXPRESSION_STATEMENT@0..47 - 0: JS_ARROW_FUNCTION_EXPRESSION@0..46 - 0: (empty) - 1: TS_TYPE_PARAMETERS@0..38 - 0: L_ANGLE@0..35 "<" [Comments("// These are valid ty ..."), Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@35..37 - 0: TS_TYPE_PARAMETER@35..36 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@35..35 - 1: TS_TYPE_PARAMETER_NAME@35..36 - 0: IDENT@35..36 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@36..37 "," [] [] - 2: R_ANGLE@37..38 ">" [] [] - 2: JS_PARAMETERS@38..41 - 0: L_PAREN@38..39 "(" [] [] - 1: JS_PARAMETER_LIST@39..39 - 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@44..46 - 0: L_CURLY@44..45 "{" [] [] - 1: JS_DIRECTIVE_LIST@45..45 - 2: JS_STATEMENT_LIST@45..45 - 3: R_CURLY@45..46 "}" [] [] - 1: SEMICOLON@46..47 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@47..67 - 0: JS_ARROW_FUNCTION_EXPRESSION@47..66 - 0: (empty) - 1: TS_TYPE_PARAMETERS@47..58 - 0: L_ANGLE@47..49 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@49..57 - 0: TS_TYPE_PARAMETER@49..56 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@49..55 - 0: TS_CONST_MODIFIER@49..55 - 0: CONST_KW@49..55 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@55..56 - 0: IDENT@55..56 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@56..57 "," [] [] - 2: R_ANGLE@57..58 ">" [] [] - 2: JS_PARAMETERS@58..61 - 0: L_PAREN@58..59 "(" [] [] - 1: JS_PARAMETER_LIST@59..59 - 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@61..64 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@64..66 - 0: L_CURLY@64..65 "{" [] [] - 1: JS_DIRECTIVE_LIST@65..65 - 2: JS_STATEMENT_LIST@65..65 - 3: R_CURLY@65..66 "}" [] [] - 1: SEMICOLON@66..67 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@67..90 - 0: JS_ARROW_FUNCTION_EXPRESSION@67..89 - 0: (empty) - 1: TS_TYPE_PARAMETERS@67..81 - 0: L_ANGLE@67..69 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@69..80 - 0: TS_TYPE_PARAMETER@69..80 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@69..69 - 1: TS_TYPE_PARAMETER_NAME@69..71 - 0: IDENT@69..71 "A" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@71..80 - 0: EXTENDS_KW@71..79 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@79..80 - 0: JS_REFERENCE_IDENTIFIER@79..80 - 0: IDENT@79..80 "B" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@80..81 ">" [] [] - 2: JS_PARAMETERS@81..84 - 0: L_PAREN@81..82 "(" [] [] - 1: JS_PARAMETER_LIST@82..82 - 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@87..89 - 0: L_CURLY@87..88 "{" [] [] - 1: JS_DIRECTIVE_LIST@88..88 - 2: JS_STATEMENT_LIST@88..88 - 3: R_CURLY@88..89 "}" [] [] - 1: SEMICOLON@89..90 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@90..110 - 0: JS_ARROW_FUNCTION_EXPRESSION@90..109 - 0: (empty) - 1: TS_TYPE_PARAMETERS@90..101 - 0: L_ANGLE@90..92 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@92..100 - 0: TS_TYPE_PARAMETER@92..100 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@92..92 - 1: TS_TYPE_PARAMETER_NAME@92..93 - 0: IDENT@92..93 "A" [] [] - 2: (empty) - 3: TS_DEFAULT_TYPE_CLAUSE@93..100 - 0: EQ@93..94 "=" [] [] - 1: TS_STRING_TYPE@94..100 - 0: STRING_KW@94..100 "string" [] [] - 2: R_ANGLE@100..101 ">" [] [] - 2: JS_PARAMETERS@101..104 - 0: L_PAREN@101..102 "(" [] [] - 1: JS_PARAMETER_LIST@102..102 - 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@107..109 - 0: L_CURLY@107..108 "{" [] [] - 1: JS_DIRECTIVE_LIST@108..108 - 2: JS_STATEMENT_LIST@108..108 - 3: R_CURLY@108..109 "}" [] [] - 1: SEMICOLON@109..110 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@110..126 - 0: JS_ARROW_FUNCTION_EXPRESSION@110..125 - 0: (empty) - 1: TS_TYPE_PARAMETERS@110..117 - 0: L_ANGLE@110..112 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@112..116 - 0: TS_TYPE_PARAMETER@112..113 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@112..112 - 1: TS_TYPE_PARAMETER_NAME@112..113 - 0: IDENT@112..113 "A" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@113..115 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@115..116 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@115..115 - 1: TS_TYPE_PARAMETER_NAME@115..116 - 0: IDENT@115..116 "B" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@116..117 ">" [] [] - 2: JS_PARAMETERS@117..120 - 0: L_PAREN@117..118 "(" [] [] - 1: JS_PARAMETER_LIST@118..118 - 2: R_PAREN@118..120 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@120..123 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@123..125 - 0: L_CURLY@123..124 "{" [] [] - 1: JS_DIRECTIVE_LIST@124..124 - 2: JS_STATEMENT_LIST@124..124 - 3: R_CURLY@124..125 "}" [] [] - 1: SEMICOLON@125..126 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@126..152 - 0: JS_ARROW_FUNCTION_EXPRESSION@126..151 - 0: (empty) - 1: TS_TYPE_PARAMETERS@126..143 - 0: L_ANGLE@126..128 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@128..142 - 0: TS_TYPE_PARAMETER@128..142 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@128..128 - 1: TS_TYPE_PARAMETER_NAME@128..130 - 0: IDENT@128..130 "A" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@130..142 - 0: EXTENDS_KW@130..138 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@138..142 - 0: JS_REFERENCE_IDENTIFIER@138..139 - 0: IDENT@138..139 "B" [] [] - 1: TS_TYPE_ARGUMENTS@139..142 - 0: L_ANGLE@139..140 "<" [] [] - 1: TS_TYPE_ARGUMENT_LIST@140..141 - 0: TS_REFERENCE_TYPE@140..141 - 0: JS_REFERENCE_IDENTIFIER@140..141 - 0: IDENT@140..141 "C" [] [] - 1: (empty) - 2: R_ANGLE@141..142 ">" [] [] - 3: (empty) - 2: R_ANGLE@142..143 ">" [] [] - 2: JS_PARAMETERS@143..146 - 0: L_PAREN@143..144 "(" [] [] - 1: JS_PARAMETER_LIST@144..144 - 2: R_PAREN@144..146 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@146..149 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@149..151 - 0: L_CURLY@149..150 "{" [] [] - 1: JS_DIRECTIVE_LIST@150..150 - 2: JS_STATEMENT_LIST@150..150 - 3: R_CURLY@150..151 "}" [] [] - 1: SEMICOLON@151..152 ";" [] [] - 4: EOF@152..153 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.rast b/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.rast deleted file mode 100644 index 0d0eb81ed0d3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.rast +++ /dev/null @@ -1,66 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@0..1 "(" [] [], - expression: JsBinaryExpression { - left: JsBinaryExpression { - left: JsParenthesizedExpression { - l_paren_token: L_PAREN@1..2 "(" [] [], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@2..3 "0" [] [], - }, - r_paren_token: R_PAREN@3..4 ")" [] [], - }, - operator_token: L_ANGLE@4..5 "<" [] [], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@5..6 "5" [] [], - }, - }, - operator_token: R_ANGLE@6..7 ">" [] [], - right: JsParenthesizedExpression { - l_paren_token: L_PAREN@7..8 "(" [] [], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@8..9 "6" [] [], - }, - r_paren_token: R_PAREN@9..10 ")" [] [], - }, - }, - r_paren_token: R_PAREN@10..11 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@11..12 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..12 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..11 - 0: JS_EXPRESSION_STATEMENT@0..11 - 0: JS_PARENTHESIZED_EXPRESSION@0..11 - 0: L_PAREN@0..1 "(" [] [] - 1: JS_BINARY_EXPRESSION@1..10 - 0: JS_BINARY_EXPRESSION@1..6 - 0: JS_PARENTHESIZED_EXPRESSION@1..4 - 0: L_PAREN@1..2 "(" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@2..3 - 0: JS_NUMBER_LITERAL@2..3 "0" [] [] - 2: R_PAREN@3..4 ")" [] [] - 1: L_ANGLE@4..5 "<" [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@5..6 - 0: JS_NUMBER_LITERAL@5..6 "5" [] [] - 1: R_ANGLE@6..7 ">" [] [] - 2: JS_PARENTHESIZED_EXPRESSION@7..10 - 0: L_PAREN@7..8 "(" [] [] - 1: JS_NUMBER_LITERAL_EXPRESSION@8..9 - 0: JS_NUMBER_LITERAL@8..9 "6" [] [] - 2: R_PAREN@9..10 ")" [] [] - 2: R_PAREN@10..11 ")" [] [] - 1: (empty) - 4: EOF@11..12 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast b/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast deleted file mode 100644 index e7da13c020d5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast +++ /dev/null @@ -1,397 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@5..9 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@9..11 "i" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@11..13 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")], - }, - }, - }, - ], - }, - first_semi_token: SEMICOLON@15..17 ";" [] [Whitespace(" ")], - test: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..19 "i" [] [Whitespace(" ")], - }, - }, - operator_token: L_ANGLE@19..21 "<" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@21..22 "3" [] [], - }, - }, - second_semi_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], - update: JsPreUpdateExpression { - operator_token: PLUS2@24..26 "++" [] [], - operand: JsIdentifierAssignment { - name_token: IDENT@26..27 "i" [] [], - }, - }, - r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@29..30 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..41 "verify" [Newline("\n"), Whitespace(" ")] [], - }, - }, - operator_token: DOT@41..42 "." [] [], - member: JsName { - value_token: IDENT@42..53 "completions" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@53..54 "(" [] [], - args: JsCallArgumentList [ - JsObjectExpression { - l_curly_token: L_CURLY@54..55 "{" [] [], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@55..70 "marker" [Newline("\n"), Whitespace(" ")] [], - }, - colon_token: COLON@70..72 ":" [] [Whitespace(" ")], - value: JsTemplateExpression { - tag: missing (optional), - type_arguments: missing (optional), - l_tick_token: BACKTICK@72..73 "`" [] [], - elements: JsTemplateElementList [ - JsTemplateElement { - dollar_curly_token: DOLLAR_CURLY@73..75 "${" [] [], - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@75..77 "i" [] [Whitespace(" ")], - }, - }, - operator_token: PLUS@77..79 "+" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@79..80 "1" [] [], - }, - }, - r_curly_token: R_CURLY@80..81 "}" [] [], - }, - ], - r_tick_token: BACKTICK@81..82 "`" [] [], - }, - }, - COMMA@82..83 "," [] [], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@83..97 "exact" [Newline("\n"), Whitespace(" ")] [], - }, - colon_token: COLON@97..99 ":" [] [Whitespace(" ")], - value: JsArrayExpression { - l_brack_token: L_BRACK@99..100 "[" [] [], - elements: JsArrayElementList [ - JsObjectExpression { - l_curly_token: L_CURLY@100..115 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@115..119 "name" [] [], - }, - colon_token: COLON@119..121 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@121..126 "\"foo\"" [] [], - }, - }, - COMMA@126..128 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@128..143 "replacementSpan" [] [], - }, - colon_token: COLON@143..145 ":" [] [Whitespace(" ")], - value: JsComputedMemberExpression { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@145..149 "test" [] [], - }, - }, - operator_token: DOT@149..150 "." [] [], - member: JsName { - value_token: IDENT@150..156 "ranges" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@156..157 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@157..158 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@158..159 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@159..160 "i" [] [], - }, - }, - r_brack_token: R_BRACK@160..162 "]" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@162..163 "}" [] [], - }, - COMMA@163..164 "," [] [], - JsObjectExpression { - l_curly_token: L_CURLY@164..179 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@179..183 "name" [] [], - }, - colon_token: COLON@183..185 ":" [] [Whitespace(" ")], - value: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@185..190 "\"bar\"" [] [], - }, - }, - COMMA@190..192 "," [] [Whitespace(" ")], - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@192..207 "replacementSpan" [] [], - }, - colon_token: COLON@207..209 ":" [] [Whitespace(" ")], - value: JsComputedMemberExpression { - object: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@209..213 "test" [] [], - }, - }, - operator_token: DOT@213..214 "." [] [], - member: JsName { - value_token: IDENT@214..220 "ranges" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@220..221 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@221..222 ")" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@222..223 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@223..224 "i" [] [], - }, - }, - r_brack_token: R_BRACK@224..226 "]" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@226..227 "}" [] [], - }, - COMMA@227..228 "," [] [], - ], - r_brack_token: R_BRACK@228..238 "]" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@238..244 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_paren_token: R_PAREN@244..245 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@245..246 ";" [] [], - }, - ], - r_curly_token: R_CURLY@246..248 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@248..249 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..249 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..248 - 0: JS_FOR_STATEMENT@0..248 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: L_PAREN@4..5 "(" [] [] - 2: JS_VARIABLE_DECLARATION@5..15 - 0: (empty) - 1: LET_KW@5..9 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@9..15 - 0: JS_VARIABLE_DECLARATOR@9..15 - 0: JS_IDENTIFIER_BINDING@9..11 - 0: IDENT@9..11 "i" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@11..15 - 0: EQ@11..13 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@13..15 - 0: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")] - 3: SEMICOLON@15..17 ";" [] [Whitespace(" ")] - 4: JS_BINARY_EXPRESSION@17..22 - 0: JS_IDENTIFIER_EXPRESSION@17..19 - 0: JS_REFERENCE_IDENTIFIER@17..19 - 0: IDENT@17..19 "i" [] [Whitespace(" ")] - 1: L_ANGLE@19..21 "<" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@21..22 - 0: JS_NUMBER_LITERAL@21..22 "3" [] [] - 5: SEMICOLON@22..24 ";" [] [Whitespace(" ")] - 6: JS_PRE_UPDATE_EXPRESSION@24..27 - 0: PLUS2@24..26 "++" [] [] - 1: JS_IDENTIFIER_ASSIGNMENT@26..27 - 0: IDENT@26..27 "i" [] [] - 7: R_PAREN@27..29 ")" [] [Whitespace(" ")] - 8: JS_BLOCK_STATEMENT@29..248 - 0: L_CURLY@29..30 "{" [] [] - 1: JS_STATEMENT_LIST@30..246 - 0: JS_EXPRESSION_STATEMENT@30..246 - 0: JS_CALL_EXPRESSION@30..245 - 0: JS_STATIC_MEMBER_EXPRESSION@30..53 - 0: JS_IDENTIFIER_EXPRESSION@30..41 - 0: JS_REFERENCE_IDENTIFIER@30..41 - 0: IDENT@30..41 "verify" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@41..42 "." [] [] - 2: JS_NAME@42..53 - 0: IDENT@42..53 "completions" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@53..245 - 0: L_PAREN@53..54 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@54..244 - 0: JS_OBJECT_EXPRESSION@54..244 - 0: L_CURLY@54..55 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@55..238 - 0: JS_PROPERTY_OBJECT_MEMBER@55..82 - 0: JS_LITERAL_MEMBER_NAME@55..70 - 0: IDENT@55..70 "marker" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@70..72 ":" [] [Whitespace(" ")] - 2: JS_TEMPLATE_EXPRESSION@72..82 - 0: (empty) - 1: (empty) - 2: BACKTICK@72..73 "`" [] [] - 3: JS_TEMPLATE_ELEMENT_LIST@73..81 - 0: JS_TEMPLATE_ELEMENT@73..81 - 0: DOLLAR_CURLY@73..75 "${" [] [] - 1: JS_BINARY_EXPRESSION@75..80 - 0: JS_IDENTIFIER_EXPRESSION@75..77 - 0: JS_REFERENCE_IDENTIFIER@75..77 - 0: IDENT@75..77 "i" [] [Whitespace(" ")] - 1: PLUS@77..79 "+" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@79..80 - 0: JS_NUMBER_LITERAL@79..80 "1" [] [] - 2: R_CURLY@80..81 "}" [] [] - 4: BACKTICK@81..82 "`" [] [] - 1: COMMA@82..83 "," [] [] - 2: JS_PROPERTY_OBJECT_MEMBER@83..238 - 0: JS_LITERAL_MEMBER_NAME@83..97 - 0: IDENT@83..97 "exact" [Newline("\n"), Whitespace(" ")] [] - 1: COLON@97..99 ":" [] [Whitespace(" ")] - 2: JS_ARRAY_EXPRESSION@99..238 - 0: L_BRACK@99..100 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@100..228 - 0: JS_OBJECT_EXPRESSION@100..163 - 0: L_CURLY@100..115 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@115..162 - 0: JS_PROPERTY_OBJECT_MEMBER@115..126 - 0: JS_LITERAL_MEMBER_NAME@115..119 - 0: IDENT@115..119 "name" [] [] - 1: COLON@119..121 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@121..126 - 0: JS_STRING_LITERAL@121..126 "\"foo\"" [] [] - 1: COMMA@126..128 "," [] [Whitespace(" ")] - 2: JS_PROPERTY_OBJECT_MEMBER@128..162 - 0: JS_LITERAL_MEMBER_NAME@128..143 - 0: IDENT@128..143 "replacementSpan" [] [] - 1: COLON@143..145 ":" [] [Whitespace(" ")] - 2: JS_COMPUTED_MEMBER_EXPRESSION@145..162 - 0: JS_CALL_EXPRESSION@145..158 - 0: JS_STATIC_MEMBER_EXPRESSION@145..156 - 0: JS_IDENTIFIER_EXPRESSION@145..149 - 0: JS_REFERENCE_IDENTIFIER@145..149 - 0: IDENT@145..149 "test" [] [] - 1: DOT@149..150 "." [] [] - 2: JS_NAME@150..156 - 0: IDENT@150..156 "ranges" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@156..158 - 0: L_PAREN@156..157 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@157..157 - 2: R_PAREN@157..158 ")" [] [] - 1: (empty) - 2: L_BRACK@158..159 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@159..160 - 0: JS_REFERENCE_IDENTIFIER@159..160 - 0: IDENT@159..160 "i" [] [] - 4: R_BRACK@160..162 "]" [] [Whitespace(" ")] - 2: R_CURLY@162..163 "}" [] [] - 1: COMMA@163..164 "," [] [] - 2: JS_OBJECT_EXPRESSION@164..227 - 0: L_CURLY@164..179 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@179..226 - 0: JS_PROPERTY_OBJECT_MEMBER@179..190 - 0: JS_LITERAL_MEMBER_NAME@179..183 - 0: IDENT@179..183 "name" [] [] - 1: COLON@183..185 ":" [] [Whitespace(" ")] - 2: JS_STRING_LITERAL_EXPRESSION@185..190 - 0: JS_STRING_LITERAL@185..190 "\"bar\"" [] [] - 1: COMMA@190..192 "," [] [Whitespace(" ")] - 2: JS_PROPERTY_OBJECT_MEMBER@192..226 - 0: JS_LITERAL_MEMBER_NAME@192..207 - 0: IDENT@192..207 "replacementSpan" [] [] - 1: COLON@207..209 ":" [] [Whitespace(" ")] - 2: JS_COMPUTED_MEMBER_EXPRESSION@209..226 - 0: JS_CALL_EXPRESSION@209..222 - 0: JS_STATIC_MEMBER_EXPRESSION@209..220 - 0: JS_IDENTIFIER_EXPRESSION@209..213 - 0: JS_REFERENCE_IDENTIFIER@209..213 - 0: IDENT@209..213 "test" [] [] - 1: DOT@213..214 "." [] [] - 2: JS_NAME@214..220 - 0: IDENT@214..220 "ranges" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@220..222 - 0: L_PAREN@220..221 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@221..221 - 2: R_PAREN@221..222 ")" [] [] - 1: (empty) - 2: L_BRACK@222..223 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@223..224 - 0: JS_REFERENCE_IDENTIFIER@223..224 - 0: IDENT@223..224 "i" [] [] - 4: R_BRACK@224..226 "]" [] [Whitespace(" ")] - 2: R_CURLY@226..227 "}" [] [] - 3: COMMA@227..228 "," [] [] - 2: R_BRACK@228..238 "]" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@238..244 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_PAREN@244..245 ")" [] [] - 1: SEMICOLON@245..246 ";" [] [] - 2: R_CURLY@246..248 "}" [Newline("\n")] [] - 4: EOF@248..249 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast b/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast deleted file mode 100644 index b3e1012ad88a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast +++ /dev/null @@ -1,65 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: TsTypeAssertionExpression { - l_angle_token: L_ANGLE@8..9 "<" [] [], - ty: TsNumberType { - number_token: NUMBER_KW@9..15 "number" [] [], - }, - r_angle_token: R_ANGLE@15..16 ">" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..25 "undefined" [] [], - }, - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@25..26 ";" [] [], - }, - ], - eof_token: EOF@26..27 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..27 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..26 - 0: JS_VARIABLE_STATEMENT@0..26 - 0: JS_VARIABLE_DECLARATION@0..25 - 0: (empty) - 1: LET_KW@0..4 "let" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..25 - 0: JS_VARIABLE_DECLARATOR@4..25 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..25 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: TS_TYPE_ASSERTION_EXPRESSION@8..25 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_NUMBER_TYPE@9..15 - 0: NUMBER_KW@9..15 "number" [] [] - 2: R_ANGLE@15..16 ">" [] [] - 3: JS_IDENTIFIER_EXPRESSION@16..25 - 0: JS_REFERENCE_IDENTIFIER@16..25 - 0: IDENT@16..25 "undefined" [] [] - 1: SEMICOLON@25..26 ";" [] [] - 4: EOF@26..27 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.rast b/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.rast deleted file mode 100644 index 36f02e0fdb6a..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.rast +++ /dev/null @@ -1,3023 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsTypeAliasDeclaration { - type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@5..8 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@8..9 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@9..12 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@12..13 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@13..15 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@15..17 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@17..18 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@18..19 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@19..25 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@25..28 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@28..29 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@29..32 "out" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@32..34 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@34..36 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@36..37 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@37..38 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@38..44 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@44..47 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@47..48 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@48..52 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@52..53 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@53..55 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@55..57 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@57..58 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@58..59 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@65..68 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@68..69 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@69..72 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@72..75 "out" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@75..77 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@77..79 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@79..80 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@80..81 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@87..90 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@90..91 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@91..95 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@95..98 "out" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@98..100 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@100..102 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@102..103 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@103..104 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@104..110 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@110..113 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@113..114 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@114..117 "in" [] [Whitespace(" ")], - }, - TsOutModifier { - modifier_token: OUT_KW@117..121 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@121..124 "out" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@124..126 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@126..128 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@128..129 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@129..130 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@136..139 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@139..140 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@140..143 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@143..144 "X" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@144..146 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@146..150 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@150..151 "Y" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@151..153 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@153..155 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@155..156 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@156..157 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@163..166 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@166..167 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@167..171 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@171..172 "X" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@172..174 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@174..177 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@177..178 "Y" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@178..180 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@180..182 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@182..183 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@183..184 "}" [] [], - }, - semicolon_token: missing (optional), - }, - TsTypeAliasDeclaration { - type_token: TYPE_KW@184..190 "type" [Newline("\n")] [Whitespace(" ")], - binding_identifier: TsIdentifierBinding { - name_token: IDENT@190..193 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@193..194 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@194..198 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@198..199 "X" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@199..201 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@201..205 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@205..207 "Y" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@207..215 "extends" [] [Whitespace(" ")], - ty: TsTypeOperatorType { - operator_token: KEYOF_KW@215..221 "keyof" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@221..222 "X" [] [], - }, - type_arguments: missing (optional), - }, - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@222..224 ">" [] [Whitespace(" ")], - }, - eq_token: EQ@224..226 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@226..227 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@227..228 "}" [] [], - }, - semicolon_token: missing (optional), - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@228..235 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@235..238 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@238..239 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@239..242 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@242..243 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@243..245 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@245..246 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@246..247 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@247..254 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@254..257 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@257..258 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@258..262 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@262..263 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@263..265 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@265..266 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@266..267 "}" [] [], - }, - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@267..275 "export" [Newline("\n")] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@275..283 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@283..289 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@289..292 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@292..293 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@293..296 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@296..297 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@297..299 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@299..300 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@300..301 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@301..308 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@308..311 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@311..312 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@312..316 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@316..317 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@317..319 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@319..320 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@320..321 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@321..332 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@332..335 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@335..336 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@336..339 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@339..340 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@340..342 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@342..343 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@343..344 "}" [] [], - }, - TsInterfaceDeclaration { - interface_token: INTERFACE_KW@344..355 "interface" [Newline("\n")] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@355..358 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@358..359 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@359..363 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@363..364 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@364..366 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@366..367 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@367..368 "}" [] [], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@368..377 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@377..383 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@383..386 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@386..387 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@387..390 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@390..391 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@391..393 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@393..394 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@394..395 "}" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@395..404 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@404..410 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@410..413 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@413..414 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@414..418 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@418..419 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@419..421 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@421..422 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@422..423 "}" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@423..432 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@432..442 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@442..445 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@445..446 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@446..449 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@449..450 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@450..452 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@452..453 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@453..454 "}" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@454..463 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsInterfaceDeclaration { - interface_token: INTERFACE_KW@463..473 "interface" [] [Whitespace(" ")], - id: TsIdentifierBinding { - name_token: IDENT@473..476 "Foo" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@476..477 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsOutModifier { - modifier_token: OUT_KW@477..481 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@481..482 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@482..484 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - l_curly_token: L_CURLY@484..485 "{" [] [], - members: TsTypeMemberList [], - r_curly_token: R_CURLY@485..486 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@486..496 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@496..497 "a" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@497..498 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@498..504 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@504..505 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@505..506 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@506..507 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@507..509 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@509..510 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@510..511 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@511..521 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@521..522 "b" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@522..523 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@523..529 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@529..531 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@531..539 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@539..540 "U" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@540..541 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@541..542 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@542..544 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@544..545 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@545..546 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@546..556 "function" [Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@556..557 "c" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@557..558 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@558..559 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@559..561 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@561..567 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@567..568 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@568..569 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@569..570 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@570..572 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@572..573 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@573..574 "}" [] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@574..583 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@583..592 "function" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@592..593 "d" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@593..594 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@594..600 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@600..601 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@601..602 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@602..603 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@603..604 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: SEMICOLON@604..605 ";" [] [], - }, - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@605..607 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@607..608 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@608..609 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@609..610 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@610..612 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@612..615 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@615..616 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@616..617 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@617..618 ";" [] [], - }, - JsExpressionStatement { - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@618..620 "<" [Newline("\n")] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@620..626 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@626..627 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@627..628 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@628..629 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@629..631 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@631..634 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@634..635 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@635..636 "}" [] [], - }, - }, - semicolon_token: SEMICOLON@636..637 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@637..639 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@639..648 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@648..649 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@649..655 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@655..656 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@656..657 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@657..658 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@658..660 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@660..661 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@661..662 "}" [] [], - }, - }, - r_paren_token: R_PAREN@662..663 ")" [] [], - }, - semicolon_token: SEMICOLON@663..664 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@664..666 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@666..675 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@675..676 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@676..682 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@682..684 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@684..692 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@692..693 "U" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@693..694 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@694..695 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@695..697 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@697..698 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@698..699 "}" [] [], - }, - }, - r_paren_token: R_PAREN@699..700 ")" [] [], - }, - semicolon_token: SEMICOLON@700..701 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@701..703 "(" [Newline("\n")] [], - expression: JsFunctionExpression { - async_token: missing (optional), - function_token: FUNCTION_KW@703..712 "function" [] [Whitespace(" ")], - star_token: missing (optional), - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@712..713 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@713..714 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@714..716 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@716..722 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@722..723 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@723..724 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@724..725 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@725..727 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@727..728 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@728..729 "}" [] [], - }, - }, - r_paren_token: R_PAREN@729..730 ")" [] [], - }, - semicolon_token: SEMICOLON@730..731 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@731..738 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@738..739 "A" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@739..740 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@740..746 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@746..747 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@747..749 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@749..750 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@750..751 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@751..758 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@758..759 "B" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@759..760 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@760..766 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@766..768 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@768..776 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@776..777 "U" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@777..779 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@779..780 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@780..781 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@781..788 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@788..789 "C" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@789..790 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@790..791 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@791..793 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@793..799 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@799..800 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@800..802 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@802..803 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@803..804 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@804..811 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@811..812 "D" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@812..813 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@813..816 "in" [] [Whitespace(" ")], - }, - TsConstModifier { - modifier_token: CONST_KW@816..822 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@822..823 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@823..825 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@825..826 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@826..827 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@827..834 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@834..835 "E" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@835..836 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@836..842 "const" [] [Whitespace(" ")], - }, - TsInModifier { - modifier_token: IN_KW@842..845 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@845..846 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@846..848 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@848..849 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@849..850 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@850..857 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@857..858 "F" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@858..859 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@859..862 "in" [] [Whitespace(" ")], - }, - TsConstModifier { - modifier_token: CONST_KW@862..868 "const" [] [Whitespace(" ")], - }, - TsOutModifier { - modifier_token: OUT_KW@868..872 "out" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@872..873 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@873..875 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@875..876 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@876..877 "}" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@877..879 "(" [Newline("\n")] [], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@879..885 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@885..886 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@886..892 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@892..893 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@893..895 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@895..896 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@896..897 "}" [] [], - }, - r_paren_token: R_PAREN@897..898 ")" [] [], - }, - semicolon_token: SEMICOLON@898..899 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@899..901 "(" [Newline("\n")] [], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@901..907 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@907..908 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@908..914 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@914..916 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@916..924 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@924..925 "U" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@925..927 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@927..928 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@928..929 "}" [] [], - }, - r_paren_token: R_PAREN@929..930 ")" [] [], - }, - semicolon_token: SEMICOLON@930..931 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@931..933 "(" [Newline("\n")] [], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@933..939 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@939..940 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@940..941 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@941..943 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@943..949 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@949..950 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@950..952 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@952..953 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@953..954 "}" [] [], - }, - r_paren_token: R_PAREN@954..955 ")" [] [], - }, - semicolon_token: SEMICOLON@955..956 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@956..958 "(" [Newline("\n")] [], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@958..964 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@964..965 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsInModifier { - modifier_token: IN_KW@965..968 "in" [] [Whitespace(" ")], - }, - TsConstModifier { - modifier_token: CONST_KW@968..974 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@974..975 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@975..977 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@977..978 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@978..979 "}" [] [], - }, - r_paren_token: R_PAREN@979..980 ")" [] [], - }, - semicolon_token: SEMICOLON@980..981 ";" [] [], - }, - JsExpressionStatement { - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@981..983 "(" [Newline("\n")] [], - expression: JsClassExpression { - decorators: JsDecoratorList [], - class_token: CLASS_KW@983..989 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@989..990 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@990..996 "const" [] [Whitespace(" ")], - }, - TsInModifier { - modifier_token: IN_KW@996..999 "in" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@999..1000 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1000..1002 ">" [] [Whitespace(" ")], - }, - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@1002..1003 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@1003..1004 "}" [] [], - }, - r_paren_token: R_PAREN@1004..1005 ")" [] [], - }, - semicolon_token: SEMICOLON@1005..1006 ";" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@1006..1013 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@1013..1015 "_" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@1015..1016 "{" [] [], - members: JsClassMemberList [ - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1016..1025 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1025..1026 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@1026..1032 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@1032..1033 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1033..1034 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@1034..1035 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1035..1037 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@1037..1038 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1038..1039 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1039..1048 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1048..1049 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@1049..1055 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@1055..1057 "T" [] [Whitespace(" ")], - }, - constraint: TsTypeConstraintClause { - extends_token: EXTENDS_KW@1057..1065 "extends" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1065..1066 "U" [] [], - }, - type_arguments: missing (optional), - }, - }, - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1066..1067 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@1067..1068 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1068..1070 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@1070..1071 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1071..1072 "}" [] [], - }, - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1072..1081 "method" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1081..1082 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [], - name: TsTypeParameterName { - ident_token: IDENT@1082..1083 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - COMMA@1083..1085 "," [] [Whitespace(" ")], - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@1085..1091 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@1091..1092 "U" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1092..1093 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@1093..1094 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1094..1096 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@1096..1097 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@1097..1098 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@1098..1100 "}" [Newline("\n")] [], - }, - TsDeclareStatement { - declare_token: DECLARE_KW@1100..1109 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: MODULE_KW@1109..1116 "module" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@1116..1118 "a" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@1118..1119 "{" [] [], - items: JsModuleItemList [ - TsDeclareFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@1119..1131 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@1131..1135 "test" [] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1135..1136 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@1136..1142 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@1142..1143 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1143..1144 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@1144..1145 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@1145..1146 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@1146..1148 ":" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1148..1149 "T" [] [], - }, - type_arguments: missing (optional), - }, - }, - semicolon_token: SEMICOLON@1149..1150 ";" [] [], - }, - ], - r_curly_token: R_CURLY@1150..1152 "}" [Newline("\n")] [], - }, - }, - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@1152..1159 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@1159..1163 "obj" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@1163..1165 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@1165..1166 "{" [] [], - members: JsObjectMemberList [ - JsMethodObjectMember { - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@1166..1170 "a" [Newline("\n"), Whitespace(" ")] [], - }, - type_parameters: TsTypeParameters { - l_angle_token: L_ANGLE@1170..1171 "<" [] [], - items: TsTypeParameterList [ - TsTypeParameter { - modifiers: TsTypeParameterModifierList [ - TsConstModifier { - modifier_token: CONST_KW@1171..1177 "const" [] [Whitespace(" ")], - }, - ], - name: TsTypeParameterName { - ident_token: IDENT@1177..1178 "T" [] [], - }, - constraint: missing (optional), - default: missing (optional), - }, - ], - r_angle_token: R_ANGLE@1178..1179 ">" [] [], - }, - parameters: JsParameters { - l_paren_token: L_PAREN@1179..1180 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@1180..1181 "b" [] [], - }, - question_mark_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@1181..1183 ":" [] [Whitespace(" ")], - ty: TsAnyType { - any_token: ANY_KW@1183..1186 "any" [] [], - }, - }, - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@1186..1187 ")" [] [], - }, - return_type_annotation: TsReturnTypeAnnotation { - colon_token: COLON@1187..1189 ":" [] [Whitespace(" ")], - ty: TsPredicateReturnType { - parameter_name: JsReferenceIdentifier { - value_token: IDENT@1189..1191 "b" [] [Whitespace(" ")], - }, - is_token: IS_KW@1191..1194 "is" [] [Whitespace(" ")], - ty: TsReferenceType { - name: JsReferenceIdentifier { - value_token: IDENT@1194..1196 "T" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - }, - }, - }, - body: JsFunctionBody { - l_curly_token: L_CURLY@1196..1198 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@1198..1205 "return" [] [Whitespace(" ")], - argument: JsBooleanLiteralExpression { - value_token: TRUE_KW@1205..1209 "true" [] [], - }, - semicolon_token: SEMICOLON@1209..1211 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@1211..1212 "}" [] [], - }, - }, - ], - r_curly_token: R_CURLY@1212..1214 "}" [Newline("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@1214..1215 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..1215 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..1214 - 0: TS_TYPE_ALIAS_DECLARATION@0..19 - 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@5..8 - 0: IDENT@5..8 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@8..15 - 0: L_ANGLE@8..9 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@9..13 - 0: TS_TYPE_PARAMETER@9..13 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..12 - 0: TS_IN_MODIFIER@9..12 - 0: IN_KW@9..12 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@12..13 - 0: IDENT@12..13 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@13..15 ">" [] [Whitespace(" ")] - 3: EQ@15..17 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@17..19 - 0: L_CURLY@17..18 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@18..18 - 2: R_CURLY@18..19 "}" [] [] - 5: (empty) - 1: TS_TYPE_ALIAS_DECLARATION@19..38 - 0: TYPE_KW@19..25 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@25..28 - 0: IDENT@25..28 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@28..34 - 0: L_ANGLE@28..29 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@29..32 - 0: TS_TYPE_PARAMETER@29..32 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@29..29 - 1: TS_TYPE_PARAMETER_NAME@29..32 - 0: IDENT@29..32 "out" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@32..34 ">" [] [Whitespace(" ")] - 3: EQ@34..36 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@36..38 - 0: L_CURLY@36..37 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@37..37 - 2: R_CURLY@37..38 "}" [] [] - 5: (empty) - 2: TS_TYPE_ALIAS_DECLARATION@38..59 - 0: TYPE_KW@38..44 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@44..47 - 0: IDENT@44..47 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@47..55 - 0: L_ANGLE@47..48 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@48..53 - 0: TS_TYPE_PARAMETER@48..53 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@48..52 - 0: TS_OUT_MODIFIER@48..52 - 0: OUT_KW@48..52 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@52..53 - 0: IDENT@52..53 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@53..55 ">" [] [Whitespace(" ")] - 3: EQ@55..57 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@57..59 - 0: L_CURLY@57..58 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@58..58 - 2: R_CURLY@58..59 "}" [] [] - 5: (empty) - 3: TS_TYPE_ALIAS_DECLARATION@59..81 - 0: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@65..68 - 0: IDENT@65..68 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@68..77 - 0: L_ANGLE@68..69 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@69..75 - 0: TS_TYPE_PARAMETER@69..75 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@69..72 - 0: TS_IN_MODIFIER@69..72 - 0: IN_KW@69..72 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@72..75 - 0: IDENT@72..75 "out" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@75..77 ">" [] [Whitespace(" ")] - 3: EQ@77..79 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@79..81 - 0: L_CURLY@79..80 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@80..80 - 2: R_CURLY@80..81 "}" [] [] - 5: (empty) - 4: TS_TYPE_ALIAS_DECLARATION@81..104 - 0: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@87..90 - 0: IDENT@87..90 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@90..100 - 0: L_ANGLE@90..91 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@91..98 - 0: TS_TYPE_PARAMETER@91..98 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@91..95 - 0: TS_OUT_MODIFIER@91..95 - 0: OUT_KW@91..95 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@95..98 - 0: IDENT@95..98 "out" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@98..100 ">" [] [Whitespace(" ")] - 3: EQ@100..102 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@102..104 - 0: L_CURLY@102..103 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@103..103 - 2: R_CURLY@103..104 "}" [] [] - 5: (empty) - 5: TS_TYPE_ALIAS_DECLARATION@104..130 - 0: TYPE_KW@104..110 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@110..113 - 0: IDENT@110..113 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@113..126 - 0: L_ANGLE@113..114 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@114..124 - 0: TS_TYPE_PARAMETER@114..124 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@114..121 - 0: TS_IN_MODIFIER@114..117 - 0: IN_KW@114..117 "in" [] [Whitespace(" ")] - 1: TS_OUT_MODIFIER@117..121 - 0: OUT_KW@117..121 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@121..124 - 0: IDENT@121..124 "out" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@124..126 ">" [] [Whitespace(" ")] - 3: EQ@126..128 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@128..130 - 0: L_CURLY@128..129 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@129..129 - 2: R_CURLY@129..130 "}" [] [] - 5: (empty) - 6: TS_TYPE_ALIAS_DECLARATION@130..157 - 0: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@136..139 - 0: IDENT@136..139 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@139..153 - 0: L_ANGLE@139..140 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@140..151 - 0: TS_TYPE_PARAMETER@140..144 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@140..143 - 0: TS_IN_MODIFIER@140..143 - 0: IN_KW@140..143 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@143..144 - 0: IDENT@143..144 "X" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@144..146 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@146..151 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@146..150 - 0: TS_OUT_MODIFIER@146..150 - 0: OUT_KW@146..150 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@150..151 - 0: IDENT@150..151 "Y" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@151..153 ">" [] [Whitespace(" ")] - 3: EQ@153..155 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@155..157 - 0: L_CURLY@155..156 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@156..156 - 2: R_CURLY@156..157 "}" [] [] - 5: (empty) - 7: TS_TYPE_ALIAS_DECLARATION@157..184 - 0: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@163..166 - 0: IDENT@163..166 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@166..180 - 0: L_ANGLE@166..167 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@167..178 - 0: TS_TYPE_PARAMETER@167..172 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@167..171 - 0: TS_OUT_MODIFIER@167..171 - 0: OUT_KW@167..171 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@171..172 - 0: IDENT@171..172 "X" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@172..174 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@174..178 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@174..177 - 0: TS_IN_MODIFIER@174..177 - 0: IN_KW@174..177 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@177..178 - 0: IDENT@177..178 "Y" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@178..180 ">" [] [Whitespace(" ")] - 3: EQ@180..182 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@182..184 - 0: L_CURLY@182..183 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@183..183 - 2: R_CURLY@183..184 "}" [] [] - 5: (empty) - 8: TS_TYPE_ALIAS_DECLARATION@184..228 - 0: TYPE_KW@184..190 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@190..193 - 0: IDENT@190..193 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@193..224 - 0: L_ANGLE@193..194 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@194..222 - 0: TS_TYPE_PARAMETER@194..199 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@194..198 - 0: TS_OUT_MODIFIER@194..198 - 0: OUT_KW@194..198 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@198..199 - 0: IDENT@198..199 "X" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@199..201 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@201..222 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@201..205 - 0: TS_OUT_MODIFIER@201..205 - 0: OUT_KW@201..205 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@205..207 - 0: IDENT@205..207 "Y" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@207..222 - 0: EXTENDS_KW@207..215 "extends" [] [Whitespace(" ")] - 1: TS_TYPE_OPERATOR_TYPE@215..222 - 0: KEYOF_KW@215..221 "keyof" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@221..222 - 0: JS_REFERENCE_IDENTIFIER@221..222 - 0: IDENT@221..222 "X" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@222..224 ">" [] [Whitespace(" ")] - 3: EQ@224..226 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@226..228 - 0: L_CURLY@226..227 "{" [] [] - 1: TS_TYPE_MEMBER_LIST@227..227 - 2: R_CURLY@227..228 "}" [] [] - 5: (empty) - 9: JS_CLASS_DECLARATION@228..247 - 0: JS_DECORATOR_LIST@228..228 - 1: (empty) - 2: CLASS_KW@228..235 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@235..238 - 0: IDENT@235..238 "Foo" [] [] - 4: TS_TYPE_PARAMETERS@238..245 - 0: L_ANGLE@238..239 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@239..243 - 0: TS_TYPE_PARAMETER@239..243 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@239..242 - 0: TS_IN_MODIFIER@239..242 - 0: IN_KW@239..242 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@242..243 - 0: IDENT@242..243 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@243..245 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@245..246 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@246..246 - 9: R_CURLY@246..247 "}" [] [] - 10: JS_CLASS_DECLARATION@247..267 - 0: JS_DECORATOR_LIST@247..247 - 1: (empty) - 2: CLASS_KW@247..254 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@254..257 - 0: IDENT@254..257 "Foo" [] [] - 4: TS_TYPE_PARAMETERS@257..265 - 0: L_ANGLE@257..258 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@258..263 - 0: TS_TYPE_PARAMETER@258..263 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@258..262 - 0: TS_OUT_MODIFIER@258..262 - 0: OUT_KW@258..262 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@262..263 - 0: IDENT@262..263 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@263..265 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@265..266 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@266..266 - 9: R_CURLY@266..267 "}" [] [] - 11: JS_EXPORT@267..301 - 0: JS_DECORATOR_LIST@267..267 - 1: EXPORT_KW@267..275 "export" [Newline("\n")] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@275..301 - 0: DEFAULT_KW@275..283 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@283..301 - 0: JS_DECORATOR_LIST@283..283 - 1: (empty) - 2: CLASS_KW@283..289 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@289..292 - 0: IDENT@289..292 "Foo" [] [] - 4: TS_TYPE_PARAMETERS@292..299 - 0: L_ANGLE@292..293 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@293..297 - 0: TS_TYPE_PARAMETER@293..297 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@293..296 - 0: TS_IN_MODIFIER@293..296 - 0: IN_KW@293..296 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@296..297 - 0: IDENT@296..297 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@297..299 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@299..300 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@300..300 - 9: R_CURLY@300..301 "}" [] [] - 2: (empty) - 12: JS_CLASS_DECLARATION@301..321 - 0: JS_DECORATOR_LIST@301..301 - 1: (empty) - 2: CLASS_KW@301..308 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@308..311 - 0: IDENT@308..311 "Foo" [] [] - 4: TS_TYPE_PARAMETERS@311..319 - 0: L_ANGLE@311..312 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@312..317 - 0: TS_TYPE_PARAMETER@312..317 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@312..316 - 0: TS_OUT_MODIFIER@312..316 - 0: OUT_KW@312..316 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@316..317 - 0: IDENT@316..317 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@317..319 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@319..320 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@320..320 - 9: R_CURLY@320..321 "}" [] [] - 13: TS_INTERFACE_DECLARATION@321..344 - 0: INTERFACE_KW@321..332 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@332..335 - 0: IDENT@332..335 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@335..342 - 0: L_ANGLE@335..336 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@336..340 - 0: TS_TYPE_PARAMETER@336..340 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@336..339 - 0: TS_IN_MODIFIER@336..339 - 0: IN_KW@336..339 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@339..340 - 0: IDENT@339..340 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@340..342 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@342..343 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@343..343 - 6: R_CURLY@343..344 "}" [] [] - 14: TS_INTERFACE_DECLARATION@344..368 - 0: INTERFACE_KW@344..355 "interface" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@355..358 - 0: IDENT@355..358 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@358..366 - 0: L_ANGLE@358..359 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@359..364 - 0: TS_TYPE_PARAMETER@359..364 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@359..363 - 0: TS_OUT_MODIFIER@359..363 - 0: OUT_KW@359..363 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@363..364 - 0: IDENT@363..364 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@364..366 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@366..367 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@367..367 - 6: R_CURLY@367..368 "}" [] [] - 15: TS_DECLARE_STATEMENT@368..395 - 0: DECLARE_KW@368..377 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@377..395 - 0: JS_DECORATOR_LIST@377..377 - 1: (empty) - 2: CLASS_KW@377..383 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@383..386 - 0: IDENT@383..386 "Foo" [] [] - 4: TS_TYPE_PARAMETERS@386..393 - 0: L_ANGLE@386..387 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@387..391 - 0: TS_TYPE_PARAMETER@387..391 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@387..390 - 0: TS_IN_MODIFIER@387..390 - 0: IN_KW@387..390 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@390..391 - 0: IDENT@390..391 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@391..393 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@393..394 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@394..394 - 9: R_CURLY@394..395 "}" [] [] - 16: TS_DECLARE_STATEMENT@395..423 - 0: DECLARE_KW@395..404 "declare" [Newline("\n")] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@404..423 - 0: JS_DECORATOR_LIST@404..404 - 1: (empty) - 2: CLASS_KW@404..410 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@410..413 - 0: IDENT@410..413 "Foo" [] [] - 4: TS_TYPE_PARAMETERS@413..421 - 0: L_ANGLE@413..414 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@414..419 - 0: TS_TYPE_PARAMETER@414..419 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@414..418 - 0: TS_OUT_MODIFIER@414..418 - 0: OUT_KW@414..418 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@418..419 - 0: IDENT@418..419 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@419..421 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@421..422 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@422..422 - 9: R_CURLY@422..423 "}" [] [] - 17: TS_DECLARE_STATEMENT@423..454 - 0: DECLARE_KW@423..432 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@432..454 - 0: INTERFACE_KW@432..442 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@442..445 - 0: IDENT@442..445 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@445..452 - 0: L_ANGLE@445..446 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@446..450 - 0: TS_TYPE_PARAMETER@446..450 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@446..449 - 0: TS_IN_MODIFIER@446..449 - 0: IN_KW@446..449 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@449..450 - 0: IDENT@449..450 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@450..452 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@452..453 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@453..453 - 6: R_CURLY@453..454 "}" [] [] - 18: TS_DECLARE_STATEMENT@454..486 - 0: DECLARE_KW@454..463 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_INTERFACE_DECLARATION@463..486 - 0: INTERFACE_KW@463..473 "interface" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@473..476 - 0: IDENT@473..476 "Foo" [] [] - 2: TS_TYPE_PARAMETERS@476..484 - 0: L_ANGLE@476..477 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@477..482 - 0: TS_TYPE_PARAMETER@477..482 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@477..481 - 0: TS_OUT_MODIFIER@477..481 - 0: OUT_KW@477..481 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@481..482 - 0: IDENT@481..482 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@482..484 ">" [] [Whitespace(" ")] - 3: (empty) - 4: L_CURLY@484..485 "{" [] [] - 5: TS_TYPE_MEMBER_LIST@485..485 - 6: R_CURLY@485..486 "}" [] [] - 19: JS_FUNCTION_DECLARATION@486..511 - 0: (empty) - 1: FUNCTION_KW@486..496 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@496..497 - 0: IDENT@496..497 "a" [] [] - 4: TS_TYPE_PARAMETERS@497..506 - 0: L_ANGLE@497..498 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@498..505 - 0: TS_TYPE_PARAMETER@498..505 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@498..504 - 0: TS_CONST_MODIFIER@498..504 - 0: CONST_KW@498..504 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@504..505 - 0: IDENT@504..505 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@505..506 ">" [] [] - 5: JS_PARAMETERS@506..509 - 0: L_PAREN@506..507 "(" [] [] - 1: JS_PARAMETER_LIST@507..507 - 2: R_PAREN@507..509 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@509..511 - 0: L_CURLY@509..510 "{" [] [] - 1: JS_DIRECTIVE_LIST@510..510 - 2: JS_STATEMENT_LIST@510..510 - 3: R_CURLY@510..511 "}" [] [] - 20: JS_FUNCTION_DECLARATION@511..546 - 0: (empty) - 1: FUNCTION_KW@511..521 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@521..522 - 0: IDENT@521..522 "b" [] [] - 4: TS_TYPE_PARAMETERS@522..541 - 0: L_ANGLE@522..523 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@523..540 - 0: TS_TYPE_PARAMETER@523..540 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@523..529 - 0: TS_CONST_MODIFIER@523..529 - 0: CONST_KW@523..529 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@529..531 - 0: IDENT@529..531 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@531..540 - 0: EXTENDS_KW@531..539 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@539..540 - 0: JS_REFERENCE_IDENTIFIER@539..540 - 0: IDENT@539..540 "U" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@540..541 ">" [] [] - 5: JS_PARAMETERS@541..544 - 0: L_PAREN@541..542 "(" [] [] - 1: JS_PARAMETER_LIST@542..542 - 2: R_PAREN@542..544 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@544..546 - 0: L_CURLY@544..545 "{" [] [] - 1: JS_DIRECTIVE_LIST@545..545 - 2: JS_STATEMENT_LIST@545..545 - 3: R_CURLY@545..546 "}" [] [] - 21: JS_FUNCTION_DECLARATION@546..574 - 0: (empty) - 1: FUNCTION_KW@546..556 "function" [Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@556..557 - 0: IDENT@556..557 "c" [] [] - 4: TS_TYPE_PARAMETERS@557..569 - 0: L_ANGLE@557..558 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@558..568 - 0: TS_TYPE_PARAMETER@558..559 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@558..558 - 1: TS_TYPE_PARAMETER_NAME@558..559 - 0: IDENT@558..559 "T" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@559..561 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@561..568 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@561..567 - 0: TS_CONST_MODIFIER@561..567 - 0: CONST_KW@561..567 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@567..568 - 0: IDENT@567..568 "U" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@568..569 ">" [] [] - 5: JS_PARAMETERS@569..572 - 0: L_PAREN@569..570 "(" [] [] - 1: JS_PARAMETER_LIST@570..570 - 2: R_PAREN@570..572 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@572..574 - 0: L_CURLY@572..573 "{" [] [] - 1: JS_DIRECTIVE_LIST@573..573 - 2: JS_STATEMENT_LIST@573..573 - 3: R_CURLY@573..574 "}" [] [] - 22: TS_DECLARE_STATEMENT@574..605 - 0: DECLARE_KW@574..583 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_DECLARE_FUNCTION_DECLARATION@583..605 - 0: (empty) - 1: FUNCTION_KW@583..592 "function" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@592..593 - 0: IDENT@592..593 "d" [] [] - 3: TS_TYPE_PARAMETERS@593..602 - 0: L_ANGLE@593..594 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@594..601 - 0: TS_TYPE_PARAMETER@594..601 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@594..600 - 0: TS_CONST_MODIFIER@594..600 - 0: CONST_KW@594..600 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@600..601 - 0: IDENT@600..601 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@601..602 ">" [] [] - 4: JS_PARAMETERS@602..604 - 0: L_PAREN@602..603 "(" [] [] - 1: JS_PARAMETER_LIST@603..603 - 2: R_PAREN@603..604 ")" [] [] - 5: (empty) - 6: SEMICOLON@604..605 ";" [] [] - 23: JS_EXPRESSION_STATEMENT@605..618 - 0: JS_ARROW_FUNCTION_EXPRESSION@605..617 - 0: (empty) - 1: TS_TYPE_PARAMETERS@605..609 - 0: L_ANGLE@605..607 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@607..608 - 0: TS_TYPE_PARAMETER@607..608 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@607..607 - 1: TS_TYPE_PARAMETER_NAME@607..608 - 0: IDENT@607..608 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@608..609 ">" [] [] - 2: JS_PARAMETERS@609..612 - 0: L_PAREN@609..610 "(" [] [] - 1: JS_PARAMETER_LIST@610..610 - 2: R_PAREN@610..612 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@612..615 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@615..617 - 0: L_CURLY@615..616 "{" [] [] - 1: JS_DIRECTIVE_LIST@616..616 - 2: JS_STATEMENT_LIST@616..616 - 3: R_CURLY@616..617 "}" [] [] - 1: SEMICOLON@617..618 ";" [] [] - 24: JS_EXPRESSION_STATEMENT@618..637 - 0: JS_ARROW_FUNCTION_EXPRESSION@618..636 - 0: (empty) - 1: TS_TYPE_PARAMETERS@618..628 - 0: L_ANGLE@618..620 "<" [Newline("\n")] [] - 1: TS_TYPE_PARAMETER_LIST@620..627 - 0: TS_TYPE_PARAMETER@620..627 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@620..626 - 0: TS_CONST_MODIFIER@620..626 - 0: CONST_KW@620..626 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@626..627 - 0: IDENT@626..627 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@627..628 ">" [] [] - 2: JS_PARAMETERS@628..631 - 0: L_PAREN@628..629 "(" [] [] - 1: JS_PARAMETER_LIST@629..629 - 2: R_PAREN@629..631 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@631..634 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@634..636 - 0: L_CURLY@634..635 "{" [] [] - 1: JS_DIRECTIVE_LIST@635..635 - 2: JS_STATEMENT_LIST@635..635 - 3: R_CURLY@635..636 "}" [] [] - 1: SEMICOLON@636..637 ";" [] [] - 25: JS_EXPRESSION_STATEMENT@637..664 - 0: JS_PARENTHESIZED_EXPRESSION@637..663 - 0: L_PAREN@637..639 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@639..662 - 0: (empty) - 1: FUNCTION_KW@639..648 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: TS_TYPE_PARAMETERS@648..657 - 0: L_ANGLE@648..649 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@649..656 - 0: TS_TYPE_PARAMETER@649..656 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@649..655 - 0: TS_CONST_MODIFIER@649..655 - 0: CONST_KW@649..655 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@655..656 - 0: IDENT@655..656 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@656..657 ">" [] [] - 5: JS_PARAMETERS@657..660 - 0: L_PAREN@657..658 "(" [] [] - 1: JS_PARAMETER_LIST@658..658 - 2: R_PAREN@658..660 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@660..662 - 0: L_CURLY@660..661 "{" [] [] - 1: JS_DIRECTIVE_LIST@661..661 - 2: JS_STATEMENT_LIST@661..661 - 3: R_CURLY@661..662 "}" [] [] - 2: R_PAREN@662..663 ")" [] [] - 1: SEMICOLON@663..664 ";" [] [] - 26: JS_EXPRESSION_STATEMENT@664..701 - 0: JS_PARENTHESIZED_EXPRESSION@664..700 - 0: L_PAREN@664..666 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@666..699 - 0: (empty) - 1: FUNCTION_KW@666..675 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: TS_TYPE_PARAMETERS@675..694 - 0: L_ANGLE@675..676 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@676..693 - 0: TS_TYPE_PARAMETER@676..693 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@676..682 - 0: TS_CONST_MODIFIER@676..682 - 0: CONST_KW@676..682 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@682..684 - 0: IDENT@682..684 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@684..693 - 0: EXTENDS_KW@684..692 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@692..693 - 0: JS_REFERENCE_IDENTIFIER@692..693 - 0: IDENT@692..693 "U" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@693..694 ">" [] [] - 5: JS_PARAMETERS@694..697 - 0: L_PAREN@694..695 "(" [] [] - 1: JS_PARAMETER_LIST@695..695 - 2: R_PAREN@695..697 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@697..699 - 0: L_CURLY@697..698 "{" [] [] - 1: JS_DIRECTIVE_LIST@698..698 - 2: JS_STATEMENT_LIST@698..698 - 3: R_CURLY@698..699 "}" [] [] - 2: R_PAREN@699..700 ")" [] [] - 1: SEMICOLON@700..701 ";" [] [] - 27: JS_EXPRESSION_STATEMENT@701..731 - 0: JS_PARENTHESIZED_EXPRESSION@701..730 - 0: L_PAREN@701..703 "(" [Newline("\n")] [] - 1: JS_FUNCTION_EXPRESSION@703..729 - 0: (empty) - 1: FUNCTION_KW@703..712 "function" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: TS_TYPE_PARAMETERS@712..724 - 0: L_ANGLE@712..713 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@713..723 - 0: TS_TYPE_PARAMETER@713..714 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@713..713 - 1: TS_TYPE_PARAMETER_NAME@713..714 - 0: IDENT@713..714 "T" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@714..716 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@716..723 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@716..722 - 0: TS_CONST_MODIFIER@716..722 - 0: CONST_KW@716..722 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@722..723 - 0: IDENT@722..723 "U" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@723..724 ">" [] [] - 5: JS_PARAMETERS@724..727 - 0: L_PAREN@724..725 "(" [] [] - 1: JS_PARAMETER_LIST@725..725 - 2: R_PAREN@725..727 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@727..729 - 0: L_CURLY@727..728 "{" [] [] - 1: JS_DIRECTIVE_LIST@728..728 - 2: JS_STATEMENT_LIST@728..728 - 3: R_CURLY@728..729 "}" [] [] - 2: R_PAREN@729..730 ")" [] [] - 1: SEMICOLON@730..731 ";" [] [] - 28: JS_CLASS_DECLARATION@731..751 - 0: JS_DECORATOR_LIST@731..731 - 1: (empty) - 2: CLASS_KW@731..738 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@738..739 - 0: IDENT@738..739 "A" [] [] - 4: TS_TYPE_PARAMETERS@739..749 - 0: L_ANGLE@739..740 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@740..747 - 0: TS_TYPE_PARAMETER@740..747 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@740..746 - 0: TS_CONST_MODIFIER@740..746 - 0: CONST_KW@740..746 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@746..747 - 0: IDENT@746..747 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@747..749 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@749..750 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@750..750 - 9: R_CURLY@750..751 "}" [] [] - 29: JS_CLASS_DECLARATION@751..781 - 0: JS_DECORATOR_LIST@751..751 - 1: (empty) - 2: CLASS_KW@751..758 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@758..759 - 0: IDENT@758..759 "B" [] [] - 4: TS_TYPE_PARAMETERS@759..779 - 0: L_ANGLE@759..760 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@760..777 - 0: TS_TYPE_PARAMETER@760..777 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@760..766 - 0: TS_CONST_MODIFIER@760..766 - 0: CONST_KW@760..766 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@766..768 - 0: IDENT@766..768 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@768..777 - 0: EXTENDS_KW@768..776 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@776..777 - 0: JS_REFERENCE_IDENTIFIER@776..777 - 0: IDENT@776..777 "U" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@777..779 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@779..780 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@780..780 - 9: R_CURLY@780..781 "}" [] [] - 30: JS_CLASS_DECLARATION@781..804 - 0: JS_DECORATOR_LIST@781..781 - 1: (empty) - 2: CLASS_KW@781..788 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@788..789 - 0: IDENT@788..789 "C" [] [] - 4: TS_TYPE_PARAMETERS@789..802 - 0: L_ANGLE@789..790 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@790..800 - 0: TS_TYPE_PARAMETER@790..791 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@790..790 - 1: TS_TYPE_PARAMETER_NAME@790..791 - 0: IDENT@790..791 "T" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@791..793 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@793..800 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@793..799 - 0: TS_CONST_MODIFIER@793..799 - 0: CONST_KW@793..799 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@799..800 - 0: IDENT@799..800 "U" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@800..802 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@802..803 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@803..803 - 9: R_CURLY@803..804 "}" [] [] - 31: JS_CLASS_DECLARATION@804..827 - 0: JS_DECORATOR_LIST@804..804 - 1: (empty) - 2: CLASS_KW@804..811 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@811..812 - 0: IDENT@811..812 "D" [] [] - 4: TS_TYPE_PARAMETERS@812..825 - 0: L_ANGLE@812..813 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@813..823 - 0: TS_TYPE_PARAMETER@813..823 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@813..822 - 0: TS_IN_MODIFIER@813..816 - 0: IN_KW@813..816 "in" [] [Whitespace(" ")] - 1: TS_CONST_MODIFIER@816..822 - 0: CONST_KW@816..822 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@822..823 - 0: IDENT@822..823 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@823..825 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@825..826 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@826..826 - 9: R_CURLY@826..827 "}" [] [] - 32: JS_CLASS_DECLARATION@827..850 - 0: JS_DECORATOR_LIST@827..827 - 1: (empty) - 2: CLASS_KW@827..834 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@834..835 - 0: IDENT@834..835 "E" [] [] - 4: TS_TYPE_PARAMETERS@835..848 - 0: L_ANGLE@835..836 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@836..846 - 0: TS_TYPE_PARAMETER@836..846 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@836..845 - 0: TS_CONST_MODIFIER@836..842 - 0: CONST_KW@836..842 "const" [] [Whitespace(" ")] - 1: TS_IN_MODIFIER@842..845 - 0: IN_KW@842..845 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@845..846 - 0: IDENT@845..846 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@846..848 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@848..849 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@849..849 - 9: R_CURLY@849..850 "}" [] [] - 33: JS_CLASS_DECLARATION@850..877 - 0: JS_DECORATOR_LIST@850..850 - 1: (empty) - 2: CLASS_KW@850..857 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@857..858 - 0: IDENT@857..858 "F" [] [] - 4: TS_TYPE_PARAMETERS@858..875 - 0: L_ANGLE@858..859 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@859..873 - 0: TS_TYPE_PARAMETER@859..873 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@859..872 - 0: TS_IN_MODIFIER@859..862 - 0: IN_KW@859..862 "in" [] [Whitespace(" ")] - 1: TS_CONST_MODIFIER@862..868 - 0: CONST_KW@862..868 "const" [] [Whitespace(" ")] - 2: TS_OUT_MODIFIER@868..872 - 0: OUT_KW@868..872 "out" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@872..873 - 0: IDENT@872..873 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@873..875 ">" [] [Whitespace(" ")] - 5: (empty) - 6: (empty) - 7: L_CURLY@875..876 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@876..876 - 9: R_CURLY@876..877 "}" [] [] - 34: JS_EXPRESSION_STATEMENT@877..899 - 0: JS_PARENTHESIZED_EXPRESSION@877..898 - 0: L_PAREN@877..879 "(" [Newline("\n")] [] - 1: JS_CLASS_EXPRESSION@879..897 - 0: JS_DECORATOR_LIST@879..879 - 1: CLASS_KW@879..885 "class" [] [Whitespace(" ")] - 2: (empty) - 3: TS_TYPE_PARAMETERS@885..895 - 0: L_ANGLE@885..886 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@886..893 - 0: TS_TYPE_PARAMETER@886..893 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@886..892 - 0: TS_CONST_MODIFIER@886..892 - 0: CONST_KW@886..892 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@892..893 - 0: IDENT@892..893 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@893..895 ">" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: L_CURLY@895..896 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@896..896 - 8: R_CURLY@896..897 "}" [] [] - 2: R_PAREN@897..898 ")" [] [] - 1: SEMICOLON@898..899 ";" [] [] - 35: JS_EXPRESSION_STATEMENT@899..931 - 0: JS_PARENTHESIZED_EXPRESSION@899..930 - 0: L_PAREN@899..901 "(" [Newline("\n")] [] - 1: JS_CLASS_EXPRESSION@901..929 - 0: JS_DECORATOR_LIST@901..901 - 1: CLASS_KW@901..907 "class" [] [Whitespace(" ")] - 2: (empty) - 3: TS_TYPE_PARAMETERS@907..927 - 0: L_ANGLE@907..908 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@908..925 - 0: TS_TYPE_PARAMETER@908..925 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@908..914 - 0: TS_CONST_MODIFIER@908..914 - 0: CONST_KW@908..914 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@914..916 - 0: IDENT@914..916 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@916..925 - 0: EXTENDS_KW@916..924 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@924..925 - 0: JS_REFERENCE_IDENTIFIER@924..925 - 0: IDENT@924..925 "U" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@925..927 ">" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: L_CURLY@927..928 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@928..928 - 8: R_CURLY@928..929 "}" [] [] - 2: R_PAREN@929..930 ")" [] [] - 1: SEMICOLON@930..931 ";" [] [] - 36: JS_EXPRESSION_STATEMENT@931..956 - 0: JS_PARENTHESIZED_EXPRESSION@931..955 - 0: L_PAREN@931..933 "(" [Newline("\n")] [] - 1: JS_CLASS_EXPRESSION@933..954 - 0: JS_DECORATOR_LIST@933..933 - 1: CLASS_KW@933..939 "class" [] [Whitespace(" ")] - 2: (empty) - 3: TS_TYPE_PARAMETERS@939..952 - 0: L_ANGLE@939..940 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@940..950 - 0: TS_TYPE_PARAMETER@940..941 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@940..940 - 1: TS_TYPE_PARAMETER_NAME@940..941 - 0: IDENT@940..941 "T" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@941..943 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@943..950 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@943..949 - 0: TS_CONST_MODIFIER@943..949 - 0: CONST_KW@943..949 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@949..950 - 0: IDENT@949..950 "U" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@950..952 ">" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: L_CURLY@952..953 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@953..953 - 8: R_CURLY@953..954 "}" [] [] - 2: R_PAREN@954..955 ")" [] [] - 1: SEMICOLON@955..956 ";" [] [] - 37: JS_EXPRESSION_STATEMENT@956..981 - 0: JS_PARENTHESIZED_EXPRESSION@956..980 - 0: L_PAREN@956..958 "(" [Newline("\n")] [] - 1: JS_CLASS_EXPRESSION@958..979 - 0: JS_DECORATOR_LIST@958..958 - 1: CLASS_KW@958..964 "class" [] [Whitespace(" ")] - 2: (empty) - 3: TS_TYPE_PARAMETERS@964..977 - 0: L_ANGLE@964..965 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@965..975 - 0: TS_TYPE_PARAMETER@965..975 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@965..974 - 0: TS_IN_MODIFIER@965..968 - 0: IN_KW@965..968 "in" [] [Whitespace(" ")] - 1: TS_CONST_MODIFIER@968..974 - 0: CONST_KW@968..974 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@974..975 - 0: IDENT@974..975 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@975..977 ">" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: L_CURLY@977..978 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@978..978 - 8: R_CURLY@978..979 "}" [] [] - 2: R_PAREN@979..980 ")" [] [] - 1: SEMICOLON@980..981 ";" [] [] - 38: JS_EXPRESSION_STATEMENT@981..1006 - 0: JS_PARENTHESIZED_EXPRESSION@981..1005 - 0: L_PAREN@981..983 "(" [Newline("\n")] [] - 1: JS_CLASS_EXPRESSION@983..1004 - 0: JS_DECORATOR_LIST@983..983 - 1: CLASS_KW@983..989 "class" [] [Whitespace(" ")] - 2: (empty) - 3: TS_TYPE_PARAMETERS@989..1002 - 0: L_ANGLE@989..990 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@990..1000 - 0: TS_TYPE_PARAMETER@990..1000 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@990..999 - 0: TS_CONST_MODIFIER@990..996 - 0: CONST_KW@990..996 "const" [] [Whitespace(" ")] - 1: TS_IN_MODIFIER@996..999 - 0: IN_KW@996..999 "in" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@999..1000 - 0: IDENT@999..1000 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1000..1002 ">" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: L_CURLY@1002..1003 "{" [] [] - 7: JS_CLASS_MEMBER_LIST@1003..1003 - 8: R_CURLY@1003..1004 "}" [] [] - 2: R_PAREN@1004..1005 ")" [] [] - 1: SEMICOLON@1005..1006 ";" [] [] - 39: JS_CLASS_DECLARATION@1006..1100 - 0: JS_DECORATOR_LIST@1006..1006 - 1: (empty) - 2: CLASS_KW@1006..1013 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@1013..1015 - 0: IDENT@1013..1015 "_" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@1015..1016 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@1016..1098 - 0: JS_METHOD_CLASS_MEMBER@1016..1039 - 0: JS_METHOD_MODIFIER_LIST@1016..1016 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@1016..1025 - 0: IDENT@1016..1025 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: TS_TYPE_PARAMETERS@1025..1034 - 0: L_ANGLE@1025..1026 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1026..1033 - 0: TS_TYPE_PARAMETER@1026..1033 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1026..1032 - 0: TS_CONST_MODIFIER@1026..1032 - 0: CONST_KW@1026..1032 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1032..1033 - 0: IDENT@1032..1033 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1033..1034 ">" [] [] - 6: JS_PARAMETERS@1034..1037 - 0: L_PAREN@1034..1035 "(" [] [] - 1: JS_PARAMETER_LIST@1035..1035 - 2: R_PAREN@1035..1037 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@1037..1039 - 0: L_CURLY@1037..1038 "{" [] [] - 1: JS_DIRECTIVE_LIST@1038..1038 - 2: JS_STATEMENT_LIST@1038..1038 - 3: R_CURLY@1038..1039 "}" [] [] - 1: JS_METHOD_CLASS_MEMBER@1039..1072 - 0: JS_METHOD_MODIFIER_LIST@1039..1039 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@1039..1048 - 0: IDENT@1039..1048 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: TS_TYPE_PARAMETERS@1048..1067 - 0: L_ANGLE@1048..1049 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1049..1066 - 0: TS_TYPE_PARAMETER@1049..1066 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1049..1055 - 0: TS_CONST_MODIFIER@1049..1055 - 0: CONST_KW@1049..1055 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1055..1057 - 0: IDENT@1055..1057 "T" [] [Whitespace(" ")] - 2: TS_TYPE_CONSTRAINT_CLAUSE@1057..1066 - 0: EXTENDS_KW@1057..1065 "extends" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@1065..1066 - 0: JS_REFERENCE_IDENTIFIER@1065..1066 - 0: IDENT@1065..1066 "U" [] [] - 1: (empty) - 3: (empty) - 2: R_ANGLE@1066..1067 ">" [] [] - 6: JS_PARAMETERS@1067..1070 - 0: L_PAREN@1067..1068 "(" [] [] - 1: JS_PARAMETER_LIST@1068..1068 - 2: R_PAREN@1068..1070 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@1070..1072 - 0: L_CURLY@1070..1071 "{" [] [] - 1: JS_DIRECTIVE_LIST@1071..1071 - 2: JS_STATEMENT_LIST@1071..1071 - 3: R_CURLY@1071..1072 "}" [] [] - 2: JS_METHOD_CLASS_MEMBER@1072..1098 - 0: JS_METHOD_MODIFIER_LIST@1072..1072 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@1072..1081 - 0: IDENT@1072..1081 "method" [Newline("\n"), Whitespace(" ")] [] - 4: (empty) - 5: TS_TYPE_PARAMETERS@1081..1093 - 0: L_ANGLE@1081..1082 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1082..1092 - 0: TS_TYPE_PARAMETER@1082..1083 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1082..1082 - 1: TS_TYPE_PARAMETER_NAME@1082..1083 - 0: IDENT@1082..1083 "T" [] [] - 2: (empty) - 3: (empty) - 1: COMMA@1083..1085 "," [] [Whitespace(" ")] - 2: TS_TYPE_PARAMETER@1085..1092 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1085..1091 - 0: TS_CONST_MODIFIER@1085..1091 - 0: CONST_KW@1085..1091 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1091..1092 - 0: IDENT@1091..1092 "U" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1092..1093 ">" [] [] - 6: JS_PARAMETERS@1093..1096 - 0: L_PAREN@1093..1094 "(" [] [] - 1: JS_PARAMETER_LIST@1094..1094 - 2: R_PAREN@1094..1096 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@1096..1098 - 0: L_CURLY@1096..1097 "{" [] [] - 1: JS_DIRECTIVE_LIST@1097..1097 - 2: JS_STATEMENT_LIST@1097..1097 - 3: R_CURLY@1097..1098 "}" [] [] - 9: R_CURLY@1098..1100 "}" [Newline("\n")] [] - 40: TS_DECLARE_STATEMENT@1100..1152 - 0: DECLARE_KW@1100..1109 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@1109..1152 - 0: MODULE_KW@1109..1116 "module" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@1116..1118 - 0: IDENT@1116..1118 "a" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@1118..1152 - 0: L_CURLY@1118..1119 "{" [] [] - 1: JS_MODULE_ITEM_LIST@1119..1150 - 0: TS_DECLARE_FUNCTION_DECLARATION@1119..1150 - 0: (empty) - 1: FUNCTION_KW@1119..1131 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@1131..1135 - 0: IDENT@1131..1135 "test" [] [] - 3: TS_TYPE_PARAMETERS@1135..1144 - 0: L_ANGLE@1135..1136 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1136..1143 - 0: TS_TYPE_PARAMETER@1136..1143 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1136..1142 - 0: TS_CONST_MODIFIER@1136..1142 - 0: CONST_KW@1136..1142 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1142..1143 - 0: IDENT@1142..1143 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1143..1144 ">" [] [] - 4: JS_PARAMETERS@1144..1146 - 0: L_PAREN@1144..1145 "(" [] [] - 1: JS_PARAMETER_LIST@1145..1145 - 2: R_PAREN@1145..1146 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@1146..1149 - 0: COLON@1146..1148 ":" [] [Whitespace(" ")] - 1: TS_REFERENCE_TYPE@1148..1149 - 0: JS_REFERENCE_IDENTIFIER@1148..1149 - 0: IDENT@1148..1149 "T" [] [] - 1: (empty) - 6: SEMICOLON@1149..1150 ";" [] [] - 2: R_CURLY@1150..1152 "}" [Newline("\n")] [] - 41: JS_VARIABLE_STATEMENT@1152..1214 - 0: JS_VARIABLE_DECLARATION@1152..1214 - 0: (empty) - 1: CONST_KW@1152..1159 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@1159..1214 - 0: JS_VARIABLE_DECLARATOR@1159..1214 - 0: JS_IDENTIFIER_BINDING@1159..1163 - 0: IDENT@1159..1163 "obj" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@1163..1214 - 0: EQ@1163..1165 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@1165..1214 - 0: L_CURLY@1165..1166 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@1166..1212 - 0: JS_METHOD_OBJECT_MEMBER@1166..1212 - 0: (empty) - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@1166..1170 - 0: IDENT@1166..1170 "a" [Newline("\n"), Whitespace(" ")] [] - 3: TS_TYPE_PARAMETERS@1170..1179 - 0: L_ANGLE@1170..1171 "<" [] [] - 1: TS_TYPE_PARAMETER_LIST@1171..1178 - 0: TS_TYPE_PARAMETER@1171..1178 - 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1171..1177 - 0: TS_CONST_MODIFIER@1171..1177 - 0: CONST_KW@1171..1177 "const" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@1177..1178 - 0: IDENT@1177..1178 "T" [] [] - 2: (empty) - 3: (empty) - 2: R_ANGLE@1178..1179 ">" [] [] - 4: JS_PARAMETERS@1179..1187 - 0: L_PAREN@1179..1180 "(" [] [] - 1: JS_PARAMETER_LIST@1180..1186 - 0: JS_FORMAL_PARAMETER@1180..1186 - 0: JS_DECORATOR_LIST@1180..1180 - 1: JS_IDENTIFIER_BINDING@1180..1181 - 0: IDENT@1180..1181 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@1181..1186 - 0: COLON@1181..1183 ":" [] [Whitespace(" ")] - 1: TS_ANY_TYPE@1183..1186 - 0: ANY_KW@1183..1186 "any" [] [] - 4: (empty) - 2: R_PAREN@1186..1187 ")" [] [] - 5: TS_RETURN_TYPE_ANNOTATION@1187..1196 - 0: COLON@1187..1189 ":" [] [Whitespace(" ")] - 1: TS_PREDICATE_RETURN_TYPE@1189..1196 - 0: JS_REFERENCE_IDENTIFIER@1189..1191 - 0: IDENT@1189..1191 "b" [] [Whitespace(" ")] - 1: IS_KW@1191..1194 "is" [] [Whitespace(" ")] - 2: TS_REFERENCE_TYPE@1194..1196 - 0: JS_REFERENCE_IDENTIFIER@1194..1196 - 0: IDENT@1194..1196 "T" [] [Whitespace(" ")] - 1: (empty) - 6: JS_FUNCTION_BODY@1196..1212 - 0: L_CURLY@1196..1198 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@1198..1198 - 2: JS_STATEMENT_LIST@1198..1211 - 0: JS_RETURN_STATEMENT@1198..1211 - 0: RETURN_KW@1198..1205 "return" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@1205..1209 - 0: TRUE_KW@1205..1209 "true" [] [] - 2: SEMICOLON@1209..1211 ";" [] [Whitespace(" ")] - 3: R_CURLY@1211..1212 "}" [] [] - 2: R_CURLY@1212..1214 "}" [Newline("\n")] [] - 1: (empty) - 4: EOF@1214..1215 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast b/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast deleted file mode 100644 index 6d6c82ba16c2..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast +++ /dev/null @@ -1,552 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@0..1 "<" [] [], - name: JsxName { - value_token: JSX_IDENT@1..4 "in" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@4..5 "T" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@5..6 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@6..7 "<" [] [], - slash_token: SLASH@7..8 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@8..10 "in" [] [], - }, - r_angle_token: R_ANGLE@10..11 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@12..14 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@14..18 "out" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@18..19 "T" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@19..20 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@20..21 "<" [] [], - slash_token: SLASH@21..22 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@22..25 "out" [] [], - }, - r_angle_token: R_ANGLE@25..26 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@26..27 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@27..29 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@29..35 "const" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@35..36 "T" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@36..37 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@37..38 "<" [] [], - slash_token: SLASH@38..39 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@39..44 "const" [] [], - }, - r_angle_token: R_ANGLE@44..45 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@45..46 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@46..48 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@48..51 "in" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@51..55 "out" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@55..56 "T" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@56..57 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@57..58 "<" [] [], - slash_token: SLASH@58..59 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@59..61 "in" [] [], - }, - r_angle_token: R_ANGLE@61..62 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@62..63 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@63..65 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@65..69 "out" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@69..72 "in" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@72..73 "T" [] [], - }, - initializer: missing (optional), - }, - ], - r_angle_token: R_ANGLE@73..74 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@74..75 "<" [] [], - slash_token: SLASH@75..76 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@76..79 "out" [] [], - }, - r_angle_token: R_ANGLE@79..80 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@80..81 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@81..83 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@83..86 "in" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@86..88 "T" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@88..95 "extends" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@95..96 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@96..97 "{" [] [], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@97..101 "true" [] [], - }, - r_curly_token: R_CURLY@101..102 "}" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@102..103 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@103..104 "<" [] [], - slash_token: SLASH@104..105 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@105..107 "in" [] [], - }, - r_angle_token: R_ANGLE@107..108 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@108..109 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@109..111 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@111..115 "out" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@115..117 "T" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@117..124 "extends" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@124..125 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@125..126 "{" [] [], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@126..130 "true" [] [], - }, - r_curly_token: R_CURLY@130..131 "}" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@131..132 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@132..133 "<" [] [], - slash_token: SLASH@133..134 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@134..137 "out" [] [], - }, - r_angle_token: R_ANGLE@137..138 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@138..139 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxElement { - opening_element: JsxOpeningElement { - l_angle_token: L_ANGLE@139..141 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@141..144 "in" [] [Whitespace(" ")], - }, - type_arguments: missing (optional), - attributes: JsxAttributeList [ - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@144..148 "out" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@148..150 "T" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@150..157 "extends" [] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@157..158 "=" [] [], - value: JsxExpressionAttributeValue { - l_curly_token: L_CURLY@158..159 "{" [] [], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@159..163 "true" [] [], - }, - r_curly_token: R_CURLY@163..164 "}" [] [], - }, - }, - }, - ], - r_angle_token: R_ANGLE@164..165 ">" [] [], - }, - children: JsxChildList [], - closing_element: JsxClosingElement { - l_angle_token: L_ANGLE@165..166 "<" [] [], - slash_token: SLASH@166..167 "/" [] [], - name: JsxName { - value_token: JSX_IDENT@167..169 "in" [] [], - }, - r_angle_token: R_ANGLE@169..170 ">" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@170..171 ";" [] [], - }, - ], - eof_token: EOF@171..172 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..172 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..171 - 0: JS_EXPRESSION_STATEMENT@0..12 - 0: JSX_TAG_EXPRESSION@0..11 - 0: JSX_ELEMENT@0..11 - 0: JSX_OPENING_ELEMENT@0..6 - 0: L_ANGLE@0..1 "<" [] [] - 1: JSX_NAME@1..4 - 0: JSX_IDENT@1..4 "in" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@4..5 - 0: JSX_ATTRIBUTE@4..5 - 0: JSX_NAME@4..5 - 0: JSX_IDENT@4..5 "T" [] [] - 1: (empty) - 4: R_ANGLE@5..6 ">" [] [] - 1: JSX_CHILD_LIST@6..6 - 2: JSX_CLOSING_ELEMENT@6..11 - 0: L_ANGLE@6..7 "<" [] [] - 1: SLASH@7..8 "/" [] [] - 2: JSX_NAME@8..10 - 0: JSX_IDENT@8..10 "in" [] [] - 3: R_ANGLE@10..11 ">" [] [] - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@12..27 - 0: JSX_TAG_EXPRESSION@12..26 - 0: JSX_ELEMENT@12..26 - 0: JSX_OPENING_ELEMENT@12..20 - 0: L_ANGLE@12..14 "<" [Newline("\n")] [] - 1: JSX_NAME@14..18 - 0: JSX_IDENT@14..18 "out" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@18..19 - 0: JSX_ATTRIBUTE@18..19 - 0: JSX_NAME@18..19 - 0: JSX_IDENT@18..19 "T" [] [] - 1: (empty) - 4: R_ANGLE@19..20 ">" [] [] - 1: JSX_CHILD_LIST@20..20 - 2: JSX_CLOSING_ELEMENT@20..26 - 0: L_ANGLE@20..21 "<" [] [] - 1: SLASH@21..22 "/" [] [] - 2: JSX_NAME@22..25 - 0: JSX_IDENT@22..25 "out" [] [] - 3: R_ANGLE@25..26 ">" [] [] - 1: SEMICOLON@26..27 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@27..46 - 0: JSX_TAG_EXPRESSION@27..45 - 0: JSX_ELEMENT@27..45 - 0: JSX_OPENING_ELEMENT@27..37 - 0: L_ANGLE@27..29 "<" [Newline("\n")] [] - 1: JSX_NAME@29..35 - 0: JSX_IDENT@29..35 "const" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@35..36 - 0: JSX_ATTRIBUTE@35..36 - 0: JSX_NAME@35..36 - 0: JSX_IDENT@35..36 "T" [] [] - 1: (empty) - 4: R_ANGLE@36..37 ">" [] [] - 1: JSX_CHILD_LIST@37..37 - 2: JSX_CLOSING_ELEMENT@37..45 - 0: L_ANGLE@37..38 "<" [] [] - 1: SLASH@38..39 "/" [] [] - 2: JSX_NAME@39..44 - 0: JSX_IDENT@39..44 "const" [] [] - 3: R_ANGLE@44..45 ">" [] [] - 1: SEMICOLON@45..46 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@46..63 - 0: JSX_TAG_EXPRESSION@46..62 - 0: JSX_ELEMENT@46..62 - 0: JSX_OPENING_ELEMENT@46..57 - 0: L_ANGLE@46..48 "<" [Newline("\n")] [] - 1: JSX_NAME@48..51 - 0: JSX_IDENT@48..51 "in" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@51..56 - 0: JSX_ATTRIBUTE@51..55 - 0: JSX_NAME@51..55 - 0: JSX_IDENT@51..55 "out" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@55..56 - 0: JSX_NAME@55..56 - 0: JSX_IDENT@55..56 "T" [] [] - 1: (empty) - 4: R_ANGLE@56..57 ">" [] [] - 1: JSX_CHILD_LIST@57..57 - 2: JSX_CLOSING_ELEMENT@57..62 - 0: L_ANGLE@57..58 "<" [] [] - 1: SLASH@58..59 "/" [] [] - 2: JSX_NAME@59..61 - 0: JSX_IDENT@59..61 "in" [] [] - 3: R_ANGLE@61..62 ">" [] [] - 1: SEMICOLON@62..63 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@63..81 - 0: JSX_TAG_EXPRESSION@63..80 - 0: JSX_ELEMENT@63..80 - 0: JSX_OPENING_ELEMENT@63..74 - 0: L_ANGLE@63..65 "<" [Newline("\n")] [] - 1: JSX_NAME@65..69 - 0: JSX_IDENT@65..69 "out" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@69..73 - 0: JSX_ATTRIBUTE@69..72 - 0: JSX_NAME@69..72 - 0: JSX_IDENT@69..72 "in" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@72..73 - 0: JSX_NAME@72..73 - 0: JSX_IDENT@72..73 "T" [] [] - 1: (empty) - 4: R_ANGLE@73..74 ">" [] [] - 1: JSX_CHILD_LIST@74..74 - 2: JSX_CLOSING_ELEMENT@74..80 - 0: L_ANGLE@74..75 "<" [] [] - 1: SLASH@75..76 "/" [] [] - 2: JSX_NAME@76..79 - 0: JSX_IDENT@76..79 "out" [] [] - 3: R_ANGLE@79..80 ">" [] [] - 1: SEMICOLON@80..81 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@81..109 - 0: JSX_TAG_EXPRESSION@81..108 - 0: JSX_ELEMENT@81..108 - 0: JSX_OPENING_ELEMENT@81..103 - 0: L_ANGLE@81..83 "<" [Newline("\n")] [] - 1: JSX_NAME@83..86 - 0: JSX_IDENT@83..86 "in" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@86..102 - 0: JSX_ATTRIBUTE@86..88 - 0: JSX_NAME@86..88 - 0: JSX_IDENT@86..88 "T" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@88..102 - 0: JSX_NAME@88..95 - 0: JSX_IDENT@88..95 "extends" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@95..102 - 0: EQ@95..96 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@96..102 - 0: L_CURLY@96..97 "{" [] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@97..101 - 0: TRUE_KW@97..101 "true" [] [] - 2: R_CURLY@101..102 "}" [] [] - 4: R_ANGLE@102..103 ">" [] [] - 1: JSX_CHILD_LIST@103..103 - 2: JSX_CLOSING_ELEMENT@103..108 - 0: L_ANGLE@103..104 "<" [] [] - 1: SLASH@104..105 "/" [] [] - 2: JSX_NAME@105..107 - 0: JSX_IDENT@105..107 "in" [] [] - 3: R_ANGLE@107..108 ">" [] [] - 1: SEMICOLON@108..109 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@109..139 - 0: JSX_TAG_EXPRESSION@109..138 - 0: JSX_ELEMENT@109..138 - 0: JSX_OPENING_ELEMENT@109..132 - 0: L_ANGLE@109..111 "<" [Newline("\n")] [] - 1: JSX_NAME@111..115 - 0: JSX_IDENT@111..115 "out" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@115..131 - 0: JSX_ATTRIBUTE@115..117 - 0: JSX_NAME@115..117 - 0: JSX_IDENT@115..117 "T" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@117..131 - 0: JSX_NAME@117..124 - 0: JSX_IDENT@117..124 "extends" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@124..131 - 0: EQ@124..125 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@125..131 - 0: L_CURLY@125..126 "{" [] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@126..130 - 0: TRUE_KW@126..130 "true" [] [] - 2: R_CURLY@130..131 "}" [] [] - 4: R_ANGLE@131..132 ">" [] [] - 1: JSX_CHILD_LIST@132..132 - 2: JSX_CLOSING_ELEMENT@132..138 - 0: L_ANGLE@132..133 "<" [] [] - 1: SLASH@133..134 "/" [] [] - 2: JSX_NAME@134..137 - 0: JSX_IDENT@134..137 "out" [] [] - 3: R_ANGLE@137..138 ">" [] [] - 1: SEMICOLON@138..139 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@139..171 - 0: JSX_TAG_EXPRESSION@139..170 - 0: JSX_ELEMENT@139..170 - 0: JSX_OPENING_ELEMENT@139..165 - 0: L_ANGLE@139..141 "<" [Newline("\n")] [] - 1: JSX_NAME@141..144 - 0: JSX_IDENT@141..144 "in" [] [Whitespace(" ")] - 2: (empty) - 3: JSX_ATTRIBUTE_LIST@144..164 - 0: JSX_ATTRIBUTE@144..148 - 0: JSX_NAME@144..148 - 0: JSX_IDENT@144..148 "out" [] [Whitespace(" ")] - 1: (empty) - 1: JSX_ATTRIBUTE@148..150 - 0: JSX_NAME@148..150 - 0: JSX_IDENT@148..150 "T" [] [Whitespace(" ")] - 1: (empty) - 2: JSX_ATTRIBUTE@150..164 - 0: JSX_NAME@150..157 - 0: JSX_IDENT@150..157 "extends" [] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@157..164 - 0: EQ@157..158 "=" [] [] - 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@158..164 - 0: L_CURLY@158..159 "{" [] [] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@159..163 - 0: TRUE_KW@159..163 "true" [] [] - 2: R_CURLY@163..164 "}" [] [] - 4: R_ANGLE@164..165 ">" [] [] - 1: JSX_CHILD_LIST@165..165 - 2: JSX_CLOSING_ELEMENT@165..170 - 0: L_ANGLE@165..166 "<" [] [] - 1: SLASH@166..167 "/" [] [] - 2: JSX_NAME@167..169 - 0: JSX_IDENT@167..169 "in" [] [] - 3: R_ANGLE@169..170 ">" [] [] - 1: SEMICOLON@170..171 ";" [] [] - 4: EOF@171..172 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_enum.rast b/crates/biome_js_parser/test_data/inline/ok/typescript_enum.rast deleted file mode 100644 index 42bdc51923c5..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/typescript_enum.rast +++ /dev/null @@ -1,185 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@5..7 "A" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@7..8 "{" [] [], - members: TsEnumMemberList [], - r_curly_token: R_CURLY@8..9 "}" [] [], - }, - TsEnumDeclaration { - const_token: missing (optional), - enum_token: ENUM_KW@9..15 "enum" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@15..17 "B" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@19..20 "a" [] [], - }, - initializer: missing (optional), - }, - COMMA@20..22 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@22..23 "b" [] [], - }, - initializer: missing (optional), - }, - COMMA@23..25 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@25..27 "c" [] [Whitespace(" ")], - }, - initializer: missing (optional), - }, - ], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - TsEnumDeclaration { - const_token: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")], - enum_token: ENUM_KW@35..40 "enum" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@40..42 "C" [] [Whitespace(" ")], - }, - l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], - members: TsEnumMemberList [ - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@44..46 "A" [] [Whitespace(" ")], - }, - initializer: JsInitializerClause { - eq_token: EQ@46..48 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@48..49 "1" [] [], - }, - }, - }, - COMMA@49..51 "," [] [Whitespace(" ")], - TsEnumMember { - name: TsLiteralEnumMemberName { - value: IDENT@51..53 "B" [] [Whitespace(" ")], - }, - initializer: JsInitializerClause { - eq_token: EQ@53..55 "=" [] [Whitespace(" ")], - expression: JsBinaryExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..57 "A" [] [Whitespace(" ")], - }, - }, - operator_token: STAR@57..59 "*" [] [Whitespace(" ")], - right: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@59..60 "2" [] [], - }, - }, - }, - }, - COMMA@60..62 "," [] [Whitespace(" ")], - TsEnumMember { - name: JsComputedMemberName { - l_brack_token: L_BRACK@62..63 "[" [] [], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@63..66 "\"A\"" [] [], - }, - r_brack_token: R_BRACK@66..68 "]" [] [Whitespace(" ")], - }, - initializer: JsInitializerClause { - eq_token: EQ@68..70 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@70..71 "3" [] [], - }, - }, - }, - COMMA@71..73 "," [] [Whitespace(" ")], - ], - r_curly_token: R_CURLY@73..74 "}" [] [], - }, - ], - eof_token: EOF@74..75 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..75 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..74 - 0: TS_ENUM_DECLARATION@0..9 - 0: (empty) - 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@5..7 - 0: IDENT@5..7 "A" [] [Whitespace(" ")] - 3: L_CURLY@7..8 "{" [] [] - 4: TS_ENUM_MEMBER_LIST@8..8 - 5: R_CURLY@8..9 "}" [] [] - 1: TS_ENUM_DECLARATION@9..28 - 0: (empty) - 1: ENUM_KW@9..15 "enum" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@15..17 - 0: IDENT@15..17 "B" [] [Whitespace(" ")] - 3: L_CURLY@17..19 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@19..27 - 0: TS_ENUM_MEMBER@19..20 - 0: TS_LITERAL_ENUM_MEMBER_NAME@19..20 - 0: IDENT@19..20 "a" [] [] - 1: (empty) - 1: COMMA@20..22 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@22..23 - 0: TS_LITERAL_ENUM_MEMBER_NAME@22..23 - 0: IDENT@22..23 "b" [] [] - 1: (empty) - 3: COMMA@23..25 "," [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER@25..27 - 0: TS_LITERAL_ENUM_MEMBER_NAME@25..27 - 0: IDENT@25..27 "c" [] [Whitespace(" ")] - 1: (empty) - 5: R_CURLY@27..28 "}" [] [] - 2: TS_ENUM_DECLARATION@28..74 - 0: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")] - 1: ENUM_KW@35..40 "enum" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "C" [] [Whitespace(" ")] - 3: L_CURLY@42..44 "{" [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER_LIST@44..73 - 0: TS_ENUM_MEMBER@44..49 - 0: TS_LITERAL_ENUM_MEMBER_NAME@44..46 - 0: IDENT@44..46 "A" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@46..49 - 0: EQ@46..48 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@48..49 - 0: JS_NUMBER_LITERAL@48..49 "1" [] [] - 1: COMMA@49..51 "," [] [Whitespace(" ")] - 2: TS_ENUM_MEMBER@51..60 - 0: TS_LITERAL_ENUM_MEMBER_NAME@51..53 - 0: IDENT@51..53 "B" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@53..60 - 0: EQ@53..55 "=" [] [Whitespace(" ")] - 1: JS_BINARY_EXPRESSION@55..60 - 0: JS_IDENTIFIER_EXPRESSION@55..57 - 0: JS_REFERENCE_IDENTIFIER@55..57 - 0: IDENT@55..57 "A" [] [Whitespace(" ")] - 1: STAR@57..59 "*" [] [Whitespace(" ")] - 2: JS_NUMBER_LITERAL_EXPRESSION@59..60 - 0: JS_NUMBER_LITERAL@59..60 "2" [] [] - 3: COMMA@60..62 "," [] [Whitespace(" ")] - 4: TS_ENUM_MEMBER@62..71 - 0: JS_COMPUTED_MEMBER_NAME@62..68 - 0: L_BRACK@62..63 "[" [] [] - 1: JS_STRING_LITERAL_EXPRESSION@63..66 - 0: JS_STRING_LITERAL@63..66 "\"A\"" [] [] - 2: R_BRACK@66..68 "]" [] [Whitespace(" ")] - 1: JS_INITIALIZER_CLAUSE@68..71 - 0: EQ@68..70 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@70..71 - 0: JS_NUMBER_LITERAL@70..71 "3" [] [] - 5: COMMA@71..73 "," [] [Whitespace(" ")] - 5: R_CURLY@73..74 "}" [] [] - 4: EOF@74..75 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.rast b/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.rast deleted file mode 100644 index 2bc38719adcc..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.rast +++ /dev/null @@ -1,52 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExport { - decorators: JsDecoratorList [], - export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], - export_clause: JsExportDefaultDeclarationClause { - default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], - declaration: JsClassExportDefaultDeclaration { - decorators: JsDecoratorList [], - abstract_token: ABSTRACT_KW@15..24 "abstract" [] [Whitespace(" ")], - class_token: CLASS_KW@24..30 "class" [] [Whitespace(" ")], - id: missing (optional), - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@30..31 "{" [] [], - members: JsClassMemberList [], - r_curly_token: R_CURLY@31..32 "}" [] [], - }, - semicolon_token: missing (optional), - }, - }, - ], - eof_token: EOF@32..33 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..33 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..32 - 0: JS_EXPORT@0..32 - 0: JS_DECORATOR_LIST@0..0 - 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] - 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..32 - 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] - 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@15..32 - 0: JS_DECORATOR_LIST@15..15 - 1: ABSTRACT_KW@15..24 "abstract" [] [Whitespace(" ")] - 2: CLASS_KW@24..30 "class" [] [Whitespace(" ")] - 3: (empty) - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@30..31 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@31..31 - 9: R_CURLY@31..32 "}" [] [] - 2: (empty) - 4: EOF@32..33 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast b/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast deleted file mode 100644 index 9555ccbce9e9..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast +++ /dev/null @@ -1,327 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - TsDeclareStatement { - declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], - declaration: JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@14..19 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@19..20 "{" [] [], - members: JsClassMemberList [ - TsConstructorSignatureClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@36..37 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@37..38 ")" [] [], - }, - semicolon_token: SEMICOLON@38..39 ";" [] [], - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@39..48 "name" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@48..49 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@49..50 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - TsGetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - get_token: GET_KW@51..60 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@60..64 "test" [] [], - }, - l_paren_token: L_PAREN@64..65 "(" [] [], - r_paren_token: R_PAREN@65..66 ")" [] [], - return_type: TsTypeAnnotation { - colon_token: COLON@66..68 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@68..74 "string" [] [], - }, - }, - semicolon_token: SEMICOLON@74..75 ";" [] [], - }, - TsSetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - set_token: SET_KW@75..84 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@84..88 "test" [] [], - }, - l_paren_token: L_PAREN@88..89 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@89..90 "v" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@90..91 ")" [] [], - semicolon_token: SEMICOLON@91..92 ";" [] [], - }, - ], - r_curly_token: R_CURLY@92..94 "}" [Newline("\n")] [], - }, - }, - TsDeclareStatement { - declare_token: DECLARE_KW@94..103 "declare" [Newline("\n")] [Whitespace(" ")], - declaration: TsModuleDeclaration { - module_or_namespace: NAMESPACE_KW@103..113 "namespace" [] [Whitespace(" ")], - name: TsIdentifierBinding { - name_token: IDENT@113..115 "n" [] [Whitespace(" ")], - }, - body: TsModuleBlock { - l_curly_token: L_CURLY@115..116 "{" [] [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@116..128 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@128..133 "Test" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@133..134 "{" [] [], - members: JsClassMemberList [ - TsConstructorSignatureClassMember { - modifiers: JsConstructorModifierList [], - name: JsLiteralMemberName { - value: IDENT@134..155 "constructor" [Newline("\n"), Whitespace(" ")] [], - }, - parameters: JsConstructorParameters { - l_paren_token: L_PAREN@155..156 "(" [] [], - parameters: JsConstructorParameterList [], - r_paren_token: R_PAREN@156..157 ")" [] [], - }, - semicolon_token: missing (optional), - }, - TsMethodSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - async_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@157..171 "name" [Newline("\n"), Whitespace(" ")] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@171..172 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@172..173 ")" [] [], - }, - return_type_annotation: missing (optional), - semicolon_token: missing (optional), - }, - TsGetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - get_token: GET_KW@173..187 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@187..191 "test" [] [], - }, - l_paren_token: L_PAREN@191..192 "(" [] [], - r_paren_token: R_PAREN@192..193 ")" [] [], - return_type: TsTypeAnnotation { - colon_token: COLON@193..195 ":" [] [Whitespace(" ")], - ty: TsStringType { - string_token: STRING_KW@195..201 "string" [] [], - }, - }, - semicolon_token: missing (optional), - }, - TsSetterSignatureClassMember { - modifiers: TsMethodSignatureModifierList [], - set_token: SET_KW@201..215 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@215..219 "test" [] [], - }, - l_paren_token: L_PAREN@219..220 "(" [] [], - parameter: JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@220..221 "v" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - comma_token: missing (optional), - r_paren_token: R_PAREN@221..222 ")" [] [], - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@222..229 "}" [Newline("\n"), Whitespace(" ")] [], - }, - ], - r_curly_token: R_CURLY@229..231 "}" [Newline("\n")] [], - }, - }, - }, - ], - eof_token: EOF@231..232 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..232 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..231 - 0: TS_DECLARE_STATEMENT@0..94 - 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] - 1: JS_CLASS_DECLARATION@8..94 - 0: JS_DECORATOR_LIST@8..8 - 1: (empty) - 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@14..19 - 0: IDENT@14..19 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@19..20 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@20..92 - 0: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@20..39 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 - 1: JS_LITERAL_MEMBER_NAME@20..36 - 0: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@36..38 - 0: L_PAREN@36..37 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@37..37 - 2: R_PAREN@37..38 ")" [] [] - 3: SEMICOLON@38..39 ";" [] [] - 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@39..51 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@39..39 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@39..48 - 0: IDENT@39..48 "name" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@48..50 - 0: L_PAREN@48..49 "(" [] [] - 1: JS_PARAMETER_LIST@49..49 - 2: R_PAREN@49..50 ")" [] [] - 6: (empty) - 7: SEMICOLON@50..51 ";" [] [] - 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@51..75 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@51..51 - 1: GET_KW@51..60 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@60..64 - 0: IDENT@60..64 "test" [] [] - 3: L_PAREN@64..65 "(" [] [] - 4: R_PAREN@65..66 ")" [] [] - 5: TS_TYPE_ANNOTATION@66..74 - 0: COLON@66..68 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@68..74 - 0: STRING_KW@68..74 "string" [] [] - 6: SEMICOLON@74..75 ";" [] [] - 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@75..92 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@75..75 - 1: SET_KW@75..84 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@84..88 - 0: IDENT@84..88 "test" [] [] - 3: L_PAREN@88..89 "(" [] [] - 4: JS_FORMAL_PARAMETER@89..90 - 0: JS_DECORATOR_LIST@89..89 - 1: JS_IDENTIFIER_BINDING@89..90 - 0: IDENT@89..90 "v" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@90..91 ")" [] [] - 7: SEMICOLON@91..92 ";" [] [] - 9: R_CURLY@92..94 "}" [Newline("\n")] [] - 1: TS_DECLARE_STATEMENT@94..231 - 0: DECLARE_KW@94..103 "declare" [Newline("\n")] [Whitespace(" ")] - 1: TS_MODULE_DECLARATION@103..231 - 0: NAMESPACE_KW@103..113 "namespace" [] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@113..115 - 0: IDENT@113..115 "n" [] [Whitespace(" ")] - 2: TS_MODULE_BLOCK@115..231 - 0: L_CURLY@115..116 "{" [] [] - 1: JS_MODULE_ITEM_LIST@116..229 - 0: JS_CLASS_DECLARATION@116..229 - 0: JS_DECORATOR_LIST@116..116 - 1: (empty) - 2: CLASS_KW@116..128 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@128..133 - 0: IDENT@128..133 "Test" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@133..134 "{" [] [] - 8: JS_CLASS_MEMBER_LIST@134..222 - 0: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@134..157 - 0: JS_CONSTRUCTOR_MODIFIER_LIST@134..134 - 1: JS_LITERAL_MEMBER_NAME@134..155 - 0: IDENT@134..155 "constructor" [Newline("\n"), Whitespace(" ")] [] - 2: JS_CONSTRUCTOR_PARAMETERS@155..157 - 0: L_PAREN@155..156 "(" [] [] - 1: JS_CONSTRUCTOR_PARAMETER_LIST@156..156 - 2: R_PAREN@156..157 ")" [] [] - 3: (empty) - 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@157..173 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@157..157 - 1: (empty) - 2: JS_LITERAL_MEMBER_NAME@157..171 - 0: IDENT@157..171 "name" [Newline("\n"), Whitespace(" ")] [] - 3: (empty) - 4: (empty) - 5: JS_PARAMETERS@171..173 - 0: L_PAREN@171..172 "(" [] [] - 1: JS_PARAMETER_LIST@172..172 - 2: R_PAREN@172..173 ")" [] [] - 6: (empty) - 7: (empty) - 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@173..201 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@173..173 - 1: GET_KW@173..187 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@187..191 - 0: IDENT@187..191 "test" [] [] - 3: L_PAREN@191..192 "(" [] [] - 4: R_PAREN@192..193 ")" [] [] - 5: TS_TYPE_ANNOTATION@193..201 - 0: COLON@193..195 ":" [] [Whitespace(" ")] - 1: TS_STRING_TYPE@195..201 - 0: STRING_KW@195..201 "string" [] [] - 6: (empty) - 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@201..222 - 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@201..201 - 1: SET_KW@201..215 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 2: JS_LITERAL_MEMBER_NAME@215..219 - 0: IDENT@215..219 "test" [] [] - 3: L_PAREN@219..220 "(" [] [] - 4: JS_FORMAL_PARAMETER@220..221 - 0: JS_DECORATOR_LIST@220..220 - 1: JS_IDENTIFIER_BINDING@220..221 - 0: IDENT@220..221 "v" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 5: (empty) - 6: R_PAREN@221..222 ")" [] [] - 7: (empty) - 9: R_CURLY@222..229 "}" [Newline("\n"), Whitespace(" ")] [] - 2: R_CURLY@229..231 "}" [Newline("\n")] [] - 4: EOF@231..232 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete.rast b/crates/biome_js_parser/test_data/inline/ok/unary_delete.rast deleted file mode 100644 index 3cb0b7158a87..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/unary_delete.rast +++ /dev/null @@ -1,1248 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@0..7 "delete" [] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@7..10 "obj" [] [], - }, - }, - operator_token: DOT@10..11 "." [] [], - member: JsName { - value_token: IDENT@11..14 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@14..15 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@23..24 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@24..27 "obj" [] [], - }, - }, - r_paren_token: R_PAREN@27..28 ")" [] [], - }, - operator_token: DOT@28..29 "." [] [], - member: JsName { - value_token: IDENT@29..32 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@32..33 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..44 "obj" [] [], - }, - }, - operator_token: DOT@44..45 "." [] [], - member: JsPrivateName { - hash_token: HASH@45..46 "#" [] [], - value_token: IDENT@46..52 "member" [] [], - }, - }, - operator_token: DOT@52..53 "." [] [], - member: JsName { - value_token: IDENT@53..56 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@56..57 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@57..65 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@65..66 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@66..69 "obj" [] [], - }, - }, - operator_token: DOT@69..70 "." [] [], - member: JsPrivateName { - hash_token: HASH@70..71 "#" [] [], - value_token: IDENT@71..77 "member" [] [], - }, - }, - r_paren_token: R_PAREN@77..78 ")" [] [], - }, - operator_token: DOT@78..79 "." [] [], - member: JsName { - value_token: IDENT@79..82 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@82..83 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@83..91 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@91..95 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@95..96 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@96..97 ")" [] [], - }, - }, - operator_token: DOT@97..98 "." [] [], - member: JsPrivateName { - hash_token: HASH@98..99 "#" [] [], - value_token: IDENT@99..105 "member" [] [], - }, - }, - operator_token: DOT@105..106 "." [] [], - member: JsName { - value_token: IDENT@106..109 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@109..110 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@110..118 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@118..119 "(" [] [], - expression: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@119..123 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@123..124 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@124..125 ")" [] [], - }, - }, - operator_token: DOT@125..126 "." [] [], - member: JsPrivateName { - hash_token: HASH@126..127 "#" [] [], - value_token: IDENT@127..133 "member" [] [], - }, - }, - r_paren_token: R_PAREN@133..134 ")" [] [], - }, - operator_token: DOT@134..135 "." [] [], - member: JsName { - value_token: IDENT@135..138 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@138..139 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@139..147 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@147..150 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@150..152 "?." [] [], - member: JsPrivateName { - hash_token: HASH@152..153 "#" [] [], - value_token: IDENT@153..159 "member" [] [], - }, - }, - operator_token: DOT@159..160 "." [] [], - member: JsName { - value_token: IDENT@160..163 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@163..164 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@164..172 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@172..173 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@173..176 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@176..178 "?." [] [], - member: JsPrivateName { - hash_token: HASH@178..179 "#" [] [], - value_token: IDENT@179..185 "member" [] [], - }, - }, - r_paren_token: R_PAREN@185..186 ")" [] [], - }, - operator_token: DOT@186..187 "." [] [], - member: JsName { - value_token: IDENT@187..190 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@190..191 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@191..199 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@199..202 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@202..204 "?." [] [], - member: JsName { - value_token: IDENT@204..209 "inner" [] [], - }, - }, - operator_token: DOT@209..210 "." [] [], - member: JsPrivateName { - hash_token: HASH@210..211 "#" [] [], - value_token: IDENT@211..217 "member" [] [], - }, - }, - operator_token: DOT@217..218 "." [] [], - member: JsName { - value_token: IDENT@218..221 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@221..222 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@222..230 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsStaticMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@230..231 "(" [] [], - expression: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@231..234 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@234..236 "?." [] [], - member: JsName { - value_token: IDENT@236..241 "inner" [] [], - }, - }, - operator_token: DOT@241..242 "." [] [], - member: JsPrivateName { - hash_token: HASH@242..243 "#" [] [], - value_token: IDENT@243..249 "member" [] [], - }, - }, - r_paren_token: R_PAREN@249..250 ")" [] [], - }, - operator_token: DOT@250..251 "." [] [], - member: JsName { - value_token: IDENT@251..254 "key" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@254..255 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@255..263 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@263..266 "obj" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@266..267 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@267..270 "key" [] [], - }, - }, - r_brack_token: R_BRACK@270..271 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@271..272 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@272..280 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@280..281 "(" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@281..284 "obj" [] [], - }, - }, - r_paren_token: R_PAREN@284..285 ")" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@285..286 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@286..289 "key" [] [], - }, - }, - r_brack_token: R_BRACK@289..290 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@290..291 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@291..299 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@299..302 "obj" [] [], - }, - }, - operator_token: DOT@302..303 "." [] [], - member: JsPrivateName { - hash_token: HASH@303..304 "#" [] [], - value_token: IDENT@304..310 "member" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@310..311 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@311..314 "key" [] [], - }, - }, - r_brack_token: R_BRACK@314..315 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@315..316 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@316..324 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@324..325 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@325..328 "obj" [] [], - }, - }, - operator_token: DOT@328..329 "." [] [], - member: JsPrivateName { - hash_token: HASH@329..330 "#" [] [], - value_token: IDENT@330..336 "member" [] [], - }, - }, - r_paren_token: R_PAREN@336..337 ")" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@337..338 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@338..341 "key" [] [], - }, - }, - r_brack_token: R_BRACK@341..342 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@342..343 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@343..351 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@351..355 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@355..356 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@356..357 ")" [] [], - }, - }, - operator_token: DOT@357..358 "." [] [], - member: JsPrivateName { - hash_token: HASH@358..359 "#" [] [], - value_token: IDENT@359..365 "member" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@365..366 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@366..369 "key" [] [], - }, - }, - r_brack_token: R_BRACK@369..370 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@370..371 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@371..379 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@379..380 "(" [] [], - expression: JsStaticMemberExpression { - object: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@380..384 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@384..385 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@385..386 ")" [] [], - }, - }, - operator_token: DOT@386..387 "." [] [], - member: JsPrivateName { - hash_token: HASH@387..388 "#" [] [], - value_token: IDENT@388..394 "member" [] [], - }, - }, - r_paren_token: R_PAREN@394..395 ")" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@395..396 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@396..399 "key" [] [], - }, - }, - r_brack_token: R_BRACK@399..400 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@400..401 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@401..409 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@409..412 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@412..414 "?." [] [], - member: JsPrivateName { - hash_token: HASH@414..415 "#" [] [], - value_token: IDENT@415..421 "member" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@421..422 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@422..425 "key" [] [], - }, - }, - r_brack_token: R_BRACK@425..426 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@426..427 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@427..435 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@435..436 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@436..439 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@439..441 "?." [] [], - member: JsPrivateName { - hash_token: HASH@441..442 "#" [] [], - value_token: IDENT@442..448 "member" [] [], - }, - }, - r_paren_token: R_PAREN@448..449 ")" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@449..450 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@450..453 "key" [] [], - }, - }, - r_brack_token: R_BRACK@453..454 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@454..455 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@455..463 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@463..466 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@466..468 "?." [] [], - member: JsName { - value_token: IDENT@468..473 "inner" [] [], - }, - }, - operator_token: DOT@473..474 "." [] [], - member: JsPrivateName { - hash_token: HASH@474..475 "#" [] [], - value_token: IDENT@475..481 "member" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@481..482 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@482..485 "key" [] [], - }, - }, - r_brack_token: R_BRACK@485..486 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@486..487 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@487..495 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsParenthesizedExpression { - l_paren_token: L_PAREN@495..496 "(" [] [], - expression: JsStaticMemberExpression { - object: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@496..499 "obj" [] [], - }, - }, - operator_token: QUESTIONDOT@499..501 "?." [] [], - member: JsName { - value_token: IDENT@501..506 "inner" [] [], - }, - }, - operator_token: DOT@506..507 "." [] [], - member: JsPrivateName { - hash_token: HASH@507..508 "#" [] [], - value_token: IDENT@508..514 "member" [] [], - }, - }, - r_paren_token: R_PAREN@514..515 ")" [] [], - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@515..516 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@516..519 "key" [] [], - }, - }, - r_brack_token: R_BRACK@519..520 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@520..521 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@521..529 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@529..530 "(" [] [], - expression: JsSequenceExpression { - left: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@530..533 "obj" [] [], - }, - }, - operator_token: DOT@533..534 "." [] [], - member: JsPrivateName { - hash_token: HASH@534..535 "#" [] [], - value_token: IDENT@535..538 "key" [] [], - }, - }, - comma_token: COMMA@538..540 "," [] [Whitespace(" ")], - right: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@540..543 "obj" [] [], - }, - }, - operator_token: DOT@543..544 "." [] [], - member: JsName { - value_token: IDENT@544..547 "key" [] [], - }, - }, - }, - r_paren_token: R_PAREN@547..548 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@548..549 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@549..557 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@557..558 "(" [] [], - expression: JsInExpression { - property: JsPrivateName { - hash_token: HASH@558..559 "#" [] [], - value_token: IDENT@559..563 "key" [] [Whitespace(" ")], - }, - in_token: IN_KW@563..566 "in" [] [Whitespace(" ")], - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@566..569 "obj" [] [], - }, - }, - }, - r_paren_token: R_PAREN@569..570 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@570..571 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@571..579 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@579..580 "(" [] [], - expression: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@580..583 "obj" [] [], - }, - }, - operator_token: DOT@583..584 "." [] [], - member: JsName { - value_token: IDENT@584..587 "key" [] [], - }, - }, - r_paren_token: R_PAREN@587..588 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@588..589 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@589..597 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@597..598 "(" [] [], - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@598..605 "console" [] [], - }, - }, - operator_token: DOT@605..606 "." [] [], - member: JsName { - value_token: IDENT@606..609 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@609..610 "(" [] [], - args: JsCallArgumentList [ - JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@610..611 "1" [] [], - }, - ], - r_paren_token: R_PAREN@611..612 ")" [] [], - }, - }, - r_paren_token: R_PAREN@612..613 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@613..614 ";" [] [], - }, - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@614..622 "delete" [Newline("\n")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@622..623 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@623..624 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@624..626 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@626..629 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@629..630 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [], - r_curly_token: R_CURLY@630..631 "}" [] [], - }, - }, - r_paren_token: R_PAREN@631..632 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@632..633 ";" [] [], - }, - ], - eof_token: EOF@633..634 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..634 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..633 - 0: JS_EXPRESSION_STATEMENT@0..15 - 0: JS_UNARY_EXPRESSION@0..14 - 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@7..14 - 0: JS_IDENTIFIER_EXPRESSION@7..10 - 0: JS_REFERENCE_IDENTIFIER@7..10 - 0: IDENT@7..10 "obj" [] [] - 1: DOT@10..11 "." [] [] - 2: JS_NAME@11..14 - 0: IDENT@11..14 "key" [] [] - 1: SEMICOLON@14..15 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@15..33 - 0: JS_UNARY_EXPRESSION@15..32 - 0: DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@23..32 - 0: JS_PARENTHESIZED_EXPRESSION@23..28 - 0: L_PAREN@23..24 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@24..27 - 0: JS_REFERENCE_IDENTIFIER@24..27 - 0: IDENT@24..27 "obj" [] [] - 2: R_PAREN@27..28 ")" [] [] - 1: DOT@28..29 "." [] [] - 2: JS_NAME@29..32 - 0: IDENT@29..32 "key" [] [] - 1: SEMICOLON@32..33 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@33..57 - 0: JS_UNARY_EXPRESSION@33..56 - 0: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@41..56 - 0: JS_STATIC_MEMBER_EXPRESSION@41..52 - 0: JS_IDENTIFIER_EXPRESSION@41..44 - 0: JS_REFERENCE_IDENTIFIER@41..44 - 0: IDENT@41..44 "obj" [] [] - 1: DOT@44..45 "." [] [] - 2: JS_PRIVATE_NAME@45..52 - 0: HASH@45..46 "#" [] [] - 1: IDENT@46..52 "member" [] [] - 1: DOT@52..53 "." [] [] - 2: JS_NAME@53..56 - 0: IDENT@53..56 "key" [] [] - 1: SEMICOLON@56..57 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@57..83 - 0: JS_UNARY_EXPRESSION@57..82 - 0: DELETE_KW@57..65 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@65..82 - 0: JS_PARENTHESIZED_EXPRESSION@65..78 - 0: L_PAREN@65..66 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@66..77 - 0: JS_IDENTIFIER_EXPRESSION@66..69 - 0: JS_REFERENCE_IDENTIFIER@66..69 - 0: IDENT@66..69 "obj" [] [] - 1: DOT@69..70 "." [] [] - 2: JS_PRIVATE_NAME@70..77 - 0: HASH@70..71 "#" [] [] - 1: IDENT@71..77 "member" [] [] - 2: R_PAREN@77..78 ")" [] [] - 1: DOT@78..79 "." [] [] - 2: JS_NAME@79..82 - 0: IDENT@79..82 "key" [] [] - 1: SEMICOLON@82..83 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@83..110 - 0: JS_UNARY_EXPRESSION@83..109 - 0: DELETE_KW@83..91 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@91..109 - 0: JS_STATIC_MEMBER_EXPRESSION@91..105 - 0: JS_CALL_EXPRESSION@91..97 - 0: JS_IDENTIFIER_EXPRESSION@91..95 - 0: JS_REFERENCE_IDENTIFIER@91..95 - 0: IDENT@91..95 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@95..97 - 0: L_PAREN@95..96 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@96..96 - 2: R_PAREN@96..97 ")" [] [] - 1: DOT@97..98 "." [] [] - 2: JS_PRIVATE_NAME@98..105 - 0: HASH@98..99 "#" [] [] - 1: IDENT@99..105 "member" [] [] - 1: DOT@105..106 "." [] [] - 2: JS_NAME@106..109 - 0: IDENT@106..109 "key" [] [] - 1: SEMICOLON@109..110 ";" [] [] - 5: JS_EXPRESSION_STATEMENT@110..139 - 0: JS_UNARY_EXPRESSION@110..138 - 0: DELETE_KW@110..118 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@118..138 - 0: JS_PARENTHESIZED_EXPRESSION@118..134 - 0: L_PAREN@118..119 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@119..133 - 0: JS_CALL_EXPRESSION@119..125 - 0: JS_IDENTIFIER_EXPRESSION@119..123 - 0: JS_REFERENCE_IDENTIFIER@119..123 - 0: IDENT@119..123 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@123..125 - 0: L_PAREN@123..124 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@124..124 - 2: R_PAREN@124..125 ")" [] [] - 1: DOT@125..126 "." [] [] - 2: JS_PRIVATE_NAME@126..133 - 0: HASH@126..127 "#" [] [] - 1: IDENT@127..133 "member" [] [] - 2: R_PAREN@133..134 ")" [] [] - 1: DOT@134..135 "." [] [] - 2: JS_NAME@135..138 - 0: IDENT@135..138 "key" [] [] - 1: SEMICOLON@138..139 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@139..164 - 0: JS_UNARY_EXPRESSION@139..163 - 0: DELETE_KW@139..147 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@147..163 - 0: JS_STATIC_MEMBER_EXPRESSION@147..159 - 0: JS_IDENTIFIER_EXPRESSION@147..150 - 0: JS_REFERENCE_IDENTIFIER@147..150 - 0: IDENT@147..150 "obj" [] [] - 1: QUESTIONDOT@150..152 "?." [] [] - 2: JS_PRIVATE_NAME@152..159 - 0: HASH@152..153 "#" [] [] - 1: IDENT@153..159 "member" [] [] - 1: DOT@159..160 "." [] [] - 2: JS_NAME@160..163 - 0: IDENT@160..163 "key" [] [] - 1: SEMICOLON@163..164 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@164..191 - 0: JS_UNARY_EXPRESSION@164..190 - 0: DELETE_KW@164..172 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@172..190 - 0: JS_PARENTHESIZED_EXPRESSION@172..186 - 0: L_PAREN@172..173 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@173..185 - 0: JS_IDENTIFIER_EXPRESSION@173..176 - 0: JS_REFERENCE_IDENTIFIER@173..176 - 0: IDENT@173..176 "obj" [] [] - 1: QUESTIONDOT@176..178 "?." [] [] - 2: JS_PRIVATE_NAME@178..185 - 0: HASH@178..179 "#" [] [] - 1: IDENT@179..185 "member" [] [] - 2: R_PAREN@185..186 ")" [] [] - 1: DOT@186..187 "." [] [] - 2: JS_NAME@187..190 - 0: IDENT@187..190 "key" [] [] - 1: SEMICOLON@190..191 ";" [] [] - 8: JS_EXPRESSION_STATEMENT@191..222 - 0: JS_UNARY_EXPRESSION@191..221 - 0: DELETE_KW@191..199 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@199..221 - 0: JS_STATIC_MEMBER_EXPRESSION@199..217 - 0: JS_STATIC_MEMBER_EXPRESSION@199..209 - 0: JS_IDENTIFIER_EXPRESSION@199..202 - 0: JS_REFERENCE_IDENTIFIER@199..202 - 0: IDENT@199..202 "obj" [] [] - 1: QUESTIONDOT@202..204 "?." [] [] - 2: JS_NAME@204..209 - 0: IDENT@204..209 "inner" [] [] - 1: DOT@209..210 "." [] [] - 2: JS_PRIVATE_NAME@210..217 - 0: HASH@210..211 "#" [] [] - 1: IDENT@211..217 "member" [] [] - 1: DOT@217..218 "." [] [] - 2: JS_NAME@218..221 - 0: IDENT@218..221 "key" [] [] - 1: SEMICOLON@221..222 ";" [] [] - 9: JS_EXPRESSION_STATEMENT@222..255 - 0: JS_UNARY_EXPRESSION@222..254 - 0: DELETE_KW@222..230 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_STATIC_MEMBER_EXPRESSION@230..254 - 0: JS_PARENTHESIZED_EXPRESSION@230..250 - 0: L_PAREN@230..231 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@231..249 - 0: JS_STATIC_MEMBER_EXPRESSION@231..241 - 0: JS_IDENTIFIER_EXPRESSION@231..234 - 0: JS_REFERENCE_IDENTIFIER@231..234 - 0: IDENT@231..234 "obj" [] [] - 1: QUESTIONDOT@234..236 "?." [] [] - 2: JS_NAME@236..241 - 0: IDENT@236..241 "inner" [] [] - 1: DOT@241..242 "." [] [] - 2: JS_PRIVATE_NAME@242..249 - 0: HASH@242..243 "#" [] [] - 1: IDENT@243..249 "member" [] [] - 2: R_PAREN@249..250 ")" [] [] - 1: DOT@250..251 "." [] [] - 2: JS_NAME@251..254 - 0: IDENT@251..254 "key" [] [] - 1: SEMICOLON@254..255 ";" [] [] - 10: JS_EXPRESSION_STATEMENT@255..272 - 0: JS_UNARY_EXPRESSION@255..271 - 0: DELETE_KW@255..263 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@263..271 - 0: JS_IDENTIFIER_EXPRESSION@263..266 - 0: JS_REFERENCE_IDENTIFIER@263..266 - 0: IDENT@263..266 "obj" [] [] - 1: (empty) - 2: L_BRACK@266..267 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@267..270 - 0: JS_REFERENCE_IDENTIFIER@267..270 - 0: IDENT@267..270 "key" [] [] - 4: R_BRACK@270..271 "]" [] [] - 1: SEMICOLON@271..272 ";" [] [] - 11: JS_EXPRESSION_STATEMENT@272..291 - 0: JS_UNARY_EXPRESSION@272..290 - 0: DELETE_KW@272..280 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@280..290 - 0: JS_PARENTHESIZED_EXPRESSION@280..285 - 0: L_PAREN@280..281 "(" [] [] - 1: JS_IDENTIFIER_EXPRESSION@281..284 - 0: JS_REFERENCE_IDENTIFIER@281..284 - 0: IDENT@281..284 "obj" [] [] - 2: R_PAREN@284..285 ")" [] [] - 1: (empty) - 2: L_BRACK@285..286 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@286..289 - 0: JS_REFERENCE_IDENTIFIER@286..289 - 0: IDENT@286..289 "key" [] [] - 4: R_BRACK@289..290 "]" [] [] - 1: SEMICOLON@290..291 ";" [] [] - 12: JS_EXPRESSION_STATEMENT@291..316 - 0: JS_UNARY_EXPRESSION@291..315 - 0: DELETE_KW@291..299 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@299..315 - 0: JS_STATIC_MEMBER_EXPRESSION@299..310 - 0: JS_IDENTIFIER_EXPRESSION@299..302 - 0: JS_REFERENCE_IDENTIFIER@299..302 - 0: IDENT@299..302 "obj" [] [] - 1: DOT@302..303 "." [] [] - 2: JS_PRIVATE_NAME@303..310 - 0: HASH@303..304 "#" [] [] - 1: IDENT@304..310 "member" [] [] - 1: (empty) - 2: L_BRACK@310..311 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@311..314 - 0: JS_REFERENCE_IDENTIFIER@311..314 - 0: IDENT@311..314 "key" [] [] - 4: R_BRACK@314..315 "]" [] [] - 1: SEMICOLON@315..316 ";" [] [] - 13: JS_EXPRESSION_STATEMENT@316..343 - 0: JS_UNARY_EXPRESSION@316..342 - 0: DELETE_KW@316..324 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@324..342 - 0: JS_PARENTHESIZED_EXPRESSION@324..337 - 0: L_PAREN@324..325 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@325..336 - 0: JS_IDENTIFIER_EXPRESSION@325..328 - 0: JS_REFERENCE_IDENTIFIER@325..328 - 0: IDENT@325..328 "obj" [] [] - 1: DOT@328..329 "." [] [] - 2: JS_PRIVATE_NAME@329..336 - 0: HASH@329..330 "#" [] [] - 1: IDENT@330..336 "member" [] [] - 2: R_PAREN@336..337 ")" [] [] - 1: (empty) - 2: L_BRACK@337..338 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@338..341 - 0: JS_REFERENCE_IDENTIFIER@338..341 - 0: IDENT@338..341 "key" [] [] - 4: R_BRACK@341..342 "]" [] [] - 1: SEMICOLON@342..343 ";" [] [] - 14: JS_EXPRESSION_STATEMENT@343..371 - 0: JS_UNARY_EXPRESSION@343..370 - 0: DELETE_KW@343..351 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@351..370 - 0: JS_STATIC_MEMBER_EXPRESSION@351..365 - 0: JS_CALL_EXPRESSION@351..357 - 0: JS_IDENTIFIER_EXPRESSION@351..355 - 0: JS_REFERENCE_IDENTIFIER@351..355 - 0: IDENT@351..355 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@355..357 - 0: L_PAREN@355..356 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@356..356 - 2: R_PAREN@356..357 ")" [] [] - 1: DOT@357..358 "." [] [] - 2: JS_PRIVATE_NAME@358..365 - 0: HASH@358..359 "#" [] [] - 1: IDENT@359..365 "member" [] [] - 1: (empty) - 2: L_BRACK@365..366 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@366..369 - 0: JS_REFERENCE_IDENTIFIER@366..369 - 0: IDENT@366..369 "key" [] [] - 4: R_BRACK@369..370 "]" [] [] - 1: SEMICOLON@370..371 ";" [] [] - 15: JS_EXPRESSION_STATEMENT@371..401 - 0: JS_UNARY_EXPRESSION@371..400 - 0: DELETE_KW@371..379 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@379..400 - 0: JS_PARENTHESIZED_EXPRESSION@379..395 - 0: L_PAREN@379..380 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@380..394 - 0: JS_CALL_EXPRESSION@380..386 - 0: JS_IDENTIFIER_EXPRESSION@380..384 - 0: JS_REFERENCE_IDENTIFIER@380..384 - 0: IDENT@380..384 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@384..386 - 0: L_PAREN@384..385 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@385..385 - 2: R_PAREN@385..386 ")" [] [] - 1: DOT@386..387 "." [] [] - 2: JS_PRIVATE_NAME@387..394 - 0: HASH@387..388 "#" [] [] - 1: IDENT@388..394 "member" [] [] - 2: R_PAREN@394..395 ")" [] [] - 1: (empty) - 2: L_BRACK@395..396 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@396..399 - 0: JS_REFERENCE_IDENTIFIER@396..399 - 0: IDENT@396..399 "key" [] [] - 4: R_BRACK@399..400 "]" [] [] - 1: SEMICOLON@400..401 ";" [] [] - 16: JS_EXPRESSION_STATEMENT@401..427 - 0: JS_UNARY_EXPRESSION@401..426 - 0: DELETE_KW@401..409 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@409..426 - 0: JS_STATIC_MEMBER_EXPRESSION@409..421 - 0: JS_IDENTIFIER_EXPRESSION@409..412 - 0: JS_REFERENCE_IDENTIFIER@409..412 - 0: IDENT@409..412 "obj" [] [] - 1: QUESTIONDOT@412..414 "?." [] [] - 2: JS_PRIVATE_NAME@414..421 - 0: HASH@414..415 "#" [] [] - 1: IDENT@415..421 "member" [] [] - 1: (empty) - 2: L_BRACK@421..422 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@422..425 - 0: JS_REFERENCE_IDENTIFIER@422..425 - 0: IDENT@422..425 "key" [] [] - 4: R_BRACK@425..426 "]" [] [] - 1: SEMICOLON@426..427 ";" [] [] - 17: JS_EXPRESSION_STATEMENT@427..455 - 0: JS_UNARY_EXPRESSION@427..454 - 0: DELETE_KW@427..435 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@435..454 - 0: JS_PARENTHESIZED_EXPRESSION@435..449 - 0: L_PAREN@435..436 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@436..448 - 0: JS_IDENTIFIER_EXPRESSION@436..439 - 0: JS_REFERENCE_IDENTIFIER@436..439 - 0: IDENT@436..439 "obj" [] [] - 1: QUESTIONDOT@439..441 "?." [] [] - 2: JS_PRIVATE_NAME@441..448 - 0: HASH@441..442 "#" [] [] - 1: IDENT@442..448 "member" [] [] - 2: R_PAREN@448..449 ")" [] [] - 1: (empty) - 2: L_BRACK@449..450 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@450..453 - 0: JS_REFERENCE_IDENTIFIER@450..453 - 0: IDENT@450..453 "key" [] [] - 4: R_BRACK@453..454 "]" [] [] - 1: SEMICOLON@454..455 ";" [] [] - 18: JS_EXPRESSION_STATEMENT@455..487 - 0: JS_UNARY_EXPRESSION@455..486 - 0: DELETE_KW@455..463 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@463..486 - 0: JS_STATIC_MEMBER_EXPRESSION@463..481 - 0: JS_STATIC_MEMBER_EXPRESSION@463..473 - 0: JS_IDENTIFIER_EXPRESSION@463..466 - 0: JS_REFERENCE_IDENTIFIER@463..466 - 0: IDENT@463..466 "obj" [] [] - 1: QUESTIONDOT@466..468 "?." [] [] - 2: JS_NAME@468..473 - 0: IDENT@468..473 "inner" [] [] - 1: DOT@473..474 "." [] [] - 2: JS_PRIVATE_NAME@474..481 - 0: HASH@474..475 "#" [] [] - 1: IDENT@475..481 "member" [] [] - 1: (empty) - 2: L_BRACK@481..482 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@482..485 - 0: JS_REFERENCE_IDENTIFIER@482..485 - 0: IDENT@482..485 "key" [] [] - 4: R_BRACK@485..486 "]" [] [] - 1: SEMICOLON@486..487 ";" [] [] - 19: JS_EXPRESSION_STATEMENT@487..521 - 0: JS_UNARY_EXPRESSION@487..520 - 0: DELETE_KW@487..495 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@495..520 - 0: JS_PARENTHESIZED_EXPRESSION@495..515 - 0: L_PAREN@495..496 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@496..514 - 0: JS_STATIC_MEMBER_EXPRESSION@496..506 - 0: JS_IDENTIFIER_EXPRESSION@496..499 - 0: JS_REFERENCE_IDENTIFIER@496..499 - 0: IDENT@496..499 "obj" [] [] - 1: QUESTIONDOT@499..501 "?." [] [] - 2: JS_NAME@501..506 - 0: IDENT@501..506 "inner" [] [] - 1: DOT@506..507 "." [] [] - 2: JS_PRIVATE_NAME@507..514 - 0: HASH@507..508 "#" [] [] - 1: IDENT@508..514 "member" [] [] - 2: R_PAREN@514..515 ")" [] [] - 1: (empty) - 2: L_BRACK@515..516 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@516..519 - 0: JS_REFERENCE_IDENTIFIER@516..519 - 0: IDENT@516..519 "key" [] [] - 4: R_BRACK@519..520 "]" [] [] - 1: SEMICOLON@520..521 ";" [] [] - 20: JS_EXPRESSION_STATEMENT@521..549 - 0: JS_UNARY_EXPRESSION@521..548 - 0: DELETE_KW@521..529 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@529..548 - 0: L_PAREN@529..530 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@530..547 - 0: JS_STATIC_MEMBER_EXPRESSION@530..538 - 0: JS_IDENTIFIER_EXPRESSION@530..533 - 0: JS_REFERENCE_IDENTIFIER@530..533 - 0: IDENT@530..533 "obj" [] [] - 1: DOT@533..534 "." [] [] - 2: JS_PRIVATE_NAME@534..538 - 0: HASH@534..535 "#" [] [] - 1: IDENT@535..538 "key" [] [] - 1: COMMA@538..540 "," [] [Whitespace(" ")] - 2: JS_STATIC_MEMBER_EXPRESSION@540..547 - 0: JS_IDENTIFIER_EXPRESSION@540..543 - 0: JS_REFERENCE_IDENTIFIER@540..543 - 0: IDENT@540..543 "obj" [] [] - 1: DOT@543..544 "." [] [] - 2: JS_NAME@544..547 - 0: IDENT@544..547 "key" [] [] - 2: R_PAREN@547..548 ")" [] [] - 1: SEMICOLON@548..549 ";" [] [] - 21: JS_EXPRESSION_STATEMENT@549..571 - 0: JS_UNARY_EXPRESSION@549..570 - 0: DELETE_KW@549..557 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@557..570 - 0: L_PAREN@557..558 "(" [] [] - 1: JS_IN_EXPRESSION@558..569 - 0: JS_PRIVATE_NAME@558..563 - 0: HASH@558..559 "#" [] [] - 1: IDENT@559..563 "key" [] [Whitespace(" ")] - 1: IN_KW@563..566 "in" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@566..569 - 0: JS_REFERENCE_IDENTIFIER@566..569 - 0: IDENT@566..569 "obj" [] [] - 2: R_PAREN@569..570 ")" [] [] - 1: SEMICOLON@570..571 ";" [] [] - 22: JS_EXPRESSION_STATEMENT@571..589 - 0: JS_UNARY_EXPRESSION@571..588 - 0: DELETE_KW@571..579 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@579..588 - 0: L_PAREN@579..580 "(" [] [] - 1: JS_STATIC_MEMBER_EXPRESSION@580..587 - 0: JS_IDENTIFIER_EXPRESSION@580..583 - 0: JS_REFERENCE_IDENTIFIER@580..583 - 0: IDENT@580..583 "obj" [] [] - 1: DOT@583..584 "." [] [] - 2: JS_NAME@584..587 - 0: IDENT@584..587 "key" [] [] - 2: R_PAREN@587..588 ")" [] [] - 1: SEMICOLON@588..589 ";" [] [] - 23: JS_EXPRESSION_STATEMENT@589..614 - 0: JS_UNARY_EXPRESSION@589..613 - 0: DELETE_KW@589..597 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@597..613 - 0: L_PAREN@597..598 "(" [] [] - 1: JS_CALL_EXPRESSION@598..612 - 0: JS_STATIC_MEMBER_EXPRESSION@598..609 - 0: JS_IDENTIFIER_EXPRESSION@598..605 - 0: JS_REFERENCE_IDENTIFIER@598..605 - 0: IDENT@598..605 "console" [] [] - 1: DOT@605..606 "." [] [] - 2: JS_NAME@606..609 - 0: IDENT@606..609 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@609..612 - 0: L_PAREN@609..610 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@610..611 - 0: JS_NUMBER_LITERAL_EXPRESSION@610..611 - 0: JS_NUMBER_LITERAL@610..611 "1" [] [] - 2: R_PAREN@611..612 ")" [] [] - 2: R_PAREN@612..613 ")" [] [] - 1: SEMICOLON@613..614 ";" [] [] - 24: JS_EXPRESSION_STATEMENT@614..633 - 0: JS_UNARY_EXPRESSION@614..632 - 0: DELETE_KW@614..622 "delete" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@622..632 - 0: L_PAREN@622..623 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@623..631 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@623..626 - 0: L_PAREN@623..624 "(" [] [] - 1: JS_PARAMETER_LIST@624..624 - 2: R_PAREN@624..626 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@626..629 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@629..631 - 0: L_CURLY@629..630 "{" [] [] - 1: JS_DIRECTIVE_LIST@630..630 - 2: JS_STATEMENT_LIST@630..630 - 3: R_CURLY@630..631 "}" [] [] - 2: R_PAREN@631..632 ")" [] [] - 1: SEMICOLON@632..633 ";" [] [] - 4: EOF@633..634 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.rast b/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.rast deleted file mode 100644 index 6b3c1a050582..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.rast +++ /dev/null @@ -1,924 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@6..16 "TestClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@18..19 "#" [] [], - id_token: IDENT@19..26 "member" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@26..28 "=" [] [Whitespace(" ")], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@28..32 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@32..34 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@34..40 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@40..41 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@45..52 "delete" [] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@52..56 "func" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@56..57 "(" [] [], - args: JsCallArgumentList [ - JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@57..61 "this" [] [], - }, - operator_token: DOT@61..62 "." [] [], - member: JsPrivateName { - hash_token: HASH@62..63 "#" [] [], - value_token: IDENT@63..69 "member" [] [], - }, - }, - ], - r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], - }, - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@73..74 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@74..81 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@81..91 "TestClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@91..93 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@93..94 "#" [] [], - id_token: IDENT@94..101 "member" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@101..103 "=" [] [Whitespace(" ")], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@103..107 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@107..109 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@109..115 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@115..116 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@120..127 "delete" [] [Whitespace(" ")], - argument: JsArrayExpression { - l_brack_token: L_BRACK@127..128 "[" [] [], - elements: JsArrayElementList [ - JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@128..132 "this" [] [], - }, - operator_token: DOT@132..133 "." [] [], - member: JsPrivateName { - hash_token: HASH@133..134 "#" [] [], - value_token: IDENT@134..140 "member" [] [], - }, - }, - ], - r_brack_token: R_BRACK@140..142 "]" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@142..144 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@144..145 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@152..162 "TestClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@162..164 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@164..165 "#" [] [], - id_token: IDENT@165..172 "member" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@172..174 "=" [] [Whitespace(" ")], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@174..178 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@178..180 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@180..186 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@186..187 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@187..189 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@189..191 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@191..198 "delete" [] [Whitespace(" ")], - argument: JsObjectExpression { - l_curly_token: L_CURLY@198..200 "{" [] [Whitespace(" ")], - members: JsObjectMemberList [ - JsPropertyObjectMember { - name: JsLiteralMemberName { - value: IDENT@200..203 "key" [] [], - }, - colon_token: COLON@203..205 ":" [] [Whitespace(" ")], - value: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@205..209 "this" [] [], - }, - operator_token: DOT@209..210 "." [] [], - member: JsPrivateName { - hash_token: HASH@210..211 "#" [] [], - value_token: IDENT@211..218 "member" [] [Whitespace(" ")], - }, - }, - }, - ], - r_curly_token: R_CURLY@218..220 "}" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@220..222 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@222..223 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@223..230 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@230..240 "TestClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@240..242 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@242..243 "#" [] [], - id_token: IDENT@243..250 "member" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@250..252 "=" [] [Whitespace(" ")], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@252..256 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@256..258 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@258..264 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@264..265 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@265..267 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@267..269 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@269..276 "delete" [] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@276..277 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@277..278 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@278..280 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@280..283 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@283..285 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@285..289 "this" [] [], - }, - operator_token: DOT@289..290 "." [] [], - member: JsPrivateName { - hash_token: HASH@290..291 "#" [] [], - value_token: IDENT@291..297 "member" [] [], - }, - }, - semicolon_token: SEMICOLON@297..299 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@299..300 "}" [] [], - }, - }, - r_paren_token: R_PAREN@300..302 ")" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@302..304 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@304..305 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@305..312 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@312..322 "TestClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@322..324 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@324..325 "#" [] [], - id_token: IDENT@325..332 "member" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@332..334 "=" [] [Whitespace(" ")], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@334..338 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@338..340 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@340..346 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@346..347 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@347..349 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@349..351 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@351..358 "delete" [] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@358..359 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: missing (optional), - type_parameters: missing (optional), - parameters: JsIdentifierBinding { - name_token: IDENT@359..365 "param" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@365..368 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@368..370 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@370..374 "this" [] [], - }, - operator_token: DOT@374..375 "." [] [], - member: JsPrivateName { - hash_token: HASH@375..376 "#" [] [], - value_token: IDENT@376..382 "member" [] [], - }, - }, - semicolon_token: SEMICOLON@382..384 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@384..385 "}" [] [], - }, - }, - r_paren_token: R_PAREN@385..387 ")" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@387..389 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@389..390 "}" [] [], - }, - JsClassDeclaration { - decorators: JsDecoratorList [], - abstract_token: missing (optional), - class_token: CLASS_KW@390..397 "class" [Newline("\n")] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@397..407 "TestClass" [] [Whitespace(" ")], - }, - type_parameters: missing (optional), - extends_clause: missing (optional), - implements_clause: missing (optional), - l_curly_token: L_CURLY@407..409 "{" [] [Whitespace(" ")], - members: JsClassMemberList [ - JsPropertyClassMember { - modifiers: JsPropertyModifierList [], - name: JsPrivateClassMemberName { - hash_token: HASH@409..410 "#" [] [], - id_token: IDENT@410..417 "member" [] [Whitespace(" ")], - }, - property_annotation: missing (optional), - value: JsInitializerClause { - eq_token: EQ@417..419 "=" [] [Whitespace(" ")], - expression: JsBooleanLiteralExpression { - value_token: TRUE_KW@419..423 "true" [] [], - }, - }, - semicolon_token: SEMICOLON@423..425 ";" [] [Whitespace(" ")], - }, - JsMethodClassMember { - modifiers: JsMethodModifierList [], - async_token: missing (optional), - star_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@425..431 "method" [] [], - }, - question_mark_token: missing (optional), - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@431..432 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@432..434 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@434..436 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsUnaryExpression { - operator_token: DELETE_KW@436..443 "delete" [] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@443..444 "(" [] [], - expression: JsArrowFunctionExpression { - async_token: ASYNC_KW@444..450 "async" [] [Whitespace(" ")], - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@450..451 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@451..453 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - fat_arrow_token: FAT_ARROW@453..456 "=>" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@456..458 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsStaticMemberExpression { - object: JsThisExpression { - this_token: THIS_KW@458..462 "this" [] [], - }, - operator_token: DOT@462..463 "." [] [], - member: JsPrivateName { - hash_token: HASH@463..464 "#" [] [], - value_token: IDENT@464..470 "member" [] [], - }, - }, - semicolon_token: SEMICOLON@470..472 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@472..473 "}" [] [], - }, - }, - r_paren_token: R_PAREN@473..475 ")" [] [Whitespace(" ")], - }, - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@475..477 "}" [] [Whitespace(" ")], - }, - }, - ], - r_curly_token: R_CURLY@477..478 "}" [] [], - }, - ], - eof_token: EOF@478..479 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..479 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..478 - 0: JS_CLASS_DECLARATION@0..74 - 0: JS_DECORATOR_LIST@0..0 - 1: (empty) - 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@6..16 - 0: IDENT@6..16 "TestClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@18..73 - 0: JS_PROPERTY_CLASS_MEMBER@18..34 - 0: JS_PROPERTY_MODIFIER_LIST@18..18 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@18..26 - 0: HASH@18..19 "#" [] [] - 1: IDENT@19..26 "member" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@26..32 - 0: EQ@26..28 "=" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@28..32 - 0: TRUE_KW@28..32 "true" [] [] - 4: SEMICOLON@32..34 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@34..73 - 0: JS_METHOD_MODIFIER_LIST@34..34 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@34..40 - 0: IDENT@34..40 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@40..43 - 0: L_PAREN@40..41 "(" [] [] - 1: JS_PARAMETER_LIST@41..41 - 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@43..73 - 0: L_CURLY@43..45 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@45..45 - 2: JS_STATEMENT_LIST@45..71 - 0: JS_EXPRESSION_STATEMENT@45..71 - 0: JS_UNARY_EXPRESSION@45..71 - 0: DELETE_KW@45..52 "delete" [] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@52..71 - 0: JS_IDENTIFIER_EXPRESSION@52..56 - 0: JS_REFERENCE_IDENTIFIER@52..56 - 0: IDENT@52..56 "func" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@56..71 - 0: L_PAREN@56..57 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@57..69 - 0: JS_STATIC_MEMBER_EXPRESSION@57..69 - 0: JS_THIS_EXPRESSION@57..61 - 0: THIS_KW@57..61 "this" [] [] - 1: DOT@61..62 "." [] [] - 2: JS_PRIVATE_NAME@62..69 - 0: HASH@62..63 "#" [] [] - 1: IDENT@63..69 "member" [] [] - 2: R_PAREN@69..71 ")" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] - 9: R_CURLY@73..74 "}" [] [] - 1: JS_CLASS_DECLARATION@74..145 - 0: JS_DECORATOR_LIST@74..74 - 1: (empty) - 2: CLASS_KW@74..81 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@81..91 - 0: IDENT@81..91 "TestClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@91..93 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@93..144 - 0: JS_PROPERTY_CLASS_MEMBER@93..109 - 0: JS_PROPERTY_MODIFIER_LIST@93..93 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@93..101 - 0: HASH@93..94 "#" [] [] - 1: IDENT@94..101 "member" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@101..107 - 0: EQ@101..103 "=" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@103..107 - 0: TRUE_KW@103..107 "true" [] [] - 4: SEMICOLON@107..109 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@109..144 - 0: JS_METHOD_MODIFIER_LIST@109..109 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@109..115 - 0: IDENT@109..115 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@115..118 - 0: L_PAREN@115..116 "(" [] [] - 1: JS_PARAMETER_LIST@116..116 - 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@118..144 - 0: L_CURLY@118..120 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@120..120 - 2: JS_STATEMENT_LIST@120..142 - 0: JS_EXPRESSION_STATEMENT@120..142 - 0: JS_UNARY_EXPRESSION@120..142 - 0: DELETE_KW@120..127 "delete" [] [Whitespace(" ")] - 1: JS_ARRAY_EXPRESSION@127..142 - 0: L_BRACK@127..128 "[" [] [] - 1: JS_ARRAY_ELEMENT_LIST@128..140 - 0: JS_STATIC_MEMBER_EXPRESSION@128..140 - 0: JS_THIS_EXPRESSION@128..132 - 0: THIS_KW@128..132 "this" [] [] - 1: DOT@132..133 "." [] [] - 2: JS_PRIVATE_NAME@133..140 - 0: HASH@133..134 "#" [] [] - 1: IDENT@134..140 "member" [] [] - 2: R_BRACK@140..142 "]" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@142..144 "}" [] [Whitespace(" ")] - 9: R_CURLY@144..145 "}" [] [] - 2: JS_CLASS_DECLARATION@145..223 - 0: JS_DECORATOR_LIST@145..145 - 1: (empty) - 2: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@152..162 - 0: IDENT@152..162 "TestClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@162..164 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@164..222 - 0: JS_PROPERTY_CLASS_MEMBER@164..180 - 0: JS_PROPERTY_MODIFIER_LIST@164..164 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@164..172 - 0: HASH@164..165 "#" [] [] - 1: IDENT@165..172 "member" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@172..178 - 0: EQ@172..174 "=" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@174..178 - 0: TRUE_KW@174..178 "true" [] [] - 4: SEMICOLON@178..180 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@180..222 - 0: JS_METHOD_MODIFIER_LIST@180..180 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@180..186 - 0: IDENT@180..186 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@186..189 - 0: L_PAREN@186..187 "(" [] [] - 1: JS_PARAMETER_LIST@187..187 - 2: R_PAREN@187..189 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@189..222 - 0: L_CURLY@189..191 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@191..191 - 2: JS_STATEMENT_LIST@191..220 - 0: JS_EXPRESSION_STATEMENT@191..220 - 0: JS_UNARY_EXPRESSION@191..220 - 0: DELETE_KW@191..198 "delete" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@198..220 - 0: L_CURLY@198..200 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_MEMBER_LIST@200..218 - 0: JS_PROPERTY_OBJECT_MEMBER@200..218 - 0: JS_LITERAL_MEMBER_NAME@200..203 - 0: IDENT@200..203 "key" [] [] - 1: COLON@203..205 ":" [] [Whitespace(" ")] - 2: JS_STATIC_MEMBER_EXPRESSION@205..218 - 0: JS_THIS_EXPRESSION@205..209 - 0: THIS_KW@205..209 "this" [] [] - 1: DOT@209..210 "." [] [] - 2: JS_PRIVATE_NAME@210..218 - 0: HASH@210..211 "#" [] [] - 1: IDENT@211..218 "member" [] [Whitespace(" ")] - 2: R_CURLY@218..220 "}" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@220..222 "}" [] [Whitespace(" ")] - 9: R_CURLY@222..223 "}" [] [] - 3: JS_CLASS_DECLARATION@223..305 - 0: JS_DECORATOR_LIST@223..223 - 1: (empty) - 2: CLASS_KW@223..230 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@230..240 - 0: IDENT@230..240 "TestClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@240..242 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@242..304 - 0: JS_PROPERTY_CLASS_MEMBER@242..258 - 0: JS_PROPERTY_MODIFIER_LIST@242..242 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@242..250 - 0: HASH@242..243 "#" [] [] - 1: IDENT@243..250 "member" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@250..256 - 0: EQ@250..252 "=" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@252..256 - 0: TRUE_KW@252..256 "true" [] [] - 4: SEMICOLON@256..258 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@258..304 - 0: JS_METHOD_MODIFIER_LIST@258..258 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@258..264 - 0: IDENT@258..264 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@264..267 - 0: L_PAREN@264..265 "(" [] [] - 1: JS_PARAMETER_LIST@265..265 - 2: R_PAREN@265..267 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@267..304 - 0: L_CURLY@267..269 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@269..269 - 2: JS_STATEMENT_LIST@269..302 - 0: JS_EXPRESSION_STATEMENT@269..302 - 0: JS_UNARY_EXPRESSION@269..302 - 0: DELETE_KW@269..276 "delete" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@276..302 - 0: L_PAREN@276..277 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@277..300 - 0: (empty) - 1: (empty) - 2: JS_PARAMETERS@277..280 - 0: L_PAREN@277..278 "(" [] [] - 1: JS_PARAMETER_LIST@278..278 - 2: R_PAREN@278..280 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@280..283 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@283..300 - 0: L_CURLY@283..285 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@285..285 - 2: JS_STATEMENT_LIST@285..299 - 0: JS_EXPRESSION_STATEMENT@285..299 - 0: JS_STATIC_MEMBER_EXPRESSION@285..297 - 0: JS_THIS_EXPRESSION@285..289 - 0: THIS_KW@285..289 "this" [] [] - 1: DOT@289..290 "." [] [] - 2: JS_PRIVATE_NAME@290..297 - 0: HASH@290..291 "#" [] [] - 1: IDENT@291..297 "member" [] [] - 1: SEMICOLON@297..299 ";" [] [Whitespace(" ")] - 3: R_CURLY@299..300 "}" [] [] - 2: R_PAREN@300..302 ")" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@302..304 "}" [] [Whitespace(" ")] - 9: R_CURLY@304..305 "}" [] [] - 4: JS_CLASS_DECLARATION@305..390 - 0: JS_DECORATOR_LIST@305..305 - 1: (empty) - 2: CLASS_KW@305..312 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@312..322 - 0: IDENT@312..322 "TestClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@322..324 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@324..389 - 0: JS_PROPERTY_CLASS_MEMBER@324..340 - 0: JS_PROPERTY_MODIFIER_LIST@324..324 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@324..332 - 0: HASH@324..325 "#" [] [] - 1: IDENT@325..332 "member" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@332..338 - 0: EQ@332..334 "=" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@334..338 - 0: TRUE_KW@334..338 "true" [] [] - 4: SEMICOLON@338..340 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@340..389 - 0: JS_METHOD_MODIFIER_LIST@340..340 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@340..346 - 0: IDENT@340..346 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@346..349 - 0: L_PAREN@346..347 "(" [] [] - 1: JS_PARAMETER_LIST@347..347 - 2: R_PAREN@347..349 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@349..389 - 0: L_CURLY@349..351 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@351..351 - 2: JS_STATEMENT_LIST@351..387 - 0: JS_EXPRESSION_STATEMENT@351..387 - 0: JS_UNARY_EXPRESSION@351..387 - 0: DELETE_KW@351..358 "delete" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@358..387 - 0: L_PAREN@358..359 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@359..385 - 0: (empty) - 1: (empty) - 2: JS_IDENTIFIER_BINDING@359..365 - 0: IDENT@359..365 "param" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@365..368 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@368..385 - 0: L_CURLY@368..370 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@370..370 - 2: JS_STATEMENT_LIST@370..384 - 0: JS_EXPRESSION_STATEMENT@370..384 - 0: JS_STATIC_MEMBER_EXPRESSION@370..382 - 0: JS_THIS_EXPRESSION@370..374 - 0: THIS_KW@370..374 "this" [] [] - 1: DOT@374..375 "." [] [] - 2: JS_PRIVATE_NAME@375..382 - 0: HASH@375..376 "#" [] [] - 1: IDENT@376..382 "member" [] [] - 1: SEMICOLON@382..384 ";" [] [Whitespace(" ")] - 3: R_CURLY@384..385 "}" [] [] - 2: R_PAREN@385..387 ")" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@387..389 "}" [] [Whitespace(" ")] - 9: R_CURLY@389..390 "}" [] [] - 5: JS_CLASS_DECLARATION@390..478 - 0: JS_DECORATOR_LIST@390..390 - 1: (empty) - 2: CLASS_KW@390..397 "class" [Newline("\n")] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@397..407 - 0: IDENT@397..407 "TestClass" [] [Whitespace(" ")] - 4: (empty) - 5: (empty) - 6: (empty) - 7: L_CURLY@407..409 "{" [] [Whitespace(" ")] - 8: JS_CLASS_MEMBER_LIST@409..477 - 0: JS_PROPERTY_CLASS_MEMBER@409..425 - 0: JS_PROPERTY_MODIFIER_LIST@409..409 - 1: JS_PRIVATE_CLASS_MEMBER_NAME@409..417 - 0: HASH@409..410 "#" [] [] - 1: IDENT@410..417 "member" [] [Whitespace(" ")] - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@417..423 - 0: EQ@417..419 "=" [] [Whitespace(" ")] - 1: JS_BOOLEAN_LITERAL_EXPRESSION@419..423 - 0: TRUE_KW@419..423 "true" [] [] - 4: SEMICOLON@423..425 ";" [] [Whitespace(" ")] - 1: JS_METHOD_CLASS_MEMBER@425..477 - 0: JS_METHOD_MODIFIER_LIST@425..425 - 1: (empty) - 2: (empty) - 3: JS_LITERAL_MEMBER_NAME@425..431 - 0: IDENT@425..431 "method" [] [] - 4: (empty) - 5: (empty) - 6: JS_PARAMETERS@431..434 - 0: L_PAREN@431..432 "(" [] [] - 1: JS_PARAMETER_LIST@432..432 - 2: R_PAREN@432..434 ")" [] [Whitespace(" ")] - 7: (empty) - 8: JS_FUNCTION_BODY@434..477 - 0: L_CURLY@434..436 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@436..436 - 2: JS_STATEMENT_LIST@436..475 - 0: JS_EXPRESSION_STATEMENT@436..475 - 0: JS_UNARY_EXPRESSION@436..475 - 0: DELETE_KW@436..443 "delete" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@443..475 - 0: L_PAREN@443..444 "(" [] [] - 1: JS_ARROW_FUNCTION_EXPRESSION@444..473 - 0: ASYNC_KW@444..450 "async" [] [Whitespace(" ")] - 1: (empty) - 2: JS_PARAMETERS@450..453 - 0: L_PAREN@450..451 "(" [] [] - 1: JS_PARAMETER_LIST@451..451 - 2: R_PAREN@451..453 ")" [] [Whitespace(" ")] - 3: (empty) - 4: FAT_ARROW@453..456 "=>" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@456..473 - 0: L_CURLY@456..458 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@458..458 - 2: JS_STATEMENT_LIST@458..472 - 0: JS_EXPRESSION_STATEMENT@458..472 - 0: JS_STATIC_MEMBER_EXPRESSION@458..470 - 0: JS_THIS_EXPRESSION@458..462 - 0: THIS_KW@458..462 "this" [] [] - 1: DOT@462..463 "." [] [] - 2: JS_PRIVATE_NAME@463..470 - 0: HASH@463..464 "#" [] [] - 1: IDENT@464..470 "member" [] [] - 1: SEMICOLON@470..472 ";" [] [Whitespace(" ")] - 3: R_CURLY@472..473 "}" [] [] - 2: R_PAREN@473..475 ")" [] [Whitespace(" ")] - 1: (empty) - 3: R_CURLY@475..477 "}" [] [Whitespace(" ")] - 9: R_CURLY@477..478 "}" [] [] - 4: EOF@478..479 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.rast b/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.rast deleted file mode 100644 index 36c640634203..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.rast +++ /dev/null @@ -1,600 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@0..6 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@6..8 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@10..11 "b" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@11..12 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@12..19 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@19..21 "c" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@21..23 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@23..24 "d" [] [], - }, - }, - }, - }, - COMMA@24..26 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@26..28 "e" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@30..31 "_" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@32..39 "using" [Newline("\n")] [Whitespace(" ")], - }, - }, - l_brack_token: L_BRACK@39..40 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@40..41 "g" [] [], - }, - }, - r_brack_token: R_BRACK@41..43 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@43..45 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..46 "h" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@46..47 ";" [] [], - }, - JsExpressionStatement { - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@47..54 "using" [Newline("\n")] [Whitespace(" ")], - }, - }, - l_brack_token: L_BRACK@54..55 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..56 "j" [] [], - }, - }, - r_brack_token: R_BRACK@56..57 "]" [] [], - }, - operator_token: EQ@57..60 "=" [Newline("\n")] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@60..61 "k" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@61..62 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: AWAIT_KW@62..69 "await" [Newline("\n")] [Whitespace(" ")], - kind: USING_KW@69..75 "using" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@75..77 "l" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@77..79 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@79..80 "m" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@80..81 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: AWAIT_KW@81..87 "await" [Newline("\n")] [], - kind: USING_KW@87..94 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@94..96 "p" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@96..98 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@98..99 "q" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@99..100 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@100..107 "await" [Newline("\n")] [Whitespace(" ")], - argument: JsComputedMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@107..112 "using" [] [], - }, - }, - optional_chain_token: missing (optional), - l_brack_token: L_BRACK@112..113 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@113..114 "r" [] [], - }, - }, - r_brack_token: R_BRACK@114..115 "]" [] [], - }, - }, - semicolon_token: SEMICOLON@115..116 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")], - argument: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@123..129 "using" [] [Whitespace(" ")], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@129..130 "(" [] [], - args: JsCallArgumentList [ - JsAssignmentExpression { - left: JsArrayAssignmentPattern { - l_brack_token: L_BRACK@130..131 "[" [] [], - elements: JsArrayAssignmentPatternElementList [ - JsArrayAssignmentPatternElement { - pattern: JsIdentifierAssignment { - name_token: IDENT@131..132 "s" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@132..134 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@134..136 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@136..137 "t" [] [], - }, - }, - }, - ], - r_paren_token: R_PAREN@137..138 ")" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@138..139 ";" [] [], - }, - JsExpressionStatement { - expression: JsAwaitExpression { - await_token: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")], - argument: JsParenthesizedExpression { - l_paren_token: L_PAREN@146..147 "(" [] [], - expression: JsAssignmentExpression { - left: JsComputedMemberAssignment { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@147..153 "using" [] [Whitespace(" ")], - }, - }, - l_brack_token: L_BRACK@153..154 "[" [] [], - member: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@154..155 "u" [] [], - }, - }, - r_brack_token: R_BRACK@155..157 "]" [] [Whitespace(" ")], - }, - operator_token: EQ@157..159 "=" [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@159..160 "v" [] [], - }, - }, - }, - r_paren_token: R_PAREN@160..161 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@161..162 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@162..169 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@169..171 "w" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@171..173 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@173..174 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@174..175 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@175..176 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@176..183 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@183..185 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@185..187 "=" [] [Whitespace(" ")], - expression: JsNullLiteralExpression { - value_token: NULL_KW@187..191 "null" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@191..192 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@192..199 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@199..201 "y" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@201..203 "=" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@203..212 "undefined" [] [], - }, - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@212..213 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: USING_KW@213..220 "using" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@220..222 "z" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@222..224 "=" [] [Whitespace(" ")], - expression: JsParenthesizedExpression { - l_paren_token: L_PAREN@224..225 "(" [] [], - expression: JsSequenceExpression { - left: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@225..228 "foo" [] [], - }, - }, - comma_token: COMMA@228..230 "," [] [Whitespace(" ")], - right: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@230..233 "bar" [] [], - }, - }, - }, - r_paren_token: R_PAREN@233..234 ")" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@234..235 ";" [] [], - }, - ], - eof_token: EOF@235..236 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..236 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..235 - 0: JS_VARIABLE_STATEMENT@0..12 - 0: JS_VARIABLE_DECLARATION@0..11 - 0: (empty) - 1: USING_KW@0..6 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@6..11 - 0: JS_VARIABLE_DECLARATOR@6..11 - 0: JS_IDENTIFIER_BINDING@6..8 - 0: IDENT@6..8 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..11 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@10..11 - 0: JS_REFERENCE_IDENTIFIER@10..11 - 0: IDENT@10..11 "b" [] [] - 1: SEMICOLON@11..12 ";" [] [] - 1: JS_VARIABLE_STATEMENT@12..32 - 0: JS_VARIABLE_DECLARATION@12..31 - 0: (empty) - 1: USING_KW@12..19 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@19..31 - 0: JS_VARIABLE_DECLARATOR@19..24 - 0: JS_IDENTIFIER_BINDING@19..21 - 0: IDENT@19..21 "c" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@21..24 - 0: EQ@21..23 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@23..24 - 0: JS_REFERENCE_IDENTIFIER@23..24 - 0: IDENT@23..24 "d" [] [] - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@26..31 - 0: JS_IDENTIFIER_BINDING@26..28 - 0: IDENT@26..28 "e" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@28..31 - 0: EQ@28..30 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@30..31 - 0: JS_REFERENCE_IDENTIFIER@30..31 - 0: IDENT@30..31 "_" [] [] - 1: SEMICOLON@31..32 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@32..47 - 0: JS_ASSIGNMENT_EXPRESSION@32..46 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@32..43 - 0: JS_IDENTIFIER_EXPRESSION@32..39 - 0: JS_REFERENCE_IDENTIFIER@32..39 - 0: IDENT@32..39 "using" [Newline("\n")] [Whitespace(" ")] - 1: L_BRACK@39..40 "[" [] [] - 2: JS_IDENTIFIER_EXPRESSION@40..41 - 0: JS_REFERENCE_IDENTIFIER@40..41 - 0: IDENT@40..41 "g" [] [] - 3: R_BRACK@41..43 "]" [] [Whitespace(" ")] - 1: EQ@43..45 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@45..46 - 0: JS_REFERENCE_IDENTIFIER@45..46 - 0: IDENT@45..46 "h" [] [] - 1: SEMICOLON@46..47 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@47..62 - 0: JS_ASSIGNMENT_EXPRESSION@47..61 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@47..57 - 0: JS_IDENTIFIER_EXPRESSION@47..54 - 0: JS_REFERENCE_IDENTIFIER@47..54 - 0: IDENT@47..54 "using" [Newline("\n")] [Whitespace(" ")] - 1: L_BRACK@54..55 "[" [] [] - 2: JS_IDENTIFIER_EXPRESSION@55..56 - 0: JS_REFERENCE_IDENTIFIER@55..56 - 0: IDENT@55..56 "j" [] [] - 3: R_BRACK@56..57 "]" [] [] - 1: EQ@57..60 "=" [Newline("\n")] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@60..61 - 0: JS_REFERENCE_IDENTIFIER@60..61 - 0: IDENT@60..61 "k" [] [] - 1: SEMICOLON@61..62 ";" [] [] - 4: JS_VARIABLE_STATEMENT@62..81 - 0: JS_VARIABLE_DECLARATION@62..80 - 0: AWAIT_KW@62..69 "await" [Newline("\n")] [Whitespace(" ")] - 1: USING_KW@69..75 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@75..80 - 0: JS_VARIABLE_DECLARATOR@75..80 - 0: JS_IDENTIFIER_BINDING@75..77 - 0: IDENT@75..77 "l" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@77..80 - 0: EQ@77..79 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@79..80 - 0: JS_REFERENCE_IDENTIFIER@79..80 - 0: IDENT@79..80 "m" [] [] - 1: SEMICOLON@80..81 ";" [] [] - 5: JS_VARIABLE_STATEMENT@81..100 - 0: JS_VARIABLE_DECLARATION@81..99 - 0: AWAIT_KW@81..87 "await" [Newline("\n")] [] - 1: USING_KW@87..94 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@94..99 - 0: JS_VARIABLE_DECLARATOR@94..99 - 0: JS_IDENTIFIER_BINDING@94..96 - 0: IDENT@94..96 "p" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@96..99 - 0: EQ@96..98 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@98..99 - 0: JS_REFERENCE_IDENTIFIER@98..99 - 0: IDENT@98..99 "q" [] [] - 1: SEMICOLON@99..100 ";" [] [] - 6: JS_EXPRESSION_STATEMENT@100..116 - 0: JS_AWAIT_EXPRESSION@100..115 - 0: AWAIT_KW@100..107 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_EXPRESSION@107..115 - 0: JS_IDENTIFIER_EXPRESSION@107..112 - 0: JS_REFERENCE_IDENTIFIER@107..112 - 0: IDENT@107..112 "using" [] [] - 1: (empty) - 2: L_BRACK@112..113 "[" [] [] - 3: JS_IDENTIFIER_EXPRESSION@113..114 - 0: JS_REFERENCE_IDENTIFIER@113..114 - 0: IDENT@113..114 "r" [] [] - 4: R_BRACK@114..115 "]" [] [] - 1: SEMICOLON@115..116 ";" [] [] - 7: JS_EXPRESSION_STATEMENT@116..139 - 0: JS_AWAIT_EXPRESSION@116..138 - 0: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_CALL_EXPRESSION@123..138 - 0: JS_IDENTIFIER_EXPRESSION@123..129 - 0: JS_REFERENCE_IDENTIFIER@123..129 - 0: IDENT@123..129 "using" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@129..138 - 0: L_PAREN@129..130 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@130..137 - 0: JS_ASSIGNMENT_EXPRESSION@130..137 - 0: JS_ARRAY_ASSIGNMENT_PATTERN@130..134 - 0: L_BRACK@130..131 "[" [] [] - 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@131..132 - 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@131..132 - 0: JS_IDENTIFIER_ASSIGNMENT@131..132 - 0: IDENT@131..132 "s" [] [] - 1: (empty) - 2: R_BRACK@132..134 "]" [] [Whitespace(" ")] - 1: EQ@134..136 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@136..137 - 0: JS_REFERENCE_IDENTIFIER@136..137 - 0: IDENT@136..137 "t" [] [] - 2: R_PAREN@137..138 ")" [] [] - 1: SEMICOLON@138..139 ";" [] [] - 8: JS_EXPRESSION_STATEMENT@139..162 - 0: JS_AWAIT_EXPRESSION@139..161 - 0: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@146..161 - 0: L_PAREN@146..147 "(" [] [] - 1: JS_ASSIGNMENT_EXPRESSION@147..160 - 0: JS_COMPUTED_MEMBER_ASSIGNMENT@147..157 - 0: JS_IDENTIFIER_EXPRESSION@147..153 - 0: JS_REFERENCE_IDENTIFIER@147..153 - 0: IDENT@147..153 "using" [] [Whitespace(" ")] - 1: L_BRACK@153..154 "[" [] [] - 2: JS_IDENTIFIER_EXPRESSION@154..155 - 0: JS_REFERENCE_IDENTIFIER@154..155 - 0: IDENT@154..155 "u" [] [] - 3: R_BRACK@155..157 "]" [] [Whitespace(" ")] - 1: EQ@157..159 "=" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@159..160 - 0: JS_REFERENCE_IDENTIFIER@159..160 - 0: IDENT@159..160 "v" [] [] - 2: R_PAREN@160..161 ")" [] [] - 1: SEMICOLON@161..162 ";" [] [] - 9: JS_VARIABLE_STATEMENT@162..176 - 0: JS_VARIABLE_DECLARATION@162..175 - 0: (empty) - 1: USING_KW@162..169 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@169..175 - 0: JS_VARIABLE_DECLARATOR@169..175 - 0: JS_IDENTIFIER_BINDING@169..171 - 0: IDENT@169..171 "w" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@171..175 - 0: EQ@171..173 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@173..175 - 0: L_CURLY@173..174 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@174..174 - 2: R_CURLY@174..175 "}" [] [] - 1: SEMICOLON@175..176 ";" [] [] - 10: JS_VARIABLE_STATEMENT@176..192 - 0: JS_VARIABLE_DECLARATION@176..191 - 0: (empty) - 1: USING_KW@176..183 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@183..191 - 0: JS_VARIABLE_DECLARATOR@183..191 - 0: JS_IDENTIFIER_BINDING@183..185 - 0: IDENT@183..185 "x" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@185..191 - 0: EQ@185..187 "=" [] [Whitespace(" ")] - 1: JS_NULL_LITERAL_EXPRESSION@187..191 - 0: NULL_KW@187..191 "null" [] [] - 1: SEMICOLON@191..192 ";" [] [] - 11: JS_VARIABLE_STATEMENT@192..213 - 0: JS_VARIABLE_DECLARATION@192..212 - 0: (empty) - 1: USING_KW@192..199 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@199..212 - 0: JS_VARIABLE_DECLARATOR@199..212 - 0: JS_IDENTIFIER_BINDING@199..201 - 0: IDENT@199..201 "y" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@201..212 - 0: EQ@201..203 "=" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@203..212 - 0: JS_REFERENCE_IDENTIFIER@203..212 - 0: IDENT@203..212 "undefined" [] [] - 1: SEMICOLON@212..213 ";" [] [] - 12: JS_VARIABLE_STATEMENT@213..235 - 0: JS_VARIABLE_DECLARATION@213..234 - 0: (empty) - 1: USING_KW@213..220 "using" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@220..234 - 0: JS_VARIABLE_DECLARATOR@220..234 - 0: JS_IDENTIFIER_BINDING@220..222 - 0: IDENT@220..222 "z" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@222..234 - 0: EQ@222..224 "=" [] [Whitespace(" ")] - 1: JS_PARENTHESIZED_EXPRESSION@224..234 - 0: L_PAREN@224..225 "(" [] [] - 1: JS_SEQUENCE_EXPRESSION@225..233 - 0: JS_IDENTIFIER_EXPRESSION@225..228 - 0: JS_REFERENCE_IDENTIFIER@225..228 - 0: IDENT@225..228 "foo" [] [] - 1: COMMA@228..230 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@230..233 - 0: JS_REFERENCE_IDENTIFIER@230..233 - 0: IDENT@230..233 "bar" [] [] - 2: R_PAREN@233..234 ")" [] [] - 1: SEMICOLON@234..235 ";" [] [] - 4: EOF@235..236 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast b/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast deleted file mode 100644 index 61125cf7ed08..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast +++ /dev/null @@ -1,231 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsForOfStatement { - for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@4..5 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: USING_KW@5..11 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@11..13 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@13..16 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..17 "y" [] [], - }, - }, - r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@19..20 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@20..21 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@21..22 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")], - await_token: AWAIT_KW@27..33 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@33..34 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: missing (optional), - kind_token: USING_KW@34..40 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@40..42 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@42..45 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@45..46 "y" [] [], - }, - }, - r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@48..49 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@49..50 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@51..56 "for" [Newline("\n")] [Whitespace(" ")], - await_token: missing (optional), - l_paren_token: L_PAREN@56..57 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: AWAIT_KW@57..63 "await" [] [Whitespace(" ")], - kind_token: USING_KW@63..69 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@69..71 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@71..74 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@74..75 "y" [] [], - }, - }, - r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@77..78 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@78..79 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@79..80 ";" [] [], - }, - JsForOfStatement { - for_token: FOR_KW@80..85 "for" [Newline("\n")] [Whitespace(" ")], - await_token: AWAIT_KW@85..91 "await" [] [Whitespace(" ")], - l_paren_token: L_PAREN@91..92 "(" [] [], - initializer: JsForVariableDeclaration { - await_token: AWAIT_KW@92..98 "await" [] [Whitespace(" ")], - kind_token: USING_KW@98..104 "using" [] [Whitespace(" ")], - declarator: JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@104..106 "x" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - }, - of_token: OF_KW@106..109 "of" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@109..110 "y" [] [], - }, - }, - r_paren_token: R_PAREN@110..112 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@112..113 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@113..114 "}" [] [], - }, - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@114..115 ";" [] [], - }, - ], - eof_token: EOF@115..116 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..116 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..115 - 0: JS_FOR_OF_STATEMENT@0..21 - 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@4..5 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@5..13 - 0: (empty) - 1: USING_KW@5..11 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@11..13 - 0: JS_IDENTIFIER_BINDING@11..13 - 0: IDENT@11..13 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@13..16 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@16..17 - 0: JS_REFERENCE_IDENTIFIER@16..17 - 0: IDENT@16..17 "y" [] [] - 6: R_PAREN@17..19 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@19..21 - 0: L_CURLY@19..20 "{" [] [] - 1: JS_STATEMENT_LIST@20..20 - 2: R_CURLY@20..21 "}" [] [] - 1: JS_EMPTY_STATEMENT@21..22 - 0: SEMICOLON@21..22 ";" [] [] - 2: JS_FOR_OF_STATEMENT@22..50 - 0: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@27..33 "await" [] [Whitespace(" ")] - 2: L_PAREN@33..34 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@34..42 - 0: (empty) - 1: USING_KW@34..40 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@40..42 - 0: JS_IDENTIFIER_BINDING@40..42 - 0: IDENT@40..42 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@42..45 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@45..46 - 0: JS_REFERENCE_IDENTIFIER@45..46 - 0: IDENT@45..46 "y" [] [] - 6: R_PAREN@46..48 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@48..50 - 0: L_CURLY@48..49 "{" [] [] - 1: JS_STATEMENT_LIST@49..49 - 2: R_CURLY@49..50 "}" [] [] - 3: JS_EMPTY_STATEMENT@50..51 - 0: SEMICOLON@50..51 ";" [] [] - 4: JS_FOR_OF_STATEMENT@51..79 - 0: FOR_KW@51..56 "for" [Newline("\n")] [Whitespace(" ")] - 1: (empty) - 2: L_PAREN@56..57 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@57..71 - 0: AWAIT_KW@57..63 "await" [] [Whitespace(" ")] - 1: USING_KW@63..69 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@69..71 - 0: JS_IDENTIFIER_BINDING@69..71 - 0: IDENT@69..71 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@71..74 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@74..75 - 0: JS_REFERENCE_IDENTIFIER@74..75 - 0: IDENT@74..75 "y" [] [] - 6: R_PAREN@75..77 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@77..79 - 0: L_CURLY@77..78 "{" [] [] - 1: JS_STATEMENT_LIST@78..78 - 2: R_CURLY@78..79 "}" [] [] - 5: JS_EMPTY_STATEMENT@79..80 - 0: SEMICOLON@79..80 ";" [] [] - 6: JS_FOR_OF_STATEMENT@80..114 - 0: FOR_KW@80..85 "for" [Newline("\n")] [Whitespace(" ")] - 1: AWAIT_KW@85..91 "await" [] [Whitespace(" ")] - 2: L_PAREN@91..92 "(" [] [] - 3: JS_FOR_VARIABLE_DECLARATION@92..106 - 0: AWAIT_KW@92..98 "await" [] [Whitespace(" ")] - 1: USING_KW@98..104 "using" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@104..106 - 0: JS_IDENTIFIER_BINDING@104..106 - 0: IDENT@104..106 "x" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 4: OF_KW@106..109 "of" [] [Whitespace(" ")] - 5: JS_IDENTIFIER_EXPRESSION@109..110 - 0: JS_REFERENCE_IDENTIFIER@109..110 - 0: IDENT@109..110 "y" [] [] - 6: R_PAREN@110..112 ")" [] [Whitespace(" ")] - 7: JS_BLOCK_STATEMENT@112..114 - 0: L_CURLY@112..113 "{" [] [] - 1: JS_STATEMENT_LIST@113..113 - 2: R_CURLY@113..114 "}" [] [] - 7: JS_EMPTY_STATEMENT@114..115 - 0: SEMICOLON@114..115 ";" [] [] - 4: EOF@115..116 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/var_decl.rast b/crates/biome_js_parser/test_data/inline/ok/var_decl.rast deleted file mode 100644 index 1233d513f741..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/var_decl.rast +++ /dev/null @@ -1,460 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@8..9 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@9..10 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@17..20 "foo" [] [], - }, - init: missing (optional), - }, - COMMA@20..22 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@22..26 "bar" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@26..28 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@28..30 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@30..31 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@31..32 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@32..37 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@37..41 "bar2" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@41..43 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@43..47 "foo2" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@47..48 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@48..55 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@55..57 "b" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@57..59 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@59..60 "5" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: CONST_KW@61..68 "const" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsObjectBindingPattern { - l_curly_token: L_CURLY@68..70 "{" [] [Whitespace(" ")], - properties: JsObjectBindingPatternPropertyList [ - JsObjectBindingPatternProperty { - member: JsLiteralMemberName { - value: IDENT@70..74 "foo5" [] [], - }, - colon_token: COLON@74..76 ":" [] [Whitespace(" ")], - pattern: JsArrayBindingPattern { - l_brack_token: L_BRACK@76..77 "[" [] [], - elements: JsArrayBindingPatternElementList [ - JsArrayBindingPatternElement { - pattern: JsIdentifierBinding { - name_token: IDENT@77..82 "bar11" [] [], - }, - init: missing (optional), - }, - ], - r_brack_token: R_BRACK@82..83 "]" [] [], - }, - init: missing (optional), - }, - COMMA@83..85 "," [] [Whitespace(" ")], - JsObjectBindingPatternShorthandProperty { - identifier: JsIdentifierBinding { - name_token: IDENT@85..90 "baz6" [] [Whitespace(" ")], - }, - init: missing (optional), - }, - ], - r_curly_token: R_CURLY@90..92 "}" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@92..94 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@94..95 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@95..96 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@96..97 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: LET_KW@97..102 "let" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@102..107 "foo6" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@107..109 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@109..116 "\"lorem\"" [] [], - }, - }, - }, - COMMA@116..118 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@118..123 "bar7" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@123..125 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@125..132 "\"ipsum\"" [] [], - }, - }, - }, - COMMA@132..134 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@134..141 "third8" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@141..143 "=" [] [Whitespace(" ")], - expression: JsStringLiteralExpression { - value_token: JS_STRING_LITERAL@143..150 "\"value\"" [] [], - }, - }, - }, - COMMA@150..152 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@152..159 "fourth" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@159..161 "=" [] [Whitespace(" ")], - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@161..162 "6" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@162..163 ";" [] [], - }, - JsVariableStatement { - declaration: JsVariableDeclaration { - await_token: missing (optional), - kind: VAR_KW@163..168 "var" [Newline("\n")] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@168..169 "q" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@169..171 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@171..172 "w" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@172..174 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@174..175 "e" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@175..177 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@177..178 "r" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@178..180 "," [] [Whitespace(" ")], - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@180..181 "t" [] [], - }, - variable_annotation: missing (optional), - initializer: missing (optional), - }, - ], - }, - semicolon_token: SEMICOLON@181..182 ";" [] [], - }, - ], - eof_token: EOF@182..183 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..183 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..182 - 0: JS_VARIABLE_STATEMENT@0..10 - 0: JS_VARIABLE_DECLARATION@0..9 - 0: (empty) - 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@4..9 - 0: JS_VARIABLE_DECLARATOR@4..9 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@6..9 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@8..9 - 0: JS_NUMBER_LITERAL@8..9 "5" [] [] - 1: SEMICOLON@9..10 ";" [] [] - 1: JS_VARIABLE_STATEMENT@10..32 - 0: JS_VARIABLE_DECLARATION@10..31 - 0: (empty) - 1: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@15..31 - 0: JS_VARIABLE_DECLARATOR@15..31 - 0: JS_OBJECT_BINDING_PATTERN@15..28 - 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@17..26 - 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@17..20 - 0: JS_IDENTIFIER_BINDING@17..20 - 0: IDENT@17..20 "foo" [] [] - 1: (empty) - 1: COMMA@20..22 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@22..26 - 0: JS_IDENTIFIER_BINDING@22..26 - 0: IDENT@22..26 "bar" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@26..28 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@28..31 - 0: EQ@28..30 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@30..31 - 0: JS_NUMBER_LITERAL@30..31 "5" [] [] - 1: SEMICOLON@31..32 ";" [] [] - 2: JS_VARIABLE_STATEMENT@32..48 - 0: JS_VARIABLE_DECLARATION@32..47 - 0: (empty) - 1: LET_KW@32..37 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@37..47 - 0: JS_VARIABLE_DECLARATOR@37..41 - 0: JS_IDENTIFIER_BINDING@37..41 - 0: IDENT@37..41 "bar2" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@41..43 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@43..47 - 0: JS_IDENTIFIER_BINDING@43..47 - 0: IDENT@43..47 "foo2" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@47..48 ";" [] [] - 3: JS_VARIABLE_STATEMENT@48..61 - 0: JS_VARIABLE_DECLARATION@48..60 - 0: (empty) - 1: CONST_KW@48..55 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@55..60 - 0: JS_VARIABLE_DECLARATOR@55..60 - 0: JS_IDENTIFIER_BINDING@55..57 - 0: IDENT@55..57 "b" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@57..60 - 0: EQ@57..59 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@59..60 - 0: JS_NUMBER_LITERAL@59..60 "5" [] [] - 1: SEMICOLON@60..61 ";" [] [] - 4: JS_VARIABLE_STATEMENT@61..97 - 0: JS_VARIABLE_DECLARATION@61..96 - 0: (empty) - 1: CONST_KW@61..68 "const" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@68..96 - 0: JS_VARIABLE_DECLARATOR@68..96 - 0: JS_OBJECT_BINDING_PATTERN@68..92 - 0: L_CURLY@68..70 "{" [] [Whitespace(" ")] - 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@70..90 - 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@70..83 - 0: JS_LITERAL_MEMBER_NAME@70..74 - 0: IDENT@70..74 "foo5" [] [] - 1: COLON@74..76 ":" [] [Whitespace(" ")] - 2: JS_ARRAY_BINDING_PATTERN@76..83 - 0: L_BRACK@76..77 "[" [] [] - 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@77..82 - 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@77..82 - 0: JS_IDENTIFIER_BINDING@77..82 - 0: IDENT@77..82 "bar11" [] [] - 1: (empty) - 2: R_BRACK@82..83 "]" [] [] - 3: (empty) - 1: COMMA@83..85 "," [] [Whitespace(" ")] - 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@85..90 - 0: JS_IDENTIFIER_BINDING@85..90 - 0: IDENT@85..90 "baz6" [] [Whitespace(" ")] - 1: (empty) - 2: R_CURLY@90..92 "}" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@92..96 - 0: EQ@92..94 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@94..96 - 0: L_CURLY@94..95 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@95..95 - 2: R_CURLY@95..96 "}" [] [] - 1: SEMICOLON@96..97 ";" [] [] - 5: JS_VARIABLE_STATEMENT@97..163 - 0: JS_VARIABLE_DECLARATION@97..162 - 0: (empty) - 1: LET_KW@97..102 "let" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@102..162 - 0: JS_VARIABLE_DECLARATOR@102..116 - 0: JS_IDENTIFIER_BINDING@102..107 - 0: IDENT@102..107 "foo6" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@107..116 - 0: EQ@107..109 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@109..116 - 0: JS_STRING_LITERAL@109..116 "\"lorem\"" [] [] - 1: COMMA@116..118 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@118..132 - 0: JS_IDENTIFIER_BINDING@118..123 - 0: IDENT@118..123 "bar7" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@123..132 - 0: EQ@123..125 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@125..132 - 0: JS_STRING_LITERAL@125..132 "\"ipsum\"" [] [] - 3: COMMA@132..134 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@134..150 - 0: JS_IDENTIFIER_BINDING@134..141 - 0: IDENT@134..141 "third8" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@141..150 - 0: EQ@141..143 "=" [] [Whitespace(" ")] - 1: JS_STRING_LITERAL_EXPRESSION@143..150 - 0: JS_STRING_LITERAL@143..150 "\"value\"" [] [] - 5: COMMA@150..152 "," [] [Whitespace(" ")] - 6: JS_VARIABLE_DECLARATOR@152..162 - 0: JS_IDENTIFIER_BINDING@152..159 - 0: IDENT@152..159 "fourth" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@159..162 - 0: EQ@159..161 "=" [] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@161..162 - 0: JS_NUMBER_LITERAL@161..162 "6" [] [] - 1: SEMICOLON@162..163 ";" [] [] - 6: JS_VARIABLE_STATEMENT@163..182 - 0: JS_VARIABLE_DECLARATION@163..181 - 0: (empty) - 1: VAR_KW@163..168 "var" [Newline("\n")] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR_LIST@168..181 - 0: JS_VARIABLE_DECLARATOR@168..169 - 0: JS_IDENTIFIER_BINDING@168..169 - 0: IDENT@168..169 "q" [] [] - 1: (empty) - 2: (empty) - 1: COMMA@169..171 "," [] [Whitespace(" ")] - 2: JS_VARIABLE_DECLARATOR@171..172 - 0: JS_IDENTIFIER_BINDING@171..172 - 0: IDENT@171..172 "w" [] [] - 1: (empty) - 2: (empty) - 3: COMMA@172..174 "," [] [Whitespace(" ")] - 4: JS_VARIABLE_DECLARATOR@174..175 - 0: JS_IDENTIFIER_BINDING@174..175 - 0: IDENT@174..175 "e" [] [] - 1: (empty) - 2: (empty) - 5: COMMA@175..177 "," [] [Whitespace(" ")] - 6: JS_VARIABLE_DECLARATOR@177..178 - 0: JS_IDENTIFIER_BINDING@177..178 - 0: IDENT@177..178 "r" [] [] - 1: (empty) - 2: (empty) - 7: COMMA@178..180 "," [] [Whitespace(" ")] - 8: JS_VARIABLE_DECLARATOR@180..181 - 0: JS_IDENTIFIER_BINDING@180..181 - 0: IDENT@180..181 "t" [] [] - 1: (empty) - 2: (empty) - 1: SEMICOLON@181..182 ";" [] [] - 4: EOF@182..183 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/while_stmt.rast b/crates/biome_js_parser/test_data/inline/ok/while_stmt.rast deleted file mode 100644 index 9450d0b74378..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/while_stmt.rast +++ /dev/null @@ -1,61 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsWhileStatement { - while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], - l_paren_token: L_PAREN@6..7 "(" [] [], - test: JsBooleanLiteralExpression { - value_token: TRUE_KW@7..11 "true" [] [], - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@13..14 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@14..15 "}" [] [], - }, - }, - JsWhileStatement { - while_token: WHILE_KW@15..22 "while" [Newline("\n")] [Whitespace(" ")], - l_paren_token: L_PAREN@22..23 "(" [] [], - test: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@23..24 "5" [] [], - }, - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@26..27 "{" [] [], - statements: JsStatementList [], - r_curly_token: R_CURLY@27..28 "}" [] [], - }, - }, - ], - eof_token: EOF@28..29 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..29 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..28 - 0: JS_WHILE_STATEMENT@0..15 - 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] - 1: L_PAREN@6..7 "(" [] [] - 2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11 - 0: TRUE_KW@7..11 "true" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@13..15 - 0: L_CURLY@13..14 "{" [] [] - 1: JS_STATEMENT_LIST@14..14 - 2: R_CURLY@14..15 "}" [] [] - 1: JS_WHILE_STATEMENT@15..28 - 0: WHILE_KW@15..22 "while" [Newline("\n")] [Whitespace(" ")] - 1: L_PAREN@22..23 "(" [] [] - 2: JS_NUMBER_LITERAL_EXPRESSION@23..24 - 0: JS_NUMBER_LITERAL@23..24 "5" [] [] - 3: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@26..28 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_STATEMENT_LIST@27..27 - 2: R_CURLY@27..28 "}" [] [] - 4: EOF@28..29 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/with_statement.rast b/crates/biome_js_parser/test_data/inline/ok/with_statement.rast deleted file mode 100644 index 344d4c3cc293..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/with_statement.rast +++ /dev/null @@ -1,164 +0,0 @@ -JsScript { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - statements: JsStatementList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], - star_token: missing (optional), - id: JsIdentifierBinding { - name_token: IDENT@19..20 "f" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@20..21 "(" [] [], - items: JsParameterList [ - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@21..22 "x" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - COMMA@22..24 "," [] [Whitespace(" ")], - JsFormalParameter { - decorators: JsDecoratorList [], - binding: JsIdentifierBinding { - name_token: IDENT@24..25 "o" [] [], - }, - question_mark_token: missing (optional), - type_annotation: missing (optional), - initializer: missing (optional), - }, - ], - r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@27..28 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsWithStatement { - with_token: WITH_KW@28..36 "with" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - l_paren_token: L_PAREN@36..37 "(" [] [], - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@37..38 "o" [] [], - }, - }, - r_paren_token: R_PAREN@38..40 ")" [] [Whitespace(" ")], - body: JsBlockStatement { - l_curly_token: L_CURLY@40..41 "{" [] [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsCallExpression { - callee: JsStaticMemberExpression { - object: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@41..53 "console" [Newline("\n"), Whitespace(" ")] [], - }, - }, - operator_token: DOT@53..54 "." [] [], - member: JsName { - value_token: IDENT@54..57 "log" [] [], - }, - }, - optional_chain_token: missing (optional), - type_arguments: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@57..58 "(" [] [], - args: JsCallArgumentList [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@58..59 "x" [] [], - }, - }, - ], - r_paren_token: R_PAREN@59..60 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@60..61 ";" [] [], - }, - ], - r_curly_token: R_CURLY@61..65 "}" [Newline("\n"), Whitespace(" ")] [], - }, - }, - ], - r_curly_token: R_CURLY@65..67 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@67..68 "" [Newline("\n")] [], -} - -0: JS_SCRIPT@0..68 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..67 - 0: JS_FUNCTION_DECLARATION@0..67 - 0: (empty) - 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] - 2: (empty) - 3: JS_IDENTIFIER_BINDING@19..20 - 0: IDENT@19..20 "f" [] [] - 4: (empty) - 5: JS_PARAMETERS@20..27 - 0: L_PAREN@20..21 "(" [] [] - 1: JS_PARAMETER_LIST@21..25 - 0: JS_FORMAL_PARAMETER@21..22 - 0: JS_DECORATOR_LIST@21..21 - 1: JS_IDENTIFIER_BINDING@21..22 - 0: IDENT@21..22 "x" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 1: COMMA@22..24 "," [] [Whitespace(" ")] - 2: JS_FORMAL_PARAMETER@24..25 - 0: JS_DECORATOR_LIST@24..24 - 1: JS_IDENTIFIER_BINDING@24..25 - 0: IDENT@24..25 "o" [] [] - 2: (empty) - 3: (empty) - 4: (empty) - 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@27..67 - 0: L_CURLY@27..28 "{" [] [] - 1: JS_DIRECTIVE_LIST@28..28 - 2: JS_STATEMENT_LIST@28..65 - 0: JS_WITH_STATEMENT@28..65 - 0: WITH_KW@28..36 "with" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: L_PAREN@36..37 "(" [] [] - 2: JS_IDENTIFIER_EXPRESSION@37..38 - 0: JS_REFERENCE_IDENTIFIER@37..38 - 0: IDENT@37..38 "o" [] [] - 3: R_PAREN@38..40 ")" [] [Whitespace(" ")] - 4: JS_BLOCK_STATEMENT@40..65 - 0: L_CURLY@40..41 "{" [] [] - 1: JS_STATEMENT_LIST@41..61 - 0: JS_EXPRESSION_STATEMENT@41..61 - 0: JS_CALL_EXPRESSION@41..60 - 0: JS_STATIC_MEMBER_EXPRESSION@41..57 - 0: JS_IDENTIFIER_EXPRESSION@41..53 - 0: JS_REFERENCE_IDENTIFIER@41..53 - 0: IDENT@41..53 "console" [Newline("\n"), Whitespace(" ")] [] - 1: DOT@53..54 "." [] [] - 2: JS_NAME@54..57 - 0: IDENT@54..57 "log" [] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@57..60 - 0: L_PAREN@57..58 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@58..59 - 0: JS_IDENTIFIER_EXPRESSION@58..59 - 0: JS_REFERENCE_IDENTIFIER@58..59 - 0: IDENT@58..59 "x" [] [] - 2: R_PAREN@59..60 ")" [] [] - 1: SEMICOLON@60..61 ";" [] [] - 2: R_CURLY@61..65 "}" [Newline("\n"), Whitespace(" ")] [] - 3: R_CURLY@65..67 "}" [Newline("\n")] [] - 4: EOF@67..68 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_expr.rast b/crates/biome_js_parser/test_data/inline/ok/yield_expr.rast deleted file mode 100644 index 6b1bd5b5b464..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/yield_expr.rast +++ /dev/null @@ -1,136 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], - star_token: STAR@9..10 "*" [] [], - id: JsIdentifierBinding { - name_token: IDENT@10..13 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@16..17 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@17..25 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: missing (optional), - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@25..28 "foo" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@28..29 ";" [] [], - }, - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@29..36 "yield" [Newline("\n"), Whitespace(" ")] [], - argument: JsYieldArgument { - star_token: STAR@36..38 "*" [] [Whitespace(" ")], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@38..41 "foo" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@41..42 ";" [] [], - }, - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@42..49 "yield" [Newline("\n"), Whitespace(" ")] [], - argument: missing (optional), - }, - semicolon_token: SEMICOLON@49..50 ";" [] [], - }, - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@50..57 "yield" [Newline("\n"), Whitespace(" ")] [], - argument: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@57..64 "yield" [Newline("\n"), Whitespace(" ")] [], - argument: missing (optional), - }, - semicolon_token: missing (optional), - }, - ], - r_curly_token: R_CURLY@64..66 "}" [Newline("\n")] [], - }, - }, - ], - eof_token: EOF@66..67 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..67 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..66 - 0: JS_FUNCTION_DECLARATION@0..66 - 0: (empty) - 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] - 2: STAR@9..10 "*" [] [] - 3: JS_IDENTIFIER_BINDING@10..13 - 0: IDENT@10..13 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@13..16 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..14 - 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@16..66 - 0: L_CURLY@16..17 "{" [] [] - 1: JS_DIRECTIVE_LIST@17..17 - 2: JS_STATEMENT_LIST@17..64 - 0: JS_EXPRESSION_STATEMENT@17..29 - 0: JS_YIELD_EXPRESSION@17..28 - 0: YIELD_KW@17..25 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@25..28 - 0: (empty) - 1: JS_IDENTIFIER_EXPRESSION@25..28 - 0: JS_REFERENCE_IDENTIFIER@25..28 - 0: IDENT@25..28 "foo" [] [] - 1: SEMICOLON@28..29 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@29..42 - 0: JS_YIELD_EXPRESSION@29..41 - 0: YIELD_KW@29..36 "yield" [Newline("\n"), Whitespace(" ")] [] - 1: JS_YIELD_ARGUMENT@36..41 - 0: STAR@36..38 "*" [] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@38..41 - 0: JS_REFERENCE_IDENTIFIER@38..41 - 0: IDENT@38..41 "foo" [] [] - 1: SEMICOLON@41..42 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@42..50 - 0: JS_YIELD_EXPRESSION@42..49 - 0: YIELD_KW@42..49 "yield" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 1: SEMICOLON@49..50 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@50..57 - 0: JS_YIELD_EXPRESSION@50..57 - 0: YIELD_KW@50..57 "yield" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 1: (empty) - 4: JS_EXPRESSION_STATEMENT@57..64 - 0: JS_YIELD_EXPRESSION@57..64 - 0: YIELD_KW@57..64 "yield" [Newline("\n"), Whitespace(" ")] [] - 1: (empty) - 1: (empty) - 3: R_CURLY@64..66 "}" [Newline("\n")] [] - 4: EOF@66..67 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.rast b/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.rast deleted file mode 100644 index 779baf5e50ca..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.rast +++ /dev/null @@ -1,187 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@0..8 "function" [] [], - star_token: STAR@8..10 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@10..13 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@13..14 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@18..24 "yield" [] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: missing (optional), - expression: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@24..26 "10" [] [], - }, - }, - }, - semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@28..29 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@29..38 "function" [Newline("\n")] [], - star_token: STAR@38..40 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@40..43 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@43..44 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@44..46 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@48..54 "yield" [] [Whitespace(" ")], - argument: JsYieldArgument { - star_token: STAR@54..55 "*" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@55..58 "bar" [] [], - }, - }, - }, - }, - semicolon_token: SEMICOLON@58..60 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@60..61 "}" [] [], - }, - }, - JsFunctionDeclaration { - async_token: missing (optional), - function_token: FUNCTION_KW@61..70 "function" [Newline("\n")] [], - star_token: STAR@70..72 "*" [] [Whitespace(" ")], - id: JsIdentifierBinding { - name_token: IDENT@72..75 "foo" [] [], - }, - type_parameters: missing (optional), - parameters: JsParameters { - l_paren_token: L_PAREN@75..76 "(" [] [], - items: JsParameterList [], - r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], - }, - return_type_annotation: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsExpressionStatement { - expression: JsYieldExpression { - yield_token: YIELD_KW@80..85 "yield" [] [], - argument: missing (optional), - }, - semicolon_token: SEMICOLON@85..87 ";" [] [Whitespace(" ")], - }, - ], - r_curly_token: R_CURLY@87..88 "}" [] [], - }, - }, - ], - eof_token: EOF@88..89 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..89 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..88 - 0: JS_FUNCTION_DECLARATION@0..29 - 0: (empty) - 1: FUNCTION_KW@0..8 "function" [] [] - 2: STAR@8..10 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@10..13 - 0: IDENT@10..13 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@13..16 - 0: L_PAREN@13..14 "(" [] [] - 1: JS_PARAMETER_LIST@14..14 - 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@16..29 - 0: L_CURLY@16..18 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@18..18 - 2: JS_STATEMENT_LIST@18..28 - 0: JS_EXPRESSION_STATEMENT@18..28 - 0: JS_YIELD_EXPRESSION@18..26 - 0: YIELD_KW@18..24 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@24..26 - 0: (empty) - 1: JS_NUMBER_LITERAL_EXPRESSION@24..26 - 0: JS_NUMBER_LITERAL@24..26 "10" [] [] - 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] - 3: R_CURLY@28..29 "}" [] [] - 1: JS_FUNCTION_DECLARATION@29..61 - 0: (empty) - 1: FUNCTION_KW@29..38 "function" [Newline("\n")] [] - 2: STAR@38..40 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@40..43 - 0: IDENT@40..43 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@43..46 - 0: L_PAREN@43..44 "(" [] [] - 1: JS_PARAMETER_LIST@44..44 - 2: R_PAREN@44..46 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@46..61 - 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@48..48 - 2: JS_STATEMENT_LIST@48..60 - 0: JS_EXPRESSION_STATEMENT@48..60 - 0: JS_YIELD_EXPRESSION@48..58 - 0: YIELD_KW@48..54 "yield" [] [Whitespace(" ")] - 1: JS_YIELD_ARGUMENT@54..58 - 0: STAR@54..55 "*" [] [] - 1: JS_IDENTIFIER_EXPRESSION@55..58 - 0: JS_REFERENCE_IDENTIFIER@55..58 - 0: IDENT@55..58 "bar" [] [] - 1: SEMICOLON@58..60 ";" [] [Whitespace(" ")] - 3: R_CURLY@60..61 "}" [] [] - 2: JS_FUNCTION_DECLARATION@61..88 - 0: (empty) - 1: FUNCTION_KW@61..70 "function" [Newline("\n")] [] - 2: STAR@70..72 "*" [] [Whitespace(" ")] - 3: JS_IDENTIFIER_BINDING@72..75 - 0: IDENT@72..75 "foo" [] [] - 4: (empty) - 5: JS_PARAMETERS@75..78 - 0: L_PAREN@75..76 "(" [] [] - 1: JS_PARAMETER_LIST@76..76 - 2: R_PAREN@76..78 ")" [] [Whitespace(" ")] - 6: (empty) - 7: JS_FUNCTION_BODY@78..88 - 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] - 1: JS_DIRECTIVE_LIST@80..80 - 2: JS_STATEMENT_LIST@80..87 - 0: JS_EXPRESSION_STATEMENT@80..87 - 0: JS_YIELD_EXPRESSION@80..85 - 0: YIELD_KW@80..85 "yield" [] [] - 1: (empty) - 1: SEMICOLON@85..87 ";" [] [Whitespace(" ")] - 3: R_CURLY@87..88 "}" [] [] - 4: EOF@88..89 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js.snap new file mode 100644 index 000000000000..eb4c1f7adb8d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +abstract class A {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + CLASS_KW@9..15 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + L_CURLY@17..18 "{" [] [], + JsClassMemberList [], + R_CURLY@18..19 "}" [] [], + ], + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..19 + 0: JS_BOGUS_STATEMENT@0..19 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: L_CURLY@17..18 "{" [] [] + 5: JS_CLASS_MEMBER_LIST@18..18 + 6: R_CURLY@18..19 "}" [] [] + 4: EOF@19..20 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +abstract_class_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × abstract classes are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + > 1 │ abstract class A {} + │ ^^^^^^^^^^^^^^^^^^^ + 2 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js.snap new file mode 100644 index 000000000000..e768396d12f1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js.snap @@ -0,0 +1,517 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[a a, ++b, ] = test; +[a, c, ...rest,] = test; +[a = , = "test"] = test; +[[a b] [c]]= test; +[a: b] = c + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@0..1 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@1..3 "a" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + missing separator, + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@3..4 "a" [] [], + }, + init: missing (optional), + }, + COMMA@4..6 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsBogusAssignment { + items: [ + PLUS2@6..8 "++" [] [], + JsIdentifierAssignment { + name_token: IDENT@8..9 "b" [] [], + }, + ], + }, + init: missing (optional), + }, + COMMA@9..11 "," [] [Whitespace(" ")], + ], + r_brack_token: R_BRACK@11..13 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@13..15 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..19 "test" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_BRACK@20..22 "[" [Newline("\n")] [], + JsBogus { + items: [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@22..23 "a" [] [], + }, + init: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@25..26 "c" [] [], + }, + init: missing (optional), + }, + COMMA@26..28 "," [] [Whitespace(" ")], + JsBogus { + items: [ + DOT3@28..31 "..." [] [], + JsIdentifierAssignment { + name_token: IDENT@31..35 "rest" [] [], + }, + ], + }, + COMMA@35..36 "," [] [], + ], + }, + R_BRACK@36..38 "]" [] [Whitespace(" ")], + ], + }, + EQ@38..40 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..44 "test" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@45..47 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@47..49 "a" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@49..51 "=" [] [Whitespace(" ")], + expression: missing (required), + }, + }, + COMMA@51..53 "," [] [Whitespace(" ")], + ], + r_brack_token: missing (required), + }, + operator_token: EQ@53..55 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@55..61 "\"test\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_BRACK@61..63 "]" [] [Whitespace(" ")], + EQ@63..65 "=" [] [Whitespace(" ")], + IDENT@65..69 "test" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@70..72 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsComputedMemberAssignment { + object: JsArrayExpression { + l_brack_token: L_BRACK@72..73 "[" [] [], + elements: JsArrayElementList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@73..75 "a" [] [Whitespace(" ")], + }, + }, + missing separator, + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@75..76 "b" [] [], + }, + }, + ], + r_brack_token: R_BRACK@76..78 "]" [] [Whitespace(" ")], + }, + l_brack_token: L_BRACK@78..79 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@79..80 "c" [] [], + }, + }, + r_brack_token: R_BRACK@80..81 "]" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@81..82 "]" [] [], + }, + operator_token: EQ@82..84 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..88 "test" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@88..89 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_BRACK@89..91 "[" [Newline("\n")] [], + JsBogus { + items: [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@91..92 "a" [] [], + }, + init: missing (optional), + }, + JsBogusAssignment { + items: [ + COLON@92..94 ":" [] [Whitespace(" ")], + IDENT@94..95 "b" [] [], + ], + }, + ], + }, + R_BRACK@95..97 "]" [] [Whitespace(" ")], + ], + }, + EQ@97..99 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@99..100 "c" [] [], + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@100..101 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..101 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..100 + 0: JS_EXPRESSION_STATEMENT@0..20 + 0: JS_ASSIGNMENT_EXPRESSION@0..19 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@0..13 + 0: L_BRACK@0..1 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@1..11 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@1..3 + 0: JS_IDENTIFIER_ASSIGNMENT@1..3 + 0: IDENT@1..3 "a" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@3..4 + 0: JS_IDENTIFIER_ASSIGNMENT@3..4 + 0: IDENT@3..4 "a" [] [] + 1: (empty) + 3: COMMA@4..6 "," [] [Whitespace(" ")] + 4: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@6..9 + 0: JS_BOGUS_ASSIGNMENT@6..9 + 0: PLUS2@6..8 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@8..9 + 0: IDENT@8..9 "b" [] [] + 1: (empty) + 5: COMMA@9..11 "," [] [Whitespace(" ")] + 2: R_BRACK@11..13 "]" [] [Whitespace(" ")] + 1: EQ@13..15 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@15..19 + 0: JS_REFERENCE_IDENTIFIER@15..19 + 0: IDENT@15..19 "test" [] [] + 1: SEMICOLON@19..20 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@20..45 + 0: JS_BOGUS_EXPRESSION@20..44 + 0: JS_BOGUS@20..38 + 0: L_BRACK@20..22 "[" [Newline("\n")] [] + 1: JS_BOGUS@22..36 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@22..23 + 0: JS_IDENTIFIER_ASSIGNMENT@22..23 + 0: IDENT@22..23 "a" [] [] + 1: (empty) + 1: COMMA@23..25 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@25..26 + 0: JS_IDENTIFIER_ASSIGNMENT@25..26 + 0: IDENT@25..26 "c" [] [] + 1: (empty) + 3: COMMA@26..28 "," [] [Whitespace(" ")] + 4: JS_BOGUS@28..35 + 0: DOT3@28..31 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@31..35 + 0: IDENT@31..35 "rest" [] [] + 5: COMMA@35..36 "," [] [] + 2: R_BRACK@36..38 "]" [] [Whitespace(" ")] + 1: EQ@38..40 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@40..44 + 0: JS_REFERENCE_IDENTIFIER@40..44 + 0: IDENT@40..44 "test" [] [] + 1: SEMICOLON@44..45 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@45..61 + 0: JS_ASSIGNMENT_EXPRESSION@45..61 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@45..53 + 0: L_BRACK@45..47 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@47..53 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@47..51 + 0: JS_IDENTIFIER_ASSIGNMENT@47..49 + 0: IDENT@47..49 "a" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@49..51 + 0: EQ@49..51 "=" [] [Whitespace(" ")] + 1: (empty) + 1: COMMA@51..53 "," [] [Whitespace(" ")] + 2: (empty) + 1: EQ@53..55 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@55..61 + 0: JS_STRING_LITERAL@55..61 "\"test\"" [] [] + 1: (empty) + 3: JS_BOGUS_STATEMENT@61..69 + 0: R_BRACK@61..63 "]" [] [Whitespace(" ")] + 1: EQ@63..65 "=" [] [Whitespace(" ")] + 2: IDENT@65..69 "test" [] [] + 4: JS_EMPTY_STATEMENT@69..70 + 0: SEMICOLON@69..70 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@70..89 + 0: JS_ASSIGNMENT_EXPRESSION@70..88 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@70..82 + 0: L_BRACK@70..72 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@72..81 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@72..81 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@72..81 + 0: JS_ARRAY_EXPRESSION@72..78 + 0: L_BRACK@72..73 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@73..76 + 0: JS_IDENTIFIER_EXPRESSION@73..75 + 0: JS_REFERENCE_IDENTIFIER@73..75 + 0: IDENT@73..75 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_EXPRESSION@75..76 + 0: JS_REFERENCE_IDENTIFIER@75..76 + 0: IDENT@75..76 "b" [] [] + 2: R_BRACK@76..78 "]" [] [Whitespace(" ")] + 1: L_BRACK@78..79 "[" [] [] + 2: JS_IDENTIFIER_EXPRESSION@79..80 + 0: JS_REFERENCE_IDENTIFIER@79..80 + 0: IDENT@79..80 "c" [] [] + 3: R_BRACK@80..81 "]" [] [] + 1: (empty) + 2: R_BRACK@81..82 "]" [] [] + 1: EQ@82..84 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@84..88 + 0: JS_REFERENCE_IDENTIFIER@84..88 + 0: IDENT@84..88 "test" [] [] + 1: SEMICOLON@88..89 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@89..100 + 0: JS_BOGUS_EXPRESSION@89..100 + 0: JS_BOGUS@89..97 + 0: L_BRACK@89..91 "[" [Newline("\n")] [] + 1: JS_BOGUS@91..95 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@91..92 + 0: JS_IDENTIFIER_ASSIGNMENT@91..92 + 0: IDENT@91..92 "a" [] [] + 1: (empty) + 1: JS_BOGUS_ASSIGNMENT@92..95 + 0: COLON@92..94 ":" [] [Whitespace(" ")] + 1: IDENT@94..95 "b" [] [] + 2: R_BRACK@95..97 "]" [] [Whitespace(" ")] + 1: EQ@97..99 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@99..100 + 0: JS_REFERENCE_IDENTIFIER@99..100 + 0: IDENT@99..100 "c" [] [] + 1: (empty) + 4: EOF@100..101 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +array_assignment_target_err.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `a` + + > 1 │ [a a, ++b, ] = test; + │ ^ + 2 │ [a, c, ...rest,] = test; + 3 │ [a = , = "test"] = test; + + i Remove a + +array_assignment_target_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `++b` + + > 1 │ [a a, ++b, ] = test; + │ ^^^ + 2 │ [a, c, ...rest,] = test; + 3 │ [a = , = "test"] = test; + + i This expression cannot be assigned to + +array_assignment_target_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element may not have a trailing comma + + 1 │ [a a, ++b, ] = test; + > 2 │ [a, c, ...rest,] = test; + │ ^ + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; + + i Remove the trailing comma here + + 1 │ [a a, ++b, ] = test; + > 2 │ [a, c, ...rest,] = test; + │ ^ + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; + + i Rest element + + 1 │ [a a, ++b, ] = test; + > 2 │ [a, c, ...rest,] = test; + │ ^^^^^^^ + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; + +array_assignment_target_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ','. + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + + i Expected an expression, or an assignment here. + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + +array_assignment_target_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an assignment target, a rest element, or a comma but instead found '='. + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + + i Expected an assignment target, a rest element, or a comma here. + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + +array_assignment_target_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + + i An explicit or implicit semicolon is expected here... + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + + i ...Which is required to end this statement + + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^^^^^^^^^^^^^^^^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c + +array_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `b` + + 2 │ [a, c, ...rest,] = test; + 3 │ [a = , = "test"] = test; + > 4 │ [[a b] [c]]= test; + │ ^ + 5 │ [a: b] = c + 6 │ + + i Remove b + +array_assignment_target_err.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `:` + + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; + > 5 │ [a: b] = c + │ ^ + 6 │ + + i Remove : + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js.snap new file mode 100644 index 000000000000..3d496cc0c11a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js.snap @@ -0,0 +1,261 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +([ ... ] = a); +([ ...c = "default" ] = a); +([ ...rest, other_assignment ] = a); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@1..3 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@3..7 "..." [] [Whitespace(" ")], + pattern: missing (required), + }, + ], + r_brack_token: R_BRACK@7..9 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@9..11 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..12 "a" [] [], + }, + }, + }, + r_paren_token: R_PAREN@12..13 ")" [] [], + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@14..16 "(" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_BRACK@16..18 "[" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@18..21 "..." [] [], + JsIdentifierAssignment { + name_token: IDENT@21..23 "c" [] [Whitespace(" ")], + }, + EQ@23..25 "=" [] [Whitespace(" ")], + JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")], + ], + }, + ], + }, + R_BRACK@35..37 "]" [] [Whitespace(" ")], + ], + }, + EQ@37..39 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@39..40 "a" [] [], + }, + }, + ], + }, + r_paren_token: R_PAREN@40..41 ")" [] [], + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_BRACK@44..46 "[" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@46..49 "..." [] [], + JsIdentifierAssignment { + name_token: IDENT@49..53 "rest" [] [], + }, + ], + }, + COMMA@53..55 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@55..72 "other_assignment" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + }, + R_BRACK@72..74 "]" [] [Whitespace(" ")], + ], + }, + EQ@74..76 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@76..77 "a" [] [], + }, + }, + ], + }, + r_paren_token: R_PAREN@77..78 ")" [] [], + }, + semicolon_token: SEMICOLON@78..79 ";" [] [], + }, + ], + eof_token: EOF@79..80 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..80 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..79 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_PARENTHESIZED_EXPRESSION@0..13 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..12 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@1..9 + 0: L_BRACK@1..3 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@3..7 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@3..7 + 0: DOT3@3..7 "..." [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@7..9 "]" [] [Whitespace(" ")] + 1: EQ@9..11 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@11..12 + 0: JS_REFERENCE_IDENTIFIER@11..12 + 0: IDENT@11..12 "a" [] [] + 2: R_PAREN@12..13 ")" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..42 + 0: JS_PARENTHESIZED_EXPRESSION@14..41 + 0: L_PAREN@14..16 "(" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@16..40 + 0: JS_BOGUS@16..37 + 0: L_BRACK@16..18 "[" [] [Whitespace(" ")] + 1: JS_BOGUS@18..35 + 0: JS_BOGUS@18..35 + 0: DOT3@18..21 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@21..23 + 0: IDENT@21..23 "c" [] [Whitespace(" ")] + 2: EQ@23..25 "=" [] [Whitespace(" ")] + 3: JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")] + 2: R_BRACK@35..37 "]" [] [Whitespace(" ")] + 1: EQ@37..39 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@39..40 + 0: JS_REFERENCE_IDENTIFIER@39..40 + 0: IDENT@39..40 "a" [] [] + 2: R_PAREN@40..41 ")" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@42..79 + 0: JS_PARENTHESIZED_EXPRESSION@42..78 + 0: L_PAREN@42..44 "(" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@44..77 + 0: JS_BOGUS@44..74 + 0: L_BRACK@44..46 "[" [] [Whitespace(" ")] + 1: JS_BOGUS@46..72 + 0: JS_BOGUS@46..53 + 0: DOT3@46..49 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@49..53 + 0: IDENT@49..53 "rest" [] [] + 1: COMMA@53..55 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@55..72 + 0: JS_IDENTIFIER_ASSIGNMENT@55..72 + 0: IDENT@55..72 "other_assignment" [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@72..74 "]" [] [Whitespace(" ")] + 1: EQ@74..76 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@76..77 + 0: JS_REFERENCE_IDENTIFIER@76..77 + 0: IDENT@76..77 "a" [] [] + 2: R_PAREN@77..78 ")" [] [] + 1: SEMICOLON@78..79 ";" [] [] + 4: EOF@79..80 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +array_assignment_target_rest_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or an assignment target but instead found ''. + + > 1 │ ([ ... ] = a); + │ + 2 │ ([ ...c = "default" ] = a); + 3 │ ([ ...rest, other_assignment ] = a); + + i Expected an identifier, or an assignment target here. + + > 1 │ ([ ... ] = a); + │ + 2 │ ([ ...c = "default" ] = a); + 3 │ ([ ...rest, other_assignment ] = a); + +array_assignment_target_rest_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element cannot have a default + + 1 │ ([ ... ] = a); + > 2 │ ([ ...c = "default" ] = a); + │ ^^^^^^^^^^^^ + 3 │ ([ ...rest, other_assignment ] = a); + 4 │ + + i Remove the default value here + + 1 │ ([ ... ] = a); + > 2 │ ([ ...c = "default" ] = a); + │ ^^^^^^^^^^^^ + 3 │ ([ ...rest, other_assignment ] = a); + 4 │ + + i Rest element + + 1 │ ([ ... ] = a); + > 2 │ ([ ...c = "default" ] = a); + │ ^^^^ + 3 │ ([ ...rest, other_assignment ] = a); + 4 │ + +array_assignment_target_rest_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element must be the last element + + 1 │ ([ ... ] = a); + 2 │ ([ ...c = "default" ] = a); + > 3 │ ([ ...rest, other_assignment ] = a); + │ ^^^^^^^ + 4 │ + + i Move the rest element to the end of the pattern, right before the closing ']' + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_binding_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js.snap new file mode 100644 index 000000000000..ec3dfab7e0d8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js.snap @@ -0,0 +1,426 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let [a b] = [1, 2]; +let [="default"] = [1, 2]; +let ["default"] = [1, 2]; +let [[c ] = []; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@4..5 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@5..7 "a" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + missing separator, + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@7..8 "b" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@8..10 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@10..12 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@12..13 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..14 "1" [] [], + }, + COMMA@14..16 "," [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@16..17 "2" [] [], + }, + ], + r_brack_token: R_BRACK@17..18 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@24..25 "[" [] [], + elements: JsArrayBindingPatternElementList [], + r_brack_token: missing (required), + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@25..26 "=" [] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@26..35 "\"default\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_BRACK@35..37 "]" [] [Whitespace(" ")], + EQ@37..39 "=" [] [Whitespace(" ")], + L_BRACK@39..40 "[" [] [], + JS_NUMBER_LITERAL@40..41 "1" [] [], + COMMA@41..43 "," [] [Whitespace(" ")], + JS_NUMBER_LITERAL@43..44 "2" [] [], + R_BRACK@44..45 "]" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_BRACK@51..52 "[" [] [], + JsBogus { + items: [ + JsBogusBinding { + items: [ + JS_STRING_LITERAL@52..61 "\"default\"" [] [], + ], + }, + ], + }, + R_BRACK@61..63 "]" [] [Whitespace(" ")], + ], + }, + JsInitializerClause { + eq_token: EQ@63..65 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@65..66 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@66..67 "1" [] [], + }, + COMMA@67..69 "," [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@69..70 "2" [] [], + }, + ], + r_brack_token: R_BRACK@70..71 "]" [] [], + }, + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@71..72 ";" [] [], + ], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@72..77 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@77..78 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsArrayBindingPattern { + l_brack_token: L_BRACK@78..79 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@79..81 "c" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@81..83 "]" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@83..85 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@85..86 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@86..87 "]" [] [], + }, + }, + }, + ], + r_brack_token: missing (required), + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@87..88 ";" [] [], + }, + ], + eof_token: EOF@88..89 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..89 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..88 + 0: JS_VARIABLE_STATEMENT@0..19 + 0: JS_VARIABLE_DECLARATION@0..18 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..18 + 0: JS_VARIABLE_DECLARATOR@4..18 + 0: JS_ARRAY_BINDING_PATTERN@4..10 + 0: L_BRACK@4..5 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@5..8 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@5..7 + 0: JS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "a" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@7..8 + 0: JS_IDENTIFIER_BINDING@7..8 + 0: IDENT@7..8 "b" [] [] + 1: (empty) + 2: R_BRACK@8..10 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@10..18 + 0: EQ@10..12 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@12..18 + 0: L_BRACK@12..13 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@13..17 + 0: JS_NUMBER_LITERAL_EXPRESSION@13..14 + 0: JS_NUMBER_LITERAL@13..14 "1" [] [] + 1: COMMA@14..16 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@16..17 + 0: JS_NUMBER_LITERAL@16..17 "2" [] [] + 2: R_BRACK@17..18 "]" [] [] + 1: SEMICOLON@18..19 ";" [] [] + 1: JS_VARIABLE_STATEMENT@19..35 + 0: JS_VARIABLE_DECLARATION@19..35 + 0: (empty) + 1: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@24..35 + 0: JS_VARIABLE_DECLARATOR@24..35 + 0: JS_ARRAY_BINDING_PATTERN@24..25 + 0: L_BRACK@24..25 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@25..25 + 2: (empty) + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@25..35 + 0: EQ@25..26 "=" [] [] + 1: JS_STRING_LITERAL_EXPRESSION@26..35 + 0: JS_STRING_LITERAL@26..35 "\"default\"" [] [] + 1: (empty) + 2: JS_BOGUS_STATEMENT@35..45 + 0: R_BRACK@35..37 "]" [] [Whitespace(" ")] + 1: EQ@37..39 "=" [] [Whitespace(" ")] + 2: L_BRACK@39..40 "[" [] [] + 3: JS_NUMBER_LITERAL@40..41 "1" [] [] + 4: COMMA@41..43 "," [] [Whitespace(" ")] + 5: JS_NUMBER_LITERAL@43..44 "2" [] [] + 6: R_BRACK@44..45 "]" [] [] + 3: JS_EMPTY_STATEMENT@45..46 + 0: SEMICOLON@45..46 ";" [] [] + 4: JS_BOGUS_STATEMENT@46..72 + 0: JS_BOGUS@46..71 + 0: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@51..71 + 0: JS_BOGUS@51..71 + 0: JS_BOGUS@51..63 + 0: L_BRACK@51..52 "[" [] [] + 1: JS_BOGUS@52..61 + 0: JS_BOGUS_BINDING@52..61 + 0: JS_STRING_LITERAL@52..61 "\"default\"" [] [] + 2: R_BRACK@61..63 "]" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@63..71 + 0: EQ@63..65 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@65..71 + 0: L_BRACK@65..66 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@66..70 + 0: JS_NUMBER_LITERAL_EXPRESSION@66..67 + 0: JS_NUMBER_LITERAL@66..67 "1" [] [] + 1: COMMA@67..69 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@69..70 + 0: JS_NUMBER_LITERAL@69..70 "2" [] [] + 2: R_BRACK@70..71 "]" [] [] + 1: SEMICOLON@71..72 ";" [] [] + 5: JS_VARIABLE_STATEMENT@72..88 + 0: JS_VARIABLE_DECLARATION@72..87 + 0: (empty) + 1: LET_KW@72..77 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@77..87 + 0: JS_VARIABLE_DECLARATOR@77..87 + 0: JS_ARRAY_BINDING_PATTERN@77..87 + 0: L_BRACK@77..78 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@78..87 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@78..87 + 0: JS_ARRAY_BINDING_PATTERN@78..83 + 0: L_BRACK@78..79 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@79..81 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@79..81 + 0: JS_IDENTIFIER_BINDING@79..81 + 0: IDENT@79..81 "c" [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@81..83 "]" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@83..87 + 0: EQ@83..85 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@85..87 + 0: L_BRACK@85..86 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@86..86 + 2: R_BRACK@86..87 "]" [] [] + 2: (empty) + 1: (empty) + 2: (empty) + 1: SEMICOLON@87..88 ";" [] [] + 4: EOF@88..89 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +array_binding_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `b` + + > 1 │ let [a b] = [1, 2]; + │ ^ + 2 │ let [="default"] = [1, 2]; + 3 │ let ["default"] = [1, 2]; + + i Remove b + +array_binding_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an object pattern, an array pattern, or a rest pattern but instead found '='. + + 1 │ let [a b] = [1, 2]; + > 2 │ let [="default"] = [1, 2]; + │ ^ + 3 │ let ["default"] = [1, 2]; + 4 │ let [[c ] = []; + + i Expected an identifier, an object pattern, an array pattern, or a rest pattern here. + + 1 │ let [a b] = [1, 2]; + > 2 │ let [="default"] = [1, 2]; + │ ^ + 3 │ let ["default"] = [1, 2]; + 4 │ let [[c ] = []; + +array_binding_err.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ let [a b] = [1, 2]; + > 2 │ let [="default"] = [1, 2]; + │ ^ + 3 │ let ["default"] = [1, 2]; + 4 │ let [[c ] = []; + + i An explicit or implicit semicolon is expected here... + + 1 │ let [a b] = [1, 2]; + > 2 │ let [="default"] = [1, 2]; + │ ^ + 3 │ let ["default"] = [1, 2]; + 4 │ let [[c ] = []; + + i ...Which is required to end this statement + + 1 │ let [a b] = [1, 2]; + > 2 │ let [="default"] = [1, 2]; + │ ^^^^^^^^^^^^^^^ + 3 │ let ["default"] = [1, 2]; + 4 │ let [[c ] = []; + +array_binding_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an object pattern, an array pattern, or a rest pattern but instead found '"default"'. + + 1 │ let [a b] = [1, 2]; + 2 │ let [="default"] = [1, 2]; + > 3 │ let ["default"] = [1, 2]; + │ ^^^^^^^^^ + 4 │ let [[c ] = []; + 5 │ + + i Expected an identifier, an object pattern, an array pattern, or a rest pattern here. + + 1 │ let [a b] = [1, 2]; + 2 │ let [="default"] = [1, 2]; + > 3 │ let ["default"] = [1, 2]; + │ ^^^^^^^^^ + 4 │ let [[c ] = []; + 5 │ + +array_binding_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `;` + + 2 │ let [="default"] = [1, 2]; + 3 │ let ["default"] = [1, 2]; + > 4 │ let [[c ] = []; + │ ^ + 5 │ + + i Remove ; + +array_binding_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Object and Array patterns require initializers. + + 2 │ let [="default"] = [1, 2]; + 3 │ let ["default"] = [1, 2]; + > 4 │ let [[c ] = []; + │ ^^^^^^^^^^ + 5 │ + + i This pattern is declared, but it is not given an initialized value. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js.snap new file mode 100644 index 000000000000..a182cac234c8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js.snap @@ -0,0 +1,289 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let [ ... ] = a; +let [ ...c = "default" ] = a; +let [ ...rest, other_assignment ] = a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@4..6 "[" [] [Whitespace(" ")], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@6..10 "..." [] [Whitespace(" ")], + pattern: missing (required), + }, + ], + r_brack_token: R_BRACK@10..12 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@12..14 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..15 "a" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_BRACK@21..23 "[" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@23..26 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@26..28 "c" [] [Whitespace(" ")], + }, + EQ@28..30 "=" [] [Whitespace(" ")], + JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")], + ], + }, + ], + }, + R_BRACK@40..42 "]" [] [Whitespace(" ")], + ], + }, + JsInitializerClause { + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "a" [] [], + }, + }, + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@45..46 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_BRACK@51..53 "[" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@53..56 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@56..60 "rest" [] [], + }, + ], + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@62..79 "other_assignment" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + }, + R_BRACK@79..81 "]" [] [Whitespace(" ")], + ], + }, + JsInitializerClause { + eq_token: EQ@81..83 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@83..84 "a" [] [], + }, + }, + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@84..85 ";" [] [], + ], + }, + ], + eof_token: EOF@85..86 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..86 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..85 + 0: JS_VARIABLE_STATEMENT@0..16 + 0: JS_VARIABLE_DECLARATION@0..15 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..15 + 0: JS_VARIABLE_DECLARATOR@4..15 + 0: JS_ARRAY_BINDING_PATTERN@4..12 + 0: L_BRACK@4..6 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@6..10 + 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@6..10 + 0: DOT3@6..10 "..." [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@10..12 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@12..15 + 0: EQ@12..14 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@14..15 + 0: JS_REFERENCE_IDENTIFIER@14..15 + 0: IDENT@14..15 "a" [] [] + 1: SEMICOLON@15..16 ";" [] [] + 1: JS_BOGUS_STATEMENT@16..46 + 0: JS_BOGUS@16..45 + 0: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@21..45 + 0: JS_BOGUS@21..45 + 0: JS_BOGUS@21..42 + 0: L_BRACK@21..23 "[" [] [Whitespace(" ")] + 1: JS_BOGUS@23..40 + 0: JS_BOGUS@23..40 + 0: DOT3@23..26 "..." [] [] + 1: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "c" [] [Whitespace(" ")] + 2: EQ@28..30 "=" [] [Whitespace(" ")] + 3: JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")] + 2: R_BRACK@40..42 "]" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@42..45 + 0: EQ@42..44 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "a" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 2: JS_BOGUS_STATEMENT@46..85 + 0: JS_BOGUS@46..84 + 0: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@51..84 + 0: JS_BOGUS@51..84 + 0: JS_BOGUS@51..81 + 0: L_BRACK@51..53 "[" [] [Whitespace(" ")] + 1: JS_BOGUS@53..79 + 0: JS_BOGUS@53..60 + 0: DOT3@53..56 "..." [] [] + 1: JS_IDENTIFIER_BINDING@56..60 + 0: IDENT@56..60 "rest" [] [] + 1: COMMA@60..62 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@62..79 + 0: JS_IDENTIFIER_BINDING@62..79 + 0: IDENT@62..79 "other_assignment" [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@79..81 "]" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@81..84 + 0: EQ@81..83 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@83..84 + 0: JS_REFERENCE_IDENTIFIER@83..84 + 0: IDENT@83..84 "a" [] [] + 1: SEMICOLON@84..85 ";" [] [] + 4: EOF@85..86 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +array_binding_rest_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found ''. + + > 1 │ let [ ... ] = a; + │ + 2 │ let [ ...c = "default" ] = a; + 3 │ let [ ...rest, other_assignment ] = a; + + i Expected an identifier, an array pattern, or an object pattern here. + + > 1 │ let [ ... ] = a; + │ + 2 │ let [ ...c = "default" ] = a; + 3 │ let [ ...rest, other_assignment ] = a; + +array_binding_rest_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element cannot have a default + + 1 │ let [ ... ] = a; + > 2 │ let [ ...c = "default" ] = a; + │ ^^^^^^^^^^^^ + 3 │ let [ ...rest, other_assignment ] = a; + 4 │ + + i Remove the default value here + + 1 │ let [ ... ] = a; + > 2 │ let [ ...c = "default" ] = a; + │ ^^^^^^^^^^^^ + 3 │ let [ ...rest, other_assignment ] = a; + 4 │ + + i Rest element + + 1 │ let [ ... ] = a; + > 2 │ let [ ...c = "default" ] = a; + │ ^^^^ + 3 │ let [ ...rest, other_assignment ] = a; + 4 │ + +array_binding_rest_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element must be the last element + + 1 │ let [ ... ] = a; + 2 │ let [ ...c = "default" ] = a; + > 3 │ let [ ...rest, other_assignment ] = a; + │ ^^^^^^^ + 4 │ + + i Move the rest element to the end of the pattern, right before the closing ']' + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.js b/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js.snap new file mode 100644 index 000000000000..4d3d74438479 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js.snap @@ -0,0 +1,94 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = [ + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@8..9 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: missing (required), + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_VARIABLE_STATEMENT@0..9 + 0: JS_VARIABLE_DECLARATION@0..9 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..9 + 0: JS_VARIABLE_DECLARATOR@4..9 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..9 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@8..9 + 0: L_BRACK@8..9 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@9..9 + 2: (empty) + 1: (empty) + 4: EOF@9..10 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +array_expr_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `]` but instead the file ends + + 1 │ let a = [ + > 2 │ + │ + + i the file ends here + + 1 │ let a = [ + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.js b/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.js rename to crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js.snap new file mode 100644 index 000000000000..5d783ff75d4c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js.snap @@ -0,0 +1,83 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +\u0061sync () => {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + ERROR_TOKEN@0..11 "\\u0061sync" [] [Whitespace(" ")], + JsParameters { + l_paren_token: L_PAREN@11..12 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@12..14 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@14..17 "=>" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..19 + 0: JS_EXPRESSION_STATEMENT@0..19 + 0: JS_BOGUS_EXPRESSION@0..19 + 0: ERROR_TOKEN@0..11 "\\u0061sync" [] [Whitespace(" ")] + 1: JS_PARAMETERS@11..14 + 0: L_PAREN@11..12 "(" [] [] + 1: JS_PARAMETER_LIST@12..12 + 2: R_PAREN@12..14 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..18 + 3: R_CURLY@18..19 "}" [] [] + 1: (empty) + 4: EOF@19..20 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +arrow_escaped_async.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'async' keyword cannot contain escape character. + + > 1 │ \u0061sync () => {} + │ ^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap new file mode 100644 index 000000000000..c2a82af861c6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap @@ -0,0 +1,145 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ((...a = "b" in {}) => {};;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@5..6 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + DOT3@6..9 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@9..11 "a" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@11..13 "=" [] [Whitespace(" ")], + expression: JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@13..17 "\"b\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@17..20 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@20..21 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@27..28 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + first_semi_token: SEMICOLON@29..30 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@30..31 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@33..34 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_FOR_STATEMENT@0..35 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_ARROW_FUNCTION_EXPRESSION@5..29 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@5..24 + 0: L_PAREN@5..6 "(" [] [] + 1: JS_PARAMETER_LIST@6..22 + 0: JS_BOGUS_PARAMETER@6..22 + 0: JS_DECORATOR_LIST@6..6 + 1: DOT3@6..9 "..." [] [] + 2: JS_IDENTIFIER_BINDING@9..11 + 0: IDENT@9..11 "a" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@11..22 + 0: EQ@11..13 "=" [] [Whitespace(" ")] + 1: JS_IN_EXPRESSION@13..22 + 0: JS_STRING_LITERAL_EXPRESSION@13..17 + 0: JS_STRING_LITERAL@13..17 "\"b\"" [] [Whitespace(" ")] + 1: IN_KW@17..20 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@20..22 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@21..21 + 2: R_CURLY@21..22 "}" [] [] + 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@27..29 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..28 + 3: R_CURLY@28..29 "}" [] [] + 3: SEMICOLON@29..30 ";" [] [] + 4: (empty) + 5: SEMICOLON@30..31 ";" [] [] + 6: (empty) + 7: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@33..35 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_STATEMENT_LIST@34..34 + 2: R_CURLY@34..35 "}" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +arrow_rest_in_expr_in_initializer.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest elements may not have default initializers + + > 1 │ for ((...a = "b" in {}) => {};;) {} + │ ^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.js b/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.js rename to crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js.snap new file mode 100644 index 000000000000..9e868929b002 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js.snap @@ -0,0 +1,361 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +eval = 0 +eval ??= 2 +eval *= 4 +arguments = "foo" +arguments ||= "baz" +({ eval } = o) +({ foo: { eval }}) = o + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@0..5 "eval" [] [Whitespace(" ")], + ], + }, + operator_token: EQ@5..7 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@7..8 "0" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@8..14 "eval" [Newline("\n")] [Whitespace(" ")], + ], + }, + operator_token: QUESTION2EQ@14..18 "??=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@18..19 "2" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@19..25 "eval" [Newline("\n")] [Whitespace(" ")], + ], + }, + operator_token: STAREQ@25..28 "*=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@28..29 "4" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@29..40 "arguments" [Newline("\n")] [Whitespace(" ")], + ], + }, + operator_token: EQ@40..42 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@42..47 "\"foo\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@47..58 "arguments" [Newline("\n")] [Whitespace(" ")], + ], + }, + operator_token: PIPE2EQ@58..62 "||=" [] [Whitespace(" ")], + right: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + JsCallExpression { + callee: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@62..67 "\"baz\"" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@67..69 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsBogusExpression { + items: [ + JsBogus { + items: [ + L_CURLY@69..71 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogusAssignment { + items: [ + IDENT@71..76 "eval" [] [Whitespace(" ")], + ], + }, + ], + }, + ], + }, + R_CURLY@76..78 "}" [] [Whitespace(" ")], + ], + }, + EQ@78..80 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@80..81 "o" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@81..82 ")" [] [], + }, + }, + JsCallArguments { + l_paren_token: L_PAREN@82..84 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsObjectExpression { + l_curly_token: L_CURLY@84..86 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@86..89 "foo" [] [], + }, + colon_token: COLON@89..91 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@91..93 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@93..98 "eval" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@98..99 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@99..100 "}" [] [], + }, + ], + r_paren_token: R_PAREN@100..102 ")" [] [Whitespace(" ")], + }, + ], + }, + operator_token: EQ@102..104 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@104..105 "o" [] [], + }, + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@105..106 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..106 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..105 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_ASSIGNMENT_EXPRESSION@0..8 + 0: JS_BOGUS_ASSIGNMENT@0..5 + 0: IDENT@0..5 "eval" [] [Whitespace(" ")] + 1: EQ@5..7 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@7..8 + 0: JS_NUMBER_LITERAL@7..8 "0" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@8..19 + 0: JS_ASSIGNMENT_EXPRESSION@8..19 + 0: JS_BOGUS_ASSIGNMENT@8..14 + 0: IDENT@8..14 "eval" [Newline("\n")] [Whitespace(" ")] + 1: QUESTION2EQ@14..18 "??=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@18..19 + 0: JS_NUMBER_LITERAL@18..19 "2" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@19..29 + 0: JS_ASSIGNMENT_EXPRESSION@19..29 + 0: JS_BOGUS_ASSIGNMENT@19..25 + 0: IDENT@19..25 "eval" [Newline("\n")] [Whitespace(" ")] + 1: STAREQ@25..28 "*=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@28..29 + 0: JS_NUMBER_LITERAL@28..29 "4" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@29..47 + 0: JS_ASSIGNMENT_EXPRESSION@29..47 + 0: JS_BOGUS_ASSIGNMENT@29..40 + 0: IDENT@29..40 "arguments" [Newline("\n")] [Whitespace(" ")] + 1: EQ@40..42 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@42..47 + 0: JS_STRING_LITERAL@42..47 "\"foo\"" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@47..105 + 0: JS_ASSIGNMENT_EXPRESSION@47..105 + 0: JS_BOGUS_ASSIGNMENT@47..58 + 0: IDENT@47..58 "arguments" [Newline("\n")] [Whitespace(" ")] + 1: PIPE2EQ@58..62 "||=" [] [Whitespace(" ")] + 2: JS_ASSIGNMENT_EXPRESSION@62..105 + 0: JS_BOGUS_ASSIGNMENT@62..102 + 0: JS_CALL_EXPRESSION@62..82 + 0: JS_STRING_LITERAL_EXPRESSION@62..67 + 0: JS_STRING_LITERAL@62..67 "\"baz\"" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@67..82 + 0: L_PAREN@67..69 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@69..81 + 0: JS_BOGUS_EXPRESSION@69..81 + 0: JS_BOGUS@69..78 + 0: L_CURLY@69..71 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@71..76 + 0: JS_BOGUS@71..76 + 0: JS_BOGUS_ASSIGNMENT@71..76 + 0: IDENT@71..76 "eval" [] [Whitespace(" ")] + 2: R_CURLY@76..78 "}" [] [Whitespace(" ")] + 1: EQ@78..80 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@80..81 + 0: JS_REFERENCE_IDENTIFIER@80..81 + 0: IDENT@80..81 "o" [] [] + 2: R_PAREN@81..82 ")" [] [] + 1: JS_CALL_ARGUMENTS@82..102 + 0: L_PAREN@82..84 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@84..100 + 0: JS_OBJECT_EXPRESSION@84..100 + 0: L_CURLY@84..86 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@86..99 + 0: JS_PROPERTY_OBJECT_MEMBER@86..99 + 0: JS_LITERAL_MEMBER_NAME@86..89 + 0: IDENT@86..89 "foo" [] [] + 1: COLON@89..91 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@91..99 + 0: L_CURLY@91..93 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@93..98 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@93..98 + 0: JS_REFERENCE_IDENTIFIER@93..98 + 0: IDENT@93..98 "eval" [] [Whitespace(" ")] + 2: R_CURLY@98..99 "}" [] [] + 2: R_CURLY@99..100 "}" [] [] + 2: R_PAREN@100..102 ")" [] [Whitespace(" ")] + 1: EQ@102..104 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@104..105 + 0: JS_REFERENCE_IDENTIFIER@104..105 + 0: IDENT@104..105 "o" [] [] + 1: (empty) + 4: EOF@105..106 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +assign_eval_or_arguments.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + > 1 │ eval = 0 + │ ^^^^ + 2 │ eval ??= 2 + 3 │ eval *= 4 + +assign_eval_or_arguments.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + 1 │ eval = 0 + > 2 │ eval ??= 2 + │ ^^^^ + 3 │ eval *= 4 + 4 │ arguments = "foo" + +assign_eval_or_arguments.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + 1 │ eval = 0 + 2 │ eval ??= 2 + > 3 │ eval *= 4 + │ ^^^^ + 4 │ arguments = "foo" + 5 │ arguments ||= "baz" + +assign_eval_or_arguments.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `arguments` as an identifier in strict mode + + 2 │ eval ??= 2 + 3 │ eval *= 4 + > 4 │ arguments = "foo" + │ ^^^^^^^^^ + 5 │ arguments ||= "baz" + 6 │ ({ eval } = o) + +assign_eval_or_arguments.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `arguments` as an identifier in strict mode + + 3 │ eval *= 4 + 4 │ arguments = "foo" + > 5 │ arguments ||= "baz" + │ ^^^^^^^^^ + 6 │ ({ eval } = o) + 7 │ ({ foo: { eval }}) = o + +assign_eval_or_arguments.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + 4 │ arguments = "foo" + 5 │ arguments ||= "baz" + > 6 │ ({ eval } = o) + │ ^^^^ + 7 │ ({ foo: { eval }}) = o + 8 │ + +assign_eval_or_arguments.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `"baz" + ({ eval } = o) + ({ foo: { eval }})` + + 3 │ eval *= 4 + 4 │ arguments = "foo" + > 5 │ arguments ||= "baz" + │ ^^^^^ + > 6 │ ({ eval } = o) + > 7 │ ({ foo: { eval }}) = o + │ ^^^^^^^^^^^^^^^^^^ + 8 │ + + i This expression cannot be assigned to + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_left.js b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/assign_expr_left.js rename to crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js.snap new file mode 100644 index 000000000000..3c26c5345da2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +( = foo); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@0..2 "(" [] [Whitespace(" ")], + assignment: missing (required), + r_paren_token: missing (required), + }, + operator_token: EQ@2..4 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..7 "foo" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_PAREN@7..8 ")" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_EXPRESSION_STATEMENT@0..7 + 0: JS_ASSIGNMENT_EXPRESSION@0..7 + 0: JS_PARENTHESIZED_ASSIGNMENT@0..2 + 0: L_PAREN@0..2 "(" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 1: EQ@2..4 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@4..7 + 0: JS_REFERENCE_IDENTIFIER@4..7 + 0: IDENT@4..7 "foo" [] [] + 1: (empty) + 1: JS_BOGUS_STATEMENT@7..8 + 0: R_PAREN@7..8 ")" [] [] + 2: JS_EMPTY_STATEMENT@8..9 + 0: SEMICOLON@8..9 ";" [] [] + 4: EOF@9..10 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +assign_expr_left.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `=` + + > 1 │ ( = foo); + │ ^ + 2 │ + + i Remove = + +assign_expr_left.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ ( = foo); + │ ^ + 2 │ + + i An explicit or implicit semicolon is expected here... + + > 1 │ ( = foo); + │ ^ + 2 │ + + i ...Which is required to end this statement + + > 1 │ ( = foo); + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_right.js b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/assign_expr_right.js rename to crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js.snap new file mode 100644 index 000000000000..6f76f0bc2b0a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js.snap @@ -0,0 +1,79 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(foo = ); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@1..5 "foo" [] [Whitespace(" ")], + }, + operator_token: EQ@5..7 "=" [] [Whitespace(" ")], + right: missing (required), + }, + r_paren_token: R_PAREN@7..8 ")" [] [], + }, + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_EXPRESSION_STATEMENT@0..9 + 0: JS_PARENTHESIZED_EXPRESSION@0..8 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..7 + 0: JS_IDENTIFIER_ASSIGNMENT@1..5 + 0: IDENT@1..5 "foo" [] [Whitespace(" ")] + 1: EQ@5..7 "=" [] [Whitespace(" ")] + 2: (empty) + 2: R_PAREN@7..8 ")" [] [] + 1: SEMICOLON@8..9 ";" [] [] + 4: EOF@9..10 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +assign_expr_right.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ')'. + + > 1 │ (foo = ); + │ ^ + 2 │ + + i Expected an expression, or an assignment here. + + > 1 │ (foo = ); + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.js b/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.js rename to crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap new file mode 100644 index 000000000000..a8b68953859c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap @@ -0,0 +1,341 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async await => {} +async() => { (a = await) => {} }; +async() => { (a = await 10) => {} }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@8..14 "async" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsBogusBinding { + items: [ + IDENT@14..20 "await" [] [Whitespace(" ")], + ], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@20..23 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@25..31 "async" [Newline("\n")] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@34..37 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@37..39 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@39..40 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@40..42 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@44..49 "await" [] [], + ], + }, + ], + }, + }, + }, + ], + r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@54..55 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@55..57 "}" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@59..65 "async" [Newline("\n")] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@65..66 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@68..71 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@73..74 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@74..76 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + AWAIT_KW@78..84 "await" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@84..86 "10" [] [], + }, + ], + }, + }, + }, + ], + r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@88..91 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@91..92 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@92..94 "}" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@94..95 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@95..96 ";" [] [], + }, + ], + eof_token: EOF@96..97 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..97 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..96 + 0: JS_VARIABLE_STATEMENT@0..25 + 0: JS_VARIABLE_DECLARATION@0..25 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..25 + 0: JS_VARIABLE_DECLARATOR@4..25 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..25 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@8..25 + 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BOGUS_BINDING@14..20 + 0: IDENT@14..20 "await" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@20..23 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@23..25 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..24 + 3: R_CURLY@24..25 "}" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@25..59 + 0: JS_ARROW_FUNCTION_EXPRESSION@25..58 + 0: ASYNC_KW@25..31 "async" [Newline("\n")] [] + 1: (empty) + 2: JS_PARAMETERS@31..34 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_PARAMETER_LIST@32..32 + 2: R_PAREN@32..34 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@34..37 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@37..58 + 0: L_CURLY@37..39 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@39..39 + 2: JS_STATEMENT_LIST@39..57 + 0: JS_EXPRESSION_STATEMENT@39..57 + 0: JS_ARROW_FUNCTION_EXPRESSION@39..57 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@39..51 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_PARAMETER_LIST@40..49 + 0: JS_FORMAL_PARAMETER@40..49 + 0: JS_DECORATOR_LIST@40..40 + 1: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@42..49 + 0: EQ@42..44 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@44..49 + 0: JS_BOGUS@44..49 + 0: IDENT@44..49 "await" [] [] + 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@54..57 + 0: L_CURLY@54..55 "{" [] [] + 1: JS_DIRECTIVE_LIST@55..55 + 2: JS_STATEMENT_LIST@55..55 + 3: R_CURLY@55..57 "}" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@57..58 "}" [] [] + 1: SEMICOLON@58..59 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@59..96 + 0: JS_ARROW_FUNCTION_EXPRESSION@59..95 + 0: ASYNC_KW@59..65 "async" [Newline("\n")] [] + 1: (empty) + 2: JS_PARAMETERS@65..68 + 0: L_PAREN@65..66 "(" [] [] + 1: JS_PARAMETER_LIST@66..66 + 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@68..71 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@71..95 + 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@73..73 + 2: JS_STATEMENT_LIST@73..94 + 0: JS_EXPRESSION_STATEMENT@73..94 + 0: JS_ARROW_FUNCTION_EXPRESSION@73..94 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@73..88 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_PARAMETER_LIST@74..86 + 0: JS_FORMAL_PARAMETER@74..86 + 0: JS_DECORATOR_LIST@74..74 + 1: JS_IDENTIFIER_BINDING@74..76 + 0: IDENT@74..76 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@76..86 + 0: EQ@76..78 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@78..86 + 0: AWAIT_KW@78..84 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@84..86 + 0: JS_NUMBER_LITERAL@84..86 "10" [] [] + 2: R_PAREN@86..88 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@88..91 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@91..94 + 0: L_CURLY@91..92 "{" [] [] + 1: JS_DIRECTIVE_LIST@92..92 + 2: JS_STATEMENT_LIST@92..92 + 3: R_CURLY@92..94 "}" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@94..95 "}" [] [] + 1: SEMICOLON@95..96 ";" [] [] + 4: EOF@96..97 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +async_arrow_expr_await_parameter.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + > 1 │ let a = async await => {} + │ ^^^^^ + 2 │ async() => { (a = await) => {} }; + 3 │ async() => { (a = await 10) => {} }; + +async_arrow_expr_await_parameter.js:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 1 │ let a = async await => {} + > 2 │ async() => { (a = await) => {} }; + │ ^^^^^ + 3 │ async() => { (a = await 10) => {} }; + 4 │ + +async_arrow_expr_await_parameter.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + 1 │ let a = async await => {} + 2 │ async() => { (a = await) => {} }; + > 3 │ async() => { (a = await 10) => {} }; + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap new file mode 100644 index 000000000000..b771047a62fb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap @@ -0,0 +1,160 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) async function t() {} +if (true) function* t() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsBogusStatement { + items: [ + ASYNC_KW@10..16 "async" [] [Whitespace(" ")], + FUNCTION_KW@16..25 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@25..26 "t" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@26..27 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@29..30 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + ], + }, + else_clause: missing (optional), + }, + JsIfStatement { + if_token: IF_KW@31..35 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@35..36 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@36..40 "true" [] [], + }, + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + consequent: JsBogusStatement { + items: [ + FUNCTION_KW@42..50 "function" [] [], + STAR@50..52 "*" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@52..53 "t" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@53..54 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@56..57 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + ], + }, + else_clause: missing (optional), + }, + ], + eof_token: EOF@58..59 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..59 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..58 + 0: JS_IF_STATEMENT@0..31 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@10..31 + 0: ASYNC_KW@10..16 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "t" [] [] + 3: JS_PARAMETERS@26..29 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_PARAMETER_LIST@27..27 + 2: R_PAREN@27..29 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@29..31 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_DIRECTIVE_LIST@30..30 + 2: JS_STATEMENT_LIST@30..30 + 3: R_CURLY@30..31 "}" [] [] + 5: (empty) + 1: JS_IF_STATEMENT@31..58 + 0: IF_KW@31..35 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@35..36 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@36..40 + 0: TRUE_KW@36..40 "true" [] [] + 3: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@42..58 + 0: FUNCTION_KW@42..50 "function" [] [] + 1: STAR@50..52 "*" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@52..53 + 0: IDENT@52..53 "t" [] [] + 3: JS_PARAMETERS@53..56 + 0: L_PAREN@53..54 "(" [] [] + 1: JS_PARAMETER_LIST@54..54 + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@56..58 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..57 + 3: R_CURLY@57..58 "}" [] [] + 5: (empty) + 4: EOF@58..59 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +async_or_generator_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `async` and generator functions can only be declared at top level or inside a block + + > 1 │ if (true) async function t() {} + │ ^^^^^^^^^^^^^^^^^^^^^ + 2 │ if (true) function* t() {} + 3 │ + +async_or_generator_in_single_statement_context.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `async` and generator functions can only be declared at top level or inside a block + + 1 │ if (true) async function t() {} + > 2 │ if (true) function* t() {} + │ ^^^^^^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_module.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_module.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js.snap new file mode 100644 index 000000000000..dc065b9c1bae --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js.snap @@ -0,0 +1,151 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let await = 10; +console.log(await); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@4..10 "await" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@10..12 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@12..14 "10" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..23 "console" [Newline("\n")] [], + }, + }, + operator_token: DOT@23..24 "." [] [], + member: JsName { + value_token: IDENT@24..27 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@27..28 "(" [] [], + args: JsCallArgumentList [ + JsAwaitExpression { + await_token: AWAIT_KW@28..33 "await" [] [], + argument: missing (required), + }, + ], + r_paren_token: R_PAREN@33..34 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_VARIABLE_STATEMENT@0..15 + 0: JS_VARIABLE_DECLARATION@0..14 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..14 + 0: JS_VARIABLE_DECLARATOR@4..14 + 0: JS_BOGUS_BINDING@4..10 + 0: IDENT@4..10 "await" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@10..14 + 0: EQ@10..12 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@12..14 + 0: JS_NUMBER_LITERAL@12..14 "10" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@15..35 + 0: JS_CALL_EXPRESSION@15..34 + 0: JS_STATIC_MEMBER_EXPRESSION@15..27 + 0: JS_IDENTIFIER_EXPRESSION@15..23 + 0: JS_REFERENCE_IDENTIFIER@15..23 + 0: IDENT@15..23 "console" [Newline("\n")] [] + 1: DOT@23..24 "." [] [] + 2: JS_NAME@24..27 + 0: IDENT@24..27 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@27..34 + 0: L_PAREN@27..28 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@28..33 + 0: JS_AWAIT_EXPRESSION@28..33 + 0: AWAIT_KW@28..33 "await" [] [] + 1: (empty) + 2: R_PAREN@33..34 ")" [] [] + 1: SEMICOLON@34..35 ";" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_in_module.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + > 1 │ let await = 10; + │ ^^^^^ + 2 │ console.log(await); + 3 │ + +await_in_module.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an unary expression but instead found ')'. + + 1 │ let await = 10; + > 2 │ console.log(await); + │ ^ + 3 │ + + i Expected an unary expression here. + + 1 │ let await = 10; + > 2 │ console.log(await); + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js.snap new file mode 100644 index 000000000000..cf20525a1acf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js.snap @@ -0,0 +1,105 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function test() { await 10; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..13 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + AWAIT_KW@18..24 "await" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@24..26 "10" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_FUNCTION_DECLARATION@0..29 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..13 + 0: IDENT@9..13 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@13..16 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..14 + 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@16..29 + 0: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..28 + 0: JS_EXPRESSION_STATEMENT@18..28 + 0: JS_BOGUS_EXPRESSION@18..26 + 0: AWAIT_KW@18..24 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@24..26 + 0: JS_NUMBER_LITERAL@24..26 "10" [] [] + 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] + 3: R_CURLY@28..29 "}" [] [] + 4: EOF@29..30 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_in_non_async_function.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + > 1 │ function test() { await 10; } + │ ^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js.snap new file mode 100644 index 000000000000..92c174c5facc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js.snap @@ -0,0 +1,238 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async function test(a = await b()) {} +function test2(a = await b()) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@15..19 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@19..20 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@20..22 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + AWAIT_KW@24..30 "await" [] [Whitespace(" ")], + JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..31 "b" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@31..32 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@32..33 ")" [] [], + }, + }, + ], + }, + }, + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@35..36 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@37..47 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@47..52 "test2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@53..55 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@55..57 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + AWAIT_KW@57..63 "await" [] [Whitespace(" ")], + JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@63..64 "b" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@64..65 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@65..66 ")" [] [], + }, + }, + ], + }, + }, + }, + ], + r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@68..69 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@69..70 "}" [] [], + }, + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..70 + 0: JS_FUNCTION_DECLARATION@0..37 + 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@15..19 + 0: IDENT@15..19 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@19..35 + 0: L_PAREN@19..20 "(" [] [] + 1: JS_PARAMETER_LIST@20..33 + 0: JS_FORMAL_PARAMETER@20..33 + 0: JS_DECORATOR_LIST@20..20 + 1: JS_IDENTIFIER_BINDING@20..22 + 0: IDENT@20..22 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@22..33 + 0: EQ@22..24 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@24..33 + 0: AWAIT_KW@24..30 "await" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@30..33 + 0: JS_IDENTIFIER_EXPRESSION@30..31 + 0: JS_REFERENCE_IDENTIFIER@30..31 + 0: IDENT@30..31 "b" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@31..33 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@32..32 + 2: R_PAREN@32..33 ")" [] [] + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@35..37 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_DIRECTIVE_LIST@36..36 + 2: JS_STATEMENT_LIST@36..36 + 3: R_CURLY@36..37 "}" [] [] + 1: JS_FUNCTION_DECLARATION@37..70 + 0: (empty) + 1: FUNCTION_KW@37..47 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@47..52 + 0: IDENT@47..52 "test2" [] [] + 4: (empty) + 5: JS_PARAMETERS@52..68 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..66 + 0: JS_FORMAL_PARAMETER@53..66 + 0: JS_DECORATOR_LIST@53..53 + 1: JS_IDENTIFIER_BINDING@53..55 + 0: IDENT@53..55 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@55..66 + 0: EQ@55..57 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@57..66 + 0: AWAIT_KW@57..63 "await" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@63..66 + 0: JS_IDENTIFIER_EXPRESSION@63..64 + 0: JS_REFERENCE_IDENTIFIER@63..64 + 0: IDENT@63..64 "b" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@64..66 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@65..65 + 2: R_PAREN@65..66 ")" [] [] + 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@68..70 + 0: L_CURLY@68..69 "{" [] [] + 1: JS_DIRECTIVE_LIST@69..69 + 2: JS_STATEMENT_LIST@69..69 + 3: R_CURLY@69..70 "}" [] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_in_parameter_initializer.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + > 1 │ async function test(a = await b()) {} + │ ^^^^^ + 2 │ function test2(a = await b()) {} + 3 │ + +await_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + 1 │ async function test(a = await b()) {} + > 2 │ function test2(a = await b()) {} + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap new file mode 100644 index 000000000000..ed52e738c20b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap @@ -0,0 +1,175 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +class A { static { await; } } +class B { static { await 10; } } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@20..27 "static" [] [Whitespace(" ")], + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@29..34 "await" [] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@34..36 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@46..48 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@50..57 "static" [] [Whitespace(" ")], + l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + AWAIT_KW@59..65 "await" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@65..67 "10" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@67..69 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@69..71 "}" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@71..72 "}" [] [], + }, + ], + eof_token: EOF@72..73 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..73 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..72 + 0: JS_CLASS_DECLARATION@0..39 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..38 + 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@20..38 + 0: STATIC_KW@20..27 "static" [] [Whitespace(" ")] + 1: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@29..36 + 0: JS_EXPRESSION_STATEMENT@29..36 + 0: JS_BOGUS_EXPRESSION@29..34 + 0: JS_BOGUS@29..34 + 0: IDENT@29..34 "await" [] [] + 1: SEMICOLON@34..36 ";" [] [Whitespace(" ")] + 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] + 9: R_CURLY@38..39 "}" [] [] + 1: JS_CLASS_DECLARATION@39..72 + 0: JS_DECORATOR_LIST@39..39 + 1: (empty) + 2: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@48..50 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@50..71 + 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@50..71 + 0: STATIC_KW@50..57 "static" [] [Whitespace(" ")] + 1: L_CURLY@57..59 "{" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@59..69 + 0: JS_EXPRESSION_STATEMENT@59..69 + 0: JS_BOGUS_EXPRESSION@59..67 + 0: AWAIT_KW@59..65 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@65..67 + 0: JS_NUMBER_LITERAL@65..67 "10" [] [] + 1: SEMICOLON@67..69 ";" [] [Whitespace(" ")] + 3: R_CURLY@69..71 "}" [] [Whitespace(" ")] + 9: R_CURLY@71..72 "}" [] [] + 4: EOF@72..73 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_in_static_initialization_block_member.cjs:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 1 │ // SCRIPT + > 2 │ class A { static { await; } } + │ ^^^^^ + 3 │ class B { static { await 10; } } + 4 │ + +await_in_static_initialization_block_member.cjs:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + 1 │ // SCRIPT + 2 │ class A { static { await; } } + > 3 │ class B { static { await 10; } } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap new file mode 100644 index 000000000000..0c2dff862294 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap @@ -0,0 +1,175 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +class A { static { await; } } +class B { static { await 10; } } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@20..27 "static" [] [Whitespace(" ")], + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@29..34 "await" [] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@34..36 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@46..48 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@50..57 "static" [] [Whitespace(" ")], + l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + AWAIT_KW@59..65 "await" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@65..67 "10" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@67..69 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@69..71 "}" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@71..72 "}" [] [], + }, + ], + eof_token: EOF@72..73 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..73 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..72 + 0: JS_CLASS_DECLARATION@0..39 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..38 + 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@20..38 + 0: STATIC_KW@20..27 "static" [] [Whitespace(" ")] + 1: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@29..36 + 0: JS_EXPRESSION_STATEMENT@29..36 + 0: JS_BOGUS_EXPRESSION@29..34 + 0: JS_BOGUS@29..34 + 0: IDENT@29..34 "await" [] [] + 1: SEMICOLON@34..36 ";" [] [Whitespace(" ")] + 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] + 9: R_CURLY@38..39 "}" [] [] + 1: JS_CLASS_DECLARATION@39..72 + 0: JS_DECORATOR_LIST@39..39 + 1: (empty) + 2: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@48..50 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@50..71 + 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@50..71 + 0: STATIC_KW@50..57 "static" [] [Whitespace(" ")] + 1: L_CURLY@57..59 "{" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@59..69 + 0: JS_EXPRESSION_STATEMENT@59..69 + 0: JS_BOGUS_EXPRESSION@59..67 + 0: AWAIT_KW@59..65 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@65..67 + 0: JS_NUMBER_LITERAL@65..67 "10" [] [] + 1: SEMICOLON@67..69 ";" [] [Whitespace(" ")] + 3: R_CURLY@69..71 "}" [] [Whitespace(" ")] + 9: R_CURLY@71..72 "}" [] [] + 4: EOF@72..73 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_in_static_initialization_block_member.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 1 │ // SCRIPT + > 2 │ class A { static { await; } } + │ ^^^^^ + 3 │ class B { static { await 10; } } + 4 │ + +await_in_static_initialization_block_member.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + 1 │ // SCRIPT + 2 │ class A { static { await; } } + > 3 │ class B { static { await 10; } } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js b/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap new file mode 100644 index 000000000000..1275f8ea23bf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap @@ -0,0 +1,334 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { await using x = y }; +foo = function() { await using x = y }; +foo = () => { await using x = y }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: AWAIT_KW@17..23 "await" [] [Whitespace(" ")], + kind: USING_KW@23..29 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@29..31 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@31..33 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..35 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@35..36 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@37..42 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@42..44 "=" [] [Whitespace(" ")], + right: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@44..52 "function" [] [], + star_token: missing (optional), + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: AWAIT_KW@57..63 "await" [] [Whitespace(" ")], + kind: USING_KW@63..69 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@69..71 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@71..73 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@73..75 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@75..76 "}" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@76..77 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@77..82 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@82..84 "=" [] [Whitespace(" ")], + right: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@84..85 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@85..87 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@87..90 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@90..92 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: AWAIT_KW@92..98 "await" [] [Whitespace(" ")], + kind: USING_KW@98..104 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@104..106 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@106..108 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@108..110 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + ], + eof_token: EOF@112..113 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..113 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..112 + 0: JS_FUNCTION_DECLARATION@0..36 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..36 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..35 + 0: JS_BOGUS_STATEMENT@17..35 + 0: JS_VARIABLE_DECLARATION@17..35 + 0: AWAIT_KW@17..23 "await" [] [Whitespace(" ")] + 1: USING_KW@23..29 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..35 + 0: JS_VARIABLE_DECLARATOR@29..35 + 0: JS_IDENTIFIER_BINDING@29..31 + 0: IDENT@29..31 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@31..35 + 0: EQ@31..33 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@33..35 + 0: JS_REFERENCE_IDENTIFIER@33..35 + 0: IDENT@33..35 "y" [] [Whitespace(" ")] + 3: R_CURLY@35..36 "}" [] [] + 1: JS_EMPTY_STATEMENT@36..37 + 0: SEMICOLON@36..37 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@37..77 + 0: JS_ASSIGNMENT_EXPRESSION@37..76 + 0: JS_IDENTIFIER_ASSIGNMENT@37..42 + 0: IDENT@37..42 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@42..44 "=" [] [Whitespace(" ")] + 2: JS_FUNCTION_EXPRESSION@44..76 + 0: (empty) + 1: FUNCTION_KW@44..52 "function" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@55..76 + 0: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..75 + 0: JS_BOGUS_STATEMENT@57..75 + 0: JS_VARIABLE_DECLARATION@57..75 + 0: AWAIT_KW@57..63 "await" [] [Whitespace(" ")] + 1: USING_KW@63..69 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@69..75 + 0: JS_VARIABLE_DECLARATOR@69..75 + 0: JS_IDENTIFIER_BINDING@69..71 + 0: IDENT@69..71 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@71..75 + 0: EQ@71..73 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@73..75 + 0: JS_REFERENCE_IDENTIFIER@73..75 + 0: IDENT@73..75 "y" [] [Whitespace(" ")] + 3: R_CURLY@75..76 "}" [] [] + 1: SEMICOLON@76..77 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@77..112 + 0: JS_ASSIGNMENT_EXPRESSION@77..111 + 0: JS_IDENTIFIER_ASSIGNMENT@77..82 + 0: IDENT@77..82 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@82..84 "=" [] [Whitespace(" ")] + 2: JS_ARROW_FUNCTION_EXPRESSION@84..111 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@84..87 + 0: L_PAREN@84..85 "(" [] [] + 1: JS_PARAMETER_LIST@85..85 + 2: R_PAREN@85..87 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@87..90 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@90..111 + 0: L_CURLY@90..92 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@92..92 + 2: JS_STATEMENT_LIST@92..110 + 0: JS_BOGUS_STATEMENT@92..110 + 0: JS_VARIABLE_DECLARATION@92..110 + 0: AWAIT_KW@92..98 "await" [] [Whitespace(" ")] + 1: USING_KW@98..104 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@104..110 + 0: JS_VARIABLE_DECLARATOR@104..110 + 0: JS_IDENTIFIER_BINDING@104..106 + 0: IDENT@104..106 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@106..110 + 0: EQ@106..108 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@108..110 + 0: JS_REFERENCE_IDENTIFIER@108..110 + 0: IDENT@108..110 "y" [] [Whitespace(" ")] + 3: R_CURLY@110..111 "}" [] [] + 1: SEMICOLON@111..112 ";" [] [] + 4: EOF@112..113 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_using_declaration_only_allowed_inside_an_async_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await using` declarations are only allowed at top-level or inside an async function + + > 1 │ function foo() { await using x = y }; + │ ^^^^^^^^^^^^^^^^^ + 2 │ foo = function() { await using x = y }; + 3 │ foo = () => { await using x = y }; + + i Wrap this declaration in an async function + +await_using_declaration_only_allowed_inside_an_async_function.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await using` declarations are only allowed at top-level or inside an async function + + 1 │ function foo() { await using x = y }; + > 2 │ foo = function() { await using x = y }; + │ ^^^^^^^^^^^^^^^^^ + 3 │ foo = () => { await using x = y }; + 4 │ + + i Wrap this declaration in an async function + +await_using_declaration_only_allowed_inside_an_async_function.js:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await using` declarations are only allowed at top-level or inside an async function + + 1 │ function foo() { await using x = y }; + 2 │ foo = function() { await using x = y }; + > 3 │ foo = () => { await using x = y }; + │ ^^^^^^^^^^^^^^^^^ + 4 │ + + i Wrap this declaration in an async function + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.js b/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/binary_expressions_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js.snap new file mode 100644 index 000000000000..5901c245a3f4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js.snap @@ -0,0 +1,177 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo(foo +); +foo + * 2; +!foo * bar; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@3..4 "(" [] [], + args: JsCallArgumentList [ + JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..8 "foo" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@8..9 "+" [] [], + right: missing (required), + }, + ], + r_paren_token: R_PAREN@9..10 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..16 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: PLUS@16..18 "+" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: missing (required), + operator_token: STAR@18..20 "*" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..21 "2" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsUnaryExpression { + operator_token: BANG@22..24 "!" [Newline("\n")] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..28 "foo" [] [Whitespace(" ")], + }, + }, + }, + operator_token: STAR@28..30 "*" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..33 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_EXPRESSION_STATEMENT@0..11 + 0: JS_CALL_EXPRESSION@0..10 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@3..10 + 0: L_PAREN@3..4 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@4..9 + 0: JS_BINARY_EXPRESSION@4..9 + 0: JS_IDENTIFIER_EXPRESSION@4..8 + 0: JS_REFERENCE_IDENTIFIER@4..8 + 0: IDENT@4..8 "foo" [] [Whitespace(" ")] + 1: PLUS@8..9 "+" [] [] + 2: (empty) + 2: R_PAREN@9..10 ")" [] [] + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@11..22 + 0: JS_BINARY_EXPRESSION@11..21 + 0: JS_IDENTIFIER_EXPRESSION@11..16 + 0: JS_REFERENCE_IDENTIFIER@11..16 + 0: IDENT@11..16 "foo" [Newline("\n")] [Whitespace(" ")] + 1: PLUS@16..18 "+" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@18..21 + 0: (empty) + 1: STAR@18..20 "*" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@20..21 + 0: JS_NUMBER_LITERAL@20..21 "2" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@22..34 + 0: JS_BINARY_EXPRESSION@22..33 + 0: JS_UNARY_EXPRESSION@22..28 + 0: BANG@22..24 "!" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@24..28 + 0: JS_REFERENCE_IDENTIFIER@24..28 + 0: IDENT@24..28 "foo" [] [Whitespace(" ")] + 1: STAR@28..30 "*" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@30..33 + 0: JS_REFERENCE_IDENTIFIER@30..33 + 0: IDENT@30..33 "bar" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +binary_expressions_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ')'. + + > 1 │ foo(foo +); + │ ^ + 2 │ foo + * 2; + 3 │ !foo * bar; + + i Expected an expression here. + + > 1 │ foo(foo +); + │ ^ + 2 │ foo + * 2; + 3 │ !foo * bar; + +binary_expressions_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression for the left hand side of the `*` operator. + + 1 │ foo(foo +); + > 2 │ foo + * 2; + │ ^ + 3 │ !foo * bar; + 4 │ + + i This operator requires a left hand side value + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.js b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.js rename to crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js.snap new file mode 100644 index 000000000000..3e82aa0c49ce --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js.snap @@ -0,0 +1,431 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async () => { let await = 5; } +function *foo() { + let yield = 5; +} +let eval = 5; +let let = 5; +const let = 5; +let a, a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@6..7 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@7..9 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@9..12 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@12..14 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@14..18 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@18..24 "await" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@26..27 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@27..29 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@30..40 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@40..41 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@41..44 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@47..48 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@48..56 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@56..62 "yield" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@62..64 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@64..65 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..66 ";" [] [], + }, + ], + r_curly_token: R_CURLY@66..68 "}" [Newline("\n")] [], + }, + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@68..73 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@73..78 "eval" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@78..80 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@80..81 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@81..82 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@82..87 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@87..91 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@91..93 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@93..94 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@94..95 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@95..102 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@102..106 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@106..108 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@108..109 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@109..110 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@110..115 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@115..116 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@116..118 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@118..119 "a" [] [], + ], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@119..120 ";" [] [], + }, + ], + eof_token: EOF@120..121 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..121 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..120 + 0: JS_EXPRESSION_STATEMENT@0..30 + 0: JS_ARROW_FUNCTION_EXPRESSION@0..30 + 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@6..9 + 0: L_PAREN@6..7 "(" [] [] + 1: JS_PARAMETER_LIST@7..7 + 2: R_PAREN@7..9 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@9..12 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@12..30 + 0: L_CURLY@12..14 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..29 + 0: JS_VARIABLE_STATEMENT@14..29 + 0: JS_VARIABLE_DECLARATION@14..27 + 0: (empty) + 1: LET_KW@14..18 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@18..27 + 0: JS_VARIABLE_DECLARATOR@18..27 + 0: JS_BOGUS_BINDING@18..24 + 0: IDENT@18..24 "await" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@24..27 + 0: EQ@24..26 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@26..27 + 0: JS_NUMBER_LITERAL@26..27 "5" [] [] + 1: SEMICOLON@27..29 ";" [] [Whitespace(" ")] + 3: R_CURLY@29..30 "}" [] [] + 1: (empty) + 1: JS_FUNCTION_DECLARATION@30..68 + 0: (empty) + 1: FUNCTION_KW@30..40 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@40..41 "*" [] [] + 3: JS_IDENTIFIER_BINDING@41..44 + 0: IDENT@41..44 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..45 + 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@47..68 + 0: L_CURLY@47..48 "{" [] [] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..66 + 0: JS_VARIABLE_STATEMENT@48..66 + 0: JS_VARIABLE_DECLARATION@48..65 + 0: (empty) + 1: LET_KW@48..56 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@56..65 + 0: JS_VARIABLE_DECLARATOR@56..65 + 0: JS_BOGUS_BINDING@56..62 + 0: IDENT@56..62 "yield" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@62..65 + 0: EQ@62..64 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@64..65 + 0: JS_NUMBER_LITERAL@64..65 "5" [] [] + 1: SEMICOLON@65..66 ";" [] [] + 3: R_CURLY@66..68 "}" [Newline("\n")] [] + 2: JS_VARIABLE_STATEMENT@68..82 + 0: JS_VARIABLE_DECLARATION@68..81 + 0: (empty) + 1: LET_KW@68..73 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@73..81 + 0: JS_VARIABLE_DECLARATOR@73..81 + 0: JS_BOGUS_BINDING@73..78 + 0: IDENT@73..78 "eval" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@78..81 + 0: EQ@78..80 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@80..81 + 0: JS_NUMBER_LITERAL@80..81 "5" [] [] + 1: SEMICOLON@81..82 ";" [] [] + 3: JS_VARIABLE_STATEMENT@82..95 + 0: JS_VARIABLE_DECLARATION@82..94 + 0: (empty) + 1: LET_KW@82..87 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@87..94 + 0: JS_VARIABLE_DECLARATOR@87..94 + 0: JS_BOGUS_BINDING@87..91 + 0: IDENT@87..91 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@91..94 + 0: EQ@91..93 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@93..94 + 0: JS_NUMBER_LITERAL@93..94 "5" [] [] + 1: SEMICOLON@94..95 ";" [] [] + 4: JS_VARIABLE_STATEMENT@95..110 + 0: JS_VARIABLE_DECLARATION@95..109 + 0: (empty) + 1: CONST_KW@95..102 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@102..109 + 0: JS_VARIABLE_DECLARATOR@102..109 + 0: JS_BOGUS_BINDING@102..106 + 0: IDENT@102..106 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@106..109 + 0: EQ@106..108 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@108..109 + 0: JS_NUMBER_LITERAL@108..109 "5" [] [] + 1: SEMICOLON@109..110 ";" [] [] + 5: JS_VARIABLE_STATEMENT@110..120 + 0: JS_VARIABLE_DECLARATION@110..119 + 0: (empty) + 1: LET_KW@110..115 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@115..119 + 0: JS_VARIABLE_DECLARATOR@115..116 + 0: JS_IDENTIFIER_BINDING@115..116 + 0: IDENT@115..116 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@116..118 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@118..119 + 0: JS_BOGUS_BINDING@118..119 + 0: IDENT@118..119 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@119..120 ";" [] [] + 4: EOF@120..121 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +binding_identifier_invalid.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + > 1 │ async () => { let await = 5; } + │ ^^^^^ + 2 │ function *foo() { + 3 │ let yield = 5; + +binding_identifier_invalid.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `yield` as an identifier in generator function + + 1 │ async () => { let await = 5; } + 2 │ function *foo() { + > 3 │ let yield = 5; + │ ^^^^^ + 4 │ } + 5 │ let eval = 5; + +binding_identifier_invalid.js:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + 3 │ let yield = 5; + 4 │ } + > 5 │ let eval = 5; + │ ^^^^ + 6 │ let let = 5; + 7 │ const let = 5; + +binding_identifier_invalid.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 4 │ } + 5 │ let eval = 5; + > 6 │ let let = 5; + │ ^^^ + 7 │ const let = 5; + 8 │ let a, a; + +binding_identifier_invalid.js:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 5 │ let eval = 5; + 6 │ let let = 5; + > 7 │ const let = 5; + │ ^^^ + 8 │ let a, a; + 9 │ + +binding_identifier_invalid.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Declarations inside of a `let` declaration may not have duplicates + + 6 │ let let = 5; + 7 │ const let = 5; + > 8 │ let a, a; + │ ^ + 9 │ + + i a second declaration of `a` is not allowed + + 6 │ let let = 5; + 7 │ const let = 5; + > 8 │ let a, a; + │ ^ + 9 │ + + i `a` is first declared here + + 6 │ let let = 5; + 7 │ const let = 5; + > 8 │ let a, a; + │ ^ + 9 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.js b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap new file mode 100644 index 000000000000..3a5dbd7e798d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap @@ -0,0 +1,141 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +let let = 5; +const let = 5; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@14..18 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..21 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@29..33 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + ], + eof_token: EOF@37..38 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..38 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..37 + 0: JS_VARIABLE_STATEMENT@0..22 + 0: JS_VARIABLE_DECLARATION@0..21 + 0: (empty) + 1: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..21 + 0: JS_VARIABLE_DECLARATOR@14..21 + 0: JS_BOGUS_BINDING@14..18 + 0: IDENT@14..18 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@18..21 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@20..21 + 0: JS_NUMBER_LITERAL@20..21 "5" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 1: JS_VARIABLE_STATEMENT@22..37 + 0: JS_VARIABLE_DECLARATION@22..36 + 0: (empty) + 1: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..36 + 0: JS_VARIABLE_DECLARATOR@29..36 + 0: JS_BOGUS_BINDING@29..33 + 0: IDENT@29..33 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@33..36 + 0: EQ@33..35 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "5" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 4: EOF@37..38 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +binding_identifier_invalid_script.cjs:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `let` cannot be declared as a variable name inside of a `let` declaration + + 1 │ // SCRIPT + > 2 │ let let = 5; + │ ^^^ + 3 │ const let = 5; + 4 │ + + i Rename the let identifier here + +binding_identifier_invalid_script.cjs:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `let` cannot be declared as a variable name inside of a `const` declaration + + 1 │ // SCRIPT + 2 │ let let = 5; + > 3 │ const let = 5; + │ ^^^ + 4 │ + + i Rename the let identifier here + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.js.snap new file mode 100644 index 000000000000..1f068c847c8c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.js.snap @@ -0,0 +1,137 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +let let = 5; +const let = 5; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@14..18 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..21 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@29..33 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + ], + eof_token: EOF@37..38 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..38 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..37 + 0: JS_VARIABLE_STATEMENT@0..22 + 0: JS_VARIABLE_DECLARATION@0..21 + 0: (empty) + 1: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..21 + 0: JS_VARIABLE_DECLARATOR@14..21 + 0: JS_BOGUS_BINDING@14..18 + 0: IDENT@14..18 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@18..21 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@20..21 + 0: JS_NUMBER_LITERAL@20..21 "5" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 1: JS_VARIABLE_STATEMENT@22..37 + 0: JS_VARIABLE_DECLARATION@22..36 + 0: (empty) + 1: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..36 + 0: JS_VARIABLE_DECLARATOR@29..36 + 0: JS_BOGUS_BINDING@29..33 + 0: IDENT@29..33 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@33..36 + 0: EQ@33..35 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "5" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 4: EOF@37..38 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +binding_identifier_invalid_script.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ let let = 5; + │ ^^^ + 3 │ const let = 5; + 4 │ + +binding_identifier_invalid_script.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 1 │ // SCRIPT + 2 │ let let = 5; + > 3 │ const let = 5; + │ ^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.js b/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.js rename to crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js.snap new file mode 100644 index 000000000000..50e7f3def405 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class S{{}} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..7 "S" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@7..8 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + L_CURLY@8..9 "{" [] [], + ], + }, + ], + r_curly_token: R_CURLY@9..10 "}" [] [], + }, + JsBogusStatement { + items: [ + R_CURLY@10..11 "}" [] [], + ], + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_CLASS_DECLARATION@0..10 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..7 + 0: IDENT@6..7 "S" [] [] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@7..8 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@8..9 + 0: JS_BOGUS_MEMBER@8..9 + 0: L_CURLY@8..9 "{" [] [] + 9: R_CURLY@9..10 "}" [] [] + 1: JS_BOGUS_STATEMENT@10..11 + 0: R_CURLY@10..11 "}" [] [] + 4: EOF@11..12 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +block_stmt_in_class.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. + + > 1 │ class S{{}} + │ ^ + 2 │ + + i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. + + > 1 │ class S{{}} + │ ^ + 2 │ + +block_stmt_in_class.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + > 1 │ class S{{}} + │ ^ + 2 │ + + i Expected a statement here. + + > 1 │ class S{{}} + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.js b/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/bracket_expr_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js.snap new file mode 100644 index 000000000000..5e5a32ac614a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js.snap @@ -0,0 +1,165 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo[] +foo?.[] +foo[ + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@3..4 "[" [] [], + member: missing (required), + r_brack_token: R_BRACK@4..5 "]" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@5..9 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: QUESTIONDOT@9..11 "?." [] [], + l_brack_token: L_BRACK@11..12 "[" [] [], + member: missing (required), + r_brack_token: R_BRACK@12..13 "]" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..17 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@17..18 "[" [] [], + member: missing (required), + r_brack_token: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@18..19 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..19 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..18 + 0: JS_EXPRESSION_STATEMENT@0..5 + 0: JS_COMPUTED_MEMBER_EXPRESSION@0..5 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: (empty) + 2: L_BRACK@3..4 "[" [] [] + 3: (empty) + 4: R_BRACK@4..5 "]" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@5..13 + 0: JS_COMPUTED_MEMBER_EXPRESSION@5..13 + 0: JS_IDENTIFIER_EXPRESSION@5..9 + 0: JS_REFERENCE_IDENTIFIER@5..9 + 0: IDENT@5..9 "foo" [Newline("\n")] [] + 1: QUESTIONDOT@9..11 "?." [] [] + 2: L_BRACK@11..12 "[" [] [] + 3: (empty) + 4: R_BRACK@12..13 "]" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@13..18 + 0: JS_COMPUTED_MEMBER_EXPRESSION@13..18 + 0: JS_IDENTIFIER_EXPRESSION@13..17 + 0: JS_REFERENCE_IDENTIFIER@13..17 + 0: IDENT@13..17 "foo" [Newline("\n")] [] + 1: (empty) + 2: L_BRACK@17..18 "[" [] [] + 3: (empty) + 4: (empty) + 1: (empty) + 4: EOF@18..19 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +bracket_expr_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ']'. + + > 1 │ foo[] + │ ^ + 2 │ foo?.[] + 3 │ foo[ + + i Expected an expression here. + + > 1 │ foo[] + │ ^ + 2 │ foo?.[] + 3 │ foo[ + +bracket_expr_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ']'. + + 1 │ foo[] + > 2 │ foo?.[] + │ ^ + 3 │ foo[ + 4 │ + + i Expected an expression here. + + 1 │ foo[] + > 2 │ foo?.[] + │ ^ + 3 │ foo[ + 4 │ + +bracket_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found the end of the file. + + 2 │ foo?.[] + 3 │ foo[ + > 4 │ + │ + + i Expected an expression here. + + 2 │ foo?.[] + 3 │ foo[ + > 4 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.js b/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/break_in_nested_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js.snap new file mode 100644 index 000000000000..1fad5a672066 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js.snap @@ -0,0 +1,128 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while (true) { + function helper() { + break; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsWhileStatement { + while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@6..7 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@7..11 "true" [] [], + }, + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@13..14 "{" [] [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@14..26 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@26..32 "helper" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@32..33 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@35..36 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + BREAK_KW@36..46 "break" [Newline("\n"), Whitespace(" ")] [], + SEMICOLON@46..47 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@47..51 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@53..54 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..54 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..53 + 0: JS_WHILE_STATEMENT@0..53 + 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] + 1: L_PAREN@6..7 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11 + 0: TRUE_KW@7..11 "true" [] [] + 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@13..53 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_STATEMENT_LIST@14..51 + 0: JS_FUNCTION_DECLARATION@14..51 + 0: (empty) + 1: FUNCTION_KW@14..26 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@26..32 + 0: IDENT@26..32 "helper" [] [] + 4: (empty) + 5: JS_PARAMETERS@32..35 + 0: L_PAREN@32..33 "(" [] [] + 1: JS_PARAMETER_LIST@33..33 + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@35..51 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_DIRECTIVE_LIST@36..36 + 2: JS_STATEMENT_LIST@36..47 + 0: JS_BOGUS_STATEMENT@36..47 + 0: BREAK_KW@36..46 "break" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@46..47 ";" [] [] + 3: R_CURLY@47..51 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@51..53 "}" [Newline("\n")] [] + 4: EOF@53..54 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +break_in_nested_function.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `break` statement can only be used within an enclosing iteration or switch statement. + + 1 │ while (true) { + 2 │ function helper() { + > 3 │ break; + │ ^^^^^ + 4 │ } + 5 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/break_stmt.js b/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/break_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js.snap new file mode 100644 index 000000000000..5872ded08c83 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js.snap @@ -0,0 +1,152 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { break; } +while (true) { + break foo; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + BREAK_KW@17..22 "break" [] [], + SEMICOLON@22..24 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@25..32 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@32..33 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@33..37 "true" [] [], + }, + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@39..40 "{" [] [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + BREAK_KW@40..49 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLabel { + value_token: IDENT@49..52 "foo" [] [], + }, + SEMICOLON@52..53 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@55..56 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..56 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..55 + 0: JS_FUNCTION_DECLARATION@0..25 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..25 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..24 + 0: JS_BOGUS_STATEMENT@17..24 + 0: BREAK_KW@17..22 "break" [] [] + 1: SEMICOLON@22..24 ";" [] [Whitespace(" ")] + 3: R_CURLY@24..25 "}" [] [] + 1: JS_WHILE_STATEMENT@25..55 + 0: WHILE_KW@25..32 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@32..33 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@33..37 + 0: TRUE_KW@33..37 "true" [] [] + 3: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@39..55 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_STATEMENT_LIST@40..53 + 0: JS_BOGUS_STATEMENT@40..53 + 0: BREAK_KW@40..49 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LABEL@49..52 + 0: IDENT@49..52 "foo" [] [] + 2: SEMICOLON@52..53 ";" [] [] + 2: R_CURLY@53..55 "}" [Newline("\n")] [] + 4: EOF@55..56 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +break_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `break` statement can only be used within an enclosing iteration or switch statement. + + > 1 │ function foo() { break; } + │ ^^^^^ + 2 │ while (true) { + 3 │ break foo; + +break_stmt.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Use of undefined statement label `foo` + + 1 │ function foo() { break; } + 2 │ while (true) { + > 3 │ break foo; + │ ^^^ + 4 │ } + 5 │ + + i This label is used, but it is never defined + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.js b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js.snap new file mode 100644 index 000000000000..04ce89d1e56d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js.snap @@ -0,0 +1,138 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { constructor(protected b) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..21 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + parameters: JsConstructorParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@22..32 "protected" [] [Whitespace(" ")], + }, + ], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..33 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@35..36 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_CLASS_DECLARATION@0..39 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..38 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..38 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..21 + 0: IDENT@10..21 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@21..35 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..33 + 0: JS_BOGUS_PARAMETER@22..33 + 0: JS_DECORATOR_LIST@22..22 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..32 + 0: TS_ACCESSIBILITY_MODIFIER@22..32 + 0: PROTECTED_KW@22..32 "protected" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@32..33 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@35..38 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_DIRECTIVE_LIST@36..36 + 2: JS_STATEMENT_LIST@36..36 + 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] + 9: R_CURLY@38..39 "}" [] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_constructor_parameter.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'protected' modifier can only be used in TypeScript files + + > 1 │ class B { constructor(protected b) {} } + │ ^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.js b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap new file mode 100644 index 000000000000..e4369a0de631 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap @@ -0,0 +1,138 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { constructor(readonly b) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..21 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + parameters: JsConstructorParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@22..31 "readonly" [] [Whitespace(" ")], + }, + ], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@31..32 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@34..35 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@35..37 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + ], + eof_token: EOF@38..39 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..39 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..38 + 0: JS_CLASS_DECLARATION@0..38 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..37 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..37 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..21 + 0: IDENT@10..21 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@21..34 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..32 + 0: JS_BOGUS_PARAMETER@22..32 + 0: JS_DECORATOR_LIST@22..22 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..31 + 0: TS_READONLY_MODIFIER@22..31 + 0: READONLY_KW@22..31 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@31..32 + 0: JS_DECORATOR_LIST@31..31 + 1: JS_IDENTIFIER_BINDING@31..32 + 0: IDENT@31..32 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@32..34 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@34..37 + 0: L_CURLY@34..35 "{" [] [] + 1: JS_DIRECTIVE_LIST@35..35 + 2: JS_STATEMENT_LIST@35..35 + 3: R_CURLY@35..37 "}" [] [Whitespace(" ")] + 9: R_CURLY@37..38 "}" [] [] + 4: EOF@38..39 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_constructor_parameter_readonly.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'readonly' modifier can only be used in TypeScript files + + > 1 │ class B { constructor(readonly b) {} } + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_err.js b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_decl_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js.snap new file mode 100644 index 000000000000..b068ab647aa0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js.snap @@ -0,0 +1,280 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class {} +class extends bar {} +class foo { set {} } +class extends {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@6..7 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@7..8 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@15..23 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..27 "bar" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@27..28 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@29..36 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@36..40 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@40..42 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@42..46 "set" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsBogusMember { + items: [ + L_CURLY@46..47 "{" [] [], + ], + }, + ], + r_curly_token: R_CURLY@47..49 "}" [] [Whitespace(" ")], + }, + JsBogusStatement { + items: [ + R_CURLY@49..50 "}" [] [], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@50..57 "class" [Newline("\n")] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@57..65 "extends" [] [Whitespace(" ")], + super_class: missing (required), + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@65..66 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@66..67 "}" [] [], + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: JS_CLASS_DECLARATION@0..8 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@6..7 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@7..7 + 9: R_CURLY@7..8 "}" [] [] + 1: JS_CLASS_DECLARATION@8..29 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: JS_EXTENDS_CLAUSE@15..27 + 0: EXTENDS_KW@15..23 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@23..27 + 0: JS_REFERENCE_IDENTIFIER@23..27 + 0: IDENT@23..27 "bar" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@27..28 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@28..28 + 9: R_CURLY@28..29 "}" [] [] + 2: JS_CLASS_DECLARATION@29..49 + 0: JS_DECORATOR_LIST@29..29 + 1: (empty) + 2: CLASS_KW@29..36 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@36..40 + 0: IDENT@36..40 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@40..42 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@42..47 + 0: JS_PROPERTY_CLASS_MEMBER@42..46 + 0: JS_PROPERTY_MODIFIER_LIST@42..42 + 1: JS_LITERAL_MEMBER_NAME@42..46 + 0: IDENT@42..46 "set" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 1: JS_BOGUS_MEMBER@46..47 + 0: L_CURLY@46..47 "{" [] [] + 9: R_CURLY@47..49 "}" [] [Whitespace(" ")] + 3: JS_BOGUS_STATEMENT@49..50 + 0: R_CURLY@49..50 "}" [] [] + 4: JS_CLASS_DECLARATION@50..67 + 0: JS_DECORATOR_LIST@50..50 + 1: (empty) + 2: CLASS_KW@50..57 "class" [Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: JS_EXTENDS_CLAUSE@57..65 + 0: EXTENDS_KW@57..65 "extends" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 6: (empty) + 7: L_CURLY@65..66 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@66..66 + 9: R_CURLY@66..67 "}" [] [] + 4: EOF@67..68 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_decl_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + > 1 │ class {} + │ ^^^^^^ + 2 │ class extends bar {} + 3 │ class foo { set {} } + +class_decl_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + 1 │ class {} + > 2 │ class extends bar {} + │ ^^^^^^ + 3 │ class foo { set {} } + 4 │ class extends {} + +class_decl_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the class property, but found none + + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^^^ + 4 │ class extends {} + 5 │ + +class_decl_err.js:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. + + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^ + 4 │ class extends {} + 5 │ + + i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. + + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^ + 4 │ class extends {} + 5 │ + +class_decl_err.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^ + 4 │ class extends {} + 5 │ + + i Expected a statement here. + + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^ + 4 │ class extends {} + 5 │ + +class_decl_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + 2 │ class extends bar {} + 3 │ class foo { set {} } + > 4 │ class extends {} + │ ^^^^^^ + 5 │ + +class_decl_err.js:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'extends' list cannot be empty. + + 2 │ class extends bar {} + 3 │ class foo { set {} } + > 4 │ class extends {} + │ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.ts b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_decl_no_id.ts rename to crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts.snap new file mode 100644 index 000000000000..461180bd526d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts.snap @@ -0,0 +1,122 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class {} +class implements B {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@6..7 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@7..8 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: TsImplementsClause { + implements_token: IMPLEMENTS_KW@15..26 "implements" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@26..28 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + l_curly_token: L_CURLY@28..29 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_CLASS_DECLARATION@0..8 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@6..7 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@7..7 + 9: R_CURLY@7..8 "}" [] [] + 1: JS_CLASS_DECLARATION@8..30 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..15 "class" [Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: TS_IMPLEMENTS_CLAUSE@15..28 + 0: IMPLEMENTS_KW@15..26 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@26..28 + 0: TS_REFERENCE_TYPE@26..28 + 0: JS_REFERENCE_IDENTIFIER@26..28 + 0: IDENT@26..28 "B" [] [Whitespace(" ")] + 1: (empty) + 7: L_CURLY@28..29 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@29..29 + 9: R_CURLY@29..30 "}" [] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + > 1 │ class {} + │ ^^^^^^ + 2 │ class implements B {} + 3 │ + +class_decl_no_id.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + 1 │ class {} + > 2 │ class implements B {} + │ ^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_member.js b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_declare_member.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js.snap new file mode 100644 index 000000000000..2a5d60e57e64 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js.snap @@ -0,0 +1,94 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { declare foo } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@18..22 "foo" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_CLASS_DECLARATION@0..23 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..22 + 0: JS_BOGUS_MEMBER@10..22 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@10..18 + 0: TS_DECLARE_MODIFIER@10..18 + 0: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@18..22 + 0: IDENT@18..22 "foo" [] [Whitespace(" ")] + 9: R_CURLY@22..23 "}" [] [] + 4: EOF@23..24 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_declare_member.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier can only be used in TypeScript files + + > 1 │ class B { declare foo } + │ ^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_method.js b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_declare_method.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js.snap new file mode 100644 index 000000000000..f4c20b0f99d1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js.snap @@ -0,0 +1,116 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { declare fn() {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@18..20 "fn" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: JS_CLASS_DECLARATION@0..27 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..26 + 0: JS_BOGUS_MEMBER@10..26 + 0: JS_BOGUS@10..18 + 0: TS_DECLARE_MODIFIER@10..18 + 0: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@18..20 + 0: IDENT@18..20 "fn" [] [] + 2: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@23..26 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..24 + 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] + 9: R_CURLY@26..27 "}" [] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_declare_method.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier can only be used in TypeScript files + + > 1 │ class B { declare fn() {} } + │ ^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_extends_err.js b/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_extends_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js.snap new file mode 100644 index 000000000000..a5a58ab15815 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js.snap @@ -0,0 +1,219 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A extends bar extends foo {} +class B extends bar, foo {} +class C implements B {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@0..6 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + JsExtendsClause { + extends_token: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..20 "bar" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + JsExtendsClause { + extends_token: EXTENDS_KW@20..28 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..32 "foo" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + L_CURLY@32..33 "{" [] [], + JsClassMemberList [], + R_CURLY@33..34 "}" [] [], + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@41..43 "B" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + EXTENDS_KW@43..51 "extends" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@51..54 "bar" [] [], + }, + }, + COMMA@54..56 "," [] [Whitespace(" ")], + JsBogus { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@56..60 "foo" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + }, + L_CURLY@60..61 "{" [] [], + JsClassMemberList [], + R_CURLY@61..62 "}" [] [], + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@69..71 "C" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + IMPLEMENTS_KW@71..82 "implements" [] [Whitespace(" ")], + TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@82..84 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + ], + }, + L_CURLY@84..85 "{" [] [], + JsClassMemberList [], + R_CURLY@85..86 "}" [] [], + ], + }, + ], + eof_token: EOF@86..87 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..87 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..86 + 0: JS_BOGUS_STATEMENT@0..34 + 0: JS_DECORATOR_LIST@0..0 + 1: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 3: JS_EXTENDS_CLAUSE@8..20 + 0: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@16..20 + 0: JS_REFERENCE_IDENTIFIER@16..20 + 0: IDENT@16..20 "bar" [] [Whitespace(" ")] + 2: (empty) + 4: JS_EXTENDS_CLAUSE@20..32 + 0: EXTENDS_KW@20..28 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@28..32 + 0: JS_REFERENCE_IDENTIFIER@28..32 + 0: IDENT@28..32 "foo" [] [Whitespace(" ")] + 2: (empty) + 5: L_CURLY@32..33 "{" [] [] + 6: JS_CLASS_MEMBER_LIST@33..33 + 7: R_CURLY@33..34 "}" [] [] + 1: JS_BOGUS_STATEMENT@34..62 + 0: JS_DECORATOR_LIST@34..34 + 1: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@41..43 + 0: IDENT@41..43 "B" [] [Whitespace(" ")] + 3: JS_BOGUS@43..60 + 0: EXTENDS_KW@43..51 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@51..54 + 0: JS_REFERENCE_IDENTIFIER@51..54 + 0: IDENT@51..54 "bar" [] [] + 2: COMMA@54..56 "," [] [Whitespace(" ")] + 3: JS_BOGUS@56..60 + 0: JS_IDENTIFIER_EXPRESSION@56..60 + 0: JS_REFERENCE_IDENTIFIER@56..60 + 0: IDENT@56..60 "foo" [] [Whitespace(" ")] + 4: L_CURLY@60..61 "{" [] [] + 5: JS_CLASS_MEMBER_LIST@61..61 + 6: R_CURLY@61..62 "}" [] [] + 2: JS_BOGUS_STATEMENT@62..86 + 0: JS_DECORATOR_LIST@62..62 + 1: CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@69..71 + 0: IDENT@69..71 "C" [] [Whitespace(" ")] + 3: JS_BOGUS@71..84 + 0: IMPLEMENTS_KW@71..82 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@82..84 + 0: TS_REFERENCE_TYPE@82..84 + 0: JS_REFERENCE_IDENTIFIER@82..84 + 0: IDENT@82..84 "B" [] [Whitespace(" ")] + 1: (empty) + 4: L_CURLY@84..85 "{" [] [] + 5: JS_CLASS_MEMBER_LIST@85..85 + 6: R_CURLY@85..86 "}" [] [] + 4: EOF@86..87 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_extends_err.js:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'extends' clause already seen. + + > 1 │ class A extends bar extends foo {} + │ ^^^^^^^^^^^ + 2 │ class B extends bar, foo {} + 3 │ class C implements B {} + + i first 'extends' clause + + > 1 │ class A extends bar extends foo {} + │ ^^^^^^^^^^^ + 2 │ class B extends bar, foo {} + 3 │ class C implements B {} + +class_extends_err.js:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Classes can only extend a single class. + + 1 │ class A extends bar extends foo {} + > 2 │ class B extends bar, foo {} + │ ^^^ + 3 │ class C implements B {} + 4 │ + +class_extends_err.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × classes can only implement interfaces in TypeScript files + + 1 │ class A extends bar extends foo {} + 2 │ class B extends bar, foo {} + > 3 │ class C implements B {} + │ ^^^^^^^^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_implements.js b/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_implements.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_implements.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js.snap new file mode 100644 index 000000000000..2dc85e86ae3f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B implements C {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@0..6 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + IMPLEMENTS_KW@8..19 "implements" [] [Whitespace(" ")], + TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@19..21 "C" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + ], + }, + L_CURLY@21..22 "{" [] [], + JsClassMemberList [], + R_CURLY@22..23 "}" [] [], + ], + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_BOGUS_STATEMENT@0..23 + 0: JS_DECORATOR_LIST@0..0 + 1: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 3: JS_BOGUS@8..21 + 0: IMPLEMENTS_KW@8..19 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@19..21 + 0: TS_REFERENCE_TYPE@19..21 + 0: JS_REFERENCE_IDENTIFIER@19..21 + 0: IDENT@19..21 "C" [] [Whitespace(" ")] + 1: (empty) + 4: L_CURLY@21..22 "{" [] [] + 5: JS_CLASS_MEMBER_LIST@22..22 + 6: R_CURLY@22..23 "}" [] [] + 4: EOF@23..24 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_implements.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × classes can only implement interfaces in TypeScript files + + > 1 │ class B implements C {} + │ ^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js.snap new file mode 100644 index 000000000000..72c9de34feb4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js.snap @@ -0,0 +1,87 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) class A {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@10..16 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + L_CURLY@18..19 "{" [] [], + JsClassMemberList [], + R_CURLY@19..20 "}" [] [], + ], + }, + else_clause: missing (optional), + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_IF_STATEMENT@0..20 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@10..20 + 0: JS_DECORATOR_LIST@10..10 + 1: CLASS_KW@10..16 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 3: L_CURLY@18..19 "{" [] [] + 4: JS_CLASS_MEMBER_LIST@19..19 + 5: R_CURLY@19..20 "}" [] [] + 5: (empty) + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Classes can only be declared at top level or inside a block + + > 1 │ if (true) class A {} + │ ^^^^^^^^^^ + 2 │ + + i wrap the class in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.js b/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js.snap new file mode 100644 index 000000000000..cb1f2f96e08c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js.snap @@ -0,0 +1,290 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { public foo() {} } +class B { static static foo() {} } +class C { accessor foo() {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@10..17 "public" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@17..20 "foo" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@34..36 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@36..38 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@38..45 "static" [] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@45..52 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@52..55 "foo" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@55..56 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@61..62 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@69..71 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@73..82 "accessor" [] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@82..85 "foo" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@85..86 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@88..89 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@89..91 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@91..92 "}" [] [], + }, + ], + eof_token: EOF@92..93 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..93 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..92 + 0: JS_CLASS_DECLARATION@0..27 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..26 + 0: JS_BOGUS_MEMBER@10..26 + 0: JS_METHOD_MODIFIER_LIST@10..17 + 0: TS_ACCESSIBILITY_MODIFIER@10..17 + 0: PUBLIC_KW@10..17 "public" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@17..20 + 0: IDENT@17..20 "foo" [] [] + 2: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@23..26 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..24 + 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] + 9: R_CURLY@26..27 "}" [] [] + 1: JS_CLASS_DECLARATION@27..62 + 0: JS_DECORATOR_LIST@27..27 + 1: (empty) + 2: CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@36..38 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@38..61 + 0: JS_BOGUS_MEMBER@38..61 + 0: JS_METHOD_MODIFIER_LIST@38..52 + 0: JS_STATIC_MODIFIER@38..45 + 0: STATIC_KW@38..45 "static" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@45..52 + 0: STATIC_KW@45..52 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@52..55 + 0: IDENT@52..55 "foo" [] [] + 2: JS_PARAMETERS@55..58 + 0: L_PAREN@55..56 "(" [] [] + 1: JS_PARAMETER_LIST@56..56 + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@58..61 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] + 9: R_CURLY@61..62 "}" [] [] + 2: JS_CLASS_DECLARATION@62..92 + 0: JS_DECORATOR_LIST@62..62 + 1: (empty) + 2: CLASS_KW@62..69 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@69..71 + 0: IDENT@69..71 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@71..73 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@73..91 + 0: JS_BOGUS_MEMBER@73..91 + 0: JS_BOGUS@73..82 + 0: JS_ACCESSOR_MODIFIER@73..82 + 0: ACCESSOR_KW@73..82 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@82..85 + 0: IDENT@82..85 "foo" [] [] + 2: JS_PARAMETERS@85..88 + 0: L_PAREN@85..86 "(" [] [] + 1: JS_PARAMETER_LIST@86..86 + 2: R_PAREN@86..88 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@88..91 + 0: L_CURLY@88..89 "{" [] [] + 1: JS_DIRECTIVE_LIST@89..89 + 2: JS_STATEMENT_LIST@89..89 + 3: R_CURLY@89..91 "}" [] [Whitespace(" ")] + 9: R_CURLY@91..92 "}" [] [] + 4: EOF@92..93 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_invalid_modifiers.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'public' modifier can only be used in TypeScript files + + > 1 │ class A { public foo() {} } + │ ^^^^^^ + 2 │ class B { static static foo() {} } + 3 │ class C { accessor foo() {} } + +class_invalid_modifiers.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' already seen + + 1 │ class A { public foo() {} } + > 2 │ class B { static static foo() {} } + │ ^^^^^^ + 3 │ class C { accessor foo() {} } + 4 │ + + i duplicate modifier + + 1 │ class A { public foo() {} } + > 2 │ class B { static static foo() {} } + │ ^^^^^^ + 3 │ class C { accessor foo() {} } + 4 │ + + i first seen here + + 1 │ class A { public foo() {} } + > 2 │ class B { static static foo() {} } + │ ^^^^^^ + 3 │ class C { accessor foo() {} } + 4 │ + +class_invalid_modifiers.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' modifier is only allowed on properties. + + 1 │ class A { public foo() {} } + 2 │ class B { static static foo() {} } + > 3 │ class C { accessor foo() {} } + │ ^^^^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.js b/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js.snap new file mode 100644 index 000000000000..f600f934f330 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js.snap @@ -0,0 +1,181 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { foo(a {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@10..13 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@14..16 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + missing separator, + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@16..17 "{" [] [], + properties: JsObjectBindingPatternPropertyList [], + r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + missing separator, + JsBogusParameter { + items: [ + R_CURLY@19..20 "}" [] [], + ], + }, + ], + r_paren_token: missing (required), + }, + return_type_annotation: missing (optional), + body: missing (required), + }, + ], + r_curly_token: missing (required), + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_CLASS_DECLARATION@0..20 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..20 + 0: JS_METHOD_CLASS_MEMBER@10..20 + 0: JS_METHOD_MODIFIER_LIST@10..10 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@10..13 + 0: IDENT@10..13 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@13..20 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..20 + 0: JS_FORMAL_PARAMETER@14..16 + 0: JS_DECORATOR_LIST@14..14 + 1: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 1: (empty) + 2: JS_FORMAL_PARAMETER@16..19 + 0: JS_DECORATOR_LIST@16..16 + 1: JS_OBJECT_BINDING_PATTERN@16..19 + 0: L_CURLY@16..17 "{" [] [] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@17..17 + 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 3: (empty) + 4: JS_BOGUS_PARAMETER@19..20 + 0: R_CURLY@19..20 "}" [] [] + 2: (empty) + 7: (empty) + 8: (empty) + 9: (empty) + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_member_method_parameters.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `{` + + > 1 │ class B { foo(a {} } + │ ^ + 2 │ + + i Remove { + +class_member_method_parameters.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `}` + + > 1 │ class B { foo(a {} } + │ ^ + 2 │ + + i Remove } + +class_member_method_parameters.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead the file ends + + 1 │ class B { foo(a {} } + > 2 │ + │ + + i the file ends here + + 1 │ class B { foo(a {} } + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_modifier.js b/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_member_modifier.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js.snap new file mode 100644 index 000000000000..f10cf2e947bd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js.snap @@ -0,0 +1,96 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { abstract foo; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@10..19 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@19..22 "foo" [] [], + }, + SEMICOLON@22..24 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..25 + 0: JS_CLASS_DECLARATION@0..25 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..24 + 0: JS_BOGUS_MEMBER@10..24 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@10..19 + 0: TS_ABSTRACT_MODIFIER@10..19 + 0: ABSTRACT_KW@10..19 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@19..22 + 0: IDENT@19..22 "foo" [] [] + 2: SEMICOLON@22..24 ";" [] [Whitespace(" ")] + 9: R_CURLY@24..25 "}" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_member_modifier.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Only abstract classes can have abstract members + + > 1 │ class A { abstract foo; } + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.js b/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap new file mode 100644 index 000000000000..5c8c98a5cb07 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap @@ -0,0 +1,131 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + accessor static foo = 1; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@9..23 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@23..30 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@30..34 "foo" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@34..36 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@36..37 "1" [] [], + }, + }, + SEMICOLON@37..38 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@38..40 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: JS_CLASS_DECLARATION@0..40 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..38 + 0: JS_BOGUS_MEMBER@9..38 + 0: JS_PROPERTY_MODIFIER_LIST@9..30 + 0: JS_ACCESSOR_MODIFIER@9..23 + 0: ACCESSOR_KW@9..23 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@23..30 + 0: STATIC_KW@23..30 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@30..34 + 0: IDENT@30..34 "foo" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@34..37 + 0: EQ@34..36 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@36..37 + 0: JS_NUMBER_LITERAL@36..37 "1" [] [] + 3: SEMICOLON@37..38 ";" [] [] + 9: R_CURLY@38..40 "}" [Newline("\n")] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_member_static_accessor_precedence.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' must precede 'accessor' + + 1 │ class A { + > 2 │ accessor static foo = 1; + │ ^^^^^^ + 3 │ } + 4 │ + + i move this modifier + + 1 │ class A { + > 2 │ accessor static foo = 1; + │ ^^^^^^ + 3 │ } + 4 │ + + i before this modifier + + 1 │ class A { + > 2 │ accessor static foo = 1; + │ ^^^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_property_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_property_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js.snap new file mode 100644 index 000000000000..c073c469ac8c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js.snap @@ -0,0 +1,103 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { lorem = ; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..16 "lorem" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@16..18 "=" [] [Whitespace(" ")], + expression: missing (required), + }, + semicolon_token: SEMICOLON@18..20 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_CLASS_DECLARATION@0..21 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..20 + 0: JS_PROPERTY_CLASS_MEMBER@10..20 + 0: JS_PROPERTY_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..16 + 0: IDENT@10..16 "lorem" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@16..18 + 0: EQ@16..18 "=" [] [Whitespace(" ")] + 1: (empty) + 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] + 9: R_CURLY@20..21 "}" [] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_property_initializer.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ';'. + + > 1 │ class B { lorem = ; } + │ ^ + 2 │ + + i Expected an expression, or an assignment here. + + > 1 │ class B { lorem = ; } + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap new file mode 100644 index 000000000000..bc2bdd0e62ce --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap @@ -0,0 +1,154 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +async function* test() { + class A { + prop = yield; + } +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@16..24 "function" [] [], + star_token: STAR@24..26 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@26..30 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@33..34 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@43..45 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..46 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@58..63 "yield" [] [], + ], + }, + ], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + ], + r_curly_token: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@68..70 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..70 + 0: JS_FUNCTION_DECLARATION@0..70 + 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@16..24 "function" [] [] + 2: STAR@24..26 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@26..30 + 0: IDENT@26..30 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@30..33 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..31 + 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@33..70 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_DIRECTIVE_LIST@34..34 + 2: JS_STATEMENT_LIST@34..68 + 0: JS_CLASS_DECLARATION@34..68 + 0: JS_DECORATOR_LIST@34..34 + 1: (empty) + 2: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..46 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@46..64 + 0: JS_PROPERTY_CLASS_MEMBER@46..64 + 0: JS_PROPERTY_MODIFIER_LIST@46..46 + 1: JS_LITERAL_MEMBER_NAME@46..56 + 0: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@56..63 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@58..63 + 0: JS_BOGUS@58..63 + 0: IDENT@58..63 "yield" [] [] + 4: SEMICOLON@63..64 ";" [] [] + 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@68..70 "}" [Newline("\n")] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_yield_property_initializer.cjs:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + 2 │ async function* test() { + 3 │ class A { + > 4 │ prop = yield; + │ ^^^^^ + 5 │ } + 6 │ } + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.js.snap new file mode 100644 index 000000000000..39a33722d1b7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.js.snap @@ -0,0 +1,154 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +async function* test() { + class A { + prop = yield; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@16..24 "function" [] [], + star_token: STAR@24..26 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@26..30 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@33..34 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@43..45 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..46 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@58..63 "yield" [] [], + ], + }, + ], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + ], + r_curly_token: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@68..70 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..70 + 0: JS_FUNCTION_DECLARATION@0..70 + 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@16..24 "function" [] [] + 2: STAR@24..26 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@26..30 + 0: IDENT@26..30 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@30..33 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..31 + 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@33..70 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_DIRECTIVE_LIST@34..34 + 2: JS_STATEMENT_LIST@34..68 + 0: JS_CLASS_DECLARATION@34..68 + 0: JS_DECORATOR_LIST@34..34 + 1: (empty) + 2: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..46 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@46..64 + 0: JS_PROPERTY_CLASS_MEMBER@46..64 + 0: JS_PROPERTY_MODIFIER_LIST@46..46 + 1: JS_LITERAL_MEMBER_NAME@46..56 + 0: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@56..63 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@58..63 + 0: JS_BOGUS@58..63 + 0: IDENT@58..63 "yield" [] [] + 4: SEMICOLON@63..64 ";" [] [] + 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@68..70 "}" [Newline("\n")] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_yield_property_initializer.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + 2 │ async function* test() { + 3 │ class A { + > 4 │ prop = yield; + │ ^^^^^ + 5 │ } + 6 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.js b/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/conditional_expr_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js.snap new file mode 100644 index 000000000000..24f9aa21f6a9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js.snap @@ -0,0 +1,207 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ? bar baz +foo ? bar baz ? foo : bar +foo ? bar : + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@4..6 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@6..10 "bar" [] [Whitespace(" ")], + }, + }, + colon_token: missing (required), + alternate: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..13 "baz" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..18 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@18..20 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..24 "bar" [] [Whitespace(" ")], + }, + }, + colon_token: missing (required), + alternate: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..28 "baz" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@28..30 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..34 "foo" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + alternate: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@36..39 "bar" [] [], + }, + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@39..44 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@44..46 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..50 "bar" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@50..51 ":" [] [], + alternate: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@51..52 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..52 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..51 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_CONDITIONAL_EXPRESSION@0..13 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "foo" [] [Whitespace(" ")] + 1: QUESTION@4..6 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@6..10 + 0: JS_REFERENCE_IDENTIFIER@6..10 + 0: IDENT@6..10 "bar" [] [Whitespace(" ")] + 3: (empty) + 4: JS_IDENTIFIER_EXPRESSION@10..13 + 0: JS_REFERENCE_IDENTIFIER@10..13 + 0: IDENT@10..13 "baz" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@13..39 + 0: JS_CONDITIONAL_EXPRESSION@13..39 + 0: JS_IDENTIFIER_EXPRESSION@13..18 + 0: JS_REFERENCE_IDENTIFIER@13..18 + 0: IDENT@13..18 "foo" [Newline("\n")] [Whitespace(" ")] + 1: QUESTION@18..20 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@20..24 + 0: JS_REFERENCE_IDENTIFIER@20..24 + 0: IDENT@20..24 "bar" [] [Whitespace(" ")] + 3: (empty) + 4: JS_CONDITIONAL_EXPRESSION@24..39 + 0: JS_IDENTIFIER_EXPRESSION@24..28 + 0: JS_REFERENCE_IDENTIFIER@24..28 + 0: IDENT@24..28 "baz" [] [Whitespace(" ")] + 1: QUESTION@28..30 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@30..34 + 0: JS_REFERENCE_IDENTIFIER@30..34 + 0: IDENT@30..34 "foo" [] [Whitespace(" ")] + 3: COLON@34..36 ":" [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@36..39 + 0: JS_REFERENCE_IDENTIFIER@36..39 + 0: IDENT@36..39 "bar" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@39..51 + 0: JS_CONDITIONAL_EXPRESSION@39..51 + 0: JS_IDENTIFIER_EXPRESSION@39..44 + 0: JS_REFERENCE_IDENTIFIER@39..44 + 0: IDENT@39..44 "foo" [Newline("\n")] [Whitespace(" ")] + 1: QUESTION@44..46 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@46..50 + 0: JS_REFERENCE_IDENTIFIER@46..50 + 0: IDENT@46..50 "bar" [] [Whitespace(" ")] + 3: COLON@50..51 ":" [] [] + 4: (empty) + 1: (empty) + 4: EOF@51..52 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +conditional_expr_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `baz` + + > 1 │ foo ? bar baz + │ ^^^ + 2 │ foo ? bar baz ? foo : bar + 3 │ foo ? bar : + + i Remove baz + +conditional_expr_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `baz` + + 1 │ foo ? bar baz + > 2 │ foo ? bar baz ? foo : bar + │ ^^^ + 3 │ foo ? bar : + 4 │ + + i Remove baz + +conditional_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found the end of the file. + + 2 │ foo ? bar baz ? foo : bar + 3 │ foo ? bar : + > 4 │ + │ + + i Expected an expression, or an assignment here. + + 2 │ foo ? bar baz ? foo : bar + 3 │ foo ? bar : + > 4 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/continue_stmt.js b/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/continue_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js.snap new file mode 100644 index 000000000000..ad4bca7c4e7f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js.snap @@ -0,0 +1,218 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { continue; } +while (true) { + continue foo; +} +foo: { + continue foo; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + CONTINUE_KW@17..25 "continue" [] [], + SEMICOLON@25..27 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@28..35 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@35..36 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@36..40 "true" [] [], + }, + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@42..43 "{" [] [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + CONTINUE_KW@43..55 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLabel { + value_token: IDENT@55..58 "foo" [] [], + }, + SEMICOLON@58..59 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@59..61 "}" [Newline("\n")] [], + }, + }, + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@61..65 "foo" [Newline("\n")] [], + }, + colon_token: COLON@65..67 ":" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@67..68 "{" [] [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + CONTINUE_KW@68..80 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLabel { + value_token: IDENT@80..83 "foo" [] [], + }, + SEMICOLON@83..84 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@84..86 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@86..87 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..87 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..86 + 0: JS_FUNCTION_DECLARATION@0..28 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..28 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..27 + 0: JS_BOGUS_STATEMENT@17..27 + 0: CONTINUE_KW@17..25 "continue" [] [] + 1: SEMICOLON@25..27 ";" [] [Whitespace(" ")] + 3: R_CURLY@27..28 "}" [] [] + 1: JS_WHILE_STATEMENT@28..61 + 0: WHILE_KW@28..35 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@35..36 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@36..40 + 0: TRUE_KW@36..40 "true" [] [] + 3: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@42..61 + 0: L_CURLY@42..43 "{" [] [] + 1: JS_STATEMENT_LIST@43..59 + 0: JS_BOGUS_STATEMENT@43..59 + 0: CONTINUE_KW@43..55 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LABEL@55..58 + 0: IDENT@55..58 "foo" [] [] + 2: SEMICOLON@58..59 ";" [] [] + 2: R_CURLY@59..61 "}" [Newline("\n")] [] + 2: JS_LABELED_STATEMENT@61..86 + 0: JS_LABEL@61..65 + 0: IDENT@61..65 "foo" [Newline("\n")] [] + 1: COLON@65..67 ":" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@67..86 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_STATEMENT_LIST@68..84 + 0: JS_BOGUS_STATEMENT@68..84 + 0: CONTINUE_KW@68..80 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LABEL@80..83 + 0: IDENT@80..83 "foo" [] [] + 2: SEMICOLON@83..84 ";" [] [] + 2: R_CURLY@84..86 "}" [Newline("\n")] [] + 4: EOF@86..87 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +continue_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. + + > 1 │ function foo() { continue; } + │ ^^^^^^^^ + 2 │ while (true) { + 3 │ continue foo; + +continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Use of undefined statement label `foo` + + 1 │ function foo() { continue; } + 2 │ while (true) { + > 3 │ continue foo; + │ ^^^ + 4 │ } + 5 │ foo: { + + i This label is used, but it is never defined + +continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `continue` statement can only jump to a label of an enclosing `for`, `while` or `do while` statement. + + 4 │ } + 5 │ foo: { + > 6 │ continue foo; + │ ^^^ + 7 │ } + 8 │ + + i This label + + 4 │ } + 5 │ foo: { + > 6 │ continue foo; + │ ^^^ + 7 │ } + 8 │ + + i points to non-iteration statement + + 3 │ continue foo; + 4 │ } + > 5 │ foo: { + │ ^^^ + 6 │ continue foo; + 7 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/debugger_stmt.js b/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/debugger_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js.snap new file mode 100644 index 000000000000..85f6fb3f5df0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js.snap @@ -0,0 +1,162 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { + debugger { + var something = "lorem"; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsDebuggerStatement { + debugger_token: DEBUGGER_KW@16..28 "debugger" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@28..29 "{" [] [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@29..38 "var" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@38..48 "something" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@48..50 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@50..57 "\"lorem\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@57..58 ";" [] [], + }, + ], + r_curly_token: R_CURLY@58..62 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@62..64 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: JS_FUNCTION_DECLARATION@0..64 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..64 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..62 + 0: JS_DEBUGGER_STATEMENT@16..28 + 0: DEBUGGER_KW@16..28 "debugger" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: JS_BLOCK_STATEMENT@28..62 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_STATEMENT_LIST@29..58 + 0: JS_VARIABLE_STATEMENT@29..58 + 0: JS_VARIABLE_DECLARATION@29..57 + 0: (empty) + 1: VAR_KW@29..38 "var" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@38..57 + 0: JS_VARIABLE_DECLARATOR@38..57 + 0: JS_IDENTIFIER_BINDING@38..48 + 0: IDENT@38..48 "something" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@48..57 + 0: EQ@48..50 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@50..57 + 0: JS_STRING_LITERAL@50..57 "\"lorem\"" [] [] + 1: SEMICOLON@57..58 ";" [] [] + 2: R_CURLY@58..62 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@62..64 "}" [Newline("\n")] [] + 4: EOF@64..65 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +debugger_stmt.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ function foo() { + > 2 │ debugger { + │ ^ + 3 │ var something = "lorem"; + 4 │ } + + i An explicit or implicit semicolon is expected here... + + 1 │ function foo() { + > 2 │ debugger { + │ ^ + 3 │ var something = "lorem"; + 4 │ } + + i ...Which is required to end this statement + + 1 │ function foo() { + > 2 │ debugger { + │ ^^^^^^^^ + 3 │ var something = "lorem"; + 4 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts.snap new file mode 100644 index 000000000000..a23af1fed64f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts.snap @@ -0,0 +1,1843 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@'dsads' class MyClass {} +@1 class MyClass {} +@++1 class MyClass {} +@[] in 1 class MyClass {} +@[] class MyClass {} +@() => {} class MyClass {} +@1 == 2 ? true : false class MyClass {} +@await fn class MyClass {} +@function(){} class MyClass {} +@obj instanceof Object class MyClass {} +@1 === 2 class MyClass {} +@new Object() class MyClass {} +@{} class MyClass {} +@a++ class MyClass {} +@a,b class MyClass {} +@`${d}foo` class MyClass {} +@obj as MyType class MyClass {} +@obj class MyClass {} +@obj satisfies MyType class MyClass {} +@obj! class MyClass {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsBogusExpression { + items: [ + JS_STRING_LITERAL@1..9 "'dsads'" [] [Whitespace(" ")], + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..23 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@23..24 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@25..27 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JS_NUMBER_LITERAL@27..29 "1" [] [Whitespace(" ")], + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@29..35 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@35..43 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@43..44 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@44..45 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@45..47 "@" [Newline("\n")] [], + expression: missing (required), + }, + ], + }, + JsExpressionStatement { + expression: JsPreUpdateExpression { + operator_token: PLUS2@47..49 "++" [] [], + operand: JsBogusAssignment { + items: [ + JS_NUMBER_LITERAL@49..51 "1" [] [Whitespace(" ")], + ], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@51..57 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@57..65 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@65..66 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@66..67 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@67..69 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + L_BRACK@69..70 "[" [] [], + JsArrayElementList [], + R_BRACK@70..72 "]" [] [Whitespace(" ")], + ], + }, + }, + ], + }, + JsBogusStatement { + items: [ + IN_KW@72..75 "in" [] [Whitespace(" ")], + JS_NUMBER_LITERAL@75..77 "1" [] [Whitespace(" ")], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@77..83 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@83..91 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@91..92 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@93..95 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + L_BRACK@95..96 "[" [] [], + JsArrayElementList [], + R_BRACK@96..98 "]" [] [Whitespace(" ")], + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@98..104 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@104..112 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@112..113 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@113..114 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@114..116 "@" [Newline("\n")] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@116..117 "(" [] [], + expression: missing (required), + r_paren_token: R_PAREN@117..119 ")" [] [Whitespace(" ")], + }, + }, + ], + }, + JsBogusStatement { + items: [ + FAT_ARROW@119..122 "=>" [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@122..123 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@123..125 "}" [] [Whitespace(" ")], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@125..131 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@131..139 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@139..140 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@140..141 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@141..143 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JS_NUMBER_LITERAL@143..145 "1" [] [Whitespace(" ")], + ], + }, + }, + ], + }, + JsBogusStatement { + items: [ + EQ2@145..148 "==" [] [Whitespace(" ")], + JS_NUMBER_LITERAL@148..150 "2" [] [Whitespace(" ")], + QUESTION@150..152 "?" [] [Whitespace(" ")], + TRUE_KW@152..157 "true" [] [Whitespace(" ")], + COLON@157..159 ":" [] [Whitespace(" ")], + FALSE_KW@159..165 "false" [] [Whitespace(" ")], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@165..171 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@171..179 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@179..180 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@180..181 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@181..183 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@183..189 "await" [] [Whitespace(" ")], + ], + }, + ], + }, + }, + ], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@189..192 "fn" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@192..198 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@198..206 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@206..207 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@207..208 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@208..210 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + FUNCTION_KW@210..218 "function" [] [], + JsParameters { + l_paren_token: L_PAREN@218..219 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@219..220 ")" [] [], + }, + JsFunctionBody { + l_curly_token: L_CURLY@220..221 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@221..223 "}" [] [Whitespace(" ")], + }, + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@223..229 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@229..237 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@237..238 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@238..239 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@239..241 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@241..245 "obj" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsBogusStatement { + items: [ + INSTANCEOF_KW@245..256 "instanceof" [] [Whitespace(" ")], + IDENT@256..263 "Object" [] [Whitespace(" ")], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@263..269 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@269..277 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@277..278 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@278..279 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@279..281 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JS_NUMBER_LITERAL@281..283 "1" [] [Whitespace(" ")], + ], + }, + }, + ], + }, + JsBogusStatement { + items: [ + EQ3@283..287 "===" [] [Whitespace(" ")], + JS_NUMBER_LITERAL@287..289 "2" [] [Whitespace(" ")], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@289..295 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@295..303 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@303..304 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@304..305 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@305..307 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + NEW_KW@307..311 "new" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@311..317 "Object" [] [], + }, + }, + JsCallArguments { + l_paren_token: L_PAREN@317..318 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@318..320 ")" [] [Whitespace(" ")], + }, + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@320..326 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@326..334 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@334..335 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@335..336 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@336..338 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + L_CURLY@338..339 "{" [] [], + JsObjectMemberList [], + R_CURLY@339..341 "}" [] [Whitespace(" ")], + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@341..347 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@347..355 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@355..356 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@356..357 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@357..359 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@359..360 "a" [] [], + }, + }, + }, + ], + }, + JsExpressionStatement { + expression: JsPreUpdateExpression { + operator_token: PLUS2@360..363 "++" [] [Whitespace(" ")], + operand: JsBogusAssignment { + items: [ + JsDecoratorList [], + CLASS_KW@363..369 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@369..377 "MyClass" [] [Whitespace(" ")], + }, + L_CURLY@377..378 "{" [] [], + JsClassMemberList [], + R_CURLY@378..379 "}" [] [], + ], + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@379..381 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@381..382 "a" [] [], + }, + }, + }, + ], + }, + JsBogusStatement { + items: [ + COMMA@382..383 "," [] [], + IDENT@383..385 "b" [] [Whitespace(" ")], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@385..391 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@391..399 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@399..400 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@400..401 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@401..403 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + BACKTICK@403..404 "`" [] [], + JsTemplateElementList [ + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@404..406 "${" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@406..407 "d" [] [], + }, + }, + r_curly_token: R_CURLY@407..408 "}" [] [], + }, + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@408..411 "foo" [] [], + }, + ], + BACKTICK@411..413 "`" [] [Whitespace(" ")], + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@413..419 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@419..427 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@427..428 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@428..429 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@429..431 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@431..435 "obj" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@435..438 "as" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@438..445 "MyType" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@445..451 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@451..459 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@459..460 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@460..461 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@461..463 "@" [Newline("\n")] [], + expression: missing (required), + }, + ], + }, + JsExpressionStatement { + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@463..464 "<" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@464..470 "MyType" [] [], + }, + type_arguments: missing (optional), + }, + r_angle_token: R_ANGLE@470..471 ">" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@471..475 "obj" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@475..481 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@481..489 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@489..490 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@490..491 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@491..493 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@493..497 "obj" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@497..507 "satisfies" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@507..514 "MyType" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@514..520 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@520..528 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@528..529 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@529..530 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@530..532 "@" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@532..535 "obj" [] [], + }, + }, + BANG@535..537 "!" [] [Whitespace(" ")], + ], + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@537..543 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@543..551 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@551..552 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@552..553 "}" [] [], + }, + ], + eof_token: EOF@553..554 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..554 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..553 + 0: JS_CLASS_DECLARATION@0..25 + 0: JS_DECORATOR_LIST@0..9 + 0: JS_DECORATOR@0..9 + 0: AT@0..1 "@" [] [] + 1: JS_BOGUS_EXPRESSION@1..9 + 0: JS_STRING_LITERAL@1..9 "'dsads'" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..23 + 0: IDENT@15..23 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@23..24 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@24..24 + 9: R_CURLY@24..25 "}" [] [] + 1: JS_CLASS_DECLARATION@25..45 + 0: JS_DECORATOR_LIST@25..29 + 0: JS_DECORATOR@25..29 + 0: AT@25..27 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@27..29 + 0: JS_NUMBER_LITERAL@27..29 "1" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@29..35 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@35..43 + 0: IDENT@35..43 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@43..44 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@44..44 + 9: R_CURLY@44..45 "}" [] [] + 2: JS_BOGUS_STATEMENT@45..47 + 0: JS_DECORATOR@45..47 + 0: AT@45..47 "@" [Newline("\n")] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@47..51 + 0: JS_PRE_UPDATE_EXPRESSION@47..51 + 0: PLUS2@47..49 "++" [] [] + 1: JS_BOGUS_ASSIGNMENT@49..51 + 0: JS_NUMBER_LITERAL@49..51 "1" [] [Whitespace(" ")] + 1: (empty) + 4: JS_CLASS_DECLARATION@51..67 + 0: JS_DECORATOR_LIST@51..51 + 1: (empty) + 2: CLASS_KW@51..57 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@57..65 + 0: IDENT@57..65 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@65..66 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@66..66 + 9: R_CURLY@66..67 "}" [] [] + 5: JS_BOGUS_STATEMENT@67..72 + 0: JS_DECORATOR@67..72 + 0: AT@67..69 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@69..72 + 0: L_BRACK@69..70 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@70..70 + 2: R_BRACK@70..72 "]" [] [Whitespace(" ")] + 6: JS_BOGUS_STATEMENT@72..77 + 0: IN_KW@72..75 "in" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL@75..77 "1" [] [Whitespace(" ")] + 7: JS_CLASS_DECLARATION@77..93 + 0: JS_DECORATOR_LIST@77..77 + 1: (empty) + 2: CLASS_KW@77..83 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@83..91 + 0: IDENT@83..91 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@91..92 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@92..92 + 9: R_CURLY@92..93 "}" [] [] + 8: JS_CLASS_DECLARATION@93..114 + 0: JS_DECORATOR_LIST@93..98 + 0: JS_DECORATOR@93..98 + 0: AT@93..95 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@95..98 + 0: L_BRACK@95..96 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@96..96 + 2: R_BRACK@96..98 "]" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@98..104 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@104..112 + 0: IDENT@104..112 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@112..113 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@113..113 + 9: R_CURLY@113..114 "}" [] [] + 9: JS_BOGUS_STATEMENT@114..119 + 0: JS_DECORATOR@114..119 + 0: AT@114..116 "@" [Newline("\n")] [] + 1: JS_PARENTHESIZED_EXPRESSION@116..119 + 0: L_PAREN@116..117 "(" [] [] + 1: (empty) + 2: R_PAREN@117..119 ")" [] [Whitespace(" ")] + 10: JS_BOGUS_STATEMENT@119..122 + 0: FAT_ARROW@119..122 "=>" [] [Whitespace(" ")] + 11: JS_BLOCK_STATEMENT@122..125 + 0: L_CURLY@122..123 "{" [] [] + 1: JS_STATEMENT_LIST@123..123 + 2: R_CURLY@123..125 "}" [] [Whitespace(" ")] + 12: JS_CLASS_DECLARATION@125..141 + 0: JS_DECORATOR_LIST@125..125 + 1: (empty) + 2: CLASS_KW@125..131 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@131..139 + 0: IDENT@131..139 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@139..140 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@140..140 + 9: R_CURLY@140..141 "}" [] [] + 13: JS_BOGUS_STATEMENT@141..145 + 0: JS_DECORATOR@141..145 + 0: AT@141..143 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@143..145 + 0: JS_NUMBER_LITERAL@143..145 "1" [] [Whitespace(" ")] + 14: JS_BOGUS_STATEMENT@145..165 + 0: EQ2@145..148 "==" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL@148..150 "2" [] [Whitespace(" ")] + 2: QUESTION@150..152 "?" [] [Whitespace(" ")] + 3: TRUE_KW@152..157 "true" [] [Whitespace(" ")] + 4: COLON@157..159 ":" [] [Whitespace(" ")] + 5: FALSE_KW@159..165 "false" [] [Whitespace(" ")] + 15: JS_CLASS_DECLARATION@165..181 + 0: JS_DECORATOR_LIST@165..165 + 1: (empty) + 2: CLASS_KW@165..171 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@171..179 + 0: IDENT@171..179 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@179..180 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@180..180 + 9: R_CURLY@180..181 "}" [] [] + 16: JS_BOGUS_STATEMENT@181..189 + 0: JS_DECORATOR@181..189 + 0: AT@181..183 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@183..189 + 0: JS_BOGUS@183..189 + 0: IDENT@183..189 "await" [] [Whitespace(" ")] + 17: JS_EXPRESSION_STATEMENT@189..192 + 0: JS_IDENTIFIER_EXPRESSION@189..192 + 0: JS_REFERENCE_IDENTIFIER@189..192 + 0: IDENT@189..192 "fn" [] [Whitespace(" ")] + 1: (empty) + 18: JS_CLASS_DECLARATION@192..208 + 0: JS_DECORATOR_LIST@192..192 + 1: (empty) + 2: CLASS_KW@192..198 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@198..206 + 0: IDENT@198..206 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@206..207 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@207..207 + 9: R_CURLY@207..208 "}" [] [] + 19: JS_CLASS_DECLARATION@208..239 + 0: JS_DECORATOR_LIST@208..223 + 0: JS_DECORATOR@208..223 + 0: AT@208..210 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@210..223 + 0: FUNCTION_KW@210..218 "function" [] [] + 1: JS_PARAMETERS@218..220 + 0: L_PAREN@218..219 "(" [] [] + 1: JS_PARAMETER_LIST@219..219 + 2: R_PAREN@219..220 ")" [] [] + 2: JS_FUNCTION_BODY@220..223 + 0: L_CURLY@220..221 "{" [] [] + 1: JS_DIRECTIVE_LIST@221..221 + 2: JS_STATEMENT_LIST@221..221 + 3: R_CURLY@221..223 "}" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@223..229 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@229..237 + 0: IDENT@229..237 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@237..238 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@238..238 + 9: R_CURLY@238..239 "}" [] [] + 20: JS_BOGUS_STATEMENT@239..245 + 0: JS_DECORATOR@239..245 + 0: AT@239..241 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@241..245 + 0: JS_REFERENCE_IDENTIFIER@241..245 + 0: IDENT@241..245 "obj" [] [Whitespace(" ")] + 21: JS_BOGUS_STATEMENT@245..263 + 0: INSTANCEOF_KW@245..256 "instanceof" [] [Whitespace(" ")] + 1: IDENT@256..263 "Object" [] [Whitespace(" ")] + 22: JS_CLASS_DECLARATION@263..279 + 0: JS_DECORATOR_LIST@263..263 + 1: (empty) + 2: CLASS_KW@263..269 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@269..277 + 0: IDENT@269..277 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@277..278 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@278..278 + 9: R_CURLY@278..279 "}" [] [] + 23: JS_BOGUS_STATEMENT@279..283 + 0: JS_DECORATOR@279..283 + 0: AT@279..281 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@281..283 + 0: JS_NUMBER_LITERAL@281..283 "1" [] [Whitespace(" ")] + 24: JS_BOGUS_STATEMENT@283..289 + 0: EQ3@283..287 "===" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL@287..289 "2" [] [Whitespace(" ")] + 25: JS_CLASS_DECLARATION@289..305 + 0: JS_DECORATOR_LIST@289..289 + 1: (empty) + 2: CLASS_KW@289..295 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@295..303 + 0: IDENT@295..303 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@303..304 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@304..304 + 9: R_CURLY@304..305 "}" [] [] + 26: JS_CLASS_DECLARATION@305..336 + 0: JS_DECORATOR_LIST@305..320 + 0: JS_DECORATOR@305..320 + 0: AT@305..307 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@307..320 + 0: NEW_KW@307..311 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@311..317 + 0: JS_REFERENCE_IDENTIFIER@311..317 + 0: IDENT@311..317 "Object" [] [] + 2: JS_CALL_ARGUMENTS@317..320 + 0: L_PAREN@317..318 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@318..318 + 2: R_PAREN@318..320 ")" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@320..326 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@326..334 + 0: IDENT@326..334 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@334..335 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@335..335 + 9: R_CURLY@335..336 "}" [] [] + 27: JS_CLASS_DECLARATION@336..357 + 0: JS_DECORATOR_LIST@336..341 + 0: JS_DECORATOR@336..341 + 0: AT@336..338 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@338..341 + 0: L_CURLY@338..339 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@339..339 + 2: R_CURLY@339..341 "}" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@341..347 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@347..355 + 0: IDENT@347..355 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@355..356 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@356..356 + 9: R_CURLY@356..357 "}" [] [] + 28: JS_BOGUS_STATEMENT@357..360 + 0: JS_DECORATOR@357..360 + 0: AT@357..359 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@359..360 + 0: JS_REFERENCE_IDENTIFIER@359..360 + 0: IDENT@359..360 "a" [] [] + 29: JS_EXPRESSION_STATEMENT@360..379 + 0: JS_PRE_UPDATE_EXPRESSION@360..379 + 0: PLUS2@360..363 "++" [] [Whitespace(" ")] + 1: JS_BOGUS_ASSIGNMENT@363..379 + 0: JS_DECORATOR_LIST@363..363 + 1: CLASS_KW@363..369 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@369..377 + 0: IDENT@369..377 "MyClass" [] [Whitespace(" ")] + 3: L_CURLY@377..378 "{" [] [] + 4: JS_CLASS_MEMBER_LIST@378..378 + 5: R_CURLY@378..379 "}" [] [] + 1: (empty) + 30: JS_BOGUS_STATEMENT@379..382 + 0: JS_DECORATOR@379..382 + 0: AT@379..381 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@381..382 + 0: JS_REFERENCE_IDENTIFIER@381..382 + 0: IDENT@381..382 "a" [] [] + 31: JS_BOGUS_STATEMENT@382..385 + 0: COMMA@382..383 "," [] [] + 1: IDENT@383..385 "b" [] [Whitespace(" ")] + 32: JS_CLASS_DECLARATION@385..401 + 0: JS_DECORATOR_LIST@385..385 + 1: (empty) + 2: CLASS_KW@385..391 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@391..399 + 0: IDENT@391..399 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@399..400 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@400..400 + 9: R_CURLY@400..401 "}" [] [] + 33: JS_CLASS_DECLARATION@401..429 + 0: JS_DECORATOR_LIST@401..413 + 0: JS_DECORATOR@401..413 + 0: AT@401..403 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@403..413 + 0: BACKTICK@403..404 "`" [] [] + 1: JS_TEMPLATE_ELEMENT_LIST@404..411 + 0: JS_TEMPLATE_ELEMENT@404..408 + 0: DOLLAR_CURLY@404..406 "${" [] [] + 1: JS_IDENTIFIER_EXPRESSION@406..407 + 0: JS_REFERENCE_IDENTIFIER@406..407 + 0: IDENT@406..407 "d" [] [] + 2: R_CURLY@407..408 "}" [] [] + 1: JS_TEMPLATE_CHUNK_ELEMENT@408..411 + 0: TEMPLATE_CHUNK@408..411 "foo" [] [] + 2: BACKTICK@411..413 "`" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@413..419 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@419..427 + 0: IDENT@419..427 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@427..428 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@428..428 + 9: R_CURLY@428..429 "}" [] [] + 34: JS_BOGUS_STATEMENT@429..435 + 0: JS_DECORATOR@429..435 + 0: AT@429..431 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@431..435 + 0: JS_REFERENCE_IDENTIFIER@431..435 + 0: IDENT@431..435 "obj" [] [Whitespace(" ")] + 35: JS_EXPRESSION_STATEMENT@435..438 + 0: JS_IDENTIFIER_EXPRESSION@435..438 + 0: JS_REFERENCE_IDENTIFIER@435..438 + 0: IDENT@435..438 "as" [] [Whitespace(" ")] + 1: (empty) + 36: JS_EXPRESSION_STATEMENT@438..445 + 0: JS_IDENTIFIER_EXPRESSION@438..445 + 0: JS_REFERENCE_IDENTIFIER@438..445 + 0: IDENT@438..445 "MyType" [] [Whitespace(" ")] + 1: (empty) + 37: JS_CLASS_DECLARATION@445..461 + 0: JS_DECORATOR_LIST@445..445 + 1: (empty) + 2: CLASS_KW@445..451 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@451..459 + 0: IDENT@451..459 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@459..460 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@460..460 + 9: R_CURLY@460..461 "}" [] [] + 38: JS_BOGUS_STATEMENT@461..463 + 0: JS_DECORATOR@461..463 + 0: AT@461..463 "@" [Newline("\n")] [] + 1: (empty) + 39: JS_EXPRESSION_STATEMENT@463..475 + 0: TS_TYPE_ASSERTION_EXPRESSION@463..475 + 0: L_ANGLE@463..464 "<" [] [] + 1: TS_REFERENCE_TYPE@464..470 + 0: JS_REFERENCE_IDENTIFIER@464..470 + 0: IDENT@464..470 "MyType" [] [] + 1: (empty) + 2: R_ANGLE@470..471 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@471..475 + 0: JS_REFERENCE_IDENTIFIER@471..475 + 0: IDENT@471..475 "obj" [] [Whitespace(" ")] + 1: (empty) + 40: JS_CLASS_DECLARATION@475..491 + 0: JS_DECORATOR_LIST@475..475 + 1: (empty) + 2: CLASS_KW@475..481 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@481..489 + 0: IDENT@481..489 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@489..490 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@490..490 + 9: R_CURLY@490..491 "}" [] [] + 41: JS_BOGUS_STATEMENT@491..497 + 0: JS_DECORATOR@491..497 + 0: AT@491..493 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@493..497 + 0: JS_REFERENCE_IDENTIFIER@493..497 + 0: IDENT@493..497 "obj" [] [Whitespace(" ")] + 42: JS_EXPRESSION_STATEMENT@497..507 + 0: JS_IDENTIFIER_EXPRESSION@497..507 + 0: JS_REFERENCE_IDENTIFIER@497..507 + 0: IDENT@497..507 "satisfies" [] [Whitespace(" ")] + 1: (empty) + 43: JS_EXPRESSION_STATEMENT@507..514 + 0: JS_IDENTIFIER_EXPRESSION@507..514 + 0: JS_REFERENCE_IDENTIFIER@507..514 + 0: IDENT@507..514 "MyType" [] [Whitespace(" ")] + 1: (empty) + 44: JS_CLASS_DECLARATION@514..530 + 0: JS_DECORATOR_LIST@514..514 + 1: (empty) + 2: CLASS_KW@514..520 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@520..528 + 0: IDENT@520..528 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@528..529 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@529..529 + 9: R_CURLY@529..530 "}" [] [] + 45: JS_CLASS_DECLARATION@530..553 + 0: JS_DECORATOR_LIST@530..537 + 0: JS_DECORATOR@530..537 + 0: AT@530..532 "@" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@532..537 + 0: JS_IDENTIFIER_EXPRESSION@532..535 + 0: JS_REFERENCE_IDENTIFIER@532..535 + 0: IDENT@532..535 "obj" [] [] + 1: BANG@535..537 "!" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@537..543 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@543..551 + 0: IDENT@543..551 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@551..552 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@552..552 + 9: R_CURLY@552..553 "}" [] [] + 4: EOF@553..554 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator.ts:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `'dsads'` + + > 1 │ @'dsads' class MyClass {} + │ ^^^^^^^ + 2 │ @1 class MyClass {} + 3 │ @++1 class MyClass {} + +decorator.ts:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `1` + + 1 │ @'dsads' class MyClass {} + > 2 │ @1 class MyClass {} + │ ^ + 3 │ @++1 class MyClass {} + 4 │ @[] in 1 class MyClass {} + +decorator.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '++'. + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + + i Expected an expression here. + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + +decorator.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `1` + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + + i This expression cannot be assigned to + +decorator.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^^^^^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + + i An explicit or implicit semicolon is expected here... + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^^^^^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + + i ...Which is required to end this statement + + 1 │ @'dsads' class MyClass {} + 2 │ @1 class MyClass {} + > 3 │ @++1 class MyClass {} + │ ^^^^^^^^^ + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + +decorator.ts:4:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `[]` + + 2 │ @1 class MyClass {} + 3 │ @++1 class MyClass {} + > 4 │ @[] in 1 class MyClass {} + │ ^^ + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + +decorator.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ @1 class MyClass {} + 3 │ @++1 class MyClass {} + > 4 │ @[] in 1 class MyClass {} + │ ^^^ + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found 'in 1'. + + 2 │ @1 class MyClass {} + 3 │ @++1 class MyClass {} + > 4 │ @[] in 1 class MyClass {} + │ ^^^^ + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + + i Expected a statement here. + + 2 │ @1 class MyClass {} + 3 │ @++1 class MyClass {} + > 4 │ @[] in 1 class MyClass {} + │ ^^^^ + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + +decorator.ts:5:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `[]` + + 3 │ @++1 class MyClass {} + 4 │ @[] in 1 class MyClass {} + > 5 │ @[] class MyClass {} + │ ^^ + 6 │ @() => {} class MyClass {} + 7 │ @1 == 2 ? true : false class MyClass {} + +decorator.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parenthesized expression didnt contain anything + + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + > 6 │ @() => {} class MyClass {} + │ ^ + 7 │ @1 == 2 ? true : false class MyClass {} + 8 │ @await fn class MyClass {} + + i Expected an expression here + +decorator.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + > 6 │ @() => {} class MyClass {} + │ ^^^ + 7 │ @1 == 2 ? true : false class MyClass {} + 8 │ @await fn class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '=>'. + + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + > 6 │ @() => {} class MyClass {} + │ ^^ + 7 │ @1 == 2 ? true : false class MyClass {} + 8 │ @await fn class MyClass {} + + i Expected a statement here. + + 4 │ @[] in 1 class MyClass {} + 5 │ @[] class MyClass {} + > 6 │ @() => {} class MyClass {} + │ ^^ + 7 │ @1 == 2 ? true : false class MyClass {} + 8 │ @await fn class MyClass {} + +decorator.ts:7:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `1` + + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + > 7 │ @1 == 2 ? true : false class MyClass {} + │ ^ + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + +decorator.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + > 7 │ @1 == 2 ? true : false class MyClass {} + │ ^^ + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '== 2 ? true : false'. + + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + > 7 │ @1 == 2 ? true : false class MyClass {} + │ ^^^^^^^^^^^^^^^^^^^ + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + + i Expected a statement here. + + 5 │ @[] class MyClass {} + 6 │ @() => {} class MyClass {} + > 7 │ @1 == 2 ? true : false class MyClass {} + │ ^^^^^^^^^^^^^^^^^^^ + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + +decorator.ts:8:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 6 │ @() => {} class MyClass {} + 7 │ @1 == 2 ? true : false class MyClass {} + > 8 │ @await fn class MyClass {} + │ ^^^^^ + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + +decorator.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 6 │ @() => {} class MyClass {} + 7 │ @1 == 2 ? true : false class MyClass {} + > 8 │ @await fn class MyClass {} + │ ^^^^^^ + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:8:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 6 │ @() => {} class MyClass {} + 7 │ @1 == 2 ? true : false class MyClass {} + > 8 │ @await fn class MyClass {} + │ ^^^^^ + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + + i An explicit or implicit semicolon is expected here... + + 6 │ @() => {} class MyClass {} + 7 │ @1 == 2 ? true : false class MyClass {} + > 8 │ @await fn class MyClass {} + │ ^^^^^ + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + + i ...Which is required to end this statement + + 6 │ @() => {} class MyClass {} + 7 │ @1 == 2 ? true : false class MyClass {} + > 8 │ @await fn class MyClass {} + │ ^^^^^^^^ + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + +decorator.ts:9:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `function(){}` + + 7 │ @1 == 2 ? true : false class MyClass {} + 8 │ @await fn class MyClass {} + > 9 │ @function(){} class MyClass {} + │ ^^^^^^^^^^^^ + 10 │ @obj instanceof Object class MyClass {} + 11 │ @1 === 2 class MyClass {} + +decorator.ts:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + > 10 │ @obj instanceof Object class MyClass {} + │ ^^^^ + 11 │ @1 === 2 class MyClass {} + 12 │ @new Object() class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found 'instanceof Object'. + + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + > 10 │ @obj instanceof Object class MyClass {} + │ ^^^^^^^^^^^^^^^^^ + 11 │ @1 === 2 class MyClass {} + 12 │ @new Object() class MyClass {} + + i Expected a statement here. + + 8 │ @await fn class MyClass {} + 9 │ @function(){} class MyClass {} + > 10 │ @obj instanceof Object class MyClass {} + │ ^^^^^^^^^^^^^^^^^ + 11 │ @1 === 2 class MyClass {} + 12 │ @new Object() class MyClass {} + +decorator.ts:11:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `1` + + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + > 11 │ @1 === 2 class MyClass {} + │ ^ + 12 │ @new Object() class MyClass {} + 13 │ @{} class MyClass {} + +decorator.ts:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + > 11 │ @1 === 2 class MyClass {} + │ ^^ + 12 │ @new Object() class MyClass {} + 13 │ @{} class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:11:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '=== 2'. + + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + > 11 │ @1 === 2 class MyClass {} + │ ^^^^^ + 12 │ @new Object() class MyClass {} + 13 │ @{} class MyClass {} + + i Expected a statement here. + + 9 │ @function(){} class MyClass {} + 10 │ @obj instanceof Object class MyClass {} + > 11 │ @1 === 2 class MyClass {} + │ ^^^^^ + 12 │ @new Object() class MyClass {} + 13 │ @{} class MyClass {} + +decorator.ts:12:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `new Object()` + + 10 │ @obj instanceof Object class MyClass {} + 11 │ @1 === 2 class MyClass {} + > 12 │ @new Object() class MyClass {} + │ ^^^^^^^^^^^^ + 13 │ @{} class MyClass {} + 14 │ @a++ class MyClass {} + +decorator.ts:13:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `{}` + + 11 │ @1 === 2 class MyClass {} + 12 │ @new Object() class MyClass {} + > 13 │ @{} class MyClass {} + │ ^^ + 14 │ @a++ class MyClass {} + 15 │ @a,b class MyClass {} + +decorator.ts:14:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 12 │ @new Object() class MyClass {} + 13 │ @{} class MyClass {} + > 14 │ @a++ class MyClass {} + │ ^^ + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:14:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `class MyClass {}` + + 12 │ @new Object() class MyClass {} + 13 │ @{} class MyClass {} + > 14 │ @a++ class MyClass {} + │ ^^^^^^^^^^^^^^^^ + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + + i This expression cannot be assigned to + +decorator.ts:15:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 13 │ @{} class MyClass {} + 14 │ @a++ class MyClass {} + > 15 │ @a,b class MyClass {} + │ ^^ + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found ',b'. + + 13 │ @{} class MyClass {} + 14 │ @a++ class MyClass {} + > 15 │ @a,b class MyClass {} + │ ^^ + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + + i Expected a statement here. + + 13 │ @{} class MyClass {} + 14 │ @a++ class MyClass {} + > 15 │ @a,b class MyClass {} + │ ^^ + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + +decorator.ts:16:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator ``${d}foo`` + + 14 │ @a++ class MyClass {} + 15 │ @a,b class MyClass {} + > 16 │ @`${d}foo` class MyClass {} + │ ^^^^^^^^^ + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + +decorator.ts:17:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:17:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + + i An explicit or implicit semicolon is expected here... + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + + i ...Which is required to end this statement + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^^^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + +decorator.ts:17:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + + i An explicit or implicit semicolon is expected here... + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + + i ...Which is required to end this statement + + 15 │ @a,b class MyClass {} + 16 │ @`${d}foo` class MyClass {} + > 17 │ @obj as MyType class MyClass {} + │ ^^^^^^^^^^^^ + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + +decorator.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '<'. + + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + > 18 │ @obj class MyClass {} + │ ^ + 19 │ @obj satisfies MyType class MyClass {} + 20 │ @obj! class MyClass {} + + i Expected an expression here. + + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + > 18 │ @obj class MyClass {} + │ ^ + 19 │ @obj satisfies MyType class MyClass {} + 20 │ @obj! class MyClass {} + +decorator.ts:18:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + > 18 │ @obj class MyClass {} + │ ^ + 19 │ @obj satisfies MyType class MyClass {} + 20 │ @obj! class MyClass {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:18:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + > 18 │ @obj class MyClass {} + │ ^^^^^ + 19 │ @obj satisfies MyType class MyClass {} + 20 │ @obj! class MyClass {} + + i An explicit or implicit semicolon is expected here... + + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + > 18 │ @obj class MyClass {} + │ ^^^^^ + 19 │ @obj satisfies MyType class MyClass {} + 20 │ @obj! class MyClass {} + + i ...Which is required to end this statement + + 16 │ @`${d}foo` class MyClass {} + 17 │ @obj as MyType class MyClass {} + > 18 │ @obj class MyClass {} + │ ^^^^^^^^^^^^^^^^^ + 19 │ @obj satisfies MyType class MyClass {} + 20 │ @obj! class MyClass {} + +decorator.ts:19:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^ + 20 │ @obj! class MyClass {} + 21 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator.ts:19:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^^^ + 20 │ @obj! class MyClass {} + 21 │ + + i An explicit or implicit semicolon is expected here... + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^^^ + 20 │ @obj! class MyClass {} + 21 │ + + i ...Which is required to end this statement + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^^^^^^^^^^^^^ + 20 │ @obj! class MyClass {} + 21 │ + +decorator.ts:19:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^^ + 20 │ @obj! class MyClass {} + 21 │ + + i An explicit or implicit semicolon is expected here... + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^^ + 20 │ @obj! class MyClass {} + 21 │ + + i ...Which is required to end this statement + + 17 │ @obj as MyType class MyClass {} + 18 │ @obj class MyClass {} + > 19 │ @obj satisfies MyType class MyClass {} + │ ^^^^^^^^^^^^ + 20 │ @obj! class MyClass {} + 21 │ + +decorator.ts:20:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `obj!` + + 18 │ @obj class MyClass {} + 19 │ @obj satisfies MyType class MyClass {} + > 20 │ @obj! class MyClass {} + │ ^^^^ + 21 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap new file mode 100644 index 000000000000..f30b52205258 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap @@ -0,0 +1,123 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default async function foo() { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: ASYNC_KW@26..32 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@32..41 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@41..44 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@47..49 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@49..50 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@50..51 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..51 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..50 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_EXPORT@10..50 + 0: JS_DECORATOR_LIST@10..10 + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..50 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@26..50 + 0: ASYNC_KW@26..32 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@32..41 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@41..44 + 0: IDENT@41..44 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..45 + 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@47..50 + 0: L_CURLY@47..49 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@49..49 + 2: JS_STATEMENT_LIST@49..49 + 3: R_CURLY@49..50 "}" [] [] + 2: (empty) + 4: EOF@50..51 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_async_function_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ export default async function foo() { } + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js.snap new file mode 100644 index 000000000000..fb27e954c88b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js.snap @@ -0,0 +1,224 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function bar() { + @decorator + let a; + @decorator @decorator2 + function Foo() { } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "bar" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..32 "decorator" [] [], + }, + }, + }, + ], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@32..42 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@42..43 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@44..51 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@51..61 "decorator" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@61..62 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@62..72 "decorator2" [] [], + }, + }, + }, + ], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@72..87 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@87..90 "Foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@90..91 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@91..93 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@95..96 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@96..98 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@98..99 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..99 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..98 + 0: JS_FUNCTION_DECLARATION@0..98 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "bar" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..98 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..96 + 0: JS_BOGUS_STATEMENT@16..32 + 0: JS_DECORATOR@16..32 + 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@23..32 + 0: JS_REFERENCE_IDENTIFIER@23..32 + 0: IDENT@23..32 "decorator" [] [] + 1: JS_VARIABLE_STATEMENT@32..44 + 0: JS_VARIABLE_DECLARATION@32..43 + 0: (empty) + 1: LET_KW@32..42 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@42..43 + 0: JS_VARIABLE_DECLARATOR@42..43 + 0: JS_IDENTIFIER_BINDING@42..43 + 0: IDENT@42..43 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@43..44 ";" [] [] + 2: JS_BOGUS_STATEMENT@44..72 + 0: JS_DECORATOR@44..61 + 0: AT@44..51 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@51..61 + 0: JS_REFERENCE_IDENTIFIER@51..61 + 0: IDENT@51..61 "decorator" [] [Whitespace(" ")] + 1: JS_DECORATOR@61..72 + 0: AT@61..62 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@62..72 + 0: JS_REFERENCE_IDENTIFIER@62..72 + 0: IDENT@62..72 "decorator2" [] [] + 3: JS_FUNCTION_DECLARATION@72..96 + 0: (empty) + 1: FUNCTION_KW@72..87 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@87..90 + 0: IDENT@87..90 "Foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@90..93 + 0: L_PAREN@90..91 "(" [] [] + 1: JS_PARAMETER_LIST@91..91 + 2: R_PAREN@91..93 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@93..96 + 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@95..95 + 2: JS_STATEMENT_LIST@95..95 + 3: R_CURLY@95..96 "}" [] [] + 3: R_CURLY@96..98 "}" [Newline("\n")] [] + 4: EOF@98..99 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_class_declaration.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ function bar() { + > 2 │ @decorator + │ ^^^^^^^^^^ + 3 │ let a; + 4 │ @decorator @decorator2 + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_declaration.js:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ @decorator + 3 │ let a; + > 4 │ @decorator @decorator2 + │ ^^^^^^^^^^^^^^^^^^^^^^ + 5 │ function Foo() { } + 6 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap new file mode 100644 index 000000000000..62cae42dad7b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap @@ -0,0 +1,182 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +let a; +@decorator1 @decorator2 +function Foo() { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@17..19 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@19..30 "decorator1" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@30..31 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..41 "decorator2" [] [], + }, + }, + }, + ], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@51..54 "Foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@54..55 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@55..57 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + }, + ], + eof_token: EOF@60..61 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..61 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..60 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_VARIABLE_STATEMENT@10..17 + 0: JS_VARIABLE_DECLARATION@10..16 + 0: (empty) + 1: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@15..16 + 0: JS_VARIABLE_DECLARATOR@15..16 + 0: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@16..17 ";" [] [] + 2: JS_BOGUS_STATEMENT@17..41 + 0: JS_DECORATOR@17..30 + 0: AT@17..19 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@19..30 + 0: JS_REFERENCE_IDENTIFIER@19..30 + 0: IDENT@19..30 "decorator1" [] [Whitespace(" ")] + 1: JS_DECORATOR@30..41 + 0: AT@30..31 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@31..41 + 0: JS_REFERENCE_IDENTIFIER@31..41 + 0: IDENT@31..41 "decorator2" [] [] + 3: JS_FUNCTION_DECLARATION@41..60 + 0: (empty) + 1: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@51..54 + 0: IDENT@51..54 "Foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@54..57 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_PARAMETER_LIST@55..55 + 2: R_PAREN@55..57 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@57..60 + 0: L_CURLY@57..59 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..60 "}" [] [] + 4: EOF@60..61 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_class_declaration_top_level.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ let a; + 3 │ @decorator1 @decorator2 + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_declaration_top_level.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ @decorator + 2 │ let a; + > 3 │ @decorator1 @decorator2 + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ function Foo() { } + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts.snap new file mode 100644 index 000000000000..a5c25de4eb4f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts.snap @@ -0,0 +1,730 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + @dec constructor() {} + @dec [index: string]: { props: string } +} +class Quiz { + @dec public constructor() {} +} +class Bar extends Foo { + @dec + constructor(); + constructor(a: String) + constructor(a?: String) {} +} +declare class Baz { + @dec method(); + @dec get foo(); + @dec set foo(a); +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@11..16 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..20 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsLiteralMemberName { + value: IDENT@20..31 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@34..35 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@35..36 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@36..41 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..45 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + L_BRACK@45..46 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@46..51 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@51..53 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@53..59 "string" [] [], + }, + }, + }, + R_BRACK@59..60 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@60..62 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@62..64 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@64..69 "props" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@71..78 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@78..79 "}" [] [], + }, + }, + ], + }, + ], + r_curly_token: R_CURLY@79..81 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@81..88 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@88..93 "Quiz" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@93..94 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@94..99 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@99..103 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@103..110 "public" [] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@110..121 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@121..122 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@122..124 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@124..125 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@126..128 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@128..135 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@135..139 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@139..147 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@147..151 "Foo" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@151..152 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@152..157 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@157..160 "dec" [] [], + }, + }, + }, + ], + }, + JsLiteralMemberName { + value: IDENT@160..175 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@175..176 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@176..177 ")" [] [], + }, + SEMICOLON@177..178 ";" [] [], + ], + }, + TsConstructorSignatureClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@178..193 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@193..194 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@194..195 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@195..197 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@197..203 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@203..204 ")" [] [], + }, + semicolon_token: missing (optional), + }, + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@204..219 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@219..220 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@220..221 "a" [] [], + }, + question_mark_token: QUESTION@221..222 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@222..224 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@224..230 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@230..232 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@232..233 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@233..234 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@234..236 "}" [Newline("\n")] [], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@236..245 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@245..251 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@251..255 "Baz" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@255..256 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@256..260 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@260..264 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@264..270 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@270..271 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@271..272 ")" [] [], + }, + SEMICOLON@272..273 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@273..277 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@277..281 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + GET_KW@281..285 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@285..288 "foo" [] [], + }, + L_PAREN@288..289 "(" [] [], + R_PAREN@289..290 ")" [] [], + SEMICOLON@290..291 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@291..295 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@295..299 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + SET_KW@299..303 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@303..306 "foo" [] [], + }, + L_PAREN@306..307 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@307..308 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + R_PAREN@308..309 ")" [] [], + SEMICOLON@309..310 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@310..312 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@312..313 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..313 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..312 + 0: JS_CLASS_DECLARATION@0..81 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..79 + 0: JS_BOGUS_MEMBER@11..36 + 0: JS_BOGUS@11..20 + 0: JS_DECORATOR@11..20 + 0: AT@11..16 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@16..20 + 0: JS_REFERENCE_IDENTIFIER@16..20 + 0: IDENT@16..20 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@20..31 + 0: IDENT@20..31 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@31..34 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..32 + 2: R_PAREN@32..34 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@34..36 + 0: L_CURLY@34..35 "{" [] [] + 1: JS_DIRECTIVE_LIST@35..35 + 2: JS_STATEMENT_LIST@35..35 + 3: R_CURLY@35..36 "}" [] [] + 1: JS_BOGUS_MEMBER@36..79 + 0: JS_BOGUS@36..45 + 0: JS_DECORATOR@36..45 + 0: AT@36..41 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@41..45 + 0: JS_REFERENCE_IDENTIFIER@41..45 + 0: IDENT@41..45 "dec" [] [Whitespace(" ")] + 1: L_BRACK@45..46 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@46..59 + 0: JS_IDENTIFIER_BINDING@46..51 + 0: IDENT@46..51 "index" [] [] + 1: TS_TYPE_ANNOTATION@51..59 + 0: COLON@51..53 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@53..59 + 0: STRING_KW@53..59 "string" [] [] + 3: R_BRACK@59..60 "]" [] [] + 4: TS_TYPE_ANNOTATION@60..79 + 0: COLON@60..62 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@62..79 + 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@64..78 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@64..78 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@64..69 + 0: IDENT@64..69 "props" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@69..78 + 0: COLON@69..71 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@71..78 + 0: STRING_KW@71..78 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@78..79 "}" [] [] + 9: R_CURLY@79..81 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@81..128 + 0: JS_DECORATOR_LIST@81..81 + 1: (empty) + 2: CLASS_KW@81..88 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@88..93 + 0: IDENT@88..93 "Quiz" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@93..94 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@94..126 + 0: JS_BOGUS_MEMBER@94..126 + 0: JS_BOGUS@94..110 + 0: JS_DECORATOR@94..103 + 0: AT@94..99 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@99..103 + 0: JS_REFERENCE_IDENTIFIER@99..103 + 0: IDENT@99..103 "dec" [] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@103..110 + 0: PUBLIC_KW@103..110 "public" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@110..121 + 0: IDENT@110..121 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@121..124 + 0: L_PAREN@121..122 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@122..122 + 2: R_PAREN@122..124 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@124..126 + 0: L_CURLY@124..125 "{" [] [] + 1: JS_DIRECTIVE_LIST@125..125 + 2: JS_STATEMENT_LIST@125..125 + 3: R_CURLY@125..126 "}" [] [] + 9: R_CURLY@126..128 "}" [Newline("\n")] [] + 2: JS_CLASS_DECLARATION@128..236 + 0: JS_DECORATOR_LIST@128..128 + 1: (empty) + 2: CLASS_KW@128..135 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@135..139 + 0: IDENT@135..139 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@139..151 + 0: EXTENDS_KW@139..147 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@147..151 + 0: JS_REFERENCE_IDENTIFIER@147..151 + 0: IDENT@147..151 "Foo" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@151..152 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@152..234 + 0: JS_BOGUS_MEMBER@152..178 + 0: JS_BOGUS@152..160 + 0: JS_DECORATOR@152..160 + 0: AT@152..157 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@157..160 + 0: JS_REFERENCE_IDENTIFIER@157..160 + 0: IDENT@157..160 "dec" [] [] + 1: JS_LITERAL_MEMBER_NAME@160..175 + 0: IDENT@160..175 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@175..177 + 0: L_PAREN@175..176 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@176..176 + 2: R_PAREN@176..177 ")" [] [] + 3: SEMICOLON@177..178 ";" [] [] + 1: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@178..204 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@178..178 + 1: JS_LITERAL_MEMBER_NAME@178..193 + 0: IDENT@178..193 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@193..204 + 0: L_PAREN@193..194 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@194..203 + 0: JS_FORMAL_PARAMETER@194..203 + 0: JS_DECORATOR_LIST@194..194 + 1: JS_IDENTIFIER_BINDING@194..195 + 0: IDENT@194..195 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@195..203 + 0: COLON@195..197 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@197..203 + 0: JS_REFERENCE_IDENTIFIER@197..203 + 0: IDENT@197..203 "String" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@203..204 ")" [] [] + 3: (empty) + 2: JS_CONSTRUCTOR_CLASS_MEMBER@204..234 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@204..204 + 1: JS_LITERAL_MEMBER_NAME@204..219 + 0: IDENT@204..219 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@219..232 + 0: L_PAREN@219..220 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@220..230 + 0: JS_FORMAL_PARAMETER@220..230 + 0: JS_DECORATOR_LIST@220..220 + 1: JS_IDENTIFIER_BINDING@220..221 + 0: IDENT@220..221 "a" [] [] + 2: QUESTION@221..222 "?" [] [] + 3: TS_TYPE_ANNOTATION@222..230 + 0: COLON@222..224 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@224..230 + 0: JS_REFERENCE_IDENTIFIER@224..230 + 0: IDENT@224..230 "String" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@230..232 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@232..234 + 0: L_CURLY@232..233 "{" [] [] + 1: JS_DIRECTIVE_LIST@233..233 + 2: JS_STATEMENT_LIST@233..233 + 3: R_CURLY@233..234 "}" [] [] + 9: R_CURLY@234..236 "}" [Newline("\n")] [] + 3: TS_DECLARE_STATEMENT@236..312 + 0: DECLARE_KW@236..245 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@245..312 + 0: JS_DECORATOR_LIST@245..245 + 1: (empty) + 2: CLASS_KW@245..251 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@251..255 + 0: IDENT@251..255 "Baz" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@255..256 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@256..310 + 0: JS_BOGUS_MEMBER@256..273 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@256..264 + 0: JS_DECORATOR@256..264 + 0: AT@256..260 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@260..264 + 0: JS_REFERENCE_IDENTIFIER@260..264 + 0: IDENT@260..264 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@264..270 + 0: IDENT@264..270 "method" [] [] + 2: JS_PARAMETERS@270..272 + 0: L_PAREN@270..271 "(" [] [] + 1: JS_PARAMETER_LIST@271..271 + 2: R_PAREN@271..272 ")" [] [] + 3: SEMICOLON@272..273 ";" [] [] + 1: JS_BOGUS_MEMBER@273..291 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@273..281 + 0: JS_DECORATOR@273..281 + 0: AT@273..277 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@277..281 + 0: JS_REFERENCE_IDENTIFIER@277..281 + 0: IDENT@277..281 "dec" [] [Whitespace(" ")] + 1: GET_KW@281..285 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@285..288 + 0: IDENT@285..288 "foo" [] [] + 3: L_PAREN@288..289 "(" [] [] + 4: R_PAREN@289..290 ")" [] [] + 5: SEMICOLON@290..291 ";" [] [] + 2: JS_BOGUS_MEMBER@291..310 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@291..299 + 0: JS_DECORATOR@291..299 + 0: AT@291..295 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@295..299 + 0: JS_REFERENCE_IDENTIFIER@295..299 + 0: IDENT@295..299 "dec" [] [Whitespace(" ")] + 1: SET_KW@299..303 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@303..306 + 0: IDENT@303..306 "foo" [] [] + 3: L_PAREN@306..307 "(" [] [] + 4: JS_FORMAL_PARAMETER@307..308 + 0: JS_DECORATOR_LIST@307..307 + 1: JS_IDENTIFIER_BINDING@307..308 + 0: IDENT@307..308 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: R_PAREN@308..309 ")" [] [] + 6: SEMICOLON@309..310 ";" [] [] + 9: R_CURLY@310..312 "}" [Newline("\n")] [] + 4: EOF@312..313 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_class_member.ts:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class Foo { + > 2 │ @dec constructor() {} + │ ^^^^ + 3 │ @dec [index: string]: { props: string } + 4 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_member.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class Foo { + 2 │ @dec constructor() {} + > 3 │ @dec [index: string]: { props: string } + │ ^^^^ + 4 │ } + 5 │ class Quiz { + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_member.ts:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ } + 5 │ class Quiz { + > 6 │ @dec public constructor() {} + │ ^^^^ + 7 │ } + 8 │ class Bar extends Foo { + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_member.ts:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 7 │ } + 8 │ class Bar extends Foo { + > 9 │ @dec + │ ^^^^ + 10 │ constructor(); + 11 │ constructor(a: String) + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_member.ts:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 13 │ } + 14 │ declare class Baz { + > 15 │ @dec method(); + │ ^^^^ + 16 │ @dec get foo(); + 17 │ @dec set foo(a); + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_member.ts:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 14 │ declare class Baz { + 15 │ @dec method(); + > 16 │ @dec get foo(); + │ ^^^^ + 17 │ @dec set foo(a); + 18 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_class_member.ts:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 15 │ @dec method(); + 16 │ @dec get foo(); + > 17 │ @dec set foo(a); + │ ^^^^ + 18 │ } + 19 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap new file mode 100644 index 000000000000..6c80e6f6ed3c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap @@ -0,0 +1,149 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default enum A { X, Y, Z } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@26..31 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@31..33 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@35..36 "X" [] [], + }, + initializer: missing (optional), + }, + COMMA@36..38 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@38..39 "Y" [] [], + }, + initializer: missing (optional), + }, + COMMA@39..41 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@41..43 "Z" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + ], + }, + ], + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_BOGUS_STATEMENT@10..44 + 0: JS_DECORATOR_LIST@10..10 + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@18..44 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: TS_ENUM_DECLARATION@26..44 + 0: (empty) + 1: ENUM_KW@26..31 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "A" [] [Whitespace(" ")] + 3: L_CURLY@33..35 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@35..43 + 0: TS_ENUM_MEMBER@35..36 + 0: TS_LITERAL_ENUM_MEMBER_NAME@35..36 + 0: IDENT@35..36 "X" [] [] + 1: (empty) + 1: COMMA@36..38 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@38..39 + 0: TS_LITERAL_ENUM_MEMBER_NAME@38..39 + 0: IDENT@38..39 "Y" [] [] + 1: (empty) + 3: COMMA@39..41 "," [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER@41..43 + 0: TS_LITERAL_ENUM_MEMBER_NAME@41..43 + 0: IDENT@41..43 "Z" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@43..44 "}" [] [] + 4: EOF@44..45 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_enum_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ export default enum A { X, Y, Z } + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_enum_export_default_declaration_clause.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. + + 1 │ @decorator + > 2 │ export default enum A { X, Y, Z } + │ ^^^^^^^^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_export.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js.snap new file mode 100644 index 000000000000..c16adbb49f81 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js.snap @@ -0,0 +1,291 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { + @decorator + export class Foo { } + @first.field @second @(() => decorator)() + export class Bar {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsDecoratorList [ + JsDecorator { + at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..32 "decorator" [] [], + }, + }, + }, + ], + EXPORT_KW@32..45 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@45..51 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@51..55 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [ + JsDecorator { + at_token: AT@58..65 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@65..70 "first" [] [], + }, + }, + operator_token: DOT@70..71 "." [] [], + member: JsName { + value_token: IDENT@71..77 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@77..78 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..85 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@85..86 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@86..87 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@87..88 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@88..90 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@93..102 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@102..103 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@103..104 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@104..105 ")" [] [], + }, + }, + }, + ], + EXPORT_KW@105..118 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@118..124 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@124..128 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@128..129 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@129..130 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@130..132 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@132..133 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..133 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..132 + 0: JS_FUNCTION_DECLARATION@0..132 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..132 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..130 + 0: JS_BOGUS_STATEMENT@16..58 + 0: JS_DECORATOR_LIST@16..32 + 0: JS_DECORATOR@16..32 + 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@23..32 + 0: JS_REFERENCE_IDENTIFIER@23..32 + 0: IDENT@23..32 "decorator" [] [] + 1: EXPORT_KW@32..45 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@45..58 + 0: JS_DECORATOR_LIST@45..45 + 1: (empty) + 2: CLASS_KW@45..51 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@51..55 + 0: IDENT@51..55 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@57..57 + 9: R_CURLY@57..58 "}" [] [] + 1: JS_BOGUS_STATEMENT@58..130 + 0: JS_DECORATOR_LIST@58..105 + 0: JS_DECORATOR@58..77 + 0: AT@58..65 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@65..77 + 0: JS_IDENTIFIER_EXPRESSION@65..70 + 0: JS_REFERENCE_IDENTIFIER@65..70 + 0: IDENT@65..70 "first" [] [] + 1: DOT@70..71 "." [] [] + 2: JS_NAME@71..77 + 0: IDENT@71..77 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@77..85 + 0: AT@77..78 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@78..85 + 0: JS_REFERENCE_IDENTIFIER@78..85 + 0: IDENT@78..85 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@85..105 + 0: AT@85..86 "@" [] [] + 1: JS_CALL_EXPRESSION@86..105 + 0: JS_PARENTHESIZED_EXPRESSION@86..103 + 0: L_PAREN@86..87 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@87..102 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@87..90 + 0: L_PAREN@87..88 "(" [] [] + 1: JS_PARAMETER_LIST@88..88 + 2: R_PAREN@88..90 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@93..102 + 0: JS_REFERENCE_IDENTIFIER@93..102 + 0: IDENT@93..102 "decorator" [] [] + 2: R_PAREN@102..103 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@103..105 + 0: L_PAREN@103..104 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@104..104 + 2: R_PAREN@104..105 ")" [] [] + 1: EXPORT_KW@105..118 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@118..130 + 0: JS_DECORATOR_LIST@118..118 + 1: (empty) + 2: CLASS_KW@118..124 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@124..128 + 0: IDENT@124..128 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@128..129 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@129..129 + 9: R_CURLY@129..130 "}" [] [] + 3: R_CURLY@130..132 "}" [Newline("\n")] [] + 4: EOF@132..133 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_export.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of an export declaration not at the top level + + 1 │ function foo() { + > 2 │ @decorator + │ ^^^^^^^^^^ + > 3 │ export class Foo { } + │ ^^^^^^^^^^^^^^^^^^^^ + 4 │ @first.field @second @(() => decorator)() + 5 │ export class Bar {} + + i move this declaration to the top level + +decorator_export.js:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of an export declaration not at the top level + + 2 │ @decorator + 3 │ export class Foo { } + > 4 │ @first.field @second @(() => decorator)() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 5 │ export class Bar {} + │ ^^^^^^^^^^^^^^^^^^^ + 6 │ } + 7 │ + + i move this declaration to the top level + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js.snap new file mode 100644 index 000000000000..35b1da2e4edf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js.snap @@ -0,0 +1,196 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +export let a; +@decorator1 @decorator2 +export function Foo() { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@18..22 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@22..23 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@24..26 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..37 "decorator1" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@37..38 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..48 "decorator2" [] [], + }, + }, + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@56..65 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@65..68 "Foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@68..69 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_EXPORT@10..24 + 0: JS_DECORATOR_LIST@10..10 + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@18..24 + 0: JS_VARIABLE_DECLARATION@18..23 + 0: (empty) + 1: LET_KW@18..22 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@22..23 + 0: JS_VARIABLE_DECLARATOR@22..23 + 0: JS_IDENTIFIER_BINDING@22..23 + 0: IDENT@22..23 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@23..24 ";" [] [] + 2: JS_BOGUS_STATEMENT@24..48 + 0: JS_DECORATOR@24..37 + 0: AT@24..26 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@26..37 + 0: JS_REFERENCE_IDENTIFIER@26..37 + 0: IDENT@26..37 "decorator1" [] [Whitespace(" ")] + 1: JS_DECORATOR@37..48 + 0: AT@37..38 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@38..48 + 0: JS_REFERENCE_IDENTIFIER@38..48 + 0: IDENT@38..48 "decorator2" [] [] + 3: JS_EXPORT@48..74 + 0: JS_DECORATOR_LIST@48..48 + 1: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@56..74 + 0: (empty) + 1: FUNCTION_KW@56..65 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@65..68 + 0: IDENT@65..68 "Foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@68..71 + 0: L_PAREN@68..69 "(" [] [] + 1: JS_PARAMETER_LIST@69..69 + 2: R_PAREN@69..71 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@71..74 + 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@73..73 + 2: JS_STATEMENT_LIST@73..73 + 3: R_CURLY@73..74 "}" [] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_export_class_clause.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ export let a; + 3 │ @decorator1 @decorator2 + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_export_class_clause.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ @decorator + 2 │ export let a; + > 3 │ @decorator1 @decorator2 + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ export function Foo() { } + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap new file mode 100644 index 000000000000..33239e876cb5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap @@ -0,0 +1,93 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultExpressionClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..27 "a" [] [], + }, + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_EXPORT@10..28 + 0: JS_DECORATOR_LIST@10..10 + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@18..28 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@26..27 + 0: JS_REFERENCE_IDENTIFIER@26..27 + 0: IDENT@26..27 "a" [] [] + 2: SEMICOLON@27..28 ";" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_export_default_expression_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ export default a; + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_expression_class.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js.snap new file mode 100644 index 000000000000..82d1e574e566 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js.snap @@ -0,0 +1,403 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = @decorator () => {}; +let b = @first @second function foo() {} +let a = @decorator ( () => {} ) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@0..4 "let" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + EQ@6..8 "=" [] [Whitespace(" ")], + JsBogusExpression { + items: [ + JsDecorator { + at_token: AT@8..9 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..19 "decorator" [] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@19..20 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: missing (required), + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + ], + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@27..28 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsIdentifierBinding { + name_token: IDENT@33..35 "b" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + EQ@35..37 "=" [] [Whitespace(" ")], + JsBogusExpression { + items: [ + JsDecorator { + at_token: AT@37..38 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..44 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@44..45 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..52 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@52..61 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@61..64 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@64..65 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@67..68 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@68..69 "}" [] [], + }, + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@69..74 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@74..76 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + JsDecorator { + at_token: AT@78..79 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@79..89 "decorator" [] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@89..91 "(" [] [Whitespace(" ")], + args: JsCallArgumentList [ + JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@91..92 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@92..94 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@94..97 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@97..98 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@98..100 "}" [] [Whitespace(" ")], + }, + }, + ], + r_paren_token: R_PAREN@100..101 ")" [] [], + }, + }, + }, + ], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@101..102 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..102 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..101 + 0: JS_BOGUS_STATEMENT@0..28 + 0: JS_BOGUS@0..27 + 0: LET_KW@0..4 "let" [] [Whitespace(" ")] + 1: JS_BOGUS@4..27 + 0: JS_BOGUS@4..27 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: JS_BOGUS@6..27 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@8..22 + 0: JS_DECORATOR@8..22 + 0: AT@8..9 "@" [] [] + 1: JS_CALL_EXPRESSION@9..22 + 0: JS_IDENTIFIER_EXPRESSION@9..19 + 0: JS_REFERENCE_IDENTIFIER@9..19 + 0: IDENT@9..19 "decorator" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@19..22 + 0: L_PAREN@19..20 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@20..20 + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 2: JS_ARROW_FUNCTION_EXPRESSION@22..27 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 4: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@25..27 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..26 + 3: R_CURLY@26..27 "}" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_BOGUS_STATEMENT@28..69 + 0: JS_BOGUS@28..69 + 0: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@33..69 + 0: JS_BOGUS@33..69 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "b" [] [Whitespace(" ")] + 1: JS_BOGUS@35..69 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@37..52 + 0: JS_DECORATOR@37..44 + 0: AT@37..38 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@38..44 + 0: JS_REFERENCE_IDENTIFIER@38..44 + 0: IDENT@38..44 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@44..52 + 0: AT@44..45 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@45..52 + 0: JS_REFERENCE_IDENTIFIER@45..52 + 0: IDENT@45..52 "second" [] [Whitespace(" ")] + 2: JS_FUNCTION_EXPRESSION@52..69 + 0: (empty) + 1: FUNCTION_KW@52..61 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@61..64 + 0: IDENT@61..64 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@64..67 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_PARAMETER_LIST@65..65 + 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@67..69 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_DIRECTIVE_LIST@68..68 + 2: JS_STATEMENT_LIST@68..68 + 3: R_CURLY@68..69 "}" [] [] + 2: JS_VARIABLE_STATEMENT@69..101 + 0: JS_VARIABLE_DECLARATION@69..101 + 0: (empty) + 1: LET_KW@69..74 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@74..101 + 0: JS_VARIABLE_DECLARATOR@74..101 + 0: JS_IDENTIFIER_BINDING@74..76 + 0: IDENT@74..76 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@76..101 + 0: EQ@76..78 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@78..101 + 0: JS_DECORATOR@78..101 + 0: AT@78..79 "@" [] [] + 1: JS_CALL_EXPRESSION@79..101 + 0: JS_IDENTIFIER_EXPRESSION@79..89 + 0: JS_REFERENCE_IDENTIFIER@79..89 + 0: IDENT@79..89 "decorator" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@89..101 + 0: L_PAREN@89..91 "(" [] [Whitespace(" ")] + 1: JS_CALL_ARGUMENT_LIST@91..100 + 0: JS_ARROW_FUNCTION_EXPRESSION@91..100 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@91..94 + 0: L_PAREN@91..92 "(" [] [] + 1: JS_PARAMETER_LIST@92..92 + 2: R_PAREN@92..94 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@94..97 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@97..100 + 0: L_CURLY@97..98 "{" [] [] + 1: JS_DIRECTIVE_LIST@98..98 + 2: JS_STATEMENT_LIST@98..98 + 3: R_CURLY@98..100 "}" [] [Whitespace(" ")] + 2: R_PAREN@100..101 ")" [] [] + 1: (empty) + 4: EOF@101..102 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_expression_class.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ let a = @decorator () => {}; + │ ^^^^^^^^^^^^^ + 2 │ let b = @first @second function foo() {} + 3 │ let a = @decorator ( () => {} ) + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_expression_class.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parenthesis '(' but instead found '=>'. + + > 1 │ let a = @decorator () => {}; + │ ^^ + 2 │ let b = @first @second function foo() {} + 3 │ let a = @decorator ( () => {} ) + + i Expected a parenthesis '(' here. + + > 1 │ let a = @decorator () => {}; + │ ^^ + 2 │ let b = @first @second function foo() {} + 3 │ let a = @decorator ( () => {} ) + +decorator_expression_class.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ let a = @decorator () => {}; + > 2 │ let b = @first @second function foo() {} + │ ^^^^^^^^^^^^^^ + 3 │ let a = @decorator ( () => {} ) + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_expression_class.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ let a = @decorator () => {}; + 2 │ let b = @first @second function foo() {} + > 3 │ let a = @decorator ( () => {} ) + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +decorator_expression_class.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found the end of the file. + + 2 │ let b = @first @second function foo() {} + 3 │ let a = @decorator ( () => {} ) + > 4 │ + │ + + i Expected an expression, or an assignment here. + + 2 │ let b = @first @second function foo() {} + 3 │ let a = @decorator ( () => {} ) + > 4 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap new file mode 100644 index 000000000000..65ce36bb9bd2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap @@ -0,0 +1,123 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default function foo() { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@26..35 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@35..38 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_EXPORT@10..44 + 0: JS_DECORATOR_LIST@10..10 + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..44 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@26..44 + 0: (empty) + 1: FUNCTION_KW@26..35 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@35..38 + 0: IDENT@35..38 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@38..41 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..39 + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@41..44 + 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@43..43 + 2: JS_STATEMENT_LIST@43..43 + 3: R_CURLY@43..44 "}" [] [] + 2: (empty) + 4: EOF@44..45 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_function_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ export default function foo() { } + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap new file mode 100644 index 000000000000..e22c9ccbc04e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap @@ -0,0 +1,105 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default interface A { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@26..36 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@36..38 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@41..42 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..42 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..41 + 0: JS_BOGUS_STATEMENT@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: JS_EXPORT@10..41 + 0: JS_DECORATOR_LIST@10..10 + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..41 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@26..41 + 0: INTERFACE_KW@26..36 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@36..38 + 0: IDENT@36..38 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@40..40 + 6: R_CURLY@40..41 "}" [] [] + 2: (empty) + 4: EOF@41..42 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_interface_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ @decorator + │ ^^^^^^^^^^ + 2 │ export default interface A { } + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts.snap new file mode 100644 index 000000000000..e6a212836ee8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts.snap @@ -0,0 +1,757 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Bar { + public @dec get foo() {} + static @dec foo: string; + readonly @dec test() {} + private @dec test() {} + protected @dec test() {} +} +class Qux extends Bar { + public @dec get foo() {} + static @dec foo: string; + readonly @dec test() {} + private @dec test() {} + accessor @dec test() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@11..21 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@21..22 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@22..26 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + GET_KW@26..30 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@30..33 "foo" [] [], + }, + L_PAREN@33..34 "(" [] [], + R_PAREN@34..36 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@36..37 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@38..48 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@48..49 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..53 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@53..56 "foo" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@56..58 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@58..64 "string" [] [], + }, + }, + SEMICOLON@64..65 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsReadonlyModifier { + modifier_token: READONLY_KW@65..77 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@77..78 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..82 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsLiteralMemberName { + value: IDENT@82..86 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@86..87 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@87..89 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@89..90 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@90..91 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@91..102 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@102..103 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@103..107 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@107..111 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@111..112 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@112..114 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@114..115 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@115..116 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@116..129 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@129..130 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@130..134 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@134..138 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@138..139 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@139..141 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@141..142 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@142..143 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@143..145 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@152..156 "Qux" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@156..164 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@164..168 "Bar" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@168..169 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@169..179 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@179..180 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@180..184 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + GET_KW@184..188 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@188..191 "foo" [] [], + }, + L_PAREN@191..192 "(" [] [], + R_PAREN@192..194 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@194..195 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@195..196 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@196..206 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@206..207 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@207..211 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@211..214 "foo" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@214..216 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@216..222 "string" [] [], + }, + }, + SEMICOLON@222..223 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsReadonlyModifier { + modifier_token: READONLY_KW@223..235 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@235..236 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@236..240 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsLiteralMemberName { + value: IDENT@240..244 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@244..245 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@247..248 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@248..249 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@249..260 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@260..261 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@261..265 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@265..269 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@269..270 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@270..272 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@272..273 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@273..274 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@274..286 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsDecorator { + at_token: AT@286..287 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@287..291 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsLiteralMemberName { + value: IDENT@291..295 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@295..296 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@296..298 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@298..299 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@299..300 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@300..302 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@302..303 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..303 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..302 + 0: JS_CLASS_DECLARATION@0..145 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..143 + 0: JS_BOGUS_MEMBER@11..38 + 0: JS_METHOD_MODIFIER_LIST@11..26 + 0: TS_ACCESSIBILITY_MODIFIER@11..21 + 0: PUBLIC_KW@11..21 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@21..26 + 0: AT@21..22 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@22..26 + 0: JS_REFERENCE_IDENTIFIER@22..26 + 0: IDENT@22..26 "dec" [] [Whitespace(" ")] + 1: GET_KW@26..30 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@30..33 + 0: IDENT@30..33 "foo" [] [] + 3: L_PAREN@33..34 "(" [] [] + 4: R_PAREN@34..36 ")" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@36..38 + 0: L_CURLY@36..37 "{" [] [] + 1: JS_DIRECTIVE_LIST@37..37 + 2: JS_STATEMENT_LIST@37..37 + 3: R_CURLY@37..38 "}" [] [] + 1: JS_BOGUS_MEMBER@38..65 + 0: JS_PROPERTY_MODIFIER_LIST@38..53 + 0: JS_STATIC_MODIFIER@38..48 + 0: STATIC_KW@38..48 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@48..53 + 0: AT@48..49 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@49..53 + 0: JS_REFERENCE_IDENTIFIER@49..53 + 0: IDENT@49..53 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@53..56 + 0: IDENT@53..56 "foo" [] [] + 2: TS_TYPE_ANNOTATION@56..64 + 0: COLON@56..58 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@58..64 + 0: STRING_KW@58..64 "string" [] [] + 3: SEMICOLON@64..65 ";" [] [] + 2: JS_BOGUS_MEMBER@65..91 + 0: JS_BOGUS@65..82 + 0: TS_READONLY_MODIFIER@65..77 + 0: READONLY_KW@65..77 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@77..82 + 0: AT@77..78 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@78..82 + 0: JS_REFERENCE_IDENTIFIER@78..82 + 0: IDENT@78..82 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@82..86 + 0: IDENT@82..86 "test" [] [] + 2: JS_PARAMETERS@86..89 + 0: L_PAREN@86..87 "(" [] [] + 1: JS_PARAMETER_LIST@87..87 + 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@89..91 + 0: L_CURLY@89..90 "{" [] [] + 1: JS_DIRECTIVE_LIST@90..90 + 2: JS_STATEMENT_LIST@90..90 + 3: R_CURLY@90..91 "}" [] [] + 3: JS_BOGUS_MEMBER@91..116 + 0: JS_METHOD_MODIFIER_LIST@91..107 + 0: TS_ACCESSIBILITY_MODIFIER@91..102 + 0: PRIVATE_KW@91..102 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@102..107 + 0: AT@102..103 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@103..107 + 0: JS_REFERENCE_IDENTIFIER@103..107 + 0: IDENT@103..107 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@107..111 + 0: IDENT@107..111 "test" [] [] + 2: JS_PARAMETERS@111..114 + 0: L_PAREN@111..112 "(" [] [] + 1: JS_PARAMETER_LIST@112..112 + 2: R_PAREN@112..114 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@114..116 + 0: L_CURLY@114..115 "{" [] [] + 1: JS_DIRECTIVE_LIST@115..115 + 2: JS_STATEMENT_LIST@115..115 + 3: R_CURLY@115..116 "}" [] [] + 4: JS_BOGUS_MEMBER@116..143 + 0: JS_METHOD_MODIFIER_LIST@116..134 + 0: TS_ACCESSIBILITY_MODIFIER@116..129 + 0: PROTECTED_KW@116..129 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@129..134 + 0: AT@129..130 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@130..134 + 0: JS_REFERENCE_IDENTIFIER@130..134 + 0: IDENT@130..134 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@134..138 + 0: IDENT@134..138 "test" [] [] + 2: JS_PARAMETERS@138..141 + 0: L_PAREN@138..139 "(" [] [] + 1: JS_PARAMETER_LIST@139..139 + 2: R_PAREN@139..141 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@141..143 + 0: L_CURLY@141..142 "{" [] [] + 1: JS_DIRECTIVE_LIST@142..142 + 2: JS_STATEMENT_LIST@142..142 + 3: R_CURLY@142..143 "}" [] [] + 9: R_CURLY@143..145 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@145..302 + 0: JS_DECORATOR_LIST@145..145 + 1: (empty) + 2: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@152..156 + 0: IDENT@152..156 "Qux" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@156..168 + 0: EXTENDS_KW@156..164 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@164..168 + 0: JS_REFERENCE_IDENTIFIER@164..168 + 0: IDENT@164..168 "Bar" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@168..169 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@169..300 + 0: JS_BOGUS_MEMBER@169..196 + 0: JS_METHOD_MODIFIER_LIST@169..184 + 0: TS_ACCESSIBILITY_MODIFIER@169..179 + 0: PUBLIC_KW@169..179 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@179..184 + 0: AT@179..180 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@180..184 + 0: JS_REFERENCE_IDENTIFIER@180..184 + 0: IDENT@180..184 "dec" [] [Whitespace(" ")] + 1: GET_KW@184..188 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@188..191 + 0: IDENT@188..191 "foo" [] [] + 3: L_PAREN@191..192 "(" [] [] + 4: R_PAREN@192..194 ")" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@194..196 + 0: L_CURLY@194..195 "{" [] [] + 1: JS_DIRECTIVE_LIST@195..195 + 2: JS_STATEMENT_LIST@195..195 + 3: R_CURLY@195..196 "}" [] [] + 1: JS_BOGUS_MEMBER@196..223 + 0: JS_PROPERTY_MODIFIER_LIST@196..211 + 0: JS_STATIC_MODIFIER@196..206 + 0: STATIC_KW@196..206 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@206..211 + 0: AT@206..207 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@207..211 + 0: JS_REFERENCE_IDENTIFIER@207..211 + 0: IDENT@207..211 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@211..214 + 0: IDENT@211..214 "foo" [] [] + 2: TS_TYPE_ANNOTATION@214..222 + 0: COLON@214..216 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@216..222 + 0: STRING_KW@216..222 "string" [] [] + 3: SEMICOLON@222..223 ";" [] [] + 2: JS_BOGUS_MEMBER@223..249 + 0: JS_BOGUS@223..240 + 0: TS_READONLY_MODIFIER@223..235 + 0: READONLY_KW@223..235 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@235..240 + 0: AT@235..236 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@236..240 + 0: JS_REFERENCE_IDENTIFIER@236..240 + 0: IDENT@236..240 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@240..244 + 0: IDENT@240..244 "test" [] [] + 2: JS_PARAMETERS@244..247 + 0: L_PAREN@244..245 "(" [] [] + 1: JS_PARAMETER_LIST@245..245 + 2: R_PAREN@245..247 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@247..249 + 0: L_CURLY@247..248 "{" [] [] + 1: JS_DIRECTIVE_LIST@248..248 + 2: JS_STATEMENT_LIST@248..248 + 3: R_CURLY@248..249 "}" [] [] + 3: JS_BOGUS_MEMBER@249..274 + 0: JS_METHOD_MODIFIER_LIST@249..265 + 0: TS_ACCESSIBILITY_MODIFIER@249..260 + 0: PRIVATE_KW@249..260 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@260..265 + 0: AT@260..261 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@261..265 + 0: JS_REFERENCE_IDENTIFIER@261..265 + 0: IDENT@261..265 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@265..269 + 0: IDENT@265..269 "test" [] [] + 2: JS_PARAMETERS@269..272 + 0: L_PAREN@269..270 "(" [] [] + 1: JS_PARAMETER_LIST@270..270 + 2: R_PAREN@270..272 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@272..274 + 0: L_CURLY@272..273 "{" [] [] + 1: JS_DIRECTIVE_LIST@273..273 + 2: JS_STATEMENT_LIST@273..273 + 3: R_CURLY@273..274 "}" [] [] + 4: JS_BOGUS_MEMBER@274..300 + 0: JS_BOGUS@274..291 + 0: JS_ACCESSOR_MODIFIER@274..286 + 0: ACCESSOR_KW@274..286 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_DECORATOR@286..291 + 0: AT@286..287 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@287..291 + 0: JS_REFERENCE_IDENTIFIER@287..291 + 0: IDENT@287..291 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@291..295 + 0: IDENT@291..295 "test" [] [] + 2: JS_PARAMETERS@295..298 + 0: L_PAREN@295..296 "(" [] [] + 1: JS_PARAMETER_LIST@296..296 + 2: R_PAREN@296..298 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@298..300 + 0: L_CURLY@298..299 "{" [] [] + 1: JS_DIRECTIVE_LIST@299..299 + 2: JS_STATEMENT_LIST@299..299 + 3: R_CURLY@299..300 "}" [] [] + 9: R_CURLY@300..302 "}" [Newline("\n")] [] + 4: EOF@302..303 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +decorator_precede_class_member.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 1 │ class Bar { + > 2 │ public @dec get foo() {} + │ ^^^^ + 3 │ static @dec foo: string; + 4 │ readonly @dec test() {} + +decorator_precede_class_member.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 1 │ class Bar { + 2 │ public @dec get foo() {} + > 3 │ static @dec foo: string; + │ ^^^^ + 4 │ readonly @dec test() {} + 5 │ private @dec test() {} + +decorator_precede_class_member.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Readonly can only appear on a property declaration or index signature. + + 2 │ public @dec get foo() {} + 3 │ static @dec foo: string; + > 4 │ readonly @dec test() {} + │ ^^^^^^^^ + 5 │ private @dec test() {} + 6 │ protected @dec test() {} + +decorator_precede_class_member.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 2 │ public @dec get foo() {} + 3 │ static @dec foo: string; + > 4 │ readonly @dec test() {} + │ ^^^^ + 5 │ private @dec test() {} + 6 │ protected @dec test() {} + +decorator_precede_class_member.ts:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 3 │ static @dec foo: string; + 4 │ readonly @dec test() {} + > 5 │ private @dec test() {} + │ ^^^^ + 6 │ protected @dec test() {} + 7 │ } + +decorator_precede_class_member.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 4 │ readonly @dec test() {} + 5 │ private @dec test() {} + > 6 │ protected @dec test() {} + │ ^^^^ + 7 │ } + 8 │ class Qux extends Bar { + +decorator_precede_class_member.ts:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 7 │ } + 8 │ class Qux extends Bar { + > 9 │ public @dec get foo() {} + │ ^^^^ + 10 │ static @dec foo: string; + 11 │ readonly @dec test() {} + +decorator_precede_class_member.ts:10:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 8 │ class Qux extends Bar { + 9 │ public @dec get foo() {} + > 10 │ static @dec foo: string; + │ ^^^^ + 11 │ readonly @dec test() {} + 12 │ private @dec test() {} + +decorator_precede_class_member.ts:11:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Readonly can only appear on a property declaration or index signature. + + 9 │ public @dec get foo() {} + 10 │ static @dec foo: string; + > 11 │ readonly @dec test() {} + │ ^^^^^^^^ + 12 │ private @dec test() {} + 13 │ accessor @dec test() {} + +decorator_precede_class_member.ts:11:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 9 │ public @dec get foo() {} + 10 │ static @dec foo: string; + > 11 │ readonly @dec test() {} + │ ^^^^ + 12 │ private @dec test() {} + 13 │ accessor @dec test() {} + +decorator_precede_class_member.ts:12:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 10 │ static @dec foo: string; + 11 │ readonly @dec test() {} + > 12 │ private @dec test() {} + │ ^^^^ + 13 │ accessor @dec test() {} + 14 │ } + +decorator_precede_class_member.ts:13:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' modifier is only allowed on properties. + + 11 │ readonly @dec test() {} + 12 │ private @dec test() {} + > 13 │ accessor @dec test() {} + │ ^^^^^^^^ + 14 │ } + 15 │ + +decorator_precede_class_member.ts:13:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators must precede the name and all keywords of property declarations. + + 11 │ readonly @dec test() {} + 12 │ private @dec test() {} + > 13 │ accessor @dec test() {} + │ ^^^^ + 14 │ } + 15 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.js b/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.js rename to crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js.snap new file mode 100644 index 000000000000..5b6bc366a7a4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js.snap @@ -0,0 +1,364 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do { } break (continue) +do { } continue (break) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsDoWhileStatement { + do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@3..5 "{" [] [Whitespace(" ")], + statements: JsStatementList [], + r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], + }, + while_token: missing (required), + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + BREAK_KW@7..13 "break" [] [Whitespace(" ")], + ], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@13..14 "(" [] [], + expression: missing (required), + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + CONTINUE_KW@14..22 "continue" [] [], + ], + }, + JsBogusStatement { + items: [ + R_PAREN@22..23 ")" [] [], + ], + }, + JsDoWhileStatement { + do_token: DO_KW@23..27 "do" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..31 "}" [] [Whitespace(" ")], + }, + while_token: missing (required), + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + CONTINUE_KW@31..40 "continue" [] [Whitespace(" ")], + ], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@40..41 "(" [] [], + expression: missing (required), + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + BREAK_KW@41..46 "break" [] [], + ], + }, + JsBogusStatement { + items: [ + R_PAREN@46..47 ")" [] [], + ], + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_DO_WHILE_STATEMENT@0..7 + 0: DO_KW@0..3 "do" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@3..7 + 0: L_CURLY@3..5 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@5..5 + 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 1: JS_BOGUS_STATEMENT@7..13 + 0: BREAK_KW@7..13 "break" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@13..14 + 0: JS_PARENTHESIZED_EXPRESSION@13..14 + 0: L_PAREN@13..14 "(" [] [] + 1: (empty) + 2: (empty) + 1: (empty) + 3: JS_BOGUS_STATEMENT@14..22 + 0: CONTINUE_KW@14..22 "continue" [] [] + 4: JS_BOGUS_STATEMENT@22..23 + 0: R_PAREN@22..23 ")" [] [] + 5: JS_DO_WHILE_STATEMENT@23..31 + 0: DO_KW@23..27 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@27..31 + 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@29..29 + 2: R_CURLY@29..31 "}" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 6: JS_BOGUS_STATEMENT@31..40 + 0: CONTINUE_KW@31..40 "continue" [] [Whitespace(" ")] + 7: JS_EXPRESSION_STATEMENT@40..41 + 0: JS_PARENTHESIZED_EXPRESSION@40..41 + 0: L_PAREN@40..41 "(" [] [] + 1: (empty) + 2: (empty) + 1: (empty) + 8: JS_BOGUS_STATEMENT@41..46 + 0: BREAK_KW@41..46 "break" [] [] + 9: JS_BOGUS_STATEMENT@46..47 + 0: R_PAREN@46..47 ")" [] [] + 4: EOF@47..48 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `while` but instead found `break` + + > 1 │ do { } break (continue) + │ ^^^^^ + 2 │ do { } continue (break) + 3 │ + + i Remove break + +do_while_no_continue_break.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ + + i An explicit or implicit semicolon is expected here... + + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ + + i ...Which is required to end this statement + + > 1 │ do { } break (continue) + │ ^^^^^^^ + 2 │ do { } continue (break) + 3 │ + +do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `break` statement can only be used within an enclosing iteration or switch statement. + + > 1 │ do { } break (continue) + │ ^^^^^ + 2 │ do { } continue (break) + 3 │ + +do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `continue` + + > 1 │ do { } break (continue) + │ ^^^^^^^^ + 2 │ do { } continue (break) + 3 │ + + i Remove continue + +do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ + + i An explicit or implicit semicolon is expected here... + + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ + + i ...Which is required to end this statement + + > 1 │ do { } break (continue) + │ ^^^^^^^^^ + 2 │ do { } continue (break) + 3 │ + +do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. + + > 1 │ do { } break (continue) + │ ^^^^^^^^ + 2 │ do { } continue (break) + 3 │ + +do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found ')'. + + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ + + i Expected a statement here. + + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ + +do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `while` but instead found `continue` + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^^^ + 3 │ + + i Remove continue + +do_while_no_continue_break.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ + + i ...Which is required to end this statement + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^^^^^ + 3 │ + +do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^^^ + 3 │ + +do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `break` + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^ + 3 │ + + i Remove break + +do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ + + i ...Which is required to end this statement + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^ + 3 │ + +do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A `break` statement can only be used within an enclosing iteration or switch statement. + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^ + 3 │ + +do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found ')'. + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ + + i Expected a statement here. + + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js.snap new file mode 100644 index 000000000000..5129218924ea --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js.snap @@ -0,0 +1,175 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do while (true) +do while () +do while true + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsDoWhileStatement { + do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], + body: JsWhileStatement { + while_token: WHILE_KW@3..9 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@9..10 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@10..14 "true" [] [], + }, + r_paren_token: R_PAREN@14..15 ")" [] [], + body: JsDoWhileStatement { + do_token: DO_KW@15..19 "do" [Newline("\n")] [Whitespace(" ")], + body: JsWhileStatement { + while_token: WHILE_KW@19..25 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@25..26 "(" [] [], + test: missing (required), + r_paren_token: R_PAREN@26..27 ")" [] [], + body: JsDoWhileStatement { + do_token: DO_KW@27..31 "do" [Newline("\n")] [Whitespace(" ")], + body: JsWhileStatement { + while_token: WHILE_KW@31..37 "while" [] [Whitespace(" ")], + l_paren_token: missing (required), + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@37..41 "true" [] [], + }, + r_paren_token: missing (required), + body: missing (required), + }, + while_token: missing (required), + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + semicolon_token: missing (optional), + }, + }, + while_token: missing (required), + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + semicolon_token: missing (optional), + }, + }, + while_token: missing (required), + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@41..42 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..42 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..41 + 0: JS_DO_WHILE_STATEMENT@0..41 + 0: DO_KW@0..3 "do" [] [Whitespace(" ")] + 1: JS_WHILE_STATEMENT@3..41 + 0: WHILE_KW@3..9 "while" [] [Whitespace(" ")] + 1: L_PAREN@9..10 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@10..14 + 0: TRUE_KW@10..14 "true" [] [] + 3: R_PAREN@14..15 ")" [] [] + 4: JS_DO_WHILE_STATEMENT@15..41 + 0: DO_KW@15..19 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_WHILE_STATEMENT@19..41 + 0: WHILE_KW@19..25 "while" [] [Whitespace(" ")] + 1: L_PAREN@25..26 "(" [] [] + 2: (empty) + 3: R_PAREN@26..27 ")" [] [] + 4: JS_DO_WHILE_STATEMENT@27..41 + 0: DO_KW@27..31 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_WHILE_STATEMENT@31..41 + 0: WHILE_KW@31..37 "while" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BOOLEAN_LITERAL_EXPRESSION@37..41 + 0: TRUE_KW@37..41 "true" [] [] + 3: (empty) + 4: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 4: EOF@41..42 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +do_while_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ')'. + + 1 │ do while (true) + > 2 │ do while () + │ ^ + 3 │ do while true + 4 │ + + i Expected an expression here. + + 1 │ do while (true) + > 2 │ do while () + │ ^ + 3 │ do while true + 4 │ + +do_while_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `true` + + 1 │ do while (true) + 2 │ do while () + > 3 │ do while true + │ ^^^^ + 4 │ + + i Remove true + +do_while_stmt_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead the file ends + + 2 │ do while () + 3 │ do while true + > 4 │ + │ + + i the file ends here + + 2 │ do while () + 3 │ do while true + > 4 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/double_label.js b/crates/biome_js_parser/tests/js_test_suite/error/double_label.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/double_label.js rename to crates/biome_js_parser/tests/js_test_suite/error/double_label.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/double_label.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/double_label.js.snap new file mode 100644 index 000000000000..91b1bfa9f8d4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/double_label.js.snap @@ -0,0 +1,131 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +label1: { + label2: { + label1: {} + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..6 "label1" [] [], + }, + colon_token: COLON@6..8 ":" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@8..9 "{" [] [], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@9..18 "label2" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@20..21 "{" [] [], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@21..32 "label1" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@34..35 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@35..36 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@36..40 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@40..42 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@42..43 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..43 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..42 + 0: JS_LABELED_STATEMENT@0..42 + 0: JS_LABEL@0..6 + 0: IDENT@0..6 "label1" [] [] + 1: COLON@6..8 ":" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@8..42 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_STATEMENT_LIST@9..40 + 0: JS_LABELED_STATEMENT@9..40 + 0: JS_LABEL@9..18 + 0: IDENT@9..18 "label2" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@18..20 ":" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@20..40 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_STATEMENT_LIST@21..36 + 0: JS_LABELED_STATEMENT@21..36 + 0: JS_LABEL@21..32 + 0: IDENT@21..32 "label1" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@32..34 ":" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@34..36 + 0: L_CURLY@34..35 "{" [] [] + 1: JS_STATEMENT_LIST@35..35 + 2: R_CURLY@35..36 "}" [] [] + 2: R_CURLY@36..40 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@40..42 "}" [Newline("\n")] [] + 4: EOF@42..43 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +double_label.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Duplicate statement labels are not allowed + + 1 │ label1: { + 2 │ label2: { + > 3 │ label1: {} + │ ^^^^^^ + 4 │ } + 5 │ } + + i a second use of `label1` here is not allowed + + 1 │ label1: { + 2 │ label2: { + > 3 │ label1: {} + │ ^^^^^^ + 4 │ } + 5 │ } + + i `label1` is first used as a label here + + > 1 │ label1: { + │ ^^^^^^ + 2 │ label2: { + 3 │ label1: {} + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.js b/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.js rename to crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js.snap new file mode 100644 index 000000000000..92f504a375f8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js.snap @@ -0,0 +1,65 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: missing (required), + r_paren_token: R_PAREN@1..2 ")" [] [], + }, + semicolon_token: SEMICOLON@2..3 ";" [] [], + }, + ], + eof_token: EOF@3..4 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..4 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..3 + 0: JS_EXPRESSION_STATEMENT@0..3 + 0: JS_PARENTHESIZED_EXPRESSION@0..2 + 0: L_PAREN@0..1 "(" [] [] + 1: (empty) + 2: R_PAREN@1..2 ")" [] [] + 1: SEMICOLON@2..3 ";" [] [] + 4: EOF@3..4 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +empty_parenthesized_expression.js:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parenthesized expression didnt contain anything + + > 1 │ (); + │ ^ + 2 │ + + i Expected an expression here + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.ts b/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.ts rename to crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts.snap new file mode 100644 index 000000000000..165729de8259 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts.snap @@ -0,0 +1,165 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum {A,B,C} +enum 1 {A,B,C} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], + id: missing (required), + l_curly_token: L_CURLY@5..6 "{" [] [], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@6..7 "A" [] [], + }, + initializer: missing (optional), + }, + COMMA@7..8 "," [] [], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@8..9 "B" [] [], + }, + initializer: missing (optional), + }, + COMMA@9..10 "," [] [], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@10..11 "C" [] [], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@11..12 "}" [] [], + }, + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@12..18 "enum" [Newline("\n")] [Whitespace(" ")], + id: JsBogusBinding { + items: [ + JS_NUMBER_LITERAL@18..20 "1" [] [Whitespace(" ")], + ], + }, + l_curly_token: L_CURLY@20..21 "{" [] [], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@21..22 "A" [] [], + }, + initializer: missing (optional), + }, + COMMA@22..23 "," [] [], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@23..24 "B" [] [], + }, + initializer: missing (optional), + }, + COMMA@24..25 "," [] [], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@25..26 "C" [] [], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: TS_ENUM_DECLARATION@0..12 + 0: (empty) + 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] + 2: (empty) + 3: L_CURLY@5..6 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@6..11 + 0: TS_ENUM_MEMBER@6..7 + 0: TS_LITERAL_ENUM_MEMBER_NAME@6..7 + 0: IDENT@6..7 "A" [] [] + 1: (empty) + 1: COMMA@7..8 "," [] [] + 2: TS_ENUM_MEMBER@8..9 + 0: TS_LITERAL_ENUM_MEMBER_NAME@8..9 + 0: IDENT@8..9 "B" [] [] + 1: (empty) + 3: COMMA@9..10 "," [] [] + 4: TS_ENUM_MEMBER@10..11 + 0: TS_LITERAL_ENUM_MEMBER_NAME@10..11 + 0: IDENT@10..11 "C" [] [] + 1: (empty) + 5: R_CURLY@11..12 "}" [] [] + 1: TS_ENUM_DECLARATION@12..27 + 0: (empty) + 1: ENUM_KW@12..18 "enum" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS_BINDING@18..20 + 0: JS_NUMBER_LITERAL@18..20 "1" [] [Whitespace(" ")] + 3: L_CURLY@20..21 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@21..26 + 0: TS_ENUM_MEMBER@21..22 + 0: TS_LITERAL_ENUM_MEMBER_NAME@21..22 + 0: IDENT@21..22 "A" [] [] + 1: (empty) + 1: COMMA@22..23 "," [] [] + 2: TS_ENUM_MEMBER@23..24 + 0: TS_LITERAL_ENUM_MEMBER_NAME@23..24 + 0: IDENT@23..24 "B" [] [] + 1: (empty) + 3: COMMA@24..25 "," [] [] + 4: TS_ENUM_MEMBER@25..26 + 0: TS_LITERAL_ENUM_MEMBER_NAME@25..26 + 0: IDENT@25..26 "C" [] [] + 1: (empty) + 5: R_CURLY@26..27 "}" [] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +enum_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `enum` statements must have a name + + > 1 │ enum {A,B,C} + │ ^^^^^ + 2 │ enum 1 {A,B,C} + 3 │ + +enum_decl_no_id.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × invalid `enum` name + + 1 │ enum {A,B,C} + > 2 │ enum 1 {A,B,C} + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js.snap new file mode 100644 index 000000000000..98ee6cc68eb6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js.snap @@ -0,0 +1,69 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +enum A {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + ENUM_KW@0..5 "enum" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + L_CURLY@7..8 "{" [] [], + TsEnumMemberList [], + R_CURLY@8..9 "}" [] [], + ], + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_BOGUS_STATEMENT@0..9 + 0: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: L_CURLY@7..8 "{" [] [] + 3: TS_ENUM_MEMBER_LIST@8..8 + 4: R_CURLY@8..9 "}" [] [] + 4: EOF@9..10 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +enum_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + > 1 │ enum A {} + │ ^^^^^^^^^ + 2 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.ts b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.ts rename to crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts.snap new file mode 100644 index 000000000000..1f212591729f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts.snap @@ -0,0 +1,116 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum; +enum A; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@0..4 "enum" [] [], + id: missing (required), + l_curly_token: missing (required), + members: TsEnumMemberList [], + r_curly_token: missing (required), + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@4..5 ";" [] [], + }, + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@5..11 "enum" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@11..12 "A" [] [], + }, + l_curly_token: missing (required), + members: TsEnumMemberList [], + r_curly_token: missing (required), + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: TS_ENUM_DECLARATION@0..4 + 0: (empty) + 1: ENUM_KW@0..4 "enum" [] [] + 2: (empty) + 3: (empty) + 4: TS_ENUM_MEMBER_LIST@4..4 + 5: (empty) + 1: JS_EMPTY_STATEMENT@4..5 + 0: SEMICOLON@4..5 ";" [] [] + 2: TS_ENUM_DECLARATION@5..12 + 0: (empty) + 1: ENUM_KW@5..11 "enum" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@11..12 + 0: IDENT@11..12 "A" [] [] + 3: (empty) + 4: TS_ENUM_MEMBER_LIST@12..12 + 5: (empty) + 3: JS_EMPTY_STATEMENT@12..13 + 0: SEMICOLON@12..13 ";" [] [] + 4: EOF@13..14 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +enum_no_l_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `enum` statements must have a name + + > 1 │ enum; + │ ^^^^ + 2 │ enum A; + 3 │ + +enum_no_l_curly.ts:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `;` + + > 1 │ enum; + │ ^ + 2 │ enum A; + 3 │ + + i Remove ; + +enum_no_l_curly.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `;` + + 1 │ enum; + > 2 │ enum A; + │ ^ + 3 │ + + i Remove ; + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.ts b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.ts rename to crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts.snap new file mode 100644 index 000000000000..50fae93f5411 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts.snap @@ -0,0 +1,126 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum {; +enum A {; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], + id: missing (required), + l_curly_token: L_CURLY@5..6 "{" [] [], + members: TsEnumMemberList [], + r_curly_token: missing (required), + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@6..7 ";" [] [], + }, + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@7..13 "enum" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@13..15 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@15..16 "{" [] [], + members: TsEnumMemberList [], + r_curly_token: missing (required), + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: TS_ENUM_DECLARATION@0..6 + 0: (empty) + 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] + 2: (empty) + 3: L_CURLY@5..6 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@6..6 + 5: (empty) + 1: JS_EMPTY_STATEMENT@6..7 + 0: SEMICOLON@6..7 ";" [] [] + 2: TS_ENUM_DECLARATION@7..16 + 0: (empty) + 1: ENUM_KW@7..13 "enum" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@13..15 + 0: IDENT@13..15 "A" [] [Whitespace(" ")] + 3: L_CURLY@15..16 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@16..16 + 5: (empty) + 3: JS_EMPTY_STATEMENT@16..17 + 0: SEMICOLON@16..17 ";" [] [] + 4: EOF@17..18 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +enum_no_r_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `enum` statements must have a name + + > 1 │ enum {; + │ ^^^^^ + 2 │ enum A {; + 3 │ + +enum_no_r_curly.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, or a computed name but instead found ';'. + + > 1 │ enum {; + │ ^ + 2 │ enum A {; + 3 │ + + i Expected an identifier, a string literal, or a computed name here. + + > 1 │ enum {; + │ ^ + 2 │ enum A {; + 3 │ + +enum_no_r_curly.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, or a computed name but instead found ';'. + + 1 │ enum {; + > 2 │ enum A {; + │ ^ + 3 │ + + i Expected an identifier, a string literal, or a computed name here. + + 1 │ enum {; + > 2 │ enum A {; + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/escaped_from.js b/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/escaped_from.js rename to crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js.snap new file mode 100644 index 000000000000..922720f3f5d5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js.snap @@ -0,0 +1,78 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export {} \u0066rom "./escaped-from.js"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@7..8 "{" [] [], + JsExportNamedFromSpecifierList [], + R_CURLY@8..10 "}" [] [Whitespace(" ")], + ERROR_TOKEN@10..20 "\\u0066rom" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@20..39 "\"./escaped-from.js\"" [] [], + }, + SEMICOLON@39..40 ";" [] [], + ], + }, + ], + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: JS_BOGUS_STATEMENT@0..40 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_BOGUS@7..40 + 0: L_CURLY@7..8 "{" [] [] + 1: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@8..8 + 2: R_CURLY@8..10 "}" [] [Whitespace(" ")] + 3: ERROR_TOKEN@10..20 "\\u0066rom" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@20..39 + 0: JS_STRING_LITERAL@20..39 "\"./escaped-from.js\"" [] [] + 5: SEMICOLON@39..40 ";" [] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +escaped_from.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'from' keyword cannot contain escape character. + + > 1 │ export {} \u0066rom "./escaped-from.js"; + │ ^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.js b/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js.snap new file mode 100644 index 000000000000..3721e4e50733 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js.snap @@ -0,0 +1,104 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +eval = "test"; +arguments = "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@0..5 "eval" [] [Whitespace(" ")], + ], + }, + operator_token: EQ@5..7 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@7..13 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + IDENT@14..25 "arguments" [Newline("\n")] [Whitespace(" ")], + ], + }, + operator_token: EQ@25..27 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@27..33 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_ASSIGNMENT_EXPRESSION@0..13 + 0: JS_BOGUS_ASSIGNMENT@0..5 + 0: IDENT@0..5 "eval" [] [Whitespace(" ")] + 1: EQ@5..7 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@7..13 + 0: JS_STRING_LITERAL@7..13 "\"test\"" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..34 + 0: JS_ASSIGNMENT_EXPRESSION@14..33 + 0: JS_BOGUS_ASSIGNMENT@14..25 + 0: IDENT@14..25 "arguments" [Newline("\n")] [Whitespace(" ")] + 1: EQ@25..27 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@27..33 + 0: JS_STRING_LITERAL@27..33 "\"test\"" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +eval_arguments_assignment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + > 1 │ eval = "test"; + │ ^^^^ + 2 │ arguments = "test"; + 3 │ + +eval_arguments_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `arguments` as an identifier in strict mode + + 1 │ eval = "test"; + > 2 │ arguments = "test"; + │ ^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.js b/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.js rename to crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap new file mode 100644 index 000000000000..86f07880205c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap @@ -0,0 +1,446 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete a.b ** 2; +void ident ** 2; +typeof ident ** 2; +-3 ** 2; ++3 ** 2; +~3 ** 2; +!true ** 2; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: DELETE_KW@0..7 "delete" [] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..8 "a" [] [], + }, + }, + operator_token: DOT@8..9 "." [] [], + member: JsName { + value_token: IDENT@9..11 "b" [] [Whitespace(" ")], + }, + }, + }, + STAR2@11..14 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@14..15 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: VOID_KW@16..22 "void" [Newline("\n")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@22..28 "ident" [] [Whitespace(" ")], + }, + }, + }, + STAR2@28..31 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@31..32 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: TYPEOF_KW@33..41 "typeof" [Newline("\n")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..47 "ident" [] [Whitespace(" ")], + }, + }, + }, + STAR2@47..50 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@50..51 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@51..52 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: MINUS@52..54 "-" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@54..56 "3" [] [Whitespace(" ")], + }, + }, + STAR2@56..59 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@59..60 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: PLUS@61..63 "+" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@63..65 "3" [] [Whitespace(" ")], + }, + }, + STAR2@65..68 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@68..69 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: TILDE@70..72 "~" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@72..74 "3" [] [Whitespace(" ")], + }, + }, + STAR2@74..77 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@77..78 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@78..79 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsUnaryExpression { + operator_token: BANG@79..81 "!" [Newline("\n")] [], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@81..86 "true" [] [Whitespace(" ")], + }, + }, + STAR2@86..89 "**" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@89..90 "2" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@90..91 ";" [] [], + }, + ], + eof_token: EOF@91..92 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..92 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..91 + 0: JS_EXPRESSION_STATEMENT@0..16 + 0: JS_BOGUS_EXPRESSION@0..15 + 0: JS_UNARY_EXPRESSION@0..11 + 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@7..11 + 0: JS_IDENTIFIER_EXPRESSION@7..8 + 0: JS_REFERENCE_IDENTIFIER@7..8 + 0: IDENT@7..8 "a" [] [] + 1: DOT@8..9 "." [] [] + 2: JS_NAME@9..11 + 0: IDENT@9..11 "b" [] [Whitespace(" ")] + 1: STAR2@11..14 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@14..15 + 0: JS_NUMBER_LITERAL@14..15 "2" [] [] + 1: SEMICOLON@15..16 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@16..33 + 0: JS_BOGUS_EXPRESSION@16..32 + 0: JS_UNARY_EXPRESSION@16..28 + 0: VOID_KW@16..22 "void" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@22..28 + 0: JS_REFERENCE_IDENTIFIER@22..28 + 0: IDENT@22..28 "ident" [] [Whitespace(" ")] + 1: STAR2@28..31 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@31..32 + 0: JS_NUMBER_LITERAL@31..32 "2" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..52 + 0: JS_BOGUS_EXPRESSION@33..51 + 0: JS_UNARY_EXPRESSION@33..47 + 0: TYPEOF_KW@33..41 "typeof" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@41..47 + 0: JS_REFERENCE_IDENTIFIER@41..47 + 0: IDENT@41..47 "ident" [] [Whitespace(" ")] + 1: STAR2@47..50 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@50..51 + 0: JS_NUMBER_LITERAL@50..51 "2" [] [] + 1: SEMICOLON@51..52 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@52..61 + 0: JS_BOGUS_EXPRESSION@52..60 + 0: JS_UNARY_EXPRESSION@52..56 + 0: MINUS@52..54 "-" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@54..56 + 0: JS_NUMBER_LITERAL@54..56 "3" [] [Whitespace(" ")] + 1: STAR2@56..59 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@59..60 + 0: JS_NUMBER_LITERAL@59..60 "2" [] [] + 1: SEMICOLON@60..61 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@61..70 + 0: JS_BOGUS_EXPRESSION@61..69 + 0: JS_UNARY_EXPRESSION@61..65 + 0: PLUS@61..63 "+" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@63..65 + 0: JS_NUMBER_LITERAL@63..65 "3" [] [Whitespace(" ")] + 1: STAR2@65..68 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@68..69 + 0: JS_NUMBER_LITERAL@68..69 "2" [] [] + 1: SEMICOLON@69..70 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@70..79 + 0: JS_BOGUS_EXPRESSION@70..78 + 0: JS_UNARY_EXPRESSION@70..74 + 0: TILDE@70..72 "~" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@72..74 + 0: JS_NUMBER_LITERAL@72..74 "3" [] [Whitespace(" ")] + 1: STAR2@74..77 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@77..78 + 0: JS_NUMBER_LITERAL@77..78 "2" [] [] + 1: SEMICOLON@78..79 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@79..91 + 0: JS_BOGUS_EXPRESSION@79..90 + 0: JS_UNARY_EXPRESSION@79..86 + 0: BANG@79..81 "!" [Newline("\n")] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@81..86 + 0: TRUE_KW@81..86 "true" [] [Whitespace(" ")] + 1: STAR2@86..89 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@89..90 + 0: JS_NUMBER_LITERAL@89..90 "2" [] [] + 1: SEMICOLON@90..91 ";" [] [] + 4: EOF@91..92 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +exponent_unary_unparenthesized.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + > 1 │ delete a.b ** 2; + │ ^^^^^^^^^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + + i The operation + + > 1 │ delete a.b ** 2; + │ ^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + + i The left-hand side + + > 1 │ delete a.b ** 2; + │ ^^^^^^^^^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + +exponent_unary_unparenthesized.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + 1 │ delete a.b ** 2; + > 2 │ void ident ** 2; + │ ^^^^^^^^^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + + i The operation + + 1 │ delete a.b ** 2; + > 2 │ void ident ** 2; + │ ^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + + i The left-hand side + + 1 │ delete a.b ** 2; + > 2 │ void ident ** 2; + │ ^^^^^^^^^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + +exponent_unary_unparenthesized.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + 1 │ delete a.b ** 2; + 2 │ void ident ** 2; + > 3 │ typeof ident ** 2; + │ ^^^^^^^^^^^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; + + i The operation + + 1 │ delete a.b ** 2; + 2 │ void ident ** 2; + > 3 │ typeof ident ** 2; + │ ^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; + + i The left-hand side + + 1 │ delete a.b ** 2; + 2 │ void ident ** 2; + > 3 │ typeof ident ** 2; + │ ^^^^^^^^^^^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; + +exponent_unary_unparenthesized.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + > 4 │ -3 ** 2; + │ ^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + + i The operation + + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + > 4 │ -3 ** 2; + │ ^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + + i The left-hand side + + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + > 4 │ -3 ** 2; + │ ^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + +exponent_unary_unparenthesized.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + > 5 │ +3 ** 2; + │ ^^ + 6 │ ~3 ** 2; + 7 │ !true ** 2; + + i The operation + + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + > 5 │ +3 ** 2; + │ ^^ + 6 │ ~3 ** 2; + 7 │ !true ** 2; + + i The left-hand side + + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + > 5 │ +3 ** 2; + │ ^^ + 6 │ ~3 ** 2; + 7 │ !true ** 2; + +exponent_unary_unparenthesized.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + 4 │ -3 ** 2; + 5 │ +3 ** 2; + > 6 │ ~3 ** 2; + │ ^^ + 7 │ !true ** 2; + 8 │ + + i The operation + + 4 │ -3 ** 2; + 5 │ +3 ** 2; + > 6 │ ~3 ** 2; + │ ^^ + 7 │ !true ** 2; + 8 │ + + i The left-hand side + + 4 │ -3 ** 2; + 5 │ +3 ** 2; + > 6 │ ~3 ** 2; + │ ^^ + 7 │ !true ** 2; + 8 │ + +exponent_unary_unparenthesized.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unparenthesized unary expression can't appear on the left-hand side of '**' + + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + > 7 │ !true ** 2; + │ ^^^^^ + 8 │ + + i The operation + + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + > 7 │ !true ** 2; + │ ^^ + 8 │ + + i The left-hand side + + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + > 7 │ !true ** 2; + │ ^^^^^ + 8 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js.snap new file mode 100644 index 000000000000..53e4fc8bd2d1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js.snap @@ -0,0 +1,90 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { as c } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: missing (required), + as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@12..14 "c" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@14..15 "}" [] [], + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@15..16 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..16 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..15 + 0: JS_EXPORT@0..15 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@7..15 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..14 + 0: JS_EXPORT_NAMED_SPECIFIER@9..14 + 0: (empty) + 1: (empty) + 2: AS_KW@9..12 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@12..14 + 0: IDENT@12..14 "c" [] [Whitespace(" ")] + 3: R_CURLY@14..15 "}" [] [] + 4: (empty) + 4: EOF@15..16 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found ''. + + > 1 │ export { as c } + │ + 2 │ + + i Expected an identifier here. + + > 1 │ export { as c } + │ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.js b/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js.snap new file mode 100644 index 000000000000..dabb12e885bc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js.snap @@ -0,0 +1,109 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ + export { pain } from "life"; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBlockStatement { + l_curly_token: L_CURLY@0..1 "{" [] [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@1..10 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@10..12 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@12..17 "pain" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], + from_token: FROM_KW@19..24 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@24..30 "\"life\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@31..33 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@33..34 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..34 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..33 + 0: JS_BLOCK_STATEMENT@0..33 + 0: L_CURLY@0..1 "{" [] [] + 1: JS_STATEMENT_LIST@1..31 + 0: JS_BOGUS_STATEMENT@1..31 + 0: JS_DECORATOR_LIST@1..1 + 1: EXPORT_KW@1..10 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@10..31 + 0: (empty) + 1: L_CURLY@10..12 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@12..17 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@12..17 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@12..17 + 0: IDENT@12..17 "pain" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@17..19 "}" [] [Whitespace(" ")] + 4: FROM_KW@19..24 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@24..30 + 0: JS_STRING_LITERAL@24..30 "\"life\"" [] [] + 6: (empty) + 7: SEMICOLON@30..31 ";" [] [] + 2: R_CURLY@31..33 "}" [Newline("\n")] [] + 4: EOF@33..34 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of an export declaration not at the top level + + 1 │ { + > 2 │ export { pain } from "life"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ } + 4 │ + + i move this declaration to the top level + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.js b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js.snap new file mode 100644 index 000000000000..852ef95df5d2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js.snap @@ -0,0 +1,223 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default ; +export default @decorator +export default +export default @decorator + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")], + DEFAULT_KW@24..32 "default" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@32..33 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..42 "decorator" [] [], + }, + }, + }, + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")], + DEFAULT_KW@50..57 "default" [] [], + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")], + DEFAULT_KW@65..73 "default" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@73..74 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..83 "decorator" [] [], + }, + }, + }, + ], + }, + ], + }, + ], + eof_token: EOF@83..84 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..84 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..83 + 0: JS_BOGUS_STATEMENT@0..15 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_EMPTY_STATEMENT@15..16 + 0: SEMICOLON@15..16 ";" [] [] + 2: JS_BOGUS_STATEMENT@16..42 + 0: JS_DECORATOR_LIST@16..16 + 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] + 2: DEFAULT_KW@24..32 "default" [] [Whitespace(" ")] + 3: JS_BOGUS_STATEMENT@32..42 + 0: JS_DECORATOR@32..42 + 0: AT@32..33 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@33..42 + 0: JS_REFERENCE_IDENTIFIER@33..42 + 0: IDENT@33..42 "decorator" [] [] + 3: JS_BOGUS_STATEMENT@42..57 + 0: JS_DECORATOR_LIST@42..42 + 1: EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")] + 2: DEFAULT_KW@50..57 "default" [] [] + 4: JS_BOGUS_STATEMENT@57..83 + 0: JS_DECORATOR_LIST@57..57 + 1: EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")] + 2: DEFAULT_KW@65..73 "default" [] [Whitespace(" ")] + 3: JS_BOGUS_STATEMENT@73..83 + 0: JS_DECORATOR@73..83 + 0: AT@73..74 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@74..83 + 0: JS_REFERENCE_IDENTIFIER@74..83 + 0: IDENT@74..83 "decorator" [] [] + 4: EOF@83..84 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_default_expression_broken.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found ';'. + + > 1 │ export default ; + │ ^ + 2 │ export default @decorator + 3 │ export default + + i Expected a class, a function, or a variable declaration here. + + > 1 │ export default ; + │ ^ + 2 │ export default @decorator + 3 │ export default + +export_default_expression_broken.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ export default ; + > 2 │ export default @decorator + │ ^^^^^^^^^^ + 3 │ export default + 4 │ export default @decorator + + i Decorators are only valid on class declarations, class expressions, and class methods. + +export_default_expression_broken.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found 'export'. + + 1 │ export default ; + 2 │ export default @decorator + > 3 │ export default + │ ^^^^^^ + 4 │ export default @decorator + 5 │ + + i Expected a class, a function, or a variable declaration here. + + 1 │ export default ; + 2 │ export default @decorator + > 3 │ export default + │ ^^^^^^ + 4 │ export default @decorator + 5 │ + +export_default_expression_broken.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found 'export'. + + 2 │ export default @decorator + 3 │ export default + > 4 │ export default @decorator + │ ^^^^^^ + 5 │ + + i Expected a class, a function, or a variable declaration here. + + 2 │ export default @decorator + 3 │ export default + > 4 │ export default @decorator + │ ^^^^^^ + 5 │ + +export_default_expression_broken.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ export default @decorator + 3 │ export default + > 4 │ export default @decorator + │ ^^^^^^^^^^ + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +export_default_expression_broken.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found the end of the file. + + 3 │ export default + 4 │ export default @decorator + > 5 │ + │ + + i Expected a class, a function, or a variable declaration here. + + 3 │ export default + 4 │ export default @decorator + > 5 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js.snap new file mode 100644 index 000000000000..4ab6041e0d69 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js.snap @@ -0,0 +1,97 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default a, b; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultExpressionClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "a" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + JsBogusStatement { + items: [ + COMMA@16..18 "," [] [Whitespace(" ")], + IDENT@18..19 "b" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_EXPORT@0..16 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@7..16 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "a" [] [] + 2: (empty) + 1: JS_BOGUS_STATEMENT@16..19 + 0: COMMA@16..18 "," [] [Whitespace(" ")] + 1: IDENT@18..19 "b" [] [] + 2: JS_EMPTY_STATEMENT@19..20 + 0: SEMICOLON@19..20 ";" [] [] + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_default_expression_clause_err.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ export default a, b; + │ ^ + 2 │ + + i An explicit or implicit semicolon is expected here... + + > 1 │ export default a, b; + │ ^ + 2 │ + + i ...Which is required to end this statement + + > 1 │ export default a, b; + │ ^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_err.js.snap new file mode 100644 index 000000000000..5c1a4f6de652 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_err.js.snap @@ -0,0 +1,64 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..6 "export" [] [], + export_clause: missing (required), + }, + ], + eof_token: EOF@6..7 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..7 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..6 + 0: JS_EXPORT@0..6 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..6 "export" [] [] + 2: (empty) + 4: EOF@6..7 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found the end of the file. + + 1 │ export + > 2 │ + │ + + i Expected a class, a function, or a variable declaration here. + + 1 │ export + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_from_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js.snap new file mode 100644 index 000000000000..bbf88455e063 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js.snap @@ -0,0 +1,412 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export *; +export * from 5; +export as from "test"; +export from "test"; +export type *; +export type * from; +export type * as from; +export type * as ns from; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: STAR@7..8 "*" [] [], + export_as: missing (optional), + from_token: missing (required), + source: missing (required), + assertion: missing (optional), + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@9..17 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: STAR@17..19 "*" [] [Whitespace(" ")], + export_as: missing (optional), + from_token: FROM_KW@19..24 "from" [] [Whitespace(" ")], + source: missing (required), + assertion: missing (optional), + semicolon_token: missing (optional), + }, + }, + JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@24..25 "5" [] [], + }, + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: missing (required), + export_as: JsExportAsClause { + as_token: AS_KW@34..37 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@37..42 "from" [] [Whitespace(" ")], + }, + }, + from_token: missing (required), + source: JsModuleSource { + value_token: JS_STRING_LITERAL@42..48 "\"test\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@48..49 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@49..57 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: missing (required), + export_as: missing (optional), + from_token: FROM_KW@57..62 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@62..68 "\"test\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@68..69 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@69..77 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: TYPE_KW@77..82 "type" [] [Whitespace(" ")], + star_token: STAR@82..83 "*" [] [], + export_as: missing (optional), + from_token: missing (required), + source: missing (required), + assertion: missing (optional), + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: TYPE_KW@92..97 "type" [] [Whitespace(" ")], + star_token: STAR@97..99 "*" [] [Whitespace(" ")], + export_as: missing (optional), + from_token: FROM_KW@99..103 "from" [] [], + source: missing (required), + assertion: missing (optional), + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@104..112 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: TYPE_KW@112..117 "type" [] [Whitespace(" ")], + star_token: STAR@117..119 "*" [] [Whitespace(" ")], + export_as: JsExportAsClause { + as_token: AS_KW@119..122 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@122..126 "from" [] [], + }, + }, + from_token: missing (required), + source: missing (required), + assertion: missing (optional), + semicolon_token: SEMICOLON@126..127 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@127..135 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: TYPE_KW@135..140 "type" [] [Whitespace(" ")], + star_token: STAR@140..142 "*" [] [Whitespace(" ")], + export_as: JsExportAsClause { + as_token: AS_KW@142..145 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@145..148 "ns" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@148..152 "from" [] [], + source: missing (required), + assertion: missing (optional), + semicolon_token: SEMICOLON@152..153 ";" [] [], + }, + }, + ], + eof_token: EOF@153..154 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..154 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..153 + 0: JS_EXPORT@0..9 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@7..9 + 0: (empty) + 1: STAR@7..8 "*" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: SEMICOLON@8..9 ";" [] [] + 1: JS_EXPORT@9..24 + 0: JS_DECORATOR_LIST@9..9 + 1: EXPORT_KW@9..17 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@17..24 + 0: (empty) + 1: STAR@17..19 "*" [] [Whitespace(" ")] + 2: (empty) + 3: FROM_KW@19..24 "from" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 2: JS_EXPRESSION_STATEMENT@24..26 + 0: JS_NUMBER_LITERAL_EXPRESSION@24..25 + 0: JS_NUMBER_LITERAL@24..25 "5" [] [] + 1: SEMICOLON@25..26 ";" [] [] + 3: JS_EXPORT@26..49 + 0: JS_DECORATOR_LIST@26..26 + 1: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@34..49 + 0: (empty) + 1: (empty) + 2: JS_EXPORT_AS_CLAUSE@34..42 + 0: AS_KW@34..37 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@37..42 + 0: IDENT@37..42 "from" [] [Whitespace(" ")] + 3: (empty) + 4: JS_MODULE_SOURCE@42..48 + 0: JS_STRING_LITERAL@42..48 "\"test\"" [] [] + 5: (empty) + 6: SEMICOLON@48..49 ";" [] [] + 4: JS_EXPORT@49..69 + 0: JS_DECORATOR_LIST@49..49 + 1: EXPORT_KW@49..57 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@57..69 + 0: (empty) + 1: (empty) + 2: (empty) + 3: FROM_KW@57..62 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@62..68 + 0: JS_STRING_LITERAL@62..68 "\"test\"" [] [] + 5: (empty) + 6: SEMICOLON@68..69 ";" [] [] + 5: JS_EXPORT@69..84 + 0: JS_DECORATOR_LIST@69..69 + 1: EXPORT_KW@69..77 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@77..84 + 0: TYPE_KW@77..82 "type" [] [Whitespace(" ")] + 1: STAR@82..83 "*" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: SEMICOLON@83..84 ";" [] [] + 6: JS_EXPORT@84..104 + 0: JS_DECORATOR_LIST@84..84 + 1: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@92..104 + 0: TYPE_KW@92..97 "type" [] [Whitespace(" ")] + 1: STAR@97..99 "*" [] [Whitespace(" ")] + 2: (empty) + 3: FROM_KW@99..103 "from" [] [] + 4: (empty) + 5: (empty) + 6: SEMICOLON@103..104 ";" [] [] + 7: JS_EXPORT@104..127 + 0: JS_DECORATOR_LIST@104..104 + 1: EXPORT_KW@104..112 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@112..127 + 0: TYPE_KW@112..117 "type" [] [Whitespace(" ")] + 1: STAR@117..119 "*" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@119..126 + 0: AS_KW@119..122 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@122..126 + 0: IDENT@122..126 "from" [] [] + 3: (empty) + 4: (empty) + 5: (empty) + 6: SEMICOLON@126..127 ";" [] [] + 8: JS_EXPORT@127..153 + 0: JS_DECORATOR_LIST@127..127 + 1: EXPORT_KW@127..135 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@135..153 + 0: TYPE_KW@135..140 "type" [] [Whitespace(" ")] + 1: STAR@140..142 "*" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@142..148 + 0: AS_KW@142..145 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@145..148 + 0: IDENT@145..148 "ns" [] [Whitespace(" ")] + 3: FROM_KW@148..152 "from" [] [] + 4: (empty) + 5: (empty) + 6: SEMICOLON@152..153 ";" [] [] + 4: EOF@153..154 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_from_clause_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `;` + + > 1 │ export *; + │ ^ + 2 │ export * from 5; + 3 │ export as from "test"; + + i Remove ; + +export_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal but instead found '5'. + + 1 │ export *; + > 2 │ export * from 5; + │ ^ + 3 │ export as from "test"; + 4 │ export from "test"; + + i Expected a string literal here. + + 1 │ export *; + > 2 │ export * from 5; + │ ^ + 3 │ export as from "test"; + 4 │ export from "test"; + +export_from_clause_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `*` but instead found `as` + + 1 │ export *; + 2 │ export * from 5; + > 3 │ export as from "test"; + │ ^^ + 4 │ export from "test"; + 5 │ export type *; + + i Remove as + +export_from_clause_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `"test"` + + 1 │ export *; + 2 │ export * from 5; + > 3 │ export as from "test"; + │ ^^^^^^ + 4 │ export from "test"; + 5 │ export type *; + + i Remove "test" + +export_from_clause_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `*` but instead found `from` + + 2 │ export * from 5; + 3 │ export as from "test"; + > 4 │ export from "test"; + │ ^^^^ + 5 │ export type *; + 6 │ export type * from; + + i Remove from + +export_from_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `;` + + 3 │ export as from "test"; + 4 │ export from "test"; + > 5 │ export type *; + │ ^ + 6 │ export type * from; + 7 │ export type * as from; + + i Remove ; + +export_from_clause_err.js:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal but instead found ';'. + + 4 │ export from "test"; + 5 │ export type *; + > 6 │ export type * from; + │ ^ + 7 │ export type * as from; + 8 │ export type * as ns from; + + i Expected a string literal here. + + 4 │ export from "test"; + 5 │ export type *; + > 6 │ export type * from; + │ ^ + 7 │ export type * as from; + 8 │ export type * as ns from; + +export_from_clause_err.js:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `;` + + 5 │ export type *; + 6 │ export type * from; + > 7 │ export type * as from; + │ ^ + 8 │ export type * as ns from; + 9 │ + + i Remove ; + +export_from_clause_err.js:8:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal but instead found ';'. + + 6 │ export type * from; + 7 │ export type * as from; + > 8 │ export type * as ns from; + │ ^ + 9 │ + + i Expected a string literal here. + + 6 │ export type * from; + 7 │ export type * as from; + > 8 │ export type * as ns from; + │ ^ + 9 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.js b/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs.snap new file mode 100644 index 000000000000..7f4c6d017c86 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs.snap @@ -0,0 +1,113 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..17 "export" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@26..28 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@31..33 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@33..40 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@40..1438 "\"Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere.\"" [] [], + }, + semicolon_token: SEMICOLON@1438..1440 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@1440..1441 "}" [] [], + }, + }, + ], + }, + ], + eof_token: EOF@1441..1442 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..1442 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..1441 + 0: JS_BOGUS_STATEMENT@0..1441 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..17 "export" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@17..1441 + 0: (empty) + 1: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "A" [] [Whitespace(" ")] + 4: (empty) + 5: JS_PARAMETERS@28..31 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..29 + 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@31..1441 + 0: L_CURLY@31..33 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@33..33 + 2: JS_STATEMENT_LIST@33..1440 + 0: JS_RETURN_STATEMENT@33..1440 + 0: RETURN_KW@33..40 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@40..1438 + 0: JS_STRING_LITERAL@40..1438 "\"Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere.\"" [] [] + 2: SEMICOLON@1438..1440 ";" [] [Whitespace(" ")] + 3: R_CURLY@1440..1441 "}" [] [] + 4: EOF@1441..1442 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_huge_function_in_script.cjs:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of an export declaration outside of a module + + 1 │ // SCRIPT + > 2 │ export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ + + i not allowed inside scripts + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_named_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js.snap new file mode 100644 index 000000000000..ced87e42134d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js.snap @@ -0,0 +1,348 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { default as "b" }; +export { "a" as b }; +export { as b }; +export { a as 5 }; +export { a b c }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@7..9 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsLiteralExportName { + value: IDENT@9..17 "default" [] [Whitespace(" ")], + }, + AS_KW@17..20 "as" [] [Whitespace(" ")], + JsLiteralExportName { + value: JS_STRING_LITERAL@20..24 "\"b\"" [] [Whitespace(" ")], + }, + ], + }, + ], + }, + R_CURLY@24..25 "}" [] [], + SEMICOLON@25..26 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@34..36 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsLiteralExportName { + value: JS_STRING_LITERAL@36..40 "\"a\"" [] [Whitespace(" ")], + }, + AS_KW@40..43 "as" [] [Whitespace(" ")], + JsLiteralExportName { + value: IDENT@43..45 "b" [] [Whitespace(" ")], + }, + ], + }, + ], + }, + R_CURLY@45..46 "}" [] [], + SEMICOLON@46..47 ";" [] [], + ], + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: missing (required), + as_token: AS_KW@57..60 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@60..62 "b" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@62..63 "}" [] [], + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@72..74 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@74..76 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@76..79 "as" [] [Whitespace(" ")], + exported_name: missing (required), + }, + JsBogus { + items: [ + JS_NUMBER_LITERAL@79..81 "5" [] [Whitespace(" ")], + ], + }, + ], + }, + R_CURLY@81..82 "}" [] [], + SEMICOLON@82..83 ";" [] [], + ], + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@83..91 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@91..93 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@93..95 "a" [] [Whitespace(" ")], + }, + }, + missing separator, + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@95..97 "b" [] [Whitespace(" ")], + }, + }, + missing separator, + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@97..99 "c" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@99..100 "}" [] [], + semicolon_token: SEMICOLON@100..101 ";" [] [], + }, + }, + ], + eof_token: EOF@101..102 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..102 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..101 + 0: JS_BOGUS_STATEMENT@0..26 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_BOGUS@7..26 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@9..24 + 0: JS_BOGUS@9..24 + 0: JS_LITERAL_EXPORT_NAME@9..17 + 0: IDENT@9..17 "default" [] [Whitespace(" ")] + 1: AS_KW@17..20 "as" [] [Whitespace(" ")] + 2: JS_LITERAL_EXPORT_NAME@20..24 + 0: JS_STRING_LITERAL@20..24 "\"b\"" [] [Whitespace(" ")] + 2: R_CURLY@24..25 "}" [] [] + 3: SEMICOLON@25..26 ";" [] [] + 1: JS_BOGUS_STATEMENT@26..47 + 0: JS_DECORATOR_LIST@26..26 + 1: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@34..47 + 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@36..45 + 0: JS_BOGUS@36..45 + 0: JS_LITERAL_EXPORT_NAME@36..40 + 0: JS_STRING_LITERAL@36..40 "\"a\"" [] [Whitespace(" ")] + 1: AS_KW@40..43 "as" [] [Whitespace(" ")] + 2: JS_LITERAL_EXPORT_NAME@43..45 + 0: IDENT@43..45 "b" [] [Whitespace(" ")] + 2: R_CURLY@45..46 "}" [] [] + 3: SEMICOLON@46..47 ";" [] [] + 2: JS_EXPORT@47..64 + 0: JS_DECORATOR_LIST@47..47 + 1: EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@55..64 + 0: (empty) + 1: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@57..62 + 0: JS_EXPORT_NAMED_SPECIFIER@57..62 + 0: (empty) + 1: (empty) + 2: AS_KW@57..60 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@60..62 + 0: IDENT@60..62 "b" [] [Whitespace(" ")] + 3: R_CURLY@62..63 "}" [] [] + 4: SEMICOLON@63..64 ";" [] [] + 3: JS_BOGUS_STATEMENT@64..83 + 0: JS_DECORATOR_LIST@64..64 + 1: EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@72..83 + 0: L_CURLY@72..74 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@74..81 + 0: JS_EXPORT_NAMED_SPECIFIER@74..79 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@74..76 + 0: IDENT@74..76 "a" [] [Whitespace(" ")] + 2: AS_KW@76..79 "as" [] [Whitespace(" ")] + 3: (empty) + 1: JS_BOGUS@79..81 + 0: JS_NUMBER_LITERAL@79..81 "5" [] [Whitespace(" ")] + 2: R_CURLY@81..82 "}" [] [] + 3: SEMICOLON@82..83 ";" [] [] + 4: JS_EXPORT@83..101 + 0: JS_DECORATOR_LIST@83..83 + 1: EXPORT_KW@83..91 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@91..101 + 0: (empty) + 1: L_CURLY@91..93 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@93..99 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@93..95 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@93..95 + 0: IDENT@93..95 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@95..97 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@95..97 + 0: IDENT@95..97 "b" [] [Whitespace(" ")] + 3: (empty) + 4: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@97..99 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@97..99 + 0: IDENT@97..99 "c" [] [Whitespace(" ")] + 3: R_CURLY@99..100 "}" [] [] + 4: SEMICOLON@100..101 ";" [] [] + 4: EOF@101..102 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_named_clause_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × "default" can only be used with "export ... from ..." + + > 1 │ export { default as "b" }; + │ ^^^^^^^ + 2 │ export { "a" as b }; + 3 │ export { as b }; + +export_named_clause_err.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A string literal cannot be used as an export binding without `from`. + + 1 │ export { default as "b" }; + > 2 │ export { "a" as b }; + │ ^^^ + 3 │ export { as b }; + 4 │ export { a as 5 }; + +export_named_clause_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found ''. + + 1 │ export { default as "b" }; + 2 │ export { "a" as b }; + > 3 │ export { as b }; + │ + 4 │ export { a as 5 }; + 5 │ export { a b c }; + + i Expected an identifier here. + + 1 │ export { default as "b" }; + 2 │ export { "a" as b }; + > 3 │ export { as b }; + │ + 4 │ export { a as 5 }; + 5 │ export { a b c }; + +export_named_clause_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal, or an identifier but instead found '5'. + + 2 │ export { "a" as b }; + 3 │ export { as b }; + > 4 │ export { a as 5 }; + │ ^ + 5 │ export { a b c }; + 6 │ + + i Expected a string literal, or an identifier here. + + 2 │ export { "a" as b }; + 3 │ export { as b }; + > 4 │ export { a as 5 }; + │ ^ + 5 │ export { a b c }; + 6 │ + +export_named_clause_err.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `b` + + 3 │ export { as b }; + 4 │ export { a as 5 }; + > 5 │ export { a b c }; + │ ^ + 6 │ + + i Remove b + +export_named_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `c` + + 3 │ export { as b }; + 4 │ export { a as 5 }; + > 5 │ export { a b c }; + │ ^ + 6 │ + + i Remove c + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js.snap new file mode 100644 index 000000000000..9510dc3d7fdc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js.snap @@ -0,0 +1,338 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { as b } from "mod"; +export { a as 5 } from "mod"; +export { a b c } from "mod"; +export { 5 as b } from "mod"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: missing (required), + export_as: JsExportAsClause { + as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@12..14 "b" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], + from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@21..26 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@27..35 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@35..37 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@37..39 "a" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@39..42 "as" [] [Whitespace(" ")], + exported_name: missing (required), + }, + }, + JsBogus { + items: [ + JS_NUMBER_LITERAL@42..44 "5" [] [Whitespace(" ")], + ], + }, + ], + }, + R_CURLY@44..46 "}" [] [Whitespace(" ")], + FROM_KW@46..51 "from" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@51..56 "\"mod\"" [] [], + }, + SEMICOLON@56..57 ";" [] [], + ], + }, + ], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@65..67 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@67..69 "a" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + missing separator, + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@69..71 "b" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + missing separator, + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@71..73 "c" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@73..75 "}" [] [Whitespace(" ")], + from_token: FROM_KW@75..80 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@80..85 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@85..86 ";" [] [], + }, + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@94..96 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JS_NUMBER_LITERAL@96..98 "5" [] [Whitespace(" ")], + AS_KW@98..101 "as" [] [Whitespace(" ")], + IDENT@101..103 "b" [] [Whitespace(" ")], + ], + }, + ], + }, + R_CURLY@103..105 "}" [] [Whitespace(" ")], + FROM_KW@105..110 "from" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@110..115 "\"mod\"" [] [], + }, + SEMICOLON@115..116 ";" [] [], + ], + }, + ], + }, + ], + eof_token: EOF@116..117 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..117 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..116 + 0: JS_EXPORT@0..27 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..27 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@9..14 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@9..14 + 0: (empty) + 1: (empty) + 2: JS_EXPORT_AS_CLAUSE@9..14 + 0: AS_KW@9..12 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@12..14 + 0: IDENT@12..14 "b" [] [Whitespace(" ")] + 3: R_CURLY@14..16 "}" [] [Whitespace(" ")] + 4: FROM_KW@16..21 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@21..26 + 0: JS_STRING_LITERAL@21..26 "\"mod\"" [] [] + 6: (empty) + 7: SEMICOLON@26..27 ";" [] [] + 1: JS_BOGUS_STATEMENT@27..57 + 0: JS_DECORATOR_LIST@27..27 + 1: EXPORT_KW@27..35 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@35..57 + 0: L_CURLY@35..37 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@37..44 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@37..42 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@37..39 + 0: IDENT@37..39 "a" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@39..42 + 0: AS_KW@39..42 "as" [] [Whitespace(" ")] + 1: (empty) + 1: JS_BOGUS@42..44 + 0: JS_NUMBER_LITERAL@42..44 "5" [] [Whitespace(" ")] + 2: R_CURLY@44..46 "}" [] [Whitespace(" ")] + 3: FROM_KW@46..51 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@51..56 + 0: JS_STRING_LITERAL@51..56 "\"mod\"" [] [] + 5: SEMICOLON@56..57 ";" [] [] + 2: JS_EXPORT@57..86 + 0: JS_DECORATOR_LIST@57..57 + 1: EXPORT_KW@57..65 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@65..86 + 0: (empty) + 1: L_CURLY@65..67 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@67..73 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@67..69 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@67..69 + 0: IDENT@67..69 "a" [] [Whitespace(" ")] + 2: (empty) + 1: (empty) + 2: JS_EXPORT_NAMED_FROM_SPECIFIER@69..71 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@69..71 + 0: IDENT@69..71 "b" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_EXPORT_NAMED_FROM_SPECIFIER@71..73 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@71..73 + 0: IDENT@71..73 "c" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@73..75 "}" [] [Whitespace(" ")] + 4: FROM_KW@75..80 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@80..85 + 0: JS_STRING_LITERAL@80..85 "\"mod\"" [] [] + 6: (empty) + 7: SEMICOLON@85..86 ";" [] [] + 3: JS_BOGUS_STATEMENT@86..116 + 0: JS_DECORATOR_LIST@86..86 + 1: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@94..116 + 0: L_CURLY@94..96 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@96..103 + 0: JS_BOGUS@96..103 + 0: JS_NUMBER_LITERAL@96..98 "5" [] [Whitespace(" ")] + 1: AS_KW@98..101 "as" [] [Whitespace(" ")] + 2: IDENT@101..103 "b" [] [Whitespace(" ")] + 2: R_CURLY@103..105 "}" [] [Whitespace(" ")] + 3: FROM_KW@105..110 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@110..115 + 0: JS_STRING_LITERAL@110..115 "\"mod\"" [] [] + 5: SEMICOLON@115..116 ";" [] [] + 4: EOF@116..117 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_named_from_clause_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal, or an identifier but instead found ''. + + > 1 │ export { as b } from "mod"; + │ + 2 │ export { a as 5 } from "mod"; + 3 │ export { a b c } from "mod"; + + i Expected a string literal, or an identifier here. + + > 1 │ export { as b } from "mod"; + │ + 2 │ export { a as 5 } from "mod"; + 3 │ export { a b c } from "mod"; + +export_named_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal, or an identifier but instead found '5'. + + 1 │ export { as b } from "mod"; + > 2 │ export { a as 5 } from "mod"; + │ ^ + 3 │ export { a b c } from "mod"; + 4 │ export { 5 as b } from "mod"; + + i Expected a string literal, or an identifier here. + + 1 │ export { as b } from "mod"; + > 2 │ export { a as 5 } from "mod"; + │ ^ + 3 │ export { a b c } from "mod"; + 4 │ export { 5 as b } from "mod"; + +export_named_from_clause_err.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `b` + + 1 │ export { as b } from "mod"; + 2 │ export { a as 5 } from "mod"; + > 3 │ export { a b c } from "mod"; + │ ^ + 4 │ export { 5 as b } from "mod"; + 5 │ + + i Remove b + +export_named_from_clause_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `c` + + 1 │ export { as b } from "mod"; + 2 │ export { a as 5 } from "mod"; + > 3 │ export { a b c } from "mod"; + │ ^ + 4 │ export { 5 as b } from "mod"; + 5 │ + + i Remove c + +export_named_from_clause_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal, or an identifier but instead found '5 as b'. + + 2 │ export { a as 5 } from "mod"; + 3 │ export { a b c } from "mod"; + > 4 │ export { 5 as b } from "mod"; + │ ^^^^^^ + 5 │ + + i Expected a string literal, or an identifier here. + + 2 │ export { a as 5 } from "mod"; + 3 │ export { a b c } from "mod"; + > 4 │ export { 5 as b } from "mod"; + │ ^^^^^^ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.js b/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js.snap new file mode 100644 index 000000000000..37ad7690aa15 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js.snap @@ -0,0 +1,192 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export let a = ; +export const b; +export let d, c; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@7..11 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@11..13 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@13..15 "=" [] [Whitespace(" ")], + expression: missing (required), + }, + }, + ], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@24..30 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@30..31 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@32..40 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@40..44 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@44..45 "d" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@45..47 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@47..48 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@48..49 ";" [] [], + }, + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_EXPORT@0..16 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@7..16 + 0: JS_VARIABLE_DECLARATION@7..15 + 0: (empty) + 1: LET_KW@7..11 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@11..15 + 0: JS_VARIABLE_DECLARATOR@11..15 + 0: JS_IDENTIFIER_BINDING@11..13 + 0: IDENT@11..13 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@13..15 + 0: EQ@13..15 "=" [] [Whitespace(" ")] + 1: (empty) + 1: SEMICOLON@15..16 ";" [] [] + 1: JS_EXPORT@16..32 + 0: JS_DECORATOR_LIST@16..16 + 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@24..32 + 0: JS_VARIABLE_DECLARATION@24..31 + 0: (empty) + 1: CONST_KW@24..30 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@30..31 + 0: JS_VARIABLE_DECLARATOR@30..31 + 0: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "b" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@31..32 ";" [] [] + 2: JS_EXPORT@32..49 + 0: JS_DECORATOR_LIST@32..32 + 1: EXPORT_KW@32..40 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@40..49 + 0: JS_VARIABLE_DECLARATION@40..48 + 0: (empty) + 1: LET_KW@40..44 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@44..48 + 0: JS_VARIABLE_DECLARATOR@44..45 + 0: JS_IDENTIFIER_BINDING@44..45 + 0: IDENT@44..45 "d" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@45..47 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@47..48 + 0: JS_IDENTIFIER_BINDING@47..48 + 0: IDENT@47..48 "c" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@48..49 ";" [] [] + 4: EOF@49..50 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +export_variable_clause_error.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ';'. + + > 1 │ export let a = ; + │ ^ + 2 │ export const b; + 3 │ export let d, c; + + i Expected an expression, or an assignment here. + + > 1 │ export let a = ; + │ ^ + 2 │ export const b; + 3 │ export let d, c; + +export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Const declarations must have an initialized value. + + 1 │ export let a = ; + > 2 │ export const b; + │ ^ + 3 │ export let d, c; + 4 │ + + i This variable needs to be initialized. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap new file mode 100644 index 000000000000..0928b8a836fb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap @@ -0,0 +1,385 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +for (let i = 0 in []) {} +for (const i = 0 in []) {} +for (var i = 0 of []) {} +for (let i = 0 of []) {} +for (const i = 0 of []) {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsForInStatement { + for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@14..15 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@15..19 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@19..21 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@25..28 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@28..29 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@32..33 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@39..40 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@40..46 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@46..48 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@48..50 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@52..55 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@55..56 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@56..57 "]" [] [], + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@59..60 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@66..67 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@67..71 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@71..73 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@77..80 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@80..81 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@81..82 "]" [] [], + }, + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@84..85 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@91..92 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@92..96 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@96..98 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@98..100 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@102..105 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@105..106 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@106..107 "]" [] [], + }, + r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@109..110 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@116..117 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@117..123 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@123..125 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@125..127 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@129..132 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@132..133 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@133..134 "]" [] [], + }, + r_paren_token: R_PAREN@134..136 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@136..137 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@137..138 "}" [] [], + }, + }, + ], + eof_token: EOF@138..139 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..139 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..138 + 0: JS_FOR_IN_STATEMENT@0..34 + 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@14..15 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@15..25 + 0: (empty) + 1: LET_KW@15..19 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@19..25 + 0: JS_IDENTIFIER_BINDING@19..21 + 0: IDENT@19..21 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..25 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..25 + 0: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")] + 3: IN_KW@25..28 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@28..30 + 0: L_BRACK@28..29 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@29..29 + 2: R_BRACK@29..30 "]" [] [] + 5: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@32..34 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_STATEMENT_LIST@33..33 + 2: R_CURLY@33..34 "}" [] [] + 1: JS_FOR_IN_STATEMENT@34..61 + 0: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@39..40 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@40..52 + 0: (empty) + 1: CONST_KW@40..46 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@46..52 + 0: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@48..52 + 0: EQ@48..50 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@50..52 + 0: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")] + 3: IN_KW@52..55 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@55..57 + 0: L_BRACK@55..56 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@56..56 + 2: R_BRACK@56..57 "]" [] [] + 5: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_STATEMENT_LIST@60..60 + 2: R_CURLY@60..61 "}" [] [] + 2: JS_FOR_OF_STATEMENT@61..86 + 0: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@66..67 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@67..77 + 0: (empty) + 1: VAR_KW@67..71 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@71..77 + 0: JS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@73..77 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@75..77 + 0: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")] + 4: OF_KW@77..80 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@80..82 + 0: L_BRACK@80..81 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@81..81 + 2: R_BRACK@81..82 "]" [] [] + 6: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@84..86 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_STATEMENT_LIST@85..85 + 2: R_CURLY@85..86 "}" [] [] + 3: JS_FOR_OF_STATEMENT@86..111 + 0: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@91..92 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@92..102 + 0: (empty) + 1: LET_KW@92..96 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@96..102 + 0: JS_IDENTIFIER_BINDING@96..98 + 0: IDENT@96..98 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@98..102 + 0: EQ@98..100 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@100..102 + 0: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")] + 4: OF_KW@102..105 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@105..107 + 0: L_BRACK@105..106 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@106..106 + 2: R_BRACK@106..107 "]" [] [] + 6: R_PAREN@107..109 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@109..111 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_STATEMENT_LIST@110..110 + 2: R_CURLY@110..111 "}" [] [] + 4: JS_FOR_OF_STATEMENT@111..138 + 0: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@116..117 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@117..129 + 0: (empty) + 1: CONST_KW@117..123 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@123..129 + 0: JS_IDENTIFIER_BINDING@123..125 + 0: IDENT@123..125 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@125..129 + 0: EQ@125..127 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@127..129 + 0: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")] + 4: OF_KW@129..132 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@132..134 + 0: L_BRACK@132..133 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@133..133 + 2: R_BRACK@133..134 "]" [] [] + 6: R_PAREN@134..136 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@136..138 + 0: L_CURLY@136..137 "{" [] [] + 1: JS_STATEMENT_LIST@137..137 + 2: R_CURLY@137..138 "}" [] [] + 4: EOF@138..139 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +for_in_and_of_initializer_loose_mode.cjs:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ // SCRIPT + > 2 │ for (let i = 0 in []) {} + │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.cjs:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ // SCRIPT + 2 │ for (let i = 0 in []) {} + > 3 │ for (const i = 0 in []) {} + │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.cjs:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + > 4 │ for (var i = 0 of []) {} + │ ^^^ + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.cjs:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + > 5 │ for (let i = 0 of []) {} + │ ^^^ + 6 │ for (const i = 0 of []) {} + 7 │ + +for_in_and_of_initializer_loose_mode.cjs:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + > 6 │ for (const i = 0 of []) {} + │ ^^^ + 7 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap new file mode 100644 index 000000000000..e2ae6045df98 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap @@ -0,0 +1,385 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +for (let i = 0 in []) {} +for (const i = 0 in []) {} +for (var i = 0 of []) {} +for (let i = 0 of []) {} +for (const i = 0 of []) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForInStatement { + for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@14..15 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@15..19 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@19..21 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@25..28 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@28..29 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@32..33 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@39..40 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@40..46 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@46..48 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@48..50 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@52..55 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@55..56 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@56..57 "]" [] [], + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@59..60 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@66..67 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@67..71 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@71..73 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@77..80 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@80..81 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@81..82 "]" [] [], + }, + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@84..85 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@91..92 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@92..96 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@96..98 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@98..100 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@102..105 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@105..106 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@106..107 "]" [] [], + }, + r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@109..110 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@116..117 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@117..123 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@123..125 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@125..127 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@129..132 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@132..133 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@133..134 "]" [] [], + }, + r_paren_token: R_PAREN@134..136 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@136..137 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@137..138 "}" [] [], + }, + }, + ], + eof_token: EOF@138..139 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..139 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..138 + 0: JS_FOR_IN_STATEMENT@0..34 + 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@14..15 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@15..25 + 0: (empty) + 1: LET_KW@15..19 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@19..25 + 0: JS_IDENTIFIER_BINDING@19..21 + 0: IDENT@19..21 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..25 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..25 + 0: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")] + 3: IN_KW@25..28 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@28..30 + 0: L_BRACK@28..29 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@29..29 + 2: R_BRACK@29..30 "]" [] [] + 5: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@32..34 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_STATEMENT_LIST@33..33 + 2: R_CURLY@33..34 "}" [] [] + 1: JS_FOR_IN_STATEMENT@34..61 + 0: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@39..40 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@40..52 + 0: (empty) + 1: CONST_KW@40..46 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@46..52 + 0: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@48..52 + 0: EQ@48..50 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@50..52 + 0: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")] + 3: IN_KW@52..55 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@55..57 + 0: L_BRACK@55..56 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@56..56 + 2: R_BRACK@56..57 "]" [] [] + 5: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_STATEMENT_LIST@60..60 + 2: R_CURLY@60..61 "}" [] [] + 2: JS_FOR_OF_STATEMENT@61..86 + 0: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@66..67 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@67..77 + 0: (empty) + 1: VAR_KW@67..71 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@71..77 + 0: JS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@73..77 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@75..77 + 0: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")] + 4: OF_KW@77..80 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@80..82 + 0: L_BRACK@80..81 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@81..81 + 2: R_BRACK@81..82 "]" [] [] + 6: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@84..86 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_STATEMENT_LIST@85..85 + 2: R_CURLY@85..86 "}" [] [] + 3: JS_FOR_OF_STATEMENT@86..111 + 0: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@91..92 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@92..102 + 0: (empty) + 1: LET_KW@92..96 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@96..102 + 0: JS_IDENTIFIER_BINDING@96..98 + 0: IDENT@96..98 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@98..102 + 0: EQ@98..100 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@100..102 + 0: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")] + 4: OF_KW@102..105 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@105..107 + 0: L_BRACK@105..106 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@106..106 + 2: R_BRACK@106..107 "]" [] [] + 6: R_PAREN@107..109 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@109..111 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_STATEMENT_LIST@110..110 + 2: R_CURLY@110..111 "}" [] [] + 4: JS_FOR_OF_STATEMENT@111..138 + 0: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@116..117 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@117..129 + 0: (empty) + 1: CONST_KW@117..123 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@123..129 + 0: JS_IDENTIFIER_BINDING@123..125 + 0: IDENT@123..125 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@125..129 + 0: EQ@125..127 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@127..129 + 0: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")] + 4: OF_KW@129..132 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@132..134 + 0: L_BRACK@132..133 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@133..133 + 2: R_BRACK@133..134 "]" [] [] + 6: R_PAREN@134..136 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@136..138 + 0: L_CURLY@136..137 "{" [] [] + 1: JS_STATEMENT_LIST@137..137 + 2: R_CURLY@137..138 "}" [] [] + 4: EOF@138..139 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +for_in_and_of_initializer_loose_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ // SCRIPT + > 2 │ for (let i = 0 in []) {} + │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ // SCRIPT + 2 │ for (let i = 0 in []) {} + > 3 │ for (const i = 0 in []) {} + │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + > 4 │ for (var i = 0 of []) {} + │ ^^^ + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + > 5 │ for (let i = 0 of []) {} + │ ^^^ + 6 │ for (const i = 0 of []) {} + 7 │ + +for_in_and_of_initializer_loose_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + > 6 │ for (const i = 0 of []) {} + │ ^^^ + 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap new file mode 100644 index 000000000000..654e6003e7a2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap @@ -0,0 +1,758 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (var i = 0 in []) {} +for (let i = 0 in []) {} +for (const i = 0 in []) {} +for (var i = 0 of []) {} +for (let i = 0 of []) {} +for (const i = 0 of []) {} +for (using x = y of z) {}; +for await (using x = y of z) {}; +for (await using x = y of z) {}; +for await (await using x = y of z) {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForInStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@5..9 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@9..11 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@11..13 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@15..18 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@18..19 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@19..20 "]" [] [], + }, + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@22..23 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@24..29 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@29..30 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@30..34 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@34..36 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@38..40 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@40..43 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@43..44 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@44..45 "]" [] [], + }, + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@47..48 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@49..54 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@54..55 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@55..61 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@61..63 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@63..65 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@65..67 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@67..70 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@70..71 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@71..72 "]" [] [], + }, + r_paren_token: R_PAREN@72..74 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@74..75 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@75..76 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@76..81 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@81..82 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@82..86 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@86..88 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@88..90 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@90..92 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@92..95 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@95..96 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@96..97 "]" [] [], + }, + r_paren_token: R_PAREN@97..99 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@99..100 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@100..101 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@101..106 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@106..107 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@107..111 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@111..113 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@113..115 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@115..117 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@117..120 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@120..121 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@121..122 "]" [] [], + }, + r_paren_token: R_PAREN@122..124 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@124..125 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@126..131 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@131..132 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@132..138 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@138..140 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@140..142 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@142..144 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@144..147 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@147..148 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@148..149 "]" [] [], + }, + r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@151..152 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@152..153 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@153..158 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@158..159 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: USING_KW@159..165 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@165..167 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@167..169 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@169..171 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + of_token: OF_KW@171..174 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@174..175 "z" [] [], + }, + }, + r_paren_token: R_PAREN@175..177 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@177..178 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@178..179 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@179..180 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@180..185 "for" [Newline("\n")] [Whitespace(" ")], + await_token: AWAIT_KW@185..191 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@191..192 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: USING_KW@192..198 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@198..200 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@200..202 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@202..204 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + of_token: OF_KW@204..207 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@207..208 "z" [] [], + }, + }, + r_paren_token: R_PAREN@208..210 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@210..211 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@211..212 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@212..213 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@213..218 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@218..219 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: AWAIT_KW@219..225 "await" [] [Whitespace(" ")], + kind_token: USING_KW@225..231 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@231..233 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@233..235 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@235..237 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + of_token: OF_KW@237..240 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@240..241 "z" [] [], + }, + }, + r_paren_token: R_PAREN@241..243 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@243..244 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@244..245 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@245..246 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@246..251 "for" [Newline("\n")] [Whitespace(" ")], + await_token: AWAIT_KW@251..257 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@257..258 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: AWAIT_KW@258..264 "await" [] [Whitespace(" ")], + kind_token: USING_KW@264..270 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@270..272 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@272..274 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@274..276 "y" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + of_token: OF_KW@276..279 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@279..280 "z" [] [], + }, + }, + r_paren_token: R_PAREN@280..282 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@282..283 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@283..284 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@284..285 ";" [] [], + }, + ], + eof_token: EOF@285..286 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..286 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..285 + 0: JS_FOR_IN_STATEMENT@0..24 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@5..15 + 0: (empty) + 1: VAR_KW@5..9 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@9..15 + 0: JS_IDENTIFIER_BINDING@9..11 + 0: IDENT@9..11 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@11..15 + 0: EQ@11..13 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@13..15 + 0: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")] + 3: IN_KW@15..18 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@18..20 + 0: L_BRACK@18..19 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@19..19 + 2: R_BRACK@19..20 "]" [] [] + 5: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@22..24 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_STATEMENT_LIST@23..23 + 2: R_CURLY@23..24 "}" [] [] + 1: JS_FOR_IN_STATEMENT@24..49 + 0: FOR_KW@24..29 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@29..30 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@30..40 + 0: (empty) + 1: LET_KW@30..34 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@34..40 + 0: JS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@36..40 + 0: EQ@36..38 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@38..40 + 0: JS_NUMBER_LITERAL@38..40 "0" [] [Whitespace(" ")] + 3: IN_KW@40..43 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@43..45 + 0: L_BRACK@43..44 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@44..44 + 2: R_BRACK@44..45 "]" [] [] + 5: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@47..49 + 0: L_CURLY@47..48 "{" [] [] + 1: JS_STATEMENT_LIST@48..48 + 2: R_CURLY@48..49 "}" [] [] + 2: JS_FOR_IN_STATEMENT@49..76 + 0: FOR_KW@49..54 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@54..55 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@55..67 + 0: (empty) + 1: CONST_KW@55..61 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@61..67 + 0: JS_IDENTIFIER_BINDING@61..63 + 0: IDENT@61..63 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@63..67 + 0: EQ@63..65 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@65..67 + 0: JS_NUMBER_LITERAL@65..67 "0" [] [Whitespace(" ")] + 3: IN_KW@67..70 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@70..72 + 0: L_BRACK@70..71 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@71..71 + 2: R_BRACK@71..72 "]" [] [] + 5: R_PAREN@72..74 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@74..76 + 0: L_CURLY@74..75 "{" [] [] + 1: JS_STATEMENT_LIST@75..75 + 2: R_CURLY@75..76 "}" [] [] + 3: JS_FOR_OF_STATEMENT@76..101 + 0: FOR_KW@76..81 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@81..82 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@82..92 + 0: (empty) + 1: VAR_KW@82..86 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@86..92 + 0: JS_IDENTIFIER_BINDING@86..88 + 0: IDENT@86..88 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@88..92 + 0: EQ@88..90 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@90..92 + 0: JS_NUMBER_LITERAL@90..92 "0" [] [Whitespace(" ")] + 4: OF_KW@92..95 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@95..97 + 0: L_BRACK@95..96 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@96..96 + 2: R_BRACK@96..97 "]" [] [] + 6: R_PAREN@97..99 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@99..101 + 0: L_CURLY@99..100 "{" [] [] + 1: JS_STATEMENT_LIST@100..100 + 2: R_CURLY@100..101 "}" [] [] + 4: JS_FOR_OF_STATEMENT@101..126 + 0: FOR_KW@101..106 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@106..107 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@107..117 + 0: (empty) + 1: LET_KW@107..111 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@111..117 + 0: JS_IDENTIFIER_BINDING@111..113 + 0: IDENT@111..113 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@113..117 + 0: EQ@113..115 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@115..117 + 0: JS_NUMBER_LITERAL@115..117 "0" [] [Whitespace(" ")] + 4: OF_KW@117..120 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@120..122 + 0: L_BRACK@120..121 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@121..121 + 2: R_BRACK@121..122 "]" [] [] + 6: R_PAREN@122..124 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@124..126 + 0: L_CURLY@124..125 "{" [] [] + 1: JS_STATEMENT_LIST@125..125 + 2: R_CURLY@125..126 "}" [] [] + 5: JS_FOR_OF_STATEMENT@126..153 + 0: FOR_KW@126..131 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@131..132 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@132..144 + 0: (empty) + 1: CONST_KW@132..138 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@138..144 + 0: JS_IDENTIFIER_BINDING@138..140 + 0: IDENT@138..140 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@140..144 + 0: EQ@140..142 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@142..144 + 0: JS_NUMBER_LITERAL@142..144 "0" [] [Whitespace(" ")] + 4: OF_KW@144..147 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@147..149 + 0: L_BRACK@147..148 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@148..148 + 2: R_BRACK@148..149 "]" [] [] + 6: R_PAREN@149..151 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@151..153 + 0: L_CURLY@151..152 "{" [] [] + 1: JS_STATEMENT_LIST@152..152 + 2: R_CURLY@152..153 "}" [] [] + 6: JS_FOR_OF_STATEMENT@153..179 + 0: FOR_KW@153..158 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@158..159 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@159..171 + 0: (empty) + 1: USING_KW@159..165 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@165..171 + 0: JS_IDENTIFIER_BINDING@165..167 + 0: IDENT@165..167 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@167..171 + 0: EQ@167..169 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@169..171 + 0: JS_REFERENCE_IDENTIFIER@169..171 + 0: IDENT@169..171 "y" [] [Whitespace(" ")] + 4: OF_KW@171..174 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@174..175 + 0: JS_REFERENCE_IDENTIFIER@174..175 + 0: IDENT@174..175 "z" [] [] + 6: R_PAREN@175..177 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@177..179 + 0: L_CURLY@177..178 "{" [] [] + 1: JS_STATEMENT_LIST@178..178 + 2: R_CURLY@178..179 "}" [] [] + 7: JS_EMPTY_STATEMENT@179..180 + 0: SEMICOLON@179..180 ";" [] [] + 8: JS_FOR_OF_STATEMENT@180..212 + 0: FOR_KW@180..185 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@185..191 "await" [] [Whitespace(" ")] + 2: L_PAREN@191..192 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@192..204 + 0: (empty) + 1: USING_KW@192..198 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@198..204 + 0: JS_IDENTIFIER_BINDING@198..200 + 0: IDENT@198..200 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@200..204 + 0: EQ@200..202 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@202..204 + 0: JS_REFERENCE_IDENTIFIER@202..204 + 0: IDENT@202..204 "y" [] [Whitespace(" ")] + 4: OF_KW@204..207 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@207..208 + 0: JS_REFERENCE_IDENTIFIER@207..208 + 0: IDENT@207..208 "z" [] [] + 6: R_PAREN@208..210 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@210..212 + 0: L_CURLY@210..211 "{" [] [] + 1: JS_STATEMENT_LIST@211..211 + 2: R_CURLY@211..212 "}" [] [] + 9: JS_EMPTY_STATEMENT@212..213 + 0: SEMICOLON@212..213 ";" [] [] + 10: JS_FOR_OF_STATEMENT@213..245 + 0: FOR_KW@213..218 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@218..219 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@219..237 + 0: AWAIT_KW@219..225 "await" [] [Whitespace(" ")] + 1: USING_KW@225..231 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@231..237 + 0: JS_IDENTIFIER_BINDING@231..233 + 0: IDENT@231..233 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@233..237 + 0: EQ@233..235 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@235..237 + 0: JS_REFERENCE_IDENTIFIER@235..237 + 0: IDENT@235..237 "y" [] [Whitespace(" ")] + 4: OF_KW@237..240 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@240..241 + 0: JS_REFERENCE_IDENTIFIER@240..241 + 0: IDENT@240..241 "z" [] [] + 6: R_PAREN@241..243 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@243..245 + 0: L_CURLY@243..244 "{" [] [] + 1: JS_STATEMENT_LIST@244..244 + 2: R_CURLY@244..245 "}" [] [] + 11: JS_EMPTY_STATEMENT@245..246 + 0: SEMICOLON@245..246 ";" [] [] + 12: JS_FOR_OF_STATEMENT@246..284 + 0: FOR_KW@246..251 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@251..257 "await" [] [Whitespace(" ")] + 2: L_PAREN@257..258 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@258..276 + 0: AWAIT_KW@258..264 "await" [] [Whitespace(" ")] + 1: USING_KW@264..270 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@270..276 + 0: JS_IDENTIFIER_BINDING@270..272 + 0: IDENT@270..272 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@272..276 + 0: EQ@272..274 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@274..276 + 0: JS_REFERENCE_IDENTIFIER@274..276 + 0: IDENT@274..276 "y" [] [Whitespace(" ")] + 4: OF_KW@276..279 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@279..280 + 0: JS_REFERENCE_IDENTIFIER@279..280 + 0: IDENT@279..280 "z" [] [] + 6: R_PAREN@280..282 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@282..284 + 0: L_CURLY@282..283 "{" [] [] + 1: JS_STATEMENT_LIST@283..283 + 2: R_CURLY@283..284 "}" [] [] + 13: JS_EMPTY_STATEMENT@284..285 + 0: SEMICOLON@284..285 ";" [] [] + 4: EOF@285..286 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +for_in_and_of_initializer_strict_mode.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + > 1 │ for (var i = 0 in []) {} + │ ^^^ + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + +for_in_and_of_initializer_strict_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ for (var i = 0 in []) {} + > 2 │ for (let i = 0 in []) {} + │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + +for_in_and_of_initializer_strict_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ for (var i = 0 in []) {} + 2 │ for (let i = 0 in []) {} + > 3 │ for (const i = 0 in []) {} + │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + +for_in_and_of_initializer_strict_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + > 4 │ for (var i = 0 of []) {} + │ ^^^ + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} + +for_in_and_of_initializer_strict_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + > 5 │ for (let i = 0 of []) {} + │ ^^^ + 6 │ for (const i = 0 of []) {} + 7 │ for (using x = y of z) {}; + +for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + > 6 │ for (const i = 0 of []) {} + │ ^^^ + 7 │ for (using x = y of z) {}; + 8 │ for await (using x = y of z) {}; + +for_in_and_of_initializer_strict_mode.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} + > 7 │ for (using x = y of z) {}; + │ ^^^ + 8 │ for await (using x = y of z) {}; + 9 │ for (await using x = y of z) {}; + +for_in_and_of_initializer_strict_mode.js:8:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 6 │ for (const i = 0 of []) {} + 7 │ for (using x = y of z) {}; + > 8 │ for await (using x = y of z) {}; + │ ^^^ + 9 │ for (await using x = y of z) {}; + 10 │ for await (await using x = y of z) {}; + +for_in_and_of_initializer_strict_mode.js:9:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 7 │ for (using x = y of z) {}; + 8 │ for await (using x = y of z) {}; + > 9 │ for (await using x = y of z) {}; + │ ^^^ + 10 │ for await (await using x = y of z) {}; + 11 │ + +for_in_and_of_initializer_strict_mode.js:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 8 │ for await (using x = y of z) {}; + 9 │ for (await using x = y of z) {}; + > 10 │ for await (await using x = y of z) {}; + │ ^^^ + 11 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.js b/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js.snap new file mode 100644 index 000000000000..3e9418762448 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let async; +for (async of [1]) ; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..9 "async" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@10..15 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@15..16 "(" [] [], + initializer: JsBogusAssignment { + items: [ + IDENT@16..22 "async" [] [Whitespace(" ")], + ], + }, + of_token: OF_KW@22..25 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@25..26 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@26..27 "1" [] [], + }, + ], + r_brack_token: R_BRACK@27..28 "]" [] [], + }, + r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], + body: JsEmptyStatement { + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + }, + ], + eof_token: EOF@31..32 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..32 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..31 + 0: JS_VARIABLE_STATEMENT@0..10 + 0: JS_VARIABLE_DECLARATION@0..9 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..9 + 0: JS_VARIABLE_DECLARATOR@4..9 + 0: JS_IDENTIFIER_BINDING@4..9 + 0: IDENT@4..9 "async" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_FOR_OF_STATEMENT@10..31 + 0: FOR_KW@10..15 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@15..16 "(" [] [] + 3: JS_BOGUS_ASSIGNMENT@16..22 + 0: IDENT@16..22 "async" [] [Whitespace(" ")] + 4: OF_KW@22..25 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@25..28 + 0: L_BRACK@25..26 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@26..27 + 0: JS_NUMBER_LITERAL_EXPRESSION@26..27 + 0: JS_NUMBER_LITERAL@26..27 "1" [] [] + 2: R_BRACK@27..28 "]" [] [] + 6: R_PAREN@28..30 ")" [] [Whitespace(" ")] + 7: JS_EMPTY_STATEMENT@30..31 + 0: SEMICOLON@30..31 ";" [] [] + 4: EOF@31..32 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +for_of_async_identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × The left-hand side of a `for...of` statement may not be `async` + + 1 │ let async; + > 2 │ for (async of [1]) ; + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js.snap new file mode 100644 index 000000000000..635950ad5ef4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js.snap @@ -0,0 +1,692 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ;; {} +for let i = 5; i < 10; i++ {} +for let i = 5; i < 10; ++i {} +for (in []) {} +for (let i, j = 6 of []) {} +for await (let a in []) {} +for await (let i = 0; i < 10; ++i) {} +for (let [a];;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: missing (required), + initializer: missing (optional), + first_semi_token: SEMICOLON@4..5 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@5..7 ";" [] [Whitespace(" ")], + update: JsObjectExpression { + l_curly_token: L_CURLY@7..8 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@8..9 "}" [] [], + }, + r_paren_token: missing (required), + body: JsForStatement { + for_token: FOR_KW@9..14 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + initializer: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@14..18 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@18..20 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@20..22 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@22..23 "5" [] [], + }, + }, + }, + ], + }, + first_semi_token: SEMICOLON@23..25 ";" [] [Whitespace(" ")], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@25..27 "i" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@27..29 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@29..31 "10" [] [], + }, + }, + second_semi_token: SEMICOLON@31..33 ";" [] [Whitespace(" ")], + update: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@33..34 "i" [] [], + }, + operator_token: PLUS2@34..37 "++" [] [Whitespace(" ")], + }, + r_paren_token: missing (required), + body: JsBlockStatement { + l_curly_token: L_CURLY@37..38 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + }, + }, + JsForStatement { + for_token: FOR_KW@39..44 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + initializer: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@44..48 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@48..50 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@50..52 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@52..53 "5" [] [], + }, + }, + }, + ], + }, + first_semi_token: SEMICOLON@53..55 ";" [] [Whitespace(" ")], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..57 "i" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@57..59 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@59..61 "10" [] [], + }, + }, + second_semi_token: SEMICOLON@61..63 ";" [] [Whitespace(" ")], + update: JsPreUpdateExpression { + operator_token: PLUS2@63..65 "++" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@65..67 "i" [] [Whitespace(" ")], + }, + }, + r_paren_token: missing (required), + body: JsBlockStatement { + l_curly_token: L_CURLY@67..68 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@68..69 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@69..74 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@74..75 "(" [] [], + initializer: missing (required), + in_token: IN_KW@75..78 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@78..79 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@79..80 "]" [] [], + }, + r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@82..83 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@83..84 "}" [] [], + }, + }, + JsBogusStatement { + items: [ + FOR_KW@84..89 "for" [Newline("\n")] [Whitespace(" ")], + L_PAREN@89..90 "(" [] [], + JsBogus { + items: [ + LET_KW@90..94 "let" [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@94..95 "i" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@95..97 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@97..99 "j" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@99..101 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@101..103 "6" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + OF_KW@103..106 "of" [] [Whitespace(" ")], + JsArrayExpression { + l_brack_token: L_BRACK@106..107 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@107..108 "]" [] [], + }, + R_PAREN@108..110 ")" [] [Whitespace(" ")], + JsBlockStatement { + l_curly_token: L_CURLY@110..111 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@111..112 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + FOR_KW@112..117 "for" [Newline("\n")] [Whitespace(" ")], + AWAIT_KW@117..123 "await" [] [Whitespace(" ")], + L_PAREN@123..124 "(" [] [], + JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@124..128 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@128..130 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + IN_KW@130..133 "in" [] [Whitespace(" ")], + JsArrayExpression { + l_brack_token: L_BRACK@133..134 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@134..135 "]" [] [], + }, + R_PAREN@135..137 ")" [] [Whitespace(" ")], + JsBlockStatement { + l_curly_token: L_CURLY@137..138 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@138..139 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + FOR_KW@139..144 "for" [Newline("\n")] [Whitespace(" ")], + AWAIT_KW@144..150 "await" [] [Whitespace(" ")], + L_PAREN@150..151 "(" [] [], + JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@151..155 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@155..157 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@157..159 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@159..160 "0" [] [], + }, + }, + }, + ], + }, + SEMICOLON@160..162 ";" [] [Whitespace(" ")], + JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@162..164 "i" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@164..166 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@166..168 "10" [] [], + }, + }, + SEMICOLON@168..170 ";" [] [Whitespace(" ")], + JsPreUpdateExpression { + operator_token: PLUS2@170..172 "++" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@172..173 "i" [] [], + }, + }, + R_PAREN@173..175 ")" [] [Whitespace(" ")], + JsBlockStatement { + l_curly_token: L_CURLY@175..176 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@176..177 "}" [] [], + }, + ], + }, + JsForStatement { + for_token: FOR_KW@177..182 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@182..183 "(" [] [], + initializer: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@183..187 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@187..188 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@188..189 "a" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@189..190 "]" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + first_semi_token: SEMICOLON@190..191 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@191..192 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@194..195 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@195..196 "}" [] [], + }, + }, + ], + eof_token: EOF@196..197 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..197 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..196 + 0: JS_FOR_STATEMENT@0..39 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: SEMICOLON@4..5 ";" [] [] + 4: (empty) + 5: SEMICOLON@5..7 ";" [] [Whitespace(" ")] + 6: JS_OBJECT_EXPRESSION@7..9 + 0: L_CURLY@7..8 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@8..8 + 2: R_CURLY@8..9 "}" [] [] + 7: (empty) + 8: JS_FOR_STATEMENT@9..39 + 0: FOR_KW@9..14 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_VARIABLE_DECLARATION@14..23 + 0: (empty) + 1: LET_KW@14..18 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@18..23 + 0: JS_VARIABLE_DECLARATOR@18..23 + 0: JS_IDENTIFIER_BINDING@18..20 + 0: IDENT@18..20 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@20..23 + 0: EQ@20..22 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@22..23 + 0: JS_NUMBER_LITERAL@22..23 "5" [] [] + 3: SEMICOLON@23..25 ";" [] [Whitespace(" ")] + 4: JS_BINARY_EXPRESSION@25..31 + 0: JS_IDENTIFIER_EXPRESSION@25..27 + 0: JS_REFERENCE_IDENTIFIER@25..27 + 0: IDENT@25..27 "i" [] [Whitespace(" ")] + 1: L_ANGLE@27..29 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@29..31 + 0: JS_NUMBER_LITERAL@29..31 "10" [] [] + 5: SEMICOLON@31..33 ";" [] [Whitespace(" ")] + 6: JS_POST_UPDATE_EXPRESSION@33..37 + 0: JS_IDENTIFIER_ASSIGNMENT@33..34 + 0: IDENT@33..34 "i" [] [] + 1: PLUS2@34..37 "++" [] [Whitespace(" ")] + 7: (empty) + 8: JS_BLOCK_STATEMENT@37..39 + 0: L_CURLY@37..38 "{" [] [] + 1: JS_STATEMENT_LIST@38..38 + 2: R_CURLY@38..39 "}" [] [] + 1: JS_FOR_STATEMENT@39..69 + 0: FOR_KW@39..44 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_VARIABLE_DECLARATION@44..53 + 0: (empty) + 1: LET_KW@44..48 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@48..53 + 0: JS_VARIABLE_DECLARATOR@48..53 + 0: JS_IDENTIFIER_BINDING@48..50 + 0: IDENT@48..50 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@50..53 + 0: EQ@50..52 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@52..53 + 0: JS_NUMBER_LITERAL@52..53 "5" [] [] + 3: SEMICOLON@53..55 ";" [] [Whitespace(" ")] + 4: JS_BINARY_EXPRESSION@55..61 + 0: JS_IDENTIFIER_EXPRESSION@55..57 + 0: JS_REFERENCE_IDENTIFIER@55..57 + 0: IDENT@55..57 "i" [] [Whitespace(" ")] + 1: L_ANGLE@57..59 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@59..61 + 0: JS_NUMBER_LITERAL@59..61 "10" [] [] + 5: SEMICOLON@61..63 ";" [] [Whitespace(" ")] + 6: JS_PRE_UPDATE_EXPRESSION@63..67 + 0: PLUS2@63..65 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@65..67 + 0: IDENT@65..67 "i" [] [Whitespace(" ")] + 7: (empty) + 8: JS_BLOCK_STATEMENT@67..69 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_STATEMENT_LIST@68..68 + 2: R_CURLY@68..69 "}" [] [] + 2: JS_FOR_IN_STATEMENT@69..84 + 0: FOR_KW@69..74 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@74..75 "(" [] [] + 2: (empty) + 3: IN_KW@75..78 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@78..80 + 0: L_BRACK@78..79 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@79..79 + 2: R_BRACK@79..80 "]" [] [] + 5: R_PAREN@80..82 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@82..84 + 0: L_CURLY@82..83 "{" [] [] + 1: JS_STATEMENT_LIST@83..83 + 2: R_CURLY@83..84 "}" [] [] + 3: JS_BOGUS_STATEMENT@84..112 + 0: FOR_KW@84..89 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@89..90 "(" [] [] + 2: JS_BOGUS@90..103 + 0: LET_KW@90..94 "let" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR@94..95 + 0: JS_IDENTIFIER_BINDING@94..95 + 0: IDENT@94..95 "i" [] [] + 1: (empty) + 2: (empty) + 2: COMMA@95..97 "," [] [Whitespace(" ")] + 3: JS_VARIABLE_DECLARATOR@97..103 + 0: JS_IDENTIFIER_BINDING@97..99 + 0: IDENT@97..99 "j" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@99..103 + 0: EQ@99..101 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@101..103 + 0: JS_NUMBER_LITERAL@101..103 "6" [] [Whitespace(" ")] + 3: OF_KW@103..106 "of" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@106..108 + 0: L_BRACK@106..107 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@107..107 + 2: R_BRACK@107..108 "]" [] [] + 5: R_PAREN@108..110 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@110..112 + 0: L_CURLY@110..111 "{" [] [] + 1: JS_STATEMENT_LIST@111..111 + 2: R_CURLY@111..112 "}" [] [] + 4: JS_BOGUS_STATEMENT@112..139 + 0: FOR_KW@112..117 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@117..123 "await" [] [Whitespace(" ")] + 2: L_PAREN@123..124 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@124..130 + 0: (empty) + 1: LET_KW@124..128 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@128..130 + 0: JS_IDENTIFIER_BINDING@128..130 + 0: IDENT@128..130 "a" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: IN_KW@130..133 "in" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@133..135 + 0: L_BRACK@133..134 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@134..134 + 2: R_BRACK@134..135 "]" [] [] + 6: R_PAREN@135..137 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@137..139 + 0: L_CURLY@137..138 "{" [] [] + 1: JS_STATEMENT_LIST@138..138 + 2: R_CURLY@138..139 "}" [] [] + 5: JS_BOGUS_STATEMENT@139..177 + 0: FOR_KW@139..144 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@144..150 "await" [] [Whitespace(" ")] + 2: L_PAREN@150..151 "(" [] [] + 3: JS_VARIABLE_DECLARATION@151..160 + 0: (empty) + 1: LET_KW@151..155 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@155..160 + 0: JS_VARIABLE_DECLARATOR@155..160 + 0: JS_IDENTIFIER_BINDING@155..157 + 0: IDENT@155..157 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@157..160 + 0: EQ@157..159 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@159..160 + 0: JS_NUMBER_LITERAL@159..160 "0" [] [] + 4: SEMICOLON@160..162 ";" [] [Whitespace(" ")] + 5: JS_BINARY_EXPRESSION@162..168 + 0: JS_IDENTIFIER_EXPRESSION@162..164 + 0: JS_REFERENCE_IDENTIFIER@162..164 + 0: IDENT@162..164 "i" [] [Whitespace(" ")] + 1: L_ANGLE@164..166 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@166..168 + 0: JS_NUMBER_LITERAL@166..168 "10" [] [] + 6: SEMICOLON@168..170 ";" [] [Whitespace(" ")] + 7: JS_PRE_UPDATE_EXPRESSION@170..173 + 0: PLUS2@170..172 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@172..173 + 0: IDENT@172..173 "i" [] [] + 8: R_PAREN@173..175 ")" [] [Whitespace(" ")] + 9: JS_BLOCK_STATEMENT@175..177 + 0: L_CURLY@175..176 "{" [] [] + 1: JS_STATEMENT_LIST@176..176 + 2: R_CURLY@176..177 "}" [] [] + 6: JS_FOR_STATEMENT@177..196 + 0: FOR_KW@177..182 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@182..183 "(" [] [] + 2: JS_VARIABLE_DECLARATION@183..190 + 0: (empty) + 1: LET_KW@183..187 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@187..190 + 0: JS_VARIABLE_DECLARATOR@187..190 + 0: JS_ARRAY_BINDING_PATTERN@187..190 + 0: L_BRACK@187..188 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@188..189 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@188..189 + 0: JS_IDENTIFIER_BINDING@188..189 + 0: IDENT@188..189 "a" [] [] + 1: (empty) + 2: R_BRACK@189..190 "]" [] [] + 1: (empty) + 2: (empty) + 3: SEMICOLON@190..191 ";" [] [] + 4: (empty) + 5: SEMICOLON@191..192 ";" [] [] + 6: (empty) + 7: R_PAREN@192..194 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@194..196 + 0: L_CURLY@194..195 "{" [] [] + 1: JS_STATEMENT_LIST@195..195 + 2: R_CURLY@195..196 "}" [] [] + 4: EOF@196..197 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +for_stmt_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `;` + + > 1 │ for ;; {} + │ ^ + 2 │ for let i = 5; i < 10; i++ {} + 3 │ for let i = 5; i < 10; ++i {} + + i Remove ; + +for_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `for` + + 1 │ for ;; {} + > 2 │ for let i = 5; i < 10; i++ {} + │ ^^^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} + + i Remove for + +for_stmt_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `let` + + 1 │ for ;; {} + > 2 │ for let i = 5; i < 10; i++ {} + │ ^^^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} + + i Remove let + +for_stmt_err.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 1 │ for ;; {} + > 2 │ for let i = 5; i < 10; i++ {} + │ ^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} + + i Remove { + +for_stmt_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `let` + + 1 │ for ;; {} + 2 │ for let i = 5; i < 10; i++ {} + > 3 │ for let i = 5; i < 10; ++i {} + │ ^^^ + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + + i Remove let + +for_stmt_err.js:3:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 1 │ for ;; {} + 2 │ for let i = 5; i < 10; i++ {} + > 3 │ for let i = 5; i < 10; ++i {} + │ ^ + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + + i Remove { + +for_stmt_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Only a single declaration is allowed in a `for...of` statement. + + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} + > 5 │ for (let i, j = 6 of []) {} + │ ^^^^^ + 6 │ for await (let a in []) {} + 7 │ for await (let i = 0; i < 10; ++i) {} + + i additional declarations + +for_stmt_err.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × await can only be used in conjunction with `for...of` statements + + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + > 6 │ for await (let a in []) {} + │ ^^^^^ + 7 │ for await (let i = 0; i < 10; ++i) {} + 8 │ for (let [a];;) {} + + i Remove the await here + + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + > 6 │ for await (let a in []) {} + │ ^^^^^ + 7 │ for await (let i = 0; i < 10; ++i) {} + 8 │ for (let [a];;) {} + + i or convert this to a `for...of` statement + + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + > 6 │ for await (let a in []) {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ for await (let i = 0; i < 10; ++i) {} + 8 │ for (let [a];;) {} + +for_stmt_err.js:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × await can only be used in conjunction with `for...of` statements + + 5 │ for (let i, j = 6 of []) {} + 6 │ for await (let a in []) {} + > 7 │ for await (let i = 0; i < 10; ++i) {} + │ ^^^^^ + 8 │ for (let [a];;) {} + 9 │ + + i Remove the await here + + 5 │ for (let i, j = 6 of []) {} + 6 │ for await (let a in []) {} + > 7 │ for await (let i = 0; i < 10; ++i) {} + │ ^^^^^ + 8 │ for (let [a];;) {} + 9 │ + + i or convert this to a `for...of` statement + + 5 │ for (let i, j = 6 of []) {} + 6 │ for await (let a in []) {} + > 7 │ for await (let i = 0; i < 10; ++i) {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ for (let [a];;) {} + 9 │ + +for_stmt_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Object and Array patterns require initializers. + + 6 │ for await (let a in []) {} + 7 │ for await (let i = 0; i < 10; ++i) {} + > 8 │ for (let [a];;) {} + │ ^^^ + 9 │ + + i This pattern is declared, but it is not given an initialized value. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.js b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/formal_params_invalid.js rename to crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js.snap new file mode 100644 index 000000000000..b183f5596b91 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js.snap @@ -0,0 +1,138 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function (a++, c) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (required), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@9..10 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@10..11 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + missing separator, + JsBogusParameter { + items: [ + PLUS2@11..13 "++" [] [], + ], + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@15..16 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@18..19 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@19..20 "}" [] [], + }, + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_FUNCTION_DECLARATION@0..20 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@9..18 + 0: L_PAREN@9..10 "(" [] [] + 1: JS_PARAMETER_LIST@10..16 + 0: JS_FORMAL_PARAMETER@10..11 + 0: JS_DECORATOR_LIST@10..10 + 1: JS_IDENTIFIER_BINDING@10..11 + 0: IDENT@10..11 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: (empty) + 2: JS_BOGUS_PARAMETER@11..13 + 0: PLUS2@11..13 "++" [] [] + 3: COMMA@13..15 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@15..16 + 0: JS_DECORATOR_LIST@15..15 + 1: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "c" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@18..20 + 0: L_CURLY@18..19 "{" [] [] + 1: JS_DIRECTIVE_LIST@19..19 + 2: JS_STATEMENT_LIST@19..19 + 3: R_CURLY@19..20 "}" [] [] + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +formal_params_invalid.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a name for the function in a function declaration, but found none + + > 1 │ function (a++, c) {} + │ ^ + 2 │ + +formal_params_invalid.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `++` + + > 1 │ function (a++, c) {} + │ ^^ + 2 │ + + i Remove ++ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.js b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.js rename to crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js.snap new file mode 100644 index 000000000000..712dd104f5a3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js.snap @@ -0,0 +1,101 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo(true) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + TRUE_KW@13..17 "true" [] [], + ], + }, + ], + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@19..20 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_FUNCTION_DECLARATION@0..21 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..19 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..17 + 0: JS_BOGUS_PARAMETER@13..17 + 0: TRUE_KW@13..17 "true" [] [] + 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@19..21 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_DIRECTIVE_LIST@20..20 + 2: JS_STATEMENT_LIST@20..20 + 3: R_CURLY@20..21 "}" [] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +formal_params_no_binding_element.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parameter but instead found 'true'. + + > 1 │ function foo(true) {} + │ ^^^^ + 2 │ + + i Expected a parameter here. + + > 1 │ function foo(true) {} + │ ^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_broken.js b/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_broken.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_broken.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js.snap new file mode 100644 index 000000000000..ae14c0e66d94 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js.snap @@ -0,0 +1,150 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo())})}{{{ {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..14 ")" [] [], + }, + return_type_annotation: missing (optional), + body: missing (required), + }, + JsBogusStatement { + items: [ + R_PAREN@14..15 ")" [] [], + R_CURLY@15..16 "}" [] [], + R_PAREN@16..17 ")" [] [], + R_CURLY@17..18 "}" [] [], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@18..19 "{" [] [], + statements: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@19..20 "{" [] [], + statements: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@20..23 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@23..24 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + ], + r_curly_token: missing (required), + }, + ], + r_curly_token: missing (required), + }, + ], + r_curly_token: missing (required), + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..25 + 0: JS_FUNCTION_DECLARATION@0..14 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..14 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..14 ")" [] [] + 6: (empty) + 7: (empty) + 1: JS_BOGUS_STATEMENT@14..18 + 0: R_PAREN@14..15 ")" [] [] + 1: R_CURLY@15..16 "}" [] [] + 2: R_PAREN@16..17 ")" [] [] + 3: R_CURLY@17..18 "}" [] [] + 2: JS_BLOCK_STATEMENT@18..25 + 0: L_CURLY@18..19 "{" [] [] + 1: JS_STATEMENT_LIST@19..25 + 0: JS_BLOCK_STATEMENT@19..25 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_STATEMENT_LIST@20..25 + 0: JS_BLOCK_STATEMENT@20..25 + 0: L_CURLY@20..23 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@23..25 + 0: JS_BLOCK_STATEMENT@23..25 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_STATEMENT_LIST@24..24 + 2: R_CURLY@24..25 "}" [] [] + 2: (empty) + 2: (empty) + 2: (empty) + 4: EOF@25..26 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +function_broken.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a function body but instead found ')'. + + > 1 │ function foo())})}{{{ {} + │ ^ + 2 │ + + i Expected a function body here. + + > 1 │ function foo())})}{{{ {} + │ ^ + 2 │ + +function_broken.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead the file ends + + 1 │ function foo())})}{{{ {} + > 2 │ + │ + + i the file ends here + + 1 │ function foo())})}{{{ {} + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_decl_err.js b/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_decl_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js.snap new file mode 100644 index 000000000000..9aabd1db14ab --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js.snap @@ -0,0 +1,585 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function() {} +function foo {} +function {} +function *() {} +async function() {} +async function *() {} +function *foo2() {} +yield foo3; +function test2(): number {} +function foo4(await) {} +function foo5(yield) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..8 "function" [] [], + star_token: missing (optional), + id: missing (required), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@8..9 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@9..11 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@11..12 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@12..13 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@13..23 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@23..27 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + parameters: missing (required), + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@27..28 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: missing (required), + type_parameters: missing (optional), + parameters: missing (required), + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@39..40 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@51..52 "*" [] [], + id: missing (required), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@55..56 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@56..57 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@57..64 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@64..72 "function" [] [], + star_token: missing (optional), + id: missing (required), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@72..73 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@73..75 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@75..76 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@76..77 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")], + star_token: STAR@93..94 "*" [] [], + id: missing (required), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@94..95 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@95..97 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@97..98 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@98..99 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@99..109 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@109..110 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@110..114 "foo2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@114..115 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@117..118 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@118..119 "}" [] [], + }, + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@119..126 "yield" [Newline("\n")] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@126..130 "foo3" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@130..131 ";" [] [], + }, + JsBogusStatement { + items: [ + FUNCTION_KW@131..141 "function" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@141..146 "test2" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@146..147 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@147..148 ")" [] [], + }, + JsBogus { + items: [ + COLON@148..150 ":" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@150..157 "number" [] [Whitespace(" ")], + }, + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@157..158 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@158..159 "}" [] [], + }, + ], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@159..169 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@169..173 "foo4" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@173..174 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@174..179 "await" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@179..181 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@181..182 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@182..183 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@183..193 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@193..197 "foo5" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@197..198 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@198..203 "yield" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@203..205 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@205..206 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@206..207 "}" [] [], + }, + }, + ], + eof_token: EOF@207..208 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..208 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..207 + 0: JS_FUNCTION_DECLARATION@0..13 + 0: (empty) + 1: FUNCTION_KW@0..8 "function" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@8..11 + 0: L_PAREN@8..9 "(" [] [] + 1: JS_PARAMETER_LIST@9..9 + 2: R_PAREN@9..11 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@11..13 + 0: L_CURLY@11..12 "{" [] [] + 1: JS_DIRECTIVE_LIST@12..12 + 2: JS_STATEMENT_LIST@12..12 + 3: R_CURLY@12..13 "}" [] [] + 1: JS_FUNCTION_DECLARATION@13..29 + 0: (empty) + 1: FUNCTION_KW@13..23 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@23..27 + 0: IDENT@23..27 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: JS_FUNCTION_BODY@27..29 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..28 + 3: R_CURLY@28..29 "}" [] [] + 2: JS_FUNCTION_DECLARATION@29..41 + 0: (empty) + 1: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: JS_FUNCTION_BODY@39..41 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..40 + 3: R_CURLY@40..41 "}" [] [] + 3: JS_FUNCTION_DECLARATION@41..57 + 0: (empty) + 1: FUNCTION_KW@41..51 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@51..52 "*" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@55..57 + 0: L_CURLY@55..56 "{" [] [] + 1: JS_DIRECTIVE_LIST@56..56 + 2: JS_STATEMENT_LIST@56..56 + 3: R_CURLY@56..57 "}" [] [] + 4: JS_FUNCTION_DECLARATION@57..77 + 0: ASYNC_KW@57..64 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@64..72 "function" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@72..75 + 0: L_PAREN@72..73 "(" [] [] + 1: JS_PARAMETER_LIST@73..73 + 2: R_PAREN@73..75 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@75..77 + 0: L_CURLY@75..76 "{" [] [] + 1: JS_DIRECTIVE_LIST@76..76 + 2: JS_STATEMENT_LIST@76..76 + 3: R_CURLY@76..77 "}" [] [] + 5: JS_FUNCTION_DECLARATION@77..99 + 0: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")] + 2: STAR@93..94 "*" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@94..97 + 0: L_PAREN@94..95 "(" [] [] + 1: JS_PARAMETER_LIST@95..95 + 2: R_PAREN@95..97 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@97..99 + 0: L_CURLY@97..98 "{" [] [] + 1: JS_DIRECTIVE_LIST@98..98 + 2: JS_STATEMENT_LIST@98..98 + 3: R_CURLY@98..99 "}" [] [] + 6: JS_FUNCTION_DECLARATION@99..119 + 0: (empty) + 1: FUNCTION_KW@99..109 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@109..110 "*" [] [] + 3: JS_IDENTIFIER_BINDING@110..114 + 0: IDENT@110..114 "foo2" [] [] + 4: (empty) + 5: JS_PARAMETERS@114..117 + 0: L_PAREN@114..115 "(" [] [] + 1: JS_PARAMETER_LIST@115..115 + 2: R_PAREN@115..117 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@117..119 + 0: L_CURLY@117..118 "{" [] [] + 1: JS_DIRECTIVE_LIST@118..118 + 2: JS_STATEMENT_LIST@118..118 + 3: R_CURLY@118..119 "}" [] [] + 7: JS_EXPRESSION_STATEMENT@119..131 + 0: JS_BOGUS_EXPRESSION@119..130 + 0: YIELD_KW@119..126 "yield" [Newline("\n")] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@126..130 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@126..130 + 0: JS_REFERENCE_IDENTIFIER@126..130 + 0: IDENT@126..130 "foo3" [] [] + 1: SEMICOLON@130..131 ";" [] [] + 8: JS_BOGUS_STATEMENT@131..159 + 0: FUNCTION_KW@131..141 "function" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@141..146 + 0: IDENT@141..146 "test2" [] [] + 2: JS_PARAMETERS@146..148 + 0: L_PAREN@146..147 "(" [] [] + 1: JS_PARAMETER_LIST@147..147 + 2: R_PAREN@147..148 ")" [] [] + 3: JS_BOGUS@148..157 + 0: COLON@148..150 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@150..157 + 0: NUMBER_KW@150..157 "number" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@157..159 + 0: L_CURLY@157..158 "{" [] [] + 1: JS_DIRECTIVE_LIST@158..158 + 2: JS_STATEMENT_LIST@158..158 + 3: R_CURLY@158..159 "}" [] [] + 9: JS_FUNCTION_DECLARATION@159..183 + 0: (empty) + 1: FUNCTION_KW@159..169 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@169..173 + 0: IDENT@169..173 "foo4" [] [] + 4: (empty) + 5: JS_PARAMETERS@173..181 + 0: L_PAREN@173..174 "(" [] [] + 1: JS_PARAMETER_LIST@174..179 + 0: JS_FORMAL_PARAMETER@174..179 + 0: JS_DECORATOR_LIST@174..174 + 1: JS_BOGUS_BINDING@174..179 + 0: IDENT@174..179 "await" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@179..181 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@181..183 + 0: L_CURLY@181..182 "{" [] [] + 1: JS_DIRECTIVE_LIST@182..182 + 2: JS_STATEMENT_LIST@182..182 + 3: R_CURLY@182..183 "}" [] [] + 10: JS_FUNCTION_DECLARATION@183..207 + 0: (empty) + 1: FUNCTION_KW@183..193 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@193..197 + 0: IDENT@193..197 "foo5" [] [] + 4: (empty) + 5: JS_PARAMETERS@197..205 + 0: L_PAREN@197..198 "(" [] [] + 1: JS_PARAMETER_LIST@198..203 + 0: JS_FORMAL_PARAMETER@198..203 + 0: JS_DECORATOR_LIST@198..198 + 1: JS_BOGUS_BINDING@198..203 + 0: IDENT@198..203 "yield" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@203..205 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@205..207 + 0: L_CURLY@205..206 "{" [] [] + 1: JS_DIRECTIVE_LIST@206..206 + 2: JS_STATEMENT_LIST@206..206 + 3: R_CURLY@206..207 "}" [] [] + 4: EOF@207..208 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +function_decl_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a name for the function in a function declaration, but found none + + > 1 │ function() {} + │ ^ + 2 │ function foo {} + 3 │ function {} + +function_decl_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parenthesis '(' but instead found '{'. + + 1 │ function() {} + > 2 │ function foo {} + │ ^ + 3 │ function {} + 4 │ function *() {} + + i Expected a parenthesis '(' here. + + 1 │ function() {} + > 2 │ function foo {} + │ ^ + 3 │ function {} + 4 │ function *() {} + +function_decl_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a name for the function in a function declaration, but found none + + 1 │ function() {} + 2 │ function foo {} + > 3 │ function {} + │ ^ + 4 │ function *() {} + 5 │ async function() {} + +function_decl_err.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a name for the function in a function declaration, but found none + + 2 │ function foo {} + 3 │ function {} + > 4 │ function *() {} + │ ^ + 5 │ async function() {} + 6 │ async function *() {} + +function_decl_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a name for the function in a function declaration, but found none + + 3 │ function {} + 4 │ function *() {} + > 5 │ async function() {} + │ ^ + 6 │ async function *() {} + 7 │ function *foo2() {} + +function_decl_err.js:6:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a name for the function in a function declaration, but found none + + 4 │ function *() {} + 5 │ async function() {} + > 6 │ async function *() {} + │ ^ + 7 │ function *foo2() {} + 8 │ yield foo3; + +function_decl_err.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 6 │ async function *() {} + 7 │ function *foo2() {} + > 8 │ yield foo3; + │ ^^^^^ + 9 │ function test2(): number {} + 10 │ function foo4(await) {} + +function_decl_err.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × return types can only be used in TypeScript files + + 7 │ function *foo2() {} + 8 │ yield foo3; + > 9 │ function test2(): number {} + │ ^^^^^^^^ + 10 │ function foo4(await) {} + 11 │ function foo5(yield) {} + +function_decl_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier inside of a module + + 8 │ yield foo3; + 9 │ function test2(): number {} + > 10 │ function foo4(await) {} + │ ^^^^^ + 11 │ function foo5(yield) {} + 12 │ + +function_decl_err.js:11:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + 9 │ function test2(): number {} + 10 │ function foo4(await) {} + > 11 │ function foo5(yield) {} + │ ^^^^^ + 12 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_escaped_async.js b/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_escaped_async.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js.snap new file mode 100644 index 000000000000..138a324b0c9d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js.snap @@ -0,0 +1,93 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +void \u0061sync function f(){} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: VOID_KW@0..5 "void" [] [Whitespace(" ")], + argument: JsBogusExpression { + items: [ + ERROR_TOKEN@5..16 "\\u0061sync" [] [Whitespace(" ")], + FUNCTION_KW@16..25 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@25..26 "f" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@26..27 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@27..28 ")" [] [], + }, + JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + ], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_EXPRESSION_STATEMENT@0..30 + 0: JS_UNARY_EXPRESSION@0..30 + 0: VOID_KW@0..5 "void" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@5..30 + 0: ERROR_TOKEN@5..16 "\\u0061sync" [] [Whitespace(" ")] + 1: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "f" [] [] + 3: JS_PARAMETERS@26..28 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_PARAMETER_LIST@27..27 + 2: R_PAREN@27..28 ")" [] [] + 4: JS_FUNCTION_BODY@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..30 "}" [] [] + 1: (empty) + 4: EOF@30..31 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +function_escaped_async.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'async' keyword cannot contain escape character. + + > 1 │ void \u0061sync function f(){} + │ ^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.js b/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_expression_id_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js.snap new file mode 100644 index 000000000000..22753a10d683 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js.snap @@ -0,0 +1,255 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(async function await() {}); +(function* yield() {}); +function* test() { function yield() {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsFunctionExpression { + async_token: ASYNC_KW@1..7 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsBogusBinding { + items: [ + IDENT@16..21 "await" [] [], + ], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@24..25 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + }, + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@28..30 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@30..38 "function" [] [], + star_token: STAR@38..40 "*" [] [Whitespace(" ")], + id: JsBogusBinding { + items: [ + IDENT@40..45 "yield" [] [], + ], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@45..46 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@48..49 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@49..50 "}" [] [], + }, + }, + r_paren_token: R_PAREN@50..51 ")" [] [], + }, + semicolon_token: SEMICOLON@51..52 ";" [] [], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@52..61 "function" [Newline("\n")] [], + star_token: STAR@61..63 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@63..67 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@67..68 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@70..72 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@72..81 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsBogusBinding { + items: [ + IDENT@81..86 "yield" [] [], + ], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@86..87 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@87..89 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@89..90 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@90..92 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + }, + ], + eof_token: EOF@93..94 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..94 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..93 + 0: JS_EXPRESSION_STATEMENT@0..28 + 0: JS_PARENTHESIZED_EXPRESSION@0..27 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_FUNCTION_EXPRESSION@1..26 + 0: ASYNC_KW@1..7 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_BOGUS_BINDING@16..21 + 0: IDENT@16..21 "await" [] [] + 4: (empty) + 5: JS_PARAMETERS@21..24 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_PARAMETER_LIST@22..22 + 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@24..26 + 0: L_CURLY@24..25 "{" [] [] + 1: JS_DIRECTIVE_LIST@25..25 + 2: JS_STATEMENT_LIST@25..25 + 3: R_CURLY@25..26 "}" [] [] + 2: R_PAREN@26..27 ")" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@28..52 + 0: JS_PARENTHESIZED_EXPRESSION@28..51 + 0: L_PAREN@28..30 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@30..50 + 0: (empty) + 1: FUNCTION_KW@30..38 "function" [] [] + 2: STAR@38..40 "*" [] [Whitespace(" ")] + 3: JS_BOGUS_BINDING@40..45 + 0: IDENT@40..45 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@45..48 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_PARAMETER_LIST@46..46 + 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@48..50 + 0: L_CURLY@48..49 "{" [] [] + 1: JS_DIRECTIVE_LIST@49..49 + 2: JS_STATEMENT_LIST@49..49 + 3: R_CURLY@49..50 "}" [] [] + 2: R_PAREN@50..51 ")" [] [] + 1: SEMICOLON@51..52 ";" [] [] + 2: JS_FUNCTION_DECLARATION@52..93 + 0: (empty) + 1: FUNCTION_KW@52..61 "function" [Newline("\n")] [] + 2: STAR@61..63 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@63..67 + 0: IDENT@63..67 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@67..70 + 0: L_PAREN@67..68 "(" [] [] + 1: JS_PARAMETER_LIST@68..68 + 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@70..93 + 0: L_CURLY@70..72 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@72..72 + 2: JS_STATEMENT_LIST@72..92 + 0: JS_FUNCTION_DECLARATION@72..92 + 0: (empty) + 1: FUNCTION_KW@72..81 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_BOGUS_BINDING@81..86 + 0: IDENT@81..86 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@86..89 + 0: L_PAREN@86..87 "(" [] [] + 1: JS_PARAMETER_LIST@87..87 + 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@89..92 + 0: L_CURLY@89..90 "{" [] [] + 1: JS_DIRECTIVE_LIST@90..90 + 2: JS_STATEMENT_LIST@90..90 + 3: R_CURLY@90..92 "}" [] [Whitespace(" ")] + 3: R_CURLY@92..93 "}" [] [] + 4: EOF@93..94 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +function_expression_id_err.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + > 1 │ (async function await() {}); + │ ^^^^^ + 2 │ (function* yield() {}); + 3 │ function* test() { function yield() {} } + +function_expression_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `yield` as an identifier in generator function + + 1 │ (async function await() {}); + > 2 │ (function* yield() {}); + │ ^^^^^ + 3 │ function* test() { function yield() {} } + 4 │ + +function_expression_id_err.js:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `yield` as an identifier in generator function + + 1 │ (async function await() {}); + 2 │ (function* yield() {}); + > 3 │ function* test() { function yield() {} } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_id_err.js b/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_id_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js.snap new file mode 100644 index 000000000000..5233962ec75f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js.snap @@ -0,0 +1,149 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function* test() { + function yield(test) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..8 "function" [] [], + star_token: STAR@8..10 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@10..14 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@14..15 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + id: JsBogusBinding { + items: [ + IDENT@30..35 "yield" [] [], + ], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@35..36 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@36..40 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@42..43 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@46..47 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..47 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..46 + 0: JS_FUNCTION_DECLARATION@0..46 + 0: (empty) + 1: FUNCTION_KW@0..8 "function" [] [] + 2: STAR@8..10 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@10..14 + 0: IDENT@10..14 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@14..17 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_PARAMETER_LIST@15..15 + 2: R_PAREN@15..17 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@17..46 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..44 + 0: JS_FUNCTION_DECLARATION@18..44 + 0: (empty) + 1: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_BOGUS_BINDING@30..35 + 0: IDENT@30..35 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@35..42 + 0: L_PAREN@35..36 "(" [] [] + 1: JS_PARAMETER_LIST@36..40 + 0: JS_FORMAL_PARAMETER@36..40 + 0: JS_DECORATOR_LIST@36..36 + 1: JS_IDENTIFIER_BINDING@36..40 + 0: IDENT@36..40 "test" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@42..44 + 0: L_CURLY@42..43 "{" [] [] + 1: JS_DIRECTIVE_LIST@43..43 + 2: JS_STATEMENT_LIST@43..43 + 3: R_CURLY@43..44 "}" [] [] + 3: R_CURLY@44..46 "}" [Newline("\n")] [] + 4: EOF@46..47 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +function_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `yield` as an identifier in generator function + + 1 │ function* test() { + > 2 │ function yield(test) {} + │ ^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.js b/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap new file mode 100644 index 000000000000..d2ff546a3d74 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap @@ -0,0 +1,214 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) function a() {} +label1: function b() {} +while (true) function c() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsBogusStatement { + items: [ + FUNCTION_KW@10..19 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@19..20 "a" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + ], + }, + else_clause: missing (optional), + }, + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@25..32 "label1" [Newline("\n")] [], + }, + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + FUNCTION_KW@34..43 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@43..44 "b" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@47..48 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + ], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@49..56 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@56..57 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@57..61 "true" [] [], + }, + r_paren_token: R_PAREN@61..63 ")" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + FUNCTION_KW@63..72 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@72..73 "c" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@73..74 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@74..76 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@76..77 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@77..78 "}" [] [], + }, + ], + }, + }, + ], + eof_token: EOF@78..79 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..79 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..78 + 0: JS_IF_STATEMENT@0..25 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@10..25 + 0: FUNCTION_KW@10..19 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "a" [] [] + 2: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@23..25 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..24 + 3: R_CURLY@24..25 "}" [] [] + 5: (empty) + 1: JS_LABELED_STATEMENT@25..49 + 0: JS_LABEL@25..32 + 0: IDENT@25..32 "label1" [Newline("\n")] [] + 1: COLON@32..34 ":" [] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@34..49 + 0: FUNCTION_KW@34..43 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@43..44 + 0: IDENT@43..44 "b" [] [] + 2: JS_PARAMETERS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..45 + 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@47..49 + 0: L_CURLY@47..48 "{" [] [] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..48 + 3: R_CURLY@48..49 "}" [] [] + 2: JS_WHILE_STATEMENT@49..78 + 0: WHILE_KW@49..56 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@56..57 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@57..61 + 0: TRUE_KW@57..61 "true" [] [] + 3: R_PAREN@61..63 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@63..78 + 0: FUNCTION_KW@63..72 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@72..73 + 0: IDENT@72..73 "c" [] [] + 2: JS_PARAMETERS@73..76 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_PARAMETER_LIST@74..74 + 2: R_PAREN@74..76 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@76..78 + 0: L_CURLY@76..77 "{" [] [] + 1: JS_DIRECTIVE_LIST@77..77 + 2: JS_STATEMENT_LIST@77..77 + 3: R_CURLY@77..78 "}" [] [] + 4: EOF@78..79 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +function_in_single_statement_context_strict.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In strict mode code, functions can only be declared at top level or inside a block + + > 1 │ if (true) function a() {} + │ ^^^^^^^^^^^^^^^ + 2 │ label1: function b() {} + 3 │ while (true) function c() {} + + i wrap the function in a block statement + +function_in_single_statement_context_strict.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In strict mode code, functions can only be declared at top level or inside a block + + 1 │ if (true) function a() {} + > 2 │ label1: function b() {} + │ ^^^^^^^^^^^^^^^ + 3 │ while (true) function c() {} + 4 │ + + i wrap the function in a block statement + +function_in_single_statement_context_strict.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In strict mode code, functions can only be declared at top level or inside a block + + 1 │ if (true) function a() {} + 2 │ label1: function b() {} + > 3 │ while (true) function c() {} + │ ^^^^^^^^^^^^^^^ + 4 │ + + i wrap the function in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.js b/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/getter_class_no_body.js rename to crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js.snap new file mode 100644 index 000000000000..a5a174886466 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js.snap @@ -0,0 +1,108 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Getters { + get foo() +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..14 "Getters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsClassMemberList [ + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@22..25 "foo" [] [], + }, + l_paren_token: L_PAREN@25..26 "(" [] [], + r_paren_token: R_PAREN@26..27 ")" [] [], + return_type: missing (optional), + body: missing (required), + }, + ], + r_curly_token: R_CURLY@27..29 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_CLASS_DECLARATION@0..29 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..14 + 0: IDENT@6..14 "Getters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@14..15 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@15..27 + 0: JS_GETTER_CLASS_MEMBER@15..27 + 0: JS_METHOD_MODIFIER_LIST@15..15 + 1: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@22..25 + 0: IDENT@22..25 "foo" [] [] + 3: L_PAREN@25..26 "(" [] [] + 4: R_PAREN@26..27 ")" [] [] + 5: (empty) + 6: (empty) + 9: R_CURLY@27..29 "}" [Newline("\n")] [] + 4: EOF@29..30 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +getter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found '}'. + + 1 │ class Getters { + 2 │ get foo() + > 3 │ } + │ ^ + 4 │ + + i Expected a class method body here. + + 1 │ class Getters { + 2 │ get foo() + > 3 │ } + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/identifier.js b/crates/biome_js_parser/tests/js_test_suite/error/identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/identifier.js rename to crates/biome_js_parser/tests/js_test_suite/error/identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/identifier.js.snap new file mode 100644 index 000000000000..5b443c153af7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/identifier.js.snap @@ -0,0 +1,96 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +yield; +await; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@0..5 "yield" [] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@5..6 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@6..12 "await" [Newline("\n")] [], + argument: missing (required), + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: JS_EXPRESSION_STATEMENT@0..6 + 0: JS_BOGUS_EXPRESSION@0..5 + 0: JS_BOGUS@0..5 + 0: IDENT@0..5 "yield" [] [] + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@6..13 + 0: JS_AWAIT_EXPRESSION@6..12 + 0: AWAIT_KW@6..12 "await" [Newline("\n")] [] + 1: (empty) + 1: SEMICOLON@12..13 ";" [] [] + 4: EOF@13..14 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +identifier.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + > 1 │ yield; + │ ^^^^^ + 2 │ await; + 3 │ + +identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an unary expression but instead found ';'. + + 1 │ yield; + > 2 │ await; + │ ^ + 3 │ + + i Expected an unary expression here. + + 1 │ yield; + > 2 │ await; + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/identifier_err.js b/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/identifier_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js.snap new file mode 100644 index 000000000000..3d5d09055c1c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js.snap @@ -0,0 +1,321 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +yield; +await; +async function test(await) {} +function* test(yield) {} +enum; +implements; +interface; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@0..5 "yield" [] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@5..6 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@6..12 "await" [Newline("\n")] [], + argument: missing (required), + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@13..20 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@20..29 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@29..33 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@33..34 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@34..39 "await" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@41..42 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@43..52 "function" [Newline("\n")] [], + star_token: STAR@52..54 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@54..58 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@58..59 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@59..64 "yield" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@66..67 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + }, + JsBogusStatement { + items: [ + ENUM_KW@68..73 "enum" [Newline("\n")] [], + TsEnumMemberList [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@73..74 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@74..85 "implements" [Newline("\n")] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@85..86 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@86..96 "interface" [Newline("\n")] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@96..97 ";" [] [], + }, + ], + eof_token: EOF@97..98 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..98 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..97 + 0: JS_EXPRESSION_STATEMENT@0..6 + 0: JS_BOGUS_EXPRESSION@0..5 + 0: JS_BOGUS@0..5 + 0: IDENT@0..5 "yield" [] [] + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@6..13 + 0: JS_AWAIT_EXPRESSION@6..12 + 0: AWAIT_KW@6..12 "await" [Newline("\n")] [] + 1: (empty) + 1: SEMICOLON@12..13 ";" [] [] + 2: JS_FUNCTION_DECLARATION@13..43 + 0: ASYNC_KW@13..20 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@20..29 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@29..33 + 0: IDENT@29..33 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@33..41 + 0: L_PAREN@33..34 "(" [] [] + 1: JS_PARAMETER_LIST@34..39 + 0: JS_FORMAL_PARAMETER@34..39 + 0: JS_DECORATOR_LIST@34..34 + 1: JS_BOGUS_BINDING@34..39 + 0: IDENT@34..39 "await" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@41..43 + 0: L_CURLY@41..42 "{" [] [] + 1: JS_DIRECTIVE_LIST@42..42 + 2: JS_STATEMENT_LIST@42..42 + 3: R_CURLY@42..43 "}" [] [] + 3: JS_FUNCTION_DECLARATION@43..68 + 0: (empty) + 1: FUNCTION_KW@43..52 "function" [Newline("\n")] [] + 2: STAR@52..54 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@54..58 + 0: IDENT@54..58 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@58..66 + 0: L_PAREN@58..59 "(" [] [] + 1: JS_PARAMETER_LIST@59..64 + 0: JS_FORMAL_PARAMETER@59..64 + 0: JS_DECORATOR_LIST@59..59 + 1: JS_BOGUS_BINDING@59..64 + 0: IDENT@59..64 "yield" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@64..66 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@66..68 + 0: L_CURLY@66..67 "{" [] [] + 1: JS_DIRECTIVE_LIST@67..67 + 2: JS_STATEMENT_LIST@67..67 + 3: R_CURLY@67..68 "}" [] [] + 4: JS_BOGUS_STATEMENT@68..73 + 0: ENUM_KW@68..73 "enum" [Newline("\n")] [] + 1: TS_ENUM_MEMBER_LIST@73..73 + 5: JS_EMPTY_STATEMENT@73..74 + 0: SEMICOLON@73..74 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@74..86 + 0: JS_BOGUS_EXPRESSION@74..85 + 0: JS_BOGUS@74..85 + 0: IDENT@74..85 "implements" [Newline("\n")] [] + 1: SEMICOLON@85..86 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@86..97 + 0: JS_BOGUS_EXPRESSION@86..96 + 0: JS_BOGUS@86..96 + 0: IDENT@86..96 "interface" [Newline("\n")] [] + 1: SEMICOLON@96..97 ";" [] [] + 4: EOF@97..98 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +identifier_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + > 1 │ yield; + │ ^^^^^ + 2 │ await; + 3 │ async function test(await) {} + +identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an unary expression but instead found ';'. + + 1 │ yield; + > 2 │ await; + │ ^ + 3 │ async function test(await) {} + 4 │ function* test(yield) {} + + i Expected an unary expression here. + + 1 │ yield; + > 2 │ await; + │ ^ + 3 │ async function test(await) {} + 4 │ function* test(yield) {} + +identifier_err.js:3:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 1 │ yield; + 2 │ await; + > 3 │ async function test(await) {} + │ ^^^^^ + 4 │ function* test(yield) {} + 5 │ enum; + +identifier_err.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `yield` as an identifier in generator function + + 2 │ await; + 3 │ async function test(await) {} + > 4 │ function* test(yield) {} + │ ^^^^^ + 5 │ enum; + 6 │ implements; + +identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 3 │ async function test(await) {} + 4 │ function* test(yield) {} + > 5 │ enum; + │ ^^^^ + 6 │ implements; + 7 │ interface; + + i TypeScript only syntax + +identifier_err.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `implements` as an identifier in strict mode + + 4 │ function* test(yield) {} + 5 │ enum; + > 6 │ implements; + │ ^^^^^^^^^^ + 7 │ interface; + 8 │ + +identifier_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `interface` as an identifier in strict mode + + 5 │ enum; + 6 │ implements; + > 7 │ interface; + │ ^^^^^^^^^ + 8 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/if_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/if_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js.snap new file mode 100644 index 000000000000..3874a6acb134 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js.snap @@ -0,0 +1,282 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) else {} +if (true) else +if else {} +if () {} else {} +if (true)}}}} {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: missing (required), + else_clause: JsElseClause { + else_token: ELSE_KW@10..15 "else" [] [Whitespace(" ")], + alternate: JsBlockStatement { + l_curly_token: L_CURLY@15..16 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + }, + JsIfStatement { + if_token: IF_KW@17..21 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@21..22 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@22..26 "true" [] [], + }, + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + consequent: missing (required), + else_clause: JsElseClause { + else_token: ELSE_KW@28..32 "else" [] [], + alternate: JsIfStatement { + if_token: IF_KW@32..36 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + consequent: missing (required), + else_clause: JsElseClause { + else_token: ELSE_KW@36..41 "else" [] [Whitespace(" ")], + alternate: JsBlockStatement { + l_curly_token: L_CURLY@41..42 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + }, + }, + }, + }, + JsIfStatement { + if_token: IF_KW@43..47 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@47..48 "(" [] [], + test: missing (required), + r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], + consequent: JsBlockStatement { + l_curly_token: L_CURLY@50..51 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@51..53 "}" [] [Whitespace(" ")], + }, + else_clause: JsElseClause { + else_token: ELSE_KW@53..58 "else" [] [Whitespace(" ")], + alternate: JsBlockStatement { + l_curly_token: L_CURLY@58..59 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + }, + }, + JsIfStatement { + if_token: IF_KW@60..64 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@64..65 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@65..69 "true" [] [], + }, + r_paren_token: R_PAREN@69..70 ")" [] [], + consequent: missing (required), + else_clause: missing (optional), + }, + JsBogusStatement { + items: [ + R_CURLY@70..71 "}" [] [], + R_CURLY@71..72 "}" [] [], + R_CURLY@72..73 "}" [] [], + R_CURLY@73..75 "}" [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@75..76 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@76..77 "}" [] [], + }, + ], + eof_token: EOF@77..78 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..78 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..77 + 0: JS_IF_STATEMENT@0..17 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_ELSE_CLAUSE@10..17 + 0: ELSE_KW@10..15 "else" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@15..17 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_STATEMENT_LIST@16..16 + 2: R_CURLY@16..17 "}" [] [] + 1: JS_IF_STATEMENT@17..43 + 0: IF_KW@17..21 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@21..22 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@22..26 + 0: TRUE_KW@22..26 "true" [] [] + 3: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_ELSE_CLAUSE@28..43 + 0: ELSE_KW@28..32 "else" [] [] + 1: JS_IF_STATEMENT@32..43 + 0: IF_KW@32..36 "if" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_ELSE_CLAUSE@36..43 + 0: ELSE_KW@36..41 "else" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@41..43 + 0: L_CURLY@41..42 "{" [] [] + 1: JS_STATEMENT_LIST@42..42 + 2: R_CURLY@42..43 "}" [] [] + 2: JS_IF_STATEMENT@43..60 + 0: IF_KW@43..47 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@47..48 "(" [] [] + 2: (empty) + 3: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@50..53 + 0: L_CURLY@50..51 "{" [] [] + 1: JS_STATEMENT_LIST@51..51 + 2: R_CURLY@51..53 "}" [] [Whitespace(" ")] + 5: JS_ELSE_CLAUSE@53..60 + 0: ELSE_KW@53..58 "else" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@58..60 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_STATEMENT_LIST@59..59 + 2: R_CURLY@59..60 "}" [] [] + 3: JS_IF_STATEMENT@60..70 + 0: IF_KW@60..64 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@64..65 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@65..69 + 0: TRUE_KW@65..69 "true" [] [] + 3: R_PAREN@69..70 ")" [] [] + 4: (empty) + 5: (empty) + 4: JS_BOGUS_STATEMENT@70..75 + 0: R_CURLY@70..71 "}" [] [] + 1: R_CURLY@71..72 "}" [] [] + 2: R_CURLY@72..73 "}" [] [] + 3: R_CURLY@73..75 "}" [] [Whitespace(" ")] + 5: JS_BLOCK_STATEMENT@75..77 + 0: L_CURLY@75..76 "{" [] [] + 1: JS_STATEMENT_LIST@76..76 + 2: R_CURLY@76..77 "}" [] [] + 4: EOF@77..78 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +if_stmt_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found 'else'. + + > 1 │ if (true) else {} + │ ^^^^ + 2 │ if (true) else + 3 │ if else {} + + i Expected a statement here. + + > 1 │ if (true) else {} + │ ^^^^ + 2 │ if (true) else + 3 │ if else {} + +if_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found 'else'. + + 1 │ if (true) else {} + > 2 │ if (true) else + │ ^^^^ + 3 │ if else {} + 4 │ if () {} else {} + + i Expected a statement here. + + 1 │ if (true) else {} + > 2 │ if (true) else + │ ^^^^ + 3 │ if else {} + 4 │ if () {} else {} + +if_stmt_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `else` + + 1 │ if (true) else {} + 2 │ if (true) else + > 3 │ if else {} + │ ^^^^ + 4 │ if () {} else {} + 5 │ if (true)}}}} {} + + i Remove else + +if_stmt_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ')'. + + 2 │ if (true) else + 3 │ if else {} + > 4 │ if () {} else {} + │ ^ + 5 │ if (true)}}}} {} + 6 │ + + i Expected an expression here. + + 2 │ if (true) else + 3 │ if else {} + > 4 │ if () {} else {} + │ ^ + 5 │ if (true)}}}} {} + 6 │ + +if_stmt_err.js:5:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + 3 │ if else {} + 4 │ if () {} else {} + > 5 │ if (true)}}}} {} + │ ^ + 6 │ + + i Expected a statement here. + + 3 │ if else {} + 4 │ if () {} else {} + > 5 │ if (true)}}}} {} + │ ^ + 6 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js.snap new file mode 100644 index 000000000000..ac36e1a22b8c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js.snap @@ -0,0 +1,100 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import { as c } from "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: missing (required), + as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@12..14 "c" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@21..27 "\"test\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_IMPORT@0..28 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@7..27 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@7..16 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..14 + 0: JS_NAMED_IMPORT_SPECIFIER@9..14 + 0: (empty) + 1: (empty) + 2: AS_KW@9..12 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@12..14 + 0: IDENT@12..14 "c" [] [Whitespace(" ")] + 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] + 2: FROM_KW@16..21 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@21..27 + 0: JS_STRING_LITERAL@21..27 "\"test\"" [] [] + 4: (empty) + 2: SEMICOLON@27..28 ";" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal, or an identifier but instead found ''. + + > 1 │ import { as c } from "test"; + │ + 2 │ + + i Expected a string literal, or an identifier here. + + > 1 │ import { as c } from "test"; + │ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_assertion_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_assertion_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js.snap new file mode 100644 index 000000000000..8acf64dec176 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js.snap @@ -0,0 +1,666 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "foo" assert { type, "json" }; +import "bar" \u{61}ssert { type: "json" }; +import { foo } assert { type: "json" }; +import "lorem" +assert { type: "json" } +import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; +import "x" assert; +import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; +import { a } from "a.json" assert + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@13..20 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@22..26 "type" [] [], + colon_token: missing (required), + value_token: missing (required), + }, + COMMA@26..28 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: JS_STRING_LITERAL@28..35 "\"json\"" [] [Whitespace(" ")], + colon_token: missing (required), + value_token: missing (required), + }, + ], + r_curly_token: R_CURLY@35..36 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsBogusStatement { + items: [ + IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsModuleSource { + value_token: JS_STRING_LITERAL@45..51 "\"bar\"" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + ERROR_TOKEN@51..63 "\\u{61}ssert" [] [Whitespace(" ")], + L_CURLY@63..65 "{" [] [Whitespace(" ")], + JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@65..69 "type" [] [], + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@71..78 "\"json\"" [] [Whitespace(" ")], + }, + ], + R_CURLY@78..79 "}" [] [], + ], + }, + ], + }, + SEMICOLON@79..80 ";" [] [], + ], + }, + JsImport { + import_token: IMPORT_KW@80..88 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@88..90 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@90..94 "foo" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@94..96 "}" [] [Whitespace(" ")], + }, + from_token: missing (required), + source: missing (required), + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@96..103 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@103..105 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@105..109 "type" [] [], + colon_token: COLON@109..111 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@118..119 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@119..120 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@128..135 "\"lorem\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@135..143 "assert" [Newline("\n")] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@143..145 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@145..149 "type" [] [], + }, + colon_token: COLON@149..151 ":" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@151..158 "\"json\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@158..159 "}" [] [], + }, + JsImport { + import_token: IMPORT_KW@159..167 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@167..172 "foo2" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@172..177 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@177..188 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@188..195 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@195..197 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: JS_STRING_LITERAL@197..203 "\"type\"" [] [], + colon_token: COLON@203..205 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@205..211 "\"json\"" [] [], + }, + COMMA@211..213 "," [] [Whitespace(" ")], + JsBogusImportAssertionEntry { + items: [ + IDENT@213..217 "type" [] [], + COLON@217..219 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@219..225 "\"html\"" [] [], + ], + }, + COMMA@225..227 "," [] [Whitespace(" ")], + JsBogusImportAssertionEntry { + items: [ + JS_STRING_LITERAL@227..233 "\"type\"" [] [], + COLON@233..235 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@235..240 "\"js\"" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@240..241 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@241..242 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@242..250 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@250..254 "\"x\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@254..260 "assert" [] [], + l_curly_token: missing (required), + assertions: JsImportAssertionEntryList [], + r_curly_token: missing (required), + }, + }, + semicolon_token: SEMICOLON@260..261 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@261..269 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@269..275 "ipsum" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@275..280 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@280..293 "\"ipsum.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@293..300 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@300..302 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@302..306 "type" [] [], + colon_token: COLON@306..308 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@308..314 "\"json\"" [] [], + }, + COMMA@314..316 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: IDENT@316..320 "lazy" [] [], + colon_token: COLON@320..322 ":" [] [Whitespace(" ")], + value_token: missing (required), + }, + missing separator, + JsImportAssertionEntry { + key: IDENT@322..326 "true" [] [], + colon_token: missing (required), + value_token: missing (required), + }, + COMMA@326..328 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: IDENT@328..339 "startAtLine" [] [], + colon_token: COLON@339..341 ":" [] [Whitespace(" ")], + value_token: missing (required), + }, + missing separator, + JsBogusImportAssertionEntry { + items: [ + JS_NUMBER_LITERAL@341..343 "1" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@343..344 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@344..345 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@345..353 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@353..355 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@355..357 "a" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@357..359 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@359..364 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@364..373 "\"a.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@373..379 "assert" [] [], + l_curly_token: missing (required), + assertions: JsImportAssertionEntryList [], + r_curly_token: missing (required), + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@379..380 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..380 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..379 + 0: JS_IMPORT@0..37 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@7..36 + 0: JS_MODULE_SOURCE@7..13 + 0: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@13..36 + 0: ASSERT_KW@13..20 "assert" [] [Whitespace(" ")] + 1: L_CURLY@20..22 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@22..35 + 0: JS_IMPORT_ASSERTION_ENTRY@22..26 + 0: IDENT@22..26 "type" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@26..28 "," [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY@28..35 + 0: JS_STRING_LITERAL@28..35 "\"json\"" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: R_CURLY@35..36 "}" [] [] + 2: SEMICOLON@36..37 ";" [] [] + 1: JS_BOGUS_STATEMENT@37..80 + 0: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@45..79 + 0: JS_MODULE_SOURCE@45..51 + 0: JS_STRING_LITERAL@45..51 "\"bar\"" [] [Whitespace(" ")] + 1: JS_BOGUS@51..79 + 0: ERROR_TOKEN@51..63 "\\u{61}ssert" [] [Whitespace(" ")] + 1: L_CURLY@63..65 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@65..78 + 0: JS_IMPORT_ASSERTION_ENTRY@65..78 + 0: IDENT@65..69 "type" [] [] + 1: COLON@69..71 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@71..78 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@78..79 "}" [] [] + 2: SEMICOLON@79..80 ";" [] [] + 2: JS_IMPORT@80..120 + 0: IMPORT_KW@80..88 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@88..119 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@88..96 + 0: L_CURLY@88..90 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@90..94 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@90..94 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@90..94 + 0: IDENT@90..94 "foo" [] [Whitespace(" ")] + 2: R_CURLY@94..96 "}" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_IMPORT_ASSERTION@96..119 + 0: ASSERT_KW@96..103 "assert" [] [Whitespace(" ")] + 1: L_CURLY@103..105 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@105..118 + 0: JS_IMPORT_ASSERTION_ENTRY@105..118 + 0: IDENT@105..109 "type" [] [] + 1: COLON@109..111 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@118..119 "}" [] [] + 2: SEMICOLON@119..120 ";" [] [] + 3: JS_IMPORT@120..135 + 0: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@128..135 + 0: JS_MODULE_SOURCE@128..135 + 0: JS_STRING_LITERAL@128..135 "\"lorem\"" [] [] + 1: (empty) + 2: (empty) + 4: JS_EXPRESSION_STATEMENT@135..143 + 0: JS_IDENTIFIER_EXPRESSION@135..143 + 0: JS_REFERENCE_IDENTIFIER@135..143 + 0: IDENT@135..143 "assert" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 5: JS_BLOCK_STATEMENT@143..159 + 0: L_CURLY@143..145 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@145..158 + 0: JS_LABELED_STATEMENT@145..158 + 0: JS_LABEL@145..149 + 0: IDENT@145..149 "type" [] [] + 1: COLON@149..151 ":" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@151..158 + 0: JS_STRING_LITERAL_EXPRESSION@151..158 + 0: JS_STRING_LITERAL@151..158 "\"json\"" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@158..159 "}" [] [] + 6: JS_IMPORT@159..242 + 0: IMPORT_KW@159..167 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@167..241 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@167..172 + 0: JS_IDENTIFIER_BINDING@167..172 + 0: IDENT@167..172 "foo2" [] [Whitespace(" ")] + 2: FROM_KW@172..177 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@177..188 + 0: JS_STRING_LITERAL@177..188 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@188..241 + 0: ASSERT_KW@188..195 "assert" [] [Whitespace(" ")] + 1: L_CURLY@195..197 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@197..240 + 0: JS_IMPORT_ASSERTION_ENTRY@197..211 + 0: JS_STRING_LITERAL@197..203 "\"type\"" [] [] + 1: COLON@203..205 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@205..211 "\"json\"" [] [] + 1: COMMA@211..213 "," [] [Whitespace(" ")] + 2: JS_BOGUS_IMPORT_ASSERTION_ENTRY@213..225 + 0: IDENT@213..217 "type" [] [] + 1: COLON@217..219 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@219..225 "\"html\"" [] [] + 3: COMMA@225..227 "," [] [Whitespace(" ")] + 4: JS_BOGUS_IMPORT_ASSERTION_ENTRY@227..240 + 0: JS_STRING_LITERAL@227..233 "\"type\"" [] [] + 1: COLON@233..235 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@235..240 "\"js\"" [] [Whitespace(" ")] + 3: R_CURLY@240..241 "}" [] [] + 2: SEMICOLON@241..242 ";" [] [] + 7: JS_IMPORT@242..261 + 0: IMPORT_KW@242..250 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@250..260 + 0: JS_MODULE_SOURCE@250..254 + 0: JS_STRING_LITERAL@250..254 "\"x\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@254..260 + 0: ASSERT_KW@254..260 "assert" [] [] + 1: (empty) + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@260..260 + 3: (empty) + 2: SEMICOLON@260..261 ";" [] [] + 8: JS_IMPORT@261..345 + 0: IMPORT_KW@261..269 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@269..344 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@269..275 + 0: JS_IDENTIFIER_BINDING@269..275 + 0: IDENT@269..275 "ipsum" [] [Whitespace(" ")] + 2: FROM_KW@275..280 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@280..293 + 0: JS_STRING_LITERAL@280..293 "\"ipsum.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@293..344 + 0: ASSERT_KW@293..300 "assert" [] [Whitespace(" ")] + 1: L_CURLY@300..302 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@302..343 + 0: JS_IMPORT_ASSERTION_ENTRY@302..314 + 0: IDENT@302..306 "type" [] [] + 1: COLON@306..308 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@308..314 "\"json\"" [] [] + 1: COMMA@314..316 "," [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY@316..322 + 0: IDENT@316..320 "lazy" [] [] + 1: COLON@320..322 ":" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_IMPORT_ASSERTION_ENTRY@322..326 + 0: IDENT@322..326 "true" [] [] + 1: (empty) + 2: (empty) + 5: COMMA@326..328 "," [] [Whitespace(" ")] + 6: JS_IMPORT_ASSERTION_ENTRY@328..341 + 0: IDENT@328..339 "startAtLine" [] [] + 1: COLON@339..341 ":" [] [Whitespace(" ")] + 2: (empty) + 7: (empty) + 8: JS_BOGUS_IMPORT_ASSERTION_ENTRY@341..343 + 0: JS_NUMBER_LITERAL@341..343 "1" [] [Whitespace(" ")] + 3: R_CURLY@343..344 "}" [] [] + 2: SEMICOLON@344..345 ";" [] [] + 9: JS_IMPORT@345..379 + 0: IMPORT_KW@345..353 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@353..379 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@353..359 + 0: L_CURLY@353..355 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@355..357 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@355..357 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@355..357 + 0: IDENT@355..357 "a" [] [Whitespace(" ")] + 2: R_CURLY@357..359 "}" [] [Whitespace(" ")] + 2: FROM_KW@359..364 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@364..373 + 0: JS_STRING_LITERAL@364..373 "\"a.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@373..379 + 0: ASSERT_KW@373..379 "assert" [] [] + 1: (empty) + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@379..379 + 3: (empty) + 2: (empty) + 4: EOF@379..380 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_assertion_err.js:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `,` + + > 1 │ import "foo" assert { type, "json" }; + │ ^ + 2 │ import "bar" \u{61}ssert { type: "json" }; + 3 │ import { foo } assert { type: "json" }; + + i Remove , + +import_assertion_err.js:1:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `}` + + > 1 │ import "foo" assert { type, "json" }; + │ ^ + 2 │ import "bar" \u{61}ssert { type: "json" }; + 3 │ import { foo } assert { type: "json" }; + + i Remove } + +import_assertion_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'assert' keyword cannot contain escape character. + + 1 │ import "foo" assert { type, "json" }; + > 2 │ import "bar" \u{61}ssert { type: "json" }; + │ ^^^^^^^^^^^ + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" + +import_assertion_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `assert` + + 1 │ import "foo" assert { type, "json" }; + 2 │ import "bar" \u{61}ssert { type: "json" }; + > 3 │ import { foo } assert { type: "json" }; + │ ^^^^^^ + 4 │ import "lorem" + 5 │ assert { type: "json" } + + i Remove assert + +import_assertion_err.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" + > 5 │ assert { type: "json" } + │ ^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + + i An explicit or implicit semicolon is expected here... + + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" + > 5 │ assert { type: "json" } + │ ^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + + i ...Which is required to end this statement + + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" + > 5 │ assert { type: "json" } + │ ^^^^^^^^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + +import_assertion_err.js:6:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Duplicate assertion keys are not allowed + + 4 │ import "lorem" + 5 │ assert { type: "json" } + > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + │ ^^^^^^ + 7 │ import "x" assert; + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + + i First use of the key `type` + + 4 │ import "lorem" + 5 │ assert { type: "json" } + > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + │ ^^^^^^ + 7 │ import "x" assert; + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + + i second use here + + 4 │ import "lorem" + 5 │ assert { type: "json" } + > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + │ ^^^^ + 7 │ import "x" assert; + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + +import_assertion_err.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `;` + + 5 │ assert { type: "json" } + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + > 7 │ import "x" assert; + │ ^ + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + 9 │ import { a } from "a.json" assert + + i Remove ; + +import_assertion_err.js:8:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `string literal` but instead found `true` + + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + │ ^^^^ + 9 │ import { a } from "a.json" assert + 10 │ + + i Remove true + +import_assertion_err.js:8:65 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `,` + + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + │ ^ + 9 │ import { a } from "a.json" assert + 10 │ + + i Remove , + +import_assertion_err.js:8:80 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `string literal` but instead found `1` + + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + │ ^ + 9 │ import { a } from "a.json" assert + 10 │ + + i Remove 1 + +import_assertion_err.js:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead the file ends + + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + 9 │ import { a } from "a.json" assert + > 10 │ + │ + + i the file ends here + + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + 9 │ import { a } from "a.json" assert + > 10 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_attribute_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_attribute_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js.snap new file mode 100644 index 000000000000..ec313da0511e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js.snap @@ -0,0 +1,612 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "foo" with { type, "json" }; +import { foo } with { type: "json" }; +import "lorem" +assert { type: "json" } +import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; +import "x" with; +import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; +import { a } from "a.json" with + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@13..18 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@20..24 "type" [] [], + colon_token: missing (required), + value_token: missing (required), + }, + COMMA@24..26 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")], + colon_token: missing (required), + value_token: missing (required), + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@35..43 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@45..49 "foo" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], + }, + from_token: missing (required), + source: missing (required), + assertion: JsImportAssertion { + assertion_kind: WITH_KW@51..56 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@56..58 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@58..62 "type" [] [], + colon_token: COLON@62..64 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@64..71 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@71..72 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@72..73 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@73..81 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@81..88 "\"lorem\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@88..96 "assert" [Newline("\n")] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@96..98 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@98..102 "type" [] [], + }, + colon_token: COLON@102..104 ":" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@104..111 "\"json\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@111..112 "}" [] [], + }, + JsImport { + import_token: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@120..125 "foo2" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@125..130 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@130..141 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@141..146 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@146..148 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: JS_STRING_LITERAL@148..154 "\"type\"" [] [], + colon_token: COLON@154..156 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@156..162 "\"json\"" [] [], + }, + COMMA@162..164 "," [] [Whitespace(" ")], + JsBogusImportAssertionEntry { + items: [ + IDENT@164..168 "type" [] [], + COLON@168..170 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@170..176 "\"html\"" [] [], + ], + }, + COMMA@176..178 "," [] [Whitespace(" ")], + JsBogusImportAssertionEntry { + items: [ + JS_STRING_LITERAL@178..184 "\"type\"" [] [], + COLON@184..186 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@186..191 "\"js\"" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@191..192 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@192..193 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@193..201 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@201..205 "\"x\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@205..209 "with" [] [], + l_curly_token: missing (required), + assertions: JsImportAssertionEntryList [], + r_curly_token: missing (required), + }, + }, + semicolon_token: SEMICOLON@209..210 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@210..218 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@218..224 "ipsum" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@224..229 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@229..242 "\"ipsum.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@242..247 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@247..249 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@249..253 "type" [] [], + colon_token: COLON@253..255 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@255..261 "\"json\"" [] [], + }, + COMMA@261..263 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: IDENT@263..267 "lazy" [] [], + colon_token: COLON@267..269 ":" [] [Whitespace(" ")], + value_token: missing (required), + }, + missing separator, + JsImportAssertionEntry { + key: IDENT@269..273 "true" [] [], + colon_token: missing (required), + value_token: missing (required), + }, + COMMA@273..275 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: IDENT@275..286 "startAtLine" [] [], + colon_token: COLON@286..288 ":" [] [Whitespace(" ")], + value_token: missing (required), + }, + missing separator, + JsBogusImportAssertionEntry { + items: [ + JS_NUMBER_LITERAL@288..290 "1" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@290..291 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@291..292 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@292..300 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@300..302 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@302..304 "a" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@304..306 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@306..311 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@311..320 "\"a.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@320..324 "with" [] [], + l_curly_token: missing (required), + assertions: JsImportAssertionEntryList [], + r_curly_token: missing (required), + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@324..325 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..325 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..324 + 0: JS_IMPORT@0..35 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@7..34 + 0: JS_MODULE_SOURCE@7..13 + 0: JS_STRING_LITERAL@7..13 "\"foo\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@13..34 + 0: WITH_KW@13..18 "with" [] [Whitespace(" ")] + 1: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@20..33 + 0: JS_IMPORT_ASSERTION_ENTRY@20..24 + 0: IDENT@20..24 "type" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@24..26 "," [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY@26..33 + 0: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: R_CURLY@33..34 "}" [] [] + 2: SEMICOLON@34..35 ";" [] [] + 1: JS_IMPORT@35..73 + 0: IMPORT_KW@35..43 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@43..72 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@43..51 + 0: L_CURLY@43..45 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@45..49 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@45..49 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@45..49 + 0: IDENT@45..49 "foo" [] [Whitespace(" ")] + 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_IMPORT_ASSERTION@51..72 + 0: WITH_KW@51..56 "with" [] [Whitespace(" ")] + 1: L_CURLY@56..58 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@58..71 + 0: JS_IMPORT_ASSERTION_ENTRY@58..71 + 0: IDENT@58..62 "type" [] [] + 1: COLON@62..64 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@64..71 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@71..72 "}" [] [] + 2: SEMICOLON@72..73 ";" [] [] + 2: JS_IMPORT@73..88 + 0: IMPORT_KW@73..81 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@81..88 + 0: JS_MODULE_SOURCE@81..88 + 0: JS_STRING_LITERAL@81..88 "\"lorem\"" [] [] + 1: (empty) + 2: (empty) + 3: JS_EXPRESSION_STATEMENT@88..96 + 0: JS_IDENTIFIER_EXPRESSION@88..96 + 0: JS_REFERENCE_IDENTIFIER@88..96 + 0: IDENT@88..96 "assert" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 4: JS_BLOCK_STATEMENT@96..112 + 0: L_CURLY@96..98 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@98..111 + 0: JS_LABELED_STATEMENT@98..111 + 0: JS_LABEL@98..102 + 0: IDENT@98..102 "type" [] [] + 1: COLON@102..104 ":" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@104..111 + 0: JS_STRING_LITERAL_EXPRESSION@104..111 + 0: JS_STRING_LITERAL@104..111 "\"json\"" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@111..112 "}" [] [] + 5: JS_IMPORT@112..193 + 0: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@120..192 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@120..125 + 0: JS_IDENTIFIER_BINDING@120..125 + 0: IDENT@120..125 "foo2" [] [Whitespace(" ")] + 2: FROM_KW@125..130 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@130..141 + 0: JS_STRING_LITERAL@130..141 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@141..192 + 0: WITH_KW@141..146 "with" [] [Whitespace(" ")] + 1: L_CURLY@146..148 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@148..191 + 0: JS_IMPORT_ASSERTION_ENTRY@148..162 + 0: JS_STRING_LITERAL@148..154 "\"type\"" [] [] + 1: COLON@154..156 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@156..162 "\"json\"" [] [] + 1: COMMA@162..164 "," [] [Whitespace(" ")] + 2: JS_BOGUS_IMPORT_ASSERTION_ENTRY@164..176 + 0: IDENT@164..168 "type" [] [] + 1: COLON@168..170 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@170..176 "\"html\"" [] [] + 3: COMMA@176..178 "," [] [Whitespace(" ")] + 4: JS_BOGUS_IMPORT_ASSERTION_ENTRY@178..191 + 0: JS_STRING_LITERAL@178..184 "\"type\"" [] [] + 1: COLON@184..186 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@186..191 "\"js\"" [] [Whitespace(" ")] + 3: R_CURLY@191..192 "}" [] [] + 2: SEMICOLON@192..193 ";" [] [] + 6: JS_IMPORT@193..210 + 0: IMPORT_KW@193..201 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@201..209 + 0: JS_MODULE_SOURCE@201..205 + 0: JS_STRING_LITERAL@201..205 "\"x\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@205..209 + 0: WITH_KW@205..209 "with" [] [] + 1: (empty) + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@209..209 + 3: (empty) + 2: SEMICOLON@209..210 ";" [] [] + 7: JS_IMPORT@210..292 + 0: IMPORT_KW@210..218 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@218..291 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@218..224 + 0: JS_IDENTIFIER_BINDING@218..224 + 0: IDENT@218..224 "ipsum" [] [Whitespace(" ")] + 2: FROM_KW@224..229 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@229..242 + 0: JS_STRING_LITERAL@229..242 "\"ipsum.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@242..291 + 0: WITH_KW@242..247 "with" [] [Whitespace(" ")] + 1: L_CURLY@247..249 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@249..290 + 0: JS_IMPORT_ASSERTION_ENTRY@249..261 + 0: IDENT@249..253 "type" [] [] + 1: COLON@253..255 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@255..261 "\"json\"" [] [] + 1: COMMA@261..263 "," [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY@263..269 + 0: IDENT@263..267 "lazy" [] [] + 1: COLON@267..269 ":" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_IMPORT_ASSERTION_ENTRY@269..273 + 0: IDENT@269..273 "true" [] [] + 1: (empty) + 2: (empty) + 5: COMMA@273..275 "," [] [Whitespace(" ")] + 6: JS_IMPORT_ASSERTION_ENTRY@275..288 + 0: IDENT@275..286 "startAtLine" [] [] + 1: COLON@286..288 ":" [] [Whitespace(" ")] + 2: (empty) + 7: (empty) + 8: JS_BOGUS_IMPORT_ASSERTION_ENTRY@288..290 + 0: JS_NUMBER_LITERAL@288..290 "1" [] [Whitespace(" ")] + 3: R_CURLY@290..291 "}" [] [] + 2: SEMICOLON@291..292 ";" [] [] + 8: JS_IMPORT@292..324 + 0: IMPORT_KW@292..300 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@300..324 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@300..306 + 0: L_CURLY@300..302 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@302..304 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@302..304 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@302..304 + 0: IDENT@302..304 "a" [] [Whitespace(" ")] + 2: R_CURLY@304..306 "}" [] [Whitespace(" ")] + 2: FROM_KW@306..311 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@311..320 + 0: JS_STRING_LITERAL@311..320 "\"a.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@320..324 + 0: WITH_KW@320..324 "with" [] [] + 1: (empty) + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@324..324 + 3: (empty) + 2: (empty) + 4: EOF@324..325 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_attribute_err.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `,` + + > 1 │ import "foo" with { type, "json" }; + │ ^ + 2 │ import { foo } with { type: "json" }; + 3 │ import "lorem" + + i Remove , + +import_attribute_err.js:1:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `}` + + > 1 │ import "foo" with { type, "json" }; + │ ^ + 2 │ import { foo } with { type: "json" }; + 3 │ import "lorem" + + i Remove } + +import_attribute_err.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `with` + + 1 │ import "foo" with { type, "json" }; + > 2 │ import { foo } with { type: "json" }; + │ ^^^^ + 3 │ import "lorem" + 4 │ assert { type: "json" } + + i Remove with + +import_attribute_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 2 │ import { foo } with { type: "json" }; + 3 │ import "lorem" + > 4 │ assert { type: "json" } + │ ^ + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + 6 │ import "x" with; + + i An explicit or implicit semicolon is expected here... + + 2 │ import { foo } with { type: "json" }; + 3 │ import "lorem" + > 4 │ assert { type: "json" } + │ ^ + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + 6 │ import "x" with; + + i ...Which is required to end this statement + + 2 │ import { foo } with { type: "json" }; + 3 │ import "lorem" + > 4 │ assert { type: "json" } + │ ^^^^^^^^ + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + 6 │ import "x" with; + +import_attribute_err.js:5:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Duplicate assertion keys are not allowed + + 3 │ import "lorem" + 4 │ assert { type: "json" } + > 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + │ ^^^^^^ + 6 │ import "x" with; + 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + + i First use of the key `type` + + 3 │ import "lorem" + 4 │ assert { type: "json" } + > 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + │ ^^^^^^ + 6 │ import "x" with; + 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + + i second use here + + 3 │ import "lorem" + 4 │ assert { type: "json" } + > 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + │ ^^^^ + 6 │ import "x" with; + 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + +import_attribute_err.js:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `;` + + 4 │ assert { type: "json" } + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + > 6 │ import "x" with; + │ ^ + 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + 8 │ import { a } from "a.json" with + + i Remove ; + +import_attribute_err.js:7:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `string literal` but instead found `true` + + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + 6 │ import "x" with; + > 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + │ ^^^^ + 8 │ import { a } from "a.json" with + 9 │ + + i Remove true + +import_attribute_err.js:7:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `,` + + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + 6 │ import "x" with; + > 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + │ ^ + 8 │ import { a } from "a.json" with + 9 │ + + i Remove , + +import_attribute_err.js:7:78 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `string literal` but instead found `1` + + 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; + 6 │ import "x" with; + > 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + │ ^ + 8 │ import { a } from "a.json" with + 9 │ + + i Remove 1 + +import_attribute_err.js:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead the file ends + + 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + 8 │ import { a } from "a.json" with + > 9 │ + │ + + i the file ends here + + 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; + 8 │ import { a } from "a.json" with + > 9 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.js b/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js.snap new file mode 100644 index 000000000000..ec66375df36e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js.snap @@ -0,0 +1,96 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ + import foo from "bar"; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBlockStatement { + l_curly_token: L_CURLY@0..1 "{" [] [], + statements: JsStatementList [ + JsBogusStatement { + items: [ + IMPORT_KW@1..10 "import" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@10..14 "foo" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@14..19 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@19..24 "\"bar\"" [] [], + }, + assertion: missing (optional), + }, + SEMICOLON@24..25 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@25..27 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: JS_BLOCK_STATEMENT@0..27 + 0: L_CURLY@0..1 "{" [] [] + 1: JS_STATEMENT_LIST@1..25 + 0: JS_BOGUS_STATEMENT@1..25 + 0: IMPORT_KW@1..10 "import" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@10..24 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@10..14 + 0: JS_IDENTIFIER_BINDING@10..14 + 0: IDENT@10..14 "foo" [] [Whitespace(" ")] + 2: FROM_KW@14..19 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@19..24 + 0: JS_STRING_LITERAL@19..24 "\"bar\"" [] [] + 4: (empty) + 2: SEMICOLON@24..25 ";" [] [] + 2: R_CURLY@25..27 "}" [Newline("\n")] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of an import declaration not at the top level + + 1 │ { + > 2 │ import foo from "bar"; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 3 │ } + 4 │ + + i move this declaration to the top level + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_err.js.snap new file mode 100644 index 000000000000..abf289abd68f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_err.js.snap @@ -0,0 +1,737 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import; +import *; +import * as c, { a, b } from "c"; +import { aa + bb, dd } from "c"; +import { ab, ac } from "c"; +import { default } from "c"; +import { "a" } from "c"; +import { as x } from "c"; +import 4 from "c"; +import y from 4; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..6 "import" [] [], + import_clause: missing (required), + semicolon_token: SEMICOLON@6..7 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@7..15 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamespaceClause { + type_token: missing (optional), + namespace_specifier: JsNamespaceImportSpecifier { + star_token: STAR@15..16 "*" [] [], + as_token: missing (required), + local_name: missing (required), + }, + from_token: missing (required), + source: missing (required), + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@17..25 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamespaceClause { + type_token: missing (optional), + namespace_specifier: JsNamespaceImportSpecifier { + star_token: STAR@25..27 "*" [] [Whitespace(" ")], + as_token: AS_KW@27..30 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@30..31 "c" [] [], + }, + }, + from_token: missing (required), + source: missing (required), + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + COMMA@31..33 "," [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "a" [] [], + }, + }, + comma_token: COMMA@36..38 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..40 "b" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@40..42 "}" [] [Whitespace(" ")], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..47 "from" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@47..50 "\"c\"" [] [], + }, + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@51..59 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@61..64 "aa" [] [Whitespace(" ")], + }, + }, + missing separator, + JsBogusNamedImportSpecifier { + items: [ + PLUS@64..66 "+" [] [Whitespace(" ")], + IDENT@66..68 "bb" [] [], + ], + }, + COMMA@68..70 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@70..73 "dd" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@73..75 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@75..80 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@80..83 "\"c\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@84..92 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@92..94 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@94..96 "ab" [] [], + }, + }, + COMMA@96..98 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@98..101 "ac" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@101..103 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@103..108 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@108..111 "\"c\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@120..122 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@122..130 "default" [] [Whitespace(" ")], + }, + as_token: missing (required), + local_name: missing (required), + }, + ], + r_curly_token: R_CURLY@130..132 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@132..137 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@137..140 "\"c\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@140..141 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@141..149 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@149..151 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: JS_STRING_LITERAL@151..155 "\"a\"" [] [Whitespace(" ")], + }, + as_token: missing (required), + local_name: missing (required), + }, + ], + r_curly_token: R_CURLY@155..157 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@157..162 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@162..165 "\"c\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@165..166 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@166..174 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@174..176 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: missing (required), + as_token: AS_KW@176..179 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@179..181 "x" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@181..183 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@183..188 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@188..191 "\"c\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@191..192 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@192..200 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: missing (required), + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@200..202 "4" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@202..207 "from" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@207..210 "\"c\"" [] [], + }, + semicolon_token: SEMICOLON@210..211 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@211..219 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@219..221 "y" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@221..226 "from" [] [Whitespace(" ")], + source: missing (required), + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@226..227 "4" [] [], + }, + semicolon_token: SEMICOLON@227..228 ";" [] [], + }, + ], + eof_token: EOF@228..229 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..229 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..228 + 0: JS_IMPORT@0..7 + 0: IMPORT_KW@0..6 "import" [] [] + 1: (empty) + 2: SEMICOLON@6..7 ";" [] [] + 1: JS_IMPORT@7..17 + 0: IMPORT_KW@7..15 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMESPACE_CLAUSE@15..16 + 0: (empty) + 1: JS_NAMESPACE_IMPORT_SPECIFIER@15..16 + 0: STAR@15..16 "*" [] [] + 1: (empty) + 2: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 2: SEMICOLON@16..17 ";" [] [] + 2: JS_IMPORT@17..31 + 0: IMPORT_KW@17..25 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMESPACE_CLAUSE@25..31 + 0: (empty) + 1: JS_NAMESPACE_IMPORT_SPECIFIER@25..31 + 0: STAR@25..27 "*" [] [Whitespace(" ")] + 1: AS_KW@27..30 "as" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "c" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: (empty) + 3: JS_BOGUS_STATEMENT@31..33 + 0: COMMA@31..33 "," [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@33..42 + 0: L_CURLY@33..35 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@35..40 + 0: JS_EXPRESSION_STATEMENT@35..40 + 0: JS_SEQUENCE_EXPRESSION@35..40 + 0: JS_IDENTIFIER_EXPRESSION@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "a" [] [] + 1: COMMA@36..38 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@38..40 + 0: JS_REFERENCE_IDENTIFIER@38..40 + 0: IDENT@38..40 "b" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@40..42 "}" [] [Whitespace(" ")] + 5: JS_EXPRESSION_STATEMENT@42..47 + 0: JS_IDENTIFIER_EXPRESSION@42..47 + 0: JS_REFERENCE_IDENTIFIER@42..47 + 0: IDENT@42..47 "from" [] [Whitespace(" ")] + 1: (empty) + 6: JS_EXPRESSION_STATEMENT@47..51 + 0: JS_STRING_LITERAL_EXPRESSION@47..50 + 0: JS_STRING_LITERAL@47..50 "\"c\"" [] [] + 1: SEMICOLON@50..51 ";" [] [] + 7: JS_IMPORT@51..84 + 0: IMPORT_KW@51..59 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@59..83 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@59..75 + 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@61..73 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@61..64 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@61..64 + 0: IDENT@61..64 "aa" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BOGUS_NAMED_IMPORT_SPECIFIER@64..68 + 0: PLUS@64..66 "+" [] [Whitespace(" ")] + 1: IDENT@66..68 "bb" [] [] + 3: COMMA@68..70 "," [] [Whitespace(" ")] + 4: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@70..73 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@70..73 + 0: IDENT@70..73 "dd" [] [Whitespace(" ")] + 2: R_CURLY@73..75 "}" [] [Whitespace(" ")] + 2: FROM_KW@75..80 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@80..83 + 0: JS_STRING_LITERAL@80..83 "\"c\"" [] [] + 4: (empty) + 2: SEMICOLON@83..84 ";" [] [] + 8: JS_IMPORT@84..112 + 0: IMPORT_KW@84..92 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@92..111 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@92..103 + 0: L_CURLY@92..94 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@94..101 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@94..96 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@94..96 + 0: IDENT@94..96 "ab" [] [] + 1: COMMA@96..98 "," [] [Whitespace(" ")] + 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@98..101 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@98..101 + 0: IDENT@98..101 "ac" [] [Whitespace(" ")] + 2: R_CURLY@101..103 "}" [] [Whitespace(" ")] + 2: FROM_KW@103..108 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@108..111 + 0: JS_STRING_LITERAL@108..111 "\"c\"" [] [] + 4: (empty) + 2: SEMICOLON@111..112 ";" [] [] + 9: JS_IMPORT@112..141 + 0: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@120..140 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@120..132 + 0: L_CURLY@120..122 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@122..130 + 0: JS_NAMED_IMPORT_SPECIFIER@122..130 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@122..130 + 0: IDENT@122..130 "default" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@130..132 "}" [] [Whitespace(" ")] + 2: FROM_KW@132..137 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@137..140 + 0: JS_STRING_LITERAL@137..140 "\"c\"" [] [] + 4: (empty) + 2: SEMICOLON@140..141 ";" [] [] + 10: JS_IMPORT@141..166 + 0: IMPORT_KW@141..149 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@149..165 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@149..157 + 0: L_CURLY@149..151 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@151..155 + 0: JS_NAMED_IMPORT_SPECIFIER@151..155 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@151..155 + 0: JS_STRING_LITERAL@151..155 "\"a\"" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@155..157 "}" [] [Whitespace(" ")] + 2: FROM_KW@157..162 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@162..165 + 0: JS_STRING_LITERAL@162..165 "\"c\"" [] [] + 4: (empty) + 2: SEMICOLON@165..166 ";" [] [] + 11: JS_IMPORT@166..192 + 0: IMPORT_KW@166..174 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@174..191 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@174..183 + 0: L_CURLY@174..176 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@176..181 + 0: JS_NAMED_IMPORT_SPECIFIER@176..181 + 0: (empty) + 1: (empty) + 2: AS_KW@176..179 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@179..181 + 0: IDENT@179..181 "x" [] [Whitespace(" ")] + 2: R_CURLY@181..183 "}" [] [Whitespace(" ")] + 2: FROM_KW@183..188 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@188..191 + 0: JS_STRING_LITERAL@188..191 "\"c\"" [] [] + 4: (empty) + 2: SEMICOLON@191..192 ";" [] [] + 12: JS_IMPORT@192..200 + 0: IMPORT_KW@192..200 "import" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 13: JS_EXPRESSION_STATEMENT@200..202 + 0: JS_NUMBER_LITERAL_EXPRESSION@200..202 + 0: JS_NUMBER_LITERAL@200..202 "4" [] [Whitespace(" ")] + 1: (empty) + 14: JS_EXPRESSION_STATEMENT@202..207 + 0: JS_IDENTIFIER_EXPRESSION@202..207 + 0: JS_REFERENCE_IDENTIFIER@202..207 + 0: IDENT@202..207 "from" [] [Whitespace(" ")] + 1: (empty) + 15: JS_EXPRESSION_STATEMENT@207..211 + 0: JS_STRING_LITERAL_EXPRESSION@207..210 + 0: JS_STRING_LITERAL@207..210 "\"c\"" [] [] + 1: SEMICOLON@210..211 ";" [] [] + 16: JS_IMPORT@211..226 + 0: IMPORT_KW@211..219 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@219..226 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@219..221 + 0: JS_IDENTIFIER_BINDING@219..221 + 0: IDENT@219..221 "y" [] [Whitespace(" ")] + 2: FROM_KW@221..226 "from" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 2: (empty) + 17: JS_EXPRESSION_STATEMENT@226..228 + 0: JS_NUMBER_LITERAL_EXPRESSION@226..227 + 0: JS_NUMBER_LITERAL@226..227 "4" [] [] + 1: SEMICOLON@227..228 ";" [] [] + 4: EOF@228..229 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a default import, a namespace import, or a named import but instead found ';'. + + > 1 │ import; + │ ^ + 2 │ import *; + 3 │ import * as c, { a, b } from "c"; + + i Expected a default import, a namespace import, or a named import here. + + > 1 │ import; + │ ^ + 2 │ import *; + 3 │ import * as c, { a, b } from "c"; + +import_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `;` + + 1 │ import; + > 2 │ import *; + │ ^ + 3 │ import * as c, { a, b } from "c"; + 4 │ import { aa + bb, dd } from "c"; + + i Remove ; + +import_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `from` but instead found `,` + + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; + + i Remove , + +import_err.js:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^^^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; + + i An explicit or implicit semicolon is expected here... + + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^^^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; + + i ...Which is required to end this statement + + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^^^^^^^^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; + +import_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `+` + + 2 │ import *; + 3 │ import * as c, { a, b } from "c"; + > 4 │ import { aa + bb, dd } from "c"; + │ ^ + 5 │ import { ab, ac } from "c"; + 6 │ import { default } from "c"; + + i Remove + + +import_err.js:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `}` + + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; + > 6 │ import { default } from "c"; + │ ^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + + i Remove } + +import_err.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `}` + + 5 │ import { ab, ac } from "c"; + 6 │ import { default } from "c"; + > 7 │ import { "a" } from "c"; + │ ^ + 8 │ import { as x } from "c"; + 9 │ import 4 from "c"; + + i Remove } + +import_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal, or an identifier but instead found ''. + + 6 │ import { default } from "c"; + 7 │ import { "a" } from "c"; + > 8 │ import { as x } from "c"; + │ + 9 │ import 4 from "c"; + 10 │ import y from 4; + + i Expected a string literal, or an identifier here. + + 6 │ import { default } from "c"; + 7 │ import { "a" } from "c"; + > 8 │ import { as x } from "c"; + │ + 9 │ import 4 from "c"; + 10 │ import y from 4; + +import_err.js:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a default import, a namespace import, or a named import but instead found '4'. + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^ + 10 │ import y from 4; + 11 │ + + i Expected a default import, a namespace import, or a named import here. + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^ + 10 │ import y from 4; + 11 │ + +import_err.js:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^ + 10 │ import y from 4; + 11 │ + + i An explicit or implicit semicolon is expected here... + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^ + 10 │ import y from 4; + 11 │ + + i ...Which is required to end this statement + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^^^ + 10 │ import y from 4; + 11 │ + +import_err.js:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^ + 10 │ import y from 4; + 11 │ + + i An explicit or implicit semicolon is expected here... + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^ + 10 │ import y from 4; + 11 │ + + i ...Which is required to end this statement + + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^^^^^ + 10 │ import y from 4; + 11 │ + +import_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a string literal but instead found '4'. + + 8 │ import { as x } from "c"; + 9 │ import 4 from "c"; + > 10 │ import y from 4; + │ ^ + 11 │ + + i Expected a string literal here. + + 8 │ import { as x } from "c"; + 9 │ import 4 from "c"; + > 10 │ import y from 4; + │ ^ + 11 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_invalid_args.js b/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_invalid_args.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js.snap new file mode 100644 index 000000000000..3d0ff2a4fc49 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js.snap @@ -0,0 +1,309 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import() +import(...["foo"]) +import("foo", { assert: { type: 'json' } }, "bar") +import("foo", { with: { type: 'json' } }, "bar") + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@0..6 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@6..7 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@7..8 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + IMPORT_KW@8..15 "import" [Newline("\n")] [], + JsBogus { + items: [ + L_PAREN@15..16 "(" [] [], + JsBogus { + items: [ + JsBogusMember { + items: [ + DOT3@16..19 "..." [] [], + JsArrayExpression { + l_brack_token: L_BRACK@19..20 "[" [] [], + elements: JsArrayElementList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@20..25 "\"foo\"" [] [], + }, + ], + r_brack_token: R_BRACK@25..26 "]" [] [], + }, + ], + }, + ], + }, + R_PAREN@26..27 ")" [] [], + ], + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@27..34 "import" [Newline("\n")] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@34..35 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@35..40 "\"foo\"" [] [], + }, + COMMA@40..42 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@44..50 "assert" [] [], + }, + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@52..54 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@54..58 "type" [] [], + }, + colon_token: COLON@58..60 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@60..67 "'json'" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@67..69 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@69..70 "}" [] [], + }, + COMMA@70..72 "," [] [Whitespace(" ")], + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@72..77 "\"bar\"" [] [], + }, + ], + r_paren_token: R_PAREN@77..78 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@78..85 "import" [Newline("\n")] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@85..86 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@86..91 "\"foo\"" [] [], + }, + COMMA@91..93 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@95..99 "with" [] [], + }, + colon_token: COLON@99..101 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@101..103 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@103..107 "type" [] [], + }, + colon_token: COLON@107..109 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@109..116 "'json'" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@116..118 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@118..119 "}" [] [], + }, + COMMA@119..121 "," [] [Whitespace(" ")], + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@121..126 "\"bar\"" [] [], + }, + ], + r_paren_token: R_PAREN@126..127 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@127..128 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..128 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..127 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_IMPORT_CALL_EXPRESSION@0..8 + 0: IMPORT_KW@0..6 "import" [] [] + 1: JS_CALL_ARGUMENTS@6..8 + 0: L_PAREN@6..7 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@7..7 + 2: R_PAREN@7..8 ")" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@8..27 + 0: JS_BOGUS_EXPRESSION@8..27 + 0: IMPORT_KW@8..15 "import" [Newline("\n")] [] + 1: JS_BOGUS@15..27 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_BOGUS@16..26 + 0: JS_BOGUS_MEMBER@16..26 + 0: DOT3@16..19 "..." [] [] + 1: JS_ARRAY_EXPRESSION@19..26 + 0: L_BRACK@19..20 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@20..25 + 0: JS_STRING_LITERAL_EXPRESSION@20..25 + 0: JS_STRING_LITERAL@20..25 "\"foo\"" [] [] + 2: R_BRACK@25..26 "]" [] [] + 2: R_PAREN@26..27 ")" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@27..78 + 0: JS_IMPORT_CALL_EXPRESSION@27..78 + 0: IMPORT_KW@27..34 "import" [Newline("\n")] [] + 1: JS_CALL_ARGUMENTS@34..78 + 0: L_PAREN@34..35 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@35..77 + 0: JS_STRING_LITERAL_EXPRESSION@35..40 + 0: JS_STRING_LITERAL@35..40 "\"foo\"" [] [] + 1: COMMA@40..42 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@42..70 + 0: L_CURLY@42..44 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@44..69 + 0: JS_PROPERTY_OBJECT_MEMBER@44..69 + 0: JS_LITERAL_MEMBER_NAME@44..50 + 0: IDENT@44..50 "assert" [] [] + 1: COLON@50..52 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@52..69 + 0: L_CURLY@52..54 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@54..67 + 0: JS_PROPERTY_OBJECT_MEMBER@54..67 + 0: JS_LITERAL_MEMBER_NAME@54..58 + 0: IDENT@54..58 "type" [] [] + 1: COLON@58..60 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@60..67 + 0: JS_STRING_LITERAL@60..67 "'json'" [] [Whitespace(" ")] + 2: R_CURLY@67..69 "}" [] [Whitespace(" ")] + 2: R_CURLY@69..70 "}" [] [] + 3: COMMA@70..72 "," [] [Whitespace(" ")] + 4: JS_STRING_LITERAL_EXPRESSION@72..77 + 0: JS_STRING_LITERAL@72..77 "\"bar\"" [] [] + 2: R_PAREN@77..78 ")" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@78..127 + 0: JS_IMPORT_CALL_EXPRESSION@78..127 + 0: IMPORT_KW@78..85 "import" [Newline("\n")] [] + 1: JS_CALL_ARGUMENTS@85..127 + 0: L_PAREN@85..86 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@86..126 + 0: JS_STRING_LITERAL_EXPRESSION@86..91 + 0: JS_STRING_LITERAL@86..91 "\"foo\"" [] [] + 1: COMMA@91..93 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@93..119 + 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@95..118 + 0: JS_PROPERTY_OBJECT_MEMBER@95..118 + 0: JS_LITERAL_MEMBER_NAME@95..99 + 0: IDENT@95..99 "with" [] [] + 1: COLON@99..101 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@101..118 + 0: L_CURLY@101..103 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@103..116 + 0: JS_PROPERTY_OBJECT_MEMBER@103..116 + 0: JS_LITERAL_MEMBER_NAME@103..107 + 0: IDENT@103..107 "type" [] [] + 1: COLON@107..109 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@109..116 + 0: JS_STRING_LITERAL@109..116 "'json'" [] [Whitespace(" ")] + 2: R_CURLY@116..118 "}" [] [Whitespace(" ")] + 2: R_CURLY@118..119 "}" [] [] + 3: COMMA@119..121 "," [] [Whitespace(" ")] + 4: JS_STRING_LITERAL_EXPRESSION@121..126 + 0: JS_STRING_LITERAL@121..126 "\"bar\"" [] [] + 2: R_PAREN@126..127 ")" [] [] + 1: (empty) + 4: EOF@127..128 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_invalid_args.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `import()` requires exactly one or two arguments. + + > 1 │ import() + │ ^ + 2 │ import(...["foo"]) + 3 │ import("foo", { assert: { type: 'json' } }, "bar") + +import_invalid_args.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `...` is not allowed in `import()` + + 1 │ import() + > 2 │ import(...["foo"]) + │ ^^^^^^^^^^ + 3 │ import("foo", { assert: { type: 'json' } }, "bar") + 4 │ import("foo", { with: { type: 'json' } }, "bar") + +import_invalid_args.js:3:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `import()` requires exactly one or two arguments. + + 1 │ import() + 2 │ import(...["foo"]) + > 3 │ import("foo", { assert: { type: 'json' } }, "bar") + │ ^^^^^^ + 4 │ import("foo", { with: { type: 'json' } }, "bar") + 5 │ + +import_invalid_args.js:4:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `import()` requires exactly one or two arguments. + + 2 │ import(...["foo"]) + 3 │ import("foo", { assert: { type: 'json' } }, "bar") + > 4 │ import("foo", { with: { type: 'json' } }, "bar") + │ ^^^^^^ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.js b/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js.snap new file mode 100644 index 000000000000..e37653e700a0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = import; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: missing (required), + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@8..14 "import" [] [], + import_clause: missing (required), + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + ], + eof_token: EOF@15..16 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..16 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..15 + 0: JS_VARIABLE_STATEMENT@0..8 + 0: JS_VARIABLE_DECLARATION@0..8 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..8 + 0: JS_VARIABLE_DECLARATOR@4..8 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..8 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 1: JS_IMPORT@8..15 + 0: IMPORT_KW@8..14 "import" [] [] + 1: (empty) + 2: SEMICOLON@14..15 ";" [] [] + 4: EOF@15..16 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_keyword_in_expression_position.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found 'import'. + + > 1 │ let a = import; + │ ^^^^^^ + 2 │ + + i Expected an expression, or an assignment here. + + > 1 │ let a = import; + │ ^^^^^^ + 2 │ + +import_keyword_in_expression_position.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a default import, a namespace import, or a named import but instead found ';'. + + > 1 │ let a = import; + │ ^ + 2 │ + + i Expected a default import, a namespace import, or a named import here. + + > 1 │ let a = import; + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_no_meta.js b/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_no_meta.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js.snap new file mode 100644 index 000000000000..9604f0591ab2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js.snap @@ -0,0 +1,102 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import.foo +import.metaa + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + IMPORT_KW@0..6 "import" [] [], + DOT@6..7 "." [] [], + JsBogus { + items: [ + IDENT@7..10 "foo" [] [], + ], + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + IMPORT_KW@10..17 "import" [Newline("\n")] [], + DOT@17..18 "." [] [], + JsBogus { + items: [ + IDENT@18..23 "metaa" [] [], + ], + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_EXPRESSION_STATEMENT@0..10 + 0: JS_BOGUS_EXPRESSION@0..10 + 0: IMPORT_KW@0..6 "import" [] [] + 1: DOT@6..7 "." [] [] + 2: JS_BOGUS@7..10 + 0: IDENT@7..10 "foo" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@10..23 + 0: JS_BOGUS_EXPRESSION@10..23 + 0: IMPORT_KW@10..17 "import" [Newline("\n")] [] + 1: DOT@17..18 "." [] [] + 2: JS_BOGUS@18..23 + 0: IDENT@18..23 "metaa" [] [] + 1: (empty) + 4: EOF@23..24 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +import_no_meta.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected `meta` following an import keyword, but found `foo` + + > 1 │ import.foo + │ ^^^ + 2 │ import.metaa + 3 │ + +import_no_meta.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected `meta` following an import keyword, but found `metaa` + + 1 │ import.foo + > 2 │ import.metaa + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.js b/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.js rename to crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap new file mode 100644 index 000000000000..35a08e94ae55 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap @@ -0,0 +1,142 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(a,; +(a, b, c; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..2 "a" [] [], + }, + }, + comma_token: COMMA@2..3 "," [] [], + right: missing (required), + }, + r_paren_token: missing (required), + }, + semicolon_token: SEMICOLON@3..4 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@4..6 "(" [Newline("\n")] [], + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@6..7 "a" [] [], + }, + }, + comma_token: COMMA@7..9 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..10 "b" [] [], + }, + }, + }, + comma_token: COMMA@10..12 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..13 "c" [] [], + }, + }, + }, + r_paren_token: missing (required), + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + ], + eof_token: EOF@14..15 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..15 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..14 + 0: JS_EXPRESSION_STATEMENT@0..4 + 0: JS_PARENTHESIZED_EXPRESSION@0..3 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@1..3 + 0: JS_IDENTIFIER_EXPRESSION@1..2 + 0: JS_REFERENCE_IDENTIFIER@1..2 + 0: IDENT@1..2 "a" [] [] + 1: COMMA@2..3 "," [] [] + 2: (empty) + 2: (empty) + 1: SEMICOLON@3..4 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@4..14 + 0: JS_PARENTHESIZED_EXPRESSION@4..13 + 0: L_PAREN@4..6 "(" [Newline("\n")] [] + 1: JS_SEQUENCE_EXPRESSION@6..13 + 0: JS_SEQUENCE_EXPRESSION@6..10 + 0: JS_IDENTIFIER_EXPRESSION@6..7 + 0: JS_REFERENCE_IDENTIFIER@6..7 + 0: IDENT@6..7 "a" [] [] + 1: COMMA@7..9 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@9..10 + 0: JS_REFERENCE_IDENTIFIER@9..10 + 0: IDENT@9..10 "b" [] [] + 1: COMMA@10..12 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@12..13 + 0: JS_REFERENCE_IDENTIFIER@12..13 + 0: IDENT@12..13 "c" [] [] + 2: (empty) + 1: SEMICOLON@13..14 ";" [] [] + 4: EOF@14..15 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +incomplete_parenthesized_sequence_expression.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ';'. + + > 1 │ (a,; + │ ^ + 2 │ (a, b, c; + 3 │ + + i Expected an expression here. + + > 1 │ (a,; + │ ^ + 2 │ (a, b, c; + 3 │ + +incomplete_parenthesized_sequence_expression.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `;` + + 1 │ (a,; + > 2 │ (a, b, c; + │ ^ + 3 │ + + i Remove ; + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js.snap new file mode 100644 index 000000000000..2cd556678682 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js.snap @@ -0,0 +1,121 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@18..24 "number" [] [], + }, + }, + }, + R_BRACK@24..25 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@27..33 "string" [] [], + }, + }, + SEMICOLON@33..34 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@34..36 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@36..37 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..37 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..36 + 0: JS_CLASS_DECLARATION@0..36 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..34 + 0: JS_BOGUS_MEMBER@9..34 + 0: L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [] + 1: TS_INDEX_SIGNATURE_PARAMETER@15..24 + 0: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 1: TS_TYPE_ANNOTATION@16..24 + 0: COLON@16..18 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@18..24 + 0: NUMBER_KW@18..24 "number" [] [] + 2: R_BRACK@24..25 "]" [] [] + 3: TS_TYPE_ANNOTATION@25..33 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@27..33 + 0: STRING_KW@27..33 "string" [] [] + 4: SEMICOLON@33..34 ";" [] [] + 9: R_CURLY@34..36 "}" [Newline("\n")] [] + 4: EOF@36..37 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +index_signature_class_member_in_js.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Index signatures are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 1 │ class A { + > 2 │ [a: number]: string; + │ ^^^^^^^^^^^^^^^^^^^^ + 3 │ } + 4 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.ts b/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.ts rename to crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap new file mode 100644 index 000000000000..c1c68cb997ec --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap @@ -0,0 +1,100 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface undefined {} +interface any {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + JsBogus { + items: [ + IDENT@10..20 "undefined" [] [Whitespace(" ")], + ], + }, + L_CURLY@20..21 "{" [] [], + TsTypeMemberList [], + R_CURLY@21..22 "}" [] [], + ], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@22..33 "interface" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + IDENT@33..37 "any" [] [Whitespace(" ")], + ], + }, + L_CURLY@37..38 "{" [] [], + TsTypeMemberList [], + R_CURLY@38..39 "}" [] [], + ], + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_BOGUS_STATEMENT@0..22 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: JS_BOGUS@10..20 + 0: IDENT@10..20 "undefined" [] [Whitespace(" ")] + 2: L_CURLY@20..21 "{" [] [] + 3: TS_TYPE_MEMBER_LIST@21..21 + 4: R_CURLY@21..22 "}" [] [] + 1: JS_BOGUS_STATEMENT@22..39 + 0: INTERFACE_KW@22..33 "interface" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@33..37 + 0: IDENT@33..37 "any" [] [Whitespace(" ")] + 2: L_CURLY@37..38 "{" [] [] + 3: TS_TYPE_MEMBER_LIST@38..38 + 4: R_CURLY@38..39 "}" [] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +interface_cannot_be_reserved_world.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type alias cannot be undefined + + > 1 │ interface undefined {} + │ ^^^^^^^^^ + 2 │ interface any {} + 3 │ + +interface_cannot_be_reserved_world.ts:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type alias cannot be any + + 1 │ interface undefined {} + > 2 │ interface any {} + │ ^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_arg_list.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js.snap new file mode 100644 index 000000000000..dfd5968cd2cf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js.snap @@ -0,0 +1,465 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo(...args) {} +let a, b, c; +foo(a,b; +foo(a,b var; +foo (,,b); +foo (a, ...); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@13..16 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@16..20 "args" [] [], + }, + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@29..30 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@32..33 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@33..35 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@35..36 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@37..41 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@41..42 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..43 "a" [] [], + }, + }, + COMMA@43..44 "," [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "b" [] [], + }, + }, + ], + r_paren_token: missing (required), + }, + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..50 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@50..51 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@51..52 "a" [] [], + }, + }, + COMMA@52..53 "," [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..55 "b" [] [Whitespace(" ")], + }, + }, + ], + r_paren_token: missing (required), + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + VAR_KW@55..58 "var" [] [], + JsBogus { + items: [], + }, + ], + }, + SEMICOLON@58..59 ";" [] [], + ], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..64 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@64..65 "(" [] [], + args: JsCallArgumentList [ + missing element, + COMMA@65..66 "," [] [], + missing element, + COMMA@66..67 "," [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@67..68 "b" [] [], + }, + }, + ], + r_paren_token: R_PAREN@68..69 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@70..75 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@75..76 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@76..77 "a" [] [], + }, + }, + COMMA@77..79 "," [] [Whitespace(" ")], + JsSpread { + dotdotdot_token: DOT3@79..82 "..." [] [], + argument: missing (required), + }, + ], + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: JS_FUNCTION_DECLARATION@0..24 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..22 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..20 + 0: JS_REST_PARAMETER@13..20 + 0: JS_DECORATOR_LIST@13..13 + 1: DOT3@13..16 "..." [] [] + 2: JS_IDENTIFIER_BINDING@16..20 + 0: IDENT@16..20 "args" [] [] + 3: (empty) + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@22..24 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..23 + 3: R_CURLY@23..24 "}" [] [] + 1: JS_VARIABLE_STATEMENT@24..37 + 0: JS_VARIABLE_DECLARATION@24..36 + 0: (empty) + 1: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..36 + 0: JS_VARIABLE_DECLARATOR@29..30 + 0: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@30..32 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@32..33 + 0: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "b" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@33..35 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@35..36 + 0: JS_IDENTIFIER_BINDING@35..36 + 0: IDENT@35..36 "c" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@36..37 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@37..46 + 0: JS_CALL_EXPRESSION@37..45 + 0: JS_IDENTIFIER_EXPRESSION@37..41 + 0: JS_REFERENCE_IDENTIFIER@37..41 + 0: IDENT@37..41 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@41..45 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@42..45 + 0: JS_IDENTIFIER_EXPRESSION@42..43 + 0: JS_REFERENCE_IDENTIFIER@42..43 + 0: IDENT@42..43 "a" [] [] + 1: COMMA@43..44 "," [] [] + 2: JS_IDENTIFIER_EXPRESSION@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "b" [] [] + 2: (empty) + 1: SEMICOLON@45..46 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@46..55 + 0: JS_CALL_EXPRESSION@46..55 + 0: JS_IDENTIFIER_EXPRESSION@46..50 + 0: JS_REFERENCE_IDENTIFIER@46..50 + 0: IDENT@46..50 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@50..55 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@51..55 + 0: JS_IDENTIFIER_EXPRESSION@51..52 + 0: JS_REFERENCE_IDENTIFIER@51..52 + 0: IDENT@51..52 "a" [] [] + 1: COMMA@52..53 "," [] [] + 2: JS_IDENTIFIER_EXPRESSION@53..55 + 0: JS_REFERENCE_IDENTIFIER@53..55 + 0: IDENT@53..55 "b" [] [Whitespace(" ")] + 2: (empty) + 1: (empty) + 4: JS_BOGUS_STATEMENT@55..59 + 0: JS_BOGUS@55..58 + 0: VAR_KW@55..58 "var" [] [] + 1: JS_BOGUS@58..58 + 1: SEMICOLON@58..59 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@59..70 + 0: JS_CALL_EXPRESSION@59..69 + 0: JS_IDENTIFIER_EXPRESSION@59..64 + 0: JS_REFERENCE_IDENTIFIER@59..64 + 0: IDENT@59..64 "foo" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@64..69 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@65..68 + 0: (empty) + 1: COMMA@65..66 "," [] [] + 2: (empty) + 3: COMMA@66..67 "," [] [] + 4: JS_IDENTIFIER_EXPRESSION@67..68 + 0: JS_REFERENCE_IDENTIFIER@67..68 + 0: IDENT@67..68 "b" [] [] + 2: R_PAREN@68..69 ")" [] [] + 1: SEMICOLON@69..70 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@70..84 + 0: JS_CALL_EXPRESSION@70..83 + 0: JS_IDENTIFIER_EXPRESSION@70..75 + 0: JS_REFERENCE_IDENTIFIER@70..75 + 0: IDENT@70..75 "foo" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@75..83 + 0: L_PAREN@75..76 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@76..82 + 0: JS_IDENTIFIER_EXPRESSION@76..77 + 0: JS_REFERENCE_IDENTIFIER@76..77 + 0: IDENT@76..77 "a" [] [] + 1: COMMA@77..79 "," [] [Whitespace(" ")] + 2: JS_SPREAD@79..82 + 0: DOT3@79..82 "..." [] [] + 1: (empty) + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 4: EOF@84..85 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +invalid_arg_list.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `;` + + 1 │ function foo(...args) {} + 2 │ let a, b, c; + > 3 │ foo(a,b; + │ ^ + 4 │ foo(a,b var; + 5 │ foo (,,b); + + i Remove ; + +invalid_arg_list.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `var` + + 2 │ let a, b, c; + 3 │ foo(a,b; + > 4 │ foo(a,b var; + │ ^^^ + 5 │ foo (,,b); + 6 │ foo (a, ...); + + i Remove var + +invalid_arg_list.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found ';'. + + 2 │ let a, b, c; + 3 │ foo(a,b; + > 4 │ foo(a,b var; + │ ^ + 5 │ foo (,,b); + 6 │ foo (a, ...); + + i Expected an identifier, an array pattern, or an object pattern here. + + 2 │ let a, b, c; + 3 │ foo(a,b; + > 4 │ foo(a,b var; + │ ^ + 5 │ foo (,,b); + 6 │ foo (a, ...); + +invalid_arg_list.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ','. + + 3 │ foo(a,b; + 4 │ foo(a,b var; + > 5 │ foo (,,b); + │ ^ + 6 │ foo (a, ...); + 7 │ + + i Expected an expression here. + + 3 │ foo(a,b; + 4 │ foo(a,b var; + > 5 │ foo (,,b); + │ ^ + 6 │ foo (a, ...); + 7 │ + +invalid_arg_list.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ','. + + 3 │ foo(a,b; + 4 │ foo(a,b var; + > 5 │ foo (,,b); + │ ^ + 6 │ foo (a, ...); + 7 │ + + i Expected an expression here. + + 3 │ foo(a,b; + 4 │ foo(a,b var; + > 5 │ foo (,,b); + │ ^ + 6 │ foo (a, ...); + 7 │ + +invalid_arg_list.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ')'. + + 4 │ foo(a,b var; + 5 │ foo (,,b); + > 6 │ foo (a, ...); + │ ^ + 7 │ + + i Expected an expression, or an assignment here. + + 4 │ foo(a,b var; + 5 │ foo (,,b); + > 6 │ foo (a, ...); + │ ^ + 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js.snap new file mode 100644 index 000000000000..aeb4cc6ee6c5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js.snap @@ -0,0 +1,355 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +++a = b; +(++a) = b; +(a = b; +a?.b = b; +a?.["b"] = b; +(a +) = b; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + PLUS2@0..2 "++" [] [], + JsIdentifierAssignment { + name_token: IDENT@2..4 "a" [] [Whitespace(" ")], + }, + ], + }, + operator_token: EQ@4..6 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@6..7 "b" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@7..8 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@8..10 "(" [Newline("\n")] [], + assignment: JsBogusAssignment { + items: [ + PLUS2@10..12 "++" [] [], + JsIdentifierAssignment { + name_token: IDENT@12..13 "a" [] [], + }, + ], + }, + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@15..17 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..18 "b" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@19..21 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@21..23 "a" [] [Whitespace(" ")], + }, + operator_token: EQ@23..25 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@25..26 "b" [] [], + }, + }, + }, + r_paren_token: missing (required), + }, + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..29 "a" [Newline("\n")] [], + }, + }, + QUESTIONDOT@29..31 "?." [] [], + JsName { + value_token: IDENT@31..33 "b" [] [Whitespace(" ")], + }, + ], + }, + operator_token: EQ@33..35 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "b" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@37..39 "a" [Newline("\n")] [], + }, + }, + QUESTIONDOT@39..41 "?." [] [], + L_BRACK@41..42 "[" [] [], + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@42..45 "\"b\"" [] [], + }, + R_BRACK@45..47 "]" [] [Whitespace(" ")], + ], + }, + operator_token: EQ@47..49 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..50 "b" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@51..53 "(" [Newline("\n")] [], + assignment: JsBogusAssignment { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..55 "a" [] [Whitespace(" ")], + }, + }, + PLUS@55..56 "+" [] [], + ], + }, + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@58..60 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@60..61 "b" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@61..62 ";" [] [], + }, + ], + eof_token: EOF@62..63 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..63 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..62 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_ASSIGNMENT_EXPRESSION@0..7 + 0: JS_BOGUS_ASSIGNMENT@0..4 + 0: PLUS2@0..2 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@2..4 + 0: IDENT@2..4 "a" [] [Whitespace(" ")] + 1: EQ@4..6 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@6..7 + 0: JS_REFERENCE_IDENTIFIER@6..7 + 0: IDENT@6..7 "b" [] [] + 1: SEMICOLON@7..8 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@8..19 + 0: JS_ASSIGNMENT_EXPRESSION@8..18 + 0: JS_PARENTHESIZED_ASSIGNMENT@8..15 + 0: L_PAREN@8..10 "(" [Newline("\n")] [] + 1: JS_BOGUS_ASSIGNMENT@10..13 + 0: PLUS2@10..12 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@12..13 + 0: IDENT@12..13 "a" [] [] + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 1: EQ@15..17 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@17..18 + 0: JS_REFERENCE_IDENTIFIER@17..18 + 0: IDENT@17..18 "b" [] [] + 1: SEMICOLON@18..19 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@19..27 + 0: JS_PARENTHESIZED_EXPRESSION@19..26 + 0: L_PAREN@19..21 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@21..26 + 0: JS_IDENTIFIER_ASSIGNMENT@21..23 + 0: IDENT@21..23 "a" [] [Whitespace(" ")] + 1: EQ@23..25 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@25..26 + 0: JS_REFERENCE_IDENTIFIER@25..26 + 0: IDENT@25..26 "b" [] [] + 2: (empty) + 1: SEMICOLON@26..27 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@27..37 + 0: JS_ASSIGNMENT_EXPRESSION@27..36 + 0: JS_BOGUS_ASSIGNMENT@27..33 + 0: JS_IDENTIFIER_EXPRESSION@27..29 + 0: JS_REFERENCE_IDENTIFIER@27..29 + 0: IDENT@27..29 "a" [Newline("\n")] [] + 1: QUESTIONDOT@29..31 "?." [] [] + 2: JS_NAME@31..33 + 0: IDENT@31..33 "b" [] [Whitespace(" ")] + 1: EQ@33..35 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "b" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@37..51 + 0: JS_ASSIGNMENT_EXPRESSION@37..50 + 0: JS_BOGUS_ASSIGNMENT@37..47 + 0: JS_IDENTIFIER_EXPRESSION@37..39 + 0: JS_REFERENCE_IDENTIFIER@37..39 + 0: IDENT@37..39 "a" [Newline("\n")] [] + 1: QUESTIONDOT@39..41 "?." [] [] + 2: L_BRACK@41..42 "[" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@42..45 + 0: JS_STRING_LITERAL@42..45 "\"b\"" [] [] + 4: R_BRACK@45..47 "]" [] [Whitespace(" ")] + 1: EQ@47..49 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@49..50 + 0: JS_REFERENCE_IDENTIFIER@49..50 + 0: IDENT@49..50 "b" [] [] + 1: SEMICOLON@50..51 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@51..62 + 0: JS_ASSIGNMENT_EXPRESSION@51..61 + 0: JS_PARENTHESIZED_ASSIGNMENT@51..58 + 0: L_PAREN@51..53 "(" [Newline("\n")] [] + 1: JS_BOGUS_ASSIGNMENT@53..56 + 0: JS_IDENTIFIER_EXPRESSION@53..55 + 0: JS_REFERENCE_IDENTIFIER@53..55 + 0: IDENT@53..55 "a" [] [Whitespace(" ")] + 1: PLUS@55..56 "+" [] [] + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 1: EQ@58..60 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@60..61 + 0: JS_REFERENCE_IDENTIFIER@60..61 + 0: IDENT@60..61 "b" [] [] + 1: SEMICOLON@61..62 ";" [] [] + 4: EOF@62..63 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +invalid_assignment_target.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `++a` + + > 1 │ ++a = b; + │ ^^^ + 2 │ (++a) = b; + 3 │ (a = b; + + i This expression cannot be assigned to + +invalid_assignment_target.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `++a` + + 1 │ ++a = b; + > 2 │ (++a) = b; + │ ^^^ + 3 │ (a = b; + 4 │ a?.b = b; + + i This expression cannot be assigned to + +invalid_assignment_target.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `;` + + 1 │ ++a = b; + 2 │ (++a) = b; + > 3 │ (a = b; + │ ^ + 4 │ a?.b = b; + 5 │ a?.["b"] = b; + + i Remove ; + +invalid_assignment_target.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `a?.b` + + 2 │ (++a) = b; + 3 │ (a = b; + > 4 │ a?.b = b; + │ ^^^^ + 5 │ a?.["b"] = b; + 6 │ (a +) = b; + + i This expression cannot be assigned to + +invalid_assignment_target.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `a?.["b"]` + + 3 │ (a = b; + 4 │ a?.b = b; + > 5 │ a?.["b"] = b; + │ ^^^^^^^^ + 6 │ (a +) = b; + 7 │ + + i This expression cannot be assigned to + +invalid_assignment_target.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ')'. + + 4 │ a?.b = b; + 5 │ a?.["b"] = b; + > 6 │ (a +) = b; + │ ^ + 7 │ + + i Expected an expression here. + + 4 │ a?.b = b; + 5 │ a?.["b"] = b; + > 6 │ (a +) = b; + │ ^ + 7 │ + +invalid_assignment_target.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `a +` + + 4 │ a?.b = b; + 5 │ a?.["b"] = b; + > 6 │ (a +) = b; + │ ^^^ + 7 │ + + i This expression cannot be assigned to + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_method_recover.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js.snap new file mode 100644 index 000000000000..4fc7d58f82a5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js.snap @@ -0,0 +1,203 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class { + [1 + 1] = () => { + let a=; + }; +}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@6..7 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsComputedMemberName { + l_brack_token: L_BRACK@7..11 "[" [Newline("\n"), Whitespace(" ")] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@11..13 "1" [] [Whitespace(" ")], + }, + operator_token: PLUS@13..15 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@15..16 "1" [] [], + }, + }, + r_brack_token: R_BRACK@16..18 "]" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@27..36 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@36..37 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@37..38 "=" [] [], + expression: missing (required), + }, + }, + ], + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + ], + r_curly_token: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + ], + r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_CLASS_DECLARATION@0..46 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@6..7 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@7..44 + 0: JS_PROPERTY_CLASS_MEMBER@7..44 + 0: JS_PROPERTY_MODIFIER_LIST@7..7 + 1: JS_COMPUTED_MEMBER_NAME@7..18 + 0: L_BRACK@7..11 "[" [Newline("\n"), Whitespace(" ")] [] + 1: JS_BINARY_EXPRESSION@11..16 + 0: JS_NUMBER_LITERAL_EXPRESSION@11..13 + 0: JS_NUMBER_LITERAL@11..13 "1" [] [Whitespace(" ")] + 1: PLUS@13..15 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@15..16 + 0: JS_NUMBER_LITERAL@15..16 "1" [] [] + 2: R_BRACK@16..18 "]" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@18..43 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@20..43 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@26..43 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..39 + 0: JS_VARIABLE_STATEMENT@27..39 + 0: JS_VARIABLE_DECLARATION@27..38 + 0: (empty) + 1: LET_KW@27..36 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@36..38 + 0: JS_VARIABLE_DECLARATOR@36..38 + 0: JS_IDENTIFIER_BINDING@36..37 + 0: IDENT@36..37 "a" [] [] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@37..38 + 0: EQ@37..38 "=" [] [] + 1: (empty) + 1: SEMICOLON@38..39 ";" [] [] + 3: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [] + 4: SEMICOLON@43..44 ";" [] [] + 9: R_CURLY@44..46 "}" [Newline("\n")] [] + 1: JS_EMPTY_STATEMENT@46..47 + 0: SEMICOLON@46..47 ";" [] [] + 4: EOF@47..48 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +invalid_method_recover.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + > 1 │ class { + │ ^^^^^^ + 2 │ [1 + 1] = () => { + 3 │ let a=; + +invalid_method_recover.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ';'. + + 1 │ class { + 2 │ [1 + 1] = () => { + > 3 │ let a=; + │ ^ + 4 │ }; + 5 │ }; + + i Expected an expression, or an assignment here. + + 1 │ class { + 2 │ [1 + 1] = () => { + > 3 │ let a=; + │ ^ + 4 │ }; + 5 │ }; + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.ts b/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.ts rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap new file mode 100644 index 000000000000..0cecae275198 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap @@ -0,0 +1,475 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +new Test?.test(); +new Test?.test(); +new A.b?.c() +new (A.b)?.c() +new (A.b?.()).c() +new A.b?.()() + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsNewExpression { + new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..8 "Test" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@8..9 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@9..15 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@15..16 ">" [] [], + }, + arguments: missing (optional), + }, + operator_token: QUESTIONDOT@16..18 "?." [] [], + member: JsName { + value_token: IDENT@18..22 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@22..23 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@23..24 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsNewExpression { + new_token: NEW_KW@25..30 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..34 "Test" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + operator_token: QUESTIONDOT@34..36 "?." [] [], + member: JsName { + value_token: IDENT@36..40 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@40..41 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@41..42 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsNewExpression { + new_token: NEW_KW@43..48 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@48..49 "A" [] [], + }, + }, + operator_token: DOT@49..50 "." [] [], + member: JsName { + value_token: IDENT@50..51 "b" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + operator_token: QUESTIONDOT@51..53 "?." [] [], + member: JsName { + value_token: IDENT@53..54 "c" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@54..55 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@55..56 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsNewExpression { + new_token: NEW_KW@56..61 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@61..62 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@62..63 "A" [] [], + }, + }, + operator_token: DOT@63..64 "." [] [], + member: JsName { + value_token: IDENT@64..65 "b" [] [], + }, + }, + r_paren_token: R_PAREN@65..66 ")" [] [], + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + operator_token: QUESTIONDOT@66..68 "?." [] [], + member: JsName { + value_token: IDENT@68..69 "c" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@69..70 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@70..71 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@71..76 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@76..77 "(" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@77..78 "A" [] [], + }, + }, + operator_token: DOT@78..79 "." [] [], + member: JsName { + value_token: IDENT@79..80 "b" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@80..82 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@82..83 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@83..84 ")" [] [], + }, + }, + r_paren_token: R_PAREN@84..85 ")" [] [], + }, + operator_token: DOT@85..86 "." [] [], + member: JsName { + value_token: IDENT@86..87 "c" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@87..88 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@88..89 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsCallExpression { + callee: JsNewExpression { + new_token: NEW_KW@89..94 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@94..95 "A" [] [], + }, + }, + operator_token: DOT@95..96 "." [] [], + member: JsName { + value_token: IDENT@96..97 "b" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + optional_chain_token: QUESTIONDOT@97..99 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@99..100 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@100..101 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@101..102 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@102..103 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@103..104 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..104 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..103 + 0: JS_EXPRESSION_STATEMENT@0..25 + 0: JS_CALL_EXPRESSION@0..24 + 0: JS_STATIC_MEMBER_EXPRESSION@0..22 + 0: JS_NEW_EXPRESSION@0..16 + 0: NEW_KW@0..4 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@4..8 + 0: JS_REFERENCE_IDENTIFIER@4..8 + 0: IDENT@4..8 "Test" [] [] + 2: TS_TYPE_ARGUMENTS@8..16 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@9..15 + 0: TS_STRING_TYPE@9..15 + 0: STRING_KW@9..15 "string" [] [] + 2: R_ANGLE@15..16 ">" [] [] + 3: (empty) + 1: QUESTIONDOT@16..18 "?." [] [] + 2: JS_NAME@18..22 + 0: IDENT@18..22 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@22..24 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@23..23 + 2: R_PAREN@23..24 ")" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@25..43 + 0: JS_CALL_EXPRESSION@25..42 + 0: JS_STATIC_MEMBER_EXPRESSION@25..40 + 0: JS_NEW_EXPRESSION@25..34 + 0: NEW_KW@25..30 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@30..34 + 0: JS_REFERENCE_IDENTIFIER@30..34 + 0: IDENT@30..34 "Test" [] [] + 2: (empty) + 3: (empty) + 1: QUESTIONDOT@34..36 "?." [] [] + 2: JS_NAME@36..40 + 0: IDENT@36..40 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@40..42 + 0: L_PAREN@40..41 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@41..41 + 2: R_PAREN@41..42 ")" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@43..56 + 0: JS_CALL_EXPRESSION@43..56 + 0: JS_STATIC_MEMBER_EXPRESSION@43..54 + 0: JS_NEW_EXPRESSION@43..51 + 0: NEW_KW@43..48 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@48..51 + 0: JS_IDENTIFIER_EXPRESSION@48..49 + 0: JS_REFERENCE_IDENTIFIER@48..49 + 0: IDENT@48..49 "A" [] [] + 1: DOT@49..50 "." [] [] + 2: JS_NAME@50..51 + 0: IDENT@50..51 "b" [] [] + 2: (empty) + 3: (empty) + 1: QUESTIONDOT@51..53 "?." [] [] + 2: JS_NAME@53..54 + 0: IDENT@53..54 "c" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@54..56 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@55..55 + 2: R_PAREN@55..56 ")" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@56..71 + 0: JS_CALL_EXPRESSION@56..71 + 0: JS_STATIC_MEMBER_EXPRESSION@56..69 + 0: JS_NEW_EXPRESSION@56..66 + 0: NEW_KW@56..61 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@61..66 + 0: L_PAREN@61..62 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@62..65 + 0: JS_IDENTIFIER_EXPRESSION@62..63 + 0: JS_REFERENCE_IDENTIFIER@62..63 + 0: IDENT@62..63 "A" [] [] + 1: DOT@63..64 "." [] [] + 2: JS_NAME@64..65 + 0: IDENT@64..65 "b" [] [] + 2: R_PAREN@65..66 ")" [] [] + 2: (empty) + 3: (empty) + 1: QUESTIONDOT@66..68 "?." [] [] + 2: JS_NAME@68..69 + 0: IDENT@68..69 "c" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@69..71 + 0: L_PAREN@69..70 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@70..70 + 2: R_PAREN@70..71 ")" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@71..89 + 0: JS_NEW_EXPRESSION@71..89 + 0: NEW_KW@71..76 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@76..87 + 0: JS_PARENTHESIZED_EXPRESSION@76..85 + 0: L_PAREN@76..77 "(" [] [] + 1: JS_CALL_EXPRESSION@77..84 + 0: JS_STATIC_MEMBER_EXPRESSION@77..80 + 0: JS_IDENTIFIER_EXPRESSION@77..78 + 0: JS_REFERENCE_IDENTIFIER@77..78 + 0: IDENT@77..78 "A" [] [] + 1: DOT@78..79 "." [] [] + 2: JS_NAME@79..80 + 0: IDENT@79..80 "b" [] [] + 1: QUESTIONDOT@80..82 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@82..84 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@83..83 + 2: R_PAREN@83..84 ")" [] [] + 2: R_PAREN@84..85 ")" [] [] + 1: DOT@85..86 "." [] [] + 2: JS_NAME@86..87 + 0: IDENT@86..87 "c" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@87..89 + 0: L_PAREN@87..88 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@88..88 + 2: R_PAREN@88..89 ")" [] [] + 1: (empty) + 5: JS_EXPRESSION_STATEMENT@89..103 + 0: JS_CALL_EXPRESSION@89..103 + 0: JS_CALL_EXPRESSION@89..101 + 0: JS_NEW_EXPRESSION@89..97 + 0: NEW_KW@89..94 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@94..97 + 0: JS_IDENTIFIER_EXPRESSION@94..95 + 0: JS_REFERENCE_IDENTIFIER@94..95 + 0: IDENT@94..95 "A" [] [] + 1: DOT@95..96 "." [] [] + 2: JS_NAME@96..97 + 0: IDENT@96..97 "b" [] [] + 2: (empty) + 3: (empty) + 1: QUESTIONDOT@97..99 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@99..101 + 0: L_PAREN@99..100 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@100..100 + 2: R_PAREN@100..101 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@101..103 + 0: L_PAREN@101..102 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@102..102 + 2: R_PAREN@102..103 ")" [] [] + 1: (empty) + 4: EOF@103..104 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +invalid_optional_chain_from_new_expressions.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid optional chain from new expression. + + > 1 │ new Test?.test(); + │ ^^ + 2 │ new Test?.test(); + 3 │ new A.b?.c() + + i Did you mean to call 'Test()'? + +invalid_optional_chain_from_new_expressions.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid optional chain from new expression. + + 1 │ new Test?.test(); + > 2 │ new Test?.test(); + │ ^^ + 3 │ new A.b?.c() + 4 │ new (A.b)?.c() + + i Did you mean to call 'Test()'? + +invalid_optional_chain_from_new_expressions.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid optional chain from new expression. + + 1 │ new Test?.test(); + 2 │ new Test?.test(); + > 3 │ new A.b?.c() + │ ^^ + 4 │ new (A.b)?.c() + 5 │ new (A.b?.()).c() + + i Did you mean to call 'A.b()'? + +invalid_optional_chain_from_new_expressions.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid optional chain from new expression. + + 2 │ new Test?.test(); + 3 │ new A.b?.c() + > 4 │ new (A.b)?.c() + │ ^^ + 5 │ new (A.b?.()).c() + 6 │ new A.b?.()() + + i Did you mean to call '(A.b)()'? + +invalid_optional_chain_from_new_expressions.ts:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid optional chain from new expression. + + 4 │ new (A.b)?.c() + 5 │ new (A.b?.()).c() + > 6 │ new A.b?.()() + │ ^^ + 7 │ + + i Did you mean to call 'A.b()'? + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap new file mode 100644 index 000000000000..f02e1000a79f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap @@ -0,0 +1,247 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (await using of x) {}; +for await (await using of x) {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsVariableDeclaration { + await_token: AWAIT_KW@5..11 "await" [] [Whitespace(" ")], + kind: USING_KW@11..17 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@17..20 "of" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + first_semi_token: missing (required), + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..21 "x" [] [], + }, + }, + second_semi_token: missing (required), + update: missing (optional), + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@23..24 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + JsBogusStatement { + items: [ + FOR_KW@26..31 "for" [Newline("\n")] [Whitespace(" ")], + AWAIT_KW@31..37 "await" [] [Whitespace(" ")], + L_PAREN@37..38 "(" [] [], + JsVariableDeclaration { + await_token: AWAIT_KW@38..44 "await" [] [Whitespace(" ")], + kind: USING_KW@44..50 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@50..53 "of" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..54 "x" [] [], + }, + }, + R_PAREN@54..56 ")" [] [Whitespace(" ")], + JsBlockStatement { + l_curly_token: L_CURLY@56..57 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + ], + eof_token: EOF@59..60 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..60 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..59 + 0: JS_FOR_STATEMENT@0..25 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_VARIABLE_DECLARATION@5..20 + 0: AWAIT_KW@5..11 "await" [] [Whitespace(" ")] + 1: USING_KW@11..17 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@17..20 + 0: JS_VARIABLE_DECLARATOR@17..20 + 0: JS_IDENTIFIER_BINDING@17..20 + 0: IDENT@17..20 "of" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: JS_IDENTIFIER_EXPRESSION@20..21 + 0: JS_REFERENCE_IDENTIFIER@20..21 + 0: IDENT@20..21 "x" [] [] + 5: (empty) + 6: (empty) + 7: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@23..25 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_STATEMENT_LIST@24..24 + 2: R_CURLY@24..25 "}" [] [] + 1: JS_EMPTY_STATEMENT@25..26 + 0: SEMICOLON@25..26 ";" [] [] + 2: JS_BOGUS_STATEMENT@26..58 + 0: FOR_KW@26..31 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@31..37 "await" [] [Whitespace(" ")] + 2: L_PAREN@37..38 "(" [] [] + 3: JS_VARIABLE_DECLARATION@38..53 + 0: AWAIT_KW@38..44 "await" [] [Whitespace(" ")] + 1: USING_KW@44..50 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@50..53 + 0: JS_VARIABLE_DECLARATOR@50..53 + 0: JS_IDENTIFIER_BINDING@50..53 + 0: IDENT@50..53 "of" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: JS_IDENTIFIER_EXPRESSION@53..54 + 0: JS_REFERENCE_IDENTIFIER@53..54 + 0: IDENT@53..54 "x" [] [] + 5: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@56..58 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_STATEMENT_LIST@57..57 + 2: R_CURLY@57..58 "}" [] [] + 3: JS_EMPTY_STATEMENT@58..59 + 0: SEMICOLON@58..59 ";" [] [] + 4: EOF@59..60 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +invalid_using_declarations_inside_for_statement.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + > 1 │ for (await using of x) {}; + │ ^^ + 2 │ for await (await using of x) {}; + 3 │ + + i This variable needs to be initialized. + +invalid_using_declarations_inside_for_statement.js:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `;` but instead found `x` + + > 1 │ for (await using of x) {}; + │ ^ + 2 │ for await (await using of x) {}; + 3 │ + + i Remove x + +invalid_using_declarations_inside_for_statement.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `;` but instead found `)` + + > 1 │ for (await using of x) {}; + │ ^ + 2 │ for await (await using of x) {}; + 3 │ + + i Remove ) + +invalid_using_declarations_inside_for_statement.js:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + 1 │ for (await using of x) {}; + > 2 │ for await (await using of x) {}; + │ ^^ + 3 │ + + i This variable needs to be initialized. + +invalid_using_declarations_inside_for_statement.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `;` but instead found `x` + + 1 │ for (await using of x) {}; + > 2 │ for await (await using of x) {}; + │ ^ + 3 │ + + i Remove x + +invalid_using_declarations_inside_for_statement.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `;` but instead found `)` + + 1 │ for (await using of x) {}; + > 2 │ for await (await using of x) {}; + │ ^ + 3 │ + + i Remove ) + +invalid_using_declarations_inside_for_statement.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × await can only be used in conjunction with `for...of` statements + + 1 │ for (await using of x) {}; + > 2 │ for await (await using of x) {}; + │ ^^^^^ + 3 │ + + i Remove the await here + + 1 │ for (await using of x) {}; + > 2 │ for await (await using of x) {}; + │ ^^^^^ + 3 │ + + i or convert this to a `for...of` statement + + 1 │ for (await using of x) {}; + > 2 │ for await (await using of x) {}; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.js b/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap new file mode 100644 index 000000000000..af0fdfd76169 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap @@ -0,0 +1,192 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + a: string; + b?: string; + c!: string +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsPropertyModifierList [], + JsLiteralMemberName { + value: IDENT@9..12 "a" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + COLON@12..14 ":" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@14..20 "string" [] [], + }, + ], + }, + SEMICOLON@20..21 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [], + JsLiteralMemberName { + value: IDENT@21..24 "b" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + QUESTION@24..25 "?" [] [], + TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@27..33 "string" [] [], + }, + }, + ], + }, + SEMICOLON@33..34 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [], + JsLiteralMemberName { + value: IDENT@34..37 "c" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + BANG@37..38 "!" [] [], + TsTypeAnnotation { + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@40..46 "string" [] [], + }, + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@46..48 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@48..49 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..49 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..48 + 0: JS_CLASS_DECLARATION@0..48 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..46 + 0: JS_BOGUS_MEMBER@9..21 + 0: JS_PROPERTY_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..12 + 0: IDENT@9..12 "a" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@12..20 + 0: COLON@12..14 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@14..20 + 0: STRING_KW@14..20 "string" [] [] + 3: SEMICOLON@20..21 ";" [] [] + 1: JS_BOGUS_MEMBER@21..34 + 0: JS_PROPERTY_MODIFIER_LIST@21..21 + 1: JS_LITERAL_MEMBER_NAME@21..24 + 0: IDENT@21..24 "b" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@24..33 + 0: QUESTION@24..25 "?" [] [] + 1: TS_TYPE_ANNOTATION@25..33 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@27..33 + 0: STRING_KW@27..33 "string" [] [] + 3: SEMICOLON@33..34 ";" [] [] + 2: JS_BOGUS_MEMBER@34..46 + 0: JS_PROPERTY_MODIFIER_LIST@34..34 + 1: JS_LITERAL_MEMBER_NAME@34..37 + 0: IDENT@34..37 "c" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@37..46 + 0: BANG@37..38 "!" [] [] + 1: TS_TYPE_ANNOTATION@38..46 + 0: COLON@38..40 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@40..46 + 0: STRING_KW@40..46 "string" [] [] + 9: R_CURLY@46..48 "}" [Newline("\n")] [] + 4: EOF@48..49 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_class_property_with_ts_annotation.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × return types can only be used in TypeScript files + + 1 │ class A { + > 2 │ a: string; + │ ^^^^^^^^ + 3 │ b?: string; + 4 │ c!: string + + i remove this type annotation + +js_class_property_with_ts_annotation.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `?` modifiers can only be used in TypeScript files + + 1 │ class A { + 2 │ a: string; + > 3 │ b?: string; + │ ^ + 4 │ c!: string + 5 │ } + +js_class_property_with_ts_annotation.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `!` modifiers can only be used in TypeScript files + + 2 │ a: string; + 3 │ b?: string; + > 4 │ c!: string + │ ^ + 5 │ } + 6 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.js b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap new file mode 100644 index 000000000000..4b0562372263 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap @@ -0,0 +1,203 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +class A { constructor(readonly, private, protected, public) {} } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..31 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..40 "readonly" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@40..42 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@42..49 "private" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@49..51 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@51..60 "protected" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@62..68 "public" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@70..71 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..74 + 0: JS_CLASS_DECLARATION@0..74 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..73 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..73 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..31 + 0: IDENT@20..31 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@31..70 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..68 + 0: JS_FORMAL_PARAMETER@32..40 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..40 + 0: IDENT@32..40 "readonly" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@40..42 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@42..49 + 0: JS_DECORATOR_LIST@42..42 + 1: JS_BOGUS_BINDING@42..49 + 0: IDENT@42..49 "private" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@49..51 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@51..60 + 0: JS_DECORATOR_LIST@51..51 + 1: JS_BOGUS_BINDING@51..60 + 0: IDENT@51..60 "protected" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@60..62 "," [] [Whitespace(" ")] + 6: JS_FORMAL_PARAMETER@62..68 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_BOGUS_BINDING@62..68 + 0: IDENT@62..68 "public" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@70..73 + 0: L_CURLY@70..71 "{" [] [] + 1: JS_DIRECTIVE_LIST@71..71 + 2: JS_STATEMENT_LIST@71..71 + 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] + 9: R_CURLY@73..74 "}" [] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_constructor_parameter_reserved_names.cjs:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `private` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^ + 3 │ + +js_constructor_parameter_reserved_names.cjs:2:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `protected` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^^^ + 3 │ + +js_constructor_parameter_reserved_names.cjs:2:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `public` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap new file mode 100644 index 000000000000..e04b8bf95c47 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap @@ -0,0 +1,203 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +class A { constructor(readonly, private, protected, public) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..31 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..40 "readonly" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@40..42 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@42..49 "private" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@49..51 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@51..60 "protected" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@62..68 "public" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@70..71 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: JS_CLASS_DECLARATION@0..74 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..73 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..73 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..31 + 0: IDENT@20..31 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@31..70 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..68 + 0: JS_FORMAL_PARAMETER@32..40 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..40 + 0: IDENT@32..40 "readonly" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@40..42 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@42..49 + 0: JS_DECORATOR_LIST@42..42 + 1: JS_BOGUS_BINDING@42..49 + 0: IDENT@42..49 "private" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@49..51 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@51..60 + 0: JS_DECORATOR_LIST@51..51 + 1: JS_BOGUS_BINDING@51..60 + 0: IDENT@51..60 "protected" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@60..62 "," [] [Whitespace(" ")] + 6: JS_FORMAL_PARAMETER@62..68 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_BOGUS_BINDING@62..68 + 0: IDENT@62..68 "public" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@70..73 + 0: L_CURLY@70..71 "{" [] [] + 1: JS_DIRECTIVE_LIST@71..71 + 2: JS_STATEMENT_LIST@71..71 + 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] + 9: R_CURLY@73..74 "}" [] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_constructor_parameter_reserved_names.js:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `private` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^ + 3 │ + +js_constructor_parameter_reserved_names.js:2:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `protected` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^^^ + 3 │ + +js_constructor_parameter_reserved_names.js:2:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `public` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.js b/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js.snap new file mode 100644 index 000000000000..84e5863cd208 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js.snap @@ -0,0 +1,180 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function a(x: string) {} +function b(x?) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + JsIdentifierBinding { + name_token: IDENT@11..12 "x" [] [], + }, + JsBogus { + items: [ + COLON@12..14 ":" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@14..20 "string" [] [], + }, + ], + }, + ], + }, + ], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@24..34 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@34..35 "b" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@35..36 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + JsIdentifierBinding { + name_token: IDENT@36..37 "x" [] [], + }, + QUESTION@37..38 "?" [] [], + ], + }, + ], + r_paren_token: R_PAREN@38..40 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@40..41 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@41..42 "}" [] [], + }, + }, + ], + eof_token: EOF@42..43 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..43 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..42 + 0: JS_FUNCTION_DECLARATION@0..24 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..22 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..20 + 0: JS_BOGUS_PARAMETER@11..20 + 0: JS_DECORATOR_LIST@11..11 + 1: JS_IDENTIFIER_BINDING@11..12 + 0: IDENT@11..12 "x" [] [] + 2: JS_BOGUS@12..20 + 0: COLON@12..14 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@14..20 + 0: STRING_KW@14..20 "string" [] [] + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@22..24 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..23 + 3: R_CURLY@23..24 "}" [] [] + 1: JS_FUNCTION_DECLARATION@24..42 + 0: (empty) + 1: FUNCTION_KW@24..34 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@34..35 + 0: IDENT@34..35 "b" [] [] + 4: (empty) + 5: JS_PARAMETERS@35..40 + 0: L_PAREN@35..36 "(" [] [] + 1: JS_PARAMETER_LIST@36..38 + 0: JS_BOGUS_PARAMETER@36..38 + 0: JS_DECORATOR_LIST@36..36 + 1: JS_IDENTIFIER_BINDING@36..37 + 0: IDENT@36..37 "x" [] [] + 2: QUESTION@37..38 "?" [] [] + 2: R_PAREN@38..40 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@40..42 + 0: L_CURLY@40..41 "{" [] [] + 1: JS_DIRECTIVE_LIST@41..41 + 2: JS_STATEMENT_LIST@41..41 + 3: R_CURLY@41..42 "}" [] [] + 4: EOF@42..43 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_formal_parameter_error.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + > 1 │ function a(x: string) {} + │ ^^^^^^^^ + 2 │ function b(x?) {} + 3 │ + + i TypeScript only syntax + +js_formal_parameter_error.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × optional parameters are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 1 │ function a(x: string) {} + > 2 │ function b(x?) {} + │ ^ + 3 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.js b/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js.snap new file mode 100644 index 000000000000..0fd91b30e7af --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js.snap @@ -0,0 +1,336 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +([=[(p[=[(p%]>([=[(p[=[( + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsArrayExpression { + l_brack_token: L_BRACK@1..2 "[" [] [], + elements: JsArrayElementList [ + JsBogusExpression { + items: [ + EQ@2..3 "=" [] [], + ], + }, + missing separator, + JsArrayExpression { + l_brack_token: L_BRACK@3..4 "[" [] [], + elements: JsArrayElementList [ + JsParenthesizedExpression { + l_paren_token: L_PAREN@4..5 "(" [] [], + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@5..6 "p" [] [], + }, + }, + l_brack_token: L_BRACK@6..7 "[" [] [], + member: missing (required), + r_brack_token: missing (required), + }, + operator_token: EQ@7..8 "=" [] [], + right: JsBinaryExpression { + left: JsArrayExpression { + l_brack_token: L_BRACK@8..9 "[" [] [], + elements: JsArrayElementList [ + JsParenthesizedExpression { + l_paren_token: L_PAREN@9..10 "(" [] [], + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..11 "p" [] [], + }, + }, + operator_token: PERCENT@11..12 "%" [] [], + right: missing (required), + }, + r_paren_token: missing (required), + }, + ], + r_brack_token: R_BRACK@12..13 "]" [] [], + }, + operator_token: R_ANGLE@13..14 ">" [] [], + right: JsParenthesizedExpression { + l_paren_token: L_PAREN@14..15 "(" [] [], + expression: JsArrayExpression { + l_brack_token: L_BRACK@15..16 "[" [] [], + elements: JsArrayElementList [ + JsBogusExpression { + items: [ + EQ@16..17 "=" [] [], + ], + }, + missing separator, + JsArrayExpression { + l_brack_token: L_BRACK@17..18 "[" [] [], + elements: JsArrayElementList [ + JsParenthesizedExpression { + l_paren_token: L_PAREN@18..19 "(" [] [], + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@19..20 "p" [] [], + }, + }, + l_brack_token: L_BRACK@20..21 "[" [] [], + member: missing (required), + r_brack_token: missing (required), + }, + operator_token: EQ@21..22 "=" [] [], + right: JsArrayExpression { + l_brack_token: L_BRACK@22..23 "[" [] [], + elements: JsArrayElementList [ + JsParenthesizedExpression { + l_paren_token: L_PAREN@23..24 "(" [] [], + expression: missing (required), + r_paren_token: missing (required), + }, + ], + r_brack_token: missing (required), + }, + }, + r_paren_token: missing (required), + }, + ], + r_brack_token: missing (required), + }, + ], + r_brack_token: missing (required), + }, + r_paren_token: missing (required), + }, + }, + }, + r_paren_token: missing (required), + }, + ], + r_brack_token: missing (required), + }, + ], + r_brack_token: missing (required), + }, + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_EXPRESSION_STATEMENT@0..24 + 0: JS_PARENTHESIZED_EXPRESSION@0..24 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ARRAY_EXPRESSION@1..24 + 0: L_BRACK@1..2 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@2..24 + 0: JS_BOGUS_EXPRESSION@2..3 + 0: EQ@2..3 "=" [] [] + 1: (empty) + 2: JS_ARRAY_EXPRESSION@3..24 + 0: L_BRACK@3..4 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@4..24 + 0: JS_PARENTHESIZED_EXPRESSION@4..24 + 0: L_PAREN@4..5 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@5..24 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@5..7 + 0: JS_IDENTIFIER_EXPRESSION@5..6 + 0: JS_REFERENCE_IDENTIFIER@5..6 + 0: IDENT@5..6 "p" [] [] + 1: L_BRACK@6..7 "[" [] [] + 2: (empty) + 3: (empty) + 1: EQ@7..8 "=" [] [] + 2: JS_BINARY_EXPRESSION@8..24 + 0: JS_ARRAY_EXPRESSION@8..13 + 0: L_BRACK@8..9 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@9..12 + 0: JS_PARENTHESIZED_EXPRESSION@9..12 + 0: L_PAREN@9..10 "(" [] [] + 1: JS_BINARY_EXPRESSION@10..12 + 0: JS_IDENTIFIER_EXPRESSION@10..11 + 0: JS_REFERENCE_IDENTIFIER@10..11 + 0: IDENT@10..11 "p" [] [] + 1: PERCENT@11..12 "%" [] [] + 2: (empty) + 2: (empty) + 2: R_BRACK@12..13 "]" [] [] + 1: R_ANGLE@13..14 ">" [] [] + 2: JS_PARENTHESIZED_EXPRESSION@14..24 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_ARRAY_EXPRESSION@15..24 + 0: L_BRACK@15..16 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@16..24 + 0: JS_BOGUS_EXPRESSION@16..17 + 0: EQ@16..17 "=" [] [] + 1: (empty) + 2: JS_ARRAY_EXPRESSION@17..24 + 0: L_BRACK@17..18 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@18..24 + 0: JS_PARENTHESIZED_EXPRESSION@18..24 + 0: L_PAREN@18..19 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@19..24 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@19..21 + 0: JS_IDENTIFIER_EXPRESSION@19..20 + 0: JS_REFERENCE_IDENTIFIER@19..20 + 0: IDENT@19..20 "p" [] [] + 1: L_BRACK@20..21 "[" [] [] + 2: (empty) + 3: (empty) + 1: EQ@21..22 "=" [] [] + 2: JS_ARRAY_EXPRESSION@22..24 + 0: L_BRACK@22..23 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@23..24 + 0: JS_PARENTHESIZED_EXPRESSION@23..24 + 0: L_PAREN@23..24 "(" [] [] + 1: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 1: (empty) + 4: EOF@24..25 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_invalid_assignment.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a property, an expression, or a method but instead found '='. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Expected a property, an expression, or a method here. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + +js_invalid_assignment.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `[` + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Remove [ + +js_invalid_assignment.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '='. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + +js_invalid_assignment.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ']'. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + +js_invalid_assignment.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a property, an expression, or a method but instead found '='. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Expected a property, an expression, or a method here. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + +js_invalid_assignment.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `[` + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Remove [ + +js_invalid_assignment.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '='. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ + +js_invalid_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead the file ends + + 1 │ ([=[(p[=[(p%]>([=[(p[=[( + > 2 │ + │ + + i the file ends here + + 1 │ ([=[(p[=[(p%]>([=[(p[=[( + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.js b/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_regex_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js.snap new file mode 100644 index 000000000000..68f376330887 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js.snap @@ -0,0 +1,90 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +/=0*_:m/=/*_:| + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + JS_REGEX_LITERAL@0..8 "/=0*_:m/" [] [], + ], + }, + operator_token: EQ@8..15 "=" [] [Comments("/*_:|\n")], + right: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@15..15 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..15 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..15 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JS_ASSIGNMENT_EXPRESSION@0..15 + 0: JS_BOGUS_ASSIGNMENT@0..8 + 0: JS_REGEX_LITERAL@0..8 "/=0*_:m/" [] [] + 1: EQ@8..15 "=" [] [Comments("/*_:|\n")] + 2: (empty) + 1: (empty) + 4: EOF@15..15 "" [] [] + +``` + +## Diagnostics + +``` +js_regex_assignment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `/=0*_:m/` + + > 1 │ /=0*_:m/=/*_:| + │ ^^^^^^^^ + 2 │ + + i This expression cannot be assigned to + +js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated block comment + + 1 │ /=0*_:m/=/*_:| + > 2 │ + │ + + i ... but the file ends here + + 1 │ /=0*_:m/=/*_:| + > 2 │ + │ + + i A block comment starts here + + > 1 │ /=0*_:m/=/*_:| + │ ^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.js b/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js.snap new file mode 100644 index 000000000000..93c36c0413ee --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js.snap @@ -0,0 +1,201 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(([zAgRvz=[=(e{V{ + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@1..2 "(" [] [], + expression: JsArrayExpression { + l_brack_token: L_BRACK@2..3 "[" [] [], + elements: JsArrayElementList [ + JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@3..9 "zAgRvz" [] [], + }, + operator_token: EQ@9..10 "=" [] [], + right: JsArrayExpression { + l_brack_token: L_BRACK@10..11 "[" [] [], + elements: JsArrayElementList [ + JsBogusExpression { + items: [ + EQ@11..12 "=" [] [], + ], + }, + missing separator, + JsParenthesizedExpression { + l_paren_token: L_PAREN@12..13 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..14 "e" [] [], + }, + }, + r_paren_token: missing (required), + }, + missing separator, + JsObjectExpression { + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "V" [] [], + }, + }, + missing separator, + JsBogusMember { + items: [ + L_CURLY@16..17 "{" [] [], + ], + }, + ], + r_curly_token: missing (required), + }, + ], + r_brack_token: missing (required), + }, + }, + ], + r_brack_token: missing (required), + }, + r_paren_token: missing (required), + }, + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: JS_EXPRESSION_STATEMENT@0..17 + 0: JS_PARENTHESIZED_EXPRESSION@0..17 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@1..17 + 0: L_PAREN@1..2 "(" [] [] + 1: JS_ARRAY_EXPRESSION@2..17 + 0: L_BRACK@2..3 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@3..17 + 0: JS_ASSIGNMENT_EXPRESSION@3..17 + 0: JS_IDENTIFIER_ASSIGNMENT@3..9 + 0: IDENT@3..9 "zAgRvz" [] [] + 1: EQ@9..10 "=" [] [] + 2: JS_ARRAY_EXPRESSION@10..17 + 0: L_BRACK@10..11 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@11..17 + 0: JS_BOGUS_EXPRESSION@11..12 + 0: EQ@11..12 "=" [] [] + 1: (empty) + 2: JS_PARENTHESIZED_EXPRESSION@12..14 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@13..14 + 0: JS_REFERENCE_IDENTIFIER@13..14 + 0: IDENT@13..14 "e" [] [] + 2: (empty) + 3: (empty) + 4: JS_OBJECT_EXPRESSION@14..17 + 0: L_CURLY@14..15 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@15..17 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "V" [] [] + 1: (empty) + 2: JS_BOGUS_MEMBER@16..17 + 0: L_CURLY@16..17 "{" [] [] + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 2: (empty) + 1: (empty) + 4: EOF@17..18 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_rewind_at_eof_token.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a property, an expression, or a method but instead found '='. + + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ + + i Expected a property, an expression, or a method here. + + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ + +js_rewind_at_eof_token.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `(` + + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ + + i Remove ( + +js_rewind_at_eof_token.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ + + i Remove { + +js_rewind_at_eof_token.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `{` + + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ + + i Remove { + +js_rewind_at_eof_token.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead the file ends + + 1 │ (([zAgRvz=[=(e{V{ + > 2 │ + │ + + i the file ends here + + 1 │ (([zAgRvz=[=(e{V{ + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.js b/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js.snap new file mode 100644 index 000000000000..bf8843e18697 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js.snap @@ -0,0 +1,82 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +1 >> /* a comment */ > 2; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..2 "1" [] [Whitespace(" ")], + }, + operator_token: SHR@2..21 ">>" [] [Whitespace(" "), Comments("/* a comment */"), Whitespace(" ")], + right: missing (required), + }, + operator_token: R_ANGLE@21..23 ">" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..24 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..25 + 0: JS_EXPRESSION_STATEMENT@0..25 + 0: JS_BINARY_EXPRESSION@0..24 + 0: JS_BINARY_EXPRESSION@0..21 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 + 0: JS_NUMBER_LITERAL@0..2 "1" [] [Whitespace(" ")] + 1: SHR@2..21 ">>" [] [Whitespace(" "), Comments("/* a comment */"), Whitespace(" ")] + 2: (empty) + 1: R_ANGLE@21..23 ">" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@23..24 + 0: JS_NUMBER_LITERAL@23..24 "2" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_right_shift_comments.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '>'. + + > 1 │ 1 >> /* a comment */ > 2; + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ 1 >> /* a comment */ > 2; + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.js b/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js.snap new file mode 100644 index 000000000000..9916a6359784 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js.snap @@ -0,0 +1,131 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a: string, b!: number; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@0..4 "let" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + JsBogus { + items: [ + COLON@5..7 ":" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@7..13 "string" [] [], + }, + ], + }, + ], + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsBogus { + items: [ + JsIdentifierBinding { + name_token: IDENT@15..16 "b" [] [], + }, + JsBogus { + items: [ + BANG@16..17 "!" [] [], + TsTypeAnnotation { + colon_token: COLON@17..19 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@19..25 "number" [] [], + }, + }, + ], + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@25..26 ";" [] [], + ], + }, + ], + eof_token: EOF@26..27 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..27 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..26 + 0: JS_BOGUS_STATEMENT@0..26 + 0: JS_BOGUS@0..25 + 0: LET_KW@0..4 "let" [] [Whitespace(" ")] + 1: JS_BOGUS@4..25 + 0: JS_BOGUS@4..13 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: JS_BOGUS@5..13 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@7..13 + 0: STRING_KW@7..13 "string" [] [] + 1: COMMA@13..15 "," [] [Whitespace(" ")] + 2: JS_BOGUS@15..25 + 0: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "b" [] [] + 1: JS_BOGUS@16..25 + 0: BANG@16..17 "!" [] [] + 1: TS_TYPE_ANNOTATION@17..25 + 0: COLON@17..19 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@19..25 + 0: NUMBER_KW@19..25 "number" [] [] + 1: SEMICOLON@25..26 ";" [] [] + 4: EOF@26..27 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_type_variable_annotation.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + > 1 │ let a: string, b!: number; + │ ^^^^^^^^ + 2 │ + + i TypeScript only syntax + +js_type_variable_annotation.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × definite assertion assignments are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + > 1 │ let a: string, b!: number; + │ ^^^^^^^^^ + 2 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap new file mode 100644 index 000000000000..7374846ad909 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap @@ -0,0 +1,117 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ 4 + 3 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [ + JsxExpressionChild { + l_curly_token: L_CURLY@6..8 "{" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@8..10 "4" [] [Whitespace(" ")], + }, + operator_token: PLUS@10..12 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@12..13 "3" [] [], + }, + }, + r_curly_token: missing (required), + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@13..14 "<" [] [], + slash_token: SLASH@14..15 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@15..19 "test" [] [], + }, + r_angle_token: R_ANGLE@19..20 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_EXPRESSION_STATEMENT@0..20 + 0: JSX_TAG_EXPRESSION@0..20 + 0: JSX_ELEMENT@0..20 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..13 + 0: JSX_EXPRESSION_CHILD@6..13 + 0: L_CURLY@6..8 "{" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@8..13 + 0: JS_NUMBER_LITERAL_EXPRESSION@8..10 + 0: JS_NUMBER_LITERAL@8..10 "4" [] [Whitespace(" ")] + 1: PLUS@10..12 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@12..13 + 0: JS_NUMBER_LITERAL@12..13 "3" [] [] + 2: (empty) + 2: JSX_CLOSING_ELEMENT@13..20 + 0: L_ANGLE@13..14 "<" [] [] + 1: SLASH@14..15 "/" [] [] + 2: JSX_NAME@15..19 + 0: JSX_IDENT@15..19 "test" [] [] + 3: R_ANGLE@19..20 ">" [] [] + 1: (empty) + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_child_expression_missing_r_curly.jsx:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `<` + + > 1 │ { 4 + 3 + │ ^ + 2 │ + + i Remove < + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap new file mode 100644 index 000000000000..ffb0059a41a6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap @@ -0,0 +1,133 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + + { 5 + 3 + some text + + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@6..9 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@11..13 "5" [] [Whitespace(" ")], + }, + operator_token: PLUS@13..15 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@15..16 "3" [] [], + }, + }, + r_curly_token: missing (required), + }, + JsxText { + value_token: JSX_TEXT_LITERAL@16..29 "some text\n" [Newline("\n"), Whitespace(" ")] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@29..30 "<" [] [], + slash_token: SLASH@30..31 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@31..35 "test" [] [], + }, + r_angle_token: R_ANGLE@35..36 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@36..37 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..37 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..36 + 0: JS_EXPRESSION_STATEMENT@0..36 + 0: JSX_TAG_EXPRESSION@0..36 + 0: JSX_ELEMENT@0..36 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..29 + 0: JSX_TEXT@6..9 + 0: JSX_TEXT_LITERAL@6..9 "\n " [] [] + 1: JSX_EXPRESSION_CHILD@9..16 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@11..16 + 0: JS_NUMBER_LITERAL_EXPRESSION@11..13 + 0: JS_NUMBER_LITERAL@11..13 "5" [] [Whitespace(" ")] + 1: PLUS@13..15 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@15..16 + 0: JS_NUMBER_LITERAL@15..16 "3" [] [] + 2: (empty) + 2: JSX_TEXT@16..29 + 0: JSX_TEXT_LITERAL@16..29 "some text\n" [Newline("\n"), Whitespace(" ")] [] + 2: JSX_CLOSING_ELEMENT@29..36 + 0: L_ANGLE@29..30 "<" [] [] + 1: SLASH@30..31 "/" [] [] + 2: JSX_NAME@31..35 + 0: JSX_IDENT@31..35 "test" [] [] + 3: R_ANGLE@35..36 ">" [] [] + 1: (empty) + 4: EOF@36..37 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_children_expression_missing_r_curly.jsx:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `some` + + 1 │ + 2 │ { 5 + 3 + > 3 │ some text + │ ^^^^ + 4 │ + 5 │ + + i Remove some + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap new file mode 100644 index 000000000000..2960fe64e1d5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap @@ -0,0 +1,251 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
+ {import.meta} + {class A{}} + {super()} + {new.target} +
+ +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..4 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@4..5 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@5..8 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@8..9 "{" [] [], + expression: JsBogusExpression { + items: [ + IMPORT_KW@9..15 "import" [] [], + DOT@15..16 "." [] [], + META@16..20 "meta" [] [], + ], + }, + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@21..24 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@24..25 "{" [] [], + expression: JsBogusExpression { + items: [ + JsDecoratorList [], + CLASS_KW@25..31 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@31..32 "A" [] [], + }, + L_CURLY@32..33 "{" [] [], + JsClassMemberList [], + R_CURLY@33..34 "}" [] [], + ], + }, + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@35..38 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@38..39 "{" [] [], + expression: JsCallExpression { + callee: JsBogusExpression { + items: [ + SUPER_KW@39..44 "super" [] [], + ], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@44..45 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@45..46 ")" [] [], + }, + }, + r_curly_token: R_CURLY@46..47 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@47..50 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@50..51 "{" [] [], + expression: JsBogusExpression { + items: [ + NEW_KW@51..54 "new" [] [], + DOT@54..55 "." [] [], + TARGET@55..61 "target" [] [], + ], + }, + r_curly_token: R_CURLY@61..62 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@62..63 "\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@63..64 "<" [] [], + slash_token: SLASH@64..65 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@65..68 "div" [] [], + }, + r_angle_token: R_ANGLE@68..69 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@69..70 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..70 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..69 + 0: JS_EXPRESSION_STATEMENT@0..69 + 0: JSX_TAG_EXPRESSION@0..69 + 0: JSX_ELEMENT@0..69 + 0: JSX_OPENING_ELEMENT@0..5 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..4 + 0: JSX_IDENT@1..4 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@4..4 + 4: R_ANGLE@4..5 ">" [] [] + 1: JSX_CHILD_LIST@5..63 + 0: JSX_TEXT@5..8 + 0: JSX_TEXT_LITERAL@5..8 "\n " [] [] + 1: JSX_EXPRESSION_CHILD@8..21 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_BOGUS_EXPRESSION@9..20 + 0: IMPORT_KW@9..15 "import" [] [] + 1: DOT@15..16 "." [] [] + 2: META@16..20 "meta" [] [] + 2: R_CURLY@20..21 "}" [] [] + 2: JSX_TEXT@21..24 + 0: JSX_TEXT_LITERAL@21..24 "\n " [] [] + 3: JSX_EXPRESSION_CHILD@24..35 + 0: L_CURLY@24..25 "{" [] [] + 1: JS_BOGUS_EXPRESSION@25..34 + 0: JS_DECORATOR_LIST@25..25 + 1: CLASS_KW@25..31 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@31..32 + 0: IDENT@31..32 "A" [] [] + 3: L_CURLY@32..33 "{" [] [] + 4: JS_CLASS_MEMBER_LIST@33..33 + 5: R_CURLY@33..34 "}" [] [] + 2: R_CURLY@34..35 "}" [] [] + 4: JSX_TEXT@35..38 + 0: JSX_TEXT_LITERAL@35..38 "\n " [] [] + 5: JSX_EXPRESSION_CHILD@38..47 + 0: L_CURLY@38..39 "{" [] [] + 1: JS_CALL_EXPRESSION@39..46 + 0: JS_BOGUS_EXPRESSION@39..44 + 0: SUPER_KW@39..44 "super" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@44..46 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@45..45 + 2: R_PAREN@45..46 ")" [] [] + 2: R_CURLY@46..47 "}" [] [] + 6: JSX_TEXT@47..50 + 0: JSX_TEXT_LITERAL@47..50 "\n " [] [] + 7: JSX_EXPRESSION_CHILD@50..62 + 0: L_CURLY@50..51 "{" [] [] + 1: JS_BOGUS_EXPRESSION@51..61 + 0: NEW_KW@51..54 "new" [] [] + 1: DOT@54..55 "." [] [] + 2: TARGET@55..61 "target" [] [] + 2: R_CURLY@61..62 "}" [] [] + 8: JSX_TEXT@62..63 + 0: JSX_TEXT_LITERAL@62..63 "\n" [] [] + 2: JSX_CLOSING_ELEMENT@63..69 + 0: L_ANGLE@63..64 "<" [] [] + 1: SLASH@64..65 "/" [] [] + 2: JSX_NAME@65..68 + 0: JSX_IDENT@65..68 "div" [] [] + 3: R_ANGLE@68..69 ">" [] [] + 1: (empty) + 4: EOF@69..70 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_children_expressions_not_accepted.jsx:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × This expression is not valid as a JSX expression. + + 1 │
+ > 2 │ {import.meta} + │ ^^^^^^^^^^^ + 3 │ {class A{}} + 4 │ {super()} + +jsx_children_expressions_not_accepted.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × This expression is not valid as a JSX expression. + + 1 │
+ 2 │ {import.meta} + > 3 │ {class A{}} + │ ^^^^^^^^^ + 4 │ {super()} + 5 │ {new.target} + +jsx_children_expressions_not_accepted.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `super` is only valid inside of a class constructor of a subclass. + + 2 │ {import.meta} + 3 │ {class A{}} + > 4 │ {super()} + │ ^^^^^ + 5 │ {new.target} + 6 │
+ +jsx_children_expressions_not_accepted.jsx:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × This expression is not valid as a JSX expression. + + 3 │ {class A{}} + 4 │ {super()} + > 5 │ {new.target} + │ ^^^^^^^^^^ + 6 │
+ 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap new file mode 100644 index 000000000000..1d473158ac76 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap @@ -0,0 +1,409 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; +; +<><5>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@6..7 "<" [] [], + slash_token: SLASH@7..8 "/" [] [], + name: missing (required), + r_angle_token: R_ANGLE@8..9 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@10..12 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@12..16 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@16..17 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@17..18 "<" [] [], + slash_token: SLASH@18..19 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@19..23 "text" [] [], + }, + r_angle_token: R_ANGLE@23..24 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@25..27 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@27..31 "some" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@31..32 ">" [] [], + }, + children: JsxChildList [ + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@32..33 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@33..39 "nested" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@39..40 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@40..41 "<" [] [], + slash_token: SLASH@41..42 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@42..46 "some" [] [], + }, + r_angle_token: R_ANGLE@46..47 ">" [] [], + }, + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@47..48 "<" [] [], + slash_token: SLASH@48..49 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@49..55 "nested" [] [], + }, + r_angle_token: R_ANGLE@55..56 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@56..57 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + JsxOpeningFragment { + l_angle_token: L_ANGLE@57..59 "<" [Newline("\n")] [], + r_angle_token: R_ANGLE@59..60 ">" [] [], + }, + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_ANGLE@60..61 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JS_NUMBER_LITERAL@61..62 "5" [] [], + ], + }, + ], + }, + R_ANGLE@62..63 ">" [] [], + ], + }, + JsxChildList [], + JsxClosingElement { + l_angle_token: L_ANGLE@63..64 "<" [] [], + slash_token: SLASH@64..65 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@65..69 "test" [] [], + }, + r_angle_token: R_ANGLE@69..70 ">" [] [], + }, + ], + }, + ], + }, + JsxClosingFragment { + l_angle_token: L_ANGLE@70..71 "<" [] [], + slash_token: SLASH@71..72 "/" [] [], + r_angle_token: R_ANGLE@72..73 ">" [] [], + }, + ], + }, + ], + }, + semicolon_token: SEMICOLON@73..74 ";" [] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: JS_EXPRESSION_STATEMENT@0..10 + 0: JSX_TAG_EXPRESSION@0..9 + 0: JSX_ELEMENT@0..9 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..6 + 2: JSX_CLOSING_ELEMENT@6..9 + 0: L_ANGLE@6..7 "<" [] [] + 1: SLASH@7..8 "/" [] [] + 2: (empty) + 3: R_ANGLE@8..9 ">" [] [] + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@10..25 + 0: JSX_TAG_EXPRESSION@10..24 + 0: JSX_ELEMENT@10..24 + 0: JSX_OPENING_ELEMENT@10..17 + 0: L_ANGLE@10..12 "<" [Newline("\n")] [] + 1: JSX_NAME@12..16 + 0: JSX_IDENT@12..16 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@16..16 + 4: R_ANGLE@16..17 ">" [] [] + 1: JSX_CHILD_LIST@17..17 + 2: JSX_CLOSING_ELEMENT@17..24 + 0: L_ANGLE@17..18 "<" [] [] + 1: SLASH@18..19 "/" [] [] + 2: JSX_NAME@19..23 + 0: JSX_IDENT@19..23 "text" [] [] + 3: R_ANGLE@23..24 ">" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@25..57 + 0: JSX_TAG_EXPRESSION@25..56 + 0: JSX_ELEMENT@25..56 + 0: JSX_OPENING_ELEMENT@25..32 + 0: L_ANGLE@25..27 "<" [Newline("\n")] [] + 1: JSX_NAME@27..31 + 0: JSX_IDENT@27..31 "some" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@31..31 + 4: R_ANGLE@31..32 ">" [] [] + 1: JSX_CHILD_LIST@32..47 + 0: JSX_ELEMENT@32..47 + 0: JSX_OPENING_ELEMENT@32..40 + 0: L_ANGLE@32..33 "<" [] [] + 1: JSX_NAME@33..39 + 0: JSX_IDENT@33..39 "nested" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@39..39 + 4: R_ANGLE@39..40 ">" [] [] + 1: JSX_CHILD_LIST@40..40 + 2: JSX_CLOSING_ELEMENT@40..47 + 0: L_ANGLE@40..41 "<" [] [] + 1: SLASH@41..42 "/" [] [] + 2: JSX_NAME@42..46 + 0: JSX_IDENT@42..46 "some" [] [] + 3: R_ANGLE@46..47 ">" [] [] + 2: JSX_CLOSING_ELEMENT@47..56 + 0: L_ANGLE@47..48 "<" [] [] + 1: SLASH@48..49 "/" [] [] + 2: JSX_NAME@49..55 + 0: JSX_IDENT@49..55 "nested" [] [] + 3: R_ANGLE@55..56 ">" [] [] + 1: SEMICOLON@56..57 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@57..74 + 0: JS_BOGUS_EXPRESSION@57..73 + 0: JS_BOGUS@57..73 + 0: JSX_OPENING_FRAGMENT@57..60 + 0: L_ANGLE@57..59 "<" [Newline("\n")] [] + 1: R_ANGLE@59..60 ">" [] [] + 1: JS_BOGUS@60..70 + 0: JS_BOGUS@60..70 + 0: JS_BOGUS@60..63 + 0: L_ANGLE@60..61 "<" [] [] + 1: JS_BOGUS@61..62 + 0: JS_BOGUS@61..62 + 0: JS_NUMBER_LITERAL@61..62 "5" [] [] + 2: R_ANGLE@62..63 ">" [] [] + 1: JSX_CHILD_LIST@63..63 + 2: JSX_CLOSING_ELEMENT@63..70 + 0: L_ANGLE@63..64 "<" [] [] + 1: SLASH@64..65 "/" [] [] + 2: JSX_NAME@65..69 + 0: JSX_IDENT@65..69 "test" [] [] + 3: R_ANGLE@69..70 ">" [] [] + 2: JSX_CLOSING_FRAGMENT@70..73 + 0: L_ANGLE@70..71 "<" [] [] + 1: SLASH@71..72 "/" [] [] + 2: R_ANGLE@72..73 ">" [] [] + 1: SEMICOLON@73..74 ";" [] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_closing_element_mismatch.jsx:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected corresponding JSX closing tag for 'test'. + + > 1 │ ; + │ ^^^^^^ + 2 │ ; + 3 │ ; + + i Opening tag + + > 1 │ ; + │ ^^^^^^ + 2 │ ; + 3 │ ; + + i closing tag + + > 1 │ ; + │ ^^^ + 2 │ ; + 3 │ ; + +jsx_closing_element_mismatch.jsx:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected corresponding JSX closing tag for 'test'. + + 1 │ ; + > 2 │ ; + │ ^^^^^^ + 3 │ ; + 4 │ <><5>; + + i Opening tag + + 1 │ ; + > 2 │ ; + │ ^^^^^^ + 3 │ ; + 4 │ <><5>; + + i closing tag + + 1 │ ; + > 2 │ ; + │ ^^^^^^^ + 3 │ ; + 4 │ <><5>; + +jsx_closing_element_mismatch.jsx:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected corresponding JSX closing tag for 'nested'. + + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^^ + 4 │ <><5>; + 5 │ + + i Opening tag + + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^^ + 4 │ <><5>; + 5 │ + + i closing tag + + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^ + 4 │ <><5>; + 5 │ + +jsx_closing_element_mismatch.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected corresponding JSX closing tag for 'some'. + + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^ + 4 │ <><5>; + 5 │ + + i Opening tag + + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^ + 4 │ <><5>; + 5 │ + + i closing tag + + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^^^ + 4 │ <><5>; + 5 │ + +jsx_closing_element_mismatch.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found '5'. + + 2 │ ; + 3 │ ; + > 4 │ <><5>; + │ ^ + 5 │ + + i Expected an identifier here. + + 2 │ ; + 3 │ ; + > 4 │ <><5>; + │ ^ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap new file mode 100644 index 000000000000..2cecbc69480b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap @@ -0,0 +1,127 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>abcd + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@0..1 "<" [] [], + r_angle_token: R_ANGLE@1..2 ">" [] [], + }, + children: JsxChildList [ + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@2..3 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@3..7 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@7..8 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@8..12 "abcd" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@12..13 "<" [] [], + slash_token: SLASH@13..14 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@14..19 "test" [] [Whitespace(" ")], + }, + r_angle_token: missing (required), + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@19..44 "more content follows here" [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@44..45 "<" [] [], + slash_token: SLASH@45..46 "/" [] [], + r_angle_token: R_ANGLE@46..47 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_EXPRESSION_STATEMENT@0..47 + 0: JSX_TAG_EXPRESSION@0..47 + 0: JSX_FRAGMENT@0..47 + 0: JSX_OPENING_FRAGMENT@0..2 + 0: L_ANGLE@0..1 "<" [] [] + 1: R_ANGLE@1..2 ">" [] [] + 1: JSX_CHILD_LIST@2..44 + 0: JSX_ELEMENT@2..19 + 0: JSX_OPENING_ELEMENT@2..8 + 0: L_ANGLE@2..3 "<" [] [] + 1: JSX_NAME@3..7 + 0: JSX_IDENT@3..7 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@7..7 + 4: R_ANGLE@7..8 ">" [] [] + 1: JSX_CHILD_LIST@8..12 + 0: JSX_TEXT@8..12 + 0: JSX_TEXT_LITERAL@8..12 "abcd" [] [] + 2: JSX_CLOSING_ELEMENT@12..19 + 0: L_ANGLE@12..13 "<" [] [] + 1: SLASH@13..14 "/" [] [] + 2: JSX_NAME@14..19 + 0: JSX_IDENT@14..19 "test" [] [Whitespace(" ")] + 3: (empty) + 1: JSX_TEXT@19..44 + 0: JSX_TEXT_LITERAL@19..44 "more content follows here" [] [] + 2: JSX_CLOSING_FRAGMENT@44..47 + 0: L_ANGLE@44..45 "<" [] [] + 1: SLASH@45..46 "/" [] [] + 2: R_ANGLE@46..47 ">" [] [] + 1: (empty) + 4: EOF@47..48 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_closing_missing_r_angle.jsx:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `more` + + > 1 │ <>abcd + │ ^^^^ + 2 │ + + i Remove more + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap new file mode 100644 index 000000000000..5e280a2c1bad --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap @@ -0,0 +1,106 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@5..14 "className" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@14..15 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@15..16 "{" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..21 "asdf" [] [Whitespace(" ")], + }, + }, + r_curly_token: R_CURLY@21..27 "}" [Skipped("asdf")] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@27..28 "/" [] [], + r_angle_token: R_ANGLE@28..29 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@29..30 ";" [] [], + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_EXPRESSION_STATEMENT@0..30 + 0: JSX_TAG_EXPRESSION@0..29 + 0: JSX_SELF_CLOSING_ELEMENT@0..29 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..27 + 0: JSX_ATTRIBUTE@5..27 + 0: JSX_NAME@5..14 + 0: JSX_IDENT@5..14 "className" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@14..27 + 0: EQ@14..15 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@15..27 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_IDENTIFIER_EXPRESSION@16..21 + 0: JS_REFERENCE_IDENTIFIER@16..21 + 0: IDENT@16..21 "asdf" [] [Whitespace(" ")] + 2: R_CURLY@21..27 "}" [Skipped("asdf")] [Whitespace(" ")] + 4: SLASH@27..28 "/" [] [] + 5: R_ANGLE@28..29 ">" [] [] + 1: SEMICOLON@29..30 ";" [] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_element_attribute_expression_error.jsx:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `asdf` + + > 1 │
; + │ ^^^^ + 2 │ + + i Remove asdf + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap new file mode 100644 index 000000000000..369440c7b6d6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap @@ -0,0 +1,161 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@26..27 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@27..31 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@31..45 "string_literal" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@45..47 "=" [] [Whitespace(" ")], + value: missing (required), + }, + }, + ], + r_angle_token: R_ANGLE@47..48 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@48..49 "<" [] [], + slash_token: SLASH@49..50 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@50..53 "div" [] [], + }, + r_angle_token: R_ANGLE@53..54 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@54..55 ";" [] [], + }, + ], + r_curly_token: R_CURLY@55..57 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@57..58 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..58 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..57 + 0: JS_FUNCTION_DECLARATION@0..57 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@13..57 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..55 + 0: JS_RETURN_STATEMENT@14..55 + 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@26..54 + 0: JSX_ELEMENT@26..54 + 0: JSX_OPENING_ELEMENT@26..48 + 0: L_ANGLE@26..27 "<" [] [] + 1: JSX_NAME@27..31 + 0: JSX_IDENT@27..31 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@31..47 + 0: JSX_ATTRIBUTE@31..47 + 0: JSX_NAME@31..45 + 0: JSX_IDENT@31..45 "string_literal" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@45..47 + 0: EQ@45..47 "=" [] [Whitespace(" ")] + 1: (empty) + 4: R_ANGLE@47..48 ">" [] [] + 1: JSX_CHILD_LIST@48..48 + 2: JSX_CLOSING_ELEMENT@48..54 + 0: L_ANGLE@48..49 "<" [] [] + 1: SLASH@49..50 "/" [] [] + 2: JSX_NAME@50..53 + 0: JSX_IDENT@50..53 "div" [] [] + 3: R_ANGLE@53..54 ">" [] [] + 2: SEMICOLON@54..55 ";" [] [] + 3: R_CURLY@55..57 "}" [Newline("\n")] [] + 4: EOF@57..58 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_element_attribute_missing_value.jsx:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a JSX attribute value but instead found '>'. + + 1 │ function f() { + > 2 │ return
; + │ ^ + 3 │ } + 4 │ + + i Expected a JSX attribute value here. + + 1 │ function f() { + > 2 │ return
; + │ ^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap new file mode 100644 index 000000000000..737c0bad5bad --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap @@ -0,0 +1,127 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
<>test + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..4 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@4..5 ">" [] [], + }, + children: JsxChildList [ + JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@5..6 "<" [] [], + r_angle_token: R_ANGLE@6..7 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@7..11 "test" [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@11..12 "<" [] [], + slash_token: SLASH@12..14 "/" [] [Whitespace(" ")], + r_angle_token: missing (required), + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@14..28 "5 more content" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@28..29 "<" [] [], + slash_token: SLASH@29..30 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@30..33 "div" [] [], + }, + r_angle_token: R_ANGLE@33..34 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_EXPRESSION_STATEMENT@0..34 + 0: JSX_TAG_EXPRESSION@0..34 + 0: JSX_ELEMENT@0..34 + 0: JSX_OPENING_ELEMENT@0..5 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..4 + 0: JSX_IDENT@1..4 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@4..4 + 4: R_ANGLE@4..5 ">" [] [] + 1: JSX_CHILD_LIST@5..28 + 0: JSX_FRAGMENT@5..14 + 0: JSX_OPENING_FRAGMENT@5..7 + 0: L_ANGLE@5..6 "<" [] [] + 1: R_ANGLE@6..7 ">" [] [] + 1: JSX_CHILD_LIST@7..11 + 0: JSX_TEXT@7..11 + 0: JSX_TEXT_LITERAL@7..11 "test" [] [] + 2: JSX_CLOSING_FRAGMENT@11..14 + 0: L_ANGLE@11..12 "<" [] [] + 1: SLASH@12..14 "/" [] [Whitespace(" ")] + 2: (empty) + 1: JSX_TEXT@14..28 + 0: JSX_TEXT_LITERAL@14..28 "5 more content" [] [] + 2: JSX_CLOSING_ELEMENT@28..34 + 0: L_ANGLE@28..29 "<" [] [] + 1: SLASH@29..30 "/" [] [] + 2: JSX_NAME@30..33 + 0: JSX_IDENT@30..33 "div" [] [] + 3: R_ANGLE@33..34 ">" [] [] + 1: (empty) + 4: EOF@34..35 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_fragment_closing_missing_r_angle.jsx:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `5` + + > 1 │
<>test + │ ^ + 2 │ + + i Remove 5 + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx.snap new file mode 100644 index 000000000000..c7f95a6f2fe3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx.snap @@ -0,0 +1,158 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + test >; + invalid }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..2 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@2..3 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@3..10 " test >" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@10..11 "<" [] [], + slash_token: SLASH@11..12 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@12..13 "a" [] [], + }, + r_angle_token: R_ANGLE@13..14 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@15..17 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@17..18 "b" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@18..19 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@19..29 " invalid }" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@29..30 "<" [] [], + slash_token: SLASH@30..31 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@31..32 "b" [] [], + }, + r_angle_token: R_ANGLE@32..33 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JSX_TAG_EXPRESSION@0..14 + 0: JSX_ELEMENT@0..14 + 0: JSX_OPENING_ELEMENT@0..3 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..2 + 0: JSX_IDENT@1..2 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@2..2 + 4: R_ANGLE@2..3 ">" [] [] + 1: JSX_CHILD_LIST@3..10 + 0: JSX_TEXT@3..10 + 0: JSX_TEXT_LITERAL@3..10 " test >" [] [] + 2: JSX_CLOSING_ELEMENT@10..14 + 0: L_ANGLE@10..11 "<" [] [] + 1: SLASH@11..12 "/" [] [] + 2: JSX_NAME@12..13 + 0: JSX_IDENT@12..13 "a" [] [] + 3: R_ANGLE@13..14 ">" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@15..34 + 0: JSX_TAG_EXPRESSION@15..33 + 0: JSX_ELEMENT@15..33 + 0: JSX_OPENING_ELEMENT@15..19 + 0: L_ANGLE@15..17 "<" [Newline("\n")] [] + 1: JSX_NAME@17..18 + 0: JSX_IDENT@17..18 "b" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@18..18 + 4: R_ANGLE@18..19 ">" [] [] + 1: JSX_CHILD_LIST@19..29 + 0: JSX_TEXT@19..29 + 0: JSX_TEXT_LITERAL@19..29 " invalid }" [] [] + 2: JSX_CLOSING_ELEMENT@29..33 + 0: L_ANGLE@29..30 "<" [] [] + 1: SLASH@30..31 "/" [] [] + 2: JSX_NAME@31..32 + 0: JSX_IDENT@31..32 "b" [] [] + 3: R_ANGLE@32..33 ">" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_invalid_text.jsx:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected token. Did you mean `{'>'}` or `>`? + + > 1 │ test >; + │ ^ + 2 │ invalid }; + 3 │ + +jsx_invalid_text.jsx:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected token. Did you mean `{'}'}` or `}`? + + 1 │ test >; + > 2 │ invalid }; + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap new file mode 100644 index 000000000000..b74fccc9a882 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap @@ -0,0 +1,208 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>test; +<>test some text; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + JsxOpeningFragment { + l_angle_token: L_ANGLE@0..1 "<" [] [], + r_angle_token: R_ANGLE@1..2 ">" [] [], + }, + JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@2..6 "test" [] [], + }, + ], + JsBogus { + items: [ + L_ANGLE@6..7 "<" [] [], + SLASH@7..8 "/" [] [], + JsxName { + value_token: JSX_IDENT@8..12 "test" [] [], + }, + R_ANGLE@12..13 ">" [] [], + ], + }, + ], + }, + ], + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@14..16 "<" [Newline("\n")] [], + r_angle_token: R_ANGLE@16..17 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@17..21 "test" [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@21..22 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@22..27 "inner" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@27..28 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@28..38 " some text" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@38..39 "<" [] [], + slash_token: SLASH@39..40 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@40..45 "inner" [] [], + }, + r_angle_token: R_ANGLE@45..46 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@46..48 ";\n" [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: missing (required), + slash_token: missing (required), + r_angle_token: missing (required), + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@48..48 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..48 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_BOGUS_EXPRESSION@0..13 + 0: JS_BOGUS@0..13 + 0: JSX_OPENING_FRAGMENT@0..2 + 0: L_ANGLE@0..1 "<" [] [] + 1: R_ANGLE@1..2 ">" [] [] + 1: JSX_CHILD_LIST@2..6 + 0: JSX_TEXT@2..6 + 0: JSX_TEXT_LITERAL@2..6 "test" [] [] + 2: JS_BOGUS@6..13 + 0: L_ANGLE@6..7 "<" [] [] + 1: SLASH@7..8 "/" [] [] + 2: JSX_NAME@8..12 + 0: JSX_IDENT@8..12 "test" [] [] + 3: R_ANGLE@12..13 ">" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..48 + 0: JSX_TAG_EXPRESSION@14..48 + 0: JSX_FRAGMENT@14..48 + 0: JSX_OPENING_FRAGMENT@14..17 + 0: L_ANGLE@14..16 "<" [Newline("\n")] [] + 1: R_ANGLE@16..17 ">" [] [] + 1: JSX_CHILD_LIST@17..48 + 0: JSX_TEXT@17..21 + 0: JSX_TEXT_LITERAL@17..21 "test" [] [] + 1: JSX_ELEMENT@21..46 + 0: JSX_OPENING_ELEMENT@21..28 + 0: L_ANGLE@21..22 "<" [] [] + 1: JSX_NAME@22..27 + 0: JSX_IDENT@22..27 "inner" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@27..27 + 4: R_ANGLE@27..28 ">" [] [] + 1: JSX_CHILD_LIST@28..38 + 0: JSX_TEXT@28..38 + 0: JSX_TEXT_LITERAL@28..38 " some text" [] [] + 2: JSX_CLOSING_ELEMENT@38..46 + 0: L_ANGLE@38..39 "<" [] [] + 1: SLASH@39..40 "/" [] [] + 2: JSX_NAME@40..45 + 0: JSX_IDENT@40..45 "inner" [] [] + 3: R_ANGLE@45..46 ">" [] [] + 2: JSX_TEXT@46..48 + 0: JSX_TEXT_LITERAL@46..48 ";\n" [] [] + 2: JSX_CLOSING_FRAGMENT@48..48 + 0: (empty) + 1: (empty) + 2: (empty) + 1: (empty) + 4: EOF@48..48 "" [] [] + +``` + +## Diagnostics + +``` +jsx_missing_closing_fragment.jsx:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × JSX fragment has no corresponding closing tag. + + > 1 │ <>test; + │ ^^ + 2 │ <>test some text; + 3 │ + + i Opening fragment + + > 1 │ <>test; + │ ^^ + 2 │ <>test some text; + 3 │ + + i Closing tag + + > 1 │ <>test; + │ ^^^^ + 2 │ <>test some text; + 3 │ + +jsx_missing_closing_fragment.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `<` but instead the file ends + + 1 │ <>test; + 2 │ <>test some text; + > 3 │ + │ + + i the file ends here + + 1 │ <>test; + 2 │ <>test some text; + > 3 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap new file mode 100644 index 000000000000..2969ba4738c8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap @@ -0,0 +1,220 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@1..10 "namespace" [] [], + }, + colon_token: COLON@10..11 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@11..12 "a" [] [], + }, + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@12..13 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@13..14 "<" [] [], + slash_token: SLASH@14..15 "/" [] [], + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@15..24 "namespace" [] [], + }, + colon_token: COLON@24..25 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@25..26 "a" [] [], + }, + }, + r_angle_token: R_ANGLE@26..27 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_ANGLE@28..30 "<" [Newline("\n")] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsxName { + value_token: JSX_IDENT@30..39 "namespace" [] [], + }, + COLON@39..40 ":" [] [], + JsxName { + value_token: JSX_IDENT@40..41 "a" [] [], + }, + ], + }, + DOT@41..42 "." [] [], + JsName { + value_token: IDENT@42..43 "b" [] [], + }, + ], + }, + JsxAttributeList [], + R_ANGLE@43..44 ">" [] [], + ], + }, + JsxChildList [], + JsBogus { + items: [ + L_ANGLE@44..45 "<" [] [], + SLASH@45..46 "/" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsxName { + value_token: JSX_IDENT@46..55 "namespace" [] [], + }, + COLON@55..56 ":" [] [], + JsxName { + value_token: JSX_IDENT@56..57 "a" [] [], + }, + ], + }, + DOT@57..58 "." [] [], + JsName { + value_token: IDENT@58..59 "b" [] [], + }, + ], + }, + R_ANGLE@59..60 ">" [] [], + ], + }, + ], + }, + ], + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + ], + eof_token: EOF@61..62 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..62 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..61 + 0: JS_EXPRESSION_STATEMENT@0..28 + 0: JSX_TAG_EXPRESSION@0..27 + 0: JSX_ELEMENT@0..27 + 0: JSX_OPENING_ELEMENT@0..13 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAMESPACE_NAME@1..12 + 0: JSX_NAME@1..10 + 0: JSX_IDENT@1..10 "namespace" [] [] + 1: COLON@10..11 ":" [] [] + 2: JSX_NAME@11..12 + 0: JSX_IDENT@11..12 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@12..12 + 4: R_ANGLE@12..13 ">" [] [] + 1: JSX_CHILD_LIST@13..13 + 2: JSX_CLOSING_ELEMENT@13..27 + 0: L_ANGLE@13..14 "<" [] [] + 1: SLASH@14..15 "/" [] [] + 2: JSX_NAMESPACE_NAME@15..26 + 0: JSX_NAME@15..24 + 0: JSX_IDENT@15..24 "namespace" [] [] + 1: COLON@24..25 ":" [] [] + 2: JSX_NAME@25..26 + 0: JSX_IDENT@25..26 "a" [] [] + 3: R_ANGLE@26..27 ">" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@28..61 + 0: JS_BOGUS_EXPRESSION@28..60 + 0: JS_BOGUS@28..60 + 0: JS_BOGUS@28..44 + 0: L_ANGLE@28..30 "<" [Newline("\n")] [] + 1: JS_BOGUS@30..43 + 0: JS_BOGUS@30..41 + 0: JSX_NAME@30..39 + 0: JSX_IDENT@30..39 "namespace" [] [] + 1: COLON@39..40 ":" [] [] + 2: JSX_NAME@40..41 + 0: JSX_IDENT@40..41 "a" [] [] + 1: DOT@41..42 "." [] [] + 2: JS_NAME@42..43 + 0: IDENT@42..43 "b" [] [] + 2: JSX_ATTRIBUTE_LIST@43..43 + 3: R_ANGLE@43..44 ">" [] [] + 1: JSX_CHILD_LIST@44..44 + 2: JS_BOGUS@44..60 + 0: L_ANGLE@44..45 "<" [] [] + 1: SLASH@45..46 "/" [] [] + 2: JS_BOGUS@46..59 + 0: JS_BOGUS@46..57 + 0: JSX_NAME@46..55 + 0: JSX_IDENT@46..55 "namespace" [] [] + 1: COLON@55..56 ":" [] [] + 2: JSX_NAME@56..57 + 0: JSX_IDENT@56..57 "a" [] [] + 1: DOT@57..58 "." [] [] + 2: JS_NAME@58..59 + 0: IDENT@58..59 "b" [] [] + 3: R_ANGLE@59..60 ">" [] [] + 1: SEMICOLON@60..61 ";" [] [] + 4: EOF@61..62 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_namespace_member_element_name.jsx:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × JSX property access expressions cannot include JSX namespace names. + + 1 │ ; + > 2 │ ; + │ ^^^^^^^^^^^ + 3 │ + +jsx_namespace_member_element_name.jsx:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × JSX property access expressions cannot include JSX namespace names. + + 1 │ ; + > 2 │ ; + │ ^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap new file mode 100644 index 000000000000..a350aac5546f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap @@ -0,0 +1,158 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<> some content + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@0..1 "<" [] [], + r_angle_token: R_ANGLE@1..2 ">" [] [], + }, + children: JsxChildList [ + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@2..3 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@3..8 "test" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: missing (required), + }, + children: JsxChildList [ + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@8..9 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@9..14 "inner" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@14..15 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@15..28 " some content" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@28..29 "<" [] [], + slash_token: SLASH@29..30 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@30..35 "inner" [] [], + }, + r_angle_token: R_ANGLE@35..36 ">" [] [], + }, + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@36..37 "<" [] [], + slash_token: SLASH@37..38 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@38..42 "test" [] [], + }, + r_angle_token: R_ANGLE@42..43 ">" [] [], + }, + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@43..44 "<" [] [], + slash_token: SLASH@44..45 "/" [] [], + r_angle_token: R_ANGLE@45..46 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@46..47 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..47 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..46 + 0: JS_EXPRESSION_STATEMENT@0..46 + 0: JSX_TAG_EXPRESSION@0..46 + 0: JSX_FRAGMENT@0..46 + 0: JSX_OPENING_FRAGMENT@0..2 + 0: L_ANGLE@0..1 "<" [] [] + 1: R_ANGLE@1..2 ">" [] [] + 1: JSX_CHILD_LIST@2..43 + 0: JSX_ELEMENT@2..43 + 0: JSX_OPENING_ELEMENT@2..8 + 0: L_ANGLE@2..3 "<" [] [] + 1: JSX_NAME@3..8 + 0: JSX_IDENT@3..8 "test" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@8..8 + 4: (empty) + 1: JSX_CHILD_LIST@8..36 + 0: JSX_ELEMENT@8..36 + 0: JSX_OPENING_ELEMENT@8..15 + 0: L_ANGLE@8..9 "<" [] [] + 1: JSX_NAME@9..14 + 0: JSX_IDENT@9..14 "inner" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@14..14 + 4: R_ANGLE@14..15 ">" [] [] + 1: JSX_CHILD_LIST@15..28 + 0: JSX_TEXT@15..28 + 0: JSX_TEXT_LITERAL@15..28 " some content" [] [] + 2: JSX_CLOSING_ELEMENT@28..36 + 0: L_ANGLE@28..29 "<" [] [] + 1: SLASH@29..30 "/" [] [] + 2: JSX_NAME@30..35 + 0: JSX_IDENT@30..35 "inner" [] [] + 3: R_ANGLE@35..36 ">" [] [] + 2: JSX_CLOSING_ELEMENT@36..43 + 0: L_ANGLE@36..37 "<" [] [] + 1: SLASH@37..38 "/" [] [] + 2: JSX_NAME@38..42 + 0: JSX_IDENT@38..42 "test" [] [] + 3: R_ANGLE@42..43 ">" [] [] + 2: JSX_CLOSING_FRAGMENT@43..46 + 0: L_ANGLE@43..44 "<" [] [] + 1: SLASH@44..45 "/" [] [] + 2: R_ANGLE@45..46 ">" [] [] + 1: (empty) + 4: EOF@46..47 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_opening_element_missing_r_angle.jsx:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `<` + + > 1 │ <> some content + │ ^ + 2 │ + + i Remove < + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.js b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.js rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap new file mode 100644 index 000000000000..31afe6a59f5f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap @@ -0,0 +1,491 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function f() { + let a =
a
; // JSX + let b = b; // type assertion + let c = bd; // type assertion + let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + let d = a/; +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..20 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..35 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@35..37 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBogusExpression { + items: [ + L_ANGLE@37..38 "<" [] [], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@38..41 "div" [] [], + }, + type_arguments: missing (optional), + }, + R_ANGLE@41..42 ">" [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..43 "a" [] [], + }, + }, + ], + }, + operator_token: L_ANGLE@43..44 "<" [] [], + right: JsBinaryExpression { + left: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@44..52 "/div>; /" [] [], + }, + operator_token: SLASH@52..54 "/" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@54..57 "JSX" [] [], + }, + }, + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@66..68 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@68..70 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + L_ANGLE@70..71 "<" [] [], + TsStringType { + string_token: STRING_KW@71..77 "string" [] [], + }, + R_ANGLE@77..78 ">" [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..79 "b" [] [], + }, + }, + ], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@79..98 ";" [] [Whitespace(" "), Comments("// type assertion")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@98..107 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@107..109 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@109..111 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsBogusExpression { + items: [ + L_ANGLE@111..112 "<" [] [], + TsStringType { + string_token: STRING_KW@112..118 "string" [] [], + }, + R_ANGLE@118..119 ">" [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@119..120 "b" [] [], + }, + }, + ], + }, + operator_token: L_ANGLE@120..121 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@121..122 "a" [] [], + }, + }, + }, + operator_token: R_ANGLE@122..123 ">" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@123..124 "d" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@124..143 ";" [] [Whitespace(" "), Comments("// type assertion")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@143..152 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@152..154 "d" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@154..156 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBogusExpression { + items: [ + L_ANGLE@156..157 "<" [] [], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@157..160 "div" [] [], + }, + type_arguments: missing (optional), + }, + R_ANGLE@160..161 ">" [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@161..162 "a" [] [], + }, + }, + ], + }, + operator_token: L_ANGLE@162..163 "<" [] [], + right: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@163..169 "/div>/" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@169..248 ";" [] [Whitespace(" "), Comments("// ambiguous: JSX or ...")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@248..257 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@257..259 "d" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@259..261 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBogusExpression { + items: [ + L_ANGLE@261..262 "<" [] [], + TsStringType { + string_token: STRING_KW@262..268 "string" [] [], + }, + R_ANGLE@268..269 ">" [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@269..270 "a" [] [], + }, + }, + ], + }, + operator_token: L_ANGLE@270..271 "<" [] [], + right: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@271..280 "/string>/" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@280..281 ";" [] [], + }, + ], + r_curly_token: R_CURLY@281..283 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@283..284 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..284 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..283 + 0: JS_FUNCTION_DECLARATION@0..283 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@23..283 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..281 + 0: JS_VARIABLE_STATEMENT@24..57 + 0: JS_VARIABLE_DECLARATION@24..57 + 0: (empty) + 1: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@33..57 + 0: JS_VARIABLE_DECLARATOR@33..57 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@35..57 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@37..57 + 0: JS_BOGUS_EXPRESSION@37..43 + 0: L_ANGLE@37..38 "<" [] [] + 1: TS_REFERENCE_TYPE@38..41 + 0: JS_REFERENCE_IDENTIFIER@38..41 + 0: IDENT@38..41 "div" [] [] + 1: (empty) + 2: R_ANGLE@41..42 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@42..43 + 0: JS_REFERENCE_IDENTIFIER@42..43 + 0: IDENT@42..43 "a" [] [] + 1: L_ANGLE@43..44 "<" [] [] + 2: JS_BINARY_EXPRESSION@44..57 + 0: JS_REGEX_LITERAL_EXPRESSION@44..52 + 0: JS_REGEX_LITERAL@44..52 "/div>; /" [] [] + 1: SLASH@52..54 "/" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@54..57 + 0: JS_REFERENCE_IDENTIFIER@54..57 + 0: IDENT@54..57 "JSX" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@57..98 + 0: JS_VARIABLE_DECLARATION@57..79 + 0: (empty) + 1: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@66..79 + 0: JS_VARIABLE_DECLARATOR@66..79 + 0: JS_IDENTIFIER_BINDING@66..68 + 0: IDENT@66..68 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@68..79 + 0: EQ@68..70 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@70..79 + 0: L_ANGLE@70..71 "<" [] [] + 1: TS_STRING_TYPE@71..77 + 0: STRING_KW@71..77 "string" [] [] + 2: R_ANGLE@77..78 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@78..79 + 0: JS_REFERENCE_IDENTIFIER@78..79 + 0: IDENT@78..79 "b" [] [] + 1: SEMICOLON@79..98 ";" [] [Whitespace(" "), Comments("// type assertion")] + 2: JS_VARIABLE_STATEMENT@98..143 + 0: JS_VARIABLE_DECLARATION@98..124 + 0: (empty) + 1: LET_KW@98..107 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@107..124 + 0: JS_VARIABLE_DECLARATOR@107..124 + 0: JS_IDENTIFIER_BINDING@107..109 + 0: IDENT@107..109 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@109..124 + 0: EQ@109..111 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@111..124 + 0: JS_BINARY_EXPRESSION@111..122 + 0: JS_BOGUS_EXPRESSION@111..120 + 0: L_ANGLE@111..112 "<" [] [] + 1: TS_STRING_TYPE@112..118 + 0: STRING_KW@112..118 "string" [] [] + 2: R_ANGLE@118..119 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@119..120 + 0: JS_REFERENCE_IDENTIFIER@119..120 + 0: IDENT@119..120 "b" [] [] + 1: L_ANGLE@120..121 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@121..122 + 0: JS_REFERENCE_IDENTIFIER@121..122 + 0: IDENT@121..122 "a" [] [] + 1: R_ANGLE@122..123 ">" [] [] + 2: JS_IDENTIFIER_EXPRESSION@123..124 + 0: JS_REFERENCE_IDENTIFIER@123..124 + 0: IDENT@123..124 "d" [] [] + 1: SEMICOLON@124..143 ";" [] [Whitespace(" "), Comments("// type assertion")] + 3: JS_VARIABLE_STATEMENT@143..248 + 0: JS_VARIABLE_DECLARATION@143..169 + 0: (empty) + 1: LET_KW@143..152 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@152..169 + 0: JS_VARIABLE_DECLARATOR@152..169 + 0: JS_IDENTIFIER_BINDING@152..154 + 0: IDENT@152..154 "d" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@154..169 + 0: EQ@154..156 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@156..169 + 0: JS_BOGUS_EXPRESSION@156..162 + 0: L_ANGLE@156..157 "<" [] [] + 1: TS_REFERENCE_TYPE@157..160 + 0: JS_REFERENCE_IDENTIFIER@157..160 + 0: IDENT@157..160 "div" [] [] + 1: (empty) + 2: R_ANGLE@160..161 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@161..162 + 0: JS_REFERENCE_IDENTIFIER@161..162 + 0: IDENT@161..162 "a" [] [] + 1: L_ANGLE@162..163 "<" [] [] + 2: JS_REGEX_LITERAL_EXPRESSION@163..169 + 0: JS_REGEX_LITERAL@163..169 "/div>/" [] [] + 1: SEMICOLON@169..248 ";" [] [Whitespace(" "), Comments("// ambiguous: JSX or ...")] + 4: JS_VARIABLE_STATEMENT@248..281 + 0: JS_VARIABLE_DECLARATION@248..280 + 0: (empty) + 1: LET_KW@248..257 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@257..280 + 0: JS_VARIABLE_DECLARATOR@257..280 + 0: JS_IDENTIFIER_BINDING@257..259 + 0: IDENT@257..259 "d" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@259..280 + 0: EQ@259..261 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@261..280 + 0: JS_BOGUS_EXPRESSION@261..270 + 0: L_ANGLE@261..262 "<" [] [] + 1: TS_STRING_TYPE@262..268 + 0: STRING_KW@262..268 "string" [] [] + 2: R_ANGLE@268..269 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@269..270 + 0: JS_REFERENCE_IDENTIFIER@269..270 + 0: IDENT@269..270 "a" [] [] + 1: L_ANGLE@270..271 "<" [] [] + 2: JS_REGEX_LITERAL_EXPRESSION@271..280 + 0: JS_REGEX_LITERAL@271..280 "/string>/" [] [] + 1: SEMICOLON@280..281 ";" [] [] + 3: R_CURLY@281..283 "}" [Newline("\n")] [] + 4: EOF@283..284 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_or_type_assertion.cjs:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 1 │ // SCRIPT + 2 │ function f() { + > 3 │ let a =
a
; // JSX + │ ^^^^^^ + 4 │ let b = b; // type assertion + 5 │ let c = b
d; // type assertion + + i TypeScript only syntax + +jsx_or_type_assertion.cjs:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 2 │ function f() { + 3 │ let a =
a
; // JSX + > 4 │ let b = b; // type assertion + │ ^^^^^^^^^ + 5 │ let c = b
d; // type assertion + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + + i TypeScript only syntax + +jsx_or_type_assertion.cjs:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 3 │ let a =
a
; // JSX + 4 │ let b = b; // type assertion + > 5 │ let c = b
d; // type assertion + │ ^^^^^^^^^ + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + 7 │ let d = a/; + + i TypeScript only syntax + +jsx_or_type_assertion.cjs:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 4 │ let b = b; // type assertion + 5 │ let c = b
d; // type assertion + > 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + │ ^^^^^^ + 7 │ let d = a/; + 8 │ } + + i TypeScript only syntax + +jsx_or_type_assertion.cjs:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 5 │ let c = b
d; // type assertion + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + > 7 │ let d = a/; + │ ^^^^^^^^^ + 8 │ } + 9 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap new file mode 100644 index 000000000000..d49f3274c9d0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap @@ -0,0 +1,437 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +function f() { + let a =
a
; // JSX + let b = b; // type assertion + let c = b
d; // type assertion + let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + let d = a/; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..20 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..35 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@35..37 "=" [] [Whitespace(" ")], + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@37..38 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@38..41 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@41..42 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@42..43 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@43..44 "<" [] [], + slash_token: SLASH@44..45 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@45..48 "div" [] [], + }, + r_angle_token: R_ANGLE@48..49 ">" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@49..57 ";" [] [Whitespace(" "), Comments("// JSX")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@66..68 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@68..70 "=" [] [Whitespace(" ")], + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@70..71 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@71..77 "string" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@77..78 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@78..111 "b; // type assertion\n let c = " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@111..112 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@112..118 "string" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@118..119 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@119..120 "b" [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@120..121 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@121..122 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@122..123 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@123..156 "d; // type assertion\n let d = " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@156..157 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@157..160 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@160..161 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@161..162 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@162..163 "<" [] [], + slash_token: SLASH@163..164 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@164..167 "div" [] [], + }, + r_angle_token: R_ANGLE@167..168 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@168..261 "/; // ambiguous: JSX or \"type assertion a less than regex /div>/\". Probably JSX.\n let d = " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@261..262 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@262..268 "string" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@268..269 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@269..270 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@270..271 "<" [] [], + slash_token: SLASH@271..272 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@272..278 "string" [] [], + }, + r_angle_token: R_ANGLE@278..279 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@279..284 "/;\n}\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: missing (required), + slash_token: missing (required), + name: missing (required), + r_angle_token: missing (required), + }, + }, + ], + closing_element: JsxClosingElement { + l_angle_token: missing (required), + slash_token: missing (required), + name: missing (required), + r_angle_token: missing (required), + }, + }, + ], + closing_element: JsxClosingElement { + l_angle_token: missing (required), + slash_token: missing (required), + name: missing (required), + r_angle_token: missing (required), + }, + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: missing (required), + }, + }, + ], + eof_token: EOF@284..284 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..284 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..284 + 0: JS_FUNCTION_DECLARATION@0..284 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@23..284 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..284 + 0: JS_VARIABLE_STATEMENT@24..57 + 0: JS_VARIABLE_DECLARATION@24..49 + 0: (empty) + 1: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@33..49 + 0: JS_VARIABLE_DECLARATOR@33..49 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@35..49 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@37..49 + 0: JSX_ELEMENT@37..49 + 0: JSX_OPENING_ELEMENT@37..42 + 0: L_ANGLE@37..38 "<" [] [] + 1: JSX_NAME@38..41 + 0: JSX_IDENT@38..41 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@41..41 + 4: R_ANGLE@41..42 ">" [] [] + 1: JSX_CHILD_LIST@42..43 + 0: JSX_TEXT@42..43 + 0: JSX_TEXT_LITERAL@42..43 "a" [] [] + 2: JSX_CLOSING_ELEMENT@43..49 + 0: L_ANGLE@43..44 "<" [] [] + 1: SLASH@44..45 "/" [] [] + 2: JSX_NAME@45..48 + 0: JSX_IDENT@45..48 "div" [] [] + 3: R_ANGLE@48..49 ">" [] [] + 1: SEMICOLON@49..57 ";" [] [Whitespace(" "), Comments("// JSX")] + 1: JS_VARIABLE_STATEMENT@57..284 + 0: JS_VARIABLE_DECLARATION@57..284 + 0: (empty) + 1: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@66..284 + 0: JS_VARIABLE_DECLARATOR@66..284 + 0: JS_IDENTIFIER_BINDING@66..68 + 0: IDENT@66..68 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@68..284 + 0: EQ@68..70 "=" [] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@70..284 + 0: JSX_ELEMENT@70..284 + 0: JSX_OPENING_ELEMENT@70..78 + 0: L_ANGLE@70..71 "<" [] [] + 1: JSX_NAME@71..77 + 0: JSX_IDENT@71..77 "string" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@77..77 + 4: R_ANGLE@77..78 ">" [] [] + 1: JSX_CHILD_LIST@78..284 + 0: JSX_TEXT@78..111 + 0: JSX_TEXT_LITERAL@78..111 "b; // type assertion\n let c = " [] [] + 1: JSX_ELEMENT@111..284 + 0: JSX_OPENING_ELEMENT@111..119 + 0: L_ANGLE@111..112 "<" [] [] + 1: JSX_NAME@112..118 + 0: JSX_IDENT@112..118 "string" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@118..118 + 4: R_ANGLE@118..119 ">" [] [] + 1: JSX_CHILD_LIST@119..284 + 0: JSX_TEXT@119..120 + 0: JSX_TEXT_LITERAL@119..120 "b" [] [] + 1: JSX_ELEMENT@120..284 + 0: JSX_OPENING_ELEMENT@120..123 + 0: L_ANGLE@120..121 "<" [] [] + 1: JSX_NAME@121..122 + 0: JSX_IDENT@121..122 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@122..122 + 4: R_ANGLE@122..123 ">" [] [] + 1: JSX_CHILD_LIST@123..284 + 0: JSX_TEXT@123..156 + 0: JSX_TEXT_LITERAL@123..156 "d; // type assertion\n let d = " [] [] + 1: JSX_ELEMENT@156..168 + 0: JSX_OPENING_ELEMENT@156..161 + 0: L_ANGLE@156..157 "<" [] [] + 1: JSX_NAME@157..160 + 0: JSX_IDENT@157..160 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@160..160 + 4: R_ANGLE@160..161 ">" [] [] + 1: JSX_CHILD_LIST@161..162 + 0: JSX_TEXT@161..162 + 0: JSX_TEXT_LITERAL@161..162 "a" [] [] + 2: JSX_CLOSING_ELEMENT@162..168 + 0: L_ANGLE@162..163 "<" [] [] + 1: SLASH@163..164 "/" [] [] + 2: JSX_NAME@164..167 + 0: JSX_IDENT@164..167 "div" [] [] + 3: R_ANGLE@167..168 ">" [] [] + 2: JSX_TEXT@168..261 + 0: JSX_TEXT_LITERAL@168..261 "/; // ambiguous: JSX or \"type assertion a less than regex /div>/\". Probably JSX.\n let d = " [] [] + 3: JSX_ELEMENT@261..279 + 0: JSX_OPENING_ELEMENT@261..269 + 0: L_ANGLE@261..262 "<" [] [] + 1: JSX_NAME@262..268 + 0: JSX_IDENT@262..268 "string" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@268..268 + 4: R_ANGLE@268..269 ">" [] [] + 1: JSX_CHILD_LIST@269..270 + 0: JSX_TEXT@269..270 + 0: JSX_TEXT_LITERAL@269..270 "a" [] [] + 2: JSX_CLOSING_ELEMENT@270..279 + 0: L_ANGLE@270..271 "<" [] [] + 1: SLASH@271..272 "/" [] [] + 2: JSX_NAME@272..278 + 0: JSX_IDENT@272..278 "string" [] [] + 3: R_ANGLE@278..279 ">" [] [] + 4: JSX_TEXT@279..284 + 0: JSX_TEXT_LITERAL@279..284 "/;\n}\n" [] [] + 2: JSX_CLOSING_ELEMENT@284..284 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 2: JSX_CLOSING_ELEMENT@284..284 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 2: JSX_CLOSING_ELEMENT@284..284 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 1: (empty) + 3: (empty) + 4: EOF@284..284 "" [] [] + +``` + +## Diagnostics + +``` +jsx_or_type_assertion.js:6:87 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected token. Did you mean `{'>'}` or `>`? + + 4 │ let b = b; // type assertion + 5 │ let c = b
d; // type assertion + > 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + │ ^ + 7 │ let d = a/; + 8 │ } + +jsx_or_type_assertion.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected token. Did you mean `{'}'}` or `}`? + + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + 7 │ let d = a/; + > 8 │ } + │ ^ + 9 │ + +jsx_or_type_assertion.js:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `<` but instead the file ends + + 7 │ let d = a/; + 8 │ } + > 9 │ + │ + + i the file ends here + + 7 │ let d = a/; + 8 │ } + > 9 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap new file mode 100644 index 000000000000..a0655b8d4a45 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap @@ -0,0 +1,122 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@0..1 "<" [] [], + r_angle_token: R_ANGLE@1..2 ">" [] [], + }, + children: JsxChildList [ + JsxSelfClosingElement { + l_angle_token: L_ANGLE@2..3 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@3..8 "test" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@8..10 "/" [] [Whitespace(" ")], + r_angle_token: missing (required), + }, + JsxText { + value_token: JSX_TEXT_LITERAL@10..31 "some test followed by" [] [], + }, + JsxSelfClosingElement { + l_angle_token: L_ANGLE@31..32 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@32..34 "a" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@34..35 "/" [] [], + r_angle_token: R_ANGLE@35..36 ">" [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@36..37 "<" [] [], + slash_token: SLASH@37..38 "/" [] [], + r_angle_token: R_ANGLE@38..39 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@39..40 ";" [] [], + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: JS_EXPRESSION_STATEMENT@0..40 + 0: JSX_TAG_EXPRESSION@0..39 + 0: JSX_FRAGMENT@0..39 + 0: JSX_OPENING_FRAGMENT@0..2 + 0: L_ANGLE@0..1 "<" [] [] + 1: R_ANGLE@1..2 ">" [] [] + 1: JSX_CHILD_LIST@2..36 + 0: JSX_SELF_CLOSING_ELEMENT@2..10 + 0: L_ANGLE@2..3 "<" [] [] + 1: JSX_NAME@3..8 + 0: JSX_IDENT@3..8 "test" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@8..8 + 4: SLASH@8..10 "/" [] [Whitespace(" ")] + 5: (empty) + 1: JSX_TEXT@10..31 + 0: JSX_TEXT_LITERAL@10..31 "some test followed by" [] [] + 2: JSX_SELF_CLOSING_ELEMENT@31..36 + 0: L_ANGLE@31..32 "<" [] [] + 1: JSX_NAME@32..34 + 0: JSX_IDENT@32..34 "a" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@34..34 + 4: SLASH@34..35 "/" [] [] + 5: R_ANGLE@35..36 ">" [] [] + 2: JSX_CLOSING_FRAGMENT@36..39 + 0: L_ANGLE@36..37 "<" [] [] + 1: SLASH@37..38 "/" [] [] + 2: R_ANGLE@38..39 ">" [] [] + 1: SEMICOLON@39..40 ";" [] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_self_closing_element_missing_r_angle.jsx:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `some` + + > 1 │ <>; + │ ^^^^ + 2 │ + + i Remove some + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap new file mode 100644 index 000000000000..289ce0090b20 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap @@ -0,0 +1,347 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let obj = {}; +
; +; +; +
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..8 "obj" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@11..12 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@13..15 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@15..17 "a" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxSpreadAttribute { + l_curly_token: L_CURLY@17..18 "{" [] [], + dotdotdot_token: DOT3@18..21 "..." [] [], + argument: JsBogusExpression { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..24 "obj" [] [], + }, + }, + COMMA@24..26 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..31 "other" [] [], + }, + }, + ], + }, + r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], + }, + ], + slash_token: SLASH@33..34 "/" [] [], + r_angle_token: R_ANGLE@34..35 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@35..36 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@36..38 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@38..40 "a" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxSpreadAttribute { + l_curly_token: missing (required), + dotdotdot_token: DOT3@40..43 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@43..46 "obj" [] [], + }, + }, + r_curly_token: R_CURLY@46..48 "}" [] [Whitespace(" ")], + }, + ], + slash_token: SLASH@48..49 "/" [] [], + r_angle_token: R_ANGLE@49..50 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@51..53 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@53..55 "a" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxSpreadAttribute { + l_curly_token: L_CURLY@55..56 "{" [] [], + dotdotdot_token: missing (required), + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@56..59 "obj" [] [], + }, + }, + r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], + }, + ], + slash_token: SLASH@61..62 "/" [] [], + r_angle_token: R_ANGLE@62..63 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@64..66 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@66..69 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxSpreadAttribute { + l_curly_token: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [], + dotdotdot_token: DOT3@77..80 "..." [] [], + argument: JsObjectExpression { + l_curly_token: L_CURLY@80..81 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")], + }, + r_curly_token: missing (required), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@148..149 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [], + }, + }, + }, + ], + slash_token: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [], + r_angle_token: R_ANGLE@167..168 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@168..169 ";" [] [], + }, + ], + eof_token: EOF@169..170 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..170 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..169 + 0: JS_VARIABLE_STATEMENT@0..13 + 0: JS_VARIABLE_DECLARATION@0..12 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..12 + 0: JS_VARIABLE_DECLARATOR@4..12 + 0: JS_IDENTIFIER_BINDING@4..8 + 0: IDENT@4..8 "obj" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..12 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@10..12 + 0: L_CURLY@10..11 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@11..11 + 2: R_CURLY@11..12 "}" [] [] + 1: SEMICOLON@12..13 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@13..36 + 0: JSX_TAG_EXPRESSION@13..35 + 0: JSX_SELF_CLOSING_ELEMENT@13..35 + 0: L_ANGLE@13..15 "<" [Newline("\n")] [] + 1: JSX_NAME@15..17 + 0: JSX_IDENT@15..17 "a" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@17..33 + 0: JSX_SPREAD_ATTRIBUTE@17..33 + 0: L_CURLY@17..18 "{" [] [] + 1: DOT3@18..21 "..." [] [] + 2: JS_BOGUS_EXPRESSION@21..31 + 0: JS_IDENTIFIER_EXPRESSION@21..24 + 0: JS_REFERENCE_IDENTIFIER@21..24 + 0: IDENT@21..24 "obj" [] [] + 1: COMMA@24..26 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@26..31 + 0: JS_REFERENCE_IDENTIFIER@26..31 + 0: IDENT@26..31 "other" [] [] + 3: R_CURLY@31..33 "}" [] [Whitespace(" ")] + 4: SLASH@33..34 "/" [] [] + 5: R_ANGLE@34..35 ">" [] [] + 1: SEMICOLON@35..36 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@36..51 + 0: JSX_TAG_EXPRESSION@36..50 + 0: JSX_SELF_CLOSING_ELEMENT@36..50 + 0: L_ANGLE@36..38 "<" [Newline("\n")] [] + 1: JSX_NAME@38..40 + 0: JSX_IDENT@38..40 "a" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@40..48 + 0: JSX_SPREAD_ATTRIBUTE@40..48 + 0: (empty) + 1: DOT3@40..43 "..." [] [] + 2: JS_IDENTIFIER_EXPRESSION@43..46 + 0: JS_REFERENCE_IDENTIFIER@43..46 + 0: IDENT@43..46 "obj" [] [] + 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] + 4: SLASH@48..49 "/" [] [] + 5: R_ANGLE@49..50 ">" [] [] + 1: SEMICOLON@50..51 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@51..64 + 0: JSX_TAG_EXPRESSION@51..63 + 0: JSX_SELF_CLOSING_ELEMENT@51..63 + 0: L_ANGLE@51..53 "<" [Newline("\n")] [] + 1: JSX_NAME@53..55 + 0: JSX_IDENT@53..55 "a" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@55..61 + 0: JSX_SPREAD_ATTRIBUTE@55..61 + 0: L_CURLY@55..56 "{" [] [] + 1: (empty) + 2: JS_IDENTIFIER_EXPRESSION@56..59 + 0: JS_REFERENCE_IDENTIFIER@56..59 + 0: IDENT@56..59 "obj" [] [] + 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] + 4: SLASH@61..62 "/" [] [] + 5: R_ANGLE@62..63 ">" [] [] + 1: SEMICOLON@63..64 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@64..169 + 0: JSX_TAG_EXPRESSION@64..168 + 0: JSX_SELF_CLOSING_ELEMENT@64..168 + 0: L_ANGLE@64..66 "<" [Newline("\n")] [] + 1: JSX_NAME@66..69 + 0: JSX_IDENT@66..69 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@69..161 + 0: JSX_SPREAD_ATTRIBUTE@69..130 + 0: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [] + 1: DOT3@77..80 "..." [] [] + 2: JS_OBJECT_EXPRESSION@80..130 + 0: L_CURLY@80..81 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@81..81 + 2: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")] + 3: (empty) + 1: JSX_ATTRIBUTE@130..161 + 0: JSX_NAME@130..148 + 0: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@148..161 + 0: EQ@148..149 "=" [] [] + 1: JSX_STRING@149..161 + 0: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [] + 4: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [] + 5: R_ANGLE@167..168 ">" [] [] + 1: SEMICOLON@168..169 ";" [] [] + 4: EOF@169..170 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_spread_attribute_error.jsx:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Comma operator isn't a valid value for a JSX spread argument. + + 1 │ let obj = {}; + > 2 │ ; + │ ^^^^^^^^^^ + 3 │ ; + 4 │ ; + +jsx_spread_attribute_error.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `...` + + 1 │ let obj = {}; + 2 │ ; + > 3 │ ; + │ ^^^ + 4 │ ; + 5 │
; + 3 │ ; + > 4 │ ; + │ ^^^ + 5 │
8 │ invalidProp="HelloWorld" + │ ^^^^^^^^^^^ + 9 │ />; + 10 │ + + i Remove invalidProp + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap new file mode 100644 index 000000000000..00558184b0a0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{...} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [ + JsxSpreadChild { + l_curly_token: L_CURLY@6..7 "{" [] [], + dotdotdot_token: DOT3@7..10 "..." [] [], + expression: missing (required), + r_curly_token: R_CURLY@10..11 "}" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@11..12 "<" [] [], + slash_token: SLASH@12..13 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@13..17 "test" [] [], + }, + r_angle_token: R_ANGLE@17..18 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@18..19 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..19 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..18 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JSX_TAG_EXPRESSION@0..18 + 0: JSX_ELEMENT@0..18 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..11 + 0: JSX_SPREAD_CHILD@6..11 + 0: L_CURLY@6..7 "{" [] [] + 1: DOT3@7..10 "..." [] [] + 2: (empty) + 3: R_CURLY@10..11 "}" [] [] + 2: JSX_CLOSING_ELEMENT@11..18 + 0: L_ANGLE@11..12 "<" [] [] + 1: SLASH@12..13 "/" [] [] + 2: JSX_NAME@13..17 + 0: JSX_IDENT@13..17 "test" [] [] + 3: R_ANGLE@17..18 ">" [] [] + 1: (empty) + 4: EOF@18..19 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +jsx_spread_no_expression.jsx:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '}'. + + > 1 │ {...} + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ {...} + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap new file mode 100644 index 000000000000..7b723b5ee82f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap @@ -0,0 +1,119 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) label1: label2: function a() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsLabeledStatement { + label: JsLabel { + value_token: IDENT@10..16 "label1" [] [], + }, + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + body: JsLabeledStatement { + label: JsLabel { + value_token: IDENT@18..24 "label2" [] [], + }, + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + FUNCTION_KW@26..35 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@35..36 "a" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@39..40 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + ], + }, + }, + }, + else_clause: missing (optional), + }, + ], + eof_token: EOF@41..42 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..42 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..41 + 0: JS_IF_STATEMENT@0..41 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_LABELED_STATEMENT@10..41 + 0: JS_LABEL@10..16 + 0: IDENT@10..16 "label1" [] [] + 1: COLON@16..18 ":" [] [Whitespace(" ")] + 2: JS_LABELED_STATEMENT@18..41 + 0: JS_LABEL@18..24 + 0: IDENT@18..24 "label2" [] [] + 1: COLON@24..26 ":" [] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@26..41 + 0: FUNCTION_KW@26..35 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@35..36 + 0: IDENT@35..36 "a" [] [] + 2: JS_PARAMETERS@36..39 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_PARAMETER_LIST@37..37 + 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@39..41 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..40 + 3: R_CURLY@40..41 "}" [] [] + 5: (empty) + 4: EOF@41..42 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +labelled_function_decl_in_single_statement_context.js:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In strict mode code, functions can only be declared at top level or inside a block + + > 1 │ if (true) label1: label2: function a() {} + │ ^^^^^^^^^^^^^^^ + 2 │ + + i wrap the function in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.js b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.js rename to crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap new file mode 100644 index 000000000000..fe8b08bcef4e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap @@ -0,0 +1,93 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +label1: function a() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..6 "label1" [] [], + }, + colon_token: COLON@6..8 ":" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + FUNCTION_KW@8..17 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@17..18 "a" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@18..19 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@21..22 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + ], + }, + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_LABELED_STATEMENT@0..23 + 0: JS_LABEL@0..6 + 0: IDENT@0..6 "label1" [] [] + 1: COLON@6..8 ":" [] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@8..23 + 0: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@17..18 + 0: IDENT@17..18 "a" [] [] + 2: JS_PARAMETERS@18..21 + 0: L_PAREN@18..19 "(" [] [] + 1: JS_PARAMETER_LIST@19..19 + 2: R_PAREN@19..21 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@21..23 + 0: L_CURLY@21..22 "{" [] [] + 1: JS_DIRECTIVE_LIST@22..22 + 2: JS_STATEMENT_LIST@22..22 + 3: R_CURLY@22..23 "}" [] [] + 4: EOF@23..24 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +labelled_function_declaration_strict_mode.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In strict mode code, functions can only be declared at top level or inside a block + + > 1 │ label1: function a() {} + │ ^^^^^^^^^^^^^^^ + 2 │ + + i wrap the function in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.js b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.js rename to crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap new file mode 100644 index 000000000000..5823820fac73 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +L: let +[a] = 0; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [], + }, + colon_token: COLON@11..13 ":" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@13..16 "let" [] [], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@16..18 "[" [Newline("\n")] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@18..19 "a" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@19..21 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..24 "0" [] [], + }, + }, + }, + ], + }, + SEMICOLON@24..25 ";" [] [], + ], + }, + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..25 + 0: JS_LABELED_STATEMENT@0..25 + 0: JS_LABEL@0..11 + 0: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [] + 1: COLON@11..13 ":" [] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@13..25 + 0: JS_VARIABLE_DECLARATION@13..24 + 0: (empty) + 1: LET_KW@13..16 "let" [] [] + 2: JS_VARIABLE_DECLARATOR_LIST@16..24 + 0: JS_VARIABLE_DECLARATOR@16..24 + 0: JS_ARRAY_BINDING_PATTERN@16..21 + 0: L_BRACK@16..18 "[" [Newline("\n")] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@18..19 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "a" [] [] + 1: (empty) + 2: R_BRACK@19..21 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..24 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..24 + 0: JS_NUMBER_LITERAL@23..24 "0" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +let_array_with_new_line.cjs:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Lexical declaration cannot appear in a single-statement context + + 1 │ // SCRIPT + > 2 │ L: let + │ ^^^ + > 3 │ [a] = 0; + │ ^^^^^^^^ + 4 │ + + i Wrap this declaration in a block statement + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.js.snap new file mode 100644 index 000000000000..8f9945647c60 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.js.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +L: let +[a] = 0; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [], + }, + colon_token: COLON@11..13 ":" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@13..16 "let" [] [], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@16..18 "[" [Newline("\n")] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@18..19 "a" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@19..21 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..24 "0" [] [], + }, + }, + }, + ], + }, + SEMICOLON@24..25 ";" [] [], + ], + }, + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..25 + 0: JS_LABELED_STATEMENT@0..25 + 0: JS_LABEL@0..11 + 0: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [] + 1: COLON@11..13 ":" [] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@13..25 + 0: JS_VARIABLE_DECLARATION@13..24 + 0: (empty) + 1: LET_KW@13..16 "let" [] [] + 2: JS_VARIABLE_DECLARATOR_LIST@16..24 + 0: JS_VARIABLE_DECLARATOR@16..24 + 0: JS_ARRAY_BINDING_PATTERN@16..21 + 0: L_BRACK@16..18 "[" [Newline("\n")] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@18..19 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "a" [] [] + 1: (empty) + 2: R_BRACK@19..21 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..24 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..24 + 0: JS_NUMBER_LITERAL@23..24 "0" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +let_array_with_new_line.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Lexical declaration cannot appear in a single-statement context + + 1 │ // SCRIPT + > 2 │ L: let + │ ^^^ + > 3 │ [a] = 0; + │ ^^^^^^^^ + 4 │ + + i Wrap this declaration in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.js b/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js.snap new file mode 100644 index 000000000000..090ac53175b1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js.snap @@ -0,0 +1,163 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async function f() { + let + await 0; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@15..16 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@16..17 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@19..20 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@20..26 "let" [Newline("\n"), Whitespace(" ")] [], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@26..35 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "0" [] [], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + ], + r_curly_token: R_CURLY@37..39 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_FUNCTION_DECLARATION@0..39 + 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@16..19 + 0: L_PAREN@16..17 "(" [] [] + 1: JS_PARAMETER_LIST@17..17 + 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@19..39 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_DIRECTIVE_LIST@20..20 + 2: JS_STATEMENT_LIST@20..37 + 0: JS_VARIABLE_STATEMENT@20..35 + 0: JS_VARIABLE_DECLARATION@20..35 + 0: (empty) + 1: LET_KW@20..26 "let" [Newline("\n"), Whitespace(" ")] [] + 2: JS_VARIABLE_DECLARATOR_LIST@26..35 + 0: JS_VARIABLE_DECLARATOR@26..35 + 0: JS_BOGUS_BINDING@26..35 + 0: IDENT@26..35 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@35..37 + 0: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "0" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 3: R_CURLY@37..39 "}" [Newline("\n")] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +let_newline_in_async_function.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 1 │ async function f() { + 2 │ let + > 3 │ await 0; + │ ^^^^^ + 4 │ } + 5 │ + +let_newline_in_async_function.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ async function f() { + 2 │ let + > 3 │ await 0; + │ ^ + 4 │ } + 5 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ async function f() { + 2 │ let + > 3 │ await 0; + │ ^ + 4 │ } + 5 │ + + i ...Which is required to end this statement + + 1 │ async function f() { + > 2 │ let + │ ^^^ + > 3 │ await 0; + │ ^^^^^^ + 4 │ } + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap new file mode 100644 index 000000000000..af0158597856 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap @@ -0,0 +1,160 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) let a; +while (true) const b = 5; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@10..14 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + SEMICOLON@15..16 ";" [] [], + ], + }, + else_clause: missing (optional), + }, + JsWhileStatement { + while_token: WHILE_KW@16..23 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@23..24 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@24..28 "true" [] [], + }, + r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@30..36 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@36..38 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@40..41 "5" [] [], + }, + }, + }, + ], + }, + SEMICOLON@41..42 ";" [] [], + ], + }, + }, + ], + eof_token: EOF@42..43 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..43 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..42 + 0: JS_IF_STATEMENT@0..16 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@10..16 + 0: JS_VARIABLE_DECLARATION@10..15 + 0: (empty) + 1: LET_KW@10..14 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..15 + 0: JS_VARIABLE_DECLARATOR@14..15 + 0: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@15..16 ";" [] [] + 5: (empty) + 1: JS_WHILE_STATEMENT@16..42 + 0: WHILE_KW@16..23 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@23..24 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@24..28 + 0: TRUE_KW@24..28 "true" [] [] + 3: R_PAREN@28..30 ")" [] [Whitespace(" ")] + 4: JS_BOGUS_STATEMENT@30..42 + 0: JS_VARIABLE_DECLARATION@30..41 + 0: (empty) + 1: CONST_KW@30..36 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@36..41 + 0: JS_VARIABLE_DECLARATOR@36..41 + 0: JS_IDENTIFIER_BINDING@36..38 + 0: IDENT@36..38 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@38..41 + 0: EQ@38..40 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@40..41 + 0: JS_NUMBER_LITERAL@40..41 "5" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 4: EOF@42..43 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +lexical_declaration_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Lexical declaration cannot appear in a single-statement context + + > 1 │ if (true) let a; + │ ^^^^^^ + 2 │ while (true) const b = 5; + 3 │ + + i Wrap this declaration in a block statement + +lexical_declaration_in_single_statement_context.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Lexical declaration cannot appear in a single-statement context + + 1 │ if (true) let a; + > 2 │ while (true) const b = 5; + │ ^^^^^^^^^^^^ + 3 │ + + i Wrap this declaration in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/literals.js b/crates/biome_js_parser/tests/js_test_suite/error/literals.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/literals.js rename to crates/biome_js_parser/tests/js_test_suite/error/literals.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/literals.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/literals.js.snap new file mode 100644 index 000000000000..3bd80b9564ac --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/literals.js.snap @@ -0,0 +1,252 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +00, 012, 08, 091, 0789 // parser errors +01n, 0_0, 01.2 // lexer errors +"test +continues" // unterminated string literal + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..2 "00" [] [], + }, + comma_token: COMMA@2..4 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@4..7 "012" [] [], + }, + }, + comma_token: COMMA@7..9 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@9..11 "08" [] [], + }, + }, + comma_token: COMMA@11..13 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..16 "091" [] [], + }, + }, + comma_token: COMMA@16..18 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@18..39 "0789" [] [Whitespace(" "), Comments("// parser errors")], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@39..43 "01n" [Newline("\n")] [], + }, + comma_token: COMMA@43..45 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@45..48 "0_0" [] [], + }, + }, + comma_token: COMMA@48..50 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@50..70 "01.2" [] [Whitespace(" "), Comments("// lexer errors")], + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + ERROR_TOKEN@70..76 "\"test" [Newline("\n")] [], + IDENT@76..86 "continues" [Newline("\n")] [], + ERROR_TOKEN@86..118 "\" // unterminated string literal" [] [], + ], + }, + ], + eof_token: EOF@118..119 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..119 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..118 + 0: JS_EXPRESSION_STATEMENT@0..39 + 0: JS_SEQUENCE_EXPRESSION@0..39 + 0: JS_SEQUENCE_EXPRESSION@0..16 + 0: JS_SEQUENCE_EXPRESSION@0..11 + 0: JS_SEQUENCE_EXPRESSION@0..7 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 + 0: JS_NUMBER_LITERAL@0..2 "00" [] [] + 1: COMMA@2..4 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@4..7 + 0: JS_NUMBER_LITERAL@4..7 "012" [] [] + 1: COMMA@7..9 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@9..11 + 0: JS_NUMBER_LITERAL@9..11 "08" [] [] + 1: COMMA@11..13 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@13..16 + 0: JS_NUMBER_LITERAL@13..16 "091" [] [] + 1: COMMA@16..18 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@18..39 + 0: JS_NUMBER_LITERAL@18..39 "0789" [] [Whitespace(" "), Comments("// parser errors")] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@39..70 + 0: JS_SEQUENCE_EXPRESSION@39..70 + 0: JS_SEQUENCE_EXPRESSION@39..48 + 0: JS_BIGINT_LITERAL_EXPRESSION@39..43 + 0: JS_BIGINT_LITERAL@39..43 "01n" [Newline("\n")] [] + 1: COMMA@43..45 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@45..48 + 0: JS_NUMBER_LITERAL@45..48 "0_0" [] [] + 1: COMMA@48..50 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@50..70 + 0: JS_NUMBER_LITERAL@50..70 "01.2" [] [Whitespace(" "), Comments("// lexer errors")] + 1: (empty) + 2: JS_BOGUS_STATEMENT@70..118 + 0: ERROR_TOKEN@70..76 "\"test" [Newline("\n")] [] + 1: IDENT@76..86 "continues" [Newline("\n")] [] + 2: ERROR_TOKEN@86..118 "\" // unterminated string literal" [] [] + 4: EOF@118..119 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +literals.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. + + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + +literals.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. + + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + +literals.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decimals with leading zeros are not allowed in strict mode. + + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + +literals.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decimals with leading zeros are not allowed in strict mode. + + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + +literals.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decimals with leading zeros are not allowed in strict mode. + + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + +literals.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Octal literals are not allowed for BigInts. + + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ ^^^ + 3 │ "test + 4 │ continues" // unterminated string literal + +literals.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × numeric separator can not be used after leading 0 + + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ + 3 │ "test + 4 │ continues" // unterminated string literal + +literals.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unexpected number + + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ ^^^ + 3 │ "test + 4 │ continues" // unterminated string literal + +literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated string literal + + 1 │ 00, 012, 08, 091, 0789 // parser errors + 2 │ 01n, 0_0, 01.2 // lexer errors + > 3 │ "test + │ ^^^^^ + 4 │ continues" // unterminated string literal + 5 │ + + i + + 1 │ 00, 012, 08, 091, 0789 // parser errors + 2 │ 01n, 0_0, 01.2 // lexer errors + > 3 │ "test + │ ^^^^^ + 4 │ continues" // unterminated string literal + 5 │ + + i The closing quote must be on the same line. + +literals.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated string literal + + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + > 4 │ continues" // unterminated string literal + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ + + i + + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + > 4 │ continues" // unterminated string literal + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ + + i The closing quote must be on the same line. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.js b/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/logical_expressions_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js.snap new file mode 100644 index 000000000000..206b842a41cd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js.snap @@ -0,0 +1,178 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ?? * 2; +!foo && bar; +foo(foo ||) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], + }, + }, + operator_token: QUESTION2@4..7 "??" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: missing (required), + operator_token: STAR@7..9 "*" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@9..10 "2" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsUnaryExpression { + operator_token: BANG@11..13 "!" [Newline("\n")] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..17 "foo" [] [Whitespace(" ")], + }, + }, + }, + operator_token: AMP2@17..20 "&&" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..23 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..28 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@28..29 "(" [] [], + args: JsCallArgumentList [ + JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@29..33 "foo" [] [Whitespace(" ")], + }, + }, + operator_token: PIPE2@33..35 "||" [] [], + right: missing (required), + }, + ], + r_paren_token: R_PAREN@35..36 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@36..37 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..37 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..36 + 0: JS_EXPRESSION_STATEMENT@0..11 + 0: JS_LOGICAL_EXPRESSION@0..10 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "foo" [] [Whitespace(" ")] + 1: QUESTION2@4..7 "??" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@7..10 + 0: (empty) + 1: STAR@7..9 "*" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@9..10 + 0: JS_NUMBER_LITERAL@9..10 "2" [] [] + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@11..24 + 0: JS_LOGICAL_EXPRESSION@11..23 + 0: JS_UNARY_EXPRESSION@11..17 + 0: BANG@11..13 "!" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@13..17 + 0: JS_REFERENCE_IDENTIFIER@13..17 + 0: IDENT@13..17 "foo" [] [Whitespace(" ")] + 1: AMP2@17..20 "&&" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@20..23 + 0: JS_REFERENCE_IDENTIFIER@20..23 + 0: IDENT@20..23 "bar" [] [] + 1: SEMICOLON@23..24 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@24..36 + 0: JS_CALL_EXPRESSION@24..36 + 0: JS_IDENTIFIER_EXPRESSION@24..28 + 0: JS_REFERENCE_IDENTIFIER@24..28 + 0: IDENT@24..28 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@28..36 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@29..35 + 0: JS_LOGICAL_EXPRESSION@29..35 + 0: JS_IDENTIFIER_EXPRESSION@29..33 + 0: JS_REFERENCE_IDENTIFIER@29..33 + 0: IDENT@29..33 "foo" [] [Whitespace(" ")] + 1: PIPE2@33..35 "||" [] [] + 2: (empty) + 2: R_PAREN@35..36 ")" [] [] + 1: (empty) + 4: EOF@36..37 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +logical_expressions_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression for the left hand side of the `*` operator. + + > 1 │ foo ?? * 2; + │ ^ + 2 │ !foo && bar; + 3 │ foo(foo ||) + + i This operator requires a left hand side value + +logical_expressions_err.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ')'. + + 1 │ foo ?? * 2; + 2 │ !foo && bar; + > 3 │ foo(foo ||) + │ ^ + 4 │ + + i Expected an expression here. + + 1 │ foo ?? * 2; + 2 │ !foo && bar; + > 3 │ foo(foo ||) + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/method_getter_err.js b/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/method_getter_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js.snap new file mode 100644 index 000000000000..f07b7ae1df41 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js.snap @@ -0,0 +1,146 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + get {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@11..17 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsBogusMember { + items: [ + L_CURLY@17..18 "{" [] [], + ], + }, + ], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + JsBogusStatement { + items: [ + R_CURLY@19..21 "}" [Newline("\n")] [], + ], + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_CLASS_DECLARATION@0..19 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..18 + 0: JS_PROPERTY_CLASS_MEMBER@11..17 + 0: JS_PROPERTY_MODIFIER_LIST@11..11 + 1: JS_LITERAL_MEMBER_NAME@11..17 + 0: IDENT@11..17 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 1: JS_BOGUS_MEMBER@17..18 + 0: L_CURLY@17..18 "{" [] [] + 9: R_CURLY@18..19 "}" [] [] + 1: JS_BOGUS_STATEMENT@19..21 + 0: R_CURLY@19..21 "}" [Newline("\n")] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +method_getter_err.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the class property, but found none + + 1 │ class foo { + > 2 │ get {} + │ ^^^ + 3 │ } + 4 │ + +method_getter_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. + + 1 │ class foo { + > 2 │ get {} + │ ^ + 3 │ } + 4 │ + + i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. + + 1 │ class foo { + > 2 │ get {} + │ ^ + 3 │ } + 4 │ + +method_getter_err.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + 1 │ class foo { + 2 │ get {} + > 3 │ } + │ ^ + 4 │ + + i Expected a statement here. + + 1 │ class foo { + 2 │ get {} + > 3 │ } + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/module_closing_curly.ts b/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/module_closing_curly.ts rename to crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts.snap new file mode 100644 index 000000000000..f7005fa8f437 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts.snap @@ -0,0 +1,131 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module A { + "name": "troublesome-lib", + "typings": "lib/index.d.ts", + "version": "0.0.1" +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@17..18 "{" [] [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@18..26 "\"name\"" [Newline("\n"), Whitespace(" ")] [], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + COLON@26..28 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@28..45 "\"troublesome-lib\"" [] [], + COMMA@45..46 "," [] [], + JS_STRING_LITERAL@46..57 "\"typings\"" [Newline("\n"), Whitespace(" ")] [], + COLON@57..59 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@59..75 "\"lib/index.d.ts\"" [] [], + COMMA@75..76 "," [] [], + JS_STRING_LITERAL@76..87 "\"version\"" [Newline("\n"), Whitespace(" ")] [], + COLON@87..89 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@89..96 "\"0.0.1\"" [] [], + ], + }, + ], + r_curly_token: R_CURLY@96..98 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@98..99 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..99 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..98 + 0: TS_DECLARE_STATEMENT@0..98 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..98 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@17..98 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_MODULE_ITEM_LIST@18..96 + 0: JS_EXPRESSION_STATEMENT@18..26 + 0: JS_STRING_LITERAL_EXPRESSION@18..26 + 0: JS_STRING_LITERAL@18..26 "\"name\"" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 1: JS_BOGUS_STATEMENT@26..96 + 0: COLON@26..28 ":" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL@28..45 "\"troublesome-lib\"" [] [] + 2: COMMA@45..46 "," [] [] + 3: JS_STRING_LITERAL@46..57 "\"typings\"" [Newline("\n"), Whitespace(" ")] [] + 4: COLON@57..59 ":" [] [Whitespace(" ")] + 5: JS_STRING_LITERAL@59..75 "\"lib/index.d.ts\"" [] [] + 6: COMMA@75..76 "," [] [] + 7: JS_STRING_LITERAL@76..87 "\"version\"" [Newline("\n"), Whitespace(" ")] [] + 8: COLON@87..89 ":" [] [Whitespace(" ")] + 9: JS_STRING_LITERAL@89..96 "\"0.0.1\"" [] [] + 2: R_CURLY@96..98 "}" [Newline("\n")] [] + 4: EOF@98..99 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +module_closing_curly.ts:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ declare module A { + > 2 │ "name": "troublesome-lib", + │ ^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" + + i An explicit or implicit semicolon is expected here... + + 1 │ declare module A { + > 2 │ "name": "troublesome-lib", + │ ^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" + + i ...Which is required to end this statement + + 1 │ declare module A { + > 2 │ "name": "troublesome-lib", + │ ^^^^^^^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.js b/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js.snap new file mode 100644 index 000000000000..175fe5e5afc9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js.snap @@ -0,0 +1,235 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default (class {}) +export default a + b; +export default (function a() {}) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultExpressionClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@15..16 "(" [] [], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@16..22 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@22..23 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + r_paren_token: R_PAREN@24..25 ")" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@25..33 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + DEFAULT_KW@33..41 "default" [] [Whitespace(" ")], + JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..43 "a" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@43..45 "+" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..46 "b" [] [], + }, + }, + }, + SEMICOLON@46..47 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + DEFAULT_KW@55..63 "default" [] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@63..64 "(" [] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@73..74 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@74..75 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@77..78 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@78..79 "}" [] [], + }, + }, + r_paren_token: R_PAREN@79..80 ")" [] [], + }, + ], + }, + ], + }, + ], + eof_token: EOF@80..81 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..81 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..80 + 0: JS_EXPORT@0..25 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@7..25 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@15..25 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_CLASS_EXPRESSION@16..24 + 0: JS_DECORATOR_LIST@16..16 + 1: CLASS_KW@16..22 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@22..23 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@23..23 + 8: R_CURLY@23..24 "}" [] [] + 2: R_PAREN@24..25 ")" [] [] + 2: (empty) + 1: JS_BOGUS_STATEMENT@25..47 + 0: JS_DECORATOR_LIST@25..25 + 1: EXPORT_KW@25..33 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@33..47 + 0: DEFAULT_KW@33..41 "default" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@41..46 + 0: JS_IDENTIFIER_EXPRESSION@41..43 + 0: JS_REFERENCE_IDENTIFIER@41..43 + 0: IDENT@41..43 "a" [] [Whitespace(" ")] + 1: PLUS@43..45 "+" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@45..46 + 0: JS_REFERENCE_IDENTIFIER@45..46 + 0: IDENT@45..46 "b" [] [] + 2: SEMICOLON@46..47 ";" [] [] + 2: JS_BOGUS_STATEMENT@47..80 + 0: JS_DECORATOR_LIST@47..47 + 1: EXPORT_KW@47..55 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@55..80 + 0: DEFAULT_KW@55..63 "default" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@63..80 + 0: L_PAREN@63..64 "(" [] [] + 1: JS_FUNCTION_EXPRESSION@64..79 + 0: (empty) + 1: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@73..74 + 0: IDENT@73..74 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@74..77 + 0: L_PAREN@74..75 "(" [] [] + 1: JS_PARAMETER_LIST@75..75 + 2: R_PAREN@75..77 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@77..79 + 0: L_CURLY@77..78 "{" [] [] + 1: JS_DIRECTIVE_LIST@78..78 + 2: JS_STATEMENT_LIST@78..78 + 3: R_CURLY@78..79 "}" [] [] + 2: R_PAREN@79..80 ")" [] [] + 4: EOF@80..81 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +multiple_default_exports_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal duplicate default export declarations + + 1 │ export default (class {}) + > 2 │ export default a + b; + │ ^^^^^^^^^^^^^^ + 3 │ export default (function a() {}) + 4 │ + + i multiple default exports are erroneous + + 1 │ export default (class {}) + > 2 │ export default a + b; + │ ^^^^^^^^^^^^^^ + 3 │ export default (function a() {}) + 4 │ + + i the module's default export is first defined here + + > 1 │ export default (class {}) + │ ^^^^^^^^^^^^^^^^^^ + 2 │ export default a + b; + 3 │ export default (function a() {}) + +multiple_default_exports_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal duplicate default export declarations + + 1 │ export default (class {}) + 2 │ export default a + b; + > 3 │ export default (function a() {}) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ + + i multiple default exports are erroneous + + 1 │ export default (class {}) + 2 │ export default a + b; + > 3 │ export default (function a() {}) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ + + i the module's default export is first defined here + + > 1 │ export default (class {}) + │ ^^^^^^^^^^^^^^^^^^ + 2 │ export default a + b; + 3 │ export default (function a() {}) + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/new_exprs.js b/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/new_exprs.js rename to crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js.snap new file mode 100644 index 000000000000..694ffe24b438 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js.snap @@ -0,0 +1,71 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +new; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@0..3 "new" [] [], + callee: missing (required), + type_arguments: missing (optional), + arguments: missing (optional), + }, + semicolon_token: SEMICOLON@3..4 ";" [] [], + }, + ], + eof_token: EOF@4..5 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..5 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..4 + 0: JS_EXPRESSION_STATEMENT@0..4 + 0: JS_NEW_EXPRESSION@0..3 + 0: NEW_KW@0..3 "new" [] [] + 1: (empty) + 2: (empty) + 3: (empty) + 1: SEMICOLON@3..4 ";" [] [] + 4: EOF@4..5 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +new_exprs.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ';'. + + > 1 │ new; + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ new; + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.js b/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.js rename to crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap new file mode 100644 index 000000000000..5805ff7174b4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap @@ -0,0 +1,127 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +async function test() {} +await test(); + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@25..29 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@29..30 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@32..33 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + AWAIT_KW@34..41 "await" [Newline("\n")] [Whitespace(" ")], + JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..45 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@45..46 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@46..47 ")" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + ], + eof_token: EOF@48..49 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..49 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..48 + 0: JS_FUNCTION_DECLARATION@0..34 + 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@16..25 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@25..29 + 0: IDENT@25..29 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@29..32 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_PARAMETER_LIST@30..30 + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@32..34 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_DIRECTIVE_LIST@33..33 + 2: JS_STATEMENT_LIST@33..33 + 3: R_CURLY@33..34 "}" [] [] + 1: JS_EXPRESSION_STATEMENT@34..48 + 0: JS_BOGUS_EXPRESSION@34..47 + 0: AWAIT_KW@34..41 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@41..47 + 0: JS_IDENTIFIER_EXPRESSION@41..45 + 0: JS_REFERENCE_IDENTIFIER@41..45 + 0: IDENT@41..45 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@45..47 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@46..46 + 2: R_PAREN@46..47 ")" [] [] + 1: SEMICOLON@47..48 ";" [] [] + 4: EOF@48..49 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +no_top_level_await_in_scripts.cjs:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + 1 │ // SCRIPT + 2 │ async function test() {} + > 3 │ await test(); + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.js b/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_binding_pattern.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js.snap new file mode 100644 index 000000000000..bbd2d2237b6c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js.snap @@ -0,0 +1,474 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { 5 } } = { eval: "foo" }; +let { eval } = { eval: "foo" }; +let { 5, 6 } = { eval: "foo" }; +let { default , eval: } = {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@6..8 "5" [] [Whitespace(" ")], + }, + colon_token: missing (required), + pattern: missing (required), + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@8..10 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_CURLY@10..12 "}" [] [Whitespace(" ")], + EQ@12..14 "=" [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@14..16 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@16..20 "eval" [] [], + }, + colon_token: COLON@20..22 ":" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@22..28 "\"foo\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@29..30 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@30..35 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@35..37 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsBogusBinding { + items: [ + IDENT@37..42 "eval" [] [Whitespace(" ")], + ], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@44..46 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@48..52 "eval" [] [], + }, + colon_token: COLON@52..54 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@54..60 "\"foo\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@61..62 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@62..67 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@67..69 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@69..70 "5" [] [], + }, + colon_token: missing (required), + pattern: missing (required), + init: missing (optional), + }, + COMMA@70..72 "," [] [Whitespace(" ")], + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@72..74 "6" [] [Whitespace(" ")], + }, + colon_token: missing (required), + pattern: missing (required), + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@74..76 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@80..84 "eval" [] [], + }, + colon_token: COLON@84..86 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@86..92 "\"foo\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@93..94 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@94..99 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@99..101 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@101..109 "default" [] [Whitespace(" ")], + }, + colon_token: missing (required), + pattern: missing (required), + init: missing (optional), + }, + COMMA@109..111 "," [] [Whitespace(" ")], + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@111..115 "eval" [] [], + }, + colon_token: COLON@115..117 ":" [] [Whitespace(" ")], + pattern: missing (required), + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@117..119 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@119..121 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@121..122 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@122..123 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@123..124 ";" [] [], + }, + ], + eof_token: EOF@124..125 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..125 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..124 + 0: JS_VARIABLE_STATEMENT@0..10 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_OBJECT_BINDING_PATTERN@4..10 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..8 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@6..8 + 0: JS_LITERAL_MEMBER_NAME@6..8 + 0: JS_NUMBER_LITERAL@6..8 "5" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 2: R_CURLY@8..10 "}" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 1: (empty) + 1: JS_BOGUS_STATEMENT@10..14 + 0: R_CURLY@10..12 "}" [] [Whitespace(" ")] + 1: EQ@12..14 "=" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@14..29 + 0: L_CURLY@14..16 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@16..28 + 0: JS_LABELED_STATEMENT@16..28 + 0: JS_LABEL@16..20 + 0: IDENT@16..20 "eval" [] [] + 1: COLON@20..22 ":" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@22..28 + 0: JS_STRING_LITERAL_EXPRESSION@22..28 + 0: JS_STRING_LITERAL@22..28 "\"foo\"" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@28..29 "}" [] [] + 3: JS_EMPTY_STATEMENT@29..30 + 0: SEMICOLON@29..30 ";" [] [] + 4: JS_VARIABLE_STATEMENT@30..62 + 0: JS_VARIABLE_DECLARATION@30..61 + 0: (empty) + 1: LET_KW@30..35 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@35..61 + 0: JS_VARIABLE_DECLARATOR@35..61 + 0: JS_OBJECT_BINDING_PATTERN@35..44 + 0: L_CURLY@35..37 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@37..42 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@37..42 + 0: JS_BOGUS_BINDING@37..42 + 0: IDENT@37..42 "eval" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@42..44 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@44..61 + 0: EQ@44..46 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@46..61 + 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@48..60 + 0: JS_PROPERTY_OBJECT_MEMBER@48..60 + 0: JS_LITERAL_MEMBER_NAME@48..52 + 0: IDENT@48..52 "eval" [] [] + 1: COLON@52..54 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@54..60 + 0: JS_STRING_LITERAL@54..60 "\"foo\"" [] [Whitespace(" ")] + 2: R_CURLY@60..61 "}" [] [] + 1: SEMICOLON@61..62 ";" [] [] + 5: JS_VARIABLE_STATEMENT@62..94 + 0: JS_VARIABLE_DECLARATION@62..93 + 0: (empty) + 1: LET_KW@62..67 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@67..93 + 0: JS_VARIABLE_DECLARATOR@67..93 + 0: JS_OBJECT_BINDING_PATTERN@67..76 + 0: L_CURLY@67..69 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@69..74 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@69..70 + 0: JS_LITERAL_MEMBER_NAME@69..70 + 0: JS_NUMBER_LITERAL@69..70 "5" [] [] + 1: (empty) + 2: (empty) + 3: (empty) + 1: COMMA@70..72 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_PROPERTY@72..74 + 0: JS_LITERAL_MEMBER_NAME@72..74 + 0: JS_NUMBER_LITERAL@72..74 "6" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 2: R_CURLY@74..76 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@76..93 + 0: EQ@76..78 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@78..93 + 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@80..92 + 0: JS_PROPERTY_OBJECT_MEMBER@80..92 + 0: JS_LITERAL_MEMBER_NAME@80..84 + 0: IDENT@80..84 "eval" [] [] + 1: COLON@84..86 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@86..92 + 0: JS_STRING_LITERAL@86..92 "\"foo\"" [] [Whitespace(" ")] + 2: R_CURLY@92..93 "}" [] [] + 1: SEMICOLON@93..94 ";" [] [] + 6: JS_VARIABLE_STATEMENT@94..124 + 0: JS_VARIABLE_DECLARATION@94..123 + 0: (empty) + 1: LET_KW@94..99 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@99..123 + 0: JS_VARIABLE_DECLARATOR@99..123 + 0: JS_OBJECT_BINDING_PATTERN@99..119 + 0: L_CURLY@99..101 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@101..117 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@101..109 + 0: JS_LITERAL_MEMBER_NAME@101..109 + 0: IDENT@101..109 "default" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 1: COMMA@109..111 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_PROPERTY@111..117 + 0: JS_LITERAL_MEMBER_NAME@111..115 + 0: IDENT@111..115 "eval" [] [] + 1: COLON@115..117 ":" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@117..119 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@119..123 + 0: EQ@119..121 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@121..123 + 0: L_CURLY@121..122 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@122..122 + 2: R_CURLY@122..123 "}" [] [] + 1: SEMICOLON@123..124 ";" [] [] + 4: EOF@124..125 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_binding_pattern.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `}` + + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + + i Remove } + +object_binding_pattern.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Object and Array patterns require initializers. + + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^^^^^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + + i This pattern is declared, but it is not given an initialized value. + +object_binding_pattern.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '} ='. + + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^^^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + + i Expected a statement here. + + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^^^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + +object_binding_pattern.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `eval` as an identifier in strict mode + + 1 │ let { 5 } } = { eval: "foo" }; + > 2 │ let { eval } = { eval: "foo" }; + │ ^^^^ + 3 │ let { 5, 6 } = { eval: "foo" }; + 4 │ let { default , eval: } = {}; + +object_binding_pattern.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `,` + + 1 │ let { 5 } } = { eval: "foo" }; + 2 │ let { eval } = { eval: "foo" }; + > 3 │ let { 5, 6 } = { eval: "foo" }; + │ ^ + 4 │ let { default , eval: } = {}; + 5 │ + + i Remove , + +object_binding_pattern.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `}` + + 1 │ let { 5 } } = { eval: "foo" }; + 2 │ let { eval } = { eval: "foo" }; + > 3 │ let { 5, 6 } = { eval: "foo" }; + │ ^ + 4 │ let { default , eval: } = {}; + 5 │ + + i Remove } + +object_binding_pattern.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `,` + + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + > 4 │ let { default , eval: } = {}; + │ ^ + 5 │ + + i Remove , + +object_binding_pattern.js:4:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found '}'. + + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + > 4 │ let { default , eval: } = {}; + │ ^ + 5 │ + + i Expected an identifier, an array pattern, or an object pattern here. + + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + > 4 │ let { default , eval: } = {}; + │ ^ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_err.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js.snap new file mode 100644 index 000000000000..e3b7c1593937 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js.snap @@ -0,0 +1,229 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {, foo} +let b = { foo bar } +let b = { foo + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + missing element, + COMMA@9..11 "," [] [Whitespace(" ")], + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@11..14 "foo" [] [], + }, + }, + ], + r_curly_token: R_CURLY@14..15 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@20..22 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@26..30 "foo" [] [Whitespace(" ")], + }, + }, + missing separator, + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@30..34 "bar" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@40..42 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@46..49 "foo" [] [], + }, + }, + ], + r_curly_token: missing (required), + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_VARIABLE_STATEMENT@0..15 + 0: JS_VARIABLE_DECLARATION@0..15 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..15 + 0: JS_VARIABLE_DECLARATOR@4..15 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..15 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..15 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..14 + 0: (empty) + 1: COMMA@9..11 "," [] [Whitespace(" ")] + 2: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@11..14 + 0: JS_REFERENCE_IDENTIFIER@11..14 + 0: IDENT@11..14 "foo" [] [] + 2: R_CURLY@14..15 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@15..35 + 0: JS_VARIABLE_DECLARATION@15..35 + 0: (empty) + 1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@20..35 + 0: JS_VARIABLE_DECLARATOR@20..35 + 0: JS_IDENTIFIER_BINDING@20..22 + 0: IDENT@20..22 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@22..35 + 0: EQ@22..24 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@24..35 + 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@26..34 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@26..30 + 0: JS_REFERENCE_IDENTIFIER@26..30 + 0: IDENT@26..30 "foo" [] [Whitespace(" ")] + 1: (empty) + 2: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@30..34 + 0: JS_REFERENCE_IDENTIFIER@30..34 + 0: IDENT@30..34 "bar" [] [Whitespace(" ")] + 2: R_CURLY@34..35 "}" [] [] + 1: (empty) + 2: JS_VARIABLE_STATEMENT@35..49 + 0: JS_VARIABLE_DECLARATION@35..49 + 0: (empty) + 1: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@40..49 + 0: JS_VARIABLE_DECLARATOR@40..49 + 0: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@42..49 + 0: EQ@42..44 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@44..49 + 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@46..49 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@46..49 + 0: JS_REFERENCE_IDENTIFIER@46..49 + 0: IDENT@46..49 "foo" [] [] + 2: (empty) + 1: (empty) + 4: EOF@49..50 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_expr_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `bar` + + 1 │ let a = {, foo} + > 2 │ let b = { foo bar } + │ ^^^ + 3 │ let b = { foo + 4 │ + + i Remove bar + +object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead the file ends + + 2 │ let b = { foo bar } + 3 │ let b = { foo + > 4 │ + │ + + i the file ends here + + 2 │ let b = { foo bar } + 3 │ let b = { foo + > 4 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js.snap new file mode 100644 index 000000000000..267ea8c66c91 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js.snap @@ -0,0 +1,240 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { /: 6, /: /foo/ } +let b = {{}} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + SLASH@10..11 "/" [] [], + ], + }, + COLON@11..13 ":" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..14 "6" [] [], + }, + ], + }, + COMMA@14..16 "," [] [Whitespace(" ")], + JsBogusMember { + items: [ + JsBogus { + items: [ + SLASH@16..17 "/" [] [], + ], + }, + COLON@17..19 ":" [] [Whitespace(" ")], + JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@19..25 "/foo/" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@26..31 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@31..33 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@35..36 "{" [] [], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + L_CURLY@36..37 "{" [] [], + ], + }, + ], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_CURLY@38..39 "}" [] [], + ], + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_VARIABLE_STATEMENT@0..26 + 0: JS_VARIABLE_DECLARATION@0..26 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..26 + 0: JS_VARIABLE_DECLARATOR@4..26 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..26 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..26 + 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@10..25 + 0: JS_BOGUS_MEMBER@10..14 + 0: JS_BOGUS@10..11 + 0: SLASH@10..11 "/" [] [] + 1: COLON@11..13 ":" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@13..14 + 0: JS_NUMBER_LITERAL@13..14 "6" [] [] + 1: COMMA@14..16 "," [] [Whitespace(" ")] + 2: JS_BOGUS_MEMBER@16..25 + 0: JS_BOGUS@16..17 + 0: SLASH@16..17 "/" [] [] + 1: COLON@17..19 ":" [] [Whitespace(" ")] + 2: JS_REGEX_LITERAL_EXPRESSION@19..25 + 0: JS_REGEX_LITERAL@19..25 "/foo/" [] [Whitespace(" ")] + 2: R_CURLY@25..26 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@26..38 + 0: JS_VARIABLE_DECLARATION@26..38 + 0: (empty) + 1: LET_KW@26..31 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@31..38 + 0: JS_VARIABLE_DECLARATOR@31..38 + 0: JS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@33..38 + 0: EQ@33..35 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@35..38 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@36..37 + 0: JS_BOGUS_MEMBER@36..37 + 0: L_CURLY@36..37 "{" [] [] + 2: R_CURLY@37..38 "}" [] [] + 1: (empty) + 2: JS_BOGUS_STATEMENT@38..39 + 0: R_CURLY@38..39 "}" [] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_expr_error_prop_name.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '/'. + + > 1 │ let a = { /: 6, /: /foo/ } + │ ^ + 2 │ let b = {{}} + 3 │ + + i Expected a property, a shorthand property, a getter, a setter, or a method here. + + > 1 │ let a = { /: 6, /: /foo/ } + │ ^ + 2 │ let b = {{}} + 3 │ + +object_expr_error_prop_name.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '/'. + + > 1 │ let a = { /: 6, /: /foo/ } + │ ^ + 2 │ let b = {{}} + 3 │ + + i Expected a property, a shorthand property, a getter, a setter, or a method here. + + > 1 │ let a = { /: 6, /: /foo/ } + │ ^ + 2 │ let b = {{}} + 3 │ + +object_expr_error_prop_name.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{'. + + 1 │ let a = { /: 6, /: /foo/ } + > 2 │ let b = {{}} + │ ^ + 3 │ + + i Expected a property, a shorthand property, a getter, a setter, or a method here. + + 1 │ let a = { /: 6, /: /foo/ } + > 2 │ let b = {{}} + │ ^ + 3 │ + +object_expr_error_prop_name.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + 1 │ let a = { /: 6, /: /foo/ } + > 2 │ let b = {{}} + │ ^ + 3 │ + + i Expected a statement here. + + 1 │ let a = { /: 6, /: /foo/ } + > 2 │ let b = {{}} + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_method.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_method.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js.snap new file mode 100644 index 000000000000..8224caada1f2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js.snap @@ -0,0 +1,108 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { foo) } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@10..13 "foo" [] [], + }, + }, + missing separator, + JsBogusMember { + items: [ + R_PAREN@13..15 ")" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@15..16 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@16..17 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..17 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..16 + 0: JS_VARIABLE_STATEMENT@0..16 + 0: JS_VARIABLE_DECLARATION@0..16 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..16 + 0: JS_VARIABLE_DECLARATOR@4..16 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..16 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..16 + 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@10..15 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@10..13 + 0: JS_REFERENCE_IDENTIFIER@10..13 + 0: IDENT@10..13 "foo" [] [] + 1: (empty) + 2: JS_BOGUS_MEMBER@13..15 + 0: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 2: R_CURLY@15..16 "}" [] [] + 1: (empty) + 4: EOF@16..17 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_expr_method.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `)` + + > 1 │ let b = { foo) } + │ ^ + 2 │ + + i Remove ) + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap new file mode 100644 index 000000000000..b4727e668730 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap @@ -0,0 +1,103 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let d = {5} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "d" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@9..10 "5" [] [], + }, + colon_token: missing (required), + value: missing (required), + }, + ], + r_curly_token: R_CURLY@10..11 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..11 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..11 + 0: JS_VARIABLE_DECLARATOR@4..11 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "d" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..11 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..11 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..10 + 0: JS_PROPERTY_OBJECT_MEMBER@9..10 + 0: JS_LITERAL_MEMBER_NAME@9..10 + 0: JS_NUMBER_LITERAL@9..10 "5" [] [] + 1: (empty) + 2: (empty) + 2: R_CURLY@10..11 "}" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_expr_non_ident_literal_prop.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `}` + + > 1 │ let d = {5} + │ ^ + 2 │ + + i Remove } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_setter.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_setter.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js.snap new file mode 100644 index 000000000000..b3b04ba290a6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js.snap @@ -0,0 +1,145 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { + set foo() { + return 5; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsSetterObjectMember { + set_token: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@15..18 "foo" [] [], + }, + l_paren_token: L_PAREN@18..19 "(" [] [], + parameter: missing (required), + comma_token: missing (optional), + r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@21..22 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@22..34 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@34..35 "5" [] [], + }, + semicolon_token: SEMICOLON@35..36 ";" [] [], + }, + ], + r_curly_token: R_CURLY@36..39 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@39..41 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@41..42 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..42 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..41 + 0: JS_VARIABLE_STATEMENT@0..41 + 0: JS_VARIABLE_DECLARATION@0..41 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..41 + 0: JS_VARIABLE_DECLARATOR@4..41 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..41 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..41 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..39 + 0: JS_SETTER_OBJECT_MEMBER@9..39 + 0: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@15..18 + 0: IDENT@15..18 "foo" [] [] + 2: L_PAREN@18..19 "(" [] [] + 3: (empty) + 4: (empty) + 5: R_PAREN@19..21 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@21..39 + 0: L_CURLY@21..22 "{" [] [] + 1: JS_DIRECTIVE_LIST@22..22 + 2: JS_STATEMENT_LIST@22..36 + 0: JS_RETURN_STATEMENT@22..36 + 0: RETURN_KW@22..34 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@34..35 + 0: JS_NUMBER_LITERAL@34..35 "5" [] [] + 2: SEMICOLON@35..36 ";" [] [] + 3: R_CURLY@36..39 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@39..41 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@41..42 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_expr_setter.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parameter but instead found ')'. + + 1 │ let b = { + > 2 │ set foo() { + │ ^ + 3 │ return 5; + 4 │ } + + i Expected a parameter here. + + 1 │ let b = { + > 2 │ set foo() { + │ ^ + 3 │ return 5; + 4 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.js b/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_property_binding_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js.snap new file mode 100644 index 000000000000..6656a6162cc6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js.snap @@ -0,0 +1,296 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { foo: , bar } = {} +let { : lorem = "test" } = {} +let { , ipsum: bazz } = {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@6..9 "foo" [] [], + }, + colon_token: COLON@9..11 ":" [] [Whitespace(" ")], + pattern: missing (required), + init: missing (optional), + }, + COMMA@11..13 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@13..17 "bar" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@19..21 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@21..22 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: missing (required), + colon_token: COLON@30..32 ":" [] [Whitespace(" ")], + pattern: JsIdentifierBinding { + name_token: IDENT@32..38 "lorem" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@40..47 "\"test\"" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@47..49 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@49..51 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@51..52 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@53..58 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@58..60 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + missing element, + COMMA@60..62 "," [] [Whitespace(" ")], + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@62..67 "ipsum" [] [], + }, + colon_token: COLON@67..69 ":" [] [Whitespace(" ")], + pattern: JsIdentifierBinding { + name_token: IDENT@69..74 "bazz" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@74..76 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@78..79 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@79..80 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@80..81 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..81 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..80 + 0: JS_VARIABLE_STATEMENT@0..23 + 0: JS_VARIABLE_DECLARATION@0..23 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..23 + 0: JS_VARIABLE_DECLARATOR@4..23 + 0: JS_OBJECT_BINDING_PATTERN@4..19 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..17 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@6..11 + 0: JS_LITERAL_MEMBER_NAME@6..9 + 0: IDENT@6..9 "foo" [] [] + 1: COLON@9..11 ":" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 1: COMMA@11..13 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@13..17 + 0: JS_IDENTIFIER_BINDING@13..17 + 0: IDENT@13..17 "bar" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@19..23 + 0: EQ@19..21 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@21..23 + 0: L_CURLY@21..22 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@22..22 + 2: R_CURLY@22..23 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@23..53 + 0: JS_VARIABLE_DECLARATION@23..53 + 0: (empty) + 1: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@28..53 + 0: JS_VARIABLE_DECLARATOR@28..53 + 0: JS_OBJECT_BINDING_PATTERN@28..49 + 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@30..47 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@30..47 + 0: (empty) + 1: COLON@30..32 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@32..38 + 0: IDENT@32..38 "lorem" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@38..47 + 0: EQ@38..40 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@40..47 + 0: JS_STRING_LITERAL@40..47 "\"test\"" [] [Whitespace(" ")] + 2: R_CURLY@47..49 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@49..53 + 0: EQ@49..51 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@51..53 + 0: L_CURLY@51..52 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@52..52 + 2: R_CURLY@52..53 "}" [] [] + 1: (empty) + 2: JS_VARIABLE_STATEMENT@53..80 + 0: JS_VARIABLE_DECLARATION@53..80 + 0: (empty) + 1: LET_KW@53..58 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@58..80 + 0: JS_VARIABLE_DECLARATOR@58..80 + 0: JS_OBJECT_BINDING_PATTERN@58..76 + 0: L_CURLY@58..60 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@60..74 + 0: (empty) + 1: COMMA@60..62 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_PROPERTY@62..74 + 0: JS_LITERAL_MEMBER_NAME@62..67 + 0: IDENT@62..67 "ipsum" [] [] + 1: COLON@67..69 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@69..74 + 0: IDENT@69..74 "bazz" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@74..76 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@76..80 + 0: EQ@76..78 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@78..80 + 0: L_CURLY@78..79 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@79..79 + 2: R_CURLY@79..80 "}" [] [] + 1: (empty) + 4: EOF@80..81 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_property_binding_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found ','. + + > 1 │ let { foo: , bar } = {} + │ ^ + 2 │ let { : lorem = "test" } = {} + 3 │ let { , ipsum: bazz } = {} + + i Expected an identifier, an array pattern, or an object pattern here. + + > 1 │ let { foo: , bar } = {} + │ ^ + 2 │ let { : lorem = "test" } = {} + 3 │ let { , ipsum: bazz } = {} + +object_property_binding_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. + + 1 │ let { foo: , bar } = {} + > 2 │ let { : lorem = "test" } = {} + │ ^ + 3 │ let { , ipsum: bazz } = {} + 4 │ + + i Expected an identifier, a string literal, a number literal, or a computed property here. + + 1 │ let { foo: , bar } = {} + > 2 │ let { : lorem = "test" } = {} + │ ^ + 3 │ let { , ipsum: bazz } = {} + 4 │ + +object_property_binding_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a member name, or a rest pattern but instead found ','. + + 1 │ let { foo: , bar } = {} + 2 │ let { : lorem = "test" } = {} + > 3 │ let { , ipsum: bazz } = {} + │ ^ + 4 │ + + i Expected an identifier, a member name, or a rest pattern here. + + 1 │ let { foo: , bar } = {} + 2 │ let { : lorem = "test" } = {} + > 3 │ let { , ipsum: bazz } = {} + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.js b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js.snap new file mode 100644 index 000000000000..21bd24c73da4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js.snap @@ -0,0 +1,270 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { a b } = c +let { = "test" } = c +let { , d } = c + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@6..8 "a" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + missing separator, + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@8..10 "b" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@10..12 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@12..14 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..15 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: missing (required), + init: JsInitializerClause { + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@24..31 "\"test\"" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@36..41 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + missing element, + COMMA@43..45 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@45..47 "d" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@47..49 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@49..51 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@51..52 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@52..53 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..53 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..52 + 0: JS_VARIABLE_STATEMENT@0..15 + 0: JS_VARIABLE_DECLARATION@0..15 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..15 + 0: JS_VARIABLE_DECLARATOR@4..15 + 0: JS_OBJECT_BINDING_PATTERN@4..12 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..10 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@6..8 + 0: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "a" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@8..10 + 0: JS_IDENTIFIER_BINDING@8..10 + 0: IDENT@8..10 "b" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@10..12 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@12..15 + 0: EQ@12..14 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@14..15 + 0: JS_REFERENCE_IDENTIFIER@14..15 + 0: IDENT@14..15 "c" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@15..36 + 0: JS_VARIABLE_DECLARATION@15..36 + 0: (empty) + 1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@20..36 + 0: JS_VARIABLE_DECLARATOR@20..36 + 0: JS_OBJECT_BINDING_PATTERN@20..33 + 0: L_CURLY@20..22 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@22..31 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@22..31 + 0: (empty) + 1: JS_INITIALIZER_CLAUSE@22..31 + 0: EQ@22..24 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@24..31 + 0: JS_STRING_LITERAL@24..31 "\"test\"" [] [Whitespace(" ")] + 2: R_CURLY@31..33 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@33..36 + 0: EQ@33..35 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "c" [] [] + 1: (empty) + 2: JS_VARIABLE_STATEMENT@36..52 + 0: JS_VARIABLE_DECLARATION@36..52 + 0: (empty) + 1: LET_KW@36..41 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@41..52 + 0: JS_VARIABLE_DECLARATOR@41..52 + 0: JS_OBJECT_BINDING_PATTERN@41..49 + 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@43..47 + 0: (empty) + 1: COMMA@43..45 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@45..47 + 0: JS_IDENTIFIER_BINDING@45..47 + 0: IDENT@45..47 "d" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@47..49 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@49..52 + 0: EQ@49..51 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@51..52 + 0: JS_REFERENCE_IDENTIFIER@51..52 + 0: IDENT@51..52 "c" [] [] + 1: (empty) + 4: EOF@52..53 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_shorthand_property_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `b` + + > 1 │ let { a b } = c + │ ^ + 2 │ let { = "test" } = c + 3 │ let { , d } = c + + i Remove b + +object_shorthand_property_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found '='. + + 1 │ let { a b } = c + > 2 │ let { = "test" } = c + │ ^ + 3 │ let { , d } = c + 4 │ + + i Expected an identifier here. + + 1 │ let { a b } = c + > 2 │ let { = "test" } = c + │ ^ + 3 │ let { , d } = c + 4 │ + +object_shorthand_property_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a member name, or a rest pattern but instead found ','. + + 1 │ let { a b } = c + 2 │ let { = "test" } = c + > 3 │ let { , d } = c + │ ^ + 4 │ + + i Expected an identifier, a member name, or a rest pattern here. + + 1 │ let { a b } = c + 2 │ let { = "test" } = c + > 3 │ let { , d } = c + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js.snap new file mode 100644 index 000000000000..ab22ca1f6bcd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({ arrow = () => {} }) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + JsReferenceIdentifier { + value_token: IDENT@3..9 "arrow" [] [Whitespace(" ")], + }, + EQ@9..11 "=" [] [Whitespace(" ")], + JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@11..12 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@12..14 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + r_paren_token: R_PAREN@21..22 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@22..23 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..23 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..22 + 0: JS_EXPRESSION_STATEMENT@0..22 + 0: JS_PARENTHESIZED_EXPRESSION@0..22 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..21 + 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@3..20 + 0: JS_BOGUS_MEMBER@3..20 + 0: JS_REFERENCE_IDENTIFIER@3..9 + 0: IDENT@3..9 "arrow" [] [Whitespace(" ")] + 1: EQ@9..11 "=" [] [Whitespace(" ")] + 2: JS_ARROW_FUNCTION_EXPRESSION@11..20 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@11..14 + 0: L_PAREN@11..12 "(" [] [] + 1: JS_PARAMETER_LIST@12..12 + 2: R_PAREN@12..14 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@17..20 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..18 + 3: R_CURLY@18..20 "}" [] [Whitespace(" ")] + 2: R_CURLY@20..21 "}" [] [] + 2: R_PAREN@21..22 ")" [] [] + 1: (empty) + 4: EOF@22..23 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +object_shorthand_with_initializer.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. + + > 1 │ ({ arrow = () => {} }) + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.ts b/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.ts rename to crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap new file mode 100644 index 000000000000..a4966c7ba2c1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap @@ -0,0 +1,207 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = { test: null }; +a.test?.; +a.test?. 2 │ a.test?.; + │ ^ + 3 │ a.test?. 2 │ a.test?.; + │ ^ + 3 │ a.test?. 3 │ a.test?. 3 │ a.test?. 1 │ class B { foo?; } + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.js b/crates/biome_js_parser/tests/js_test_suite/error/paren_or_arrow_expr_invalid_params.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.js rename to crates/biome_js_parser/tests/js_test_suite/error/paren_or_arrow_expr_invalid_params.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/paren_or_arrow_expr_invalid_params.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/paren_or_arrow_expr_invalid_params.js.snap new file mode 100644 index 000000000000..06334fde1825 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/paren_or_arrow_expr_invalid_params.js.snap @@ -0,0 +1,446 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(5 + 5) => {} +(a, ,b) => {} +(a, b) =>; +(a: string; +(a, b) + => {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@1..3 "5" [] [Whitespace(" ")], + }, + operator_token: PLUS@3..5 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@5..6 "5" [] [], + }, + }, + r_paren_token: R_PAREN@6..8 ")" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + FAT_ARROW@8..11 "=>" [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@11..12 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@12..13 "}" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..15 "(" [Newline("\n")] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@16..18 "," [] [Whitespace(" ")], + missing element, + COMMA@18..19 "," [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@19..20 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@27..29 "(" [Newline("\n")] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@29..30 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..33 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@35..37 "=>" [] [], + body: missing (required), + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..40 "(" [Newline("\n")] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + JsIdentifierBinding { + name_token: IDENT@40..41 "a" [] [], + }, + JsBogus { + items: [ + COLON@41..43 ":" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@43..49 "string" [] [], + }, + ], + }, + ], + }, + ], + r_paren_token: missing (required), + }, + return_type_annotation: missing (optional), + fat_arrow_token: missing (required), + body: missing (required), + }, + semicolon_token: SEMICOLON@49..50 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@50..52 "(" [Newline("\n")] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@52..53 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@53..55 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@55..56 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@57..62 "=>" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@62..63 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@63..64 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_PARENTHESIZED_EXPRESSION@0..8 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_BINARY_EXPRESSION@1..6 + 0: JS_NUMBER_LITERAL_EXPRESSION@1..3 + 0: JS_NUMBER_LITERAL@1..3 "5" [] [Whitespace(" ")] + 1: PLUS@3..5 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@5..6 + 0: JS_NUMBER_LITERAL@5..6 "5" [] [] + 2: R_PAREN@6..8 ")" [] [Whitespace(" ")] + 1: (empty) + 1: JS_BOGUS_STATEMENT@8..11 + 0: FAT_ARROW@8..11 "=>" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@11..13 + 0: L_CURLY@11..12 "{" [] [] + 1: JS_STATEMENT_LIST@12..12 + 2: R_CURLY@12..13 "}" [] [] + 3: JS_EXPRESSION_STATEMENT@13..27 + 0: JS_ARROW_FUNCTION_EXPRESSION@13..27 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@13..22 + 0: L_PAREN@13..15 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@15..20 + 0: JS_FORMAL_PARAMETER@15..16 + 0: JS_DECORATOR_LIST@15..15 + 1: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@16..18 "," [] [Whitespace(" ")] + 2: (empty) + 3: COMMA@18..19 "," [] [] + 4: JS_FORMAL_PARAMETER@19..20 + 0: JS_DECORATOR_LIST@19..19 + 1: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@25..27 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..26 + 3: R_CURLY@26..27 "}" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@27..38 + 0: JS_ARROW_FUNCTION_EXPRESSION@27..37 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@27..35 + 0: L_PAREN@27..29 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@29..33 + 0: JS_FORMAL_PARAMETER@29..30 + 0: JS_DECORATOR_LIST@29..29 + 1: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@30..32 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@32..33 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@35..37 "=>" [] [] + 5: (empty) + 1: SEMICOLON@37..38 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@38..50 + 0: JS_ARROW_FUNCTION_EXPRESSION@38..49 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@38..49 + 0: L_PAREN@38..40 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@40..49 + 0: JS_BOGUS_PARAMETER@40..49 + 0: JS_DECORATOR_LIST@40..40 + 1: JS_IDENTIFIER_BINDING@40..41 + 0: IDENT@40..41 "a" [] [] + 2: JS_BOGUS@41..49 + 0: COLON@41..43 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@43..49 + 0: STRING_KW@43..49 "string" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 1: SEMICOLON@49..50 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@50..64 + 0: JS_ARROW_FUNCTION_EXPRESSION@50..64 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@50..57 + 0: L_PAREN@50..52 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@52..56 + 0: JS_FORMAL_PARAMETER@52..53 + 0: JS_DECORATOR_LIST@52..52 + 1: JS_IDENTIFIER_BINDING@52..53 + 0: IDENT@52..53 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@53..55 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@55..56 + 0: JS_DECORATOR_LIST@55..55 + 1: JS_IDENTIFIER_BINDING@55..56 + 0: IDENT@55..56 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@56..57 ")" [] [] + 3: (empty) + 4: FAT_ARROW@57..62 "=>" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@62..64 + 0: L_CURLY@62..63 "{" [] [] + 1: JS_DIRECTIVE_LIST@63..63 + 2: JS_STATEMENT_LIST@63..63 + 3: R_CURLY@63..64 "}" [] [] + 1: (empty) + 4: EOF@64..65 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +paren_or_arrow_expr_invalid_params.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ (5 + 5) => {} + │ ^^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + + i An explicit or implicit semicolon is expected here... + + > 1 │ (5 + 5) => {} + │ ^^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + + i ...Which is required to end this statement + + > 1 │ (5 + 5) => {} + │ ^^^^^^^^^^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + +paren_or_arrow_expr_invalid_params.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parameter but instead found ','. + + 1 │ (5 + 5) => {} + > 2 │ (a, ,b) => {} + │ ^ + 3 │ (a, b) =>; + 4 │ (a: string; + + i Expected a parameter here. + + 1 │ (5 + 5) => {} + > 2 │ (a, ,b) => {} + │ ^ + 3 │ (a, b) =>; + 4 │ (a: string; + +paren_or_arrow_expr_invalid_params.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a function body, or an expression but instead found ';'. + + 1 │ (5 + 5) => {} + 2 │ (a, ,b) => {} + > 3 │ (a, b) =>; + │ ^ + 4 │ (a: string; + 5 │ (a, b) + + i Expected a function body, or an expression here. + + 1 │ (5 + 5) => {} + 2 │ (a, ,b) => {} + > 3 │ (a, b) =>; + │ ^ + 4 │ (a: string; + 5 │ (a, b) + +paren_or_arrow_expr_invalid_params.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + > 4 │ (a: string; + │ ^^^^^^^^ + 5 │ (a, b) + 6 │ => {} + + i TypeScript only syntax + +paren_or_arrow_expr_invalid_params.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `;` + + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + > 4 │ (a: string; + │ ^ + 5 │ (a, b) + 6 │ => {} + + i Remove ; + +paren_or_arrow_expr_invalid_params.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Line terminator not permitted before arrow. + + 4 │ (a: string; + 5 │ (a, b) + > 6 │ => {} + │ ^^ + 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.js b/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.js rename to crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap new file mode 100644 index 000000000000..7e0b5dfc4fc8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap @@ -0,0 +1,121 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = \; foo(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@0..4 "let" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + EQ@6..8 "=" [] [Whitespace(" ")], + JsBogus { + items: [ + ERROR_TOKEN@8..9 "\\" [] [], + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@9..11 ";" [] [Whitespace(" ")], + ], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..14 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@14..15 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@15..16 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: JS_BOGUS_STATEMENT@0..11 + 0: JS_BOGUS@0..9 + 0: LET_KW@0..4 "let" [] [Whitespace(" ")] + 1: JS_BOGUS@4..9 + 0: JS_BOGUS@4..9 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: JS_BOGUS@6..9 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_BOGUS@8..9 + 0: ERROR_TOKEN@8..9 "\\" [] [] + 1: SEMICOLON@9..11 ";" [] [Whitespace(" ")] + 1: JS_EXPRESSION_STATEMENT@11..17 + 0: JS_CALL_EXPRESSION@11..16 + 0: JS_IDENTIFIER_EXPRESSION@11..14 + 0: JS_REFERENCE_IDENTIFIER@11..14 + 0: IDENT@11..14 "foo" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@14..16 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@15..15 + 2: R_PAREN@15..16 ")" [] [] + 1: SEMICOLON@16..17 ";" [] [] + 4: EOF@17..18 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +primary_expr_invalid_recovery.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unexpected token `\` + + > 1 │ let a = \; foo(); + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.js b/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.js rename to crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js.snap new file mode 100644 index 000000000000..46e88d950306 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js.snap @@ -0,0 +1,277 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + #prop; + test() { + #prop in #prop in this; + 5 + #prop; + #prop + #prop + 5; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [], + id_token: IDENT@12..16 "prop" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsInExpression { + property: JsInExpression { + property: JsPrivateName { + hash_token: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [], + value_token: IDENT@32..37 "prop" [] [Whitespace(" ")], + }, + in_token: IN_KW@37..40 "in" [] [Whitespace(" ")], + object: JsBogusExpression { + items: [ + HASH@40..41 "#" [] [], + IDENT@41..46 "prop" [] [Whitespace(" ")], + ], + }, + }, + in_token: IN_KW@46..49 "in" [] [Whitespace(" ")], + object: JsThisExpression { + this_token: THIS_KW@49..53 "this" [] [], + }, + }, + semicolon_token: SEMICOLON@53..54 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@54..60 "5" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + operator_token: PLUS@60..62 "+" [] [Whitespace(" ")], + right: JsBogusExpression { + items: [ + HASH@62..63 "#" [] [], + IDENT@63..67 "prop" [] [], + ], + }, + }, + semicolon_token: SEMICOLON@67..68 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + HASH@68..73 "#" [Newline("\n"), Whitespace(" ")] [], + IDENT@73..77 "prop" [] [], + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBogusExpression { + items: [ + HASH@77..82 "#" [Newline("\n"), Whitespace(" ")] [], + IDENT@82..87 "prop" [] [Whitespace(" ")], + ], + }, + operator_token: PLUS@87..89 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@89..90 "5" [] [], + }, + }, + semicolon_token: SEMICOLON@90..91 ";" [] [], + }, + ], + r_curly_token: R_CURLY@91..94 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@94..96 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@96..97 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..97 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..96 + 0: JS_CLASS_DECLARATION@0..96 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..94 + 0: JS_PROPERTY_CLASS_MEMBER@9..17 + 0: JS_PROPERTY_MODIFIER_LIST@9..9 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@9..16 + 0: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [] + 1: IDENT@12..16 "prop" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@16..17 ";" [] [] + 1: JS_METHOD_CLASS_MEMBER@17..94 + 0: JS_METHOD_MODIFIER_LIST@17..17 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@17..23 + 0: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@26..94 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..91 + 0: JS_EXPRESSION_STATEMENT@27..54 + 0: JS_IN_EXPRESSION@27..53 + 0: JS_IN_EXPRESSION@27..46 + 0: JS_PRIVATE_NAME@27..37 + 0: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@32..37 "prop" [] [Whitespace(" ")] + 1: IN_KW@37..40 "in" [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@40..46 + 0: HASH@40..41 "#" [] [] + 1: IDENT@41..46 "prop" [] [Whitespace(" ")] + 1: IN_KW@46..49 "in" [] [Whitespace(" ")] + 2: JS_THIS_EXPRESSION@49..53 + 0: THIS_KW@49..53 "this" [] [] + 1: SEMICOLON@53..54 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@54..68 + 0: JS_BINARY_EXPRESSION@54..67 + 0: JS_NUMBER_LITERAL_EXPRESSION@54..60 + 0: JS_NUMBER_LITERAL@54..60 "5" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: PLUS@60..62 "+" [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@62..67 + 0: HASH@62..63 "#" [] [] + 1: IDENT@63..67 "prop" [] [] + 1: SEMICOLON@67..68 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@68..77 + 0: JS_BOGUS_EXPRESSION@68..77 + 0: HASH@68..73 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@73..77 "prop" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@77..91 + 0: JS_BINARY_EXPRESSION@77..90 + 0: JS_BOGUS_EXPRESSION@77..87 + 0: HASH@77..82 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@82..87 "prop" [] [Whitespace(" ")] + 1: PLUS@87..89 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@89..90 + 0: JS_NUMBER_LITERAL@89..90 "5" [] [] + 1: SEMICOLON@90..91 ";" [] [] + 3: R_CURLY@91..94 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@94..96 "}" [Newline("\n")] [] + 4: EOF@96..97 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +private_name_presence_check_recursive.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Private names are only allowed on the left side of a 'in' expression + + 2 │ #prop; + 3 │ test() { + > 4 │ #prop in #prop in this; + │ ^^^^^ + 5 │ 5 + #prop; + 6 │ #prop + +private_name_presence_check_recursive.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Private names are only allowed on the left side of a 'in' expression + + 3 │ test() { + 4 │ #prop in #prop in this; + > 5 │ 5 + #prop; + │ ^^^^^ + 6 │ #prop + 7 │ #prop + 5; + +private_name_presence_check_recursive.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Private names are only allowed on the left side of a 'in' expression + + 4 │ #prop in #prop in this; + 5 │ 5 + #prop; + > 6 │ #prop + │ ^^^^^ + 7 │ #prop + 5; + 8 │ } + +private_name_presence_check_recursive.js:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Private names are only allowed on the left side of a 'in' expression + + 5 │ 5 + #prop; + 6 │ #prop + > 7 │ #prop + 5; + │ ^^^^^ + 8 │ } + 9 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_with_space.js b/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/private_name_with_space.js rename to crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js.snap new file mode 100644 index 000000000000..e57f8999c83b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js.snap @@ -0,0 +1,126 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + # test; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@9..13 "#" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + id_token: missing (required), + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@13..17 "test" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + ], + r_curly_token: R_CURLY@18..20 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_CLASS_DECLARATION@0..20 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..18 + 0: JS_PROPERTY_CLASS_MEMBER@9..13 + 0: JS_PROPERTY_MODIFIER_LIST@9..9 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@9..13 + 0: HASH@9..13 "#" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@13..18 + 0: JS_PROPERTY_MODIFIER_LIST@13..13 + 1: JS_LITERAL_MEMBER_NAME@13..17 + 0: IDENT@13..17 "test" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@17..18 ";" [] [] + 9: R_CURLY@18..20 "}" [Newline("\n")] [] + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +private_name_with_space.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected space or comment between `#` and identifier + + 1 │ class A { + > 2 │ # test; + │ ^ + 3 │ } + 4 │ + + i remove the space here + +private_name_with_space.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the class property, but found none + + 1 │ class A { + > 2 │ # test; + │ ^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.js b/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js.snap new file mode 100644 index 000000000000..2204fa54ae71 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js.snap @@ -0,0 +1,460 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({:y} = {}); +({=y} = {}); +({:="test"} = {}); +({:=} = {}); +({ a b } = {}); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@1..2 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: missing (required), + colon_token: COLON@2..3 ":" [] [], + pattern: JsIdentifierAssignment { + name_token: IDENT@3..4 "y" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@4..6 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@6..8 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@9..10 "}" [] [], + }, + }, + r_paren_token: R_PAREN@10..11 ")" [] [], + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@12..14 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@14..15 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: missing (required), + init: JsInitializerClause { + eq_token: EQ@15..16 "=" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "y" [] [], + }, + }, + }, + }, + ], + r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@19..21 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@21..22 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + }, + r_paren_token: R_PAREN@23..24 ")" [] [], + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@25..27 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@27..28 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: missing (required), + colon_token: COLON@28..29 ":" [] [], + pattern: missing (required), + init: JsInitializerClause { + eq_token: EQ@29..30 "=" [] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@30..36 "\"test\"" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@38..40 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@40..41 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@41..42 "}" [] [], + }, + }, + r_paren_token: R_PAREN@42..43 ")" [] [], + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@44..46 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@46..47 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: missing (required), + colon_token: COLON@47..48 ":" [] [], + pattern: missing (required), + init: JsInitializerClause { + eq_token: EQ@48..49 "=" [] [], + expression: missing (required), + }, + }, + ], + r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@51..53 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@53..54 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + }, + r_paren_token: R_PAREN@55..56 ")" [] [], + }, + semicolon_token: SEMICOLON@56..57 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@57..59 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@61..63 "a" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + missing separator, + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@63..65 "b" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@65..67 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@67..69 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@69..70 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@70..71 "}" [] [], + }, + }, + r_paren_token: R_PAREN@71..72 ")" [] [], + }, + semicolon_token: SEMICOLON@72..73 ";" [] [], + }, + ], + eof_token: EOF@73..74 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..74 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..73 + 0: JS_EXPRESSION_STATEMENT@0..12 + 0: JS_PARENTHESIZED_EXPRESSION@0..11 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..10 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..6 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@2..4 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@2..4 + 0: (empty) + 1: COLON@2..3 ":" [] [] + 2: JS_IDENTIFIER_ASSIGNMENT@3..4 + 0: IDENT@3..4 "y" [] [] + 3: (empty) + 2: R_CURLY@4..6 "}" [] [Whitespace(" ")] + 1: EQ@6..8 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@8..10 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..9 + 2: R_CURLY@9..10 "}" [] [] + 2: R_PAREN@10..11 ")" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@12..25 + 0: JS_PARENTHESIZED_EXPRESSION@12..24 + 0: L_PAREN@12..14 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@14..23 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@14..19 + 0: L_CURLY@14..15 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@15..17 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@15..17 + 0: (empty) + 1: JS_INITIALIZER_CLAUSE@15..17 + 0: EQ@15..16 "=" [] [] + 1: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "y" [] [] + 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] + 1: EQ@19..21 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@21..23 + 0: L_CURLY@21..22 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@22..22 + 2: R_CURLY@22..23 "}" [] [] + 2: R_PAREN@23..24 ")" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@25..44 + 0: JS_PARENTHESIZED_EXPRESSION@25..43 + 0: L_PAREN@25..27 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@27..42 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@27..38 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@28..36 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@28..36 + 0: (empty) + 1: COLON@28..29 ":" [] [] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@29..36 + 0: EQ@29..30 "=" [] [] + 1: JS_STRING_LITERAL_EXPRESSION@30..36 + 0: JS_STRING_LITERAL@30..36 "\"test\"" [] [] + 2: R_CURLY@36..38 "}" [] [Whitespace(" ")] + 1: EQ@38..40 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@40..42 + 0: L_CURLY@40..41 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@41..41 + 2: R_CURLY@41..42 "}" [] [] + 2: R_PAREN@42..43 ")" [] [] + 1: SEMICOLON@43..44 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@44..57 + 0: JS_PARENTHESIZED_EXPRESSION@44..56 + 0: L_PAREN@44..46 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@46..55 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@46..51 + 0: L_CURLY@46..47 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@47..49 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@47..49 + 0: (empty) + 1: COLON@47..48 ":" [] [] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@48..49 + 0: EQ@48..49 "=" [] [] + 1: (empty) + 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] + 1: EQ@51..53 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@53..55 + 0: L_CURLY@53..54 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@54..54 + 2: R_CURLY@54..55 "}" [] [] + 2: R_PAREN@55..56 ")" [] [] + 1: SEMICOLON@56..57 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@57..73 + 0: JS_PARENTHESIZED_EXPRESSION@57..72 + 0: L_PAREN@57..59 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@59..71 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@59..67 + 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@61..65 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@61..63 + 0: JS_IDENTIFIER_ASSIGNMENT@61..63 + 0: IDENT@61..63 "a" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@63..65 + 0: JS_IDENTIFIER_ASSIGNMENT@63..65 + 0: IDENT@63..65 "b" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@65..67 "}" [] [Whitespace(" ")] + 1: EQ@67..69 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@69..71 + 0: L_CURLY@69..70 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@70..70 + 2: R_CURLY@70..71 "}" [] [] + 2: R_PAREN@71..72 ")" [] [] + 1: SEMICOLON@72..73 ";" [] [] + 4: EOF@73..74 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +property_assignment_target_err.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. + + > 1 │ ({:y} = {}); + │ ^ + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + + i Expected an identifier, a string literal, a number literal, or a computed property here. + + > 1 │ ({:y} = {}); + │ ^ + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + +property_assignment_target_err.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found '='. + + 1 │ ({:y} = {}); + > 2 │ ({=y} = {}); + │ ^ + 3 │ ({:="test"} = {}); + 4 │ ({:=} = {}); + + i Expected an identifier here. + + 1 │ ({:y} = {}); + > 2 │ ({=y} = {}); + │ ^ + 3 │ ({:="test"} = {}); + 4 │ ({:=} = {}); + +property_assignment_target_err.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. + + 1 │ ({:y} = {}); + 2 │ ({=y} = {}); + > 3 │ ({:="test"} = {}); + │ ^ + 4 │ ({:=} = {}); + 5 │ ({ a b } = {}); + + i Expected an identifier, a string literal, a number literal, or a computed property here. + + 1 │ ({:y} = {}); + 2 │ ({=y} = {}); + > 3 │ ({:="test"} = {}); + │ ^ + 4 │ ({:=} = {}); + 5 │ ({ a b } = {}); + +property_assignment_target_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or an assignment target but instead found '='. + + 1 │ ({:y} = {}); + 2 │ ({=y} = {}); + > 3 │ ({:="test"} = {}); + │ ^ + 4 │ ({:=} = {}); + 5 │ ({ a b } = {}); + + i Expected an identifier, or an assignment target here. + + 1 │ ({:y} = {}); + 2 │ ({=y} = {}); + > 3 │ ({:="test"} = {}); + │ ^ + 4 │ ({:=} = {}); + 5 │ ({ a b } = {}); + +property_assignment_target_err.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. + + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ + + i Expected an identifier, a string literal, a number literal, or a computed property here. + + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ + +property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or an assignment target but instead found '='. + + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ + + i Expected an identifier, or an assignment target here. + + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ + +property_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found '}'. + + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ + + i Expected an expression, or an assignment here. + + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ + +property_assignment_target_err.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `b` + + 3 │ ({:="test"} = {}); + 4 │ ({:=} = {}); + > 5 │ ({ a b } = {}); + │ ^ + 6 │ + + i Remove b + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/regex.js b/crates/biome_js_parser/tests/js_test_suite/error/regex.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/regex.js rename to crates/biome_js_parser/tests/js_test_suite/error/regex.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/regex.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/regex.js.snap new file mode 100644 index 000000000000..b82c5d9881e6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/regex.js.snap @@ -0,0 +1,84 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +/[\p{Control}--[\t\n]]/vv; +/[\p{Control}--[\t\n]]/uv; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@0..25 "/[\\p{Control}--[\\t\\n]]/vv" [] [], + }, + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + JsExpressionStatement { + expression: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@26..52 "/[\\p{Control}--[\\t\\n]]/uv" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@52..53 ";" [] [], + }, + ], + eof_token: EOF@53..54 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..54 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..53 + 0: JS_EXPRESSION_STATEMENT@0..26 + 0: JS_REGEX_LITERAL_EXPRESSION@0..25 + 0: JS_REGEX_LITERAL@0..25 "/[\\p{Control}--[\\t\\n]]/vv" [] [] + 1: SEMICOLON@25..26 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@26..53 + 0: JS_REGEX_LITERAL_EXPRESSION@26..52 + 0: JS_REGEX_LITERAL@26..52 "/[\\p{Control}--[\\t\\n]]/uv" [Newline("\n")] [] + 1: SEMICOLON@52..53 ";" [] [] + 4: EOF@53..54 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +regex.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Duplicate flag `v`. + + > 1 │ /[\p{Control}--[\t\n]]/vv; + │ ^ + 2 │ /[\p{Control}--[\t\n]]/uv; + 3 │ + + i This flag was already used. + +regex.js:2:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid regex flag. + + 1 │ /[\p{Control}--[\t\n]]/vv; + > 2 │ /[\p{Control}--[\t\n]]/uv; + │ ^ + 3 │ + + i The 'u' and 'v' regular expression flags cannot be enabled at the same time. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.js b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js.snap new file mode 100644 index 000000000000..94786ee30386 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js.snap @@ -0,0 +1,418 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({ ... } = a); +({ ...c = "default" } = a); +({ ...{a} } = b); +({ ...rest, other_assignment } = a); +({ ...rest, } = a); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@3..7 "..." [] [Whitespace(" ")], + target: missing (required), + }, + ], + r_curly_token: R_CURLY@7..9 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@9..11 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..12 "a" [] [], + }, + }, + }, + r_paren_token: R_PAREN@12..13 ")" [] [], + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@14..16 "(" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_CURLY@16..18 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@18..21 "..." [] [], + JsIdentifierAssignment { + name_token: IDENT@21..23 "c" [] [Whitespace(" ")], + }, + EQ@23..25 "=" [] [Whitespace(" ")], + JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")], + ], + }, + ], + }, + R_CURLY@35..37 "}" [] [Whitespace(" ")], + ], + }, + EQ@37..39 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@39..40 "a" [] [], + }, + }, + ], + }, + r_paren_token: R_PAREN@40..41 ")" [] [], + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@46..49 "..." [] [], + target: JsBogusAssignment { + items: [ + L_CURLY@49..50 "{" [] [], + JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@50..51 "a" [] [], + }, + init: missing (optional), + }, + ], + R_CURLY@51..53 "}" [] [Whitespace(" ")], + ], + }, + }, + ], + r_curly_token: R_CURLY@53..55 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@55..57 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..58 "b" [] [], + }, + }, + }, + r_paren_token: R_PAREN@58..59 ")" [] [], + }, + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@60..62 "(" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_CURLY@62..64 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@64..67 "..." [] [], + JsIdentifierAssignment { + name_token: IDENT@67..71 "rest" [] [], + }, + ], + }, + COMMA@71..73 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@73..90 "other_assignment" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + }, + R_CURLY@90..92 "}" [] [Whitespace(" ")], + ], + }, + EQ@92..94 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@94..95 "a" [] [], + }, + }, + ], + }, + r_paren_token: R_PAREN@95..96 ")" [] [], + }, + semicolon_token: SEMICOLON@96..97 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@97..99 "(" [Newline("\n")] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_CURLY@99..101 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@101..104 "..." [] [], + JsIdentifierAssignment { + name_token: IDENT@104..108 "rest" [] [], + }, + ], + }, + COMMA@108..110 "," [] [Whitespace(" ")], + ], + }, + R_CURLY@110..112 "}" [] [Whitespace(" ")], + ], + }, + EQ@112..114 "=" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@114..115 "a" [] [], + }, + }, + ], + }, + r_paren_token: R_PAREN@115..116 ")" [] [], + }, + semicolon_token: SEMICOLON@116..117 ";" [] [], + }, + ], + eof_token: EOF@117..118 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..118 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..117 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_PARENTHESIZED_EXPRESSION@0..13 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..12 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..9 + 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@3..7 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@3..7 + 0: DOT3@3..7 "..." [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@7..9 "}" [] [Whitespace(" ")] + 1: EQ@9..11 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@11..12 + 0: JS_REFERENCE_IDENTIFIER@11..12 + 0: IDENT@11..12 "a" [] [] + 2: R_PAREN@12..13 ")" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..42 + 0: JS_PARENTHESIZED_EXPRESSION@14..41 + 0: L_PAREN@14..16 "(" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@16..40 + 0: JS_BOGUS@16..37 + 0: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@18..35 + 0: JS_BOGUS@18..35 + 0: DOT3@18..21 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@21..23 + 0: IDENT@21..23 "c" [] [Whitespace(" ")] + 2: EQ@23..25 "=" [] [Whitespace(" ")] + 3: JS_STRING_LITERAL@25..35 "\"default\"" [] [Whitespace(" ")] + 2: R_CURLY@35..37 "}" [] [Whitespace(" ")] + 1: EQ@37..39 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@39..40 + 0: JS_REFERENCE_IDENTIFIER@39..40 + 0: IDENT@39..40 "a" [] [] + 2: R_PAREN@40..41 ")" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@42..60 + 0: JS_PARENTHESIZED_EXPRESSION@42..59 + 0: L_PAREN@42..44 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@44..58 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@44..55 + 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@46..53 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@46..53 + 0: DOT3@46..49 "..." [] [] + 1: JS_BOGUS_ASSIGNMENT@49..53 + 0: L_CURLY@49..50 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@50..51 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@50..51 + 0: JS_IDENTIFIER_ASSIGNMENT@50..51 + 0: IDENT@50..51 "a" [] [] + 1: (empty) + 2: R_CURLY@51..53 "}" [] [Whitespace(" ")] + 2: R_CURLY@53..55 "}" [] [Whitespace(" ")] + 1: EQ@55..57 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@57..58 + 0: JS_REFERENCE_IDENTIFIER@57..58 + 0: IDENT@57..58 "b" [] [] + 2: R_PAREN@58..59 ")" [] [] + 1: SEMICOLON@59..60 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@60..97 + 0: JS_PARENTHESIZED_EXPRESSION@60..96 + 0: L_PAREN@60..62 "(" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@62..95 + 0: JS_BOGUS@62..92 + 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@64..90 + 0: JS_BOGUS@64..71 + 0: DOT3@64..67 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@67..71 + 0: IDENT@67..71 "rest" [] [] + 1: COMMA@71..73 "," [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@73..90 + 0: JS_IDENTIFIER_ASSIGNMENT@73..90 + 0: IDENT@73..90 "other_assignment" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@90..92 "}" [] [Whitespace(" ")] + 1: EQ@92..94 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@94..95 + 0: JS_REFERENCE_IDENTIFIER@94..95 + 0: IDENT@94..95 "a" [] [] + 2: R_PAREN@95..96 ")" [] [] + 1: SEMICOLON@96..97 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@97..117 + 0: JS_PARENTHESIZED_EXPRESSION@97..116 + 0: L_PAREN@97..99 "(" [Newline("\n")] [] + 1: JS_BOGUS_EXPRESSION@99..115 + 0: JS_BOGUS@99..112 + 0: L_CURLY@99..101 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@101..110 + 0: JS_BOGUS@101..108 + 0: DOT3@101..104 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@104..108 + 0: IDENT@104..108 "rest" [] [] + 1: COMMA@108..110 "," [] [Whitespace(" ")] + 2: R_CURLY@110..112 "}" [] [Whitespace(" ")] + 1: EQ@112..114 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@114..115 + 0: JS_REFERENCE_IDENTIFIER@114..115 + 0: IDENT@114..115 "a" [] [] + 2: R_PAREN@115..116 ")" [] [] + 1: SEMICOLON@116..117 ";" [] [] + 4: EOF@117..118 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +rest_property_assignment_target_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or an assignment target but instead found '}'. + + > 1 │ ({ ... } = a); + │ ^ + 2 │ ({ ...c = "default" } = a); + 3 │ ({ ...{a} } = b); + + i Expected an identifier, or an assignment target here. + + > 1 │ ({ ... } = a); + │ ^ + 2 │ ({ ...c = "default" } = a); + 3 │ ({ ...{a} } = b); + +rest_property_assignment_target_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element cannot have a default + + 1 │ ({ ... } = a); + > 2 │ ({ ...c = "default" } = a); + │ ^^^^^^^^^^^^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + + i Remove the default value here + + 1 │ ({ ... } = a); + > 2 │ ({ ...c = "default" } = a); + │ ^^^^^^^^^^^^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + + i Rest element + + 1 │ ({ ... } = a); + > 2 │ ({ ...c = "default" } = a); + │ ^^^^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + +rest_property_assignment_target_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × object and array assignment targets are not allowed in rest patterns + + 1 │ ({ ... } = a); + 2 │ ({ ...c = "default" } = a); + > 3 │ ({ ...{a} } = b); + │ ^^^ + 4 │ ({ ...rest, other_assignment } = a); + 5 │ ({ ...rest, } = a); + +rest_property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element must be the last element + + 2 │ ({ ...c = "default" } = a); + 3 │ ({ ...{a} } = b); + > 4 │ ({ ...rest, other_assignment } = a); + │ ^^^^^^^ + 5 │ ({ ...rest, } = a); + 6 │ + + i Move the rest element to the end of the pattern, right before the closing '}' + +rest_property_assignment_target_err.js:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element may not have a trailing comma + + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + > 5 │ ({ ...rest, } = a); + │ ^ + 6 │ + + i Remove the trailing comma here + + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + > 5 │ ({ ...rest, } = a); + │ ^ + 6 │ + + i Rest element + + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + > 5 │ ({ ...rest, } = a); + │ ^^^^^^^ + 6 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.js b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js.snap new file mode 100644 index 000000000000..1dc8bce33cbf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js.snap @@ -0,0 +1,577 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { ... } = a; +let { ...c = "default" } = a; +let { ...{a} } = b; +let { ...rest, other_assignment } = a; +let { ...rest2, } = a; +async function test() { + let { ...await } = a; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternRest { + dotdotdot_token: DOT3@6..10 "..." [] [Whitespace(" ")], + binding: missing (required), + }, + ], + r_curly_token: R_CURLY@10..12 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@12..14 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..15 "a" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_CURLY@21..23 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@23..26 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@26..28 "c" [] [Whitespace(" ")], + }, + EQ@28..30 "=" [] [Whitespace(" ")], + JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")], + ], + }, + ], + }, + R_CURLY@40..42 "}" [] [Whitespace(" ")], + ], + }, + JsInitializerClause { + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "a" [] [], + }, + }, + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@45..46 ";" [] [], + ], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@51..53 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternRest { + dotdotdot_token: DOT3@53..56 "..." [] [], + binding: JsBogusBinding { + items: [ + L_CURLY@56..57 "{" [] [], + JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@57..58 "a" [] [], + }, + init: missing (optional), + }, + ], + R_CURLY@58..60 "}" [] [Whitespace(" ")], + ], + }, + }, + ], + r_curly_token: R_CURLY@60..62 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@62..64 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@64..65 "b" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..66 ";" [] [], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_CURLY@71..73 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@73..76 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@76..80 "rest" [] [], + }, + ], + }, + COMMA@80..82 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@82..99 "other_assignment" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + }, + R_CURLY@99..101 "}" [] [Whitespace(" ")], + ], + }, + JsInitializerClause { + eq_token: EQ@101..103 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@103..104 "a" [] [], + }, + }, + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@104..105 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@105..110 "let" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + L_CURLY@110..112 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@112..115 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@115..120 "rest2" [] [], + }, + ], + }, + COMMA@120..122 "," [] [Whitespace(" ")], + ], + }, + R_CURLY@122..124 "}" [] [Whitespace(" ")], + ], + }, + JsInitializerClause { + eq_token: EQ@124..126 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@126..127 "a" [] [], + }, + }, + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@127..128 ";" [] [], + ], + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@128..135 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@135..144 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@144..148 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@148..149 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@151..152 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@152..159 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@159..161 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternRest { + dotdotdot_token: DOT3@161..164 "..." [] [], + binding: JsBogusBinding { + items: [ + IDENT@164..170 "await" [] [Whitespace(" ")], + ], + }, + }, + ], + r_curly_token: R_CURLY@170..172 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@172..174 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@174..175 "a" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@175..176 ";" [] [], + }, + ], + r_curly_token: R_CURLY@176..178 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@178..179 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..179 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..178 + 0: JS_VARIABLE_STATEMENT@0..16 + 0: JS_VARIABLE_DECLARATION@0..15 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..15 + 0: JS_VARIABLE_DECLARATOR@4..15 + 0: JS_OBJECT_BINDING_PATTERN@4..12 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..10 + 0: JS_OBJECT_BINDING_PATTERN_REST@6..10 + 0: DOT3@6..10 "..." [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@10..12 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@12..15 + 0: EQ@12..14 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@14..15 + 0: JS_REFERENCE_IDENTIFIER@14..15 + 0: IDENT@14..15 "a" [] [] + 1: SEMICOLON@15..16 ";" [] [] + 1: JS_BOGUS_STATEMENT@16..46 + 0: JS_BOGUS@16..45 + 0: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@21..45 + 0: JS_BOGUS@21..45 + 0: JS_BOGUS@21..42 + 0: L_CURLY@21..23 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@23..40 + 0: JS_BOGUS@23..40 + 0: DOT3@23..26 "..." [] [] + 1: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "c" [] [Whitespace(" ")] + 2: EQ@28..30 "=" [] [Whitespace(" ")] + 3: JS_STRING_LITERAL@30..40 "\"default\"" [] [Whitespace(" ")] + 2: R_CURLY@40..42 "}" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@42..45 + 0: EQ@42..44 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "a" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 2: JS_VARIABLE_STATEMENT@46..66 + 0: JS_VARIABLE_DECLARATION@46..65 + 0: (empty) + 1: LET_KW@46..51 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@51..65 + 0: JS_VARIABLE_DECLARATOR@51..65 + 0: JS_OBJECT_BINDING_PATTERN@51..62 + 0: L_CURLY@51..53 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@53..60 + 0: JS_OBJECT_BINDING_PATTERN_REST@53..60 + 0: DOT3@53..56 "..." [] [] + 1: JS_BOGUS_BINDING@56..60 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@57..58 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@57..58 + 0: JS_IDENTIFIER_BINDING@57..58 + 0: IDENT@57..58 "a" [] [] + 1: (empty) + 2: R_CURLY@58..60 "}" [] [Whitespace(" ")] + 2: R_CURLY@60..62 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@62..65 + 0: EQ@62..64 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@64..65 + 0: JS_REFERENCE_IDENTIFIER@64..65 + 0: IDENT@64..65 "b" [] [] + 1: SEMICOLON@65..66 ";" [] [] + 3: JS_BOGUS_STATEMENT@66..105 + 0: JS_BOGUS@66..104 + 0: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@71..104 + 0: JS_BOGUS@71..104 + 0: JS_BOGUS@71..101 + 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@73..99 + 0: JS_BOGUS@73..80 + 0: DOT3@73..76 "..." [] [] + 1: JS_IDENTIFIER_BINDING@76..80 + 0: IDENT@76..80 "rest" [] [] + 1: COMMA@80..82 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@82..99 + 0: JS_IDENTIFIER_BINDING@82..99 + 0: IDENT@82..99 "other_assignment" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@99..101 "}" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@101..104 + 0: EQ@101..103 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@103..104 + 0: JS_REFERENCE_IDENTIFIER@103..104 + 0: IDENT@103..104 "a" [] [] + 1: SEMICOLON@104..105 ";" [] [] + 4: JS_BOGUS_STATEMENT@105..128 + 0: JS_BOGUS@105..127 + 0: LET_KW@105..110 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@110..127 + 0: JS_BOGUS@110..127 + 0: JS_BOGUS@110..124 + 0: L_CURLY@110..112 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@112..122 + 0: JS_BOGUS@112..120 + 0: DOT3@112..115 "..." [] [] + 1: JS_IDENTIFIER_BINDING@115..120 + 0: IDENT@115..120 "rest2" [] [] + 1: COMMA@120..122 "," [] [Whitespace(" ")] + 2: R_CURLY@122..124 "}" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@124..127 + 0: EQ@124..126 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@126..127 + 0: JS_REFERENCE_IDENTIFIER@126..127 + 0: IDENT@126..127 "a" [] [] + 1: SEMICOLON@127..128 ";" [] [] + 5: JS_FUNCTION_DECLARATION@128..178 + 0: ASYNC_KW@128..135 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@135..144 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@144..148 + 0: IDENT@144..148 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@148..151 + 0: L_PAREN@148..149 "(" [] [] + 1: JS_PARAMETER_LIST@149..149 + 2: R_PAREN@149..151 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@151..178 + 0: L_CURLY@151..152 "{" [] [] + 1: JS_DIRECTIVE_LIST@152..152 + 2: JS_STATEMENT_LIST@152..176 + 0: JS_VARIABLE_STATEMENT@152..176 + 0: JS_VARIABLE_DECLARATION@152..175 + 0: (empty) + 1: LET_KW@152..159 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@159..175 + 0: JS_VARIABLE_DECLARATOR@159..175 + 0: JS_OBJECT_BINDING_PATTERN@159..172 + 0: L_CURLY@159..161 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@161..170 + 0: JS_OBJECT_BINDING_PATTERN_REST@161..170 + 0: DOT3@161..164 "..." [] [] + 1: JS_BOGUS_BINDING@164..170 + 0: IDENT@164..170 "await" [] [Whitespace(" ")] + 2: R_CURLY@170..172 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@172..175 + 0: EQ@172..174 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@174..175 + 0: JS_REFERENCE_IDENTIFIER@174..175 + 0: IDENT@174..175 "a" [] [] + 1: SEMICOLON@175..176 ";" [] [] + 3: R_CURLY@176..178 "}" [Newline("\n")] [] + 4: EOF@178..179 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +rest_property_binding_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found '}'. + + > 1 │ let { ... } = a; + │ ^ + 2 │ let { ...c = "default" } = a; + 3 │ let { ...{a} } = b; + + i Expected an identifier here. + + > 1 │ let { ... } = a; + │ ^ + 2 │ let { ...c = "default" } = a; + 3 │ let { ...{a} } = b; + +rest_property_binding_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element cannot have a default + + 1 │ let { ... } = a; + > 2 │ let { ...c = "default" } = a; + │ ^^^^^^^^^^^^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + + i Remove the default value here + + 1 │ let { ... } = a; + > 2 │ let { ...c = "default" } = a; + │ ^^^^^^^^^^^^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + + i Rest element + + 1 │ let { ... } = a; + > 2 │ let { ...c = "default" } = a; + │ ^^^^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + +rest_property_binding_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected identifier binding + + 1 │ let { ... } = a; + 2 │ let { ...c = "default" } = a; + > 3 │ let { ...{a} } = b; + │ ^^^ + 4 │ let { ...rest, other_assignment } = a; + 5 │ let { ...rest2, } = a; + + i Object rest patterns must bind to an identifier, other patterns are not allowed. + +rest_property_binding_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element must be the last element + + 2 │ let { ...c = "default" } = a; + 3 │ let { ...{a} } = b; + > 4 │ let { ...rest, other_assignment } = a; + │ ^^^^^^^ + 5 │ let { ...rest2, } = a; + 6 │ async function test() { + + i Move the rest element to the end of the pattern, right before the closing '}' + +rest_property_binding_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest element may not have a trailing comma + + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + > 5 │ let { ...rest2, } = a; + │ ^ + 6 │ async function test() { + 7 │ let { ...await } = a; + + i Remove the trailing comma here + + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + > 5 │ let { ...rest2, } = a; + │ ^ + 6 │ async function test() { + 7 │ let { ...await } = a; + + i Rest element + + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + > 5 │ let { ...rest2, } = a; + │ ^^^^^^^^ + 6 │ async function test() { + 7 │ let { ...await } = a; + +rest_property_binding_err.js:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 5 │ let { ...rest2, } = a; + 6 │ async function test() { + > 7 │ let { ...await } = a; + │ ^^^^^ + 8 │ } + 9 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/return_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/return_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js.snap new file mode 100644 index 000000000000..b71585ce3995 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js.snap @@ -0,0 +1,86 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +return; +return foo; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + RETURN_KW@0..6 "return" [] [], + SEMICOLON@6..7 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + RETURN_KW@7..15 "return" [Newline("\n")] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..18 "foo" [] [], + }, + }, + SEMICOLON@18..19 ";" [] [], + ], + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..19 + 0: JS_BOGUS_STATEMENT@0..7 + 0: RETURN_KW@0..6 "return" [] [] + 1: SEMICOLON@6..7 ";" [] [] + 1: JS_BOGUS_STATEMENT@7..19 + 0: RETURN_KW@7..15 "return" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@15..18 + 0: JS_REFERENCE_IDENTIFIER@15..18 + 0: IDENT@15..18 "foo" [] [] + 2: SEMICOLON@18..19 ";" [] [] + 4: EOF@19..20 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +return_stmt_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal return statement outside of a function + + > 1 │ return; + │ ^^^^^^^ + 2 │ return foo; + 3 │ + +return_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal return statement outside of a function + + 1 │ return; + > 2 │ return foo; + │ ^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/semicolons_err.js b/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/semicolons_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js.snap new file mode 100644 index 000000000000..a443d9a70c57 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let foo = bar throw foo + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..8 "foo" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..14 "bar" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsThrowStatement { + throw_token: THROW_KW@14..20 "throw" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..23 "foo" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_VARIABLE_STATEMENT@0..14 + 0: JS_VARIABLE_DECLARATION@0..14 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..14 + 0: JS_VARIABLE_DECLARATOR@4..14 + 0: JS_IDENTIFIER_BINDING@4..8 + 0: IDENT@4..8 "foo" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..14 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@10..14 + 0: JS_REFERENCE_IDENTIFIER@10..14 + 0: IDENT@10..14 "bar" [] [Whitespace(" ")] + 1: (empty) + 1: JS_THROW_STATEMENT@14..23 + 0: THROW_KW@14..20 "throw" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@20..23 + 0: JS_REFERENCE_IDENTIFIER@20..23 + 0: IDENT@20..23 "foo" [] [] + 2: (empty) + 4: EOF@23..24 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +semicolons_err.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ let foo = bar throw foo + │ ^^^^^ + 2 │ + + i An explicit or implicit semicolon is expected here... + + > 1 │ let foo = bar throw foo + │ ^^^^^ + 2 │ + + i ...Which is required to end this statement + + > 1 │ let foo = bar throw foo + │ ^^^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/sequence_expr.js b/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/sequence_expr.js rename to crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js.snap new file mode 100644 index 000000000000..9d268a2701dc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js.snap @@ -0,0 +1,92 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +1, 2, , 4 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..1 "1" [] [], + }, + comma_token: COMMA@1..3 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@3..4 "2" [] [], + }, + }, + comma_token: COMMA@4..6 "," [] [Whitespace(" ")], + right: missing (required), + }, + comma_token: COMMA@6..8 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@8..9 "4" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_EXPRESSION_STATEMENT@0..9 + 0: JS_SEQUENCE_EXPRESSION@0..9 + 0: JS_SEQUENCE_EXPRESSION@0..6 + 0: JS_SEQUENCE_EXPRESSION@0..4 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..1 + 0: JS_NUMBER_LITERAL@0..1 "1" [] [] + 1: COMMA@1..3 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@3..4 + 0: JS_NUMBER_LITERAL@3..4 "2" [] [] + 1: COMMA@4..6 "," [] [Whitespace(" ")] + 2: (empty) + 1: COMMA@6..8 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@8..9 + 0: JS_NUMBER_LITERAL@8..9 "4" [] [] + 1: (empty) + 4: EOF@9..10 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +sequence_expr.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ','. + + > 1 │ 1, 2, , 4 + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ 1, 2, , 4 + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_member.js b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/setter_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js.snap new file mode 100644 index 000000000000..9f2d4e24a816 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js.snap @@ -0,0 +1,119 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Setters { + set foo() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..14 "Setters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsClassMemberList [ + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@22..25 "foo" [] [], + }, + l_paren_token: L_PAREN@25..26 "(" [] [], + parameter: missing (required), + comma_token: missing (optional), + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@30..32 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@32..33 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..33 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..32 + 0: JS_CLASS_DECLARATION@0..32 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..14 + 0: IDENT@6..14 "Setters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@14..15 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@15..30 + 0: JS_SETTER_CLASS_MEMBER@15..30 + 0: JS_METHOD_MODIFIER_LIST@15..15 + 1: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@22..25 + 0: IDENT@22..25 "foo" [] [] + 3: L_PAREN@25..26 "(" [] [] + 4: (empty) + 5: (empty) + 6: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..30 "}" [] [] + 9: R_CURLY@30..32 "}" [Newline("\n")] [] + 4: EOF@32..33 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +setter_class_member.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parameter but instead found ')'. + + 1 │ class Setters { + > 2 │ set foo() {} + │ ^ + 3 │ } + 4 │ + + i Expected a parameter here. + + 1 │ class Setters { + > 2 │ set foo() {} + │ ^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.js b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/setter_class_no_body.js rename to crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js.snap new file mode 100644 index 000000000000..bd989fd00380 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js.snap @@ -0,0 +1,124 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Setters { + set foo(a) +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..14 "Setters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsClassMemberList [ + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@22..25 "foo" [] [], + }, + l_paren_token: L_PAREN@25..26 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@26..27 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@27..28 ")" [] [], + body: missing (required), + }, + ], + r_curly_token: R_CURLY@28..30 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_CLASS_DECLARATION@0..30 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..14 + 0: IDENT@6..14 "Setters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@14..15 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@15..28 + 0: JS_SETTER_CLASS_MEMBER@15..28 + 0: JS_METHOD_MODIFIER_LIST@15..15 + 1: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@22..25 + 0: IDENT@22..25 "foo" [] [] + 3: L_PAREN@25..26 "(" [] [] + 4: JS_FORMAL_PARAMETER@26..27 + 0: JS_DECORATOR_LIST@26..26 + 1: JS_IDENTIFIER_BINDING@26..27 + 0: IDENT@26..27 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@27..28 ")" [] [] + 7: (empty) + 9: R_CURLY@28..30 "}" [Newline("\n")] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +setter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found '}'. + + 1 │ class Setters { + 2 │ set foo(a) + > 3 │ } + │ ^ + 4 │ + + i Expected a class method body here. + + 1 │ class Setters { + 2 │ set foo(a) + > 3 │ } + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/spread.js b/crates/biome_js_parser/tests/js_test_suite/error/spread.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/spread.js rename to crates/biome_js_parser/tests/js_test_suite/error/spread.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/spread.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/spread.js.snap new file mode 100644 index 000000000000..39f345c30766 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/spread.js.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[...] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@0..1 "[" [] [], + elements: JsArrayElementList [ + JsSpread { + dotdotdot_token: DOT3@1..4 "..." [] [], + argument: missing (required), + }, + ], + r_brack_token: R_BRACK@4..5 "]" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@5..6 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..6 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..5 + 0: JS_EXPRESSION_STATEMENT@0..5 + 0: JS_ARRAY_EXPRESSION@0..5 + 0: L_BRACK@0..1 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@1..4 + 0: JS_SPREAD@1..4 + 0: DOT3@1..4 "..." [] [] + 1: (empty) + 2: R_BRACK@4..5 "]" [] [] + 1: (empty) + 4: EOF@5..6 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +spread.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ']'. + + > 1 │ [...] + │ ^ + 2 │ + + i Expected an expression, or an assignment here. + + > 1 │ [...] + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.js b/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/statements_closing_curly.js rename to crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js.snap new file mode 100644 index 000000000000..772b3bb5d0fe --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js.snap @@ -0,0 +1,116 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ +"name": "troublesome-lib", +"typings": "lib/index.d.ts", +"version": "0.0.1" +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBlockStatement { + l_curly_token: L_CURLY@0..1 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@1..8 "\"name\"" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + COLON@8..10 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@10..27 "\"troublesome-lib\"" [] [], + COMMA@27..28 "," [] [], + JS_STRING_LITERAL@28..38 "\"typings\"" [Newline("\n")] [], + COLON@38..40 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@40..56 "\"lib/index.d.ts\"" [] [], + COMMA@56..57 "," [] [], + JS_STRING_LITERAL@57..67 "\"version\"" [Newline("\n")] [], + COLON@67..69 ":" [] [Whitespace(" ")], + JS_STRING_LITERAL@69..76 "\"0.0.1\"" [] [], + ], + }, + ], + r_curly_token: R_CURLY@76..78 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@78..79 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..79 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..78 + 0: JS_BLOCK_STATEMENT@0..78 + 0: L_CURLY@0..1 "{" [] [] + 1: JS_STATEMENT_LIST@1..76 + 0: JS_EXPRESSION_STATEMENT@1..8 + 0: JS_STRING_LITERAL_EXPRESSION@1..8 + 0: JS_STRING_LITERAL@1..8 "\"name\"" [Newline("\n")] [] + 1: (empty) + 1: JS_BOGUS_STATEMENT@8..76 + 0: COLON@8..10 ":" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL@10..27 "\"troublesome-lib\"" [] [] + 2: COMMA@27..28 "," [] [] + 3: JS_STRING_LITERAL@28..38 "\"typings\"" [Newline("\n")] [] + 4: COLON@38..40 ":" [] [Whitespace(" ")] + 5: JS_STRING_LITERAL@40..56 "\"lib/index.d.ts\"" [] [] + 6: COMMA@56..57 "," [] [] + 7: JS_STRING_LITERAL@57..67 "\"version\"" [Newline("\n")] [] + 8: COLON@67..69 ":" [] [Whitespace(" ")] + 9: JS_STRING_LITERAL@69..76 "\"0.0.1\"" [] [] + 2: R_CURLY@76..78 "}" [Newline("\n")] [] + 4: EOF@78..79 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +statements_closing_curly.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ { + > 2 │ "name": "troublesome-lib", + │ ^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" + + i An explicit or implicit semicolon is expected here... + + 1 │ { + > 2 │ "name": "troublesome-lib", + │ ^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" + + i ...Which is required to end this statement + + 1 │ { + > 2 │ "name": "troublesome-lib", + │ ^^^^^^^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/subscripts_err.js b/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/subscripts_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js.snap new file mode 100644 index 000000000000..501a26cc7057 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js.snap @@ -0,0 +1,171 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo()?.baz[].; +BAR`b + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsComputedMemberExpression { + object: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@3..4 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@4..5 ")" [] [], + }, + }, + operator_token: QUESTIONDOT@5..7 "?." [] [], + member: JsName { + value_token: IDENT@7..10 "baz" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@10..11 "[" [] [], + member: missing (required), + r_brack_token: R_BRACK@11..12 "]" [] [], + }, + operator_token: DOT@12..13 "." [] [], + member: missing (required), + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsTemplateExpression { + tag: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..18 "BAR" [Newline("\n")] [], + }, + }, + type_arguments: missing (optional), + l_tick_token: BACKTICK@18..19 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@19..21 "b\n" [] [], + }, + ], + r_tick_token: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@21..21 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_STATIC_MEMBER_EXPRESSION@0..13 + 0: JS_COMPUTED_MEMBER_EXPRESSION@0..12 + 0: JS_STATIC_MEMBER_EXPRESSION@0..10 + 0: JS_CALL_EXPRESSION@0..5 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@3..5 + 0: L_PAREN@3..4 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@4..4 + 2: R_PAREN@4..5 ")" [] [] + 1: QUESTIONDOT@5..7 "?." [] [] + 2: JS_NAME@7..10 + 0: IDENT@7..10 "baz" [] [] + 1: (empty) + 2: L_BRACK@10..11 "[" [] [] + 3: (empty) + 4: R_BRACK@11..12 "]" [] [] + 1: DOT@12..13 "." [] [] + 2: (empty) + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..21 + 0: JS_TEMPLATE_EXPRESSION@14..21 + 0: JS_IDENTIFIER_EXPRESSION@14..18 + 0: JS_REFERENCE_IDENTIFIER@14..18 + 0: IDENT@14..18 "BAR" [Newline("\n")] [] + 1: (empty) + 2: BACKTICK@18..19 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@19..21 + 0: JS_TEMPLATE_CHUNK_ELEMENT@19..21 + 0: TEMPLATE_CHUNK@19..21 "b\n" [] [] + 4: (empty) + 1: (empty) + 4: EOF@21..21 "" [] [] + +``` + +## Diagnostics + +``` +subscripts_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ']'. + + > 1 │ foo()?.baz[].; + │ ^ + 2 │ BAR`b + 3 │ + + i Expected an expression here. + + > 1 │ foo()?.baz[].; + │ ^ + 2 │ BAR`b + 3 │ + +subscripts_err.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier but instead found ';'. + + > 1 │ foo()?.baz[].; + │ ^ + 2 │ BAR`b + 3 │ + + i Expected an identifier here. + + > 1 │ foo()?.baz[].; + │ ^ + 2 │ BAR`b + 3 │ + +subscripts_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated template literal + + 1 │ foo()?.baz[].; + > 2 │ BAR`b + │ ^ + > 3 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_err.js b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/super_expression_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js.snap new file mode 100644 index 000000000000..028ff7954273 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js.snap @@ -0,0 +1,254 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test extends B { + test() { + super(); + super?.test(); + } +} +super(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@19..21 "B" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@21..22 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@22..29 "test" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@29..30 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@32..33 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsBogusExpression { + items: [ + SUPER_KW@33..43 "super" [Newline("\n"), Whitespace(" ")] [], + ], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@43..44 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@44..45 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsBogusExpression { + items: [ + SUPER_KW@46..56 "super" [Newline("\n"), Whitespace(" ")] [], + ], + }, + operator_token: QUESTIONDOT@56..58 "?." [] [], + member: JsName { + value_token: IDENT@58..62 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@62..63 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@63..64 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@64..65 ";" [] [], + }, + ], + r_curly_token: R_CURLY@65..69 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@69..71 "}" [Newline("\n")] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsBogusExpression { + items: [ + SUPER_KW@71..77 "super" [Newline("\n")] [], + ], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@77..78 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@78..79 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@79..80 ";" [] [], + }, + ], + eof_token: EOF@80..81 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..81 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..80 + 0: JS_CLASS_DECLARATION@0..71 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@11..21 + 0: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@19..21 + 0: JS_REFERENCE_IDENTIFIER@19..21 + 0: IDENT@19..21 "B" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@21..22 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@22..69 + 0: JS_METHOD_CLASS_MEMBER@22..69 + 0: JS_METHOD_MODIFIER_LIST@22..22 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@22..29 + 0: IDENT@22..29 "test" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@29..32 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_PARAMETER_LIST@30..30 + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@32..69 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_DIRECTIVE_LIST@33..33 + 2: JS_STATEMENT_LIST@33..65 + 0: JS_EXPRESSION_STATEMENT@33..46 + 0: JS_CALL_EXPRESSION@33..45 + 0: JS_BOGUS_EXPRESSION@33..43 + 0: SUPER_KW@33..43 "super" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@43..45 + 0: L_PAREN@43..44 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@44..44 + 2: R_PAREN@44..45 ")" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@46..65 + 0: JS_CALL_EXPRESSION@46..64 + 0: JS_STATIC_MEMBER_EXPRESSION@46..62 + 0: JS_BOGUS_EXPRESSION@46..56 + 0: SUPER_KW@46..56 "super" [Newline("\n"), Whitespace(" ")] [] + 1: QUESTIONDOT@56..58 "?." [] [] + 2: JS_NAME@58..62 + 0: IDENT@58..62 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@62..64 + 0: L_PAREN@62..63 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@63..63 + 2: R_PAREN@63..64 ")" [] [] + 1: SEMICOLON@64..65 ";" [] [] + 3: R_CURLY@65..69 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@69..71 "}" [Newline("\n")] [] + 1: JS_EXPRESSION_STATEMENT@71..80 + 0: JS_CALL_EXPRESSION@71..79 + 0: JS_BOGUS_EXPRESSION@71..77 + 0: SUPER_KW@71..77 "super" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@77..79 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@78..78 + 2: R_PAREN@78..79 ")" [] [] + 1: SEMICOLON@79..80 ";" [] [] + 4: EOF@80..81 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +super_expression_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `super` is only valid inside of a class constructor of a subclass. + + 1 │ class Test extends B { + 2 │ test() { + > 3 │ super(); + │ ^^^^^ + 4 │ super?.test(); + 5 │ } + +super_expression_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Super doesn't support optional chaining as super can never be null + + 2 │ test() { + 3 │ super(); + > 4 │ super?.test(); + │ ^^^^^ + 5 │ } + 6 │ } + +super_expression_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `super` is only valid inside of a class constructor of a subclass. + + 5 │ } + 6 │ } + > 7 │ super(); + │ ^^^^^ + 8 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.js b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.js rename to crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap new file mode 100644 index 000000000000..89c5d120376a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap @@ -0,0 +1,170 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A extends B { constructor(super()) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..18 "B" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..31 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + parameters: JsConstructorParameterList [ + JsBogusParameter { + items: [ + SUPER_KW@32..37 "super" [] [], + L_PAREN@37..38 "(" [] [], + ], + }, + ], + r_paren_token: R_PAREN@38..39 ")" [] [], + }, + body: missing (required), + }, + JsBogusMember { + items: [ + R_PAREN@39..41 ")" [] [Whitespace(" ")], + L_CURLY@41..42 "{" [] [], + ], + }, + ], + r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")], + }, + JsBogusStatement { + items: [ + R_CURLY@44..45 "}" [] [], + ], + }, + ], + eof_token: EOF@45..46 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..46 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..45 + 0: JS_CLASS_DECLARATION@0..44 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@8..18 + 0: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@16..18 + 0: JS_REFERENCE_IDENTIFIER@16..18 + 0: IDENT@16..18 "B" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..42 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..39 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..31 + 0: IDENT@20..31 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@31..39 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..38 + 0: JS_BOGUS_PARAMETER@32..38 + 0: SUPER_KW@32..37 "super" [] [] + 1: L_PAREN@37..38 "(" [] [] + 2: R_PAREN@38..39 ")" [] [] + 3: (empty) + 1: JS_BOGUS_MEMBER@39..42 + 0: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 1: L_CURLY@41..42 "{" [] [] + 9: R_CURLY@42..44 "}" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@44..45 + 0: R_CURLY@44..45 "}" [] [] + 4: EOF@45..46 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +super_expression_in_constructor_parameter_list.js:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parameter but instead found 'super('. + + > 1 │ class A extends B { constructor(super()) {} } + │ ^^^^^^ + 2 │ + + i Expected a parameter here. + + > 1 │ class A extends B { constructor(super()) {} } + │ ^^^^^^ + 2 │ + +super_expression_in_constructor_parameter_list.js:1:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found ')'. + + > 1 │ class A extends B { constructor(super()) {} } + │ ^ + 2 │ + + i Expected a class method body here. + + > 1 │ class A extends B { constructor(super()) {} } + │ ^ + 2 │ + +super_expression_in_constructor_parameter_list.js:1:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + > 1 │ class A extends B { constructor(super()) {} } + │ ^ + 2 │ + + i Expected a statement here. + + > 1 │ class A extends B { constructor(super()) {} } + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/switch_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js.snap new file mode 100644 index 000000000000..f7ccbfa5d9d0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js.snap @@ -0,0 +1,452 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +switch foo {} +switch {} +switch { var i = 0 } +switch { var i = 0; case "bar": {} } +switch (foo) { + default: {} + default: {} +} +switch (foo) { case : } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsSwitchStatement { + switch_token: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")], + l_paren_token: missing (required), + discriminant: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..11 "foo" [] [Whitespace(" ")], + }, + }, + r_paren_token: missing (required), + l_curly_token: L_CURLY@11..12 "{" [] [], + cases: JsSwitchCaseList [], + r_curly_token: R_CURLY@12..13 "}" [] [], + }, + JsSwitchStatement { + switch_token: SWITCH_KW@13..21 "switch" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + discriminant: missing (required), + r_paren_token: missing (required), + l_curly_token: L_CURLY@21..22 "{" [] [], + cases: JsSwitchCaseList [], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + JsSwitchStatement { + switch_token: SWITCH_KW@23..31 "switch" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + discriminant: missing (required), + r_paren_token: missing (required), + l_curly_token: L_CURLY@31..33 "{" [] [Whitespace(" ")], + cases: JsSwitchCaseList [ + JsCaseClause { + case_token: missing (required), + test: missing (required), + colon_token: missing (required), + consequent: JsStatementList [ + JsBogusStatement { + items: [ + VAR_KW@33..37 "var" [] [Whitespace(" ")], + IDENT@37..39 "i" [] [Whitespace(" ")], + EQ@39..41 "=" [] [Whitespace(" ")], + JS_NUMBER_LITERAL@41..43 "0" [] [Whitespace(" ")], + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + JsSwitchStatement { + switch_token: SWITCH_KW@44..52 "switch" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + discriminant: missing (required), + r_paren_token: missing (required), + l_curly_token: L_CURLY@52..54 "{" [] [Whitespace(" ")], + cases: JsSwitchCaseList [ + JsCaseClause { + case_token: missing (required), + test: missing (required), + colon_token: missing (required), + consequent: JsStatementList [ + JsBogusStatement { + items: [ + VAR_KW@54..58 "var" [] [Whitespace(" ")], + IDENT@58..60 "i" [] [Whitespace(" ")], + EQ@60..62 "=" [] [Whitespace(" ")], + JS_NUMBER_LITERAL@62..63 "0" [] [], + SEMICOLON@63..65 ";" [] [Whitespace(" ")], + ], + }, + ], + }, + JsCaseClause { + case_token: CASE_KW@65..70 "case" [] [Whitespace(" ")], + test: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@70..75 "\"bar\"" [] [], + }, + colon_token: COLON@75..77 ":" [] [Whitespace(" ")], + consequent: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@77..78 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@78..80 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + JsSwitchStatement { + switch_token: SWITCH_KW@81..89 "switch" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@89..90 "(" [] [], + discriminant: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@90..93 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@93..95 ")" [] [Whitespace(" ")], + l_curly_token: L_CURLY@95..96 "{" [] [], + cases: JsSwitchCaseList [ + JsDefaultClause { + default_token: DEFAULT_KW@96..106 "default" [Newline("\n"), Whitespace(" ")] [], + colon_token: COLON@106..108 ":" [] [Whitespace(" ")], + consequent: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@108..109 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@109..110 "}" [] [], + }, + ], + }, + JsCaseClause { + case_token: missing (required), + test: JsBogusExpression { + items: [ + DEFAULT_KW@110..120 "default" [Newline("\n"), Whitespace(" ")] [], + ], + }, + colon_token: COLON@120..122 ":" [] [Whitespace(" ")], + consequent: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@122..123 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@123..124 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@124..126 "}" [Newline("\n")] [], + }, + JsSwitchStatement { + switch_token: SWITCH_KW@126..134 "switch" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@134..135 "(" [] [], + discriminant: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@135..138 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@138..140 ")" [] [Whitespace(" ")], + l_curly_token: L_CURLY@140..142 "{" [] [Whitespace(" ")], + cases: JsSwitchCaseList [ + JsCaseClause { + case_token: CASE_KW@142..147 "case" [] [Whitespace(" ")], + test: missing (required), + colon_token: COLON@147..149 ":" [] [Whitespace(" ")], + consequent: JsStatementList [], + }, + ], + r_curly_token: R_CURLY@149..150 "}" [] [], + }, + ], + eof_token: EOF@150..151 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..151 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..150 + 0: JS_SWITCH_STATEMENT@0..13 + 0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_EXPRESSION@7..11 + 0: JS_REFERENCE_IDENTIFIER@7..11 + 0: IDENT@7..11 "foo" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@11..12 "{" [] [] + 5: JS_SWITCH_CASE_LIST@12..12 + 6: R_CURLY@12..13 "}" [] [] + 1: JS_SWITCH_STATEMENT@13..23 + 0: SWITCH_KW@13..21 "switch" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: L_CURLY@21..22 "{" [] [] + 5: JS_SWITCH_CASE_LIST@22..22 + 6: R_CURLY@22..23 "}" [] [] + 2: JS_SWITCH_STATEMENT@23..44 + 0: SWITCH_KW@23..31 "switch" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: L_CURLY@31..33 "{" [] [Whitespace(" ")] + 5: JS_SWITCH_CASE_LIST@33..43 + 0: JS_CASE_CLAUSE@33..43 + 0: (empty) + 1: (empty) + 2: (empty) + 3: JS_STATEMENT_LIST@33..43 + 0: JS_BOGUS_STATEMENT@33..43 + 0: VAR_KW@33..37 "var" [] [Whitespace(" ")] + 1: IDENT@37..39 "i" [] [Whitespace(" ")] + 2: EQ@39..41 "=" [] [Whitespace(" ")] + 3: JS_NUMBER_LITERAL@41..43 "0" [] [Whitespace(" ")] + 6: R_CURLY@43..44 "}" [] [] + 3: JS_SWITCH_STATEMENT@44..81 + 0: SWITCH_KW@44..52 "switch" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: L_CURLY@52..54 "{" [] [Whitespace(" ")] + 5: JS_SWITCH_CASE_LIST@54..80 + 0: JS_CASE_CLAUSE@54..65 + 0: (empty) + 1: (empty) + 2: (empty) + 3: JS_STATEMENT_LIST@54..65 + 0: JS_BOGUS_STATEMENT@54..65 + 0: VAR_KW@54..58 "var" [] [Whitespace(" ")] + 1: IDENT@58..60 "i" [] [Whitespace(" ")] + 2: EQ@60..62 "=" [] [Whitespace(" ")] + 3: JS_NUMBER_LITERAL@62..63 "0" [] [] + 4: SEMICOLON@63..65 ";" [] [Whitespace(" ")] + 1: JS_CASE_CLAUSE@65..80 + 0: CASE_KW@65..70 "case" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@70..75 + 0: JS_STRING_LITERAL@70..75 "\"bar\"" [] [] + 2: COLON@75..77 ":" [] [Whitespace(" ")] + 3: JS_STATEMENT_LIST@77..80 + 0: JS_BLOCK_STATEMENT@77..80 + 0: L_CURLY@77..78 "{" [] [] + 1: JS_STATEMENT_LIST@78..78 + 2: R_CURLY@78..80 "}" [] [Whitespace(" ")] + 6: R_CURLY@80..81 "}" [] [] + 4: JS_SWITCH_STATEMENT@81..126 + 0: SWITCH_KW@81..89 "switch" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@89..90 "(" [] [] + 2: JS_IDENTIFIER_EXPRESSION@90..93 + 0: JS_REFERENCE_IDENTIFIER@90..93 + 0: IDENT@90..93 "foo" [] [] + 3: R_PAREN@93..95 ")" [] [Whitespace(" ")] + 4: L_CURLY@95..96 "{" [] [] + 5: JS_SWITCH_CASE_LIST@96..124 + 0: JS_DEFAULT_CLAUSE@96..110 + 0: DEFAULT_KW@96..106 "default" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@106..108 ":" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@108..110 + 0: JS_BLOCK_STATEMENT@108..110 + 0: L_CURLY@108..109 "{" [] [] + 1: JS_STATEMENT_LIST@109..109 + 2: R_CURLY@109..110 "}" [] [] + 1: JS_CASE_CLAUSE@110..124 + 0: (empty) + 1: JS_BOGUS_EXPRESSION@110..120 + 0: DEFAULT_KW@110..120 "default" [Newline("\n"), Whitespace(" ")] [] + 2: COLON@120..122 ":" [] [Whitespace(" ")] + 3: JS_STATEMENT_LIST@122..124 + 0: JS_BLOCK_STATEMENT@122..124 + 0: L_CURLY@122..123 "{" [] [] + 1: JS_STATEMENT_LIST@123..123 + 2: R_CURLY@123..124 "}" [] [] + 6: R_CURLY@124..126 "}" [Newline("\n")] [] + 5: JS_SWITCH_STATEMENT@126..150 + 0: SWITCH_KW@126..134 "switch" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@134..135 "(" [] [] + 2: JS_IDENTIFIER_EXPRESSION@135..138 + 0: JS_REFERENCE_IDENTIFIER@135..138 + 0: IDENT@135..138 "foo" [] [] + 3: R_PAREN@138..140 ")" [] [Whitespace(" ")] + 4: L_CURLY@140..142 "{" [] [Whitespace(" ")] + 5: JS_SWITCH_CASE_LIST@142..149 + 0: JS_CASE_CLAUSE@142..149 + 0: CASE_KW@142..147 "case" [] [Whitespace(" ")] + 1: (empty) + 2: COLON@147..149 ":" [] [Whitespace(" ")] + 3: JS_STATEMENT_LIST@149..149 + 6: R_CURLY@149..150 "}" [] [] + 4: EOF@150..151 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +switch_stmt_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `foo` + + > 1 │ switch foo {} + │ ^^^ + 2 │ switch {} + 3 │ switch { var i = 0 } + + i Remove foo + +switch_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + > 1 │ switch foo {} + │ ^ + 2 │ switch {} + 3 │ switch { var i = 0 } + + i Remove { + +switch_stmt_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `{` + + 1 │ switch foo {} + > 2 │ switch {} + │ ^ + 3 │ switch { var i = 0 } + 4 │ switch { var i = 0; case "bar": {} } + + i Remove { + +switch_stmt_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `{` + + 1 │ switch foo {} + 2 │ switch {} + > 3 │ switch { var i = 0 } + │ ^ + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { + + i Remove { + +switch_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a default, or a case but instead found 'var i = 0'. + + 1 │ switch foo {} + 2 │ switch {} + > 3 │ switch { var i = 0 } + │ ^^^^^^^^^ + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { + + i Expected a default, or a case here. + + 1 │ switch foo {} + 2 │ switch {} + > 3 │ switch { var i = 0 } + │ ^^^^^^^^^ + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { + +switch_stmt_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `{` + + 2 │ switch {} + 3 │ switch { var i = 0 } + > 4 │ switch { var i = 0; case "bar": {} } + │ ^ + 5 │ switch (foo) { + 6 │ default: {} + + i Remove { + +switch_stmt_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a default, or a case but instead found 'var i = 0;'. + + 2 │ switch {} + 3 │ switch { var i = 0 } + > 4 │ switch { var i = 0; case "bar": {} } + │ ^^^^^^^^^^ + 5 │ switch (foo) { + 6 │ default: {} + + i Expected a default, or a case here. + + 2 │ switch {} + 3 │ switch { var i = 0 } + > 4 │ switch { var i = 0; case "bar": {} } + │ ^^^^^^^^^^ + 5 │ switch (foo) { + 6 │ default: {} + +switch_stmt_err.js:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Multiple default clauses inside of a switch statement are not allowed + + 5 │ switch (foo) { + 6 │ default: {} + > 7 │ default: {} + │ ^^^^^^^^^^^ + 8 │ } + 9 │ switch (foo) { case : } + + i a second clause here is not allowed + + 5 │ switch (foo) { + 6 │ default: {} + > 7 │ default: {} + │ ^^^^^^^^^^^ + 8 │ } + 9 │ switch (foo) { case : } + + i the first default clause is defined here + + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { + > 6 │ default: {} + │ ^^^^^^^^^^^ + 7 │ default: {} + 8 │ } + +switch_stmt_err.js:9:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ':'. + + 7 │ default: {} + 8 │ } + > 9 │ switch (foo) { case : } + │ ^ + 10 │ + + i Expected an expression here. + + 7 │ default: {} + 8 │ } + > 9 │ switch (foo) { case : } + │ ^ + 10 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.js b/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.js rename to crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js.snap new file mode 100644 index 000000000000..85852e2b765c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js.snap @@ -0,0 +1,244 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +obj.val?.prop`template` +obj.val?.[expr]`template` +obj.func?.(args)`template` + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "obj" [] [], + }, + }, + operator_token: DOT@3..4 "." [] [], + member: JsName { + value_token: IDENT@4..7 "val" [] [], + }, + }, + operator_token: QUESTIONDOT@7..9 "?." [] [], + member: JsName { + value_token: IDENT@9..13 "prop" [] [], + }, + }, + BACKTICK@13..14 "`" [] [], + JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@14..22 "template" [] [], + }, + ], + BACKTICK@22..23 "`" [] [], + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsComputedMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..27 "obj" [Newline("\n")] [], + }, + }, + operator_token: DOT@27..28 "." [] [], + member: JsName { + value_token: IDENT@28..31 "val" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@31..33 "?." [] [], + l_brack_token: L_BRACK@33..34 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@34..38 "expr" [] [], + }, + }, + r_brack_token: R_BRACK@38..39 "]" [] [], + }, + BACKTICK@39..40 "`" [] [], + JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@40..48 "template" [] [], + }, + ], + BACKTICK@48..49 "`" [] [], + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..53 "obj" [Newline("\n")] [], + }, + }, + operator_token: DOT@53..54 "." [] [], + member: JsName { + value_token: IDENT@54..58 "func" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@58..60 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@60..61 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@61..65 "args" [] [], + }, + }, + ], + r_paren_token: R_PAREN@65..66 ")" [] [], + }, + }, + BACKTICK@66..67 "`" [] [], + JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@67..75 "template" [] [], + }, + ], + BACKTICK@75..76 "`" [] [], + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@76..77 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..77 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..76 + 0: JS_EXPRESSION_STATEMENT@0..23 + 0: JS_BOGUS_EXPRESSION@0..23 + 0: JS_STATIC_MEMBER_EXPRESSION@0..13 + 0: JS_STATIC_MEMBER_EXPRESSION@0..7 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "obj" [] [] + 1: DOT@3..4 "." [] [] + 2: JS_NAME@4..7 + 0: IDENT@4..7 "val" [] [] + 1: QUESTIONDOT@7..9 "?." [] [] + 2: JS_NAME@9..13 + 0: IDENT@9..13 "prop" [] [] + 1: BACKTICK@13..14 "`" [] [] + 2: JS_TEMPLATE_ELEMENT_LIST@14..22 + 0: JS_TEMPLATE_CHUNK_ELEMENT@14..22 + 0: TEMPLATE_CHUNK@14..22 "template" [] [] + 3: BACKTICK@22..23 "`" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@23..49 + 0: JS_BOGUS_EXPRESSION@23..49 + 0: JS_COMPUTED_MEMBER_EXPRESSION@23..39 + 0: JS_STATIC_MEMBER_EXPRESSION@23..31 + 0: JS_IDENTIFIER_EXPRESSION@23..27 + 0: JS_REFERENCE_IDENTIFIER@23..27 + 0: IDENT@23..27 "obj" [Newline("\n")] [] + 1: DOT@27..28 "." [] [] + 2: JS_NAME@28..31 + 0: IDENT@28..31 "val" [] [] + 1: QUESTIONDOT@31..33 "?." [] [] + 2: L_BRACK@33..34 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@34..38 + 0: JS_REFERENCE_IDENTIFIER@34..38 + 0: IDENT@34..38 "expr" [] [] + 4: R_BRACK@38..39 "]" [] [] + 1: BACKTICK@39..40 "`" [] [] + 2: JS_TEMPLATE_ELEMENT_LIST@40..48 + 0: JS_TEMPLATE_CHUNK_ELEMENT@40..48 + 0: TEMPLATE_CHUNK@40..48 "template" [] [] + 3: BACKTICK@48..49 "`" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@49..76 + 0: JS_BOGUS_EXPRESSION@49..76 + 0: JS_CALL_EXPRESSION@49..66 + 0: JS_STATIC_MEMBER_EXPRESSION@49..58 + 0: JS_IDENTIFIER_EXPRESSION@49..53 + 0: JS_REFERENCE_IDENTIFIER@49..53 + 0: IDENT@49..53 "obj" [Newline("\n")] [] + 1: DOT@53..54 "." [] [] + 2: JS_NAME@54..58 + 0: IDENT@54..58 "func" [] [] + 1: QUESTIONDOT@58..60 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@60..66 + 0: L_PAREN@60..61 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@61..65 + 0: JS_IDENTIFIER_EXPRESSION@61..65 + 0: JS_REFERENCE_IDENTIFIER@61..65 + 0: IDENT@61..65 "args" [] [] + 2: R_PAREN@65..66 ")" [] [] + 1: BACKTICK@66..67 "`" [] [] + 2: JS_TEMPLATE_ELEMENT_LIST@67..75 + 0: JS_TEMPLATE_CHUNK_ELEMENT@67..75 + 0: TEMPLATE_CHUNK@67..75 "template" [] [] + 3: BACKTICK@75..76 "`" [] [] + 1: (empty) + 4: EOF@76..77 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +template_after_optional_chain.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Tagged template expressions are not permitted in an optional chain. + + > 1 │ obj.val?.prop`template` + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ obj.val?.[expr]`template` + 3 │ obj.func?.(args)`template` + +template_after_optional_chain.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Tagged template expressions are not permitted in an optional chain. + + 1 │ obj.val?.prop`template` + > 2 │ obj.val?.[expr]`template` + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ obj.func?.(args)`template` + 4 │ + +template_after_optional_chain.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Tagged template expressions are not permitted in an optional chain. + + 1 │ obj.val?.prop`template` + 2 │ obj.val?.[expr]`template` + > 3 │ obj.func?.(args)`template` + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal.js b/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/template_literal.js rename to crates/biome_js_parser/tests/js_test_suite/error/template_literal.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js.snap new file mode 100644 index 000000000000..b65f997476f2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js.snap @@ -0,0 +1,195 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = `foo ${}` +let b = `${a a}` + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@8..9 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@9..13 "foo " [] [], + }, + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@13..15 "${" [] [], + expression: missing (required), + r_curly_token: R_CURLY@15..16 "}" [] [], + }, + ], + r_tick_token: BACKTICK@16..17 "`" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@22..24 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + BACKTICK@26..27 "`" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + DOLLAR_CURLY@27..29 "${" [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@29..31 "a" [] [Whitespace(" ")], + }, + }, + JsBogus { + items: [ + IDENT@31..32 "a" [] [], + ], + }, + R_CURLY@32..33 "}" [] [], + ], + }, + ], + }, + BACKTICK@33..34 "`" [] [], + ], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_VARIABLE_STATEMENT@0..17 + 0: JS_VARIABLE_DECLARATION@0..17 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..17 + 0: JS_VARIABLE_DECLARATOR@4..17 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..17 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@8..17 + 0: (empty) + 1: (empty) + 2: BACKTICK@8..9 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@9..16 + 0: JS_TEMPLATE_CHUNK_ELEMENT@9..13 + 0: TEMPLATE_CHUNK@9..13 "foo " [] [] + 1: JS_TEMPLATE_ELEMENT@13..16 + 0: DOLLAR_CURLY@13..15 "${" [] [] + 1: (empty) + 2: R_CURLY@15..16 "}" [] [] + 4: BACKTICK@16..17 "`" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@17..34 + 0: JS_VARIABLE_DECLARATION@17..34 + 0: (empty) + 1: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@22..34 + 0: JS_VARIABLE_DECLARATOR@22..34 + 0: JS_IDENTIFIER_BINDING@22..24 + 0: IDENT@22..24 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@24..34 + 0: EQ@24..26 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@26..34 + 0: BACKTICK@26..27 "`" [] [] + 1: JS_BOGUS@27..33 + 0: JS_BOGUS@27..33 + 0: DOLLAR_CURLY@27..29 "${" [] [] + 1: JS_IDENTIFIER_EXPRESSION@29..31 + 0: JS_REFERENCE_IDENTIFIER@29..31 + 0: IDENT@29..31 "a" [] [Whitespace(" ")] + 2: JS_BOGUS@31..32 + 0: IDENT@31..32 "a" [] [] + 3: R_CURLY@32..33 "}" [] [] + 2: BACKTICK@33..34 "`" [] [] + 1: (empty) + 4: EOF@34..35 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +template_literal.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '}'. + + > 1 │ let a = `foo ${}` + │ ^ + 2 │ let b = `${a a}` + 3 │ + + i Expected an expression here. + + > 1 │ let a = `foo ${}` + │ ^ + 2 │ let b = `${a a}` + 3 │ + +template_literal.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `a` + + 1 │ let a = `foo ${}` + > 2 │ let b = `${a a}` + │ ^ + 3 │ + + i Remove a + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.js b/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.js rename to crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js.snap new file mode 100644 index 000000000000..fab9a7659dbd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = `${foo} bar + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@8..9 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@9..11 "${" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..14 "foo" [] [], + }, + }, + r_curly_token: R_CURLY@14..15 "}" [] [], + }, + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@15..20 " bar\n" [] [], + }, + ], + r_tick_token: missing (required), + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@20..20 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_VARIABLE_STATEMENT@0..20 + 0: JS_VARIABLE_DECLARATION@0..20 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..20 + 0: JS_VARIABLE_DECLARATOR@4..20 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..20 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@8..20 + 0: (empty) + 1: (empty) + 2: BACKTICK@8..9 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@9..20 + 0: JS_TEMPLATE_ELEMENT@9..15 + 0: DOLLAR_CURLY@9..11 "${" [] [] + 1: JS_IDENTIFIER_EXPRESSION@11..14 + 0: JS_REFERENCE_IDENTIFIER@11..14 + 0: IDENT@11..14 "foo" [] [] + 2: R_CURLY@14..15 "}" [] [] + 1: JS_TEMPLATE_CHUNK_ELEMENT@15..20 + 0: TEMPLATE_CHUNK@15..20 " bar\n" [] [] + 4: (empty) + 1: (empty) + 4: EOF@20..20 "" [] [] + +``` + +## Diagnostics + +``` +template_literal_unterminated.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated template literal + + > 1 │ let a = `${foo} bar + │ ^^^^ + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/throw_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js.snap new file mode 100644 index 000000000000..413c99943cd3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js.snap @@ -0,0 +1,134 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +throw +new Error("oh no :(") +throw; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsThrowStatement { + throw_token: THROW_KW@0..5 "throw" [] [], + argument: missing (required), + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@5..10 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..15 "Error" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@15..16 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@16..26 "\"oh no :(\"" [] [], + }, + ], + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsThrowStatement { + throw_token: THROW_KW@27..33 "throw" [Newline("\n")] [], + argument: missing (required), + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_THROW_STATEMENT@0..5 + 0: THROW_KW@0..5 "throw" [] [] + 1: (empty) + 2: (empty) + 1: JS_EXPRESSION_STATEMENT@5..27 + 0: JS_NEW_EXPRESSION@5..27 + 0: NEW_KW@5..10 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@10..15 + 0: JS_REFERENCE_IDENTIFIER@10..15 + 0: IDENT@10..15 "Error" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@15..27 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@16..26 + 0: JS_STRING_LITERAL_EXPRESSION@16..26 + 0: JS_STRING_LITERAL@16..26 "\"oh no :(\"" [] [] + 2: R_PAREN@26..27 ")" [] [] + 1: (empty) + 2: JS_THROW_STATEMENT@27..34 + 0: THROW_KW@27..33 "throw" [Newline("\n")] [] + 1: (empty) + 2: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +throw_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Linebreaks between a throw statement and the error to be thrown are not allowed + + 1 │ throw + > 2 │ new Error("oh no :(") + │ ^^^ + 3 │ throw; + 4 │ + + i A linebreak is not allowed here + + i Help: did you mean to throw this? + + 1 │ throw + > 2 │ new Error("oh no :(") + │ ^^^ + 3 │ throw; + 4 │ + +throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ';'. + + 1 │ throw + 2 │ new Error("oh no :(") + > 3 │ throw; + │ ^ + 4 │ + + i Expected an expression here. + + 1 │ throw + 2 │ new Error("oh no :(") + > 3 │ throw; + │ ^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap new file mode 100644 index 000000000000..cb56e9d3bc6e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap @@ -0,0 +1,266 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@28..39 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@39..40 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + }, + ], + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@42..51 "abstract" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@51..57 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@57..58 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + TsGetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@60..69 "abstract" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@69..73 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@73..79 "getter" [] [], + }, + l_paren_token: L_PAREN@79..80 "(" [] [], + r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], + return_type: missing (optional), + semicolon_token: missing (optional), + }, + TsSetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@82..91 "abstract" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@91..95 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@95..101 "setter" [] [], + }, + l_paren_token: L_PAREN@101..102 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@102..107 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], + semicolon_token: missing (optional), + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@109..118 "abstract" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@118..123 "prop" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@123..124 "}" [] [], + }, + ], + eof_token: EOF@124..125 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..125 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..124 + 0: JS_CLASS_DECLARATION@0..124 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@19..123 + 0: JS_BOGUS_MEMBER@19..42 + 0: JS_BOGUS@19..28 + 0: TS_ABSTRACT_MODIFIER@19..28 + 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@28..39 + 0: IDENT@28..39 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@39..42 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@40..40 + 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@42..60 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@42..51 + 0: TS_ABSTRACT_MODIFIER@42..51 + 0: ABSTRACT_KW@42..51 "abstract" [] [Whitespace(" ")] + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@51..57 + 0: IDENT@51..57 "method" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@57..60 + 0: L_PAREN@57..58 "(" [] [] + 1: JS_PARAMETER_LIST@58..58 + 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] + 6: (empty) + 7: (empty) + 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@60..82 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@60..69 + 0: TS_ABSTRACT_MODIFIER@60..69 + 0: ABSTRACT_KW@60..69 "abstract" [] [Whitespace(" ")] + 1: GET_KW@69..73 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@73..79 + 0: IDENT@73..79 "getter" [] [] + 3: L_PAREN@79..80 "(" [] [] + 4: R_PAREN@80..82 ")" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@82..109 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@82..91 + 0: TS_ABSTRACT_MODIFIER@82..91 + 0: ABSTRACT_KW@82..91 "abstract" [] [Whitespace(" ")] + 1: SET_KW@91..95 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@95..101 + 0: IDENT@95..101 "setter" [] [] + 3: L_PAREN@101..102 "(" [] [] + 4: JS_FORMAL_PARAMETER@102..107 + 0: JS_DECORATOR_LIST@102..102 + 1: JS_IDENTIFIER_BINDING@102..107 + 0: IDENT@102..107 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@107..109 ")" [] [Whitespace(" ")] + 7: (empty) + 4: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@109..123 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@109..118 + 0: TS_ABSTRACT_MODIFIER@109..118 + 0: ABSTRACT_KW@109..118 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@118..123 + 0: IDENT@118..123 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 9: R_CURLY@123..124 "}" [] [] + 4: EOF@124..125 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found 'abstract'. + + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^ + 2 │ + + i Expected a class method body here. + + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^ + 2 │ + +ts_abstract_member_ansi.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' cannot appear on a constructor declaration. + + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^ + 2 │ + +ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the method declaration, but found none + + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^^^^^^^^^^ + 2 │ + +ts_abstract_member_ansi.ts:1:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the method declaration, but found none + + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^^^^^^^^^^^^^^ + 2 │ + +ts_abstract_member_ansi.ts:1:83 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the method declaration, but found none + + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap new file mode 100644 index 000000000000..10e02dde6045 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap @@ -0,0 +1,117 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract name!: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@33..37 "name" [] [], + }, + JsBogus { + items: [ + BANG@37..38 "!" [] [], + TsTypeAnnotation { + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@40..46 "string" [] [], + }, + }, + ], + }, + SEMICOLON@46..47 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@47..49 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_CLASS_DECLARATION@0..49 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..47 + 0: JS_BOGUS_MEMBER@18..47 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..33 + 0: TS_ABSTRACT_MODIFIER@18..33 + 0: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@33..37 + 0: IDENT@33..37 "name" [] [] + 2: JS_BOGUS@37..46 + 0: BANG@37..38 "!" [] [] + 1: TS_TYPE_ANNOTATION@38..46 + 0: COLON@38..40 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@40..46 + 0: STRING_KW@40..46 "string" [] [] + 3: SEMICOLON@46..47 ";" [] [] + 9: R_CURLY@47..49 "}" [Newline("\n")] [] + 4: EOF@49..50 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_abstract_property_cannot_be_definite.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A definite assignment operator '!' cannot appear on an 'abstract' property. + + 1 │ abstract class A { + > 2 │ abstract name!: string; + │ ^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap new file mode 100644 index 000000000000..8be8e10b4dbd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap @@ -0,0 +1,120 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract name: string = ""; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@32..36 "name" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@36..38 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@38..45 "string" [] [Whitespace(" ")], + }, + }, + JsInitializerClause { + eq_token: EQ@45..47 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@47..49 "\"\"" [] [], + }, + }, + SEMICOLON@49..50 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@52..53 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..53 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..52 + 0: JS_CLASS_DECLARATION@0..52 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..50 + 0: JS_BOGUS_MEMBER@18..50 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..32 + 0: TS_ABSTRACT_MODIFIER@18..32 + 0: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@32..36 + 0: IDENT@32..36 "name" [] [] + 2: TS_TYPE_ANNOTATION@36..45 + 0: COLON@36..38 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@38..45 + 0: STRING_KW@38..45 "string" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@45..49 + 0: EQ@45..47 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@47..49 + 0: JS_STRING_LITERAL@47..49 "\"\"" [] [] + 4: SEMICOLON@49..50 ";" [] [] + 9: R_CURLY@50..52 "}" [Newline("\n")] [] + 4: EOF@52..53 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_abstract_property_cannot_have_initiliazers.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Property cannot have an initializer because it is marked abstract. + + 1 │ abstract class A { + > 2 │ abstract name: string = ""; + │ ^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts.snap new file mode 100644 index 000000000000..c7cde39640e3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts.snap @@ -0,0 +1,104 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { async method(); } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + ASYNC_KW@18..24 "async" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@24..30 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@31..32 ")" [] [], + }, + SEMICOLON@32..34 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: TS_DECLARE_STATEMENT@0..35 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..35 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..34 + 0: JS_BOGUS_MEMBER@18..34 + 0: ASYNC_KW@18..24 "async" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@24..30 + 0: IDENT@24..30 "method" [] [] + 2: JS_PARAMETERS@30..32 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..31 + 2: R_PAREN@31..32 ")" [] [] + 3: SEMICOLON@32..34 ";" [] [Whitespace(" ")] + 9: R_CURLY@34..35 "}" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_ambient_async_method.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'async' modifier cannot be used in an ambient context. + + > 1 │ declare class A { async method(); } + │ ^^^^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts.snap new file mode 100644 index 000000000000..209642f922cc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts.snap @@ -0,0 +1,176 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { method() method2() method3() } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@18..24 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@24..25 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@27..34 "method2" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@34..35 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@35..37 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@37..44 "method3" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@47..48 "}" [] [], + }, + }, + ], + eof_token: EOF@48..49 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..49 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..48 + 0: TS_DECLARE_STATEMENT@0..48 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..48 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..47 + 0: TS_METHOD_SIGNATURE_CLASS_MEMBER@18..27 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@18..18 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@18..24 + 0: IDENT@18..24 "method" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@24..27 + 0: L_PAREN@24..25 "(" [] [] + 1: JS_PARAMETER_LIST@25..25 + 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] + 6: (empty) + 7: (empty) + 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@27..37 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@27..27 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@27..34 + 0: IDENT@27..34 "method2" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@34..37 + 0: L_PAREN@34..35 "(" [] [] + 1: JS_PARAMETER_LIST@35..35 + 2: R_PAREN@35..37 ")" [] [Whitespace(" ")] + 6: (empty) + 7: (empty) + 2: TS_METHOD_SIGNATURE_CLASS_MEMBER@37..47 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@37..37 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@37..44 + 0: IDENT@37..44 "method3" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..45 + 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 6: (empty) + 7: (empty) + 9: R_CURLY@47..48 "}" [] [] + 4: EOF@48..49 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_ambient_context_semi.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the method declaration, but found none + + > 1 │ declare class A { method() method2() method3() } + │ ^^^^^^^^ + 2 │ + +ts_ambient_context_semi.ts:1:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a semicolon to end the method declaration, but found none + + > 1 │ declare class A { method() method2() method3() } + │ ^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap new file mode 100644 index 000000000000..66fe78acb282 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap @@ -0,0 +1,218 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class T { readonly b: string = "test"; } +class T { declare readonly b: string = "test"; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "T" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@27..28 "b" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@30..37 "string" [] [Whitespace(" ")], + }, + }, + JsInitializerClause { + eq_token: EQ@37..39 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@39..45 "\"test\"" [] [], + }, + }, + SEMICOLON@45..47 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@47..48 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@48..55 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@55..57 "T" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@59..67 "declare" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@67..76 "readonly" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@76..77 "b" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@77..79 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@79..86 "string" [] [Whitespace(" ")], + }, + }, + JsInitializerClause { + eq_token: EQ@86..88 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@88..94 "\"test\"" [] [], + }, + }, + SEMICOLON@94..96 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@96..97 "}" [] [], + }, + ], + eof_token: EOF@97..98 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..98 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..97 + 0: TS_DECLARE_STATEMENT@0..48 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..48 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "T" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..47 + 0: JS_BOGUS_MEMBER@18..47 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..27 + 0: TS_READONLY_MODIFIER@18..27 + 0: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@27..28 + 0: IDENT@27..28 "b" [] [] + 2: TS_TYPE_ANNOTATION@28..37 + 0: COLON@28..30 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@30..37 + 0: STRING_KW@30..37 "string" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@37..45 + 0: EQ@37..39 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@39..45 + 0: JS_STRING_LITERAL@39..45 "\"test\"" [] [] + 4: SEMICOLON@45..47 ";" [] [Whitespace(" ")] + 9: R_CURLY@47..48 "}" [] [] + 1: JS_CLASS_DECLARATION@48..97 + 0: JS_DECORATOR_LIST@48..48 + 1: (empty) + 2: CLASS_KW@48..55 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@55..57 + 0: IDENT@55..57 "T" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@57..59 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@59..96 + 0: JS_BOGUS_MEMBER@59..96 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@59..76 + 0: TS_DECLARE_MODIFIER@59..67 + 0: DECLARE_KW@59..67 "declare" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@67..76 + 0: READONLY_KW@67..76 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@76..77 + 0: IDENT@76..77 "b" [] [] + 2: TS_TYPE_ANNOTATION@77..86 + 0: COLON@77..79 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@79..86 + 0: STRING_KW@79..86 "string" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@86..94 + 0: EQ@86..88 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@88..94 + 0: JS_STRING_LITERAL@88..94 "\"test\"" [] [] + 4: SEMICOLON@94..96 ";" [] [Whitespace(" ")] + 9: R_CURLY@96..97 "}" [] [] + 4: EOF@97..98 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_annotated_property_initializer_ambient_context.ts:1:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In ambient contexts, properties cannot have both a type annotation and an initializer. + + > 1 │ declare class T { readonly b: string = "test"; } + │ ^^^^^^^^ + 2 │ class T { declare readonly b: string = "test"; } + 3 │ + + i The type annotation is here: + + > 1 │ declare class T { readonly b: string = "test"; } + │ ^^^^^^^^ + 2 │ class T { declare readonly b: string = "test"; } + 3 │ + +ts_annotated_property_initializer_ambient_context.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In ambient contexts, properties cannot have both a type annotation and an initializer. + + 1 │ declare class T { readonly b: string = "test"; } + > 2 │ class T { declare readonly b: string = "test"; } + │ ^^^^^^^^ + 3 │ + + i The type annotation is here: + + 1 │ declare class T { readonly b: string = "test"; } + > 2 │ class T { declare readonly b: string = "test"; } + │ ^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap new file mode 100644 index 000000000000..e3b26ef66438 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap @@ -0,0 +1,128 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = (this: string) => {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@8..9 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + THIS_KW@9..13 "this" [] [], + TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@15..21 "string" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_VARIABLE_STATEMENT@0..28 + 0: JS_VARIABLE_DECLARATION@0..28 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..28 + 0: JS_VARIABLE_DECLARATOR@4..28 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..28 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@8..28 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@8..23 + 0: L_PAREN@8..9 "(" [] [] + 1: JS_PARAMETER_LIST@9..21 + 0: JS_BOGUS_PARAMETER@9..21 + 0: THIS_KW@9..13 "this" [] [] + 1: TS_TYPE_ANNOTATION@13..21 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@15..21 + 0: STRING_KW@15..21 "string" [] [] + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@23..26 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@26..28 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..27 + 3: R_CURLY@27..28 "}" [] [] + 1: (empty) + 4: EOF@28..29 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_arrow_function_this_parameter.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An arrow function cannot have a 'this' parameter. + + > 1 │ let a = (this: string) => {} + │ ^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap new file mode 100644 index 000000000000..11cef1c73a02 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap @@ -0,0 +1,225 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +a as string = "string"; +(a() as string) = "string"; + a = 3; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@7..10 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")], + }, + as_token: AS_KW@14..17 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@17..24 "string" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@24..26 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@26..34 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@35..37 "(" [Newline("\n")] [], + assignment: TsAsAssignment { + assignment: JsBogusAssignment { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@37..38 "a" [] [], + }, + }, + JsCallArguments { + l_paren_token: L_PAREN@38..39 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + ], + }, + as_token: AS_KW@41..44 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@44..50 "string" [] [], + }, + }, + r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@52..54 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@54..62 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@62..63 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + L_ANGLE@63..65 "<" [Newline("\n")] [], + TsNumberType { + number_token: NUMBER_KW@65..71 "number" [] [], + }, + R_ANGLE@71..73 ">" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@73..75 "a" [] [Whitespace(" ")], + }, + }, + ], + }, + operator_token: EQ@75..77 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@77..78 "3" [] [], + }, + }, + semicolon_token: SEMICOLON@78..79 ";" [] [], + }, + ], + eof_token: EOF@79..80 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..80 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..79 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_TYPE_ANNOTATION@5..10 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@7..10 + 0: ANY_KW@7..10 "any" [] [] + 2: (empty) + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@11..35 + 0: JS_ASSIGNMENT_EXPRESSION@11..34 + 0: TS_AS_ASSIGNMENT@11..24 + 0: JS_IDENTIFIER_ASSIGNMENT@11..14 + 0: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")] + 1: AS_KW@14..17 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@17..24 + 0: STRING_KW@17..24 "string" [] [Whitespace(" ")] + 1: EQ@24..26 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@26..34 + 0: JS_STRING_LITERAL@26..34 "\"string\"" [] [] + 1: SEMICOLON@34..35 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@35..63 + 0: JS_ASSIGNMENT_EXPRESSION@35..62 + 0: JS_PARENTHESIZED_ASSIGNMENT@35..52 + 0: L_PAREN@35..37 "(" [Newline("\n")] [] + 1: TS_AS_ASSIGNMENT@37..50 + 0: JS_BOGUS_ASSIGNMENT@37..41 + 0: JS_IDENTIFIER_EXPRESSION@37..38 + 0: JS_REFERENCE_IDENTIFIER@37..38 + 0: IDENT@37..38 "a" [] [] + 1: JS_CALL_ARGUMENTS@38..41 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@39..39 + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 1: AS_KW@41..44 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@44..50 + 0: STRING_KW@44..50 "string" [] [] + 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] + 1: EQ@52..54 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@54..62 + 0: JS_STRING_LITERAL@54..62 "\"string\"" [] [] + 1: SEMICOLON@62..63 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@63..79 + 0: JS_ASSIGNMENT_EXPRESSION@63..78 + 0: JS_BOGUS_ASSIGNMENT@63..75 + 0: L_ANGLE@63..65 "<" [Newline("\n")] [] + 1: TS_NUMBER_TYPE@65..71 + 0: NUMBER_KW@65..71 "number" [] [] + 2: R_ANGLE@71..73 ">" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_EXPRESSION@73..75 + 0: JS_REFERENCE_IDENTIFIER@73..75 + 0: IDENT@73..75 "a" [] [Whitespace(" ")] + 1: EQ@75..77 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@77..78 + 0: JS_NUMBER_LITERAL@77..78 "3" [] [] + 1: SEMICOLON@78..79 ";" [] [] + 4: EOF@79..80 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_as_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `a()` + + 1 │ let a: any; + 2 │ a as string = "string"; + > 3 │ (a() as string) = "string"; + │ ^^^ + 4 │ a = 3; + 5 │ + + i This expression cannot be assigned to + +ts_as_assignment_no_parenthesize.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to ` a` + + 2 │ a as string = "string"; + 3 │ (a() as string) = "string"; + > 4 │ a = 3; + │ ^^^^^^^^^^ + 5 │ + + i This expression cannot be assigned to + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap new file mode 100644 index 000000000000..d7a52d42ef2e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap @@ -0,0 +1,277 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { + @decorator + } +class CC { + @ + } +class @ +class C@ + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@0..6 "class" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@6..8 "C" [] [Whitespace(" ")], + }, + L_CURLY@8..9 "{" [] [], + JsBogus { + items: [ + JsDecorator { + at_token: AT@9..12 "@" [Newline("\n"), Whitespace("\t")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..21 "decorator" [] [], + }, + }, + }, + ], + }, + R_CURLY@21..24 "}" [Newline("\n"), Whitespace("\t")] [], + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@31..34 "CC" [] [Whitespace(" ")], + }, + L_CURLY@34..35 "{" [] [], + JsBogus { + items: [ + JsDecorator { + at_token: AT@35..38 "@" [Newline("\n"), Whitespace("\t")] [], + expression: missing (required), + }, + ], + }, + R_CURLY@38..41 "}" [Newline("\n"), Whitespace("\t")] [], + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@41..48 "class" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + JsDecorator { + at_token: AT@48..49 "@" [] [], + expression: JsBogusExpression { + items: [ + JsDecoratorList [], + CLASS_KW@49..56 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@56..57 "C" [] [], + }, + JsBogus { + items: [ + JsDecorator { + at_token: AT@57..58 "@" [] [], + expression: missing (required), + }, + ], + }, + ], + }, + }, + ], + }, + ], + }, + ], + eof_token: EOF@58..59 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..59 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..58 + 0: JS_BOGUS_STATEMENT@0..24 + 0: JS_DECORATOR_LIST@0..0 + 1: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "C" [] [Whitespace(" ")] + 3: L_CURLY@8..9 "{" [] [] + 4: JS_BOGUS@9..21 + 0: JS_DECORATOR@9..21 + 0: AT@9..12 "@" [Newline("\n"), Whitespace("\t")] [] + 1: JS_IDENTIFIER_EXPRESSION@12..21 + 0: JS_REFERENCE_IDENTIFIER@12..21 + 0: IDENT@12..21 "decorator" [] [] + 5: R_CURLY@21..24 "}" [Newline("\n"), Whitespace("\t")] [] + 1: JS_BOGUS_STATEMENT@24..41 + 0: JS_DECORATOR_LIST@24..24 + 1: CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@31..34 + 0: IDENT@31..34 "CC" [] [Whitespace(" ")] + 3: L_CURLY@34..35 "{" [] [] + 4: JS_BOGUS@35..38 + 0: JS_DECORATOR@35..38 + 0: AT@35..38 "@" [Newline("\n"), Whitespace("\t")] [] + 1: (empty) + 5: R_CURLY@38..41 "}" [Newline("\n"), Whitespace("\t")] [] + 2: JS_BOGUS_STATEMENT@41..58 + 0: JS_DECORATOR_LIST@41..41 + 1: CLASS_KW@41..48 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@48..58 + 0: JS_DECORATOR@48..58 + 0: AT@48..49 "@" [] [] + 1: JS_BOGUS_EXPRESSION@49..58 + 0: JS_DECORATOR_LIST@49..49 + 1: CLASS_KW@49..56 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@56..57 + 0: IDENT@56..57 "C" [] [] + 3: JS_BOGUS@57..58 + 0: JS_DECORATOR@57..58 + 0: AT@57..58 "@" [] [] + 1: (empty) + 4: EOF@58..59 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_broken_class_member_modifiers.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '}'. + + 1 │ class C { + 2 │ @decorator + > 3 │ } + │ ^ + 4 │ class CC { + 5 │ @ + + i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. + + 1 │ class C { + 2 │ @decorator + > 3 │ } + │ ^ + 4 │ class CC { + 5 │ @ + +ts_broken_class_member_modifiers.ts:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '}'. + + 4 │ class CC { + 5 │ @ + > 6 │ } + │ ^ + 7 │ class @ + 8 │ class C@ + + i Expected an expression here. + + 4 │ class CC { + 5 │ @ + > 6 │ } + │ ^ + 7 │ class @ + 8 │ class C@ + +ts_broken_class_member_modifiers.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + 5 │ @ + 6 │ } + > 7 │ class @ + │ ^^^^^^ + 8 │ class C@ + 9 │ + +ts_broken_class_member_modifiers.ts:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `@` + + 5 │ @ + 6 │ } + > 7 │ class @ + │ ^ + 8 │ class C@ + 9 │ + + i Remove @ + +ts_broken_class_member_modifiers.ts:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `@` + + 6 │ } + 7 │ class @ + > 8 │ class C@ + │ ^ + 9 │ + + i Remove @ + +ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found the end of the file. + + 7 │ class @ + 8 │ class C@ + > 9 │ + │ + + i Expected an expression here. + + 7 │ class @ + 8 │ class C@ + > 9 │ + │ + +ts_broken_class_member_modifiers.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid decorator `class C@` + + 6 │ } + 7 │ class @ + > 8 │ class C@ + │ ^^^^^^^^ + 9 │ + +ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found the end of the file. + + 7 │ class @ + 8 │ class C@ + > 9 │ + │ + + i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here. + + 7 │ class @ + 8 │ class C@ + > 9 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap new file mode 100644 index 000000000000..0cc3fd1a6a4e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap @@ -0,0 +1,104 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +try {} catch (error: Error) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsTryStatement { + try_token: TRY_KW@0..4 "try" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@4..5 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@7..13 "catch" [] [Whitespace(" ")], + declaration: JsCatchDeclaration { + l_paren_token: L_PAREN@13..14 "(" [] [], + binding: JsIdentifierBinding { + name_token: IDENT@14..19 "error" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@19..21 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@21..26 "Error" [] [], + }, + type_arguments: missing (optional), + }, + }, + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + }, + body: JsBlockStatement { + l_curly_token: L_CURLY@28..29 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_TRY_STATEMENT@0..30 + 0: TRY_KW@0..4 "try" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@4..7 + 0: L_CURLY@4..5 "{" [] [] + 1: JS_STATEMENT_LIST@5..5 + 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@7..30 + 0: CATCH_KW@7..13 "catch" [] [Whitespace(" ")] + 1: JS_CATCH_DECLARATION@13..28 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_IDENTIFIER_BINDING@14..19 + 0: IDENT@14..19 "error" [] [] + 2: TS_TYPE_ANNOTATION@19..26 + 0: COLON@19..21 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@21..26 + 0: JS_REFERENCE_IDENTIFIER@21..26 + 0: IDENT@21..26 "Error" [] [] + 1: (empty) + 3: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_STATEMENT_LIST@29..29 + 2: R_CURLY@29..30 "}" [] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_catch_declaration_non_any_unknown_type_annotation.ts:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Catch clause variable type annotation must be 'any' or 'unknown' if specified. + + > 1 │ try {} catch (error: Error) {} + │ ^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap new file mode 100644 index 000000000000..532f8992f79a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap @@ -0,0 +1,484 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + declare method(): string; + declare constructor(declare readonly prop) {} + declare get test() { return "a" } + declare set test(value: string) {} + declare [name: string]: string; + declare accessor foo: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@12..25 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@25..31 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@32..33 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@33..35 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@35..41 "string" [] [], + }, + }, + SEMICOLON@41..42 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@42..55 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@55..66 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@66..67 "(" [] [], + parameters: JsConstructorParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@67..75 "declare" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@75..84 "readonly" [] [Whitespace(" ")], + }, + ], + }, + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@84..88 "prop" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + ], + r_paren_token: R_PAREN@88..90 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@90..91 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@91..92 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + GET_KW@105..109 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@109..113 "test" [] [], + }, + L_PAREN@113..114 "(" [] [], + R_PAREN@114..116 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@116..118 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@118..125 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@125..129 "\"a\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@129..130 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@130..143 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + SET_KW@143..147 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@147..151 "test" [] [], + }, + L_PAREN@151..152 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@152..157 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@157..159 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@159..165 "string" [] [], + }, + }, + initializer: missing (optional), + }, + R_PAREN@165..167 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@167..168 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@168..169 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@169..182 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + L_BRACK@182..183 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@183..187 "name" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@187..189 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@189..195 "string" [] [], + }, + }, + }, + R_BRACK@195..196 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@196..198 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@198..204 "string" [] [], + }, + }, + SEMICOLON@204..205 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@205..218 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@218..227 "accessor" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@227..230 "foo" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@230..232 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@232..238 "string" [] [], + }, + }, + SEMICOLON@238..239 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@239..241 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@241..242 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..242 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..241 + 0: JS_CLASS_DECLARATION@0..241 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..239 + 0: JS_BOGUS_MEMBER@12..42 + 0: JS_BOGUS@12..25 + 0: TS_DECLARE_MODIFIER@12..25 + 0: DECLARE_KW@12..25 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@25..31 + 0: IDENT@25..31 "method" [] [] + 2: JS_PARAMETERS@31..33 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_PARAMETER_LIST@32..32 + 2: R_PAREN@32..33 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@33..41 + 0: COLON@33..35 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@35..41 + 0: STRING_KW@35..41 "string" [] [] + 4: SEMICOLON@41..42 ";" [] [] + 1: JS_BOGUS_MEMBER@42..92 + 0: JS_BOGUS@42..55 + 0: TS_DECLARE_MODIFIER@42..55 + 0: DECLARE_KW@42..55 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@55..66 + 0: IDENT@55..66 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@66..90 + 0: L_PAREN@66..67 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@67..88 + 0: JS_BOGUS_PARAMETER@67..88 + 0: JS_DECORATOR_LIST@67..67 + 1: JS_BOGUS@67..84 + 0: TS_DECLARE_MODIFIER@67..75 + 0: DECLARE_KW@67..75 "declare" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@75..84 + 0: READONLY_KW@75..84 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@84..88 + 0: JS_DECORATOR_LIST@84..84 + 1: JS_IDENTIFIER_BINDING@84..88 + 0: IDENT@84..88 "prop" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@88..90 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@90..92 + 0: L_CURLY@90..91 "{" [] [] + 1: JS_DIRECTIVE_LIST@91..91 + 2: JS_STATEMENT_LIST@91..91 + 3: R_CURLY@91..92 "}" [] [] + 2: JS_BOGUS_MEMBER@92..130 + 0: JS_BOGUS@92..105 + 0: TS_DECLARE_MODIFIER@92..105 + 0: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@105..109 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@109..113 + 0: IDENT@109..113 "test" [] [] + 3: L_PAREN@113..114 "(" [] [] + 4: R_PAREN@114..116 ")" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@116..130 + 0: L_CURLY@116..118 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@118..118 + 2: JS_STATEMENT_LIST@118..129 + 0: JS_RETURN_STATEMENT@118..129 + 0: RETURN_KW@118..125 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@125..129 + 0: JS_STRING_LITERAL@125..129 "\"a\"" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@129..130 "}" [] [] + 3: JS_BOGUS_MEMBER@130..169 + 0: JS_BOGUS@130..143 + 0: TS_DECLARE_MODIFIER@130..143 + 0: DECLARE_KW@130..143 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@143..147 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@147..151 + 0: IDENT@147..151 "test" [] [] + 3: L_PAREN@151..152 "(" [] [] + 4: JS_FORMAL_PARAMETER@152..165 + 0: JS_DECORATOR_LIST@152..152 + 1: JS_IDENTIFIER_BINDING@152..157 + 0: IDENT@152..157 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@157..165 + 0: COLON@157..159 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@159..165 + 0: STRING_KW@159..165 "string" [] [] + 4: (empty) + 5: R_PAREN@165..167 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@167..169 + 0: L_CURLY@167..168 "{" [] [] + 1: JS_DIRECTIVE_LIST@168..168 + 2: JS_STATEMENT_LIST@168..168 + 3: R_CURLY@168..169 "}" [] [] + 4: JS_BOGUS_MEMBER@169..205 + 0: JS_BOGUS@169..182 + 0: TS_DECLARE_MODIFIER@169..182 + 0: DECLARE_KW@169..182 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@182..183 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@183..195 + 0: JS_IDENTIFIER_BINDING@183..187 + 0: IDENT@183..187 "name" [] [] + 1: TS_TYPE_ANNOTATION@187..195 + 0: COLON@187..189 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@189..195 + 0: STRING_KW@189..195 "string" [] [] + 3: R_BRACK@195..196 "]" [] [] + 4: TS_TYPE_ANNOTATION@196..204 + 0: COLON@196..198 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@198..204 + 0: STRING_KW@198..204 "string" [] [] + 5: SEMICOLON@204..205 ";" [] [] + 5: JS_BOGUS_MEMBER@205..239 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@205..227 + 0: TS_DECLARE_MODIFIER@205..218 + 0: DECLARE_KW@205..218 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@218..227 + 0: ACCESSOR_KW@218..227 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@227..230 + 0: IDENT@227..230 "foo" [] [] + 2: TS_TYPE_ANNOTATION@230..238 + 0: COLON@230..232 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@232..238 + 0: STRING_KW@232..238 "string" [] [] + 3: SEMICOLON@238..239 ";" [] [] + 9: R_CURLY@239..241 "}" [Newline("\n")] [] + 4: EOF@241..242 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_declare_modifier_error.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier is only allowed on properties. + + 1 │ class Test { + > 2 │ declare method(): string; + │ ^^^^^^^ + 3 │ declare constructor(declare readonly prop) {} + 4 │ declare get test() { return "a" } + +ts_class_declare_modifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' cannot appear on a parameter. + + 1 │ class Test { + 2 │ declare method(): string; + > 3 │ declare constructor(declare readonly prop) {} + │ ^^^^^^^ + 4 │ declare get test() { return "a" } + 5 │ declare set test(value: string) {} + +ts_class_declare_modifier_error.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' cannot appear on a constructor declaration. + + 1 │ class Test { + 2 │ declare method(): string; + > 3 │ declare constructor(declare readonly prop) {} + │ ^^^^^^^ + 4 │ declare get test() { return "a" } + 5 │ declare set test(value: string) {} + +ts_class_declare_modifier_error.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier is only allowed on properties. + + 2 │ declare method(): string; + 3 │ declare constructor(declare readonly prop) {} + > 4 │ declare get test() { return "a" } + │ ^^^^^^^ + 5 │ declare set test(value: string) {} + 6 │ declare [name: string]: string; + +ts_class_declare_modifier_error.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier is only allowed on properties. + + 3 │ declare constructor(declare readonly prop) {} + 4 │ declare get test() { return "a" } + > 5 │ declare set test(value: string) {} + │ ^^^^^^^ + 6 │ declare [name: string]: string; + 7 │ declare accessor foo: string; + +ts_class_declare_modifier_error.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier cannot appear on an index signature. + + 4 │ declare get test() { return "a" } + 5 │ declare set test(value: string) {} + > 6 │ declare [name: string]: string; + │ ^^^^^^^ + 7 │ declare accessor foo: string; + 8 │ } + +ts_class_declare_modifier_error.ts:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' cannot be used with 'accessor' modifier. + + 5 │ declare set test(value: string) {} + 6 │ declare [name: string]: string; + > 7 │ declare accessor foo: string; + │ ^^^^^^^ + 8 │ } + 9 │ + + i 'declare' modifier + + 5 │ declare set test(value: string) {} + 6 │ declare [name: string]: string; + > 7 │ declare accessor foo: string; + │ ^^^^^^^ + 8 │ } + 9 │ + + i 'accessor' modifier + + 5 │ declare set test(value: string) {} + 6 │ declare [name: string]: string; + > 7 │ declare accessor foo: string; + │ ^^^^^^^^ + 8 │ } + 9 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap new file mode 100644 index 000000000000..e339afae431c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap @@ -0,0 +1,375 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A {} +interface Int {} +class B implements Int extends A {} +class C implements Int implements Int {} +class D implements {} +class E extends {} +class F extends E, {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@9..10 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@10..21 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@21..25 "Int" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@25..26 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@34..36 "B" [] [Whitespace(" ")], + }, + TsImplementsClause { + implements_token: IMPLEMENTS_KW@36..47 "implements" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@47..51 "Int" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + JsExtendsClause { + extends_token: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..61 "A" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + L_CURLY@61..62 "{" [] [], + JsClassMemberList [], + R_CURLY@62..63 "}" [] [], + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@63..70 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@70..72 "C" [] [Whitespace(" ")], + }, + TsImplementsClause { + implements_token: IMPLEMENTS_KW@72..83 "implements" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@83..87 "Int" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + TsImplementsClause { + implements_token: IMPLEMENTS_KW@87..98 "implements" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@98..102 "Int" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + L_CURLY@102..103 "{" [] [], + JsClassMemberList [], + R_CURLY@103..104 "}" [] [], + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@104..111 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@111..113 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: TsImplementsClause { + implements_token: IMPLEMENTS_KW@113..124 "implements" [] [Whitespace(" ")], + types: TsTypeList [], + }, + l_curly_token: L_CURLY@124..125 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@126..133 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@133..135 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@135..143 "extends" [] [Whitespace(" ")], + super_class: missing (required), + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@143..144 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@144..145 "}" [] [], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@152..154 "F" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + EXTENDS_KW@154..162 "extends" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@162..163 "E" [] [], + }, + }, + COMMA@163..165 "," [] [Whitespace(" ")], + ], + }, + L_CURLY@165..166 "{" [] [], + JsClassMemberList [], + R_CURLY@166..167 "}" [] [], + ], + }, + ], + eof_token: EOF@167..168 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..168 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..167 + 0: JS_CLASS_DECLARATION@0..10 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..9 + 9: R_CURLY@9..10 "}" [] [] + 1: TS_INTERFACE_DECLARATION@10..27 + 0: INTERFACE_KW@10..21 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@21..25 + 0: IDENT@21..25 "Int" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@25..26 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@26..26 + 6: R_CURLY@26..27 "}" [] [] + 2: JS_BOGUS_STATEMENT@27..63 + 0: JS_DECORATOR_LIST@27..27 + 1: CLASS_KW@27..34 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "B" [] [Whitespace(" ")] + 3: TS_IMPLEMENTS_CLAUSE@36..51 + 0: IMPLEMENTS_KW@36..47 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@47..51 + 0: TS_REFERENCE_TYPE@47..51 + 0: JS_REFERENCE_IDENTIFIER@47..51 + 0: IDENT@47..51 "Int" [] [Whitespace(" ")] + 1: (empty) + 4: JS_EXTENDS_CLAUSE@51..61 + 0: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@59..61 + 0: JS_REFERENCE_IDENTIFIER@59..61 + 0: IDENT@59..61 "A" [] [Whitespace(" ")] + 2: (empty) + 5: L_CURLY@61..62 "{" [] [] + 6: JS_CLASS_MEMBER_LIST@62..62 + 7: R_CURLY@62..63 "}" [] [] + 3: JS_BOGUS_STATEMENT@63..104 + 0: JS_DECORATOR_LIST@63..63 + 1: CLASS_KW@63..70 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@70..72 + 0: IDENT@70..72 "C" [] [Whitespace(" ")] + 3: TS_IMPLEMENTS_CLAUSE@72..87 + 0: IMPLEMENTS_KW@72..83 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@83..87 + 0: TS_REFERENCE_TYPE@83..87 + 0: JS_REFERENCE_IDENTIFIER@83..87 + 0: IDENT@83..87 "Int" [] [Whitespace(" ")] + 1: (empty) + 4: TS_IMPLEMENTS_CLAUSE@87..102 + 0: IMPLEMENTS_KW@87..98 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@98..102 + 0: TS_REFERENCE_TYPE@98..102 + 0: JS_REFERENCE_IDENTIFIER@98..102 + 0: IDENT@98..102 "Int" [] [Whitespace(" ")] + 1: (empty) + 5: L_CURLY@102..103 "{" [] [] + 6: JS_CLASS_MEMBER_LIST@103..103 + 7: R_CURLY@103..104 "}" [] [] + 4: JS_CLASS_DECLARATION@104..126 + 0: JS_DECORATOR_LIST@104..104 + 1: (empty) + 2: CLASS_KW@104..111 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@111..113 + 0: IDENT@111..113 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: TS_IMPLEMENTS_CLAUSE@113..124 + 0: IMPLEMENTS_KW@113..124 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@124..124 + 7: L_CURLY@124..125 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@125..125 + 9: R_CURLY@125..126 "}" [] [] + 5: JS_CLASS_DECLARATION@126..145 + 0: JS_DECORATOR_LIST@126..126 + 1: (empty) + 2: CLASS_KW@126..133 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@133..135 + 0: IDENT@133..135 "E" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@135..143 + 0: EXTENDS_KW@135..143 "extends" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 6: (empty) + 7: L_CURLY@143..144 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@144..144 + 9: R_CURLY@144..145 "}" [] [] + 6: JS_BOGUS_STATEMENT@145..167 + 0: JS_DECORATOR_LIST@145..145 + 1: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@152..154 + 0: IDENT@152..154 "F" [] [Whitespace(" ")] + 3: JS_BOGUS@154..165 + 0: EXTENDS_KW@154..162 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@162..163 + 0: JS_REFERENCE_IDENTIFIER@162..163 + 0: IDENT@162..163 "E" [] [] + 2: COMMA@163..165 "," [] [Whitespace(" ")] + 4: L_CURLY@165..166 "{" [] [] + 5: JS_CLASS_MEMBER_LIST@166..166 + 6: R_CURLY@166..167 "}" [] [] + 4: EOF@167..168 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_heritage_clause_errors.ts:3:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'extends' clause must precede 'implements' clause. + + 1 │ class A {} + 2 │ interface Int {} + > 3 │ class B implements Int extends A {} + │ ^^^^^^^^^ + 4 │ class C implements Int implements Int {} + 5 │ class D implements {} + + i This is where implements was found + + 1 │ class A {} + 2 │ interface Int {} + > 3 │ class B implements Int extends A {} + │ ^^^^^^^^^^^^^^ + 4 │ class C implements Int implements Int {} + 5 │ class D implements {} + +ts_class_heritage_clause_errors.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'implements' clause already seen. + + 2 │ interface Int {} + 3 │ class B implements Int extends A {} + > 4 │ class C implements Int implements Int {} + │ ^^^^^^^^^^^^^^ + 5 │ class D implements {} + 6 │ class E extends {} + + i first 'implements' clause + + 2 │ interface Int {} + 3 │ class B implements Int extends A {} + > 4 │ class C implements Int implements Int {} + │ ^^^^^^^^^^^^^^ + 5 │ class D implements {} + 6 │ class E extends {} + +ts_class_heritage_clause_errors.ts:5:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'implements' list cannot be empty. + + 3 │ class B implements Int extends A {} + 4 │ class C implements Int implements Int {} + > 5 │ class D implements {} + │ + 6 │ class E extends {} + 7 │ class F extends E, {} + +ts_class_heritage_clause_errors.ts:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'extends' list cannot be empty. + + 4 │ class C implements Int implements Int {} + 5 │ class D implements {} + > 6 │ class E extends {} + │ + 7 │ class F extends E, {} + 8 │ + +ts_class_heritage_clause_errors.ts:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Trailing comma not allowed. + + 5 │ class D implements {} + 6 │ class E extends {} + > 7 │ class F extends E, {} + │ ^ + 8 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap new file mode 100644 index 000000000000..cd94256313e5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + public static { } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@9..19 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + STATIC_KW@19..26 "static" [] [Whitespace(" ")], + L_CURLY@26..28 "{" [] [Whitespace(" ")], + JsStatementList [], + R_CURLY@28..29 "}" [] [], + ], + }, + ], + r_curly_token: R_CURLY@29..31 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@31..32 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..32 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..31 + 0: JS_CLASS_DECLARATION@0..31 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..29 + 0: JS_BOGUS_MEMBER@9..29 + 0: TS_ACCESSIBILITY_MODIFIER@9..19 + 0: PUBLIC_KW@9..19 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: STATIC_KW@19..26 "static" [] [Whitespace(" ")] + 2: L_CURLY@26..28 "{" [] [Whitespace(" ")] + 3: JS_STATEMENT_LIST@28..28 + 4: R_CURLY@28..29 "}" [] [] + 9: R_CURLY@29..31 "}" [Newline("\n")] [] + 4: EOF@31..32 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_initializer_with_modifiers.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Static class blocks cannot have any modifier. + + 1 │ class A { + > 2 │ public static { } + │ ^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap new file mode 100644 index 000000000000..ff4add3ddc4d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap @@ -0,0 +1,1099 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { base1; base2; } +abstract class Test extends Base { + override override base1; + declare declare a; + private protected public c; + private private d; + protected protected e; + public public f; + abstract abstract g; + static static h; + readonly readonly i; + override declare base2; + private abstract j; + abstract #j; + abstract static k; + abstract async l(); + declare async m(); + declare #l; + declare accessor p; + accessor accessor r; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..13 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@13..18 "base1" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@18..20 ";" [] [Whitespace(" ")], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..25 "base2" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@25..27 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@28..38 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@38..44 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@44..49 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@49..57 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..62 "Base" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@62..63 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@63..77 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@77..86 "override" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@86..91 "base1" [] [], + }, + SEMICOLON@91..92 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@105..113 "declare" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@113..114 "a" [] [], + }, + SEMICOLON@114..115 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@128..138 "protected" [] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@138..145 "public" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@145..146 "c" [] [], + }, + SEMICOLON@146..147 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@147..160 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@160..168 "private" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@168..169 "d" [] [], + }, + SEMICOLON@169..170 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@170..185 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@185..195 "protected" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@195..196 "e" [] [], + }, + SEMICOLON@196..197 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@197..209 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@209..216 "public" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@216..217 "f" [] [], + }, + SEMICOLON@217..218 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@218..232 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@232..241 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@241..242 "g" [] [], + }, + SEMICOLON@242..243 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@243..255 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@255..262 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@262..263 "h" [] [], + }, + SEMICOLON@263..264 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@264..278 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@278..287 "readonly" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@287..288 "i" [] [], + }, + SEMICOLON@288..289 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@289..303 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@303..311 "declare" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@311..316 "base2" [] [], + }, + SEMICOLON@316..317 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@317..330 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@330..339 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@339..340 "j" [] [], + }, + SEMICOLON@340..341 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@341..355 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@355..356 "#" [] [], + id_token: IDENT@356..357 "j" [] [], + }, + SEMICOLON@357..358 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@358..372 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@372..379 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@379..380 "k" [] [], + }, + SEMICOLON@380..381 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@381..395 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ASYNC_KW@395..401 "async" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@401..402 "l" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@402..403 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@403..404 ")" [] [], + }, + SEMICOLON@404..405 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@405..418 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + ASYNC_KW@418..424 "async" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@424..425 "m" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@425..426 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@426..427 ")" [] [], + }, + SEMICOLON@427..428 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@428..441 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@441..442 "#" [] [], + id_token: IDENT@442..443 "l" [] [], + }, + SEMICOLON@443..444 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@444..457 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@457..466 "accessor" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@466..467 "p" [] [], + }, + SEMICOLON@467..468 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@468..482 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@482..491 "accessor" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@491..492 "r" [] [], + }, + SEMICOLON@492..493 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@493..495 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@495..496 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..496 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..495 + 0: JS_CLASS_DECLARATION@0..28 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Base" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..13 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@13..27 + 0: JS_PROPERTY_CLASS_MEMBER@13..20 + 0: JS_PROPERTY_MODIFIER_LIST@13..13 + 1: JS_LITERAL_MEMBER_NAME@13..18 + 0: IDENT@13..18 "base1" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] + 1: JS_PROPERTY_CLASS_MEMBER@20..27 + 0: JS_PROPERTY_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..25 + 0: IDENT@20..25 "base2" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@25..27 ";" [] [Whitespace(" ")] + 9: R_CURLY@27..28 "}" [] [] + 1: JS_CLASS_DECLARATION@28..495 + 0: JS_DECORATOR_LIST@28..28 + 1: ABSTRACT_KW@28..38 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@38..44 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@44..49 + 0: IDENT@44..49 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@49..62 + 0: EXTENDS_KW@49..57 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@57..62 + 0: JS_REFERENCE_IDENTIFIER@57..62 + 0: IDENT@57..62 "Base" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@62..63 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@63..493 + 0: JS_BOGUS_MEMBER@63..92 + 0: JS_PROPERTY_MODIFIER_LIST@63..86 + 0: TS_OVERRIDE_MODIFIER@63..77 + 0: OVERRIDE_KW@63..77 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@77..86 + 0: OVERRIDE_KW@77..86 "override" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@86..91 + 0: IDENT@86..91 "base1" [] [] + 2: SEMICOLON@91..92 ";" [] [] + 1: JS_BOGUS_MEMBER@92..115 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@92..113 + 0: TS_DECLARE_MODIFIER@92..105 + 0: DECLARE_KW@92..105 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_DECLARE_MODIFIER@105..113 + 0: DECLARE_KW@105..113 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@113..114 + 0: IDENT@113..114 "a" [] [] + 2: SEMICOLON@114..115 ";" [] [] + 2: JS_BOGUS_MEMBER@115..147 + 0: JS_PROPERTY_MODIFIER_LIST@115..145 + 0: TS_ACCESSIBILITY_MODIFIER@115..128 + 0: PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@128..138 + 0: PROTECTED_KW@128..138 "protected" [] [Whitespace(" ")] + 2: TS_ACCESSIBILITY_MODIFIER@138..145 + 0: PUBLIC_KW@138..145 "public" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@145..146 + 0: IDENT@145..146 "c" [] [] + 2: SEMICOLON@146..147 ";" [] [] + 3: JS_BOGUS_MEMBER@147..170 + 0: JS_PROPERTY_MODIFIER_LIST@147..168 + 0: TS_ACCESSIBILITY_MODIFIER@147..160 + 0: PRIVATE_KW@147..160 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@160..168 + 0: PRIVATE_KW@160..168 "private" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@168..169 + 0: IDENT@168..169 "d" [] [] + 2: SEMICOLON@169..170 ";" [] [] + 4: JS_BOGUS_MEMBER@170..197 + 0: JS_PROPERTY_MODIFIER_LIST@170..195 + 0: TS_ACCESSIBILITY_MODIFIER@170..185 + 0: PROTECTED_KW@170..185 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@185..195 + 0: PROTECTED_KW@185..195 "protected" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@195..196 + 0: IDENT@195..196 "e" [] [] + 2: SEMICOLON@196..197 ";" [] [] + 5: JS_BOGUS_MEMBER@197..218 + 0: JS_PROPERTY_MODIFIER_LIST@197..216 + 0: TS_ACCESSIBILITY_MODIFIER@197..209 + 0: PUBLIC_KW@197..209 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@209..216 + 0: PUBLIC_KW@209..216 "public" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@216..217 + 0: IDENT@216..217 "f" [] [] + 2: SEMICOLON@217..218 ";" [] [] + 6: JS_BOGUS_MEMBER@218..243 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@218..241 + 0: TS_ABSTRACT_MODIFIER@218..232 + 0: ABSTRACT_KW@218..232 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@232..241 + 0: ABSTRACT_KW@232..241 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@241..242 + 0: IDENT@241..242 "g" [] [] + 2: SEMICOLON@242..243 ";" [] [] + 7: JS_BOGUS_MEMBER@243..264 + 0: JS_PROPERTY_MODIFIER_LIST@243..262 + 0: JS_STATIC_MODIFIER@243..255 + 0: STATIC_KW@243..255 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@255..262 + 0: STATIC_KW@255..262 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@262..263 + 0: IDENT@262..263 "h" [] [] + 2: SEMICOLON@263..264 ";" [] [] + 8: JS_BOGUS_MEMBER@264..289 + 0: JS_PROPERTY_MODIFIER_LIST@264..287 + 0: TS_READONLY_MODIFIER@264..278 + 0: READONLY_KW@264..278 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@278..287 + 0: READONLY_KW@278..287 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@287..288 + 0: IDENT@287..288 "i" [] [] + 2: SEMICOLON@288..289 ";" [] [] + 9: JS_BOGUS_MEMBER@289..317 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@289..311 + 0: TS_OVERRIDE_MODIFIER@289..303 + 0: OVERRIDE_KW@289..303 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_DECLARE_MODIFIER@303..311 + 0: DECLARE_KW@303..311 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@311..316 + 0: IDENT@311..316 "base2" [] [] + 2: SEMICOLON@316..317 ";" [] [] + 10: JS_BOGUS_MEMBER@317..341 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@317..339 + 0: TS_ACCESSIBILITY_MODIFIER@317..330 + 0: PRIVATE_KW@317..330 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@330..339 + 0: ABSTRACT_KW@330..339 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@339..340 + 0: IDENT@339..340 "j" [] [] + 2: SEMICOLON@340..341 ";" [] [] + 11: JS_BOGUS_MEMBER@341..358 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@341..355 + 0: TS_ABSTRACT_MODIFIER@341..355 + 0: ABSTRACT_KW@341..355 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@355..357 + 0: HASH@355..356 "#" [] [] + 1: IDENT@356..357 "j" [] [] + 2: SEMICOLON@357..358 ";" [] [] + 12: JS_BOGUS_MEMBER@358..381 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@358..379 + 0: TS_ABSTRACT_MODIFIER@358..372 + 0: ABSTRACT_KW@358..372 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@372..379 + 0: STATIC_KW@372..379 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@379..380 + 0: IDENT@379..380 "k" [] [] + 2: SEMICOLON@380..381 ";" [] [] + 13: JS_BOGUS_MEMBER@381..405 + 0: TS_ABSTRACT_MODIFIER@381..395 + 0: ABSTRACT_KW@381..395 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@395..401 "async" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@401..402 + 0: IDENT@401..402 "l" [] [] + 3: JS_PARAMETERS@402..404 + 0: L_PAREN@402..403 "(" [] [] + 1: JS_PARAMETER_LIST@403..403 + 2: R_PAREN@403..404 ")" [] [] + 4: SEMICOLON@404..405 ";" [] [] + 14: JS_BOGUS_MEMBER@405..428 + 0: JS_BOGUS@405..418 + 0: TS_DECLARE_MODIFIER@405..418 + 0: DECLARE_KW@405..418 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@418..424 "async" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@424..425 + 0: IDENT@424..425 "m" [] [] + 3: JS_PARAMETERS@425..427 + 0: L_PAREN@425..426 "(" [] [] + 1: JS_PARAMETER_LIST@426..426 + 2: R_PAREN@426..427 ")" [] [] + 4: SEMICOLON@427..428 ";" [] [] + 15: JS_BOGUS_MEMBER@428..444 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@428..441 + 0: TS_DECLARE_MODIFIER@428..441 + 0: DECLARE_KW@428..441 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@441..443 + 0: HASH@441..442 "#" [] [] + 1: IDENT@442..443 "l" [] [] + 2: SEMICOLON@443..444 ";" [] [] + 16: JS_BOGUS_MEMBER@444..468 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@444..466 + 0: TS_DECLARE_MODIFIER@444..457 + 0: DECLARE_KW@444..457 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@457..466 + 0: ACCESSOR_KW@457..466 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@466..467 + 0: IDENT@466..467 "p" [] [] + 2: SEMICOLON@467..468 ";" [] [] + 17: JS_BOGUS_MEMBER@468..493 + 0: JS_PROPERTY_MODIFIER_LIST@468..491 + 0: JS_ACCESSOR_MODIFIER@468..482 + 0: ACCESSOR_KW@468..482 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@482..491 + 0: ACCESSOR_KW@482..491 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@491..492 + 0: IDENT@491..492 "r" [] [] + 2: SEMICOLON@492..493 ";" [] [] + 9: R_CURLY@493..495 "}" [Newline("\n")] [] + 4: EOF@495..496 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_invalid_modifier_combinations.ts:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'override' already seen + + 1 │ class Base { base1; base2; } + 2 │ abstract class Test extends Base { + > 3 │ override override base1; + │ ^^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; + + i duplicate modifier + + 1 │ class Base { base1; base2; } + 2 │ abstract class Test extends Base { + > 3 │ override override base1; + │ ^^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; + + i first seen here + + 1 │ class Base { base1; base2; } + 2 │ abstract class Test extends Base { + > 3 │ override override base1; + │ ^^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; + +ts_class_invalid_modifier_combinations.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' already seen + + 2 │ abstract class Test extends Base { + 3 │ override override base1; + > 4 │ declare declare a; + │ ^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; + + i duplicate modifier + + 2 │ abstract class Test extends Base { + 3 │ override override base1; + > 4 │ declare declare a; + │ ^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; + + i first seen here + + 2 │ abstract class Test extends Base { + 3 │ override override base1; + > 4 │ declare declare a; + │ ^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; + +ts_class_invalid_modifier_combinations.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Accessibility modifier already seen. + + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + + i duplicate modifier + + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + + i first modifier + + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + +ts_class_invalid_modifier_combinations.ts:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Accessibility modifier already seen. + + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + + i duplicate modifier + + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + + i first modifier + + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + +ts_class_invalid_modifier_combinations.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Accessibility modifier already seen. + + 4 │ declare declare a; + 5 │ private protected public c; + > 6 │ private private d; + │ ^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; + + i duplicate modifier + + 4 │ declare declare a; + 5 │ private protected public c; + > 6 │ private private d; + │ ^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; + + i first modifier + + 4 │ declare declare a; + 5 │ private protected public c; + > 6 │ private private d; + │ ^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; + +ts_class_invalid_modifier_combinations.ts:7:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Accessibility modifier already seen. + + 5 │ private protected public c; + 6 │ private private d; + > 7 │ protected protected e; + │ ^^^^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; + + i duplicate modifier + + 5 │ private protected public c; + 6 │ private private d; + > 7 │ protected protected e; + │ ^^^^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; + + i first modifier + + 5 │ private protected public c; + 6 │ private private d; + > 7 │ protected protected e; + │ ^^^^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; + +ts_class_invalid_modifier_combinations.ts:8:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Accessibility modifier already seen. + + 6 │ private private d; + 7 │ protected protected e; + > 8 │ public public f; + │ ^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; + + i duplicate modifier + + 6 │ private private d; + 7 │ protected protected e; + > 8 │ public public f; + │ ^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; + + i first modifier + + 6 │ private private d; + 7 │ protected protected e; + > 8 │ public public f; + │ ^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; + +ts_class_invalid_modifier_combinations.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' already seen + + 7 │ protected protected e; + 8 │ public public f; + > 9 │ abstract abstract g; + │ ^^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; + + i duplicate modifier + + 7 │ protected protected e; + 8 │ public public f; + > 9 │ abstract abstract g; + │ ^^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; + + i first seen here + + 7 │ protected protected e; + 8 │ public public f; + > 9 │ abstract abstract g; + │ ^^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; + +ts_class_invalid_modifier_combinations.ts:10:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' already seen + + 8 │ public public f; + 9 │ abstract abstract g; + > 10 │ static static h; + │ ^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; + + i duplicate modifier + + 8 │ public public f; + 9 │ abstract abstract g; + > 10 │ static static h; + │ ^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; + + i first seen here + + 8 │ public public f; + 9 │ abstract abstract g; + > 10 │ static static h; + │ ^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; + +ts_class_invalid_modifier_combinations.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'readonly' already seen + + 9 │ abstract abstract g; + 10 │ static static h; + > 11 │ readonly readonly i; + │ ^^^^^^^^ + 12 │ override declare base2; + 13 │ private abstract j; + + i duplicate modifier + + 9 │ abstract abstract g; + 10 │ static static h; + > 11 │ readonly readonly i; + │ ^^^^^^^^ + 12 │ override declare base2; + 13 │ private abstract j; + + i first seen here + + 9 │ abstract abstract g; + 10 │ static static h; + > 11 │ readonly readonly i; + │ ^^^^^^^^ + 12 │ override declare base2; + 13 │ private abstract j; + +ts_class_invalid_modifier_combinations.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' cannot be used with 'override' modifier. + + 10 │ static static h; + 11 │ readonly readonly i; + > 12 │ override declare base2; + │ ^^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; + + i 'declare' modifier + + 10 │ static static h; + 11 │ readonly readonly i; + > 12 │ override declare base2; + │ ^^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; + + i 'override' modifier + + 10 │ static static h; + 11 │ readonly readonly i; + > 12 │ override declare base2; + │ ^^^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; + +ts_class_invalid_modifier_combinations.ts:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'private' cannot be used with 'abstract' modifier. + + 11 │ readonly readonly i; + 12 │ override declare base2; + > 13 │ private abstract j; + │ ^^^^^^^ + 14 │ abstract #j; + 15 │ abstract static k; + + i 'private' modifier + + 11 │ readonly readonly i; + 12 │ override declare base2; + > 13 │ private abstract j; + │ ^^^^^^^ + 14 │ abstract #j; + 15 │ abstract static k; + + i 'abstract' modifier + + 11 │ readonly readonly i; + 12 │ override declare base2; + > 13 │ private abstract j; + │ ^^^^^^^^ + 14 │ abstract #j; + 15 │ abstract static k; + +ts_class_invalid_modifier_combinations.ts:14:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' modifier cannot be used with a private identifier'. + + 12 │ override declare base2; + 13 │ private abstract j; + > 14 │ abstract #j; + │ ^^^^^^^^ + 15 │ abstract static k; + 16 │ abstract async l(); + +ts_class_invalid_modifier_combinations.ts:15:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' cannot be used with 'static' modifier. + + 13 │ private abstract j; + 14 │ abstract #j; + > 15 │ abstract static k; + │ ^^^^^^^^ + 16 │ abstract async l(); + 17 │ declare async m(); + + i 'abstract' modifier + + 13 │ private abstract j; + 14 │ abstract #j; + > 15 │ abstract static k; + │ ^^^^^^^^ + 16 │ abstract async l(); + 17 │ declare async m(); + + i 'static' modifier + + 13 │ private abstract j; + 14 │ abstract #j; + > 15 │ abstract static k; + │ ^^^^^^ + 16 │ abstract async l(); + 17 │ declare async m(); + +ts_class_invalid_modifier_combinations.ts:16:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × async members cannot be abstract + + 14 │ abstract #j; + 15 │ abstract static k; + > 16 │ abstract async l(); + │ ^^^^^^^^ + 17 │ declare async m(); + 18 │ declare #l; + +ts_class_invalid_modifier_combinations.ts:17:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier is only allowed on properties. + + 15 │ abstract static k; + 16 │ abstract async l(); + > 17 │ declare async m(); + │ ^^^^^^^ + 18 │ declare #l; + 19 │ declare accessor p; + +ts_class_invalid_modifier_combinations.ts:18:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier cannot be used with a private identifier'. + + 16 │ abstract async l(); + 17 │ declare async m(); + > 18 │ declare #l; + │ ^^^^^^^ + 19 │ declare accessor p; + 20 │ accessor accessor r; + +ts_class_invalid_modifier_combinations.ts:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' cannot be used with 'accessor' modifier. + + 17 │ declare async m(); + 18 │ declare #l; + > 19 │ declare accessor p; + │ ^^^^^^^ + 20 │ accessor accessor r; + 21 │ } + + i 'declare' modifier + + 17 │ declare async m(); + 18 │ declare #l; + > 19 │ declare accessor p; + │ ^^^^^^^ + 20 │ accessor accessor r; + 21 │ } + + i 'accessor' modifier + + 17 │ declare async m(); + 18 │ declare #l; + > 19 │ declare accessor p; + │ ^^^^^^^^ + 20 │ accessor accessor r; + 21 │ } + +ts_class_invalid_modifier_combinations.ts:20:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' already seen + + 18 │ declare #l; + 19 │ declare accessor p; + > 20 │ accessor accessor r; + │ ^^^^^^^^ + 21 │ } + 22 │ + + i duplicate modifier + + 18 │ declare #l; + 19 │ declare accessor p; + > 20 │ accessor accessor r; + │ ^^^^^^^^ + 21 │ } + 22 │ + + i first seen here + + 18 │ declare #l; + 19 │ declare accessor p; + > 20 │ accessor accessor r; + │ ^^^^^^^^ + 21 │ } + 22 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap new file mode 100644 index 000000000000..7616d237593f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap @@ -0,0 +1,141 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + readonly accessor foo: number = 1; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@23..32 "accessor" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@32..35 "foo" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@35..37 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@37..44 "number" [] [Whitespace(" ")], + }, + }, + JsInitializerClause { + eq_token: EQ@44..46 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@46..47 "1" [] [], + }, + }, + SEMICOLON@47..48 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@48..50 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@50..51 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..51 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..50 + 0: JS_CLASS_DECLARATION@0..50 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..48 + 0: JS_BOGUS_MEMBER@9..48 + 0: JS_PROPERTY_MODIFIER_LIST@9..32 + 0: TS_READONLY_MODIFIER@9..23 + 0: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@23..32 + 0: ACCESSOR_KW@23..32 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@32..35 + 0: IDENT@32..35 "foo" [] [] + 2: TS_TYPE_ANNOTATION@35..44 + 0: COLON@35..37 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@37..44 + 0: NUMBER_KW@37..44 "number" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@44..47 + 0: EQ@44..46 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@46..47 + 0: JS_NUMBER_LITERAL@46..47 "1" [] [] + 4: SEMICOLON@47..48 ";" [] [] + 9: R_CURLY@48..50 "}" [Newline("\n")] [] + 4: EOF@50..51 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_member_accessor_readonly_precedence.ts:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' must precede 'readonly' + + 1 │ class A { + > 2 │ readonly accessor foo: number = 1; + │ ^^^^^^^^ + 3 │ } + 4 │ + + i move this modifier + + 1 │ class A { + > 2 │ readonly accessor foo: number = 1; + │ ^^^^^^^^ + 3 │ } + 4 │ + + i before this modifier + + 1 │ class A { + > 2 │ readonly accessor foo: number = 1; + │ ^^^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap new file mode 100644 index 000000000000..7952af4e6449 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap @@ -0,0 +1,884 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { base1; base2; base3; base4;} +abstract class Test extends Base { + // Accessibility + readonly private a: string; + override protected base1; + static private b: string; + abstract protected d: string; + // Static + readonly static c: string; + accessor static d: string; + override static base2: string; + // Accessor + readonly accessor e: string; + override accessor f: string; + // abstract + override abstract base3: string; + // override + readonly override base4: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..13 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@13..18 "base1" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@18..20 ";" [] [Whitespace(" ")], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..25 "base2" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@25..27 ";" [] [Whitespace(" ")], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@27..32 "base3" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@32..34 ";" [] [Whitespace(" ")], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@34..39 "base4" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@39..40 ";" [] [], + }, + ], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@41..51 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@51..57 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@57..62 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@62..70 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@70..75 "Base" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@75..76 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@76..111 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessibility"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@111..119 "private" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@119..120 "a" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@120..122 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@122..128 "string" [] [], + }, + }, + SEMICOLON@128..129 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@129..143 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@143..153 "protected" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@153..158 "base1" [] [], + }, + SEMICOLON@158..159 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@159..171 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@171..179 "private" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@179..180 "b" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@180..182 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@182..188 "string" [] [], + }, + }, + SEMICOLON@188..189 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@189..203 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@203..213 "protected" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@213..214 "d" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@214..216 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@216..222 "string" [] [], + }, + }, + SEMICOLON@222..223 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@223..251 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Static"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@251..258 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@258..259 "c" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@259..261 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@261..267 "string" [] [], + }, + }, + SEMICOLON@267..268 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@268..282 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@282..289 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@289..290 "d" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@290..292 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@292..298 "string" [] [], + }, + }, + SEMICOLON@298..299 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@299..313 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@313..320 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@320..325 "base2" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@325..327 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@327..333 "string" [] [], + }, + }, + SEMICOLON@333..334 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@334..364 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessor"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@364..373 "accessor" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@373..374 "e" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@374..376 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@376..382 "string" [] [], + }, + }, + SEMICOLON@382..383 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@383..397 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@397..406 "accessor" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@406..407 "f" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@407..409 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@409..415 "string" [] [], + }, + }, + SEMICOLON@415..416 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@416..446 "override" [Newline("\n"), Whitespace(" "), Comments("// abstract"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@446..455 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@455..460 "base3" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@460..462 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@462..468 "string" [] [], + }, + }, + SEMICOLON@468..469 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@469..499 "readonly" [Newline("\n"), Whitespace(" "), Comments("// override"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@499..508 "override" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@508..513 "base4" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@513..515 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@515..521 "string" [] [], + }, + }, + SEMICOLON@521..522 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@522..524 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@524..525 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..525 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..524 + 0: JS_CLASS_DECLARATION@0..41 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Base" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..13 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@13..40 + 0: JS_PROPERTY_CLASS_MEMBER@13..20 + 0: JS_PROPERTY_MODIFIER_LIST@13..13 + 1: JS_LITERAL_MEMBER_NAME@13..18 + 0: IDENT@13..18 "base1" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] + 1: JS_PROPERTY_CLASS_MEMBER@20..27 + 0: JS_PROPERTY_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..25 + 0: IDENT@20..25 "base2" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@25..27 ";" [] [Whitespace(" ")] + 2: JS_PROPERTY_CLASS_MEMBER@27..34 + 0: JS_PROPERTY_MODIFIER_LIST@27..27 + 1: JS_LITERAL_MEMBER_NAME@27..32 + 0: IDENT@27..32 "base3" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@32..34 ";" [] [Whitespace(" ")] + 3: JS_PROPERTY_CLASS_MEMBER@34..40 + 0: JS_PROPERTY_MODIFIER_LIST@34..34 + 1: JS_LITERAL_MEMBER_NAME@34..39 + 0: IDENT@34..39 "base4" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@39..40 ";" [] [] + 9: R_CURLY@40..41 "}" [] [] + 1: JS_CLASS_DECLARATION@41..524 + 0: JS_DECORATOR_LIST@41..41 + 1: ABSTRACT_KW@41..51 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@51..57 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@57..62 + 0: IDENT@57..62 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@62..75 + 0: EXTENDS_KW@62..70 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@70..75 + 0: JS_REFERENCE_IDENTIFIER@70..75 + 0: IDENT@70..75 "Base" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@75..76 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@76..522 + 0: JS_BOGUS_MEMBER@76..129 + 0: JS_PROPERTY_MODIFIER_LIST@76..119 + 0: TS_READONLY_MODIFIER@76..111 + 0: READONLY_KW@76..111 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessibility"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@111..119 + 0: PRIVATE_KW@111..119 "private" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@119..120 + 0: IDENT@119..120 "a" [] [] + 2: TS_TYPE_ANNOTATION@120..128 + 0: COLON@120..122 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@122..128 + 0: STRING_KW@122..128 "string" [] [] + 3: SEMICOLON@128..129 ";" [] [] + 1: JS_BOGUS_MEMBER@129..159 + 0: JS_PROPERTY_MODIFIER_LIST@129..153 + 0: TS_OVERRIDE_MODIFIER@129..143 + 0: OVERRIDE_KW@129..143 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@143..153 + 0: PROTECTED_KW@143..153 "protected" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@153..158 + 0: IDENT@153..158 "base1" [] [] + 2: SEMICOLON@158..159 ";" [] [] + 2: JS_BOGUS_MEMBER@159..189 + 0: JS_PROPERTY_MODIFIER_LIST@159..179 + 0: JS_STATIC_MODIFIER@159..171 + 0: STATIC_KW@159..171 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@171..179 + 0: PRIVATE_KW@171..179 "private" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@179..180 + 0: IDENT@179..180 "b" [] [] + 2: TS_TYPE_ANNOTATION@180..188 + 0: COLON@180..182 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@182..188 + 0: STRING_KW@182..188 "string" [] [] + 3: SEMICOLON@188..189 ";" [] [] + 3: JS_BOGUS_MEMBER@189..223 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@189..213 + 0: TS_ABSTRACT_MODIFIER@189..203 + 0: ABSTRACT_KW@189..203 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@203..213 + 0: PROTECTED_KW@203..213 "protected" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@213..214 + 0: IDENT@213..214 "d" [] [] + 2: TS_TYPE_ANNOTATION@214..222 + 0: COLON@214..216 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@216..222 + 0: STRING_KW@216..222 "string" [] [] + 3: SEMICOLON@222..223 ";" [] [] + 4: JS_BOGUS_MEMBER@223..268 + 0: JS_PROPERTY_MODIFIER_LIST@223..258 + 0: TS_READONLY_MODIFIER@223..251 + 0: READONLY_KW@223..251 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Static"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@251..258 + 0: STATIC_KW@251..258 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@258..259 + 0: IDENT@258..259 "c" [] [] + 2: TS_TYPE_ANNOTATION@259..267 + 0: COLON@259..261 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@261..267 + 0: STRING_KW@261..267 "string" [] [] + 3: SEMICOLON@267..268 ";" [] [] + 5: JS_BOGUS_MEMBER@268..299 + 0: JS_PROPERTY_MODIFIER_LIST@268..289 + 0: JS_ACCESSOR_MODIFIER@268..282 + 0: ACCESSOR_KW@268..282 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@282..289 + 0: STATIC_KW@282..289 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@289..290 + 0: IDENT@289..290 "d" [] [] + 2: TS_TYPE_ANNOTATION@290..298 + 0: COLON@290..292 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@292..298 + 0: STRING_KW@292..298 "string" [] [] + 3: SEMICOLON@298..299 ";" [] [] + 6: JS_BOGUS_MEMBER@299..334 + 0: JS_PROPERTY_MODIFIER_LIST@299..320 + 0: TS_OVERRIDE_MODIFIER@299..313 + 0: OVERRIDE_KW@299..313 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@313..320 + 0: STATIC_KW@313..320 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@320..325 + 0: IDENT@320..325 "base2" [] [] + 2: TS_TYPE_ANNOTATION@325..333 + 0: COLON@325..327 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@327..333 + 0: STRING_KW@327..333 "string" [] [] + 3: SEMICOLON@333..334 ";" [] [] + 7: JS_BOGUS_MEMBER@334..383 + 0: JS_PROPERTY_MODIFIER_LIST@334..373 + 0: TS_READONLY_MODIFIER@334..364 + 0: READONLY_KW@334..364 "readonly" [Newline("\n"), Whitespace(" "), Comments("// Accessor"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@364..373 + 0: ACCESSOR_KW@364..373 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@373..374 + 0: IDENT@373..374 "e" [] [] + 2: TS_TYPE_ANNOTATION@374..382 + 0: COLON@374..376 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@376..382 + 0: STRING_KW@376..382 "string" [] [] + 3: SEMICOLON@382..383 ";" [] [] + 8: JS_BOGUS_MEMBER@383..416 + 0: JS_PROPERTY_MODIFIER_LIST@383..406 + 0: TS_OVERRIDE_MODIFIER@383..397 + 0: OVERRIDE_KW@383..397 "override" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@397..406 + 0: ACCESSOR_KW@397..406 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@406..407 + 0: IDENT@406..407 "f" [] [] + 2: TS_TYPE_ANNOTATION@407..415 + 0: COLON@407..409 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@409..415 + 0: STRING_KW@409..415 "string" [] [] + 3: SEMICOLON@415..416 ";" [] [] + 9: JS_BOGUS_MEMBER@416..469 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@416..455 + 0: TS_OVERRIDE_MODIFIER@416..446 + 0: OVERRIDE_KW@416..446 "override" [Newline("\n"), Whitespace(" "), Comments("// abstract"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@446..455 + 0: ABSTRACT_KW@446..455 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@455..460 + 0: IDENT@455..460 "base3" [] [] + 2: TS_TYPE_ANNOTATION@460..468 + 0: COLON@460..462 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@462..468 + 0: STRING_KW@462..468 "string" [] [] + 3: SEMICOLON@468..469 ";" [] [] + 10: JS_BOGUS_MEMBER@469..522 + 0: JS_PROPERTY_MODIFIER_LIST@469..508 + 0: TS_READONLY_MODIFIER@469..499 + 0: READONLY_KW@469..499 "readonly" [Newline("\n"), Whitespace(" "), Comments("// override"), Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@499..508 + 0: OVERRIDE_KW@499..508 "override" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@508..513 + 0: IDENT@508..513 "base4" [] [] + 2: TS_TYPE_ANNOTATION@513..521 + 0: COLON@513..515 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@515..521 + 0: STRING_KW@515..521 "string" [] [] + 3: SEMICOLON@521..522 ";" [] [] + 9: R_CURLY@522..524 "}" [Newline("\n")] [] + 4: EOF@524..525 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_modifier_precedence.ts:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'private' must precede 'readonly' + + 2 │ abstract class Test extends Base { + 3 │ // Accessibility + > 4 │ readonly private a: string; + │ ^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; + + i move this modifier + + 2 │ abstract class Test extends Base { + 3 │ // Accessibility + > 4 │ readonly private a: string; + │ ^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; + + i before this modifier + + 2 │ abstract class Test extends Base { + 3 │ // Accessibility + > 4 │ readonly private a: string; + │ ^^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; + +ts_class_modifier_precedence.ts:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'protected' must precede 'override' + + 3 │ // Accessibility + 4 │ readonly private a: string; + > 5 │ override protected base1; + │ ^^^^^^^^^ + 6 │ static private b: string; + 7 │ abstract protected d: string; + + i move this modifier + + 3 │ // Accessibility + 4 │ readonly private a: string; + > 5 │ override protected base1; + │ ^^^^^^^^^ + 6 │ static private b: string; + 7 │ abstract protected d: string; + + i before this modifier + + 3 │ // Accessibility + 4 │ readonly private a: string; + > 5 │ override protected base1; + │ ^^^^^^^^ + 6 │ static private b: string; + 7 │ abstract protected d: string; + +ts_class_modifier_precedence.ts:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'private' must precede 'static' + + 4 │ readonly private a: string; + 5 │ override protected base1; + > 6 │ static private b: string; + │ ^^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static + + i move this modifier + + 4 │ readonly private a: string; + 5 │ override protected base1; + > 6 │ static private b: string; + │ ^^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static + + i before this modifier + + 4 │ readonly private a: string; + 5 │ override protected base1; + > 6 │ static private b: string; + │ ^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static + +ts_class_modifier_precedence.ts:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'protected' must precede 'abstract' + + 5 │ override protected base1; + 6 │ static private b: string; + > 7 │ abstract protected d: string; + │ ^^^^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; + + i move this modifier + + 5 │ override protected base1; + 6 │ static private b: string; + > 7 │ abstract protected d: string; + │ ^^^^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; + + i before this modifier + + 5 │ override protected base1; + 6 │ static private b: string; + > 7 │ abstract protected d: string; + │ ^^^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; + +ts_class_modifier_precedence.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' must precede 'readonly' + + 7 │ abstract protected d: string; + 8 │ // Static + > 9 │ readonly static c: string; + │ ^^^^^^ + 10 │ accessor static d: string; + 11 │ override static base2: string; + + i move this modifier + + 7 │ abstract protected d: string; + 8 │ // Static + > 9 │ readonly static c: string; + │ ^^^^^^ + 10 │ accessor static d: string; + 11 │ override static base2: string; + + i before this modifier + + 7 │ abstract protected d: string; + 8 │ // Static + > 9 │ readonly static c: string; + │ ^^^^^^^^ + 10 │ accessor static d: string; + 11 │ override static base2: string; + +ts_class_modifier_precedence.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' must precede 'accessor' + + 8 │ // Static + 9 │ readonly static c: string; + > 10 │ accessor static d: string; + │ ^^^^^^ + 11 │ override static base2: string; + 12 │ // Accessor + + i move this modifier + + 8 │ // Static + 9 │ readonly static c: string; + > 10 │ accessor static d: string; + │ ^^^^^^ + 11 │ override static base2: string; + 12 │ // Accessor + + i before this modifier + + 8 │ // Static + 9 │ readonly static c: string; + > 10 │ accessor static d: string; + │ ^^^^^^^^ + 11 │ override static base2: string; + 12 │ // Accessor + +ts_class_modifier_precedence.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' must precede 'override' + + 9 │ readonly static c: string; + 10 │ accessor static d: string; + > 11 │ override static base2: string; + │ ^^^^^^ + 12 │ // Accessor + 13 │ readonly accessor e: string; + + i move this modifier + + 9 │ readonly static c: string; + 10 │ accessor static d: string; + > 11 │ override static base2: string; + │ ^^^^^^ + 12 │ // Accessor + 13 │ readonly accessor e: string; + + i before this modifier + + 9 │ readonly static c: string; + 10 │ accessor static d: string; + > 11 │ override static base2: string; + │ ^^^^^^^^ + 12 │ // Accessor + 13 │ readonly accessor e: string; + +ts_class_modifier_precedence.ts:13:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' must precede 'readonly' + + 11 │ override static base2: string; + 12 │ // Accessor + > 13 │ readonly accessor e: string; + │ ^^^^^^^^ + 14 │ override accessor f: string; + 15 │ // abstract + + i move this modifier + + 11 │ override static base2: string; + 12 │ // Accessor + > 13 │ readonly accessor e: string; + │ ^^^^^^^^ + 14 │ override accessor f: string; + 15 │ // abstract + + i before this modifier + + 11 │ override static base2: string; + 12 │ // Accessor + > 13 │ readonly accessor e: string; + │ ^^^^^^^^ + 14 │ override accessor f: string; + 15 │ // abstract + +ts_class_modifier_precedence.ts:14:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' cannot be used with 'override' modifier. + + 12 │ // Accessor + 13 │ readonly accessor e: string; + > 14 │ override accessor f: string; + │ ^^^^^^^^ + 15 │ // abstract + 16 │ override abstract base3: string; + + i 'accessor' modifier + + 12 │ // Accessor + 13 │ readonly accessor e: string; + > 14 │ override accessor f: string; + │ ^^^^^^^^ + 15 │ // abstract + 16 │ override abstract base3: string; + + i 'override' modifier + + 12 │ // Accessor + 13 │ readonly accessor e: string; + > 14 │ override accessor f: string; + │ ^^^^^^^^ + 15 │ // abstract + 16 │ override abstract base3: string; + +ts_class_modifier_precedence.ts:16:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' must precede 'override' + + 14 │ override accessor f: string; + 15 │ // abstract + > 16 │ override abstract base3: string; + │ ^^^^^^^^ + 17 │ // override + 18 │ readonly override base4: string; + + i move this modifier + + 14 │ override accessor f: string; + 15 │ // abstract + > 16 │ override abstract base3: string; + │ ^^^^^^^^ + 17 │ // override + 18 │ readonly override base4: string; + + i before this modifier + + 14 │ override accessor f: string; + 15 │ // abstract + > 16 │ override abstract base3: string; + │ ^^^^^^^^ + 17 │ // override + 18 │ readonly override base4: string; + +ts_class_modifier_precedence.ts:18:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'override' must precede 'readonly' + + 16 │ override abstract base3: string; + 17 │ // override + > 18 │ readonly override base4: string; + │ ^^^^^^^^ + 19 │ } + 20 │ + + i move this modifier + + 16 │ override abstract base3: string; + 17 │ // override + > 18 │ readonly override base4: string; + │ ^^^^^^^^ + 19 │ } + 20 │ + + i before this modifier + + 16 │ override abstract base3: string; + 17 │ // override + > 18 │ readonly override base4: string; + │ ^^^^^^^^ + 19 │ } + 20 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap new file mode 100644 index 000000000000..45bc5212978d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap @@ -0,0 +1,150 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class undefined {} +class string {} +class any {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..16 "undefined" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..17 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@17..18 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@18..25 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@25..32 "string" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@32..33 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@41..45 "any" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..46 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@46..47 "}" [] [], + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_CLASS_DECLARATION@0..18 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..16 + 0: IDENT@6..16 "undefined" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..17 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@17..17 + 9: R_CURLY@17..18 "}" [] [] + 1: JS_CLASS_DECLARATION@18..34 + 0: JS_DECORATOR_LIST@18..18 + 1: (empty) + 2: CLASS_KW@18..25 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@25..32 + 0: IDENT@25..32 "string" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@32..33 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@33..33 + 9: R_CURLY@33..34 "}" [] [] + 2: JS_CLASS_DECLARATION@34..47 + 0: JS_DECORATOR_LIST@34..34 + 1: (empty) + 2: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@41..45 + 0: IDENT@41..45 "any" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..46 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@46..46 + 9: R_CURLY@46..47 "}" [] [] + 4: EOF@47..48 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_name_reserved_as_type.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `undefined` cannot be used as a class name because it is already reserved as a type + + > 1 │ class undefined {} + │ ^^^^^^^^^ + 2 │ class string {} + 3 │ class any {} + +ts_class_name_reserved_as_type.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `string` cannot be used as a class name because it is already reserved as a type + + 1 │ class undefined {} + > 2 │ class string {} + │ ^^^^^^ + 3 │ class any {} + 4 │ + +ts_class_name_reserved_as_type.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `any` cannot be used as a class name because it is already reserved as a type + + 1 │ class undefined {} + 2 │ class string {} + > 3 │ class any {} + │ ^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap new file mode 100644 index 000000000000..c9b4c17924ea --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap @@ -0,0 +1,88 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class BuildError<> {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..16 "BuildError" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@16..17 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@17..19 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@19..20 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_CLASS_DECLARATION@0..21 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..16 + 0: IDENT@6..16 "BuildError" [] [] + 4: TS_TYPE_PARAMETERS@16..19 + 0: L_ANGLE@16..17 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@17..17 + 2: R_ANGLE@17..19 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@19..20 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@20..20 + 9: R_CURLY@20..21 "}" [] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_class_type_parameters_errors.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + > 1 │ class BuildError<> {} + │ ^ + 2 │ + + i Expected a type parameter here. + + > 1 │ class BuildError<> {} + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap new file mode 100644 index 000000000000..89c77156d741 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap @@ -0,0 +1,263 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + abstract my_age: number; + abstract name(): string; + abstract get age(): number; + abstract set age(v); +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@9..22 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@22..28 "my_age" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@30..36 "number" [] [], + }, + }, + SEMICOLON@36..37 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@37..50 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@50..54 "name" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@54..55 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@55..56 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@56..58 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@58..64 "string" [] [], + }, + }, + SEMICOLON@64..65 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@65..78 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + GET_KW@78..82 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@82..85 "age" [] [], + }, + L_PAREN@85..86 "(" [] [], + R_PAREN@86..87 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@87..89 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@89..95 "number" [] [], + }, + }, + SEMICOLON@95..96 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@96..109 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + SET_KW@109..113 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@113..116 "age" [] [], + }, + L_PAREN@116..117 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@117..118 "v" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + R_PAREN@118..119 ")" [] [], + SEMICOLON@119..120 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@120..122 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@122..123 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..123 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..122 + 0: JS_CLASS_DECLARATION@0..122 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..120 + 0: JS_BOGUS_MEMBER@9..37 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@9..22 + 0: TS_ABSTRACT_MODIFIER@9..22 + 0: ABSTRACT_KW@9..22 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@22..28 + 0: IDENT@22..28 "my_age" [] [] + 2: TS_TYPE_ANNOTATION@28..36 + 0: COLON@28..30 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@30..36 + 0: NUMBER_KW@30..36 "number" [] [] + 3: SEMICOLON@36..37 ";" [] [] + 1: JS_BOGUS_MEMBER@37..65 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@37..50 + 0: TS_ABSTRACT_MODIFIER@37..50 + 0: ABSTRACT_KW@37..50 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@50..54 + 0: IDENT@50..54 "name" [] [] + 2: JS_PARAMETERS@54..56 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_PARAMETER_LIST@55..55 + 2: R_PAREN@55..56 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@56..64 + 0: COLON@56..58 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@58..64 + 0: STRING_KW@58..64 "string" [] [] + 4: SEMICOLON@64..65 ";" [] [] + 2: JS_BOGUS_MEMBER@65..96 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@65..78 + 0: TS_ABSTRACT_MODIFIER@65..78 + 0: ABSTRACT_KW@65..78 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@78..82 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@82..85 + 0: IDENT@82..85 "age" [] [] + 3: L_PAREN@85..86 "(" [] [] + 4: R_PAREN@86..87 ")" [] [] + 5: TS_TYPE_ANNOTATION@87..95 + 0: COLON@87..89 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@89..95 + 0: NUMBER_KW@89..95 "number" [] [] + 6: SEMICOLON@95..96 ";" [] [] + 3: JS_BOGUS_MEMBER@96..120 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@96..109 + 0: TS_ABSTRACT_MODIFIER@96..109 + 0: ABSTRACT_KW@96..109 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@109..113 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@113..116 + 0: IDENT@113..116 "age" [] [] + 3: L_PAREN@116..117 "(" [] [] + 4: JS_FORMAL_PARAMETER@117..118 + 0: JS_DECORATOR_LIST@117..117 + 1: JS_IDENTIFIER_BINDING@117..118 + 0: IDENT@117..118 "v" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: R_PAREN@118..119 ")" [] [] + 6: SEMICOLON@119..120 ";" [] [] + 9: R_CURLY@120..122 "}" [Newline("\n")] [] + 4: EOF@122..123 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_concrete_class_with_abstract_members.ts:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Only abstract classes can have abstract members + + 1 │ class A { + > 2 │ abstract my_age: number; + │ ^^^^^^^^ + 3 │ abstract name(): string; + 4 │ abstract get age(): number; + +ts_concrete_class_with_abstract_members.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Only abstract classes can have abstract members + + 1 │ class A { + 2 │ abstract my_age: number; + > 3 │ abstract name(): string; + │ ^^^^^^^^ + 4 │ abstract get age(): number; + 5 │ abstract set age(v); + +ts_concrete_class_with_abstract_members.ts:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Only abstract classes can have abstract members + + 2 │ abstract my_age: number; + 3 │ abstract name(): string; + > 4 │ abstract get age(): number; + │ ^^^^^^^^ + 5 │ abstract set age(v); + 6 │ } + +ts_concrete_class_with_abstract_members.ts:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Only abstract classes can have abstract members + + 3 │ abstract name(): string; + 4 │ abstract get age(): number; + > 5 │ abstract set age(v); + │ ^^^^^^^^ + 6 │ } + 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap new file mode 100644 index 000000000000..116ef2d6eb31 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap @@ -0,0 +1,177 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type C = { new <>(a: A, b: B): string } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@11..15 "new" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@15..16 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@16..17 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@17..18 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@18..19 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@19..21 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@21..22 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..25 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@27..28 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@28..29 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@29..31 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@31..38 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: TS_TYPE_ALIAS_DECLARATION@0..39 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..39 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..38 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@11..38 + 0: NEW_KW@11..15 "new" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETERS@15..17 + 0: L_ANGLE@15..16 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@16..16 + 2: R_ANGLE@16..17 ">" [] [] + 2: JS_PARAMETERS@17..29 + 0: L_PAREN@17..18 "(" [] [] + 1: JS_PARAMETER_LIST@18..28 + 0: JS_FORMAL_PARAMETER@18..22 + 0: JS_DECORATOR_LIST@18..18 + 1: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@19..22 + 0: COLON@19..21 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@21..22 + 0: JS_REFERENCE_IDENTIFIER@21..22 + 0: IDENT@21..22 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@24..28 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@25..28 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@27..28 + 0: JS_REFERENCE_IDENTIFIER@27..28 + 0: IDENT@27..28 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@28..29 ")" [] [] + 3: TS_TYPE_ANNOTATION@29..38 + 0: COLON@29..31 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@31..38 + 0: STRING_KW@31..38 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@38..39 "}" [] [] + 5: (empty) + 4: EOF@39..40 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_construct_signature_member_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + > 1 │ type C = { new <>(a: A, b: B): string } + │ ^ + 2 │ + + i Expected a type parameter here. + + > 1 │ type C = { new <>(a: A, b: B): string } + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap new file mode 100644 index 000000000000..5ba58b1f4276 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { constructor(this) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..21 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + parameters: JsConstructorParameterList [ + JsBogusParameter { + items: [ + THIS_KW@22..26 "this" [] [], + ], + }, + ], + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..31 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + ], + eof_token: EOF@32..33 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..33 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..32 + 0: JS_CLASS_DECLARATION@0..32 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..31 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..31 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..21 + 0: IDENT@10..21 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@21..28 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..26 + 0: JS_BOGUS_PARAMETER@22..26 + 0: THIS_KW@22..26 "this" [] [] + 2: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@28..31 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..31 "}" [] [Whitespace(" ")] + 9: R_CURLY@31..32 "}" [] [] + 4: EOF@32..33 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_constructor_this_parameter.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A constructor cannot have a 'this' parameter. + + > 1 │ class C { constructor(this) {} } + │ ^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts.snap new file mode 100644 index 000000000000..56f2d79e2878 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts.snap @@ -0,0 +1,292 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type C = new<>(a: A, b: B) => string; +type D = abstract new<>(a: A, b: B) => string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@9..12 "new" [] [], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@12..13 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@13..14 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@14..15 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@18..19 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@19..21 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@21..22 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@22..24 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@24..25 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@30..36 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@43..45 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@45..47 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: ABSTRACT_KW@47..56 "abstract" [] [Whitespace(" ")], + new_token: NEW_KW@56..59 "new" [] [], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@59..60 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@60..61 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@61..62 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@62..63 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@63..65 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@65..66 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@66..68 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@68..69 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@71..72 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@72..74 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@74..77 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@77..83 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: TS_TYPE_ALIAS_DECLARATION@0..37 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@9..36 + 0: (empty) + 1: NEW_KW@9..12 "new" [] [] + 2: TS_TYPE_PARAMETERS@12..14 + 0: L_ANGLE@12..13 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@13..13 + 2: R_ANGLE@13..14 ">" [] [] + 3: JS_PARAMETERS@14..27 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_PARAMETER_LIST@15..25 + 0: JS_FORMAL_PARAMETER@15..19 + 0: JS_DECORATOR_LIST@15..15 + 1: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@16..19 + 0: COLON@16..18 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@18..19 + 0: JS_REFERENCE_IDENTIFIER@18..19 + 0: IDENT@18..19 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@19..21 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@21..25 + 0: JS_DECORATOR_LIST@21..21 + 1: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@22..25 + 0: COLON@22..24 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@24..25 + 0: JS_REFERENCE_IDENTIFIER@24..25 + 0: IDENT@24..25 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@30..36 + 0: STRING_KW@30..36 "string" [] [] + 5: SEMICOLON@36..37 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@37..84 + 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@45..47 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@47..83 + 0: ABSTRACT_KW@47..56 "abstract" [] [Whitespace(" ")] + 1: NEW_KW@56..59 "new" [] [] + 2: TS_TYPE_PARAMETERS@59..61 + 0: L_ANGLE@59..60 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@60..60 + 2: R_ANGLE@60..61 ">" [] [] + 3: JS_PARAMETERS@61..74 + 0: L_PAREN@61..62 "(" [] [] + 1: JS_PARAMETER_LIST@62..72 + 0: JS_FORMAL_PARAMETER@62..66 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_IDENTIFIER_BINDING@62..63 + 0: IDENT@62..63 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@63..66 + 0: COLON@63..65 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@65..66 + 0: JS_REFERENCE_IDENTIFIER@65..66 + 0: IDENT@65..66 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@66..68 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@68..72 + 0: JS_DECORATOR_LIST@68..68 + 1: JS_IDENTIFIER_BINDING@68..69 + 0: IDENT@68..69 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@69..72 + 0: COLON@69..71 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@71..72 + 0: JS_REFERENCE_IDENTIFIER@71..72 + 0: IDENT@71..72 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@72..74 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@74..77 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@77..83 + 0: STRING_KW@77..83 "string" [] [] + 5: SEMICOLON@83..84 ";" [] [] + 4: EOF@84..85 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_constructor_type_err.ts:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + > 1 │ type C = new<>(a: A, b: B) => string; + │ ^ + 2 │ type D = abstract new<>(a: A, b: B) => string; + 3 │ + + i Expected a type parameter here. + + > 1 │ type C = new<>(a: A, b: B) => string; + │ ^ + 2 │ type D = abstract new<>(a: A, b: B) => string; + 3 │ + +ts_constructor_type_err.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ type C = new<>(a: A, b: B) => string; + > 2 │ type D = abstract new<>(a: A, b: B) => string; + │ ^ + 3 │ + + i Expected a type parameter here. + + 1 │ type C = new<>(a: A, b: B) => string; + > 2 │ type D = abstract new<>(a: A, b: B) => string; + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap new file mode 100644 index 000000000000..8c2faf0376a3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap @@ -0,0 +1,261 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { constructor(b) {} } +class A { constructor<>(b) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@10..21 "constructor" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@21..22 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@22..23 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@23..24 ">" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@24..25 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@25..26 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..31 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@32..39 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@39..41 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@43..54 "constructor" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@54..55 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@55..56 ">" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@56..57 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@57..58 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@60..61 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@61..63 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@63..64 "}" [] [], + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: JS_CLASS_DECLARATION@0..32 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..31 + 0: JS_BOGUS_MEMBER@10..31 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..21 + 0: IDENT@10..21 "constructor" [] [] + 2: TS_TYPE_PARAMETERS@21..24 + 0: L_ANGLE@21..22 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@22..23 + 0: TS_TYPE_PARAMETER@22..23 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@22..22 + 1: TS_TYPE_PARAMETER_NAME@22..23 + 0: IDENT@22..23 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@23..24 ">" [] [] + 3: JS_CONSTRUCTOR_PARAMETERS@24..28 + 0: L_PAREN@24..25 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@25..26 + 0: JS_FORMAL_PARAMETER@25..26 + 0: JS_DECORATOR_LIST@25..25 + 1: JS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@28..31 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..31 "}" [] [Whitespace(" ")] + 9: R_CURLY@31..32 "}" [] [] + 1: JS_CLASS_DECLARATION@32..64 + 0: JS_DECORATOR_LIST@32..32 + 1: (empty) + 2: CLASS_KW@32..39 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@39..41 + 0: IDENT@39..41 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@43..63 + 0: JS_BOGUS_MEMBER@43..63 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@43..43 + 1: JS_LITERAL_MEMBER_NAME@43..54 + 0: IDENT@43..54 "constructor" [] [] + 2: TS_TYPE_PARAMETERS@54..56 + 0: L_ANGLE@54..55 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@55..55 + 2: R_ANGLE@55..56 ">" [] [] + 3: JS_CONSTRUCTOR_PARAMETERS@56..60 + 0: L_PAREN@56..57 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@57..58 + 0: JS_FORMAL_PARAMETER@57..58 + 0: JS_DECORATOR_LIST@57..57 + 1: JS_IDENTIFIER_BINDING@57..58 + 0: IDENT@57..58 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@60..63 + 0: L_CURLY@60..61 "{" [] [] + 1: JS_DIRECTIVE_LIST@61..61 + 2: JS_STATEMENT_LIST@61..61 + 3: R_CURLY@61..63 "}" [] [Whitespace(" ")] + 9: R_CURLY@63..64 "}" [] [] + 4: EOF@64..65 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_constructor_type_parameters.ts:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × constructors cannot have type parameters. + + > 1 │ class A { constructor(b) {} } + │ ^^^ + 2 │ class A { constructor<>(b) {} } + 3 │ + +ts_constructor_type_parameters.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ class A { constructor(b) {} } + > 2 │ class A { constructor<>(b) {} } + │ ^ + 3 │ + + i Expected a type parameter here. + + 1 │ class A { constructor(b) {} } + > 2 │ class A { constructor<>(b) {} } + │ ^ + 3 │ + +ts_constructor_type_parameters.ts:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × constructors cannot have type parameters. + + 1 │ class A { constructor(b) {} } + > 2 │ class A { constructor<>(b) {} } + │ ^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts.snap new file mode 100644 index 000000000000..c69e254273a0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts.snap @@ -0,0 +1,81 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare async function test(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + ASYNC_KW@8..14 "async" [] [Whitespace(" ")], + FUNCTION_KW@14..23 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@23..27 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@27..28 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@28..29 ")" [] [], + }, + SEMICOLON@29..30 ";" [] [], + ], + }, + ], + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_BOGUS_STATEMENT@0..30 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@8..30 + 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@14..23 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@23..27 + 0: IDENT@23..27 "test" [] [] + 3: JS_PARAMETERS@27..29 + 0: L_PAREN@27..28 "(" [] [] + 1: JS_PARAMETER_LIST@28..28 + 2: R_PAREN@28..29 ")" [] [] + 4: SEMICOLON@29..30 ";" [] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_async_function.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'async' modifier cannot be used in an ambient context. + + > 1 │ declare async function test(); + │ ^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts.snap new file mode 100644 index 000000000000..1033c6715b41 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts.snap @@ -0,0 +1,166 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare @decorator class D {} +declare @decorator abstract class D {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@8..9 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..19 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@19..25 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@25..27 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@27..28 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + DECLARE_KW@29..38 "declare" [Newline("\n")] [Whitespace(" ")], + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@38..39 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@39..49 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@49..58 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@58..64 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@64..66 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@66..67 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + ], + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..68 + 0: JS_BOGUS_STATEMENT@0..29 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@8..19 + 0: JS_DECORATOR@8..19 + 0: AT@8..9 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@9..19 + 0: JS_REFERENCE_IDENTIFIER@9..19 + 0: IDENT@9..19 "decorator" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@19..29 + 0: JS_DECORATOR_LIST@19..19 + 1: (empty) + 2: CLASS_KW@19..25 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@27..28 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@28..28 + 9: R_CURLY@28..29 "}" [] [] + 1: JS_BOGUS_STATEMENT@29..68 + 0: DECLARE_KW@29..38 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@38..49 + 0: JS_DECORATOR@38..49 + 0: AT@38..39 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@39..49 + 0: JS_REFERENCE_IDENTIFIER@39..49 + 0: IDENT@39..49 "decorator" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@49..68 + 0: JS_DECORATOR_LIST@49..49 + 1: ABSTRACT_KW@49..58 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@58..64 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@64..66 + 0: IDENT@64..66 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@66..67 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@67..67 + 9: R_CURLY@67..68 "}" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_const_initializer.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ declare @decorator class D {} + │ ^^^^^^^^^^ + 2 │ declare @decorator abstract class D {} + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_declare_const_initializer.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ declare @decorator class D {} + > 2 │ declare @decorator abstract class D {} + │ ^^^^^^^^^^ + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap new file mode 100644 index 000000000000..8562dd73b7a8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap @@ -0,0 +1,150 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module 'x' { + export function(option: any): void +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@19..20 "{" [] [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@30..38 "function" [] [], + id: missing (required), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@39..45 "option" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@45..47 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@47..50 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@50..51 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@51..53 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@53..57 "void" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@57..59 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@59..60 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..60 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..59 + 0: TS_DECLARE_STATEMENT@0..59 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@8..59 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@15..19 + 0: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@19..59 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_MODULE_ITEM_LIST@20..57 + 0: JS_EXPORT@20..57 + 0: JS_DECORATOR_LIST@20..20 + 1: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: TS_DECLARE_FUNCTION_DECLARATION@30..57 + 0: (empty) + 1: FUNCTION_KW@30..38 "function" [] [] + 2: (empty) + 3: (empty) + 4: JS_PARAMETERS@38..51 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..50 + 0: JS_FORMAL_PARAMETER@39..50 + 0: JS_DECORATOR_LIST@39..39 + 1: JS_IDENTIFIER_BINDING@39..45 + 0: IDENT@39..45 "option" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@45..50 + 0: COLON@45..47 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@47..50 + 0: ANY_KW@47..50 "any" [] [] + 4: (empty) + 2: R_PAREN@50..51 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@51..57 + 0: COLON@51..53 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@53..57 + 0: VOID_KW@53..57 "void" [] [] + 6: (empty) + 2: R_CURLY@57..59 "}" [Newline("\n")] [] + 4: EOF@59..60 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_function_export_declaration_missing_id.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found '('. + + 1 │ declare module 'x' { + > 2 │ export function(option: any): void + │ ^ + 3 │ } + 4 │ + + i Expected an identifier, an array pattern, or an object pattern here. + + 1 │ declare module 'x' { + > 2 │ export function(option: any): void + │ ^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts.snap new file mode 100644 index 000000000000..9a878bce1d6f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts.snap @@ -0,0 +1,167 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare function test(a: A): string { return "ambient function with a body"; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@8..17 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@17..21 "test" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@21..22 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@22..23 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@23..24 ">" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@24..25 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@25..26 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@26..28 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@28..29 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@29..30 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@30..32 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@32..39 "string" [] [Whitespace(" ")], + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@39..41 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@41..48 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@48..78 "\"ambient function with a body\"" [] [], + }, + semicolon_token: SEMICOLON@78..80 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + ], + }, + ], + }, + ], + eof_token: EOF@81..82 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..82 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..81 + 0: JS_BOGUS_STATEMENT@0..81 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@8..81 + 0: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@17..21 + 0: IDENT@17..21 "test" [] [] + 2: TS_TYPE_PARAMETERS@21..24 + 0: L_ANGLE@21..22 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@22..23 + 0: TS_TYPE_PARAMETER@22..23 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@22..22 + 1: TS_TYPE_PARAMETER_NAME@22..23 + 0: IDENT@22..23 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@23..24 ">" [] [] + 3: JS_PARAMETERS@24..30 + 0: L_PAREN@24..25 "(" [] [] + 1: JS_PARAMETER_LIST@25..29 + 0: JS_FORMAL_PARAMETER@25..29 + 0: JS_DECORATOR_LIST@25..25 + 1: JS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@26..29 + 0: COLON@26..28 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@28..29 + 0: JS_REFERENCE_IDENTIFIER@28..29 + 0: IDENT@28..29 "A" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@29..30 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@30..39 + 0: COLON@30..32 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@32..39 + 0: STRING_KW@32..39 "string" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@39..81 + 0: L_CURLY@39..41 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@41..41 + 2: JS_STATEMENT_LIST@41..80 + 0: JS_RETURN_STATEMENT@41..80 + 0: RETURN_KW@41..48 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@48..78 + 0: JS_STRING_LITERAL@48..78 "\"ambient function with a body\"" [] [] + 2: SEMICOLON@78..80 ";" [] [Whitespace(" ")] + 3: R_CURLY@80..81 "}" [] [] + 4: EOF@81..82 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_function_with_body.ts:1:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A 'declare' function cannot have a function body + + > 1 │ declare function test(a: A): string { return "ambient function with a body"; } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ + + i remove this body + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts.snap new file mode 100644 index 000000000000..0c537290332d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts.snap @@ -0,0 +1,180 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare function* test(): void; +declare module 'x' { + export default function* test(): void +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@8..16 "function" [] [], + STAR@16..18 "*" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@18..22 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..24 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@26..30 "void" [] [], + }, + }, + SEMICOLON@30..31 ";" [] [], + ], + }, + ], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@31..40 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@40..47 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@47..51 "'x'" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@51..52 "{" [] [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@52..62 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsBogus { + items: [ + DEFAULT_KW@62..70 "default" [] [Whitespace(" ")], + JsBogus { + items: [ + FUNCTION_KW@70..78 "function" [] [], + STAR@78..80 "*" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@80..84 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@84..85 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@85..86 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@86..88 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@88..92 "void" [] [], + }, + }, + ], + }, + ], + }, + ], + }, + ], + r_curly_token: R_CURLY@92..94 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@94..95 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..95 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..94 + 0: JS_BOGUS_STATEMENT@0..31 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@8..31 + 0: FUNCTION_KW@8..16 "function" [] [] + 1: STAR@16..18 "*" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@18..22 + 0: IDENT@18..22 "test" [] [] + 3: JS_PARAMETERS@22..24 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..24 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@24..30 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@26..30 + 0: VOID_KW@26..30 "void" [] [] + 5: SEMICOLON@30..31 ";" [] [] + 1: TS_DECLARE_STATEMENT@31..94 + 0: DECLARE_KW@31..40 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@40..94 + 0: MODULE_KW@40..47 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@47..51 + 0: JS_STRING_LITERAL@47..51 "'x'" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@51..94 + 0: L_CURLY@51..52 "{" [] [] + 1: JS_MODULE_ITEM_LIST@52..92 + 0: JS_BOGUS_STATEMENT@52..92 + 0: JS_DECORATOR_LIST@52..52 + 1: EXPORT_KW@52..62 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_BOGUS@62..92 + 0: DEFAULT_KW@62..70 "default" [] [Whitespace(" ")] + 1: JS_BOGUS@70..92 + 0: FUNCTION_KW@70..78 "function" [] [] + 1: STAR@78..80 "*" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@80..84 + 0: IDENT@80..84 "test" [] [] + 3: JS_PARAMETERS@84..86 + 0: L_PAREN@84..85 "(" [] [] + 1: JS_PARAMETER_LIST@85..85 + 2: R_PAREN@85..86 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@86..92 + 0: COLON@86..88 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@88..92 + 0: VOID_KW@88..92 "void" [] [] + 2: R_CURLY@92..94 "}" [Newline("\n")] [] + 4: EOF@94..95 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_generator_function.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Generators are not allowed in an ambient context. + + > 1 │ declare function* test(): void; + │ ^ + 2 │ declare module 'x' { + 3 │ export default function* test(): void + +ts_declare_generator_function.ts:3:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Generators are not allowed in an ambient context. + + 1 │ declare function* test(): void; + 2 │ declare module 'x' { + > 3 │ export default function* test(): void + │ ^ + 4 │ } + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts.snap new file mode 100644 index 000000000000..535aee81dc49 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { declare #name(); }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsDeclareModifier { + modifier_token: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")], + }, + ], + }, + JsPrivateClassMemberName { + hash_token: HASH@18..19 "#" [] [], + id_token: IDENT@19..23 "name" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..25 ")" [] [], + }, + SEMICOLON@25..27 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_CLASS_DECLARATION@0..28 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..27 + 0: JS_BOGUS_MEMBER@10..27 + 0: JS_BOGUS@10..18 + 0: TS_DECLARE_MODIFIER@10..18 + 0: DECLARE_KW@10..18 "declare" [] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@18..23 + 0: HASH@18..19 "#" [] [] + 1: IDENT@19..23 "name" [] [] + 2: JS_PARAMETERS@23..25 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..25 ")" [] [] + 3: SEMICOLON@25..27 ";" [] [Whitespace(" ")] + 9: R_CURLY@27..28 "}" [] [] + 1: JS_EMPTY_STATEMENT@28..29 + 0: SEMICOLON@28..29 ";" [] [] + 4: EOF@29..30 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_property_private_name.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'declare' modifier is only allowed on properties. + + > 1 │ class A { declare #name(); }; + │ ^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_using.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_using.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts.snap new file mode 100644 index 000000000000..0f432f6bad9b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts.snap @@ -0,0 +1,206 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare using x: null +declare await using x: null + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..8 "declare" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@8..14 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..15 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@15..17 ":" [] [Whitespace(" ")], + ty: TsNullLiteralType { + literal_token: NULL_KW@17..21 "null" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..30 "declare" [Newline("\n")] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: AWAIT_KW@30..36 "await" [] [Whitespace(" ")], + kind: USING_KW@36..42 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@42..43 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@43..45 ":" [] [Whitespace(" ")], + ty: TsNullLiteralType { + literal_token: NULL_KW@45..49 "null" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_IDENTIFIER_EXPRESSION@0..8 + 0: JS_REFERENCE_IDENTIFIER@0..8 + 0: IDENT@0..8 "declare" [] [Whitespace(" ")] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@8..21 + 0: JS_VARIABLE_DECLARATION@8..21 + 0: (empty) + 1: USING_KW@8..14 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..21 + 0: JS_VARIABLE_DECLARATOR@14..21 + 0: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "x" [] [] + 1: TS_TYPE_ANNOTATION@15..21 + 0: COLON@15..17 ":" [] [Whitespace(" ")] + 1: TS_NULL_LITERAL_TYPE@17..21 + 0: NULL_KW@17..21 "null" [] [] + 2: (empty) + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@21..30 + 0: JS_IDENTIFIER_EXPRESSION@21..30 + 0: JS_REFERENCE_IDENTIFIER@21..30 + 0: IDENT@21..30 "declare" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 3: JS_VARIABLE_STATEMENT@30..49 + 0: JS_VARIABLE_DECLARATION@30..49 + 0: AWAIT_KW@30..36 "await" [] [Whitespace(" ")] + 1: USING_KW@36..42 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@42..49 + 0: JS_VARIABLE_DECLARATOR@42..49 + 0: JS_IDENTIFIER_BINDING@42..43 + 0: IDENT@42..43 "x" [] [] + 1: TS_TYPE_ANNOTATION@43..49 + 0: COLON@43..45 ":" [] [Whitespace(" ")] + 1: TS_NULL_LITERAL_TYPE@45..49 + 0: NULL_KW@45..49 "null" [] [] + 2: (empty) + 1: (empty) + 4: EOF@49..50 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_declare_using.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ declare using x: null + │ ^^^^^ + 2 │ declare await using x: null + 3 │ + + i An explicit or implicit semicolon is expected here... + + > 1 │ declare using x: null + │ ^^^^^ + 2 │ declare await using x: null + 3 │ + + i ...Which is required to end this statement + + > 1 │ declare using x: null + │ ^^^^^^^^^^^^^ + 2 │ declare await using x: null + 3 │ + +ts_declare_using.ts:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + > 1 │ declare using x: null + │ ^ + 2 │ declare await using x: null + 3 │ + + i This variable needs to be initialized. + +ts_declare_using.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ declare using x: null + > 2 │ declare await using x: null + │ ^^^^^ + 3 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ declare using x: null + > 2 │ declare await using x: null + │ ^^^^^ + 3 │ + + i ...Which is required to end this statement + + 1 │ declare using x: null + > 2 │ declare await using x: null + │ ^^^^^^^^^^^^^ + 3 │ + +ts_declare_using.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + 1 │ declare using x: null + > 2 │ declare await using x: null + │ ^ + 3 │ + + i This variable needs to be initialized. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts.snap new file mode 100644 index 000000000000..59ae5dd42bef --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts.snap @@ -0,0 +1,726 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { + constructor(@foo readonly x: number) {} +} +class CC { + constructor(@foo @dec(arg) readonly x: number) {} +} +class CC { + constructor(@foo @dec.method(arg) readonly x: number) {} +} +class CCC { + constructor(@foo @dec.method(arg) private readonly x: number) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@25..26 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@26..27 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..31 "foo" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")], + }, + ], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@40..41 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@41..43 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@43..49 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + ], + }, + R_PAREN@49..51 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@51..52 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@62..65 "CC" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@65..66 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@82..83 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@83..84 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..88 "foo" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@88..89 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@89..92 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@92..93 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@93..96 "arg" [] [], + }, + }, + ], + r_paren_token: R_PAREN@96..98 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")], + }, + ], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@107..108 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@108..110 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@110..116 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + ], + }, + R_PAREN@116..118 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@118..119 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@119..120 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@120..122 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@129..132 "CC" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@132..133 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@149..150 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@150..151 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@151..155 "foo" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@155..156 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@156..159 "dec" [] [], + }, + }, + operator_token: DOT@159..160 "." [] [], + member: JsName { + value_token: IDENT@160..166 "method" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@166..167 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@167..170 "arg" [] [], + }, + }, + ], + r_paren_token: R_PAREN@170..172 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")], + }, + ], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@181..182 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@182..184 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@184..190 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + ], + }, + R_PAREN@190..192 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@192..193 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@193..194 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@194..196 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@203..207 "CCC" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@207..208 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@224..225 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@225..226 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@226..230 "foo" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@230..231 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@231..234 "dec" [] [], + }, + }, + operator_token: DOT@234..235 "." [] [], + member: JsName { + value_token: IDENT@235..241 "method" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@241..242 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@242..245 "arg" [] [], + }, + }, + ], + r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")], + }, + ], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@264..265 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@265..267 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@267..273 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + ], + }, + R_PAREN@273..275 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@275..276 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@276..277 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@277..279 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@279..280 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..280 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..279 + 0: JS_CLASS_DECLARATION@0..55 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..53 + 0: JS_BOGUS_MEMBER@9..53 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..25 + 0: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@25..51 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_BOGUS@26..49 + 0: JS_BOGUS@26..49 + 0: JS_BOGUS@26..31 + 0: JS_DECORATOR@26..31 + 0: AT@26..27 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@27..31 + 0: JS_REFERENCE_IDENTIFIER@27..31 + 0: IDENT@27..31 "foo" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@31..40 + 0: TS_READONLY_MODIFIER@31..40 + 0: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@40..49 + 0: JS_DECORATOR_LIST@40..40 + 1: JS_IDENTIFIER_BINDING@40..41 + 0: IDENT@40..41 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@41..49 + 0: COLON@41..43 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@43..49 + 0: NUMBER_KW@43..49 "number" [] [] + 4: (empty) + 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@51..53 + 0: L_CURLY@51..52 "{" [] [] + 1: JS_DIRECTIVE_LIST@52..52 + 2: JS_STATEMENT_LIST@52..52 + 3: R_CURLY@52..53 "}" [] [] + 9: R_CURLY@53..55 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@55..122 + 0: JS_DECORATOR_LIST@55..55 + 1: (empty) + 2: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@62..65 + 0: IDENT@62..65 "CC" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@65..66 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@66..120 + 0: JS_BOGUS_MEMBER@66..120 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@66..66 + 1: JS_LITERAL_MEMBER_NAME@66..82 + 0: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@82..118 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_BOGUS@83..116 + 0: JS_BOGUS@83..116 + 0: JS_BOGUS@83..98 + 0: JS_DECORATOR@83..88 + 0: AT@83..84 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@84..88 + 0: JS_REFERENCE_IDENTIFIER@84..88 + 0: IDENT@84..88 "foo" [] [Whitespace(" ")] + 1: JS_DECORATOR@88..98 + 0: AT@88..89 "@" [] [] + 1: JS_CALL_EXPRESSION@89..98 + 0: JS_IDENTIFIER_EXPRESSION@89..92 + 0: JS_REFERENCE_IDENTIFIER@89..92 + 0: IDENT@89..92 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@92..98 + 0: L_PAREN@92..93 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@93..96 + 0: JS_IDENTIFIER_EXPRESSION@93..96 + 0: JS_REFERENCE_IDENTIFIER@93..96 + 0: IDENT@93..96 "arg" [] [] + 2: R_PAREN@96..98 ")" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@98..107 + 0: TS_READONLY_MODIFIER@98..107 + 0: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@107..116 + 0: JS_DECORATOR_LIST@107..107 + 1: JS_IDENTIFIER_BINDING@107..108 + 0: IDENT@107..108 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@108..116 + 0: COLON@108..110 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@110..116 + 0: NUMBER_KW@110..116 "number" [] [] + 4: (empty) + 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@118..120 + 0: L_CURLY@118..119 "{" [] [] + 1: JS_DIRECTIVE_LIST@119..119 + 2: JS_STATEMENT_LIST@119..119 + 3: R_CURLY@119..120 "}" [] [] + 9: R_CURLY@120..122 "}" [Newline("\n")] [] + 2: JS_CLASS_DECLARATION@122..196 + 0: JS_DECORATOR_LIST@122..122 + 1: (empty) + 2: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@129..132 + 0: IDENT@129..132 "CC" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@132..133 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@133..194 + 0: JS_BOGUS_MEMBER@133..194 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@133..133 + 1: JS_LITERAL_MEMBER_NAME@133..149 + 0: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@149..192 + 0: L_PAREN@149..150 "(" [] [] + 1: JS_BOGUS@150..190 + 0: JS_BOGUS@150..190 + 0: JS_BOGUS@150..172 + 0: JS_DECORATOR@150..155 + 0: AT@150..151 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@151..155 + 0: JS_REFERENCE_IDENTIFIER@151..155 + 0: IDENT@151..155 "foo" [] [Whitespace(" ")] + 1: JS_DECORATOR@155..172 + 0: AT@155..156 "@" [] [] + 1: JS_CALL_EXPRESSION@156..172 + 0: JS_STATIC_MEMBER_EXPRESSION@156..166 + 0: JS_IDENTIFIER_EXPRESSION@156..159 + 0: JS_REFERENCE_IDENTIFIER@156..159 + 0: IDENT@156..159 "dec" [] [] + 1: DOT@159..160 "." [] [] + 2: JS_NAME@160..166 + 0: IDENT@160..166 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@166..172 + 0: L_PAREN@166..167 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@167..170 + 0: JS_IDENTIFIER_EXPRESSION@167..170 + 0: JS_REFERENCE_IDENTIFIER@167..170 + 0: IDENT@167..170 "arg" [] [] + 2: R_PAREN@170..172 ")" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@172..181 + 0: TS_READONLY_MODIFIER@172..181 + 0: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@181..190 + 0: JS_DECORATOR_LIST@181..181 + 1: JS_IDENTIFIER_BINDING@181..182 + 0: IDENT@181..182 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@182..190 + 0: COLON@182..184 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@184..190 + 0: NUMBER_KW@184..190 "number" [] [] + 4: (empty) + 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@192..194 + 0: L_CURLY@192..193 "{" [] [] + 1: JS_DIRECTIVE_LIST@193..193 + 2: JS_STATEMENT_LIST@193..193 + 3: R_CURLY@193..194 "}" [] [] + 9: R_CURLY@194..196 "}" [Newline("\n")] [] + 3: JS_CLASS_DECLARATION@196..279 + 0: JS_DECORATOR_LIST@196..196 + 1: (empty) + 2: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@203..207 + 0: IDENT@203..207 "CCC" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@207..208 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@208..277 + 0: JS_BOGUS_MEMBER@208..277 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@208..208 + 1: JS_LITERAL_MEMBER_NAME@208..224 + 0: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@224..275 + 0: L_PAREN@224..225 "(" [] [] + 1: JS_BOGUS@225..273 + 0: JS_BOGUS@225..273 + 0: JS_BOGUS@225..247 + 0: JS_DECORATOR@225..230 + 0: AT@225..226 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@226..230 + 0: JS_REFERENCE_IDENTIFIER@226..230 + 0: IDENT@226..230 "foo" [] [Whitespace(" ")] + 1: JS_DECORATOR@230..247 + 0: AT@230..231 "@" [] [] + 1: JS_CALL_EXPRESSION@231..247 + 0: JS_STATIC_MEMBER_EXPRESSION@231..241 + 0: JS_IDENTIFIER_EXPRESSION@231..234 + 0: JS_REFERENCE_IDENTIFIER@231..234 + 0: IDENT@231..234 "dec" [] [] + 1: DOT@234..235 "." [] [] + 2: JS_NAME@235..241 + 0: IDENT@235..241 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@241..247 + 0: L_PAREN@241..242 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@242..245 + 0: JS_IDENTIFIER_EXPRESSION@242..245 + 0: JS_REFERENCE_IDENTIFIER@242..245 + 0: IDENT@242..245 "arg" [] [] + 2: R_PAREN@245..247 ")" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@247..264 + 0: TS_ACCESSIBILITY_MODIFIER@247..255 + 0: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@255..264 + 0: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@264..273 + 0: JS_DECORATOR_LIST@264..264 + 1: JS_IDENTIFIER_BINDING@264..265 + 0: IDENT@264..265 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@265..273 + 0: COLON@265..267 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@267..273 + 0: NUMBER_KW@267..273 "number" [] [] + 4: (empty) + 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@275..277 + 0: L_CURLY@275..276 "{" [] [] + 1: JS_DIRECTIVE_LIST@276..276 + 2: JS_STATEMENT_LIST@276..276 + 3: R_CURLY@276..277 "}" [] [] + 9: R_CURLY@277..279 "}" [Newline("\n")] [] + 4: EOF@279..280 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_constructor.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class C { + > 2 │ constructor(@foo readonly x: number) {} + │ ^^^^ + 3 │ } + 4 │ class CC { + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_constructor.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 3 │ } + 4 │ class CC { + > 5 │ constructor(@foo @dec(arg) readonly x: number) {} + │ ^^^^^^^^^^^^^^ + 6 │ } + 7 │ class CC { + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_constructor.ts:8:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 6 │ } + 7 │ class CC { + > 8 │ constructor(@foo @dec.method(arg) readonly x: number) {} + │ ^^^^^^^^^^^^^^^^^^^^^ + 9 │ } + 10 │ class CCC { + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_constructor.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 9 │ } + 10 │ class CCC { + > 11 │ constructor(@foo @dec.method(arg) private readonly x: number) {} + │ ^^^^^^^^^^^^^^^^^^^^^ + 12 │ } + 13 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_object.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts.snap new file mode 100644 index 000000000000..ddefc96391f7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts.snap @@ -0,0 +1,920 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ + method(@dec x, second, @dec third = 'default') {} + method(@dec.fn() x, second, @dec.fn() third = 'default') {} + method(@dec() x, second, @dec() third = 'default') {} + set val(@dec x) {} + set val(@dec.fn() x) {} + set val(@dec() x) {} +}) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..2 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@2..13 "method" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@14..15 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..19 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@19..20 "x" [] [], + }, + ], + }, + COMMA@20..22 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@22..28 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@28..30 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@30..31 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..35 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@35..41 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@41..43 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@43..52 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@52..54 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@54..55 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@55..56 "}" [] [], + }, + }, + missing separator, + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@56..67 "method" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@67..68 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@68..69 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@69..72 "dec" [] [], + }, + }, + operator_token: DOT@72..73 "." [] [], + member: JsName { + value_token: IDENT@73..75 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@75..76 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@78..79 "x" [] [], + }, + ], + }, + COMMA@79..81 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@81..87 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@87..89 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@89..90 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@90..93 "dec" [] [], + }, + }, + operator_token: DOT@93..94 "." [] [], + member: JsName { + value_token: IDENT@94..96 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@96..97 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@97..99 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@99..105 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@105..107 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@107..116 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@118..119 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@119..120 "}" [] [], + }, + }, + missing separator, + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@120..131 "method" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@131..132 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@132..133 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@133..136 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@136..137 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@137..139 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@139..140 "x" [] [], + }, + ], + }, + COMMA@140..142 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@142..148 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@148..150 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@150..151 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@151..154 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@154..155 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@155..157 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@157..163 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@163..165 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@165..174 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@174..176 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@176..177 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@177..178 "}" [] [], + }, + }, + missing separator, + JsSetterObjectMember { + set_token: SET_KW@178..187 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@187..190 "val" [] [], + }, + l_paren_token: L_PAREN@190..191 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@191..192 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@192..196 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@196..197 "x" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@197..199 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@199..200 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@200..201 "}" [] [], + }, + }, + missing separator, + JsSetterObjectMember { + set_token: SET_KW@201..210 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@210..213 "val" [] [], + }, + l_paren_token: L_PAREN@213..214 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@214..215 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@215..218 "dec" [] [], + }, + }, + operator_token: DOT@218..219 "." [] [], + member: JsName { + value_token: IDENT@219..221 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@221..222 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@222..224 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@224..225 "x" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@225..227 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@227..228 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@228..229 "}" [] [], + }, + }, + missing separator, + JsSetterObjectMember { + set_token: SET_KW@229..238 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@238..241 "val" [] [], + }, + l_paren_token: L_PAREN@241..242 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@242..243 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@243..246 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@246..247 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@247..249 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@249..250 "x" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@250..252 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@252..253 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@253..254 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@254..256 "}" [Newline("\n")] [], + }, + r_paren_token: R_PAREN@256..257 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@257..258 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..258 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..257 + 0: JS_EXPRESSION_STATEMENT@0..257 + 0: JS_PARENTHESIZED_EXPRESSION@0..257 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..256 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@2..254 + 0: JS_METHOD_OBJECT_MEMBER@2..56 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@2..13 + 0: IDENT@2..13 "method" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@13..54 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..52 + 0: JS_BOGUS_PARAMETER@14..20 + 0: JS_BOGUS@14..19 + 0: JS_DECORATOR@14..19 + 0: AT@14..15 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@15..19 + 0: JS_REFERENCE_IDENTIFIER@15..19 + 0: IDENT@15..19 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "x" [] [] + 1: COMMA@20..22 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@22..28 + 0: JS_DECORATOR_LIST@22..22 + 1: JS_IDENTIFIER_BINDING@22..28 + 0: IDENT@22..28 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@28..30 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@30..52 + 0: JS_BOGUS@30..35 + 0: JS_DECORATOR@30..35 + 0: AT@30..31 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@31..35 + 0: JS_REFERENCE_IDENTIFIER@31..35 + 0: IDENT@31..35 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@35..41 + 0: IDENT@35..41 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@41..52 + 0: EQ@41..43 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@43..52 + 0: JS_STRING_LITERAL@43..52 "'default'" [] [] + 2: R_PAREN@52..54 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@54..56 + 0: L_CURLY@54..55 "{" [] [] + 1: JS_DIRECTIVE_LIST@55..55 + 2: JS_STATEMENT_LIST@55..55 + 3: R_CURLY@55..56 "}" [] [] + 1: (empty) + 2: JS_METHOD_OBJECT_MEMBER@56..120 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@56..67 + 0: IDENT@56..67 "method" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@67..118 + 0: L_PAREN@67..68 "(" [] [] + 1: JS_PARAMETER_LIST@68..116 + 0: JS_BOGUS_PARAMETER@68..79 + 0: JS_BOGUS@68..78 + 0: JS_DECORATOR@68..78 + 0: AT@68..69 "@" [] [] + 1: JS_CALL_EXPRESSION@69..78 + 0: JS_STATIC_MEMBER_EXPRESSION@69..75 + 0: JS_IDENTIFIER_EXPRESSION@69..72 + 0: JS_REFERENCE_IDENTIFIER@69..72 + 0: IDENT@69..72 "dec" [] [] + 1: DOT@72..73 "." [] [] + 2: JS_NAME@73..75 + 0: IDENT@73..75 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@75..78 + 0: L_PAREN@75..76 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@76..76 + 2: R_PAREN@76..78 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@78..79 + 0: IDENT@78..79 "x" [] [] + 1: COMMA@79..81 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@81..87 + 0: JS_DECORATOR_LIST@81..81 + 1: JS_IDENTIFIER_BINDING@81..87 + 0: IDENT@81..87 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@87..89 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@89..116 + 0: JS_BOGUS@89..99 + 0: JS_DECORATOR@89..99 + 0: AT@89..90 "@" [] [] + 1: JS_CALL_EXPRESSION@90..99 + 0: JS_STATIC_MEMBER_EXPRESSION@90..96 + 0: JS_IDENTIFIER_EXPRESSION@90..93 + 0: JS_REFERENCE_IDENTIFIER@90..93 + 0: IDENT@90..93 "dec" [] [] + 1: DOT@93..94 "." [] [] + 2: JS_NAME@94..96 + 0: IDENT@94..96 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@96..99 + 0: L_PAREN@96..97 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@97..97 + 2: R_PAREN@97..99 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@99..105 + 0: IDENT@99..105 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@105..116 + 0: EQ@105..107 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@107..116 + 0: JS_STRING_LITERAL@107..116 "'default'" [] [] + 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@118..120 + 0: L_CURLY@118..119 "{" [] [] + 1: JS_DIRECTIVE_LIST@119..119 + 2: JS_STATEMENT_LIST@119..119 + 3: R_CURLY@119..120 "}" [] [] + 3: (empty) + 4: JS_METHOD_OBJECT_MEMBER@120..178 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@120..131 + 0: IDENT@120..131 "method" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@131..176 + 0: L_PAREN@131..132 "(" [] [] + 1: JS_PARAMETER_LIST@132..174 + 0: JS_BOGUS_PARAMETER@132..140 + 0: JS_BOGUS@132..139 + 0: JS_DECORATOR@132..139 + 0: AT@132..133 "@" [] [] + 1: JS_CALL_EXPRESSION@133..139 + 0: JS_IDENTIFIER_EXPRESSION@133..136 + 0: JS_REFERENCE_IDENTIFIER@133..136 + 0: IDENT@133..136 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@136..139 + 0: L_PAREN@136..137 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@137..137 + 2: R_PAREN@137..139 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@139..140 + 0: IDENT@139..140 "x" [] [] + 1: COMMA@140..142 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@142..148 + 0: JS_DECORATOR_LIST@142..142 + 1: JS_IDENTIFIER_BINDING@142..148 + 0: IDENT@142..148 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@148..150 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@150..174 + 0: JS_BOGUS@150..157 + 0: JS_DECORATOR@150..157 + 0: AT@150..151 "@" [] [] + 1: JS_CALL_EXPRESSION@151..157 + 0: JS_IDENTIFIER_EXPRESSION@151..154 + 0: JS_REFERENCE_IDENTIFIER@151..154 + 0: IDENT@151..154 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@154..157 + 0: L_PAREN@154..155 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@155..155 + 2: R_PAREN@155..157 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@157..163 + 0: IDENT@157..163 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@163..174 + 0: EQ@163..165 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@165..174 + 0: JS_STRING_LITERAL@165..174 "'default'" [] [] + 2: R_PAREN@174..176 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@176..178 + 0: L_CURLY@176..177 "{" [] [] + 1: JS_DIRECTIVE_LIST@177..177 + 2: JS_STATEMENT_LIST@177..177 + 3: R_CURLY@177..178 "}" [] [] + 5: (empty) + 6: JS_SETTER_OBJECT_MEMBER@178..201 + 0: SET_KW@178..187 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@187..190 + 0: IDENT@187..190 "val" [] [] + 2: L_PAREN@190..191 "(" [] [] + 3: JS_BOGUS_PARAMETER@191..197 + 0: JS_BOGUS@191..196 + 0: JS_DECORATOR@191..196 + 0: AT@191..192 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@192..196 + 0: JS_REFERENCE_IDENTIFIER@192..196 + 0: IDENT@192..196 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@196..197 + 0: IDENT@196..197 "x" [] [] + 4: (empty) + 5: R_PAREN@197..199 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@199..201 + 0: L_CURLY@199..200 "{" [] [] + 1: JS_DIRECTIVE_LIST@200..200 + 2: JS_STATEMENT_LIST@200..200 + 3: R_CURLY@200..201 "}" [] [] + 7: (empty) + 8: JS_SETTER_OBJECT_MEMBER@201..229 + 0: SET_KW@201..210 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@210..213 + 0: IDENT@210..213 "val" [] [] + 2: L_PAREN@213..214 "(" [] [] + 3: JS_BOGUS_PARAMETER@214..225 + 0: JS_BOGUS@214..224 + 0: JS_DECORATOR@214..224 + 0: AT@214..215 "@" [] [] + 1: JS_CALL_EXPRESSION@215..224 + 0: JS_STATIC_MEMBER_EXPRESSION@215..221 + 0: JS_IDENTIFIER_EXPRESSION@215..218 + 0: JS_REFERENCE_IDENTIFIER@215..218 + 0: IDENT@215..218 "dec" [] [] + 1: DOT@218..219 "." [] [] + 2: JS_NAME@219..221 + 0: IDENT@219..221 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@221..224 + 0: L_PAREN@221..222 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@222..222 + 2: R_PAREN@222..224 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@224..225 + 0: IDENT@224..225 "x" [] [] + 4: (empty) + 5: R_PAREN@225..227 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@227..229 + 0: L_CURLY@227..228 "{" [] [] + 1: JS_DIRECTIVE_LIST@228..228 + 2: JS_STATEMENT_LIST@228..228 + 3: R_CURLY@228..229 "}" [] [] + 9: (empty) + 10: JS_SETTER_OBJECT_MEMBER@229..254 + 0: SET_KW@229..238 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@238..241 + 0: IDENT@238..241 "val" [] [] + 2: L_PAREN@241..242 "(" [] [] + 3: JS_BOGUS_PARAMETER@242..250 + 0: JS_BOGUS@242..249 + 0: JS_DECORATOR@242..249 + 0: AT@242..243 "@" [] [] + 1: JS_CALL_EXPRESSION@243..249 + 0: JS_IDENTIFIER_EXPRESSION@243..246 + 0: JS_REFERENCE_IDENTIFIER@243..246 + 0: IDENT@243..246 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@246..249 + 0: L_PAREN@246..247 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@247..247 + 2: R_PAREN@247..249 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@249..250 + 0: IDENT@249..250 "x" [] [] + 4: (empty) + 5: R_PAREN@250..252 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@252..254 + 0: L_CURLY@252..253 "{" [] [] + 1: JS_DIRECTIVE_LIST@253..253 + 2: JS_STATEMENT_LIST@253..253 + 3: R_CURLY@253..254 "}" [] [] + 2: R_CURLY@254..256 "}" [Newline("\n")] [] + 2: R_PAREN@256..257 ")" [] [] + 1: (empty) + 4: EOF@257..258 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_object.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ ({ + > 2 │ method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ ({ + > 2 │ method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `method` + + 1 │ ({ + 2 │ method(@dec x, second, @dec third = 'default') {} + > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^ + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ set val(@dec x) {} + + i Remove method + +ts_decorator_object.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ ({ + 2 │ method(@dec x, second, @dec third = 'default') {} + > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ set val(@dec x) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ ({ + 2 │ method(@dec x, second, @dec third = 'default') {} + > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ set val(@dec x) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `method` + + 2 │ method(@dec x, second, @dec third = 'default') {} + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ set val(@dec x) {} + 6 │ set val(@dec.fn() x) {} + + i Remove method + +ts_decorator_object.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ method(@dec x, second, @dec third = 'default') {} + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ set val(@dec x) {} + 6 │ set val(@dec.fn() x) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ method(@dec x, second, @dec third = 'default') {} + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ set val(@dec x) {} + 6 │ set val(@dec.fn() x) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `set` + + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + > 5 │ set val(@dec x) {} + │ ^^^ + 6 │ set val(@dec.fn() x) {} + 7 │ set val(@dec() x) {} + + i Remove set + +ts_decorator_object.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + > 5 │ set val(@dec x) {} + │ ^^^^ + 6 │ set val(@dec.fn() x) {} + 7 │ set val(@dec() x) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `set` + + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ set val(@dec x) {} + > 6 │ set val(@dec.fn() x) {} + │ ^^^ + 7 │ set val(@dec() x) {} + 8 │ }) + + i Remove set + +ts_decorator_object.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ set val(@dec x) {} + > 6 │ set val(@dec.fn() x) {} + │ ^^^^^^^^^ + 7 │ set val(@dec() x) {} + 8 │ }) + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_object.ts:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `set` + + 5 │ set val(@dec x) {} + 6 │ set val(@dec.fn() x) {} + > 7 │ set val(@dec() x) {} + │ ^^^ + 8 │ }) + 9 │ + + i Remove set + +ts_decorator_object.ts:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ set val(@dec x) {} + 6 │ set val(@dec.fn() x) {} + > 7 │ set val(@dec() x) {} + │ ^^^^^^ + 8 │ }) + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap new file mode 100644 index 000000000000..80b30da1a539 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap @@ -0,0 +1,1145 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a { + function method(@dec x, second, @dec third = 'default') {} + function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + function method(@dec() x, second, @dec() third = 'default') {} +} +declare function method(@dec x, second, @dec third = 'default') +declare function method(@dec.fn() x, second, @dec.fn() third = 'default') +declare function method(@dec() x, second, @dec() third = 'default') + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@15..17 "a" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@17..18 "{" [] [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@30..36 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@37..38 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..42 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@42..43 "x" [] [], + }, + ], + }, + COMMA@43..45 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@45..51 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@51..53 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@53..54 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@54..58 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@58..64 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@64..66 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@66..75 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@77..78 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@78..79 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + FUNCTION_KW@79..91 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@91..97 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@97..98 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@98..99 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@99..102 "dec" [] [], + }, + }, + operator_token: DOT@102..103 "." [] [], + member: JsName { + value_token: IDENT@103..105 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@105..106 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@106..108 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@108..109 "x" [] [], + }, + ], + }, + COMMA@109..111 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@111..117 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@117..119 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@119..120 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@120..123 "dec" [] [], + }, + }, + operator_token: DOT@123..124 "." [] [], + member: JsName { + value_token: IDENT@124..126 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@126..127 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@129..135 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@135..137 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@137..146 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@146..148 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@148..149 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@149..150 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + FUNCTION_KW@150..162 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@162..168 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@168..169 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@169..170 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@170..173 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@173..174 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@174..176 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@176..177 "x" [] [], + }, + ], + }, + COMMA@177..179 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@179..185 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@185..187 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@187..188 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@188..191 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@191..192 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@194..200 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@200..202 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@202..211 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@211..213 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@213..214 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@214..215 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@215..217 "}" [Newline("\n")] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@217..226 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@226..235 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@235..241 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@241..242 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@242..243 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@243..247 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@247..248 "x" [] [], + }, + ], + }, + COMMA@248..250 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@250..256 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@256..258 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@258..259 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@259..263 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@263..269 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@269..271 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@271..280 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@280..281 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@281..290 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@290..299 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@299..305 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@305..306 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@306..307 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@307..310 "dec" [] [], + }, + }, + operator_token: DOT@310..311 "." [] [], + member: JsName { + value_token: IDENT@311..313 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@313..314 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@314..316 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@316..317 "x" [] [], + }, + ], + }, + COMMA@317..319 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@319..325 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@325..327 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@327..328 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@328..331 "dec" [] [], + }, + }, + operator_token: DOT@331..332 "." [] [], + member: JsName { + value_token: IDENT@332..334 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@334..335 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@335..337 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@337..343 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@343..345 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@345..354 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@354..355 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@355..364 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@364..373 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@373..379 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@379..380 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@380..381 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@381..384 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@384..385 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@385..387 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@387..388 "x" [] [], + }, + ], + }, + COMMA@388..390 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@390..396 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@396..398 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@398..399 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@399..402 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@402..403 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@403..405 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@405..411 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@411..413 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@413..422 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@422..423 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@423..424 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..424 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..423 + 0: TS_DECLARE_STATEMENT@0..217 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..217 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "a" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@17..217 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_MODULE_ITEM_LIST@18..215 + 0: JS_BOGUS_STATEMENT@18..79 + 0: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@30..36 + 0: IDENT@30..36 "method" [] [] + 2: JS_PARAMETERS@36..77 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_PARAMETER_LIST@37..75 + 0: JS_BOGUS_PARAMETER@37..43 + 0: JS_BOGUS@37..42 + 0: JS_DECORATOR@37..42 + 0: AT@37..38 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@38..42 + 0: JS_REFERENCE_IDENTIFIER@38..42 + 0: IDENT@38..42 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@42..43 + 0: IDENT@42..43 "x" [] [] + 1: COMMA@43..45 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@45..51 + 0: JS_DECORATOR_LIST@45..45 + 1: JS_IDENTIFIER_BINDING@45..51 + 0: IDENT@45..51 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@51..53 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@53..75 + 0: JS_BOGUS@53..58 + 0: JS_DECORATOR@53..58 + 0: AT@53..54 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@54..58 + 0: JS_REFERENCE_IDENTIFIER@54..58 + 0: IDENT@54..58 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@58..64 + 0: IDENT@58..64 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@64..75 + 0: EQ@64..66 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@66..75 + 0: JS_STRING_LITERAL@66..75 "'default'" [] [] + 2: R_PAREN@75..77 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@77..79 + 0: L_CURLY@77..78 "{" [] [] + 1: JS_DIRECTIVE_LIST@78..78 + 2: JS_STATEMENT_LIST@78..78 + 3: R_CURLY@78..79 "}" [] [] + 1: JS_BOGUS_STATEMENT@79..150 + 0: FUNCTION_KW@79..91 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@91..97 + 0: IDENT@91..97 "method" [] [] + 2: JS_PARAMETERS@97..148 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_PARAMETER_LIST@98..146 + 0: JS_BOGUS_PARAMETER@98..109 + 0: JS_BOGUS@98..108 + 0: JS_DECORATOR@98..108 + 0: AT@98..99 "@" [] [] + 1: JS_CALL_EXPRESSION@99..108 + 0: JS_STATIC_MEMBER_EXPRESSION@99..105 + 0: JS_IDENTIFIER_EXPRESSION@99..102 + 0: JS_REFERENCE_IDENTIFIER@99..102 + 0: IDENT@99..102 "dec" [] [] + 1: DOT@102..103 "." [] [] + 2: JS_NAME@103..105 + 0: IDENT@103..105 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@105..108 + 0: L_PAREN@105..106 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@106..106 + 2: R_PAREN@106..108 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@108..109 + 0: IDENT@108..109 "x" [] [] + 1: COMMA@109..111 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@111..117 + 0: JS_DECORATOR_LIST@111..111 + 1: JS_IDENTIFIER_BINDING@111..117 + 0: IDENT@111..117 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@117..119 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@119..146 + 0: JS_BOGUS@119..129 + 0: JS_DECORATOR@119..129 + 0: AT@119..120 "@" [] [] + 1: JS_CALL_EXPRESSION@120..129 + 0: JS_STATIC_MEMBER_EXPRESSION@120..126 + 0: JS_IDENTIFIER_EXPRESSION@120..123 + 0: JS_REFERENCE_IDENTIFIER@120..123 + 0: IDENT@120..123 "dec" [] [] + 1: DOT@123..124 "." [] [] + 2: JS_NAME@124..126 + 0: IDENT@124..126 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@126..129 + 0: L_PAREN@126..127 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@127..127 + 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@129..135 + 0: IDENT@129..135 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@135..146 + 0: EQ@135..137 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@137..146 + 0: JS_STRING_LITERAL@137..146 "'default'" [] [] + 2: R_PAREN@146..148 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@148..150 + 0: L_CURLY@148..149 "{" [] [] + 1: JS_DIRECTIVE_LIST@149..149 + 2: JS_STATEMENT_LIST@149..149 + 3: R_CURLY@149..150 "}" [] [] + 2: JS_BOGUS_STATEMENT@150..215 + 0: FUNCTION_KW@150..162 "function" [Newline("\n"), Whitespace("\t\t")] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@162..168 + 0: IDENT@162..168 "method" [] [] + 2: JS_PARAMETERS@168..213 + 0: L_PAREN@168..169 "(" [] [] + 1: JS_PARAMETER_LIST@169..211 + 0: JS_BOGUS_PARAMETER@169..177 + 0: JS_BOGUS@169..176 + 0: JS_DECORATOR@169..176 + 0: AT@169..170 "@" [] [] + 1: JS_CALL_EXPRESSION@170..176 + 0: JS_IDENTIFIER_EXPRESSION@170..173 + 0: JS_REFERENCE_IDENTIFIER@170..173 + 0: IDENT@170..173 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@173..176 + 0: L_PAREN@173..174 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@174..174 + 2: R_PAREN@174..176 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@176..177 + 0: IDENT@176..177 "x" [] [] + 1: COMMA@177..179 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@179..185 + 0: JS_DECORATOR_LIST@179..179 + 1: JS_IDENTIFIER_BINDING@179..185 + 0: IDENT@179..185 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@185..187 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@187..211 + 0: JS_BOGUS@187..194 + 0: JS_DECORATOR@187..194 + 0: AT@187..188 "@" [] [] + 1: JS_CALL_EXPRESSION@188..194 + 0: JS_IDENTIFIER_EXPRESSION@188..191 + 0: JS_REFERENCE_IDENTIFIER@188..191 + 0: IDENT@188..191 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@191..194 + 0: L_PAREN@191..192 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@192..192 + 2: R_PAREN@192..194 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@194..200 + 0: IDENT@194..200 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@200..211 + 0: EQ@200..202 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@202..211 + 0: JS_STRING_LITERAL@202..211 "'default'" [] [] + 2: R_PAREN@211..213 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@213..215 + 0: L_CURLY@213..214 "{" [] [] + 1: JS_DIRECTIVE_LIST@214..214 + 2: JS_STATEMENT_LIST@214..214 + 3: R_CURLY@214..215 "}" [] [] + 2: R_CURLY@215..217 "}" [Newline("\n")] [] + 1: TS_DECLARE_STATEMENT@217..281 + 0: DECLARE_KW@217..226 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@226..281 + 0: (empty) + 1: FUNCTION_KW@226..235 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@235..241 + 0: IDENT@235..241 "method" [] [] + 3: (empty) + 4: JS_PARAMETERS@241..281 + 0: L_PAREN@241..242 "(" [] [] + 1: JS_PARAMETER_LIST@242..280 + 0: JS_BOGUS_PARAMETER@242..248 + 0: JS_BOGUS@242..247 + 0: JS_DECORATOR@242..247 + 0: AT@242..243 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@243..247 + 0: JS_REFERENCE_IDENTIFIER@243..247 + 0: IDENT@243..247 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@247..248 + 0: IDENT@247..248 "x" [] [] + 1: COMMA@248..250 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@250..256 + 0: JS_DECORATOR_LIST@250..250 + 1: JS_IDENTIFIER_BINDING@250..256 + 0: IDENT@250..256 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@256..258 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@258..280 + 0: JS_BOGUS@258..263 + 0: JS_DECORATOR@258..263 + 0: AT@258..259 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@259..263 + 0: JS_REFERENCE_IDENTIFIER@259..263 + 0: IDENT@259..263 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@263..269 + 0: IDENT@263..269 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@269..280 + 0: EQ@269..271 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@271..280 + 0: JS_STRING_LITERAL@271..280 "'default'" [] [] + 2: R_PAREN@280..281 ")" [] [] + 5: (empty) + 6: (empty) + 2: TS_DECLARE_STATEMENT@281..355 + 0: DECLARE_KW@281..290 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@290..355 + 0: (empty) + 1: FUNCTION_KW@290..299 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@299..305 + 0: IDENT@299..305 "method" [] [] + 3: (empty) + 4: JS_PARAMETERS@305..355 + 0: L_PAREN@305..306 "(" [] [] + 1: JS_PARAMETER_LIST@306..354 + 0: JS_BOGUS_PARAMETER@306..317 + 0: JS_BOGUS@306..316 + 0: JS_DECORATOR@306..316 + 0: AT@306..307 "@" [] [] + 1: JS_CALL_EXPRESSION@307..316 + 0: JS_STATIC_MEMBER_EXPRESSION@307..313 + 0: JS_IDENTIFIER_EXPRESSION@307..310 + 0: JS_REFERENCE_IDENTIFIER@307..310 + 0: IDENT@307..310 "dec" [] [] + 1: DOT@310..311 "." [] [] + 2: JS_NAME@311..313 + 0: IDENT@311..313 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@313..316 + 0: L_PAREN@313..314 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@314..314 + 2: R_PAREN@314..316 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@316..317 + 0: IDENT@316..317 "x" [] [] + 1: COMMA@317..319 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@319..325 + 0: JS_DECORATOR_LIST@319..319 + 1: JS_IDENTIFIER_BINDING@319..325 + 0: IDENT@319..325 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@325..327 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@327..354 + 0: JS_BOGUS@327..337 + 0: JS_DECORATOR@327..337 + 0: AT@327..328 "@" [] [] + 1: JS_CALL_EXPRESSION@328..337 + 0: JS_STATIC_MEMBER_EXPRESSION@328..334 + 0: JS_IDENTIFIER_EXPRESSION@328..331 + 0: JS_REFERENCE_IDENTIFIER@328..331 + 0: IDENT@328..331 "dec" [] [] + 1: DOT@331..332 "." [] [] + 2: JS_NAME@332..334 + 0: IDENT@332..334 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@334..337 + 0: L_PAREN@334..335 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@335..335 + 2: R_PAREN@335..337 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@337..343 + 0: IDENT@337..343 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@343..354 + 0: EQ@343..345 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@345..354 + 0: JS_STRING_LITERAL@345..354 "'default'" [] [] + 2: R_PAREN@354..355 ")" [] [] + 5: (empty) + 6: (empty) + 3: TS_DECLARE_STATEMENT@355..423 + 0: DECLARE_KW@355..364 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@364..423 + 0: (empty) + 1: FUNCTION_KW@364..373 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@373..379 + 0: IDENT@373..379 "method" [] [] + 3: (empty) + 4: JS_PARAMETERS@379..423 + 0: L_PAREN@379..380 "(" [] [] + 1: JS_PARAMETER_LIST@380..422 + 0: JS_BOGUS_PARAMETER@380..388 + 0: JS_BOGUS@380..387 + 0: JS_DECORATOR@380..387 + 0: AT@380..381 "@" [] [] + 1: JS_CALL_EXPRESSION@381..387 + 0: JS_IDENTIFIER_EXPRESSION@381..384 + 0: JS_REFERENCE_IDENTIFIER@381..384 + 0: IDENT@381..384 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@384..387 + 0: L_PAREN@384..385 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@385..385 + 2: R_PAREN@385..387 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@387..388 + 0: IDENT@387..388 "x" [] [] + 1: COMMA@388..390 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@390..396 + 0: JS_DECORATOR_LIST@390..390 + 1: JS_IDENTIFIER_BINDING@390..396 + 0: IDENT@390..396 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@396..398 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@398..422 + 0: JS_BOGUS@398..405 + 0: JS_DECORATOR@398..405 + 0: AT@398..399 "@" [] [] + 1: JS_CALL_EXPRESSION@399..405 + 0: JS_IDENTIFIER_EXPRESSION@399..402 + 0: JS_REFERENCE_IDENTIFIER@399..402 + 0: IDENT@399..402 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@402..405 + 0: L_PAREN@402..403 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@403..403 + 2: R_PAREN@403..405 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@405..411 + 0: IDENT@405..411 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@411..422 + 0: EQ@411..413 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@413..422 + 0: JS_STRING_LITERAL@413..422 "'default'" [] [] + 2: R_PAREN@422..423 ")" [] [] + 5: (empty) + 6: (empty) + 4: EOF@423..424 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_ambient_function.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ declare module a { + > 2 │ function method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:2:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ declare module a { + > 2 │ function method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:2:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A 'declare' function cannot have a function body + + 1 │ declare module a { + > 2 │ function method(@dec x, second, @dec third = 'default') {} + │ ^^ + 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + + i remove this body + +ts_decorator_on_ambient_function.ts:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ declare module a { + 2 │ function method(@dec x, second, @dec third = 'default') {} + > 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + 5 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:3:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ declare module a { + 2 │ function method(@dec x, second, @dec third = 'default') {} + > 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + 5 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:3:69 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A 'declare' function cannot have a function body + + 1 │ declare module a { + 2 │ function method(@dec x, second, @dec third = 'default') {} + > 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^ + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + 5 │ } + + i remove this body + +ts_decorator_on_ambient_function.ts:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ function method(@dec x, second, @dec third = 'default') {} + 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ function method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ } + 6 │ declare function method(@dec x, second, @dec third = 'default') + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:4:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ function method(@dec x, second, @dec third = 'default') {} + 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ function method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ } + 6 │ declare function method(@dec x, second, @dec third = 'default') + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:4:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A 'declare' function cannot have a function body + + 2 │ function method(@dec x, second, @dec third = 'default') {} + 3 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ function method(@dec() x, second, @dec() third = 'default') {} + │ ^^ + 5 │ } + 6 │ declare function method(@dec x, second, @dec third = 'default') + + i remove this body + +ts_decorator_on_ambient_function.ts:6:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + 5 │ } + > 6 │ declare function method(@dec x, second, @dec third = 'default') + │ ^^^^ + 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') + 8 │ declare function method(@dec() x, second, @dec() third = 'default') + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:6:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ function method(@dec() x, second, @dec() third = 'default') {} + 5 │ } + > 6 │ declare function method(@dec x, second, @dec third = 'default') + │ ^^^^ + 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') + 8 │ declare function method(@dec() x, second, @dec() third = 'default') + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:7:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ } + 6 │ declare function method(@dec x, second, @dec third = 'default') + > 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') + │ ^^^^^^^^^ + 8 │ declare function method(@dec() x, second, @dec() third = 'default') + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:7:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ } + 6 │ declare function method(@dec x, second, @dec third = 'default') + > 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') + │ ^^^^^^^^^ + 8 │ declare function method(@dec() x, second, @dec() third = 'default') + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:8:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 6 │ declare function method(@dec x, second, @dec third = 'default') + 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') + > 8 │ declare function method(@dec() x, second, @dec() third = 'default') + │ ^^^^^^ + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_ambient_function.ts:8:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 6 │ declare function method(@dec x, second, @dec third = 'default') + 7 │ declare function method(@dec.fn() x, second, @dec.fn() third = 'default') + > 8 │ declare function method(@dec() x, second, @dec() third = 'default') + │ ^^^^^^ + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap new file mode 100644 index 000000000000..649d13fcdaf3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap @@ -0,0 +1,641 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const method = (@dec x, second, @dec third = 'default') => {}; +const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; +const method = (@dec() x, second, @dec() third = 'default') => {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..13 "method" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@13..15 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@15..16 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@16..17 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..21 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@21..22 "x" [] [], + }, + ], + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..30 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@32..33 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..37 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@37..43 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@43..45 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@45..54 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@56..59 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@59..60 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@61..62 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@62..69 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@69..76 "method" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@78..79 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@79..80 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@80..83 "dec" [] [], + }, + }, + operator_token: DOT@83..84 "." [] [], + member: JsName { + value_token: IDENT@84..86 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@86..87 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@87..89 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@89..90 "x" [] [], + }, + ], + }, + COMMA@90..92 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@92..98 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@98..100 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@100..101 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@101..104 "dec" [] [], + }, + }, + operator_token: DOT@104..105 "." [] [], + member: JsName { + value_token: IDENT@105..107 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@107..108 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@110..116 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@116..118 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@118..127 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@132..133 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@133..134 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@134..135 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@135..142 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@142..149 "method" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@149..151 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@151..152 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@152..153 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@153..156 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@156..157 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@157..159 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@159..160 "x" [] [], + }, + ], + }, + COMMA@160..162 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@162..168 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@168..170 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@170..171 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@171..174 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@174..175 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@175..177 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@177..183 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@183..185 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@185..194 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@194..196 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@196..199 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@199..200 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@200..201 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@201..202 ";" [] [], + }, + ], + eof_token: EOF@202..203 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..203 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..202 + 0: JS_VARIABLE_STATEMENT@0..62 + 0: JS_VARIABLE_DECLARATION@0..61 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..61 + 0: JS_VARIABLE_DECLARATOR@6..61 + 0: JS_IDENTIFIER_BINDING@6..13 + 0: IDENT@6..13 "method" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@13..61 + 0: EQ@13..15 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@15..61 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@15..56 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_PARAMETER_LIST@16..54 + 0: JS_BOGUS_PARAMETER@16..22 + 0: JS_BOGUS@16..21 + 0: JS_DECORATOR@16..21 + 0: AT@16..17 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@17..21 + 0: JS_REFERENCE_IDENTIFIER@17..21 + 0: IDENT@17..21 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "x" [] [] + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@24..30 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..30 + 0: IDENT@24..30 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@30..32 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@32..54 + 0: JS_BOGUS@32..37 + 0: JS_DECORATOR@32..37 + 0: AT@32..33 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@33..37 + 0: JS_REFERENCE_IDENTIFIER@33..37 + 0: IDENT@33..37 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@37..43 + 0: IDENT@37..43 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@43..54 + 0: EQ@43..45 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@45..54 + 0: JS_STRING_LITERAL@45..54 "'default'" [] [] + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@56..59 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_DIRECTIVE_LIST@60..60 + 2: JS_STATEMENT_LIST@60..60 + 3: R_CURLY@60..61 "}" [] [] + 1: SEMICOLON@61..62 ";" [] [] + 1: JS_VARIABLE_STATEMENT@62..135 + 0: JS_VARIABLE_DECLARATION@62..134 + 0: (empty) + 1: CONST_KW@62..69 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@69..134 + 0: JS_VARIABLE_DECLARATOR@69..134 + 0: JS_IDENTIFIER_BINDING@69..76 + 0: IDENT@69..76 "method" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@76..134 + 0: EQ@76..78 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@78..134 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@78..129 + 0: L_PAREN@78..79 "(" [] [] + 1: JS_PARAMETER_LIST@79..127 + 0: JS_BOGUS_PARAMETER@79..90 + 0: JS_BOGUS@79..89 + 0: JS_DECORATOR@79..89 + 0: AT@79..80 "@" [] [] + 1: JS_CALL_EXPRESSION@80..89 + 0: JS_STATIC_MEMBER_EXPRESSION@80..86 + 0: JS_IDENTIFIER_EXPRESSION@80..83 + 0: JS_REFERENCE_IDENTIFIER@80..83 + 0: IDENT@80..83 "dec" [] [] + 1: DOT@83..84 "." [] [] + 2: JS_NAME@84..86 + 0: IDENT@84..86 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@86..89 + 0: L_PAREN@86..87 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@87..87 + 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@89..90 + 0: IDENT@89..90 "x" [] [] + 1: COMMA@90..92 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@92..98 + 0: JS_DECORATOR_LIST@92..92 + 1: JS_IDENTIFIER_BINDING@92..98 + 0: IDENT@92..98 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@98..100 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@100..127 + 0: JS_BOGUS@100..110 + 0: JS_DECORATOR@100..110 + 0: AT@100..101 "@" [] [] + 1: JS_CALL_EXPRESSION@101..110 + 0: JS_STATIC_MEMBER_EXPRESSION@101..107 + 0: JS_IDENTIFIER_EXPRESSION@101..104 + 0: JS_REFERENCE_IDENTIFIER@101..104 + 0: IDENT@101..104 "dec" [] [] + 1: DOT@104..105 "." [] [] + 2: JS_NAME@105..107 + 0: IDENT@105..107 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@107..110 + 0: L_PAREN@107..108 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@108..108 + 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@110..116 + 0: IDENT@110..116 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@116..127 + 0: EQ@116..118 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@118..127 + 0: JS_STRING_LITERAL@118..127 "'default'" [] [] + 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@132..134 + 0: L_CURLY@132..133 "{" [] [] + 1: JS_DIRECTIVE_LIST@133..133 + 2: JS_STATEMENT_LIST@133..133 + 3: R_CURLY@133..134 "}" [] [] + 1: SEMICOLON@134..135 ";" [] [] + 2: JS_VARIABLE_STATEMENT@135..202 + 0: JS_VARIABLE_DECLARATION@135..201 + 0: (empty) + 1: CONST_KW@135..142 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@142..201 + 0: JS_VARIABLE_DECLARATOR@142..201 + 0: JS_IDENTIFIER_BINDING@142..149 + 0: IDENT@142..149 "method" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@149..201 + 0: EQ@149..151 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@151..201 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@151..196 + 0: L_PAREN@151..152 "(" [] [] + 1: JS_PARAMETER_LIST@152..194 + 0: JS_BOGUS_PARAMETER@152..160 + 0: JS_BOGUS@152..159 + 0: JS_DECORATOR@152..159 + 0: AT@152..153 "@" [] [] + 1: JS_CALL_EXPRESSION@153..159 + 0: JS_IDENTIFIER_EXPRESSION@153..156 + 0: JS_REFERENCE_IDENTIFIER@153..156 + 0: IDENT@153..156 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@156..159 + 0: L_PAREN@156..157 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@157..157 + 2: R_PAREN@157..159 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@159..160 + 0: IDENT@159..160 "x" [] [] + 1: COMMA@160..162 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@162..168 + 0: JS_DECORATOR_LIST@162..162 + 1: JS_IDENTIFIER_BINDING@162..168 + 0: IDENT@162..168 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@168..170 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@170..194 + 0: JS_BOGUS@170..177 + 0: JS_DECORATOR@170..177 + 0: AT@170..171 "@" [] [] + 1: JS_CALL_EXPRESSION@171..177 + 0: JS_IDENTIFIER_EXPRESSION@171..174 + 0: JS_REFERENCE_IDENTIFIER@171..174 + 0: IDENT@171..174 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@174..177 + 0: L_PAREN@174..175 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@175..175 + 2: R_PAREN@175..177 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@177..183 + 0: IDENT@177..183 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@183..194 + 0: EQ@183..185 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@185..194 + 0: JS_STRING_LITERAL@185..194 "'default'" [] [] + 2: R_PAREN@194..196 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@196..199 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@199..201 + 0: L_CURLY@199..200 "{" [] [] + 1: JS_DIRECTIVE_LIST@200..200 + 2: JS_STATEMENT_LIST@200..200 + 3: R_CURLY@200..201 "}" [] [] + 1: SEMICOLON@201..202 ";" [] [] + 4: EOF@202..203 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_arrow_function.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ const method = (@dec x, second, @dec third = 'default') => {}; + │ ^^^^ + 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; + 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_arrow_function.ts:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ const method = (@dec x, second, @dec third = 'default') => {}; + │ ^^^^ + 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; + 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_arrow_function.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const method = (@dec x, second, @dec third = 'default') => {}; + > 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; + │ ^^^^^^^^^ + 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_arrow_function.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const method = (@dec x, second, @dec third = 'default') => {}; + > 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; + │ ^^^^^^^^^ + 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_arrow_function.ts:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const method = (@dec x, second, @dec third = 'default') => {}; + 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; + > 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_arrow_function.ts:3:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const method = (@dec x, second, @dec third = 'default') => {}; + 2 │ const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; + > 3 │ const method = (@dec() x, second, @dec() third = 'default') => {}; + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap new file mode 100644 index 000000000000..e9abdb26e989 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap @@ -0,0 +1,1201 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec x, second, @dec third = 'default') {} + method(@dec.fn() x, second, @dec.fn() third = 'default') {} + method(@dec() x, second, @dec() third = 'default') {} + static method(@dec x, second, @dec third = 'default') {} + static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + static method(@dec() x, second, @dec() third = 'default') {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@21..22 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@22..26 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@26..27 "x" [] [], + }, + ], + }, + COMMA@27..29 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@29..35 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@35..37 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@37..38 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..42 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@42..48 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@48..50 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@50..59 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@61..62 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@74..75 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@75..76 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@76..79 "dec" [] [], + }, + }, + operator_token: DOT@79..80 "." [] [], + member: JsName { + value_token: IDENT@80..82 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@82..83 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@85..86 "x" [] [], + }, + ], + }, + COMMA@86..88 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@88..94 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@94..96 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@96..97 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@97..100 "dec" [] [], + }, + }, + operator_token: DOT@100..101 "." [] [], + member: JsName { + value_token: IDENT@101..103 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@103..104 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@104..106 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@106..112 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@112..114 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@114..123 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@123..125 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@125..126 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@126..127 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@138..139 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@139..140 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@140..143 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@143..144 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@144..146 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@146..147 "x" [] [], + }, + ], + }, + COMMA@147..149 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@149..155 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@155..157 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@157..158 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@158..161 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@161..162 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@162..164 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@164..170 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@170..172 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@172..181 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@183..184 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@184..185 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@197..203 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@203..204 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@204..205 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@205..209 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@209..210 "x" [] [], + }, + ], + }, + COMMA@210..212 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@212..218 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@218..220 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@220..221 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@221..225 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@225..231 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@231..233 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@233..242 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@242..244 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@244..245 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@245..246 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@258..264 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@264..265 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@265..266 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@266..269 "dec" [] [], + }, + }, + operator_token: DOT@269..270 "." [] [], + member: JsName { + value_token: IDENT@270..272 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@272..273 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@273..275 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@275..276 "x" [] [], + }, + ], + }, + COMMA@276..278 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@278..284 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@284..286 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@286..287 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@287..290 "dec" [] [], + }, + }, + operator_token: DOT@290..291 "." [] [], + member: JsName { + value_token: IDENT@291..293 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@293..294 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@294..296 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@296..302 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@302..304 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@304..313 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@313..315 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@315..316 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@316..317 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@329..335 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@335..336 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@336..337 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@337..340 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@340..341 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@341..343 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@343..344 "x" [] [], + }, + ], + }, + COMMA@344..346 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@346..352 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@352..354 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@354..355 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@355..358 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@358..359 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@359..361 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@361..367 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@367..369 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@369..378 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@378..380 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@380..381 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@381..382 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@382..384 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@384..385 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..385 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..384 + 0: JS_CLASS_DECLARATION@0..384 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..382 + 0: JS_METHOD_CLASS_MEMBER@9..63 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@9..20 + 0: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@20..61 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..59 + 0: JS_BOGUS_PARAMETER@21..27 + 0: JS_BOGUS@21..26 + 0: JS_DECORATOR@21..26 + 0: AT@21..22 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@22..26 + 0: JS_REFERENCE_IDENTIFIER@22..26 + 0: IDENT@22..26 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@26..27 + 0: IDENT@26..27 "x" [] [] + 1: COMMA@27..29 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@29..35 + 0: JS_DECORATOR_LIST@29..29 + 1: JS_IDENTIFIER_BINDING@29..35 + 0: IDENT@29..35 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@35..37 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@37..59 + 0: JS_BOGUS@37..42 + 0: JS_DECORATOR@37..42 + 0: AT@37..38 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@38..42 + 0: JS_REFERENCE_IDENTIFIER@38..42 + 0: IDENT@38..42 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@42..48 + 0: IDENT@42..48 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@48..59 + 0: EQ@48..50 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@50..59 + 0: JS_STRING_LITERAL@50..59 "'default'" [] [] + 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@61..63 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_DIRECTIVE_LIST@62..62 + 2: JS_STATEMENT_LIST@62..62 + 3: R_CURLY@62..63 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@63..127 + 0: JS_METHOD_MODIFIER_LIST@63..63 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@63..74 + 0: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@74..125 + 0: L_PAREN@74..75 "(" [] [] + 1: JS_PARAMETER_LIST@75..123 + 0: JS_BOGUS_PARAMETER@75..86 + 0: JS_BOGUS@75..85 + 0: JS_DECORATOR@75..85 + 0: AT@75..76 "@" [] [] + 1: JS_CALL_EXPRESSION@76..85 + 0: JS_STATIC_MEMBER_EXPRESSION@76..82 + 0: JS_IDENTIFIER_EXPRESSION@76..79 + 0: JS_REFERENCE_IDENTIFIER@76..79 + 0: IDENT@76..79 "dec" [] [] + 1: DOT@79..80 "." [] [] + 2: JS_NAME@80..82 + 0: IDENT@80..82 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@82..85 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@83..83 + 2: R_PAREN@83..85 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@85..86 + 0: IDENT@85..86 "x" [] [] + 1: COMMA@86..88 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@88..94 + 0: JS_DECORATOR_LIST@88..88 + 1: JS_IDENTIFIER_BINDING@88..94 + 0: IDENT@88..94 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@94..96 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@96..123 + 0: JS_BOGUS@96..106 + 0: JS_DECORATOR@96..106 + 0: AT@96..97 "@" [] [] + 1: JS_CALL_EXPRESSION@97..106 + 0: JS_STATIC_MEMBER_EXPRESSION@97..103 + 0: JS_IDENTIFIER_EXPRESSION@97..100 + 0: JS_REFERENCE_IDENTIFIER@97..100 + 0: IDENT@97..100 "dec" [] [] + 1: DOT@100..101 "." [] [] + 2: JS_NAME@101..103 + 0: IDENT@101..103 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@103..106 + 0: L_PAREN@103..104 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@104..104 + 2: R_PAREN@104..106 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@106..112 + 0: IDENT@106..112 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@112..123 + 0: EQ@112..114 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@114..123 + 0: JS_STRING_LITERAL@114..123 "'default'" [] [] + 2: R_PAREN@123..125 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@125..127 + 0: L_CURLY@125..126 "{" [] [] + 1: JS_DIRECTIVE_LIST@126..126 + 2: JS_STATEMENT_LIST@126..126 + 3: R_CURLY@126..127 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@127..185 + 0: JS_METHOD_MODIFIER_LIST@127..127 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@127..138 + 0: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@138..183 + 0: L_PAREN@138..139 "(" [] [] + 1: JS_PARAMETER_LIST@139..181 + 0: JS_BOGUS_PARAMETER@139..147 + 0: JS_BOGUS@139..146 + 0: JS_DECORATOR@139..146 + 0: AT@139..140 "@" [] [] + 1: JS_CALL_EXPRESSION@140..146 + 0: JS_IDENTIFIER_EXPRESSION@140..143 + 0: JS_REFERENCE_IDENTIFIER@140..143 + 0: IDENT@140..143 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@143..146 + 0: L_PAREN@143..144 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@144..144 + 2: R_PAREN@144..146 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@146..147 + 0: IDENT@146..147 "x" [] [] + 1: COMMA@147..149 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@149..155 + 0: JS_DECORATOR_LIST@149..149 + 1: JS_IDENTIFIER_BINDING@149..155 + 0: IDENT@149..155 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@155..157 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@157..181 + 0: JS_BOGUS@157..164 + 0: JS_DECORATOR@157..164 + 0: AT@157..158 "@" [] [] + 1: JS_CALL_EXPRESSION@158..164 + 0: JS_IDENTIFIER_EXPRESSION@158..161 + 0: JS_REFERENCE_IDENTIFIER@158..161 + 0: IDENT@158..161 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@161..164 + 0: L_PAREN@161..162 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@162..162 + 2: R_PAREN@162..164 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@164..170 + 0: IDENT@164..170 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@170..181 + 0: EQ@170..172 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@172..181 + 0: JS_STRING_LITERAL@172..181 "'default'" [] [] + 2: R_PAREN@181..183 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@183..185 + 0: L_CURLY@183..184 "{" [] [] + 1: JS_DIRECTIVE_LIST@184..184 + 2: JS_STATEMENT_LIST@184..184 + 3: R_CURLY@184..185 "}" [] [] + 3: JS_METHOD_CLASS_MEMBER@185..246 + 0: JS_METHOD_MODIFIER_LIST@185..197 + 0: JS_STATIC_MODIFIER@185..197 + 0: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@197..203 + 0: IDENT@197..203 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@203..244 + 0: L_PAREN@203..204 "(" [] [] + 1: JS_PARAMETER_LIST@204..242 + 0: JS_BOGUS_PARAMETER@204..210 + 0: JS_BOGUS@204..209 + 0: JS_DECORATOR@204..209 + 0: AT@204..205 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@205..209 + 0: JS_REFERENCE_IDENTIFIER@205..209 + 0: IDENT@205..209 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@209..210 + 0: IDENT@209..210 "x" [] [] + 1: COMMA@210..212 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@212..218 + 0: JS_DECORATOR_LIST@212..212 + 1: JS_IDENTIFIER_BINDING@212..218 + 0: IDENT@212..218 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@218..220 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@220..242 + 0: JS_BOGUS@220..225 + 0: JS_DECORATOR@220..225 + 0: AT@220..221 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@221..225 + 0: JS_REFERENCE_IDENTIFIER@221..225 + 0: IDENT@221..225 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@225..231 + 0: IDENT@225..231 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@231..242 + 0: EQ@231..233 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@233..242 + 0: JS_STRING_LITERAL@233..242 "'default'" [] [] + 2: R_PAREN@242..244 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@244..246 + 0: L_CURLY@244..245 "{" [] [] + 1: JS_DIRECTIVE_LIST@245..245 + 2: JS_STATEMENT_LIST@245..245 + 3: R_CURLY@245..246 "}" [] [] + 4: JS_METHOD_CLASS_MEMBER@246..317 + 0: JS_METHOD_MODIFIER_LIST@246..258 + 0: JS_STATIC_MODIFIER@246..258 + 0: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@258..264 + 0: IDENT@258..264 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@264..315 + 0: L_PAREN@264..265 "(" [] [] + 1: JS_PARAMETER_LIST@265..313 + 0: JS_BOGUS_PARAMETER@265..276 + 0: JS_BOGUS@265..275 + 0: JS_DECORATOR@265..275 + 0: AT@265..266 "@" [] [] + 1: JS_CALL_EXPRESSION@266..275 + 0: JS_STATIC_MEMBER_EXPRESSION@266..272 + 0: JS_IDENTIFIER_EXPRESSION@266..269 + 0: JS_REFERENCE_IDENTIFIER@266..269 + 0: IDENT@266..269 "dec" [] [] + 1: DOT@269..270 "." [] [] + 2: JS_NAME@270..272 + 0: IDENT@270..272 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@272..275 + 0: L_PAREN@272..273 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@273..273 + 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@275..276 + 0: IDENT@275..276 "x" [] [] + 1: COMMA@276..278 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@278..284 + 0: JS_DECORATOR_LIST@278..278 + 1: JS_IDENTIFIER_BINDING@278..284 + 0: IDENT@278..284 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@284..286 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@286..313 + 0: JS_BOGUS@286..296 + 0: JS_DECORATOR@286..296 + 0: AT@286..287 "@" [] [] + 1: JS_CALL_EXPRESSION@287..296 + 0: JS_STATIC_MEMBER_EXPRESSION@287..293 + 0: JS_IDENTIFIER_EXPRESSION@287..290 + 0: JS_REFERENCE_IDENTIFIER@287..290 + 0: IDENT@287..290 "dec" [] [] + 1: DOT@290..291 "." [] [] + 2: JS_NAME@291..293 + 0: IDENT@291..293 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@293..296 + 0: L_PAREN@293..294 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@294..294 + 2: R_PAREN@294..296 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@296..302 + 0: IDENT@296..302 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@302..313 + 0: EQ@302..304 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@304..313 + 0: JS_STRING_LITERAL@304..313 "'default'" [] [] + 2: R_PAREN@313..315 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@315..317 + 0: L_CURLY@315..316 "{" [] [] + 1: JS_DIRECTIVE_LIST@316..316 + 2: JS_STATEMENT_LIST@316..316 + 3: R_CURLY@316..317 "}" [] [] + 5: JS_METHOD_CLASS_MEMBER@317..382 + 0: JS_METHOD_MODIFIER_LIST@317..329 + 0: JS_STATIC_MODIFIER@317..329 + 0: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@329..335 + 0: IDENT@329..335 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@335..380 + 0: L_PAREN@335..336 "(" [] [] + 1: JS_PARAMETER_LIST@336..378 + 0: JS_BOGUS_PARAMETER@336..344 + 0: JS_BOGUS@336..343 + 0: JS_DECORATOR@336..343 + 0: AT@336..337 "@" [] [] + 1: JS_CALL_EXPRESSION@337..343 + 0: JS_IDENTIFIER_EXPRESSION@337..340 + 0: JS_REFERENCE_IDENTIFIER@337..340 + 0: IDENT@337..340 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@340..343 + 0: L_PAREN@340..341 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@341..341 + 2: R_PAREN@341..343 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@343..344 + 0: IDENT@343..344 "x" [] [] + 1: COMMA@344..346 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@346..352 + 0: JS_DECORATOR_LIST@346..346 + 1: JS_IDENTIFIER_BINDING@346..352 + 0: IDENT@346..352 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@352..354 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@354..378 + 0: JS_BOGUS@354..361 + 0: JS_DECORATOR@354..361 + 0: AT@354..355 "@" [] [] + 1: JS_CALL_EXPRESSION@355..361 + 0: JS_IDENTIFIER_EXPRESSION@355..358 + 0: JS_REFERENCE_IDENTIFIER@355..358 + 0: IDENT@355..358 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@358..361 + 0: L_PAREN@358..359 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@359..359 + 2: R_PAREN@359..361 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@361..367 + 0: IDENT@361..367 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@367..378 + 0: EQ@367..369 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@369..378 + 0: JS_STRING_LITERAL@369..378 "'default'" [] [] + 2: R_PAREN@378..380 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@380..382 + 0: L_CURLY@380..381 "{" [] [] + 1: JS_DIRECTIVE_LIST@381..381 + 2: JS_STATEMENT_LIST@381..381 + 3: R_CURLY@381..382 "}" [] [] + 9: R_CURLY@382..384 "}" [Newline("\n")] [] + 4: EOF@384..385 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_class_method.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + > 2 │ method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + > 2 │ method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + 2 │ method(@dec x, second, @dec third = 'default') {} + > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ static method(@dec x, second, @dec third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + 2 │ method(@dec x, second, @dec third = 'default') {} + > 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ static method(@dec x, second, @dec third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ method(@dec x, second, @dec third = 'default') {} + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ static method(@dec x, second, @dec third = 'default') {} + 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ method(@dec x, second, @dec third = 'default') {} + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 4 │ method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 5 │ static method(@dec x, second, @dec third = 'default') {} + 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:5:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + > 5 │ static method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 7 │ static method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:5:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 3 │ method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 4 │ method(@dec() x, second, @dec() third = 'default') {} + > 5 │ static method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 7 │ static method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ static method(@dec x, second, @dec third = 'default') {} + > 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 7 │ static method(@dec() x, second, @dec() third = 'default') {} + 8 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:6:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ method(@dec() x, second, @dec() third = 'default') {} + 5 │ static method(@dec x, second, @dec third = 'default') {} + > 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 7 │ static method(@dec() x, second, @dec() third = 'default') {} + 8 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ static method(@dec x, second, @dec third = 'default') {} + 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 7 │ static method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 8 │ } + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_method.ts:7:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ static method(@dec x, second, @dec third = 'default') {} + 6 │ static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 7 │ static method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 8 │ } + 9 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap new file mode 100644 index 000000000000..23f140a9b864 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap @@ -0,0 +1,329 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + set val(@dec x) {} + set val(@dec.fn() x) {} + set val(@dec() x) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@18..21 "val" [] [], + }, + l_paren_token: L_PAREN@21..22 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@22..23 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..27 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@27..28 "x" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@30..31 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@41..44 "val" [] [], + }, + l_paren_token: L_PAREN@44..45 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@45..46 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..49 "dec" [] [], + }, + }, + operator_token: DOT@49..50 "." [] [], + member: JsName { + value_token: IDENT@50..52 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@52..53 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@55..56 "x" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@69..72 "val" [] [], + }, + l_paren_token: L_PAREN@72..73 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@73..74 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..77 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@77..78 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@80..81 "x" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@83..84 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@84..85 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@85..87 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@87..88 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..88 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..87 + 0: JS_CLASS_DECLARATION@0..87 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..85 + 0: JS_SETTER_CLASS_MEMBER@9..32 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@18..21 + 0: IDENT@18..21 "val" [] [] + 3: L_PAREN@21..22 "(" [] [] + 4: JS_BOGUS_PARAMETER@22..28 + 0: JS_BOGUS@22..27 + 0: JS_DECORATOR@22..27 + 0: AT@22..23 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@23..27 + 0: JS_REFERENCE_IDENTIFIER@23..27 + 0: IDENT@23..27 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@27..28 + 0: IDENT@27..28 "x" [] [] + 5: (empty) + 6: R_PAREN@28..30 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@30..32 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_DIRECTIVE_LIST@31..31 + 2: JS_STATEMENT_LIST@31..31 + 3: R_CURLY@31..32 "}" [] [] + 1: JS_SETTER_CLASS_MEMBER@32..60 + 0: JS_METHOD_MODIFIER_LIST@32..32 + 1: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@41..44 + 0: IDENT@41..44 "val" [] [] + 3: L_PAREN@44..45 "(" [] [] + 4: JS_BOGUS_PARAMETER@45..56 + 0: JS_BOGUS@45..55 + 0: JS_DECORATOR@45..55 + 0: AT@45..46 "@" [] [] + 1: JS_CALL_EXPRESSION@46..55 + 0: JS_STATIC_MEMBER_EXPRESSION@46..52 + 0: JS_IDENTIFIER_EXPRESSION@46..49 + 0: JS_REFERENCE_IDENTIFIER@46..49 + 0: IDENT@46..49 "dec" [] [] + 1: DOT@49..50 "." [] [] + 2: JS_NAME@50..52 + 0: IDENT@50..52 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@55..56 + 0: IDENT@55..56 "x" [] [] + 5: (empty) + 6: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@58..60 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..60 "}" [] [] + 2: JS_SETTER_CLASS_MEMBER@60..85 + 0: JS_METHOD_MODIFIER_LIST@60..60 + 1: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@69..72 + 0: IDENT@69..72 "val" [] [] + 3: L_PAREN@72..73 "(" [] [] + 4: JS_BOGUS_PARAMETER@73..81 + 0: JS_BOGUS@73..80 + 0: JS_DECORATOR@73..80 + 0: AT@73..74 "@" [] [] + 1: JS_CALL_EXPRESSION@74..80 + 0: JS_IDENTIFIER_EXPRESSION@74..77 + 0: JS_REFERENCE_IDENTIFIER@74..77 + 0: IDENT@74..77 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@77..80 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@78..78 + 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@80..81 + 0: IDENT@80..81 "x" [] [] + 5: (empty) + 6: R_PAREN@81..83 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@83..85 + 0: L_CURLY@83..84 "{" [] [] + 1: JS_DIRECTIVE_LIST@84..84 + 2: JS_STATEMENT_LIST@84..84 + 3: R_CURLY@84..85 "}" [] [] + 9: R_CURLY@85..87 "}" [Newline("\n")] [] + 4: EOF@87..88 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_class_setter.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + > 2 │ set val(@dec x) {} + │ ^^^^ + 3 │ set val(@dec.fn() x) {} + 4 │ set val(@dec() x) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_setter.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + 2 │ set val(@dec x) {} + > 3 │ set val(@dec.fn() x) {} + │ ^^^^^^^^^ + 4 │ set val(@dec() x) {} + 5 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_decorator_on_class_setter.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ set val(@dec x) {} + 3 │ set val(@dec.fn() x) {} + > 4 │ set val(@dec() x) {} + │ ^^^^^^ + 5 │ } + 6 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap new file mode 100644 index 000000000000..7352a5aaf35d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap @@ -0,0 +1,581 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type I = new(@dec x, second, @dec third = 'default') => string; +type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; +type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@9..12 "new" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@13..14 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..18 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@18..19 "x" [] [], + }, + ], + }, + COMMA@19..21 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@21..27 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@27..29 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@29..30 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..34 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@34..40 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@42..51 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@53..56 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@56..62 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@62..63 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@63..69 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@69..71 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@71..73 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: ABSTRACT_KW@73..82 "abstract" [] [Whitespace(" ")], + new_token: NEW_KW@82..85 "new" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@85..86 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@86..87 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@87..90 "dec" [] [], + }, + }, + operator_token: DOT@90..91 "." [] [], + member: JsName { + value_token: IDENT@91..93 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@93..94 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@94..96 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@96..97 "x" [] [], + }, + ], + }, + COMMA@97..99 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@99..105 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@105..107 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@107..108 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@108..111 "dec" [] [], + }, + }, + operator_token: DOT@111..112 "." [] [], + member: JsName { + value_token: IDENT@112..114 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@114..115 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@117..123 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@123..125 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@125..134 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@134..136 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@136..139 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@139..145 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@145..146 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@146..152 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@152..154 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@154..156 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")], + new_token: NEW_KW@165..168 "new" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@168..169 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@169..170 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@170..173 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@173..174 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@174..176 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@176..177 "x" [] [], + }, + ], + }, + COMMA@177..179 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@179..185 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@185..187 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@187..188 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@188..191 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@191..192 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@194..200 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@200..202 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@202..211 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@211..213 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@213..216 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@216..222 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@222..223 ";" [] [], + }, + ], + eof_token: EOF@223..224 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..224 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..223 + 0: TS_TYPE_ALIAS_DECLARATION@0..63 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@9..62 + 0: (empty) + 1: NEW_KW@9..12 "new" [] [] + 2: (empty) + 3: JS_PARAMETERS@12..53 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..51 + 0: JS_BOGUS_PARAMETER@13..19 + 0: JS_BOGUS@13..18 + 0: JS_DECORATOR@13..18 + 0: AT@13..14 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@14..18 + 0: JS_REFERENCE_IDENTIFIER@14..18 + 0: IDENT@14..18 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "x" [] [] + 1: COMMA@19..21 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@21..27 + 0: JS_DECORATOR_LIST@21..21 + 1: JS_IDENTIFIER_BINDING@21..27 + 0: IDENT@21..27 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@27..29 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@29..51 + 0: JS_BOGUS@29..34 + 0: JS_DECORATOR@29..34 + 0: AT@29..30 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@30..34 + 0: JS_REFERENCE_IDENTIFIER@30..34 + 0: IDENT@30..34 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@34..40 + 0: IDENT@34..40 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@40..51 + 0: EQ@40..42 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@42..51 + 0: JS_STRING_LITERAL@42..51 "'default'" [] [] + 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@53..56 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@56..62 + 0: STRING_KW@56..62 "string" [] [] + 5: SEMICOLON@62..63 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@63..146 + 0: TYPE_KW@63..69 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@69..71 + 0: IDENT@69..71 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@71..73 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@73..145 + 0: ABSTRACT_KW@73..82 "abstract" [] [Whitespace(" ")] + 1: NEW_KW@82..85 "new" [] [] + 2: (empty) + 3: JS_PARAMETERS@85..136 + 0: L_PAREN@85..86 "(" [] [] + 1: JS_PARAMETER_LIST@86..134 + 0: JS_BOGUS_PARAMETER@86..97 + 0: JS_BOGUS@86..96 + 0: JS_DECORATOR@86..96 + 0: AT@86..87 "@" [] [] + 1: JS_CALL_EXPRESSION@87..96 + 0: JS_STATIC_MEMBER_EXPRESSION@87..93 + 0: JS_IDENTIFIER_EXPRESSION@87..90 + 0: JS_REFERENCE_IDENTIFIER@87..90 + 0: IDENT@87..90 "dec" [] [] + 1: DOT@90..91 "." [] [] + 2: JS_NAME@91..93 + 0: IDENT@91..93 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@93..96 + 0: L_PAREN@93..94 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@94..94 + 2: R_PAREN@94..96 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@96..97 + 0: IDENT@96..97 "x" [] [] + 1: COMMA@97..99 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@99..105 + 0: JS_DECORATOR_LIST@99..99 + 1: JS_IDENTIFIER_BINDING@99..105 + 0: IDENT@99..105 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@105..107 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@107..134 + 0: JS_BOGUS@107..117 + 0: JS_DECORATOR@107..117 + 0: AT@107..108 "@" [] [] + 1: JS_CALL_EXPRESSION@108..117 + 0: JS_STATIC_MEMBER_EXPRESSION@108..114 + 0: JS_IDENTIFIER_EXPRESSION@108..111 + 0: JS_REFERENCE_IDENTIFIER@108..111 + 0: IDENT@108..111 "dec" [] [] + 1: DOT@111..112 "." [] [] + 2: JS_NAME@112..114 + 0: IDENT@112..114 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@114..117 + 0: L_PAREN@114..115 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@115..115 + 2: R_PAREN@115..117 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@117..123 + 0: IDENT@117..123 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@123..134 + 0: EQ@123..125 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@125..134 + 0: JS_STRING_LITERAL@125..134 "'default'" [] [] + 2: R_PAREN@134..136 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@136..139 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@139..145 + 0: STRING_KW@139..145 "string" [] [] + 5: SEMICOLON@145..146 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@146..223 + 0: TYPE_KW@146..152 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@152..154 + 0: IDENT@152..154 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@154..156 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@156..222 + 0: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")] + 1: NEW_KW@165..168 "new" [] [] + 2: (empty) + 3: JS_PARAMETERS@168..213 + 0: L_PAREN@168..169 "(" [] [] + 1: JS_PARAMETER_LIST@169..211 + 0: JS_BOGUS_PARAMETER@169..177 + 0: JS_BOGUS@169..176 + 0: JS_DECORATOR@169..176 + 0: AT@169..170 "@" [] [] + 1: JS_CALL_EXPRESSION@170..176 + 0: JS_IDENTIFIER_EXPRESSION@170..173 + 0: JS_REFERENCE_IDENTIFIER@170..173 + 0: IDENT@170..173 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@173..176 + 0: L_PAREN@173..174 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@174..174 + 2: R_PAREN@174..176 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@176..177 + 0: IDENT@176..177 "x" [] [] + 1: COMMA@177..179 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@179..185 + 0: JS_DECORATOR_LIST@179..179 + 1: JS_IDENTIFIER_BINDING@179..185 + 0: IDENT@179..185 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@185..187 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@187..211 + 0: JS_BOGUS@187..194 + 0: JS_DECORATOR@187..194 + 0: AT@187..188 "@" [] [] + 1: JS_CALL_EXPRESSION@188..194 + 0: JS_IDENTIFIER_EXPRESSION@188..191 + 0: JS_REFERENCE_IDENTIFIER@188..191 + 0: IDENT@188..191 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@191..194 + 0: L_PAREN@191..192 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@192..192 + 2: R_PAREN@192..194 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@194..200 + 0: IDENT@194..200 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@200..211 + 0: EQ@200..202 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@202..211 + 0: JS_STRING_LITERAL@202..211 "'default'" [] [] + 2: R_PAREN@211..213 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@213..216 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@216..222 + 0: STRING_KW@216..222 "string" [] [] + 5: SEMICOLON@222..223 ";" [] [] + 4: EOF@223..224 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_constructor_type.ts:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ type I = new(@dec x, second, @dec third = 'default') => string; + │ ^^^^ + 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_constructor_type.ts:1:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ type I = new(@dec x, second, @dec third = 'default') => string; + │ ^^^^ + 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_constructor_type.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type I = new(@dec x, second, @dec third = 'default') => string; + > 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^^^^^^^^^ + 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_constructor_type.ts:2:44 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type I = new(@dec x, second, @dec third = 'default') => string; + > 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^^^^^^^^^ + 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_constructor_type.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type I = new(@dec x, second, @dec third = 'default') => string; + 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_constructor_type.ts:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type I = new(@dec x, second, @dec third = 'default') => string; + 2 │ type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap new file mode 100644 index 000000000000..dd68ba5da85c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap @@ -0,0 +1,572 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function method(@dec x, second, @dec third = 'default') {} +function method(@dec.fn() x, second, @dec.fn() third = 'default') {} +function method(@dec() x, second, @dec() third = 'default') {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..15 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@15..16 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@16..17 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..21 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@21..22 "x" [] [], + }, + ], + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..30 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@32..33 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..37 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@37..43 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@43..45 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@45..54 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@56..57 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@58..68 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@68..74 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@74..75 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@75..76 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@76..79 "dec" [] [], + }, + }, + operator_token: DOT@79..80 "." [] [], + member: JsName { + value_token: IDENT@80..82 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@82..83 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@85..86 "x" [] [], + }, + ], + }, + COMMA@86..88 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@88..94 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@94..96 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@96..97 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@97..100 "dec" [] [], + }, + }, + operator_token: DOT@100..101 "." [] [], + member: JsName { + value_token: IDENT@101..103 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@103..104 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@104..106 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@106..112 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@112..114 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@114..123 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@123..125 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@125..126 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@126..127 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@127..137 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@137..143 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@143..144 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@144..145 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@145..148 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@148..149 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@151..152 "x" [] [], + }, + ], + }, + COMMA@152..154 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@154..160 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@160..162 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@162..163 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@163..166 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@166..167 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@167..169 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@169..175 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@175..177 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@177..186 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@186..188 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@188..189 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@189..190 "}" [] [], + }, + }, + ], + eof_token: EOF@190..191 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..191 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..190 + 0: JS_FUNCTION_DECLARATION@0..58 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..15 + 0: IDENT@9..15 "method" [] [] + 4: (empty) + 5: JS_PARAMETERS@15..56 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_PARAMETER_LIST@16..54 + 0: JS_BOGUS_PARAMETER@16..22 + 0: JS_BOGUS@16..21 + 0: JS_DECORATOR@16..21 + 0: AT@16..17 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@17..21 + 0: JS_REFERENCE_IDENTIFIER@17..21 + 0: IDENT@17..21 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "x" [] [] + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@24..30 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..30 + 0: IDENT@24..30 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@30..32 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@32..54 + 0: JS_BOGUS@32..37 + 0: JS_DECORATOR@32..37 + 0: AT@32..33 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@33..37 + 0: JS_REFERENCE_IDENTIFIER@33..37 + 0: IDENT@33..37 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@37..43 + 0: IDENT@37..43 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@43..54 + 0: EQ@43..45 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@45..54 + 0: JS_STRING_LITERAL@45..54 "'default'" [] [] + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@56..58 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..57 + 3: R_CURLY@57..58 "}" [] [] + 1: JS_FUNCTION_DECLARATION@58..127 + 0: (empty) + 1: FUNCTION_KW@58..68 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@68..74 + 0: IDENT@68..74 "method" [] [] + 4: (empty) + 5: JS_PARAMETERS@74..125 + 0: L_PAREN@74..75 "(" [] [] + 1: JS_PARAMETER_LIST@75..123 + 0: JS_BOGUS_PARAMETER@75..86 + 0: JS_BOGUS@75..85 + 0: JS_DECORATOR@75..85 + 0: AT@75..76 "@" [] [] + 1: JS_CALL_EXPRESSION@76..85 + 0: JS_STATIC_MEMBER_EXPRESSION@76..82 + 0: JS_IDENTIFIER_EXPRESSION@76..79 + 0: JS_REFERENCE_IDENTIFIER@76..79 + 0: IDENT@76..79 "dec" [] [] + 1: DOT@79..80 "." [] [] + 2: JS_NAME@80..82 + 0: IDENT@80..82 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@82..85 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@83..83 + 2: R_PAREN@83..85 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@85..86 + 0: IDENT@85..86 "x" [] [] + 1: COMMA@86..88 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@88..94 + 0: JS_DECORATOR_LIST@88..88 + 1: JS_IDENTIFIER_BINDING@88..94 + 0: IDENT@88..94 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@94..96 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@96..123 + 0: JS_BOGUS@96..106 + 0: JS_DECORATOR@96..106 + 0: AT@96..97 "@" [] [] + 1: JS_CALL_EXPRESSION@97..106 + 0: JS_STATIC_MEMBER_EXPRESSION@97..103 + 0: JS_IDENTIFIER_EXPRESSION@97..100 + 0: JS_REFERENCE_IDENTIFIER@97..100 + 0: IDENT@97..100 "dec" [] [] + 1: DOT@100..101 "." [] [] + 2: JS_NAME@101..103 + 0: IDENT@101..103 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@103..106 + 0: L_PAREN@103..104 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@104..104 + 2: R_PAREN@104..106 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@106..112 + 0: IDENT@106..112 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@112..123 + 0: EQ@112..114 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@114..123 + 0: JS_STRING_LITERAL@114..123 "'default'" [] [] + 2: R_PAREN@123..125 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@125..127 + 0: L_CURLY@125..126 "{" [] [] + 1: JS_DIRECTIVE_LIST@126..126 + 2: JS_STATEMENT_LIST@126..126 + 3: R_CURLY@126..127 "}" [] [] + 2: JS_FUNCTION_DECLARATION@127..190 + 0: (empty) + 1: FUNCTION_KW@127..137 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@137..143 + 0: IDENT@137..143 "method" [] [] + 4: (empty) + 5: JS_PARAMETERS@143..188 + 0: L_PAREN@143..144 "(" [] [] + 1: JS_PARAMETER_LIST@144..186 + 0: JS_BOGUS_PARAMETER@144..152 + 0: JS_BOGUS@144..151 + 0: JS_DECORATOR@144..151 + 0: AT@144..145 "@" [] [] + 1: JS_CALL_EXPRESSION@145..151 + 0: JS_IDENTIFIER_EXPRESSION@145..148 + 0: JS_REFERENCE_IDENTIFIER@145..148 + 0: IDENT@145..148 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@148..151 + 0: L_PAREN@148..149 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@149..149 + 2: R_PAREN@149..151 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@151..152 + 0: IDENT@151..152 "x" [] [] + 1: COMMA@152..154 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@154..160 + 0: JS_DECORATOR_LIST@154..154 + 1: JS_IDENTIFIER_BINDING@154..160 + 0: IDENT@154..160 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@160..162 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@162..186 + 0: JS_BOGUS@162..169 + 0: JS_DECORATOR@162..169 + 0: AT@162..163 "@" [] [] + 1: JS_CALL_EXPRESSION@163..169 + 0: JS_IDENTIFIER_EXPRESSION@163..166 + 0: JS_REFERENCE_IDENTIFIER@163..166 + 0: IDENT@163..166 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@166..169 + 0: L_PAREN@166..167 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@167..167 + 2: R_PAREN@167..169 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@169..175 + 0: IDENT@169..175 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@175..186 + 0: EQ@175..177 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@177..186 + 0: JS_STRING_LITERAL@177..186 "'default'" [] [] + 2: R_PAREN@186..188 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@188..190 + 0: L_CURLY@188..189 "{" [] [] + 1: JS_DIRECTIVE_LIST@189..189 + 2: JS_STATEMENT_LIST@189..189 + 3: R_CURLY@189..190 "}" [] [] + 4: EOF@190..191 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_function_declaration.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ function method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 3 │ function method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_declaration.ts:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ function method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 3 │ function method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_declaration.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ function method(@dec x, second, @dec third = 'default') {} + > 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 3 │ function method(@dec() x, second, @dec() third = 'default') {} + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_declaration.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ function method(@dec x, second, @dec third = 'default') {} + > 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 3 │ function method(@dec() x, second, @dec() third = 'default') {} + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_declaration.ts:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ function method(@dec x, second, @dec third = 'default') {} + 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 3 │ function method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_declaration.ts:3:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ function method(@dec x, second, @dec third = 'default') {} + 2 │ function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 3 │ function method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap new file mode 100644 index 000000000000..072b471ee8ce --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap @@ -0,0 +1,662 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const expr = function method(@dec x, second, @dec third = 'default') {} +const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} +const expr = function method(@dec() x, second, @dec() third = 'default') {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..11 "expr" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@11..13 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@13..22 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@22..28 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@29..30 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..34 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@34..35 "x" [] [], + }, + ], + }, + COMMA@35..37 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@37..43 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@43..45 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@45..46 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..50 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@50..56 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@58..67 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@67..69 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@69..70 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@70..71 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@71..78 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@78..83 "expr" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@83..85 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@85..94 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@94..100 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@100..101 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@101..102 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@102..105 "dec" [] [], + }, + }, + operator_token: DOT@105..106 "." [] [], + member: JsName { + value_token: IDENT@106..108 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@108..109 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@109..111 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@111..112 "x" [] [], + }, + ], + }, + COMMA@112..114 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@114..120 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@120..122 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@122..123 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@123..126 "dec" [] [], + }, + }, + operator_token: DOT@126..127 "." [] [], + member: JsName { + value_token: IDENT@127..129 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@129..130 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@130..132 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@132..138 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@138..140 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@140..149 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@149..151 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@151..152 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@152..153 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@153..160 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@160..165 "expr" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@165..167 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@167..176 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@176..182 "method" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@182..183 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@183..184 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@184..187 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@187..188 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@188..190 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@190..191 "x" [] [], + }, + ], + }, + COMMA@191..193 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@193..199 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@199..201 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@201..202 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@202..205 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@205..206 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@206..208 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@208..214 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@214..216 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@216..225 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@225..227 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@227..228 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@228..229 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@229..230 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..230 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..229 + 0: JS_VARIABLE_STATEMENT@0..71 + 0: JS_VARIABLE_DECLARATION@0..71 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..71 + 0: JS_VARIABLE_DECLARATOR@6..71 + 0: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "expr" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@11..71 + 0: EQ@11..13 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@13..71 + 0: (empty) + 1: FUNCTION_KW@13..22 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@22..28 + 0: IDENT@22..28 "method" [] [] + 4: (empty) + 5: JS_PARAMETERS@28..69 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..67 + 0: JS_BOGUS_PARAMETER@29..35 + 0: JS_BOGUS@29..34 + 0: JS_DECORATOR@29..34 + 0: AT@29..30 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@30..34 + 0: JS_REFERENCE_IDENTIFIER@30..34 + 0: IDENT@30..34 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@34..35 + 0: IDENT@34..35 "x" [] [] + 1: COMMA@35..37 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@37..43 + 0: JS_DECORATOR_LIST@37..37 + 1: JS_IDENTIFIER_BINDING@37..43 + 0: IDENT@37..43 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@43..45 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@45..67 + 0: JS_BOGUS@45..50 + 0: JS_DECORATOR@45..50 + 0: AT@45..46 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@46..50 + 0: JS_REFERENCE_IDENTIFIER@46..50 + 0: IDENT@46..50 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@50..56 + 0: IDENT@50..56 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@56..67 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@58..67 + 0: JS_STRING_LITERAL@58..67 "'default'" [] [] + 2: R_PAREN@67..69 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@69..71 + 0: L_CURLY@69..70 "{" [] [] + 1: JS_DIRECTIVE_LIST@70..70 + 2: JS_STATEMENT_LIST@70..70 + 3: R_CURLY@70..71 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@71..153 + 0: JS_VARIABLE_DECLARATION@71..153 + 0: (empty) + 1: CONST_KW@71..78 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@78..153 + 0: JS_VARIABLE_DECLARATOR@78..153 + 0: JS_IDENTIFIER_BINDING@78..83 + 0: IDENT@78..83 "expr" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@83..153 + 0: EQ@83..85 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@85..153 + 0: (empty) + 1: FUNCTION_KW@85..94 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@94..100 + 0: IDENT@94..100 "method" [] [] + 4: (empty) + 5: JS_PARAMETERS@100..151 + 0: L_PAREN@100..101 "(" [] [] + 1: JS_PARAMETER_LIST@101..149 + 0: JS_BOGUS_PARAMETER@101..112 + 0: JS_BOGUS@101..111 + 0: JS_DECORATOR@101..111 + 0: AT@101..102 "@" [] [] + 1: JS_CALL_EXPRESSION@102..111 + 0: JS_STATIC_MEMBER_EXPRESSION@102..108 + 0: JS_IDENTIFIER_EXPRESSION@102..105 + 0: JS_REFERENCE_IDENTIFIER@102..105 + 0: IDENT@102..105 "dec" [] [] + 1: DOT@105..106 "." [] [] + 2: JS_NAME@106..108 + 0: IDENT@106..108 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@108..111 + 0: L_PAREN@108..109 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@109..109 + 2: R_PAREN@109..111 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@111..112 + 0: IDENT@111..112 "x" [] [] + 1: COMMA@112..114 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@114..120 + 0: JS_DECORATOR_LIST@114..114 + 1: JS_IDENTIFIER_BINDING@114..120 + 0: IDENT@114..120 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@120..122 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@122..149 + 0: JS_BOGUS@122..132 + 0: JS_DECORATOR@122..132 + 0: AT@122..123 "@" [] [] + 1: JS_CALL_EXPRESSION@123..132 + 0: JS_STATIC_MEMBER_EXPRESSION@123..129 + 0: JS_IDENTIFIER_EXPRESSION@123..126 + 0: JS_REFERENCE_IDENTIFIER@123..126 + 0: IDENT@123..126 "dec" [] [] + 1: DOT@126..127 "." [] [] + 2: JS_NAME@127..129 + 0: IDENT@127..129 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@129..132 + 0: L_PAREN@129..130 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@130..130 + 2: R_PAREN@130..132 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@132..138 + 0: IDENT@132..138 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@138..149 + 0: EQ@138..140 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@140..149 + 0: JS_STRING_LITERAL@140..149 "'default'" [] [] + 2: R_PAREN@149..151 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@151..153 + 0: L_CURLY@151..152 "{" [] [] + 1: JS_DIRECTIVE_LIST@152..152 + 2: JS_STATEMENT_LIST@152..152 + 3: R_CURLY@152..153 "}" [] [] + 1: (empty) + 2: JS_VARIABLE_STATEMENT@153..229 + 0: JS_VARIABLE_DECLARATION@153..229 + 0: (empty) + 1: CONST_KW@153..160 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@160..229 + 0: JS_VARIABLE_DECLARATOR@160..229 + 0: JS_IDENTIFIER_BINDING@160..165 + 0: IDENT@160..165 "expr" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@165..229 + 0: EQ@165..167 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@167..229 + 0: (empty) + 1: FUNCTION_KW@167..176 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@176..182 + 0: IDENT@176..182 "method" [] [] + 4: (empty) + 5: JS_PARAMETERS@182..227 + 0: L_PAREN@182..183 "(" [] [] + 1: JS_PARAMETER_LIST@183..225 + 0: JS_BOGUS_PARAMETER@183..191 + 0: JS_BOGUS@183..190 + 0: JS_DECORATOR@183..190 + 0: AT@183..184 "@" [] [] + 1: JS_CALL_EXPRESSION@184..190 + 0: JS_IDENTIFIER_EXPRESSION@184..187 + 0: JS_REFERENCE_IDENTIFIER@184..187 + 0: IDENT@184..187 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@187..190 + 0: L_PAREN@187..188 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@188..188 + 2: R_PAREN@188..190 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@190..191 + 0: IDENT@190..191 "x" [] [] + 1: COMMA@191..193 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@193..199 + 0: JS_DECORATOR_LIST@193..193 + 1: JS_IDENTIFIER_BINDING@193..199 + 0: IDENT@193..199 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@199..201 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@201..225 + 0: JS_BOGUS@201..208 + 0: JS_DECORATOR@201..208 + 0: AT@201..202 "@" [] [] + 1: JS_CALL_EXPRESSION@202..208 + 0: JS_IDENTIFIER_EXPRESSION@202..205 + 0: JS_REFERENCE_IDENTIFIER@202..205 + 0: IDENT@202..205 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@205..208 + 0: L_PAREN@205..206 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@206..206 + 2: R_PAREN@206..208 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@208..214 + 0: IDENT@208..214 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@214..225 + 0: EQ@214..216 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@216..225 + 0: JS_STRING_LITERAL@216..225 "'default'" [] [] + 2: R_PAREN@225..227 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@227..229 + 0: L_CURLY@227..228 "{" [] [] + 1: JS_DIRECTIVE_LIST@228..228 + 2: JS_STATEMENT_LIST@228..228 + 3: R_CURLY@228..229 "}" [] [] + 1: (empty) + 4: EOF@229..230 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_function_expression.ts:1:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_expression.ts:1:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} + │ ^^^^ + 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_expression.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} + > 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_expression.ts:2:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} + > 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + │ ^^^^^^^^^ + 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_expression.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} + 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_expression.ts:3:48 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ const expr = function method(@dec x, second, @dec third = 'default') {} + 2 │ const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + > 3 │ const expr = function method(@dec() x, second, @dec() third = 'default') {} + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap new file mode 100644 index 000000000000..f96019f31a88 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap @@ -0,0 +1,664 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type I = (@dec x, second, @dec third = 'default') => string; +type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; +type I = (@dec() x, second, @dec() third = 'default') => string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@9..10 "(" [] [], + ty: missing (required), + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@10..11 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..15 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "x" [] [], + }, + }, + comma_token: COMMA@16..18 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..24 "second" [] [], + }, + }, + }, + COMMA@24..26 "," [] [Whitespace(" ")], + JsBogusExpression { + items: [ + JsDecorator { + at_token: AT@26..27 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..31 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@31..37 "third" [] [Whitespace(" ")], + }, + operator_token: EQ@37..39 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@39..48 "'default'" [] [], + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_PAREN@48..50 ")" [] [Whitespace(" ")], + FAT_ARROW@50..53 "=>" [] [Whitespace(" ")], + STRING_KW@53..59 "string" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@60..66 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@66..68 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@68..70 "=" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@70..71 "(" [] [], + ty: missing (required), + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@71..72 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@72..75 "dec" [] [], + }, + }, + operator_token: DOT@75..76 "." [] [], + member: JsName { + value_token: IDENT@76..78 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@78..79 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@79..81 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@81..82 "x" [] [], + }, + }, + comma_token: COMMA@82..84 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..90 "second" [] [], + }, + }, + }, + COMMA@90..92 "," [] [Whitespace(" ")], + JsBogusExpression { + items: [ + JsDecorator { + at_token: AT@92..93 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@93..96 "dec" [] [], + }, + }, + operator_token: DOT@96..97 "." [] [], + member: JsName { + value_token: IDENT@97..99 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@99..100 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@100..102 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@102..108 "third" [] [Whitespace(" ")], + }, + operator_token: EQ@108..110 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@110..119 "'default'" [] [], + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_PAREN@119..121 ")" [] [Whitespace(" ")], + FAT_ARROW@121..124 "=>" [] [Whitespace(" ")], + STRING_KW@124..130 "string" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@130..131 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@131..137 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@137..139 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@139..141 "=" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@141..142 "(" [] [], + ty: missing (required), + r_paren_token: missing (required), + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@142..143 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@143..146 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@146..147 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@147..149 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@149..150 "x" [] [], + }, + }, + comma_token: COMMA@150..152 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@152..158 "second" [] [], + }, + }, + }, + COMMA@158..160 "," [] [Whitespace(" ")], + JsBogusExpression { + items: [ + JsDecorator { + at_token: AT@160..161 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@161..164 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@164..165 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@165..167 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@167..173 "third" [] [Whitespace(" ")], + }, + operator_token: EQ@173..175 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@175..184 "'default'" [] [], + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + R_PAREN@184..186 ")" [] [Whitespace(" ")], + FAT_ARROW@186..189 "=>" [] [Whitespace(" ")], + STRING_KW@189..195 "string" [] [], + ], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@195..196 ";" [] [], + }, + ], + eof_token: EOF@196..197 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..197 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..196 + 0: TS_TYPE_ALIAS_DECLARATION@0..10 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_PARENTHESIZED_TYPE@9..10 + 0: L_PAREN@9..10 "(" [] [] + 1: (empty) + 2: (empty) + 5: (empty) + 1: JS_BOGUS_STATEMENT@10..15 + 0: JS_DECORATOR@10..15 + 0: AT@10..11 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@11..15 + 0: JS_REFERENCE_IDENTIFIER@11..15 + 0: IDENT@11..15 "dec" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@15..48 + 0: JS_BOGUS_EXPRESSION@15..48 + 0: JS_SEQUENCE_EXPRESSION@15..24 + 0: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "x" [] [] + 1: COMMA@16..18 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@18..24 + 0: JS_REFERENCE_IDENTIFIER@18..24 + 0: IDENT@18..24 "second" [] [] + 1: COMMA@24..26 "," [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@26..31 + 0: JS_DECORATOR@26..31 + 0: AT@26..27 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@27..31 + 0: JS_REFERENCE_IDENTIFIER@27..31 + 0: IDENT@27..31 "dec" [] [Whitespace(" ")] + 3: JS_ASSIGNMENT_EXPRESSION@31..48 + 0: JS_IDENTIFIER_ASSIGNMENT@31..37 + 0: IDENT@31..37 "third" [] [Whitespace(" ")] + 1: EQ@37..39 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@39..48 + 0: JS_STRING_LITERAL@39..48 "'default'" [] [] + 1: (empty) + 3: JS_BOGUS_STATEMENT@48..59 + 0: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 1: FAT_ARROW@50..53 "=>" [] [Whitespace(" ")] + 2: STRING_KW@53..59 "string" [] [] + 4: JS_EMPTY_STATEMENT@59..60 + 0: SEMICOLON@59..60 ";" [] [] + 5: TS_TYPE_ALIAS_DECLARATION@60..71 + 0: TYPE_KW@60..66 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@66..68 + 0: IDENT@66..68 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@68..70 "=" [] [Whitespace(" ")] + 4: TS_PARENTHESIZED_TYPE@70..71 + 0: L_PAREN@70..71 "(" [] [] + 1: (empty) + 2: (empty) + 5: (empty) + 6: JS_BOGUS_STATEMENT@71..81 + 0: JS_DECORATOR@71..81 + 0: AT@71..72 "@" [] [] + 1: JS_CALL_EXPRESSION@72..81 + 0: JS_STATIC_MEMBER_EXPRESSION@72..78 + 0: JS_IDENTIFIER_EXPRESSION@72..75 + 0: JS_REFERENCE_IDENTIFIER@72..75 + 0: IDENT@72..75 "dec" [] [] + 1: DOT@75..76 "." [] [] + 2: JS_NAME@76..78 + 0: IDENT@76..78 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@78..81 + 0: L_PAREN@78..79 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@79..79 + 2: R_PAREN@79..81 ")" [] [Whitespace(" ")] + 7: JS_EXPRESSION_STATEMENT@81..119 + 0: JS_BOGUS_EXPRESSION@81..119 + 0: JS_SEQUENCE_EXPRESSION@81..90 + 0: JS_IDENTIFIER_EXPRESSION@81..82 + 0: JS_REFERENCE_IDENTIFIER@81..82 + 0: IDENT@81..82 "x" [] [] + 1: COMMA@82..84 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@84..90 + 0: JS_REFERENCE_IDENTIFIER@84..90 + 0: IDENT@84..90 "second" [] [] + 1: COMMA@90..92 "," [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@92..102 + 0: JS_DECORATOR@92..102 + 0: AT@92..93 "@" [] [] + 1: JS_CALL_EXPRESSION@93..102 + 0: JS_STATIC_MEMBER_EXPRESSION@93..99 + 0: JS_IDENTIFIER_EXPRESSION@93..96 + 0: JS_REFERENCE_IDENTIFIER@93..96 + 0: IDENT@93..96 "dec" [] [] + 1: DOT@96..97 "." [] [] + 2: JS_NAME@97..99 + 0: IDENT@97..99 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@99..102 + 0: L_PAREN@99..100 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@100..100 + 2: R_PAREN@100..102 ")" [] [Whitespace(" ")] + 3: JS_ASSIGNMENT_EXPRESSION@102..119 + 0: JS_IDENTIFIER_ASSIGNMENT@102..108 + 0: IDENT@102..108 "third" [] [Whitespace(" ")] + 1: EQ@108..110 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@110..119 + 0: JS_STRING_LITERAL@110..119 "'default'" [] [] + 1: (empty) + 8: JS_BOGUS_STATEMENT@119..130 + 0: R_PAREN@119..121 ")" [] [Whitespace(" ")] + 1: FAT_ARROW@121..124 "=>" [] [Whitespace(" ")] + 2: STRING_KW@124..130 "string" [] [] + 9: JS_EMPTY_STATEMENT@130..131 + 0: SEMICOLON@130..131 ";" [] [] + 10: TS_TYPE_ALIAS_DECLARATION@131..142 + 0: TYPE_KW@131..137 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@137..139 + 0: IDENT@137..139 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@139..141 "=" [] [Whitespace(" ")] + 4: TS_PARENTHESIZED_TYPE@141..142 + 0: L_PAREN@141..142 "(" [] [] + 1: (empty) + 2: (empty) + 5: (empty) + 11: JS_BOGUS_STATEMENT@142..149 + 0: JS_DECORATOR@142..149 + 0: AT@142..143 "@" [] [] + 1: JS_CALL_EXPRESSION@143..149 + 0: JS_IDENTIFIER_EXPRESSION@143..146 + 0: JS_REFERENCE_IDENTIFIER@143..146 + 0: IDENT@143..146 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@146..149 + 0: L_PAREN@146..147 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@147..147 + 2: R_PAREN@147..149 ")" [] [Whitespace(" ")] + 12: JS_EXPRESSION_STATEMENT@149..184 + 0: JS_BOGUS_EXPRESSION@149..184 + 0: JS_SEQUENCE_EXPRESSION@149..158 + 0: JS_IDENTIFIER_EXPRESSION@149..150 + 0: JS_REFERENCE_IDENTIFIER@149..150 + 0: IDENT@149..150 "x" [] [] + 1: COMMA@150..152 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@152..158 + 0: JS_REFERENCE_IDENTIFIER@152..158 + 0: IDENT@152..158 "second" [] [] + 1: COMMA@158..160 "," [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@160..167 + 0: JS_DECORATOR@160..167 + 0: AT@160..161 "@" [] [] + 1: JS_CALL_EXPRESSION@161..167 + 0: JS_IDENTIFIER_EXPRESSION@161..164 + 0: JS_REFERENCE_IDENTIFIER@161..164 + 0: IDENT@161..164 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@164..167 + 0: L_PAREN@164..165 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@165..165 + 2: R_PAREN@165..167 ")" [] [Whitespace(" ")] + 3: JS_ASSIGNMENT_EXPRESSION@167..184 + 0: JS_IDENTIFIER_ASSIGNMENT@167..173 + 0: IDENT@167..173 "third" [] [Whitespace(" ")] + 1: EQ@173..175 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@175..184 + 0: JS_STRING_LITERAL@175..184 "'default'" [] [] + 1: (empty) + 13: JS_BOGUS_STATEMENT@184..195 + 0: R_PAREN@184..186 ")" [] [Whitespace(" ")] + 1: FAT_ARROW@186..189 "=>" [] [Whitespace(" ")] + 2: STRING_KW@189..195 "string" [] [] + 14: JS_EMPTY_STATEMENT@195..196 + 0: SEMICOLON@195..196 ";" [] [] + 4: EOF@196..197 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_function_type.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '@'. + + > 1 │ type I = (@dec x, second, @dec third = 'default') => string; + │ ^ + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + + i Expected a type here. + + > 1 │ type I = (@dec x, second, @dec third = 'default') => string; + │ ^ + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + +ts_decorator_on_function_type.ts:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ type I = (@dec x, second, @dec third = 'default') => string; + │ ^^^^ + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_type.ts:1:49 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + > 1 │ type I = (@dec x, second, @dec third = 'default') => string; + │ ^ + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + + i An explicit or implicit semicolon is expected here... + + > 1 │ type I = (@dec x, second, @dec third = 'default') => string; + │ ^ + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + + i ...Which is required to end this statement + + > 1 │ type I = (@dec x, second, @dec third = 'default') => string; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + +ts_decorator_on_function_type.ts:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '@'. + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^ + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + 4 │ + + i Expected a type here. + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^ + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + 4 │ + +ts_decorator_on_function_type.ts:2:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^^^^^^^^^ + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_type.ts:2:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^ + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + 4 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^ + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + 4 │ + + i ...Which is required to end this statement + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + > 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + 4 │ + +ts_decorator_on_function_type.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found '@'. + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + │ ^ + 4 │ + + i Expected a type here. + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + │ ^ + 4 │ + +ts_decorator_on_function_type.ts:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + │ ^^^^^^ + 4 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_function_type.ts:3:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + │ ^ + 4 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + │ ^ + 4 │ + + i ...Which is required to end this statement + + 1 │ type I = (@dec x, second, @dec third = 'default') => string; + 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; + > 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap new file mode 100644 index 000000000000..b3ff807803c3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap @@ -0,0 +1,642 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = {new (@dec x, second, @dec third = 'default'): string; } +type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } +type C = { + new(@dec() x, second, @dec() third = 'default'): string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..10 "{" [] [], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@10..14 "new" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@14..15 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@15..16 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..20 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@20..21 "x" [] [], + }, + ], + }, + COMMA@21..23 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@23..29 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@29..31 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@31..32 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..36 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@36..42 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@44..53 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@53..54 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@54..56 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@56..62 "string" [] [], + }, + }, + separator_token: SEMICOLON@62..64 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@64..65 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@71..73 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@75..76 "{" [] [], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@76..82 "method" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@82..83 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@83..84 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..87 "dec" [] [], + }, + }, + operator_token: DOT@87..88 "." [] [], + member: JsName { + value_token: IDENT@88..90 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@90..91 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@91..93 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@93..94 "x" [] [], + }, + ], + }, + COMMA@94..96 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@96..102 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@102..104 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@104..105 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@105..108 "dec" [] [], + }, + }, + operator_token: DOT@108..109 "." [] [], + member: JsName { + value_token: IDENT@109..111 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@111..112 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@112..114 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@114..120 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@120..122 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@122..131 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@131..132 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@132..134 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@134..140 "string" [] [], + }, + }, + separator_token: SEMICOLON@140..142 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@142..143 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@143..149 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@149..151 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@151..153 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@153..154 "{" [] [], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@154..159 "new" [Newline("\n"), Whitespace(" ")] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@159..160 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@160..161 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@161..164 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@164..165 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@165..167 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@167..168 "x" [] [], + }, + ], + }, + COMMA@168..170 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@170..176 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@176..178 "," [] [Whitespace(" ")], + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@178..179 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@179..182 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@182..183 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@183..185 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@185..191 "third" [] [Whitespace(" ")], + }, + JsInitializerClause { + eq_token: EQ@191..193 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@193..202 "'default'" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@202..203 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@203..205 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@205..211 "string" [] [], + }, + }, + separator_token: SEMICOLON@211..212 ";" [] [], + }, + ], + r_curly_token: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@212..213 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..213 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..212 + 0: TS_TYPE_ALIAS_DECLARATION@0..65 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..65 + 0: L_CURLY@9..10 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@10..64 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@10..64 + 0: NEW_KW@10..14 "new" [] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@14..54 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_PARAMETER_LIST@15..53 + 0: JS_BOGUS_PARAMETER@15..21 + 0: JS_BOGUS@15..20 + 0: JS_DECORATOR@15..20 + 0: AT@15..16 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@16..20 + 0: JS_REFERENCE_IDENTIFIER@16..20 + 0: IDENT@16..20 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@20..21 + 0: IDENT@20..21 "x" [] [] + 1: COMMA@21..23 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@23..29 + 0: JS_DECORATOR_LIST@23..23 + 1: JS_IDENTIFIER_BINDING@23..29 + 0: IDENT@23..29 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@29..31 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@31..53 + 0: JS_BOGUS@31..36 + 0: JS_DECORATOR@31..36 + 0: AT@31..32 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@32..36 + 0: JS_REFERENCE_IDENTIFIER@32..36 + 0: IDENT@32..36 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@36..42 + 0: IDENT@36..42 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@42..53 + 0: EQ@42..44 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@44..53 + 0: JS_STRING_LITERAL@44..53 "'default'" [] [] + 2: R_PAREN@53..54 ")" [] [] + 3: TS_TYPE_ANNOTATION@54..62 + 0: COLON@54..56 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@56..62 + 0: STRING_KW@56..62 "string" [] [] + 4: SEMICOLON@62..64 ";" [] [Whitespace(" ")] + 2: R_CURLY@64..65 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@65..143 + 0: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@73..75 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@75..143 + 0: L_CURLY@75..76 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@76..142 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@76..142 + 0: JS_LITERAL_MEMBER_NAME@76..82 + 0: IDENT@76..82 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@82..132 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_PARAMETER_LIST@83..131 + 0: JS_BOGUS_PARAMETER@83..94 + 0: JS_BOGUS@83..93 + 0: JS_DECORATOR@83..93 + 0: AT@83..84 "@" [] [] + 1: JS_CALL_EXPRESSION@84..93 + 0: JS_STATIC_MEMBER_EXPRESSION@84..90 + 0: JS_IDENTIFIER_EXPRESSION@84..87 + 0: JS_REFERENCE_IDENTIFIER@84..87 + 0: IDENT@84..87 "dec" [] [] + 1: DOT@87..88 "." [] [] + 2: JS_NAME@88..90 + 0: IDENT@88..90 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@90..93 + 0: L_PAREN@90..91 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@91..91 + 2: R_PAREN@91..93 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@93..94 + 0: IDENT@93..94 "x" [] [] + 1: COMMA@94..96 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@96..102 + 0: JS_DECORATOR_LIST@96..96 + 1: JS_IDENTIFIER_BINDING@96..102 + 0: IDENT@96..102 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@102..104 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@104..131 + 0: JS_BOGUS@104..114 + 0: JS_DECORATOR@104..114 + 0: AT@104..105 "@" [] [] + 1: JS_CALL_EXPRESSION@105..114 + 0: JS_STATIC_MEMBER_EXPRESSION@105..111 + 0: JS_IDENTIFIER_EXPRESSION@105..108 + 0: JS_REFERENCE_IDENTIFIER@105..108 + 0: IDENT@105..108 "dec" [] [] + 1: DOT@108..109 "." [] [] + 2: JS_NAME@109..111 + 0: IDENT@109..111 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@111..114 + 0: L_PAREN@111..112 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@112..112 + 2: R_PAREN@112..114 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@114..120 + 0: IDENT@114..120 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@120..131 + 0: EQ@120..122 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@122..131 + 0: JS_STRING_LITERAL@122..131 "'default'" [] [] + 2: R_PAREN@131..132 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@132..140 + 0: COLON@132..134 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@134..140 + 0: STRING_KW@134..140 "string" [] [] + 5: SEMICOLON@140..142 ";" [] [Whitespace(" ")] + 2: R_CURLY@142..143 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@143..212 + 0: TYPE_KW@143..149 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@149..151 + 0: IDENT@149..151 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@151..153 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@153..212 + 0: L_CURLY@153..154 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@154..212 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@154..212 + 0: NEW_KW@154..159 "new" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: JS_PARAMETERS@159..203 + 0: L_PAREN@159..160 "(" [] [] + 1: JS_PARAMETER_LIST@160..202 + 0: JS_BOGUS_PARAMETER@160..168 + 0: JS_BOGUS@160..167 + 0: JS_DECORATOR@160..167 + 0: AT@160..161 "@" [] [] + 1: JS_CALL_EXPRESSION@161..167 + 0: JS_IDENTIFIER_EXPRESSION@161..164 + 0: JS_REFERENCE_IDENTIFIER@161..164 + 0: IDENT@161..164 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@164..167 + 0: L_PAREN@164..165 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@165..165 + 2: R_PAREN@165..167 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@167..168 + 0: IDENT@167..168 "x" [] [] + 1: COMMA@168..170 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@170..176 + 0: JS_DECORATOR_LIST@170..170 + 1: JS_IDENTIFIER_BINDING@170..176 + 0: IDENT@170..176 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@176..178 "," [] [Whitespace(" ")] + 4: JS_BOGUS_PARAMETER@178..202 + 0: JS_BOGUS@178..185 + 0: JS_DECORATOR@178..185 + 0: AT@178..179 "@" [] [] + 1: JS_CALL_EXPRESSION@179..185 + 0: JS_IDENTIFIER_EXPRESSION@179..182 + 0: JS_REFERENCE_IDENTIFIER@179..182 + 0: IDENT@179..182 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@182..185 + 0: L_PAREN@182..183 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@183..183 + 2: R_PAREN@183..185 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@185..191 + 0: IDENT@185..191 "third" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@191..202 + 0: EQ@191..193 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@193..202 + 0: JS_STRING_LITERAL@193..202 "'default'" [] [] + 2: R_PAREN@202..203 ")" [] [] + 3: TS_TYPE_ANNOTATION@203..211 + 0: COLON@203..205 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@205..211 + 0: STRING_KW@205..211 "string" [] [] + 4: SEMICOLON@211..212 ";" [] [] + 2: (empty) + 5: (empty) + 4: EOF@212..213 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_on_signature_member.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } + │ ^^^^ + 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } + 3 │ type C = { + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_signature_member.ts:1:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } + │ ^^^^ + 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } + 3 │ type C = { + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_signature_member.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } + > 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } + │ ^^^^^^^^^ + 3 │ type C = { + 4 │ new(@dec() x, second, @dec() third = 'default'): string; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_signature_member.ts:2:39 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type A = {new (@dec x, second, @dec third = 'default'): string; } + > 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } + │ ^^^^^^^^^ + 3 │ type C = { + 4 │ new(@dec() x, second, @dec() third = 'default'): string; + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_signature_member.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } + 3 │ type C = { + > 4 │ new(@dec() x, second, @dec() third = 'default'): string; + │ ^^^^^^ + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_signature_member.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } + 3 │ type C = { + > 4 │ new(@dec() x, second, @dec() third = 'default'): string; + │ ^^^^^^ + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_on_signature_member.ts:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead the file ends + + 3 │ type C = { + 4 │ new(@dec() x, second, @dec() third = 'default'): string; + > 5 │ + │ + + i the file ends here + + 3 │ type C = { + 4 │ new(@dec() x, second, @dec() third = 'default'): string; + > 5 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap new file mode 100644 index 000000000000..61ed7f4f14b2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap @@ -0,0 +1,450 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { set a(@dec b: number) } +type B = { set a(@dec(val) b) } +type AA = { set a(@dec b: number) } +type BB = { set a(@dec(val) b) } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@11..15 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@15..16 "a" [] [], + }, + l_paren_token: L_PAREN@16..17 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@17..18 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..22 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@22..23 "b" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@25..31 "number" [] [], + }, + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@40..42 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@46..50 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@50..51 "a" [] [], + }, + l_paren_token: L_PAREN@51..52 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@52..53 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..56 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@56..57 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..60 "val" [] [], + }, + }, + ], + r_paren_token: R_PAREN@60..62 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@62..63 "b" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@65..66 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@72..75 "AA" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@75..77 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@77..79 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@79..83 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@83..84 "a" [] [], + }, + l_paren_token: L_PAREN@84..85 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@85..86 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@86..90 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@90..91 "b" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@91..93 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@93..99 "number" [] [], + }, + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@102..108 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@108..111 "BB" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@111..113 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@113..115 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@115..119 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@119..120 "a" [] [], + }, + l_paren_token: L_PAREN@120..121 "(" [] [], + parameter: JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@121..122 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@122..125 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@125..126 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@126..129 "val" [] [], + }, + }, + ], + r_paren_token: R_PAREN@129..131 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@131..132 "b" [] [], + }, + ], + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@132..134 ")" [] [Whitespace(" ")], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@134..135 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@135..136 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..136 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..135 + 0: TS_TYPE_ALIAS_DECLARATION@0..34 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..34 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..33 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@11..33 + 0: SET_KW@11..15 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@15..16 + 0: IDENT@15..16 "a" [] [] + 2: L_PAREN@16..17 "(" [] [] + 3: JS_BOGUS_PARAMETER@17..31 + 0: JS_BOGUS@17..22 + 0: JS_DECORATOR@17..22 + 0: AT@17..18 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@18..22 + 0: JS_REFERENCE_IDENTIFIER@18..22 + 0: IDENT@18..22 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@22..23 + 0: IDENT@22..23 "b" [] [] + 2: TS_TYPE_ANNOTATION@23..31 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@25..31 + 0: NUMBER_KW@25..31 "number" [] [] + 4: (empty) + 5: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@33..34 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@34..66 + 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@42..44 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@44..66 + 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@46..65 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@46..65 + 0: SET_KW@46..50 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@50..51 + 0: IDENT@50..51 "a" [] [] + 2: L_PAREN@51..52 "(" [] [] + 3: JS_BOGUS_PARAMETER@52..63 + 0: JS_BOGUS@52..62 + 0: JS_DECORATOR@52..62 + 0: AT@52..53 "@" [] [] + 1: JS_CALL_EXPRESSION@53..62 + 0: JS_IDENTIFIER_EXPRESSION@53..56 + 0: JS_REFERENCE_IDENTIFIER@53..56 + 0: IDENT@53..56 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@56..62 + 0: L_PAREN@56..57 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@57..60 + 0: JS_IDENTIFIER_EXPRESSION@57..60 + 0: JS_REFERENCE_IDENTIFIER@57..60 + 0: IDENT@57..60 "val" [] [] + 2: R_PAREN@60..62 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@62..63 + 0: IDENT@62..63 "b" [] [] + 4: (empty) + 5: R_PAREN@63..65 ")" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@65..66 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@66..102 + 0: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@72..75 + 0: IDENT@72..75 "AA" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@75..77 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@77..102 + 0: L_CURLY@77..79 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@79..101 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@79..101 + 0: SET_KW@79..83 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@83..84 + 0: IDENT@83..84 "a" [] [] + 2: L_PAREN@84..85 "(" [] [] + 3: JS_BOGUS_PARAMETER@85..99 + 0: JS_BOGUS@85..90 + 0: JS_DECORATOR@85..90 + 0: AT@85..86 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@86..90 + 0: JS_REFERENCE_IDENTIFIER@86..90 + 0: IDENT@86..90 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@90..91 + 0: IDENT@90..91 "b" [] [] + 2: TS_TYPE_ANNOTATION@91..99 + 0: COLON@91..93 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@93..99 + 0: NUMBER_KW@93..99 "number" [] [] + 4: (empty) + 5: R_PAREN@99..101 ")" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@101..102 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@102..135 + 0: TYPE_KW@102..108 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@108..111 + 0: IDENT@108..111 "BB" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@111..113 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@113..135 + 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@115..134 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@115..134 + 0: SET_KW@115..119 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@119..120 + 0: IDENT@119..120 "a" [] [] + 2: L_PAREN@120..121 "(" [] [] + 3: JS_BOGUS_PARAMETER@121..132 + 0: JS_BOGUS@121..131 + 0: JS_DECORATOR@121..131 + 0: AT@121..122 "@" [] [] + 1: JS_CALL_EXPRESSION@122..131 + 0: JS_IDENTIFIER_EXPRESSION@122..125 + 0: JS_REFERENCE_IDENTIFIER@122..125 + 0: IDENT@122..125 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@125..131 + 0: L_PAREN@125..126 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@126..129 + 0: JS_IDENTIFIER_EXPRESSION@126..129 + 0: JS_REFERENCE_IDENTIFIER@126..129 + 0: IDENT@126..129 "val" [] [] + 2: R_PAREN@129..131 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@131..132 + 0: IDENT@131..132 "b" [] [] + 4: (empty) + 5: R_PAREN@132..134 ")" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@134..135 "}" [] [] + 5: (empty) + 4: EOF@135..136 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_setter_signature.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ type A = { set a(@dec b: number) } + │ ^^^^ + 2 │ type B = { set a(@dec(val) b) } + 3 │ type AA = { set a(@dec b: number) } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_setter_signature.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type A = { set a(@dec b: number) } + > 2 │ type B = { set a(@dec(val) b) } + │ ^^^^^^^^^ + 3 │ type AA = { set a(@dec b: number) } + 4 │ type BB = { set a(@dec(val) b) } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_setter_signature.ts:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ type A = { set a(@dec b: number) } + 2 │ type B = { set a(@dec(val) b) } + > 3 │ type AA = { set a(@dec b: number) } + │ ^^^^ + 4 │ type BB = { set a(@dec(val) b) } + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_setter_signature.ts:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ type B = { set a(@dec(val) b) } + 3 │ type AA = { set a(@dec b: number) } + > 4 │ type BB = { set a(@dec(val) b) } + │ ^^^^^^^^^ + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap new file mode 100644 index 000000000000..0d8dd2a3c1f6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap @@ -0,0 +1,356 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec this) {} + method(@dec(val) this) {} + method(@dec.fn(val) this) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@18..19 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@19..20 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..24 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsThisParameter { + this_token: THIS_KW@24..28 "this" [] [], + type_annotation: missing (optional), + }, + ], + }, + R_PAREN@28..30 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@30..31 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@41..42 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@42..43 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@43..46 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@46..47 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@47..50 "val" [] [], + }, + }, + ], + r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsThisParameter { + this_token: THIS_KW@52..56 "this" [] [], + type_annotation: missing (optional), + }, + ], + }, + R_PAREN@56..58 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@69..70 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@70..71 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@71..74 "dec" [] [], + }, + }, + operator_token: DOT@74..75 "." [] [], + member: JsName { + value_token: IDENT@75..77 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@77..78 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..81 "val" [] [], + }, + }, + ], + r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsThisParameter { + this_token: THIS_KW@83..87 "this" [] [], + type_annotation: missing (optional), + }, + ], + }, + R_PAREN@87..89 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@89..90 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@90..91 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@91..93 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@93..94 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..94 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..93 + 0: JS_CLASS_DECLARATION@0..93 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..91 + 0: JS_BOGUS_MEMBER@9..32 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..18 + 0: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@18..30 + 0: L_PAREN@18..19 "(" [] [] + 1: JS_BOGUS@19..28 + 0: JS_BOGUS@19..24 + 0: JS_DECORATOR@19..24 + 0: AT@19..20 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@20..24 + 0: JS_REFERENCE_IDENTIFIER@20..24 + 0: IDENT@20..24 "dec" [] [Whitespace(" ")] + 1: TS_THIS_PARAMETER@24..28 + 0: THIS_KW@24..28 "this" [] [] + 1: (empty) + 2: R_PAREN@28..30 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@30..32 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_DIRECTIVE_LIST@31..31 + 2: JS_STATEMENT_LIST@31..31 + 3: R_CURLY@31..32 "}" [] [] + 1: JS_BOGUS_MEMBER@32..60 + 0: JS_METHOD_MODIFIER_LIST@32..32 + 1: JS_LITERAL_MEMBER_NAME@32..41 + 0: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@41..58 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_BOGUS@42..56 + 0: JS_BOGUS@42..52 + 0: JS_DECORATOR@42..52 + 0: AT@42..43 "@" [] [] + 1: JS_CALL_EXPRESSION@43..52 + 0: JS_IDENTIFIER_EXPRESSION@43..46 + 0: JS_REFERENCE_IDENTIFIER@43..46 + 0: IDENT@43..46 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@46..52 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@47..50 + 0: JS_IDENTIFIER_EXPRESSION@47..50 + 0: JS_REFERENCE_IDENTIFIER@47..50 + 0: IDENT@47..50 "val" [] [] + 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] + 1: TS_THIS_PARAMETER@52..56 + 0: THIS_KW@52..56 "this" [] [] + 1: (empty) + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@58..60 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..60 "}" [] [] + 2: JS_BOGUS_MEMBER@60..91 + 0: JS_METHOD_MODIFIER_LIST@60..60 + 1: JS_LITERAL_MEMBER_NAME@60..69 + 0: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@69..89 + 0: L_PAREN@69..70 "(" [] [] + 1: JS_BOGUS@70..87 + 0: JS_BOGUS@70..83 + 0: JS_DECORATOR@70..83 + 0: AT@70..71 "@" [] [] + 1: JS_CALL_EXPRESSION@71..83 + 0: JS_STATIC_MEMBER_EXPRESSION@71..77 + 0: JS_IDENTIFIER_EXPRESSION@71..74 + 0: JS_REFERENCE_IDENTIFIER@71..74 + 0: IDENT@71..74 "dec" [] [] + 1: DOT@74..75 "." [] [] + 2: JS_NAME@75..77 + 0: IDENT@75..77 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@77..83 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@78..81 + 0: JS_IDENTIFIER_EXPRESSION@78..81 + 0: JS_REFERENCE_IDENTIFIER@78..81 + 0: IDENT@78..81 "val" [] [] + 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] + 1: TS_THIS_PARAMETER@83..87 + 0: THIS_KW@83..87 "this" [] [] + 1: (empty) + 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@89..91 + 0: L_CURLY@89..90 "{" [] [] + 1: JS_DIRECTIVE_LIST@90..90 + 2: JS_STATEMENT_LIST@90..90 + 3: R_CURLY@90..91 "}" [] [] + 9: R_CURLY@91..93 "}" [Newline("\n")] [] + 4: EOF@93..94 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_this_parameter.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + > 2 │ method(@dec this) {} + │ ^^^^ + 3 │ method(@dec(val) this) {} + 4 │ method(@dec.fn(val) this) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_this_parameter.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + 2 │ method(@dec this) {} + > 3 │ method(@dec(val) this) {} + │ ^^^^^^^^^ + 4 │ method(@dec.fn(val) this) {} + 5 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_this_parameter.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ method(@dec this) {} + 3 │ method(@dec(val) this) {} + > 4 │ method(@dec.fn(val) this) {} + │ ^^^^^^^^^^^^ + 5 │ } + 6 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap new file mode 100644 index 000000000000..47d38ba913f7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap @@ -0,0 +1,356 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec this) {} + method(@dec(val) this) {} + method(@dec.fn(val) this) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@18..19 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@19..20 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..24 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsThisParameter { + this_token: THIS_KW@24..28 "this" [] [], + type_annotation: missing (optional), + }, + ], + }, + R_PAREN@28..30 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@30..31 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@41..42 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@42..43 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@43..46 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@46..47 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@47..50 "val" [] [], + }, + }, + ], + r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsThisParameter { + this_token: THIS_KW@52..56 "this" [] [], + type_annotation: missing (optional), + }, + ], + }, + R_PAREN@56..58 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [], + }, + JsBogus { + items: [ + L_PAREN@69..70 "(" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@70..71 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@71..74 "dec" [] [], + }, + }, + operator_token: DOT@74..75 "." [] [], + member: JsName { + value_token: IDENT@75..77 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@77..78 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..81 "val" [] [], + }, + }, + ], + r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + TsThisParameter { + this_token: THIS_KW@83..87 "this" [] [], + type_annotation: missing (optional), + }, + ], + }, + R_PAREN@87..89 ")" [] [Whitespace(" ")], + ], + }, + JsFunctionBody { + l_curly_token: L_CURLY@89..90 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@90..91 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@91..93 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@93..94 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..94 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..93 + 0: JS_CLASS_DECLARATION@0..93 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..91 + 0: JS_BOGUS_MEMBER@9..32 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..18 + 0: IDENT@9..18 "method" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@18..30 + 0: L_PAREN@18..19 "(" [] [] + 1: JS_BOGUS@19..28 + 0: JS_BOGUS@19..24 + 0: JS_DECORATOR@19..24 + 0: AT@19..20 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@20..24 + 0: JS_REFERENCE_IDENTIFIER@20..24 + 0: IDENT@20..24 "dec" [] [Whitespace(" ")] + 1: TS_THIS_PARAMETER@24..28 + 0: THIS_KW@24..28 "this" [] [] + 1: (empty) + 2: R_PAREN@28..30 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@30..32 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_DIRECTIVE_LIST@31..31 + 2: JS_STATEMENT_LIST@31..31 + 3: R_CURLY@31..32 "}" [] [] + 1: JS_BOGUS_MEMBER@32..60 + 0: JS_METHOD_MODIFIER_LIST@32..32 + 1: JS_LITERAL_MEMBER_NAME@32..41 + 0: IDENT@32..41 "method" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@41..58 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_BOGUS@42..56 + 0: JS_BOGUS@42..52 + 0: JS_DECORATOR@42..52 + 0: AT@42..43 "@" [] [] + 1: JS_CALL_EXPRESSION@43..52 + 0: JS_IDENTIFIER_EXPRESSION@43..46 + 0: JS_REFERENCE_IDENTIFIER@43..46 + 0: IDENT@43..46 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@46..52 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@47..50 + 0: JS_IDENTIFIER_EXPRESSION@47..50 + 0: JS_REFERENCE_IDENTIFIER@47..50 + 0: IDENT@47..50 "val" [] [] + 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] + 1: TS_THIS_PARAMETER@52..56 + 0: THIS_KW@52..56 "this" [] [] + 1: (empty) + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@58..60 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..60 "}" [] [] + 2: JS_BOGUS_MEMBER@60..91 + 0: JS_METHOD_MODIFIER_LIST@60..60 + 1: JS_LITERAL_MEMBER_NAME@60..69 + 0: IDENT@60..69 "method" [Newline("\n"), Whitespace(" ")] [] + 2: JS_BOGUS@69..89 + 0: L_PAREN@69..70 "(" [] [] + 1: JS_BOGUS@70..87 + 0: JS_BOGUS@70..83 + 0: JS_DECORATOR@70..83 + 0: AT@70..71 "@" [] [] + 1: JS_CALL_EXPRESSION@71..83 + 0: JS_STATIC_MEMBER_EXPRESSION@71..77 + 0: JS_IDENTIFIER_EXPRESSION@71..74 + 0: JS_REFERENCE_IDENTIFIER@71..74 + 0: IDENT@71..74 "dec" [] [] + 1: DOT@74..75 "." [] [] + 2: JS_NAME@75..77 + 0: IDENT@75..77 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@77..83 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@78..81 + 0: JS_IDENTIFIER_EXPRESSION@78..81 + 0: JS_REFERENCE_IDENTIFIER@78..81 + 0: IDENT@78..81 "val" [] [] + 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] + 1: TS_THIS_PARAMETER@83..87 + 0: THIS_KW@83..87 "this" [] [] + 1: (empty) + 2: R_PAREN@87..89 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@89..91 + 0: L_CURLY@89..90 "{" [] [] + 1: JS_DIRECTIVE_LIST@90..90 + 2: JS_STATEMENT_LIST@90..90 + 3: R_CURLY@90..91 "}" [] [] + 9: R_CURLY@91..93 "}" [Newline("\n")] [] + 4: EOF@93..94 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_decorator_this_parameter_option.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + > 2 │ method(@dec this) {} + │ ^^^^ + 3 │ method(@dec(val) this) {} + 4 │ method(@dec.fn(val) this) {} + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_this_parameter_option.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class A { + 2 │ method(@dec this) {} + > 3 │ method(@dec(val) this) {} + │ ^^^^^^^^^ + 4 │ method(@dec.fn(val) this) {} + 5 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_decorator_this_parameter_option.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ method(@dec this) {} + 3 │ method(@dec(val) this) {} + > 4 │ method(@dec.fn(val) this) {} + │ ^^^^^^^^^^^^ + 5 │ } + 6 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap new file mode 100644 index 000000000000..a4508e6ea7bd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap @@ -0,0 +1,179 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { prop!: string } +class B { declare prop!: string } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [], + JsLiteralMemberName { + value: IDENT@18..22 "prop" [] [], + }, + TsDefinitePropertyAnnotation { + excl_token: BANG@22..23 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@25..32 "string" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + ], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@33..40 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@40..42 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@44..52 "declare" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@52..56 "prop" [] [], + }, + TsDefinitePropertyAnnotation { + excl_token: BANG@56..57 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@57..59 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@59..66 "string" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + ], + r_curly_token: R_CURLY@66..67 "}" [] [], + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: TS_DECLARE_STATEMENT@0..33 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..33 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..32 + 0: JS_BOGUS_MEMBER@18..32 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..18 + 1: JS_LITERAL_MEMBER_NAME@18..22 + 0: IDENT@18..22 "prop" [] [] + 2: TS_DEFINITE_PROPERTY_ANNOTATION@22..32 + 0: BANG@22..23 "!" [] [] + 1: TS_TYPE_ANNOTATION@23..32 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@25..32 + 0: STRING_KW@25..32 "string" [] [Whitespace(" ")] + 9: R_CURLY@32..33 "}" [] [] + 1: JS_CLASS_DECLARATION@33..67 + 0: JS_DECORATOR_LIST@33..33 + 1: (empty) + 2: CLASS_KW@33..40 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@42..44 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@44..66 + 0: JS_BOGUS_MEMBER@44..66 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@44..52 + 0: TS_DECLARE_MODIFIER@44..52 + 0: DECLARE_KW@44..52 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@52..56 + 0: IDENT@52..56 "prop" [] [] + 2: TS_DEFINITE_PROPERTY_ANNOTATION@56..66 + 0: BANG@56..57 "!" [] [] + 1: TS_TYPE_ANNOTATION@57..66 + 0: COLON@57..59 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@59..66 + 0: STRING_KW@59..66 "string" [] [Whitespace(" ")] + 9: R_CURLY@66..67 "}" [] [] + 4: EOF@67..68 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_definite_assignment_in_ambient_context.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Definite assignment operators '!' aren't allowed in ambient contexts. + + > 1 │ declare class A { prop!: string } + │ ^ + 2 │ class B { declare prop!: string } + 3 │ + +ts_definite_assignment_in_ambient_context.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Definite assignment operators '!' aren't allowed in ambient contexts. + + 1 │ declare class A { prop!: string } + > 2 │ class B { declare prop!: string } + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap new file mode 100644 index 000000000000..d763f9d72c7f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap @@ -0,0 +1,103 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a!: string = "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsDefiniteVariableAnnotation { + excl_token: BANG@5..6 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@6..8 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@8..15 "string" [] [Whitespace(" ")], + }, + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@15..17 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@17..23 "\"test\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_VARIABLE_STATEMENT@0..24 + 0: JS_VARIABLE_DECLARATION@0..23 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..23 + 0: JS_VARIABLE_DECLARATOR@4..23 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_DEFINITE_VARIABLE_ANNOTATION@5..15 + 0: BANG@5..6 "!" [] [] + 1: TS_TYPE_ANNOTATION@6..15 + 0: COLON@6..8 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@8..15 + 0: STRING_KW@8..15 "string" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@15..23 + 0: EQ@15..17 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@17..23 + 0: JS_STRING_LITERAL@17..23 "\"test\"" [] [] + 1: SEMICOLON@23..24 ";" [] [] + 4: EOF@24..25 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_definite_variable_with_initializer.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Declarations with initializers cannot also have definite assignment assertions. + + > 1 │ let a!: string = "test"; + │ ^^^^^^^^ + 2 │ + + i Annotation + + > 1 │ let a!: string = "test"; + │ ^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_declare.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_declare.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts.snap new file mode 100644 index 000000000000..af7ab3919c5f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts.snap @@ -0,0 +1,184 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export declare @decorator class D {} +export declare @decorator abstract class D {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + JsBogus { + items: [ + DECLARE_KW@7..15 "declare" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@15..16 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..26 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@32..34 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@34..35 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@35..36 "}" [] [], + }, + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + DECLARE_KW@44..52 "declare" [] [Whitespace(" ")], + JsBogusStatement { + items: [ + JsDecorator { + at_token: AT@52..53 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..63 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@63..72 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@72..78 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@78..80 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@80..81 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@81..82 "}" [] [], + }, + ], + }, + ], + }, + ], + eof_token: EOF@82..83 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..83 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..82 + 0: JS_BOGUS_STATEMENT@0..36 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_BOGUS@7..36 + 0: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@15..26 + 0: JS_DECORATOR@15..26 + 0: AT@15..16 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@16..26 + 0: JS_REFERENCE_IDENTIFIER@16..26 + 0: IDENT@16..26 "decorator" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@26..36 + 0: JS_DECORATOR_LIST@26..26 + 1: (empty) + 2: CLASS_KW@26..32 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@32..34 + 0: IDENT@32..34 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@34..35 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@35..35 + 9: R_CURLY@35..36 "}" [] [] + 1: JS_BOGUS_STATEMENT@36..82 + 0: JS_DECORATOR_LIST@36..36 + 1: EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@44..82 + 0: DECLARE_KW@44..52 "declare" [] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@52..63 + 0: JS_DECORATOR@52..63 + 0: AT@52..53 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@53..63 + 0: JS_REFERENCE_IDENTIFIER@53..63 + 0: IDENT@53..63 "decorator" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@63..82 + 0: JS_DECORATOR_LIST@63..63 + 1: ABSTRACT_KW@63..72 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@72..78 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@78..80 + 0: IDENT@78..80 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@80..81 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@81..81 + 9: R_CURLY@81..82 "}" [] [] + 4: EOF@82..83 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_export_declare.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ export declare @decorator class D {} + │ ^^^^^^^^^^ + 2 │ export declare @decorator abstract class D {} + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_export_declare.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ export declare @decorator class D {} + > 2 │ export declare @decorator abstract class D {} + │ ^^^^^^^^^^ + 3 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts.snap new file mode 100644 index 000000000000..0431a483fe15 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default enum A { X, Y, Z } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + JsBogus { + items: [ + DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@15..20 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@20..22 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@22..24 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@24..25 "X" [] [], + }, + initializer: missing (optional), + }, + COMMA@25..27 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@27..28 "Y" [] [], + }, + initializer: missing (optional), + }, + COMMA@28..30 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@30..32 "Z" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + ], + }, + ], + }, + ], + eof_token: EOF@33..34 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..34 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..33 + 0: JS_BOGUS_STATEMENT@0..33 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_BOGUS@7..33 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_ENUM_DECLARATION@15..33 + 0: (empty) + 1: ENUM_KW@15..20 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@20..22 + 0: IDENT@20..22 "A" [] [Whitespace(" ")] + 3: L_CURLY@22..24 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@24..32 + 0: TS_ENUM_MEMBER@24..25 + 0: TS_LITERAL_ENUM_MEMBER_NAME@24..25 + 0: IDENT@24..25 "X" [] [] + 1: (empty) + 1: COMMA@25..27 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@27..28 + 0: TS_LITERAL_ENUM_MEMBER_NAME@27..28 + 0: IDENT@27..28 "Y" [] [] + 1: (empty) + 3: COMMA@28..30 "," [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER@30..32 + 0: TS_LITERAL_ENUM_MEMBER_NAME@30..32 + 0: IDENT@30..32 "Z" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@32..33 "}" [] [] + 4: EOF@33..34 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_export_default_enum.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. + + > 1 │ export default enum A { X, Y, Z } + │ ^^^^^^^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js.snap new file mode 100644 index 000000000000..8c99861da541 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js.snap @@ -0,0 +1,436 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a, b, c; +export type { a }; +export { type b }; +export { type c as cc }; +export type { d } from "./d"; +export { type e } from "./e"; +export { type e as ee } from "./e"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@5..7 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@7..8 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@8..10 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@10..11 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@12..20 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + TYPE_KW@20..25 "type" [] [Whitespace(" ")], + L_CURLY@25..27 "{" [] [Whitespace(" ")], + JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@27..29 "a" [] [Whitespace(" ")], + }, + }, + ], + R_CURLY@29..30 "}" [] [], + SEMICOLON@30..31 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@39..41 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + TYPE_KW@41..46 "type" [] [Whitespace(" ")], + JsReferenceIdentifier { + value_token: IDENT@46..48 "b" [] [Whitespace(" ")], + }, + ], + }, + ], + }, + R_CURLY@48..49 "}" [] [], + SEMICOLON@49..50 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@50..58 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@58..60 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + TYPE_KW@60..65 "type" [] [Whitespace(" ")], + JsReferenceIdentifier { + value_token: IDENT@65..67 "c" [] [Whitespace(" ")], + }, + AS_KW@67..70 "as" [] [Whitespace(" ")], + JsLiteralExportName { + value: IDENT@70..73 "cc" [] [Whitespace(" ")], + }, + ], + }, + ], + }, + R_CURLY@73..74 "}" [] [], + SEMICOLON@74..75 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@75..83 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + TYPE_KW@83..88 "type" [] [Whitespace(" ")], + L_CURLY@88..90 "{" [] [Whitespace(" ")], + JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@90..92 "d" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + R_CURLY@92..94 "}" [] [Whitespace(" ")], + FROM_KW@94..99 "from" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@99..104 "\"./d\"" [] [], + }, + SEMICOLON@104..105 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@105..113 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@113..115 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + TYPE_KW@115..120 "type" [] [Whitespace(" ")], + JsLiteralExportName { + value: IDENT@120..122 "e" [] [Whitespace(" ")], + }, + ], + }, + ], + }, + R_CURLY@122..124 "}" [] [Whitespace(" ")], + FROM_KW@124..129 "from" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@129..134 "\"./e\"" [] [], + }, + SEMICOLON@134..135 ";" [] [], + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@135..143 "export" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + L_CURLY@143..145 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + TYPE_KW@145..150 "type" [] [Whitespace(" ")], + JsLiteralExportName { + value: IDENT@150..152 "e" [] [Whitespace(" ")], + }, + JsExportAsClause { + as_token: AS_KW@152..155 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@155..158 "ee" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + }, + R_CURLY@158..160 "}" [] [Whitespace(" ")], + FROM_KW@160..165 "from" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@165..170 "\"./e\"" [] [], + }, + SEMICOLON@170..171 ";" [] [], + ], + }, + ], + }, + ], + eof_token: EOF@171..172 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..172 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..171 + 0: JS_VARIABLE_STATEMENT@0..12 + 0: JS_VARIABLE_DECLARATION@0..11 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..11 + 0: JS_VARIABLE_DECLARATOR@4..5 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@5..7 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@7..8 + 0: JS_IDENTIFIER_BINDING@7..8 + 0: IDENT@7..8 "b" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@8..10 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@10..11 + 0: JS_IDENTIFIER_BINDING@10..11 + 0: IDENT@10..11 "c" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_BOGUS_STATEMENT@12..31 + 0: JS_DECORATOR_LIST@12..12 + 1: EXPORT_KW@12..20 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@20..31 + 0: TYPE_KW@20..25 "type" [] [Whitespace(" ")] + 1: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@27..29 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@27..29 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@27..29 + 0: IDENT@27..29 "a" [] [Whitespace(" ")] + 3: R_CURLY@29..30 "}" [] [] + 4: SEMICOLON@30..31 ";" [] [] + 2: JS_BOGUS_STATEMENT@31..50 + 0: JS_DECORATOR_LIST@31..31 + 1: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@39..50 + 0: L_CURLY@39..41 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@41..48 + 0: JS_BOGUS@41..48 + 0: TYPE_KW@41..46 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@46..48 + 0: IDENT@46..48 "b" [] [Whitespace(" ")] + 2: R_CURLY@48..49 "}" [] [] + 3: SEMICOLON@49..50 ";" [] [] + 3: JS_BOGUS_STATEMENT@50..75 + 0: JS_DECORATOR_LIST@50..50 + 1: EXPORT_KW@50..58 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@58..75 + 0: L_CURLY@58..60 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@60..73 + 0: JS_BOGUS@60..73 + 0: TYPE_KW@60..65 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@65..67 + 0: IDENT@65..67 "c" [] [Whitespace(" ")] + 2: AS_KW@67..70 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@70..73 + 0: IDENT@70..73 "cc" [] [Whitespace(" ")] + 2: R_CURLY@73..74 "}" [] [] + 3: SEMICOLON@74..75 ";" [] [] + 4: JS_BOGUS_STATEMENT@75..105 + 0: JS_DECORATOR_LIST@75..75 + 1: EXPORT_KW@75..83 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@83..105 + 0: TYPE_KW@83..88 "type" [] [Whitespace(" ")] + 1: L_CURLY@88..90 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@90..92 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@90..92 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@90..92 + 0: IDENT@90..92 "d" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@92..94 "}" [] [Whitespace(" ")] + 4: FROM_KW@94..99 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@99..104 + 0: JS_STRING_LITERAL@99..104 "\"./d\"" [] [] + 6: SEMICOLON@104..105 ";" [] [] + 5: JS_BOGUS_STATEMENT@105..135 + 0: JS_DECORATOR_LIST@105..105 + 1: EXPORT_KW@105..113 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@113..135 + 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@115..122 + 0: JS_BOGUS@115..122 + 0: TYPE_KW@115..120 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@120..122 + 0: IDENT@120..122 "e" [] [Whitespace(" ")] + 2: R_CURLY@122..124 "}" [] [Whitespace(" ")] + 3: FROM_KW@124..129 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@129..134 + 0: JS_STRING_LITERAL@129..134 "\"./e\"" [] [] + 5: SEMICOLON@134..135 ";" [] [] + 6: JS_BOGUS_STATEMENT@135..171 + 0: JS_DECORATOR_LIST@135..135 + 1: EXPORT_KW@135..143 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS@143..171 + 0: L_CURLY@143..145 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@145..158 + 0: JS_BOGUS@145..158 + 0: TYPE_KW@145..150 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@150..152 + 0: IDENT@150..152 "e" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@152..158 + 0: AS_KW@152..155 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@155..158 + 0: IDENT@155..158 "ee" [] [Whitespace(" ")] + 2: R_CURLY@158..160 "}" [] [Whitespace(" ")] + 3: FROM_KW@160..165 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@165..170 + 0: JS_STRING_LITERAL@165..170 "\"./e\"" [] [] + 5: SEMICOLON@170..171 ";" [] [] + 4: EOF@171..172 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_export_syntax_in_js.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 1 │ let a, b, c; + > 2 │ export type { a }; + │ ^^^^^^^^^^^ + 3 │ export { type b }; + 4 │ export { type c as cc }; + + i TypeScript only syntax + +ts_export_syntax_in_js.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × export { type ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 1 │ let a, b, c; + 2 │ export type { a }; + > 3 │ export { type b }; + │ ^^^^^^ + 4 │ export { type c as cc }; + 5 │ export type { d } from "./d"; + + i TypeScript only syntax + +ts_export_syntax_in_js.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × export { type ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 2 │ export type { a }; + 3 │ export { type b }; + > 4 │ export { type c as cc }; + │ ^^^^^^^^^^^^ + 5 │ export type { d } from "./d"; + 6 │ export { type e } from "./e"; + + i TypeScript only syntax + +ts_export_syntax_in_js.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 3 │ export { type b }; + 4 │ export { type c as cc }; + > 5 │ export type { d } from "./d"; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 6 │ export { type e } from "./e"; + 7 │ export { type e as ee } from "./e"; + + i TypeScript only syntax + +ts_export_syntax_in_js.js:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × export { type ident }'' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 4 │ export { type c as cc }; + 5 │ export type { d } from "./d"; + > 6 │ export { type e } from "./e"; + │ ^^^^^^ + 7 │ export { type e as ee } from "./e"; + 8 │ + + i TypeScript only syntax + +ts_export_syntax_in_js.js:7:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × export { type ident }'' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + 5 │ export type { d } from "./d"; + 6 │ export { type e } from "./e"; + > 7 │ export { type e as ee } from "./e"; + │ ^^^^^^^^^^^^ + 8 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts.snap new file mode 100644 index 000000000000..33a4d086c4bb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export type + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: missing (required), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..11 "type" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_EXPORT@0..7 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: (empty) + 1: JS_EXPRESSION_STATEMENT@7..11 + 0: JS_IDENTIFIER_EXPRESSION@7..11 + 0: JS_REFERENCE_IDENTIFIER@7..11 + 0: IDENT@7..11 "type" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_export_type.ts:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found 'type'. + + > 1 │ export type + │ ^^^^ + 2 │ + + i Expected a class, a function, or a variable declaration here. + + > 1 │ export type + │ ^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap new file mode 100644 index 000000000000..b085a281534c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap @@ -0,0 +1,111 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A {} +interface B extends A, {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@12..13 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@13..14 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@25..27 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: TsExtendsClause { + extends_token: EXTENDS_KW@27..35 "extends" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@36..38 "," [] [Whitespace(" ")], + missing element, + ], + }, + l_curly_token: L_CURLY@38..39 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: TS_INTERFACE_DECLARATION@0..14 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@12..13 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@13..13 + 6: R_CURLY@13..14 "}" [] [] + 1: TS_INTERFACE_DECLARATION@14..40 + 0: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "B" [] [Whitespace(" ")] + 2: (empty) + 3: TS_EXTENDS_CLAUSE@27..38 + 0: EXTENDS_KW@27..35 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@35..38 + 0: TS_REFERENCE_TYPE@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "A" [] [] + 1: (empty) + 1: COMMA@36..38 "," [] [Whitespace(" ")] + 2: (empty) + 4: L_CURLY@38..39 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@39..39 + 6: R_CURLY@39..40 "}" [] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_extends_trailing_comma.ts:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Trailing comma not allowed. + + 1 │ interface A {} + > 2 │ interface B extends A, {} + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap new file mode 100644 index 000000000000..3a9c029444b9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(@dec x) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@11..12 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..16 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@16..17 "x" [] [], + }, + ], + }, + ], + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@19..20 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_FUNCTION_DECLARATION@0..21 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..19 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..17 + 0: JS_BOGUS_PARAMETER@11..17 + 0: JS_BOGUS@11..16 + 0: JS_DECORATOR@11..16 + 0: AT@11..12 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@12..16 + 0: JS_REFERENCE_IDENTIFIER@12..16 + 0: IDENT@12..16 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@16..17 + 0: IDENT@16..17 "x" [] [] + 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@19..21 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_DIRECTIVE_LIST@20..20 + 2: JS_STATEMENT_LIST@20..20 + 3: R_CURLY@20..21 "}" [] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_formal_parameter_decorator.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + > 1 │ function a(@dec x) {} + │ ^^^^ + 2 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap new file mode 100644 index 000000000000..efefd5577e6c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap @@ -0,0 +1,228 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + constructor(@dec x) {} + method(@dec x) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@26..27 "(" [] [], + parameters: JsConstructorParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@27..28 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..32 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@32..33 "x" [] [], + }, + ], + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@35..36 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@47..48 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@48..49 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..53 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsIdentifierBinding { + name_token: IDENT@53..54 "x" [] [], + }, + ], + }, + ], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@56..57 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@58..60 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@60..61 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..61 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..60 + 0: JS_CLASS_DECLARATION@0..60 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..58 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@11..37 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@11..11 + 1: JS_LITERAL_MEMBER_NAME@11..26 + 0: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@26..35 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@27..33 + 0: JS_BOGUS_PARAMETER@27..33 + 0: JS_BOGUS@27..32 + 0: JS_DECORATOR@27..32 + 0: AT@27..28 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@28..32 + 0: JS_REFERENCE_IDENTIFIER@28..32 + 0: IDENT@28..32 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "x" [] [] + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@35..37 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_DIRECTIVE_LIST@36..36 + 2: JS_STATEMENT_LIST@36..36 + 3: R_CURLY@36..37 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@37..58 + 0: JS_METHOD_MODIFIER_LIST@37..37 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@37..47 + 0: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@47..56 + 0: L_PAREN@47..48 "(" [] [] + 1: JS_PARAMETER_LIST@48..54 + 0: JS_BOGUS_PARAMETER@48..54 + 0: JS_BOGUS@48..53 + 0: JS_DECORATOR@48..53 + 0: AT@48..49 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@49..53 + 0: JS_REFERENCE_IDENTIFIER@49..53 + 0: IDENT@49..53 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@53..54 + 0: IDENT@53..54 "x" [] [] + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@56..58 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..57 + 3: R_CURLY@57..58 "}" [] [] + 9: R_CURLY@58..60 "}" [Newline("\n")] [] + 4: EOF@60..61 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_formal_parameter_decorator_option.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class Foo { + > 2 │ constructor(@dec x) {} + │ ^^^^ + 3 │ method(@dec x) {} + 4 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +ts_formal_parameter_decorator_option.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ class Foo { + 2 │ constructor(@dec x) {} + > 3 │ method(@dec x) {} + │ ^^^^ + 4 │ } + 5 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + + i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts.snap new file mode 100644 index 000000000000..7a684b4212c6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts.snap @@ -0,0 +1,302 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(x?: string = "test") {} +function b(...rest: string[] = "init") {} +function c(...rest, b: string) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@11..12 "x" [] [], + }, + question_mark_token: QUESTION@12..13 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@15..22 "string" [] [Whitespace(" ")], + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@24..30 "\"test\"" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@32..33 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@44..45 "b" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@45..46 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + DOT3@46..49 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@49..53 "rest" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@53..55 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsStringType { + string_token: STRING_KW@55..61 "string" [] [], + }, + l_brack_token: L_BRACK@61..62 "[" [] [], + r_brack_token: R_BRACK@62..64 "]" [] [Whitespace(" ")], + }, + }, + JsInitializerClause { + eq_token: EQ@64..66 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@66..72 "\"init\"" [] [], + }, + }, + ], + }, + ], + r_paren_token: R_PAREN@72..74 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@74..75 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@75..76 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@76..86 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@86..87 "c" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@87..88 "(" [] [], + items: JsParameterList [ + JsBogusParameter { + items: [ + JsDecoratorList [], + DOT3@88..91 "..." [] [], + JsIdentifierBinding { + name_token: IDENT@91..95 "rest" [] [], + }, + ], + }, + COMMA@95..97 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@97..98 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@98..100 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@100..106 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@106..108 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@108..109 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@109..110 "}" [] [], + }, + }, + ], + eof_token: EOF@110..111 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..111 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..110 + 0: JS_FUNCTION_DECLARATION@0..34 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..32 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..30 + 0: JS_FORMAL_PARAMETER@11..30 + 0: JS_DECORATOR_LIST@11..11 + 1: JS_IDENTIFIER_BINDING@11..12 + 0: IDENT@11..12 "x" [] [] + 2: QUESTION@12..13 "?" [] [] + 3: TS_TYPE_ANNOTATION@13..22 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@15..22 + 0: STRING_KW@15..22 "string" [] [Whitespace(" ")] + 4: JS_INITIALIZER_CLAUSE@22..30 + 0: EQ@22..24 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@24..30 + 0: JS_STRING_LITERAL@24..30 "\"test\"" [] [] + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@32..34 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_DIRECTIVE_LIST@33..33 + 2: JS_STATEMENT_LIST@33..33 + 3: R_CURLY@33..34 "}" [] [] + 1: JS_FUNCTION_DECLARATION@34..76 + 0: (empty) + 1: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@44..45 + 0: IDENT@44..45 "b" [] [] + 4: (empty) + 5: JS_PARAMETERS@45..74 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_PARAMETER_LIST@46..72 + 0: JS_BOGUS_PARAMETER@46..72 + 0: JS_DECORATOR_LIST@46..46 + 1: DOT3@46..49 "..." [] [] + 2: JS_IDENTIFIER_BINDING@49..53 + 0: IDENT@49..53 "rest" [] [] + 3: TS_TYPE_ANNOTATION@53..64 + 0: COLON@53..55 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@55..64 + 0: TS_STRING_TYPE@55..61 + 0: STRING_KW@55..61 "string" [] [] + 1: L_BRACK@61..62 "[" [] [] + 2: R_BRACK@62..64 "]" [] [Whitespace(" ")] + 4: JS_INITIALIZER_CLAUSE@64..72 + 0: EQ@64..66 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@66..72 + 0: JS_STRING_LITERAL@66..72 "\"init\"" [] [] + 2: R_PAREN@72..74 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@74..76 + 0: L_CURLY@74..75 "{" [] [] + 1: JS_DIRECTIVE_LIST@75..75 + 2: JS_STATEMENT_LIST@75..75 + 3: R_CURLY@75..76 "}" [] [] + 2: JS_FUNCTION_DECLARATION@76..110 + 0: (empty) + 1: FUNCTION_KW@76..86 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@86..87 + 0: IDENT@86..87 "c" [] [] + 4: (empty) + 5: JS_PARAMETERS@87..108 + 0: L_PAREN@87..88 "(" [] [] + 1: JS_PARAMETER_LIST@88..106 + 0: JS_BOGUS_PARAMETER@88..95 + 0: JS_DECORATOR_LIST@88..88 + 1: DOT3@88..91 "..." [] [] + 2: JS_IDENTIFIER_BINDING@91..95 + 0: IDENT@91..95 "rest" [] [] + 1: COMMA@95..97 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@97..106 + 0: JS_DECORATOR_LIST@97..97 + 1: JS_IDENTIFIER_BINDING@97..98 + 0: IDENT@97..98 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@98..106 + 0: COLON@98..100 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@100..106 + 0: STRING_KW@100..106 "string" [] [] + 4: (empty) + 2: R_PAREN@106..108 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@108..110 + 0: L_CURLY@108..109 "{" [] [] + 1: JS_DIRECTIVE_LIST@109..109 + 2: JS_STATEMENT_LIST@109..109 + 3: R_CURLY@109..110 "}" [] [] + 4: EOF@110..111 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_formal_parameter_error.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parameter cannot have question mark and initializer + + > 1 │ function a(x?: string = "test") {} + │ ^^^^^^^^ + 2 │ function b(...rest: string[] = "init") {} + 3 │ function c(...rest, b: string) {} + +ts_formal_parameter_error.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest elements may not have default initializers + + 1 │ function a(x?: string = "test") {} + > 2 │ function b(...rest: string[] = "init") {} + │ ^^^^^^^^ + 3 │ function c(...rest, b: string) {} + 4 │ + +ts_formal_parameter_error.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × rest elements may not have trailing commas + + 1 │ function a(x?: string = "test") {} + 2 │ function b(...rest: string[] = "init") {} + > 3 │ function c(...rest, b: string) {} + │ ^^^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts.snap new file mode 100644 index 000000000000..7cbf0d0f0a25 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts.snap @@ -0,0 +1,164 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function* test(a: string); +function* test(a: string) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + FUNCTION_KW@0..8 "function" [] [], + STAR@8..10 "*" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@10..14 "test" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@14..15 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@18..24 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@24..25 ")" [] [], + }, + SEMICOLON@25..26 ";" [] [], + ], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@26..35 "function" [Newline("\n")] [], + star_token: STAR@35..37 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@37..41 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@41..42 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@42..43 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@43..45 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@45..51 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@53..54 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + }, + ], + eof_token: EOF@55..56 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..56 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..55 + 0: JS_BOGUS_STATEMENT@0..26 + 0: FUNCTION_KW@0..8 "function" [] [] + 1: STAR@8..10 "*" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@10..14 + 0: IDENT@10..14 "test" [] [] + 3: JS_PARAMETERS@14..25 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_PARAMETER_LIST@15..24 + 0: JS_FORMAL_PARAMETER@15..24 + 0: JS_DECORATOR_LIST@15..15 + 1: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@16..24 + 0: COLON@16..18 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@18..24 + 0: STRING_KW@18..24 "string" [] [] + 4: (empty) + 2: R_PAREN@24..25 ")" [] [] + 4: SEMICOLON@25..26 ";" [] [] + 1: JS_FUNCTION_DECLARATION@26..55 + 0: (empty) + 1: FUNCTION_KW@26..35 "function" [Newline("\n")] [] + 2: STAR@35..37 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@37..41 + 0: IDENT@37..41 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@41..53 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_PARAMETER_LIST@42..51 + 0: JS_FORMAL_PARAMETER@42..51 + 0: JS_DECORATOR_LIST@42..42 + 1: JS_IDENTIFIER_BINDING@42..43 + 0: IDENT@42..43 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@43..51 + 0: COLON@43..45 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@45..51 + 0: STRING_KW@45..51 "string" [] [] + 4: (empty) + 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@53..55 + 0: L_CURLY@53..54 "{" [] [] + 1: JS_DIRECTIVE_LIST@54..54 + 2: JS_STATEMENT_LIST@54..54 + 3: R_CURLY@54..55 "}" [] [] + 4: EOF@55..56 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_function_overload_generator.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An overload signature cannot be declared as a generator. + + > 1 │ function* test(a: string); + │ ^ + 2 │ function* test(a: string) {} + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_function_type_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts.snap new file mode 100644 index 000000000000..83720bc0b869 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts.snap @@ -0,0 +1,160 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type G = <>(a: A, b: B) => string + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "G" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@9..10 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@11..12 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@12..13 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@16..18 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@18..19 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@19..21 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@21..22 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@27..33 "string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@33..34 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..34 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..33 + 0: TS_TYPE_ALIAS_DECLARATION@0..33 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "G" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@9..33 + 0: TS_TYPE_PARAMETERS@9..11 + 0: L_ANGLE@9..10 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@10..10 + 2: R_ANGLE@10..11 ">" [] [] + 1: JS_PARAMETERS@11..24 + 0: L_PAREN@11..12 "(" [] [] + 1: JS_PARAMETER_LIST@12..22 + 0: JS_FORMAL_PARAMETER@12..16 + 0: JS_DECORATOR_LIST@12..12 + 1: JS_IDENTIFIER_BINDING@12..13 + 0: IDENT@12..13 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@13..16 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@16..18 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@18..22 + 0: JS_DECORATOR_LIST@18..18 + 1: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@19..22 + 0: COLON@19..21 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@21..22 + 0: JS_REFERENCE_IDENTIFIER@21..22 + 0: IDENT@21..22 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@24..27 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@27..33 + 0: STRING_KW@27..33 "string" [] [] + 5: (empty) + 4: EOF@33..34 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_function_type_err.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + > 1 │ type G = <>(a: A, b: B) => string + │ ^ + 2 │ + + i Expected a type parameter here. + + > 1 │ type G = <>(a: A, b: B) => string + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap new file mode 100644 index 000000000000..b12f0b29f8ca --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap @@ -0,0 +1,242 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + get a(): A {} + set a(value: A) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@18..19 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@19..20 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@20..21 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@21..22 ">" [] [], + }, + L_PAREN@22..23 "(" [] [], + R_PAREN@23..24 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@26..28 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [], + SET_KW@30..36 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@36..37 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@37..38 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@38..39 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@39..40 ">" [] [], + }, + L_PAREN@40..41 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@41..46 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@46..48 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@48..49 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + R_PAREN@49..51 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@51..52 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@55..56 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..56 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..55 + 0: JS_CLASS_DECLARATION@0..55 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..53 + 0: JS_BOGUS_MEMBER@12..30 + 0: JS_METHOD_MODIFIER_LIST@12..12 + 1: GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@18..19 + 0: IDENT@18..19 "a" [] [] + 3: TS_TYPE_PARAMETERS@19..22 + 0: L_ANGLE@19..20 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@20..21 + 0: TS_TYPE_PARAMETER@20..21 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@20..20 + 1: TS_TYPE_PARAMETER_NAME@20..21 + 0: IDENT@20..21 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@21..22 ">" [] [] + 4: L_PAREN@22..23 "(" [] [] + 5: R_PAREN@23..24 ")" [] [] + 6: TS_TYPE_ANNOTATION@24..28 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@26..28 + 0: JS_REFERENCE_IDENTIFIER@26..28 + 0: IDENT@26..28 "A" [] [Whitespace(" ")] + 1: (empty) + 7: JS_FUNCTION_BODY@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..30 "}" [] [] + 1: JS_BOGUS_MEMBER@30..53 + 0: JS_METHOD_MODIFIER_LIST@30..30 + 1: SET_KW@30..36 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@36..37 + 0: IDENT@36..37 "a" [] [] + 3: TS_TYPE_PARAMETERS@37..40 + 0: L_ANGLE@37..38 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@38..39 + 0: TS_TYPE_PARAMETER@38..39 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@38..38 + 1: TS_TYPE_PARAMETER_NAME@38..39 + 0: IDENT@38..39 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@39..40 ">" [] [] + 4: L_PAREN@40..41 "(" [] [] + 5: JS_FORMAL_PARAMETER@41..49 + 0: JS_DECORATOR_LIST@41..41 + 1: JS_IDENTIFIER_BINDING@41..46 + 0: IDENT@41..46 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@46..49 + 0: COLON@46..48 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@48..49 + 0: JS_REFERENCE_IDENTIFIER@48..49 + 0: IDENT@48..49 "A" [] [] + 1: (empty) + 4: (empty) + 6: R_PAREN@49..51 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@51..53 + 0: L_CURLY@51..52 "{" [] [] + 1: JS_DIRECTIVE_LIST@52..52 + 2: JS_STATEMENT_LIST@52..52 + 3: R_CURLY@52..53 "}" [] [] + 9: R_CURLY@53..55 "}" [Newline("\n")] [] + 4: EOF@55..56 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_getter_setter_type_parameters.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + 1 │ class Test { + > 2 │ get a(): A {} + │ ^^^ + 3 │ set a(value: A) {} + 4 │ } + +ts_getter_setter_type_parameters.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + 1 │ class Test { + 2 │ get a(): A {} + > 3 │ set a(value: A) {} + │ ^^^ + 4 │ } + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap new file mode 100644 index 000000000000..39bbeb333e97 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap @@ -0,0 +1,250 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + get a<>(): A {} + set a<>(value: A) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@18..19 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@19..20 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@20..21 ">" [] [], + }, + L_PAREN@21..22 "(" [] [], + R_PAREN@22..23 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@25..27 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@27..28 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsMethodModifierList [], + SET_KW@29..35 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@35..36 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@36..37 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@37..38 ">" [] [], + }, + L_PAREN@38..39 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@39..44 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@44..46 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@46..47 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + R_PAREN@47..49 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@49..50 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@53..54 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..54 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..53 + 0: JS_CLASS_DECLARATION@0..53 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..51 + 0: JS_BOGUS_MEMBER@12..29 + 0: JS_METHOD_MODIFIER_LIST@12..12 + 1: GET_KW@12..18 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@18..19 + 0: IDENT@18..19 "a" [] [] + 3: TS_TYPE_PARAMETERS@19..21 + 0: L_ANGLE@19..20 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@20..20 + 2: R_ANGLE@20..21 ">" [] [] + 4: L_PAREN@21..22 "(" [] [] + 5: R_PAREN@22..23 ")" [] [] + 6: TS_TYPE_ANNOTATION@23..27 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@25..27 + 0: JS_REFERENCE_IDENTIFIER@25..27 + 0: IDENT@25..27 "A" [] [Whitespace(" ")] + 1: (empty) + 7: JS_FUNCTION_BODY@27..29 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..28 + 3: R_CURLY@28..29 "}" [] [] + 1: JS_BOGUS_MEMBER@29..51 + 0: JS_METHOD_MODIFIER_LIST@29..29 + 1: SET_KW@29..35 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@35..36 + 0: IDENT@35..36 "a" [] [] + 3: TS_TYPE_PARAMETERS@36..38 + 0: L_ANGLE@36..37 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@37..37 + 2: R_ANGLE@37..38 ">" [] [] + 4: L_PAREN@38..39 "(" [] [] + 5: JS_FORMAL_PARAMETER@39..47 + 0: JS_DECORATOR_LIST@39..39 + 1: JS_IDENTIFIER_BINDING@39..44 + 0: IDENT@39..44 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@44..47 + 0: COLON@44..46 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@46..47 + 0: JS_REFERENCE_IDENTIFIER@46..47 + 0: IDENT@46..47 "A" [] [] + 1: (empty) + 4: (empty) + 6: R_PAREN@47..49 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@49..51 + 0: L_CURLY@49..50 "{" [] [] + 1: JS_DIRECTIVE_LIST@50..50 + 2: JS_STATEMENT_LIST@50..50 + 3: R_CURLY@50..51 "}" [] [] + 9: R_CURLY@51..53 "}" [Newline("\n")] [] + 4: EOF@53..54 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_getter_setter_type_parameters_errors.ts:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ class Test { + > 2 │ get a<>(): A {} + │ ^ + 3 │ set a<>(value: A) {} + 4 │ } + + i Expected a type parameter here. + + 1 │ class Test { + > 2 │ get a<>(): A {} + │ ^ + 3 │ set a<>(value: A) {} + 4 │ } + +ts_getter_setter_type_parameters_errors.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + 1 │ class Test { + > 2 │ get a<>(): A {} + │ ^^ + 3 │ set a<>(value: A) {} + 4 │ } + +ts_getter_setter_type_parameters_errors.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ class Test { + 2 │ get a<>(): A {} + > 3 │ set a<>(value: A) {} + │ ^ + 4 │ } + 5 │ + + i Expected a type parameter here. + + 1 │ class Test { + 2 │ get a<>(): A {} + > 3 │ set a<>(value: A) {} + │ ^ + 4 │ } + 5 │ + +ts_getter_setter_type_parameters_errors.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + 1 │ class Test { + 2 │ get a<>(): A {} + > 3 │ set a<>(value: A) {} + │ ^^ + 4 │ } + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap new file mode 100644 index 000000000000..9e63969625c9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap @@ -0,0 +1,129 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + L_BRACK@32..33 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@33..34 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@36..42 "number" [] [], + }, + }, + }, + R_BRACK@42..43 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@43..45 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@45..51 "string" [] [], + }, + }, + SEMICOLON@51..52 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_CLASS_DECLARATION@0..54 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..52 + 0: JS_BOGUS_MEMBER@18..52 + 0: JS_BOGUS@18..32 + 0: TS_ABSTRACT_MODIFIER@18..32 + 0: ABSTRACT_KW@18..32 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@32..33 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@33..42 + 0: JS_IDENTIFIER_BINDING@33..34 + 0: IDENT@33..34 "a" [] [] + 1: TS_TYPE_ANNOTATION@34..42 + 0: COLON@34..36 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@36..42 + 0: NUMBER_KW@36..42 "number" [] [] + 3: R_BRACK@42..43 "]" [] [] + 4: TS_TYPE_ANNOTATION@43..51 + 0: COLON@43..45 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@45..51 + 0: STRING_KW@45..51 "string" [] [] + 5: SEMICOLON@51..52 ";" [] [] + 9: R_CURLY@52..54 "}" [Newline("\n")] [] + 4: EOF@54..55 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_index_signature_class_member_cannot_be_abstract.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' modifier cannot appear on an index signature. + + 1 │ abstract class A { + > 2 │ abstract [a: number]: string; + │ ^^^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap new file mode 100644 index 000000000000..e7de0f6185bf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap @@ -0,0 +1,129 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + accessor [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@18..32 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + L_BRACK@32..33 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@33..34 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@36..42 "number" [] [], + }, + }, + }, + R_BRACK@42..43 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@43..45 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@45..51 "string" [] [], + }, + }, + SEMICOLON@51..52 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_CLASS_DECLARATION@0..54 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..52 + 0: JS_BOGUS_MEMBER@18..52 + 0: JS_BOGUS@18..32 + 0: JS_ACCESSOR_MODIFIER@18..32 + 0: ACCESSOR_KW@18..32 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@32..33 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@33..42 + 0: JS_IDENTIFIER_BINDING@33..34 + 0: IDENT@33..34 "a" [] [] + 1: TS_TYPE_ANNOTATION@34..42 + 0: COLON@34..36 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@36..42 + 0: NUMBER_KW@36..42 "number" [] [] + 3: R_BRACK@42..43 "]" [] [] + 4: TS_TYPE_ANNOTATION@43..51 + 0: COLON@43..45 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@45..51 + 0: STRING_KW@45..51 "string" [] [] + 5: SEMICOLON@51..52 ";" [] [] + 9: R_CURLY@52..54 "}" [Newline("\n")] [] + 4: EOF@54..55 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_index_signature_class_member_cannot_be_accessor.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'accessor' modifier cannot appear on an index signature. + + 1 │ abstract class A { + > 2 │ accessor [a: number]: string; + │ ^^^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap new file mode 100644 index 000000000000..27da0f717b21 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap @@ -0,0 +1,309 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + public [a: number]: string; +} +class B { + private [a: number]: string; +} +class C { + protected [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@9..22 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + L_BRACK@22..23 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@23..24 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@26..32 "number" [] [], + }, + }, + }, + R_BRACK@32..33 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@33..35 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@35..41 "string" [] [], + }, + }, + SEMICOLON@41..42 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@42..44 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@51..53 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@53..54 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@54..68 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + L_BRACK@68..69 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@69..70 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@70..72 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@72..78 "number" [] [], + }, + }, + }, + R_BRACK@78..79 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@79..81 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@81..87 "string" [] [], + }, + }, + SEMICOLON@87..88 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@88..90 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@90..97 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@97..99 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@99..100 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@100..116 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + L_BRACK@116..117 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@117..118 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@118..120 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@120..126 "number" [] [], + }, + }, + }, + R_BRACK@126..127 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@127..129 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@129..135 "string" [] [], + }, + }, + SEMICOLON@135..136 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@136..138 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@138..139 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..139 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..138 + 0: JS_CLASS_DECLARATION@0..44 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..42 + 0: JS_BOGUS_MEMBER@9..42 + 0: JS_BOGUS@9..22 + 0: TS_ACCESSIBILITY_MODIFIER@9..22 + 0: PUBLIC_KW@9..22 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@22..23 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@23..32 + 0: JS_IDENTIFIER_BINDING@23..24 + 0: IDENT@23..24 "a" [] [] + 1: TS_TYPE_ANNOTATION@24..32 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@26..32 + 0: NUMBER_KW@26..32 "number" [] [] + 3: R_BRACK@32..33 "]" [] [] + 4: TS_TYPE_ANNOTATION@33..41 + 0: COLON@33..35 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@35..41 + 0: STRING_KW@35..41 "string" [] [] + 5: SEMICOLON@41..42 ";" [] [] + 9: R_CURLY@42..44 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@44..90 + 0: JS_DECORATOR_LIST@44..44 + 1: (empty) + 2: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@51..53 + 0: IDENT@51..53 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@53..54 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@54..88 + 0: JS_BOGUS_MEMBER@54..88 + 0: JS_BOGUS@54..68 + 0: TS_ACCESSIBILITY_MODIFIER@54..68 + 0: PRIVATE_KW@54..68 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@68..69 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@69..78 + 0: JS_IDENTIFIER_BINDING@69..70 + 0: IDENT@69..70 "a" [] [] + 1: TS_TYPE_ANNOTATION@70..78 + 0: COLON@70..72 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@72..78 + 0: NUMBER_KW@72..78 "number" [] [] + 3: R_BRACK@78..79 "]" [] [] + 4: TS_TYPE_ANNOTATION@79..87 + 0: COLON@79..81 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@81..87 + 0: STRING_KW@81..87 "string" [] [] + 5: SEMICOLON@87..88 ";" [] [] + 9: R_CURLY@88..90 "}" [Newline("\n")] [] + 2: JS_CLASS_DECLARATION@90..138 + 0: JS_DECORATOR_LIST@90..90 + 1: (empty) + 2: CLASS_KW@90..97 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@97..99 + 0: IDENT@97..99 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@99..100 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@100..136 + 0: JS_BOGUS_MEMBER@100..136 + 0: JS_BOGUS@100..116 + 0: TS_ACCESSIBILITY_MODIFIER@100..116 + 0: PROTECTED_KW@100..116 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@116..117 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@117..126 + 0: JS_IDENTIFIER_BINDING@117..118 + 0: IDENT@117..118 "a" [] [] + 1: TS_TYPE_ANNOTATION@118..126 + 0: COLON@118..120 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@120..126 + 0: NUMBER_KW@120..126 "number" [] [] + 3: R_BRACK@126..127 "]" [] [] + 4: TS_TYPE_ANNOTATION@127..135 + 0: COLON@127..129 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@129..135 + 0: STRING_KW@129..135 "string" [] [] + 5: SEMICOLON@135..136 ";" [] [] + 9: R_CURLY@136..138 "}" [Newline("\n")] [] + 4: EOF@138..139 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━ + + × 'public' modifier cannot appear on an index signature. + + 1 │ class A { + > 2 │ public [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ class B { + +ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━ + + × 'private' modifier cannot appear on an index signature. + + 3 │ } + 4 │ class B { + > 5 │ private [a: number]: string; + │ ^^^^^^^ + 6 │ } + 7 │ class C { + +ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━ + + × 'protected' modifier cannot appear on an index signature. + + 6 │ } + 7 │ class C { + > 8 │ protected [a: number]: string; + │ ^^^^^^^^^ + 9 │ } + 10 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap new file mode 100644 index 000000000000..0046fa04d94d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap @@ -0,0 +1,148 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + readonly static [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsIndexSignatureModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@23..30 "static" [] [Whitespace(" ")], + }, + ], + L_BRACK@30..31 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@31..32 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@34..40 "number" [] [], + }, + }, + }, + R_BRACK@40..41 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@41..43 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@43..49 "string" [] [], + }, + }, + SEMICOLON@49..50 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@52..53 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..53 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..52 + 0: JS_CLASS_DECLARATION@0..52 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..50 + 0: JS_BOGUS_MEMBER@9..50 + 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@9..30 + 0: TS_READONLY_MODIFIER@9..23 + 0: READONLY_KW@9..23 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@23..30 + 0: STATIC_KW@23..30 "static" [] [Whitespace(" ")] + 1: L_BRACK@30..31 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@31..40 + 0: JS_IDENTIFIER_BINDING@31..32 + 0: IDENT@31..32 "a" [] [] + 1: TS_TYPE_ANNOTATION@32..40 + 0: COLON@32..34 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@34..40 + 0: NUMBER_KW@34..40 "number" [] [] + 3: R_BRACK@40..41 "]" [] [] + 4: TS_TYPE_ANNOTATION@41..49 + 0: COLON@41..43 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@43..49 + 0: STRING_KW@43..49 "string" [] [] + 5: SEMICOLON@49..50 ";" [] [] + 9: R_CURLY@50..52 "}" [Newline("\n")] [] + 4: EOF@52..53 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_index_signature_class_member_static_readonly_precedence.ts:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'static' must precede 'readonly' + + 1 │ class A { + > 2 │ readonly static [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ + + i move this modifier + + 1 │ class A { + > 2 │ readonly static [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ + + i before this modifier + + 1 │ class A { + > 2 │ readonly static [a: number]: string; + │ ^^^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap new file mode 100644 index 000000000000..92228c7bf475 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap @@ -0,0 +1,261 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + static [index: string]: string +} +interface B { + public [index: string]: string +} +interface C { + private [index: string]: string +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + L_CURLY@12..13 "{" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + STATIC_KW@13..25 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + L_BRACK@25..26 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@26..31 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@33..39 "string" [] [], + }, + }, + }, + R_BRACK@39..40 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@40..42 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@42..48 "string" [] [], + }, + }, + ], + }, + ], + }, + R_CURLY@48..50 "}" [Newline("\n")] [], + ], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@50..61 "interface" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@61..63 "B" [] [Whitespace(" ")], + }, + L_CURLY@63..64 "{" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + PUBLIC_KW@64..76 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + L_BRACK@76..77 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@77..82 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@82..84 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@84..90 "string" [] [], + }, + }, + }, + R_BRACK@90..91 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@91..93 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@93..99 "string" [] [], + }, + }, + ], + }, + ], + }, + R_CURLY@99..101 "}" [Newline("\n")] [], + ], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@101..112 "interface" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@112..114 "C" [] [Whitespace(" ")], + }, + L_CURLY@114..115 "{" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + L_BRACK@128..129 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@129..134 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@134..136 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@136..142 "string" [] [], + }, + }, + }, + R_BRACK@142..143 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@143..145 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@145..151 "string" [] [], + }, + }, + ], + }, + ], + }, + R_CURLY@151..153 "}" [Newline("\n")] [], + ], + }, + ], + eof_token: EOF@153..154 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..154 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..153 + 0: JS_BOGUS_STATEMENT@0..50 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: L_CURLY@12..13 "{" [] [] + 3: JS_BOGUS@13..48 + 0: JS_BOGUS@13..48 + 0: STATIC_KW@13..25 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@25..26 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@26..39 + 0: JS_IDENTIFIER_BINDING@26..31 + 0: IDENT@26..31 "index" [] [] + 1: TS_TYPE_ANNOTATION@31..39 + 0: COLON@31..33 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@33..39 + 0: STRING_KW@33..39 "string" [] [] + 3: R_BRACK@39..40 "]" [] [] + 4: TS_TYPE_ANNOTATION@40..48 + 0: COLON@40..42 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@42..48 + 0: STRING_KW@42..48 "string" [] [] + 4: R_CURLY@48..50 "}" [Newline("\n")] [] + 1: JS_BOGUS_STATEMENT@50..101 + 0: INTERFACE_KW@50..61 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@61..63 + 0: IDENT@61..63 "B" [] [Whitespace(" ")] + 2: L_CURLY@63..64 "{" [] [] + 3: JS_BOGUS@64..99 + 0: JS_BOGUS@64..99 + 0: PUBLIC_KW@64..76 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@76..77 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@77..90 + 0: JS_IDENTIFIER_BINDING@77..82 + 0: IDENT@77..82 "index" [] [] + 1: TS_TYPE_ANNOTATION@82..90 + 0: COLON@82..84 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@84..90 + 0: STRING_KW@84..90 "string" [] [] + 3: R_BRACK@90..91 "]" [] [] + 4: TS_TYPE_ANNOTATION@91..99 + 0: COLON@91..93 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@93..99 + 0: STRING_KW@93..99 "string" [] [] + 4: R_CURLY@99..101 "}" [Newline("\n")] [] + 2: JS_BOGUS_STATEMENT@101..153 + 0: INTERFACE_KW@101..112 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@112..114 + 0: IDENT@112..114 "C" [] [Whitespace(" ")] + 2: L_CURLY@114..115 "{" [] [] + 3: JS_BOGUS@115..151 + 0: JS_BOGUS@115..151 + 0: PRIVATE_KW@115..128 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@128..129 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@129..142 + 0: JS_IDENTIFIER_BINDING@129..134 + 0: IDENT@129..134 "index" [] [] + 1: TS_TYPE_ANNOTATION@134..142 + 0: COLON@134..136 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@136..142 + 0: STRING_KW@136..142 "string" [] [] + 3: R_BRACK@142..143 "]" [] [] + 4: TS_TYPE_ANNOTATION@143..151 + 0: COLON@143..145 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@145..151 + 0: STRING_KW@145..151 "string" [] [] + 4: R_CURLY@151..153 "}" [Newline("\n")] [] + 4: EOF@153..154 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_index_signature_interface_member_cannot_be_static.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × index signature members cannot be static + + 1 │ interface A { + > 2 │ static [index: string]: string + │ ^^^^^^ + 3 │ } + 4 │ interface B { + +ts_index_signature_interface_member_cannot_be_static.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × index signature members cannot be public + + 3 │ } + 4 │ interface B { + > 5 │ public [index: string]: string + │ ^^^^^^ + 6 │ } + 7 │ interface C { + +ts_index_signature_interface_member_cannot_be_static.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × index signature members cannot be private + + 6 │ } + 7 │ interface C { + > 8 │ private [index: string]: string + │ ^^^^^^^ + 9 │ } + 10 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap new file mode 100644 index 000000000000..87a51cb6e718 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap @@ -0,0 +1,267 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + public [a: number]: string; +} +interface B { + private [a: number]: string; +} +interface C { + protected [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + L_CURLY@12..13 "{" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + PUBLIC_KW@13..26 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + L_BRACK@26..27 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@27..28 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@30..36 "number" [] [], + }, + }, + }, + R_BRACK@36..37 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@37..39 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@39..45 "string" [] [], + }, + }, + SEMICOLON@45..46 ";" [] [], + ], + }, + ], + }, + R_CURLY@46..48 "}" [Newline("\n")] [], + ], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@48..59 "interface" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@59..61 "B" [] [Whitespace(" ")], + }, + L_CURLY@61..62 "{" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + PRIVATE_KW@62..76 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + L_BRACK@76..77 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@77..78 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@78..80 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@80..86 "number" [] [], + }, + }, + }, + R_BRACK@86..87 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@87..89 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@89..95 "string" [] [], + }, + }, + SEMICOLON@95..96 ";" [] [], + ], + }, + ], + }, + R_CURLY@96..98 "}" [Newline("\n")] [], + ], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@98..109 "interface" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@109..111 "C" [] [Whitespace(" ")], + }, + L_CURLY@111..112 "{" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + PROTECTED_KW@112..128 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + L_BRACK@128..129 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@129..130 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@130..132 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@132..138 "number" [] [], + }, + }, + }, + R_BRACK@138..139 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@139..141 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@141..147 "string" [] [], + }, + }, + SEMICOLON@147..148 ";" [] [], + ], + }, + ], + }, + R_CURLY@148..150 "}" [Newline("\n")] [], + ], + }, + ], + eof_token: EOF@150..151 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..151 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..150 + 0: JS_BOGUS_STATEMENT@0..48 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: L_CURLY@12..13 "{" [] [] + 3: JS_BOGUS@13..46 + 0: JS_BOGUS@13..46 + 0: PUBLIC_KW@13..26 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@26..27 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@27..36 + 0: JS_IDENTIFIER_BINDING@27..28 + 0: IDENT@27..28 "a" [] [] + 1: TS_TYPE_ANNOTATION@28..36 + 0: COLON@28..30 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@30..36 + 0: NUMBER_KW@30..36 "number" [] [] + 3: R_BRACK@36..37 "]" [] [] + 4: TS_TYPE_ANNOTATION@37..45 + 0: COLON@37..39 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@39..45 + 0: STRING_KW@39..45 "string" [] [] + 5: SEMICOLON@45..46 ";" [] [] + 4: R_CURLY@46..48 "}" [Newline("\n")] [] + 1: JS_BOGUS_STATEMENT@48..98 + 0: INTERFACE_KW@48..59 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@59..61 + 0: IDENT@59..61 "B" [] [Whitespace(" ")] + 2: L_CURLY@61..62 "{" [] [] + 3: JS_BOGUS@62..96 + 0: JS_BOGUS@62..96 + 0: PRIVATE_KW@62..76 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@76..77 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@77..86 + 0: JS_IDENTIFIER_BINDING@77..78 + 0: IDENT@77..78 "a" [] [] + 1: TS_TYPE_ANNOTATION@78..86 + 0: COLON@78..80 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@80..86 + 0: NUMBER_KW@80..86 "number" [] [] + 3: R_BRACK@86..87 "]" [] [] + 4: TS_TYPE_ANNOTATION@87..95 + 0: COLON@87..89 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@89..95 + 0: STRING_KW@89..95 "string" [] [] + 5: SEMICOLON@95..96 ";" [] [] + 4: R_CURLY@96..98 "}" [Newline("\n")] [] + 2: JS_BOGUS_STATEMENT@98..150 + 0: INTERFACE_KW@98..109 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@109..111 + 0: IDENT@109..111 "C" [] [Whitespace(" ")] + 2: L_CURLY@111..112 "{" [] [] + 3: JS_BOGUS@112..148 + 0: JS_BOGUS@112..148 + 0: PROTECTED_KW@112..128 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@128..129 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@129..138 + 0: JS_IDENTIFIER_BINDING@129..130 + 0: IDENT@129..130 "a" [] [] + 1: TS_TYPE_ANNOTATION@130..138 + 0: COLON@130..132 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@132..138 + 0: NUMBER_KW@132..138 "number" [] [] + 3: R_BRACK@138..139 "]" [] [] + 4: TS_TYPE_ANNOTATION@139..147 + 0: COLON@139..141 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@141..147 + 0: STRING_KW@141..147 "string" [] [] + 5: SEMICOLON@147..148 ";" [] [] + 4: R_CURLY@148..150 "}" [Newline("\n")] [] + 4: EOF@150..151 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:2:5 parse ━━━━━━━━━━━━━━━━━━ + + × index signature members cannot be public + + 1 │ interface A { + > 2 │ public [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ interface B { + +ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━ + + × index signature members cannot be private + + 3 │ } + 4 │ interface B { + > 5 │ private [a: number]: string; + │ ^^^^^^^ + 6 │ } + 7 │ interface C { + +ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━ + + × index signature members cannot be protected + + 6 │ } + 7 │ interface C { + > 8 │ protected [a: number]: string; + │ ^^^^^^^^^ + 9 │ } + 10 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap new file mode 100644 index 000000000000..4b007f645817 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap @@ -0,0 +1,1078 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type WithSelectors = S extends { getState: () => infer T } + ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + : never; +type TV1 = `${infer X}`; +type T61 = (infer A) extends infer B ? infer C : infer D; +type A = {a: infer T} +type A = () => infer T; +let s: (infer string)[] = symbol(); +let s: unique (infer string); +let s: [number, ...infer string] +let s: [(infer string)?] +let s: (infer string)[a] +let s: a[(infer string)] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..18 "WithSelectors" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@18..19 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@19..20 "S" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@24..26 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@26..34 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@36..44 "getState" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@44..46 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@46..47 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@49..52 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@52..58 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@58..60 "T" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + question_mark_token: QUESTION@61..66 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + true_type: TsObjectType { + l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@68..71 "use" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@71..73 ":" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@75..76 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@76..78 "K" [] [Whitespace(" ")], + }, + in_token: IN_KW@78..81 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@81..87 "keyof" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + INFER_KW@87..103 "infer" [] [Whitespace(" "), Comments("/*error*/"), Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@103..104 "T" [] [], + }, + ], + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@104..105 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@105..107 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@107..108 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@110..113 "=>" [] [Whitespace(" ")], + return_type: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@113..114 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@114..115 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@115..116 "K" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@116..118 "]" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + r_curly_token: R_CURLY@118..120 "}" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@120..121 "}" [] [], + }, + colon_token: COLON@121..126 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@126..131 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@131..132 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@132..138 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@138..142 "TV1" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@142..144 "=" [] [Whitespace(" ")], + ty: TsTemplateLiteralType { + l_tick_token: BACKTICK@144..145 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@145..147 "${" [] [], + ty: TsBogusType { + items: [ + INFER_KW@147..153 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@153..154 "X" [] [], + }, + ], + }, + r_curly_token: R_CURLY@154..155 "}" [] [], + }, + ], + r_tick_token: BACKTICK@155..156 "`" [] [], + }, + semicolon_token: SEMICOLON@156..157 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@163..166 "T61" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@166..167 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@167..168 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@168..170 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@170..172 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsParenthesizedType { + l_paren_token: L_PAREN@172..173 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@173..179 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@179..180 "A" [] [], + }, + ], + }, + r_paren_token: R_PAREN@180..182 ")" [] [Whitespace(" ")], + }, + extends_token: EXTENDS_KW@182..190 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@190..196 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@196..198 "B" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@198..200 "?" [] [Whitespace(" ")], + true_type: TsBogusType { + items: [ + INFER_KW@200..206 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@206..208 "C" [] [Whitespace(" ")], + }, + ], + }, + colon_token: COLON@208..210 ":" [] [Whitespace(" ")], + false_type: TsBogusType { + items: [ + INFER_KW@210..216 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@216..217 "D" [] [], + }, + ], + }, + }, + semicolon_token: SEMICOLON@217..218 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@224..226 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@226..228 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@228..229 "{" [] [], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@229..230 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@230..232 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + INFER_KW@232..238 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@238..239 "T" [] [], + }, + ], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@239..240 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@240..246 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@246..248 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@248..250 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@250..251 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@251..253 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@253..256 "=>" [] [Whitespace(" ")], + return_type: TsBogusType { + items: [ + INFER_KW@256..262 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@262..263 "T" [] [], + }, + ], + }, + }, + semicolon_token: SEMICOLON@263..264 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@264..269 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@269..270 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@270..272 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsParenthesizedType { + l_paren_token: L_PAREN@272..273 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@273..279 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@279..285 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@285..286 ")" [] [], + }, + l_brack_token: L_BRACK@286..287 "[" [] [], + r_brack_token: R_BRACK@287..289 "]" [] [Whitespace(" ")], + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@289..291 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@291..297 "symbol" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@297..298 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@298..299 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@299..300 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@300..305 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@305..306 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@306..308 ":" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: UNIQUE_KW@308..315 "unique" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@315..316 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@316..322 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@322..328 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@328..329 ")" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@329..330 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@330..335 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@335..336 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@336..338 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@338..339 "[" [] [], + elements: TsTupleTypeElementList [ + TsNumberType { + number_token: NUMBER_KW@339..345 "number" [] [], + }, + COMMA@345..347 "," [] [Whitespace(" ")], + TsRestTupleTypeElement { + dotdotdot_token: DOT3@347..350 "..." [] [], + ty: TsBogusType { + items: [ + INFER_KW@350..356 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@356..362 "string" [] [], + }, + ], + }, + }, + ], + r_brack_token: R_BRACK@362..363 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@363..368 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@368..369 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@369..371 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@371..372 "[" [] [], + elements: TsTupleTypeElementList [ + TsOptionalTupleTypeElement { + ty: TsParenthesizedType { + l_paren_token: L_PAREN@372..373 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@373..379 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@379..385 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@385..386 ")" [] [], + }, + question_mark_token: QUESTION@386..387 "?" [] [], + }, + ], + r_brack_token: R_BRACK@387..388 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@388..393 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@393..394 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@394..396 ":" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsParenthesizedType { + l_paren_token: L_PAREN@396..397 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@397..403 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@403..409 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@409..410 ")" [] [], + }, + l_brack_token: L_BRACK@410..411 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@411..412 "a" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@412..413 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@413..418 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@418..419 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@419..421 ":" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@421..422 "a" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@422..423 "[" [] [], + index_type: TsParenthesizedType { + l_paren_token: L_PAREN@423..424 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@424..430 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@430..436 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@436..437 ")" [] [], + }, + r_brack_token: R_BRACK@437..438 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@438..439 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..439 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..438 + 0: TS_TYPE_ALIAS_DECLARATION@0..132 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..18 + 0: IDENT@5..18 "WithSelectors" [] [] + 2: TS_TYPE_PARAMETERS@18..22 + 0: L_ANGLE@18..19 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@19..20 + 0: TS_TYPE_PARAMETER@19..20 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 + 1: TS_TYPE_PARAMETER_NAME@19..20 + 0: IDENT@19..20 "S" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] + 3: EQ@22..24 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@24..131 + 0: TS_REFERENCE_TYPE@24..26 + 0: JS_REFERENCE_IDENTIFIER@24..26 + 0: IDENT@24..26 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@26..34 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@34..61 + 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@36..60 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@36..60 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@36..44 + 0: IDENT@36..44 "getState" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@44..60 + 0: COLON@44..46 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@46..60 + 0: (empty) + 1: JS_PARAMETERS@46..49 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_PARAMETER_LIST@47..47 + 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@49..52 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@52..60 + 0: INFER_KW@52..58 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@58..60 + 0: IDENT@58..60 "T" [] [Whitespace(" ")] + 2: (empty) + 4: (empty) + 2: R_CURLY@60..61 "}" [] [] + 3: QUESTION@61..66 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@66..121 + 0: L_CURLY@66..68 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@68..120 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@68..120 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@68..71 + 0: IDENT@68..71 "use" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@71..120 + 0: COLON@71..73 ":" [] [Whitespace(" ")] + 1: TS_MAPPED_TYPE@73..120 + 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@75..76 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@76..78 + 0: IDENT@76..78 "K" [] [Whitespace(" ")] + 4: IN_KW@78..81 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@81..104 + 0: KEYOF_KW@81..87 "keyof" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@87..104 + 0: INFER_KW@87..103 "infer" [] [Whitespace(" "), Comments("/*error*/"), Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@103..104 + 0: IDENT@103..104 "T" [] [] + 6: (empty) + 7: R_BRACK@104..105 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@105..118 + 0: COLON@105..107 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@107..118 + 0: (empty) + 1: JS_PARAMETERS@107..110 + 0: L_PAREN@107..108 "(" [] [] + 1: JS_PARAMETER_LIST@108..108 + 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@110..113 "=>" [] [Whitespace(" ")] + 3: TS_INDEXED_ACCESS_TYPE@113..118 + 0: TS_REFERENCE_TYPE@113..114 + 0: JS_REFERENCE_IDENTIFIER@113..114 + 0: IDENT@113..114 "T" [] [] + 1: (empty) + 1: L_BRACK@114..115 "[" [] [] + 2: TS_REFERENCE_TYPE@115..116 + 0: JS_REFERENCE_IDENTIFIER@115..116 + 0: IDENT@115..116 "K" [] [] + 1: (empty) + 3: R_BRACK@116..118 "]" [] [Whitespace(" ")] + 10: (empty) + 11: R_CURLY@118..120 "}" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@120..121 "}" [] [] + 5: COLON@121..126 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_NEVER_TYPE@126..131 + 0: NEVER_KW@126..131 "never" [] [] + 5: SEMICOLON@131..132 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@132..157 + 0: TYPE_KW@132..138 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@138..142 + 0: IDENT@138..142 "TV1" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@142..144 "=" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@144..156 + 0: BACKTICK@144..145 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@145..155 + 0: TS_TEMPLATE_ELEMENT@145..155 + 0: DOLLAR_CURLY@145..147 "${" [] [] + 1: TS_BOGUS_TYPE@147..154 + 0: INFER_KW@147..153 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@153..154 + 0: IDENT@153..154 "X" [] [] + 2: R_CURLY@154..155 "}" [] [] + 2: BACKTICK@155..156 "`" [] [] + 5: SEMICOLON@156..157 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@157..218 + 0: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@163..166 + 0: IDENT@163..166 "T61" [] [] + 2: TS_TYPE_PARAMETERS@166..170 + 0: L_ANGLE@166..167 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@167..168 + 0: TS_TYPE_PARAMETER@167..168 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@167..167 + 1: TS_TYPE_PARAMETER_NAME@167..168 + 0: IDENT@167..168 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@168..170 ">" [] [Whitespace(" ")] + 3: EQ@170..172 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@172..217 + 0: TS_PARENTHESIZED_TYPE@172..182 + 0: L_PAREN@172..173 "(" [] [] + 1: TS_BOGUS_TYPE@173..180 + 0: INFER_KW@173..179 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@179..180 + 0: IDENT@179..180 "A" [] [] + 2: R_PAREN@180..182 ")" [] [Whitespace(" ")] + 1: EXTENDS_KW@182..190 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@190..198 + 0: INFER_KW@190..196 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@196..198 + 0: IDENT@196..198 "B" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@198..200 "?" [] [Whitespace(" ")] + 4: TS_BOGUS_TYPE@200..208 + 0: INFER_KW@200..206 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@206..208 + 0: IDENT@206..208 "C" [] [Whitespace(" ")] + 5: COLON@208..210 ":" [] [Whitespace(" ")] + 6: TS_BOGUS_TYPE@210..217 + 0: INFER_KW@210..216 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@216..217 + 0: IDENT@216..217 "D" [] [] + 5: SEMICOLON@217..218 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@218..240 + 0: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@224..226 + 0: IDENT@224..226 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@226..228 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@228..240 + 0: L_CURLY@228..229 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@229..239 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@229..239 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@229..230 + 0: IDENT@229..230 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@230..239 + 0: COLON@230..232 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@232..239 + 0: INFER_KW@232..238 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@238..239 + 0: IDENT@238..239 "T" [] [] + 4: (empty) + 2: R_CURLY@239..240 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@240..264 + 0: TYPE_KW@240..246 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@246..248 + 0: IDENT@246..248 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@248..250 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@250..263 + 0: (empty) + 1: JS_PARAMETERS@250..253 + 0: L_PAREN@250..251 "(" [] [] + 1: JS_PARAMETER_LIST@251..251 + 2: R_PAREN@251..253 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@253..256 "=>" [] [Whitespace(" ")] + 3: TS_BOGUS_TYPE@256..263 + 0: INFER_KW@256..262 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@262..263 + 0: IDENT@262..263 "T" [] [] + 5: SEMICOLON@263..264 ";" [] [] + 5: JS_VARIABLE_STATEMENT@264..300 + 0: JS_VARIABLE_DECLARATION@264..299 + 0: (empty) + 1: LET_KW@264..269 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@269..299 + 0: JS_VARIABLE_DECLARATOR@269..299 + 0: JS_IDENTIFIER_BINDING@269..270 + 0: IDENT@269..270 "s" [] [] + 1: TS_TYPE_ANNOTATION@270..289 + 0: COLON@270..272 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@272..289 + 0: TS_PARENTHESIZED_TYPE@272..286 + 0: L_PAREN@272..273 "(" [] [] + 1: TS_BOGUS_TYPE@273..285 + 0: INFER_KW@273..279 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@279..285 + 0: IDENT@279..285 "string" [] [] + 2: R_PAREN@285..286 ")" [] [] + 1: L_BRACK@286..287 "[" [] [] + 2: R_BRACK@287..289 "]" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@289..299 + 0: EQ@289..291 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@291..299 + 0: JS_IDENTIFIER_EXPRESSION@291..297 + 0: JS_REFERENCE_IDENTIFIER@291..297 + 0: IDENT@291..297 "symbol" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@297..299 + 0: L_PAREN@297..298 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@298..298 + 2: R_PAREN@298..299 ")" [] [] + 1: SEMICOLON@299..300 ";" [] [] + 6: JS_VARIABLE_STATEMENT@300..330 + 0: JS_VARIABLE_DECLARATION@300..329 + 0: (empty) + 1: LET_KW@300..305 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@305..329 + 0: JS_VARIABLE_DECLARATOR@305..329 + 0: JS_IDENTIFIER_BINDING@305..306 + 0: IDENT@305..306 "s" [] [] + 1: TS_TYPE_ANNOTATION@306..329 + 0: COLON@306..308 ":" [] [Whitespace(" ")] + 1: TS_TYPE_OPERATOR_TYPE@308..329 + 0: UNIQUE_KW@308..315 "unique" [] [Whitespace(" ")] + 1: TS_PARENTHESIZED_TYPE@315..329 + 0: L_PAREN@315..316 "(" [] [] + 1: TS_BOGUS_TYPE@316..328 + 0: INFER_KW@316..322 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@322..328 + 0: IDENT@322..328 "string" [] [] + 2: R_PAREN@328..329 ")" [] [] + 2: (empty) + 1: SEMICOLON@329..330 ";" [] [] + 7: JS_VARIABLE_STATEMENT@330..363 + 0: JS_VARIABLE_DECLARATION@330..363 + 0: (empty) + 1: LET_KW@330..335 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@335..363 + 0: JS_VARIABLE_DECLARATOR@335..363 + 0: JS_IDENTIFIER_BINDING@335..336 + 0: IDENT@335..336 "s" [] [] + 1: TS_TYPE_ANNOTATION@336..363 + 0: COLON@336..338 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@338..363 + 0: L_BRACK@338..339 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@339..362 + 0: TS_NUMBER_TYPE@339..345 + 0: NUMBER_KW@339..345 "number" [] [] + 1: COMMA@345..347 "," [] [Whitespace(" ")] + 2: TS_REST_TUPLE_TYPE_ELEMENT@347..362 + 0: DOT3@347..350 "..." [] [] + 1: TS_BOGUS_TYPE@350..362 + 0: INFER_KW@350..356 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@356..362 + 0: IDENT@356..362 "string" [] [] + 2: R_BRACK@362..363 "]" [] [] + 2: (empty) + 1: (empty) + 8: JS_VARIABLE_STATEMENT@363..388 + 0: JS_VARIABLE_DECLARATION@363..388 + 0: (empty) + 1: LET_KW@363..368 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@368..388 + 0: JS_VARIABLE_DECLARATOR@368..388 + 0: JS_IDENTIFIER_BINDING@368..369 + 0: IDENT@368..369 "s" [] [] + 1: TS_TYPE_ANNOTATION@369..388 + 0: COLON@369..371 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@371..388 + 0: L_BRACK@371..372 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@372..387 + 0: TS_OPTIONAL_TUPLE_TYPE_ELEMENT@372..387 + 0: TS_PARENTHESIZED_TYPE@372..386 + 0: L_PAREN@372..373 "(" [] [] + 1: TS_BOGUS_TYPE@373..385 + 0: INFER_KW@373..379 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@379..385 + 0: IDENT@379..385 "string" [] [] + 2: R_PAREN@385..386 ")" [] [] + 1: QUESTION@386..387 "?" [] [] + 2: R_BRACK@387..388 "]" [] [] + 2: (empty) + 1: (empty) + 9: JS_VARIABLE_STATEMENT@388..413 + 0: JS_VARIABLE_DECLARATION@388..413 + 0: (empty) + 1: LET_KW@388..393 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@393..413 + 0: JS_VARIABLE_DECLARATOR@393..413 + 0: JS_IDENTIFIER_BINDING@393..394 + 0: IDENT@393..394 "s" [] [] + 1: TS_TYPE_ANNOTATION@394..413 + 0: COLON@394..396 ":" [] [Whitespace(" ")] + 1: TS_INDEXED_ACCESS_TYPE@396..413 + 0: TS_PARENTHESIZED_TYPE@396..410 + 0: L_PAREN@396..397 "(" [] [] + 1: TS_BOGUS_TYPE@397..409 + 0: INFER_KW@397..403 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@403..409 + 0: IDENT@403..409 "string" [] [] + 2: R_PAREN@409..410 ")" [] [] + 1: L_BRACK@410..411 "[" [] [] + 2: TS_REFERENCE_TYPE@411..412 + 0: JS_REFERENCE_IDENTIFIER@411..412 + 0: IDENT@411..412 "a" [] [] + 1: (empty) + 3: R_BRACK@412..413 "]" [] [] + 2: (empty) + 1: (empty) + 10: JS_VARIABLE_STATEMENT@413..438 + 0: JS_VARIABLE_DECLARATION@413..438 + 0: (empty) + 1: LET_KW@413..418 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@418..438 + 0: JS_VARIABLE_DECLARATOR@418..438 + 0: JS_IDENTIFIER_BINDING@418..419 + 0: IDENT@418..419 "s" [] [] + 1: TS_TYPE_ANNOTATION@419..438 + 0: COLON@419..421 ":" [] [Whitespace(" ")] + 1: TS_INDEXED_ACCESS_TYPE@421..438 + 0: TS_REFERENCE_TYPE@421..422 + 0: JS_REFERENCE_IDENTIFIER@421..422 + 0: IDENT@421..422 "a" [] [] + 1: (empty) + 1: L_BRACK@422..423 "[" [] [] + 2: TS_PARENTHESIZED_TYPE@423..437 + 0: L_PAREN@423..424 "(" [] [] + 1: TS_BOGUS_TYPE@424..436 + 0: INFER_KW@424..430 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@430..436 + 0: IDENT@430..436 "string" [] [] + 2: R_PAREN@436..437 ")" [] [] + 3: R_BRACK@437..438 "]" [] [] + 2: (empty) + 1: (empty) + 4: EOF@438..439 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_infer_type_not_allowed.ts:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 1 │ type WithSelectors = S extends { getState: () => infer T } + > 2 │ ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + │ ^^^^^^^^^^^^^^^^^ + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + +ts_infer_type_not_allowed.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 2 │ ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + 3 │ : never; + > 4 │ type TV1 = `${infer X}`; + │ ^^^^^^^ + 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + 6 │ type A = {a: infer T} + +ts_infer_type_not_allowed.ts:5:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + │ ^^^^^^^ + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + +ts_infer_type_not_allowed.ts:5:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + │ ^^^^^^^ + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + +ts_infer_type_not_allowed.ts:5:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + │ ^^^^^^^ + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + +ts_infer_type_not_allowed.ts:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 4 │ type TV1 = `${infer X}`; + 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + > 6 │ type A = {a: infer T} + │ ^^^^^^^ + 7 │ type A = () => infer T; + 8 │ let s: (infer string)[] = symbol(); + +ts_infer_type_not_allowed.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + 6 │ type A = {a: infer T} + > 7 │ type A = () => infer T; + │ ^^^^^^^ + 8 │ let s: (infer string)[] = symbol(); + 9 │ let s: unique (infer string); + +ts_infer_type_not_allowed.ts:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + > 8 │ let s: (infer string)[] = symbol(); + │ ^^^^^^^^^^^^ + 9 │ let s: unique (infer string); + 10 │ let s: [number, ...infer string] + +ts_infer_type_not_allowed.ts:9:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 7 │ type A = () => infer T; + 8 │ let s: (infer string)[] = symbol(); + > 9 │ let s: unique (infer string); + │ ^^^^^^^^^^^^ + 10 │ let s: [number, ...infer string] + 11 │ let s: [(infer string)?] + +ts_infer_type_not_allowed.ts:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 8 │ let s: (infer string)[] = symbol(); + 9 │ let s: unique (infer string); + > 10 │ let s: [number, ...infer string] + │ ^^^^^^^^^^^^ + 11 │ let s: [(infer string)?] + 12 │ let s: (infer string)[a] + +ts_infer_type_not_allowed.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 9 │ let s: unique (infer string); + 10 │ let s: [number, ...infer string] + > 11 │ let s: [(infer string)?] + │ ^^^^^^^^^^^^ + 12 │ let s: (infer string)[a] + 13 │ let s: a[(infer string)] + +ts_infer_type_not_allowed.ts:12:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 10 │ let s: [number, ...infer string] + 11 │ let s: [(infer string)?] + > 12 │ let s: (infer string)[a] + │ ^^^^^^^^^^^^ + 13 │ let s: a[(infer string)] + 14 │ + +ts_infer_type_not_allowed.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 11 │ let s: [(infer string)?] + 12 │ let s: (infer string)[a] + > 13 │ let s: a[(infer string)] + │ ^^^^^^^^^^^^ + 14 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap new file mode 100644 index 000000000000..b10067702817 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap @@ -0,0 +1,309 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +f.c; +f?.c; +a?.f.d; +f.g; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..1 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1..2 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2..3 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@3..4 ">" [] [], + }, + }, + operator_token: DOT@4..5 "." [] [], + member: JsName { + value_token: IDENT@5..6 "c" [] [], + }, + }, + semicolon_token: SEMICOLON@6..7 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..9 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@9..10 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@10..11 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@11..12 ">" [] [], + }, + }, + operator_token: QUESTIONDOT@12..14 "?." [] [], + member: JsName { + value_token: IDENT@14..15 "c" [] [], + }, + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: TsInstantiationExpression { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..18 "a" [Newline("\n")] [], + }, + }, + operator_token: QUESTIONDOT@18..20 "?." [] [], + member: JsName { + value_token: IDENT@20..21 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@21..22 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@22..23 "c" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@23..24 ">" [] [], + }, + }, + operator_token: DOT@24..25 "." [] [], + member: JsName { + value_token: IDENT@25..26 "d" [] [], + }, + }, + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsStaticMemberExpression { + object: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..29 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@29..30 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@30..31 "a" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@31..32 ">" [] [], + }, + }, + operator_token: DOT@32..33 "." [] [], + member: JsName { + value_token: IDENT@33..34 "g" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@34..35 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + ], + eof_token: EOF@38..39 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..39 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..38 + 0: JS_EXPRESSION_STATEMENT@0..7 + 0: JS_STATIC_MEMBER_EXPRESSION@0..6 + 0: TS_INSTANTIATION_EXPRESSION@0..4 + 0: JS_IDENTIFIER_EXPRESSION@0..1 + 0: JS_REFERENCE_IDENTIFIER@0..1 + 0: IDENT@0..1 "f" [] [] + 1: TS_TYPE_ARGUMENTS@1..4 + 0: L_ANGLE@1..2 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2..3 + 0: TS_REFERENCE_TYPE@2..3 + 0: JS_REFERENCE_IDENTIFIER@2..3 + 0: IDENT@2..3 "b" [] [] + 1: (empty) + 2: R_ANGLE@3..4 ">" [] [] + 1: DOT@4..5 "." [] [] + 2: JS_NAME@5..6 + 0: IDENT@5..6 "c" [] [] + 1: SEMICOLON@6..7 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@7..16 + 0: JS_STATIC_MEMBER_EXPRESSION@7..15 + 0: TS_INSTANTIATION_EXPRESSION@7..12 + 0: JS_IDENTIFIER_EXPRESSION@7..9 + 0: JS_REFERENCE_IDENTIFIER@7..9 + 0: IDENT@7..9 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@9..12 + 0: L_ANGLE@9..10 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@10..11 + 0: TS_REFERENCE_TYPE@10..11 + 0: JS_REFERENCE_IDENTIFIER@10..11 + 0: IDENT@10..11 "b" [] [] + 1: (empty) + 2: R_ANGLE@11..12 ">" [] [] + 1: QUESTIONDOT@12..14 "?." [] [] + 2: JS_NAME@14..15 + 0: IDENT@14..15 "c" [] [] + 1: SEMICOLON@15..16 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@16..27 + 0: JS_STATIC_MEMBER_EXPRESSION@16..26 + 0: TS_INSTANTIATION_EXPRESSION@16..24 + 0: JS_STATIC_MEMBER_EXPRESSION@16..21 + 0: JS_IDENTIFIER_EXPRESSION@16..18 + 0: JS_REFERENCE_IDENTIFIER@16..18 + 0: IDENT@16..18 "a" [Newline("\n")] [] + 1: QUESTIONDOT@18..20 "?." [] [] + 2: JS_NAME@20..21 + 0: IDENT@20..21 "f" [] [] + 1: TS_TYPE_ARGUMENTS@21..24 + 0: L_ANGLE@21..22 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@22..23 + 0: TS_REFERENCE_TYPE@22..23 + 0: JS_REFERENCE_IDENTIFIER@22..23 + 0: IDENT@22..23 "c" [] [] + 1: (empty) + 2: R_ANGLE@23..24 ">" [] [] + 1: DOT@24..25 "." [] [] + 2: JS_NAME@25..26 + 0: IDENT@25..26 "d" [] [] + 1: SEMICOLON@26..27 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@27..38 + 0: TS_INSTANTIATION_EXPRESSION@27..37 + 0: JS_STATIC_MEMBER_EXPRESSION@27..34 + 0: TS_INSTANTIATION_EXPRESSION@27..32 + 0: JS_IDENTIFIER_EXPRESSION@27..29 + 0: JS_REFERENCE_IDENTIFIER@27..29 + 0: IDENT@27..29 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@29..32 + 0: L_ANGLE@29..30 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@30..31 + 0: TS_REFERENCE_TYPE@30..31 + 0: JS_REFERENCE_IDENTIFIER@30..31 + 0: IDENT@30..31 "a" [] [] + 1: (empty) + 2: R_ANGLE@31..32 ">" [] [] + 1: DOT@32..33 "." [] [] + 2: JS_NAME@33..34 + 0: IDENT@33..34 "g" [] [] + 1: TS_TYPE_ARGUMENTS@34..37 + 0: L_ANGLE@34..35 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@35..36 + 0: TS_REFERENCE_TYPE@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "b" [] [] + 1: (empty) + 2: R_ANGLE@36..37 ">" [] [] + 1: SEMICOLON@37..38 ";" [] [] + 4: EOF@38..39 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_instantiation_expression_property_access.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An instantiation expression cannot be followed by a property access. + + > 1 │ f.c; + │ ^^^^ + 2 │ f?.c; + 3 │ a?.f.d; + + i You can either wrap the instantiation expression in parentheses, or delete the type arguments. + +ts_instantiation_expression_property_access.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An instantiation expression cannot be followed by a property access. + + 1 │ f.c; + > 2 │ f?.c; + │ ^^^^ + 3 │ a?.f.d; + 4 │ f.g; + + i You can either wrap the instantiation expression in parentheses, or delete the type arguments. + +ts_instantiation_expression_property_access.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An instantiation expression cannot be followed by a property access. + + 1 │ f.c; + 2 │ f?.c; + > 3 │ a?.f.d; + │ ^^^^^^^ + 4 │ f.g; + 5 │ + + i You can either wrap the instantiation expression in parentheses, or delete the type arguments. + +ts_instantiation_expression_property_access.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An instantiation expression cannot be followed by a property access. + + 2 │ f?.c; + 3 │ a?.f.d; + > 4 │ f.g; + │ ^^^^ + 5 │ + + i You can either wrap the instantiation expression in parentheses, or delete the type arguments. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap new file mode 100644 index 000000000000..8fc811e75262 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap @@ -0,0 +1,1699 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const a8 = f; // Relational operator error +const b1 = f?.; // Error, `(` expected +f << f; +f = g; +f >> f; +f >= f; +f < f; +f > f; +f import<1>; +f yield; +f ++; +f --; +f /= 1; +f <= f; +f +[]; +f +as {}; +f +satisfies {}; +class C5 { + protected specialFoo = f #bar = 123 +} +for (const a = b.test in []) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..9 "a8" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@9..11 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..12 "f" [] [], + }, + }, + operator_token: L_ANGLE@12..13 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..19 "number" [] [], + }, + }, + }, + operator_token: R_ANGLE@19..20 ">" [] [], + right: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@20..21 "<" [] [], + ty: TsNumberType { + number_token: NUMBER_KW@21..27 "number" [] [], + }, + r_angle_token: R_ANGLE@27..28 ">" [] [], + expression: missing (required), + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@28..59 ";" [] [Whitespace(" "), Comments("// Relational operato ...")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@59..66 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@66..69 "b1" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@69..71 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@71..72 "f" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@72..74 "?." [] [], + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@74..75 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@75..81 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@81..82 ">" [] [], + }, + arguments: missing (required), + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@82..107 ";" [] [Whitespace(" "), Comments("// Error, `(` expected")], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@107..109 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@109..110 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@110..111 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@111..113 ">" [] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@113..114 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBogusType { + items: [ + JsBogus { + items: [ + L_ANGLE@114..116 "<" [] [Whitespace(" ")], + JsBogus { + items: [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@116..117 "f" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameterModifierList [], + ], + }, + ], + }, + TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@117..118 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@118..119 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@119..120 ">" [] [], + }, + parameters: missing (required), + fat_arrow_token: missing (required), + return_type: missing (required), + }, + ], + }, + ], + r_angle_token: missing (required), + }, + }, + semicolon_token: SEMICOLON@120..121 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@121..123 "f" [Newline("\n")] [], + }, + }, + TsTypeArguments { + l_angle_token: L_ANGLE@123..124 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@124..125 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@125..127 ">" [] [Whitespace(" ")], + }, + ], + }, + operator_token: EQ@127..129 "=" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@129..130 "g" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@130..131 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@131..132 "K" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@132..133 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@133..134 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@134..136 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@136..137 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..138 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@138..140 ">" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: missing (required), + operator_token: SHR@140..143 ">>" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@143..144 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@144..145 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@145..146 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@146..147 ">" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@147..148 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@148..150 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@150..151 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@151..152 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@152..154 ">" [] [Whitespace(" ")], + right: missing (required), + }, + operator_token: GTEQ@154..157 ">=" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@157..158 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@158..159 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@159..160 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@160..161 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@161..162 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@162..164 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@164..165 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@165..166 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@166..168 ">" [] [Whitespace(" ")], + right: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@168..170 "<" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@170..171 "f" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@171..172 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@172..173 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@173..174 ">" [] [], + }, + }, + r_angle_token: missing (required), + expression: missing (required), + }, + }, + semicolon_token: SEMICOLON@174..175 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@175..177 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@177..178 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@178..179 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@179..181 ">" [] [Whitespace(" ")], + right: missing (required), + }, + operator_token: R_ANGLE@181..183 ">" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@183..184 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@184..185 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@185..186 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@186..187 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@187..188 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@188..190 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@190..191 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@191..192 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@192..194 ">" [] [Whitespace(" ")], + right: missing (required), + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@194..200 "import" [] [], + import_clause: missing (required), + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@200..201 "<" [] [], + ty: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@201..202 "1" [] [], + }, + r_angle_token: R_ANGLE@202..203 ">" [] [], + expression: missing (required), + }, + semicolon_token: SEMICOLON@203..204 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@204..206 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@206..207 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@207..208 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@208..210 ">" [] [Whitespace(" ")], + right: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@210..215 "yield" [] [], + ], + }, + ], + }, + }, + semicolon_token: SEMICOLON@215..216 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@216..218 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@218..219 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@219..220 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@220..222 ">" [] [Whitespace(" ")], + right: JsPreUpdateExpression { + operator_token: PLUS2@222..224 "++" [] [], + operand: missing (required), + }, + }, + semicolon_token: SEMICOLON@224..225 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@225..227 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@227..228 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@228..229 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@229..231 ">" [] [Whitespace(" ")], + right: JsPreUpdateExpression { + operator_token: MINUS2@231..233 "--" [] [], + operand: missing (required), + }, + }, + semicolon_token: SEMICOLON@233..234 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@234..236 "f" [Newline("\n")] [], + }, + }, + operator_token: L_ANGLE@236..237 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@237..238 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@238..240 ">" [] [Whitespace(" ")], + right: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@240..245 "/= 1;" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@245..247 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@247..248 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@248..249 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@249..251 ">" [] [Whitespace(" ")], + }, + }, + operator_token: LTEQ@251..254 "<=" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@254..255 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@255..256 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@256..257 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@257..258 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@258..259 ";" [] [], + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@259..262 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@262..263 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@263..264 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@264..265 ">" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@265..267 "[" [Newline("\n")] [], + member: missing (required), + r_brack_token: R_BRACK@267..268 "]" [] [], + }, + semicolon_token: SEMICOLON@268..269 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@269..271 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@271..272 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@272..273 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@273..274 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@274..278 "as" [Newline("\n")] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@278..279 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@279..280 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@280..281 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@281..283 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@283..284 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@284..285 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@285..286 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@286..297 "satisfies" [Newline("\n")] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@297..298 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@298..299 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@299..300 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@300..307 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@307..310 "C5" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@310..311 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@311..326 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@326..337 "specialFoo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@337..339 "=" [] [Whitespace(" ")], + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@339..340 "f" [] [], + }, + }, + operator_token: L_ANGLE@340..341 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@341..347 "string" [] [], + }, + }, + }, + R_ANGLE@347..349 ">" [] [Whitespace(" ")], + JsBogusExpression { + items: [ + HASH@349..350 "#" [] [], + IDENT@350..354 "bar" [] [Whitespace(" ")], + ], + }, + ], + }, + operator_token: EQ@354..356 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@356..359 "123" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@359..361 "}" [Newline("\n")] [], + }, + JsForInStatement { + for_token: FOR_KW@361..366 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@366..367 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@367..373 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@373..375 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@375..377 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@377..378 "b" [] [], + }, + }, + operator_token: DOT@378..379 "." [] [], + member: JsName { + value_token: IDENT@379..383 "test" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@383..384 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@384..390 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@390..392 ">" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + in_token: IN_KW@392..395 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@395..396 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@396..397 "]" [] [], + }, + r_paren_token: R_PAREN@397..399 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@399..400 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@400..401 "}" [] [], + }, + }, + ], + eof_token: EOF@401..402 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..402 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..401 + 0: JS_VARIABLE_STATEMENT@0..59 + 0: JS_VARIABLE_DECLARATION@0..28 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..28 + 0: JS_VARIABLE_DECLARATOR@6..28 + 0: JS_IDENTIFIER_BINDING@6..9 + 0: IDENT@6..9 "a8" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@9..28 + 0: EQ@9..11 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@11..28 + 0: JS_BINARY_EXPRESSION@11..19 + 0: JS_IDENTIFIER_EXPRESSION@11..12 + 0: JS_REFERENCE_IDENTIFIER@11..12 + 0: IDENT@11..12 "f" [] [] + 1: L_ANGLE@12..13 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@13..19 + 0: JS_REFERENCE_IDENTIFIER@13..19 + 0: IDENT@13..19 "number" [] [] + 1: R_ANGLE@19..20 ">" [] [] + 2: TS_TYPE_ASSERTION_EXPRESSION@20..28 + 0: L_ANGLE@20..21 "<" [] [] + 1: TS_NUMBER_TYPE@21..27 + 0: NUMBER_KW@21..27 "number" [] [] + 2: R_ANGLE@27..28 ">" [] [] + 3: (empty) + 1: SEMICOLON@28..59 ";" [] [Whitespace(" "), Comments("// Relational operato ...")] + 1: JS_VARIABLE_STATEMENT@59..107 + 0: JS_VARIABLE_DECLARATION@59..82 + 0: (empty) + 1: CONST_KW@59..66 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@66..82 + 0: JS_VARIABLE_DECLARATOR@66..82 + 0: JS_IDENTIFIER_BINDING@66..69 + 0: IDENT@66..69 "b1" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@69..82 + 0: EQ@69..71 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@71..82 + 0: JS_IDENTIFIER_EXPRESSION@71..72 + 0: JS_REFERENCE_IDENTIFIER@71..72 + 0: IDENT@71..72 "f" [] [] + 1: QUESTIONDOT@72..74 "?." [] [] + 2: TS_TYPE_ARGUMENTS@74..82 + 0: L_ANGLE@74..75 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@75..81 + 0: TS_NUMBER_TYPE@75..81 + 0: NUMBER_KW@75..81 "number" [] [] + 2: R_ANGLE@81..82 ">" [] [] + 3: (empty) + 1: SEMICOLON@82..107 ";" [] [Whitespace(" "), Comments("// Error, `(` expected")] + 2: JS_EXPRESSION_STATEMENT@107..121 + 0: TS_INSTANTIATION_EXPRESSION@107..120 + 0: TS_INSTANTIATION_EXPRESSION@107..113 + 0: JS_IDENTIFIER_EXPRESSION@107..109 + 0: JS_REFERENCE_IDENTIFIER@107..109 + 0: IDENT@107..109 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@109..113 + 0: L_ANGLE@109..110 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@110..111 + 0: TS_REFERENCE_TYPE@110..111 + 0: JS_REFERENCE_IDENTIFIER@110..111 + 0: IDENT@110..111 "T" [] [] + 1: (empty) + 2: R_ANGLE@111..113 ">" [] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@113..120 + 0: L_ANGLE@113..114 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@114..120 + 0: TS_BOGUS_TYPE@114..120 + 0: JS_BOGUS@114..117 + 0: L_ANGLE@114..116 "<" [] [Whitespace(" ")] + 1: JS_BOGUS@116..117 + 0: TS_TYPE_PARAMETER@116..117 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@116..116 + 1: TS_TYPE_PARAMETER_NAME@116..117 + 0: IDENT@116..117 "f" [] [] + 2: (empty) + 3: (empty) + 1: TS_TYPE_PARAMETER_MODIFIER_LIST@117..117 + 1: TS_FUNCTION_TYPE@117..120 + 0: TS_TYPE_PARAMETERS@117..120 + 0: L_ANGLE@117..118 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@118..119 + 0: TS_TYPE_PARAMETER@118..119 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@118..118 + 1: TS_TYPE_PARAMETER_NAME@118..119 + 0: IDENT@118..119 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@119..120 ">" [] [] + 1: (empty) + 2: (empty) + 3: (empty) + 2: (empty) + 1: SEMICOLON@120..121 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@121..134 + 0: JS_ASSIGNMENT_EXPRESSION@121..133 + 0: JS_BOGUS_ASSIGNMENT@121..127 + 0: JS_IDENTIFIER_EXPRESSION@121..123 + 0: JS_REFERENCE_IDENTIFIER@121..123 + 0: IDENT@121..123 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@123..127 + 0: L_ANGLE@123..124 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@124..125 + 0: TS_REFERENCE_TYPE@124..125 + 0: JS_REFERENCE_IDENTIFIER@124..125 + 0: IDENT@124..125 "T" [] [] + 1: (empty) + 2: R_ANGLE@125..127 ">" [] [Whitespace(" ")] + 1: EQ@127..129 "=" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@129..133 + 0: JS_IDENTIFIER_EXPRESSION@129..130 + 0: JS_REFERENCE_IDENTIFIER@129..130 + 0: IDENT@129..130 "g" [] [] + 1: TS_TYPE_ARGUMENTS@130..133 + 0: L_ANGLE@130..131 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@131..132 + 0: TS_REFERENCE_TYPE@131..132 + 0: JS_REFERENCE_IDENTIFIER@131..132 + 0: IDENT@131..132 "K" [] [] + 1: (empty) + 2: R_ANGLE@132..133 ">" [] [] + 1: SEMICOLON@133..134 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@134..148 + 0: JS_BINARY_EXPRESSION@134..147 + 0: JS_BINARY_EXPRESSION@134..138 + 0: JS_IDENTIFIER_EXPRESSION@134..136 + 0: JS_REFERENCE_IDENTIFIER@134..136 + 0: IDENT@134..136 "f" [Newline("\n")] [] + 1: L_ANGLE@136..137 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@137..138 + 0: JS_REFERENCE_IDENTIFIER@137..138 + 0: IDENT@137..138 "T" [] [] + 1: R_ANGLE@138..140 ">" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@140..147 + 0: (empty) + 1: SHR@140..143 ">>" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@143..147 + 0: JS_IDENTIFIER_EXPRESSION@143..144 + 0: JS_REFERENCE_IDENTIFIER@143..144 + 0: IDENT@143..144 "f" [] [] + 1: TS_TYPE_ARGUMENTS@144..147 + 0: L_ANGLE@144..145 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@145..146 + 0: TS_REFERENCE_TYPE@145..146 + 0: JS_REFERENCE_IDENTIFIER@145..146 + 0: IDENT@145..146 "T" [] [] + 1: (empty) + 2: R_ANGLE@146..147 ">" [] [] + 1: SEMICOLON@147..148 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@148..162 + 0: JS_BINARY_EXPRESSION@148..161 + 0: JS_BINARY_EXPRESSION@148..154 + 0: JS_BINARY_EXPRESSION@148..152 + 0: JS_IDENTIFIER_EXPRESSION@148..150 + 0: JS_REFERENCE_IDENTIFIER@148..150 + 0: IDENT@148..150 "f" [Newline("\n")] [] + 1: L_ANGLE@150..151 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@151..152 + 0: JS_REFERENCE_IDENTIFIER@151..152 + 0: IDENT@151..152 "T" [] [] + 1: R_ANGLE@152..154 ">" [] [Whitespace(" ")] + 2: (empty) + 1: GTEQ@154..157 ">=" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@157..161 + 0: JS_IDENTIFIER_EXPRESSION@157..158 + 0: JS_REFERENCE_IDENTIFIER@157..158 + 0: IDENT@157..158 "f" [] [] + 1: TS_TYPE_ARGUMENTS@158..161 + 0: L_ANGLE@158..159 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@159..160 + 0: TS_REFERENCE_TYPE@159..160 + 0: JS_REFERENCE_IDENTIFIER@159..160 + 0: IDENT@159..160 "T" [] [] + 1: (empty) + 2: R_ANGLE@160..161 ">" [] [] + 1: SEMICOLON@161..162 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@162..175 + 0: JS_BINARY_EXPRESSION@162..174 + 0: JS_BINARY_EXPRESSION@162..166 + 0: JS_IDENTIFIER_EXPRESSION@162..164 + 0: JS_REFERENCE_IDENTIFIER@162..164 + 0: IDENT@162..164 "f" [Newline("\n")] [] + 1: L_ANGLE@164..165 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@165..166 + 0: JS_REFERENCE_IDENTIFIER@165..166 + 0: IDENT@165..166 "T" [] [] + 1: R_ANGLE@166..168 ">" [] [Whitespace(" ")] + 2: TS_TYPE_ASSERTION_EXPRESSION@168..174 + 0: L_ANGLE@168..170 "<" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@170..174 + 0: JS_REFERENCE_IDENTIFIER@170..171 + 0: IDENT@170..171 "f" [] [] + 1: TS_TYPE_ARGUMENTS@171..174 + 0: L_ANGLE@171..172 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@172..173 + 0: TS_REFERENCE_TYPE@172..173 + 0: JS_REFERENCE_IDENTIFIER@172..173 + 0: IDENT@172..173 "T" [] [] + 1: (empty) + 2: R_ANGLE@173..174 ">" [] [] + 2: (empty) + 3: (empty) + 1: SEMICOLON@174..175 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@175..188 + 0: JS_BINARY_EXPRESSION@175..187 + 0: JS_BINARY_EXPRESSION@175..181 + 0: JS_BINARY_EXPRESSION@175..179 + 0: JS_IDENTIFIER_EXPRESSION@175..177 + 0: JS_REFERENCE_IDENTIFIER@175..177 + 0: IDENT@175..177 "f" [Newline("\n")] [] + 1: L_ANGLE@177..178 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@178..179 + 0: JS_REFERENCE_IDENTIFIER@178..179 + 0: IDENT@178..179 "T" [] [] + 1: R_ANGLE@179..181 ">" [] [Whitespace(" ")] + 2: (empty) + 1: R_ANGLE@181..183 ">" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@183..187 + 0: JS_IDENTIFIER_EXPRESSION@183..184 + 0: JS_REFERENCE_IDENTIFIER@183..184 + 0: IDENT@183..184 "f" [] [] + 1: TS_TYPE_ARGUMENTS@184..187 + 0: L_ANGLE@184..185 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@185..186 + 0: TS_REFERENCE_TYPE@185..186 + 0: JS_REFERENCE_IDENTIFIER@185..186 + 0: IDENT@185..186 "T" [] [] + 1: (empty) + 2: R_ANGLE@186..187 ">" [] [] + 1: SEMICOLON@187..188 ";" [] [] + 8: JS_EXPRESSION_STATEMENT@188..194 + 0: JS_BINARY_EXPRESSION@188..194 + 0: JS_BINARY_EXPRESSION@188..192 + 0: JS_IDENTIFIER_EXPRESSION@188..190 + 0: JS_REFERENCE_IDENTIFIER@188..190 + 0: IDENT@188..190 "f" [Newline("\n")] [] + 1: L_ANGLE@190..191 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@191..192 + 0: JS_REFERENCE_IDENTIFIER@191..192 + 0: IDENT@191..192 "T" [] [] + 1: R_ANGLE@192..194 ">" [] [Whitespace(" ")] + 2: (empty) + 1: (empty) + 9: JS_IMPORT@194..200 + 0: IMPORT_KW@194..200 "import" [] [] + 1: (empty) + 2: (empty) + 10: JS_EXPRESSION_STATEMENT@200..204 + 0: TS_TYPE_ASSERTION_EXPRESSION@200..203 + 0: L_ANGLE@200..201 "<" [] [] + 1: TS_NUMBER_LITERAL_TYPE@201..202 + 0: (empty) + 1: JS_NUMBER_LITERAL@201..202 "1" [] [] + 2: R_ANGLE@202..203 ">" [] [] + 3: (empty) + 1: SEMICOLON@203..204 ";" [] [] + 11: JS_EXPRESSION_STATEMENT@204..216 + 0: JS_BINARY_EXPRESSION@204..215 + 0: JS_BINARY_EXPRESSION@204..208 + 0: JS_IDENTIFIER_EXPRESSION@204..206 + 0: JS_REFERENCE_IDENTIFIER@204..206 + 0: IDENT@204..206 "f" [Newline("\n")] [] + 1: L_ANGLE@206..207 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@207..208 + 0: JS_REFERENCE_IDENTIFIER@207..208 + 0: IDENT@207..208 "T" [] [] + 1: R_ANGLE@208..210 ">" [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@210..215 + 0: JS_BOGUS@210..215 + 0: IDENT@210..215 "yield" [] [] + 1: SEMICOLON@215..216 ";" [] [] + 12: JS_EXPRESSION_STATEMENT@216..225 + 0: JS_BINARY_EXPRESSION@216..224 + 0: JS_BINARY_EXPRESSION@216..220 + 0: JS_IDENTIFIER_EXPRESSION@216..218 + 0: JS_REFERENCE_IDENTIFIER@216..218 + 0: IDENT@216..218 "f" [Newline("\n")] [] + 1: L_ANGLE@218..219 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@219..220 + 0: JS_REFERENCE_IDENTIFIER@219..220 + 0: IDENT@219..220 "T" [] [] + 1: R_ANGLE@220..222 ">" [] [Whitespace(" ")] + 2: JS_PRE_UPDATE_EXPRESSION@222..224 + 0: PLUS2@222..224 "++" [] [] + 1: (empty) + 1: SEMICOLON@224..225 ";" [] [] + 13: JS_EXPRESSION_STATEMENT@225..234 + 0: JS_BINARY_EXPRESSION@225..233 + 0: JS_BINARY_EXPRESSION@225..229 + 0: JS_IDENTIFIER_EXPRESSION@225..227 + 0: JS_REFERENCE_IDENTIFIER@225..227 + 0: IDENT@225..227 "f" [Newline("\n")] [] + 1: L_ANGLE@227..228 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@228..229 + 0: JS_REFERENCE_IDENTIFIER@228..229 + 0: IDENT@228..229 "T" [] [] + 1: R_ANGLE@229..231 ">" [] [Whitespace(" ")] + 2: JS_PRE_UPDATE_EXPRESSION@231..233 + 0: MINUS2@231..233 "--" [] [] + 1: (empty) + 1: SEMICOLON@233..234 ";" [] [] + 14: JS_EXPRESSION_STATEMENT@234..245 + 0: JS_BINARY_EXPRESSION@234..245 + 0: JS_BINARY_EXPRESSION@234..238 + 0: JS_IDENTIFIER_EXPRESSION@234..236 + 0: JS_REFERENCE_IDENTIFIER@234..236 + 0: IDENT@234..236 "f" [Newline("\n")] [] + 1: L_ANGLE@236..237 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@237..238 + 0: JS_REFERENCE_IDENTIFIER@237..238 + 0: IDENT@237..238 "T" [] [] + 1: R_ANGLE@238..240 ">" [] [Whitespace(" ")] + 2: JS_REGEX_LITERAL_EXPRESSION@240..245 + 0: JS_REGEX_LITERAL@240..245 "/= 1;" [] [] + 1: (empty) + 15: JS_EXPRESSION_STATEMENT@245..259 + 0: JS_BINARY_EXPRESSION@245..258 + 0: TS_INSTANTIATION_EXPRESSION@245..251 + 0: JS_IDENTIFIER_EXPRESSION@245..247 + 0: JS_REFERENCE_IDENTIFIER@245..247 + 0: IDENT@245..247 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@247..251 + 0: L_ANGLE@247..248 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@248..249 + 0: TS_REFERENCE_TYPE@248..249 + 0: JS_REFERENCE_IDENTIFIER@248..249 + 0: IDENT@248..249 "T" [] [] + 1: (empty) + 2: R_ANGLE@249..251 ">" [] [Whitespace(" ")] + 1: LTEQ@251..254 "<=" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@254..258 + 0: JS_IDENTIFIER_EXPRESSION@254..255 + 0: JS_REFERENCE_IDENTIFIER@254..255 + 0: IDENT@254..255 "f" [] [] + 1: TS_TYPE_ARGUMENTS@255..258 + 0: L_ANGLE@255..256 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@256..257 + 0: TS_REFERENCE_TYPE@256..257 + 0: JS_REFERENCE_IDENTIFIER@256..257 + 0: IDENT@256..257 "T" [] [] + 1: (empty) + 2: R_ANGLE@257..258 ">" [] [] + 1: SEMICOLON@258..259 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@259..269 + 0: JS_COMPUTED_MEMBER_EXPRESSION@259..268 + 0: TS_INSTANTIATION_EXPRESSION@259..265 + 0: JS_IDENTIFIER_EXPRESSION@259..262 + 0: JS_REFERENCE_IDENTIFIER@259..262 + 0: IDENT@259..262 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@262..265 + 0: L_ANGLE@262..263 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@263..264 + 0: TS_REFERENCE_TYPE@263..264 + 0: JS_REFERENCE_IDENTIFIER@263..264 + 0: IDENT@263..264 "T" [] [] + 1: (empty) + 2: R_ANGLE@264..265 ">" [] [] + 1: (empty) + 2: L_BRACK@265..267 "[" [Newline("\n")] [] + 3: (empty) + 4: R_BRACK@267..268 "]" [] [] + 1: SEMICOLON@268..269 ";" [] [] + 17: JS_EXPRESSION_STATEMENT@269..274 + 0: TS_INSTANTIATION_EXPRESSION@269..274 + 0: JS_IDENTIFIER_EXPRESSION@269..271 + 0: JS_REFERENCE_IDENTIFIER@269..271 + 0: IDENT@269..271 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@271..274 + 0: L_ANGLE@271..272 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@272..273 + 0: TS_REFERENCE_TYPE@272..273 + 0: JS_REFERENCE_IDENTIFIER@272..273 + 0: IDENT@272..273 "T" [] [] + 1: (empty) + 2: R_ANGLE@273..274 ">" [] [] + 1: (empty) + 18: JS_EXPRESSION_STATEMENT@274..278 + 0: JS_IDENTIFIER_EXPRESSION@274..278 + 0: JS_REFERENCE_IDENTIFIER@274..278 + 0: IDENT@274..278 "as" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 19: JS_BLOCK_STATEMENT@278..280 + 0: L_CURLY@278..279 "{" [] [] + 1: JS_STATEMENT_LIST@279..279 + 2: R_CURLY@279..280 "}" [] [] + 20: JS_EMPTY_STATEMENT@280..281 + 0: SEMICOLON@280..281 ";" [] [] + 21: JS_EXPRESSION_STATEMENT@281..286 + 0: TS_INSTANTIATION_EXPRESSION@281..286 + 0: JS_IDENTIFIER_EXPRESSION@281..283 + 0: JS_REFERENCE_IDENTIFIER@281..283 + 0: IDENT@281..283 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@283..286 + 0: L_ANGLE@283..284 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@284..285 + 0: TS_REFERENCE_TYPE@284..285 + 0: JS_REFERENCE_IDENTIFIER@284..285 + 0: IDENT@284..285 "T" [] [] + 1: (empty) + 2: R_ANGLE@285..286 ">" [] [] + 1: (empty) + 22: JS_EXPRESSION_STATEMENT@286..297 + 0: JS_IDENTIFIER_EXPRESSION@286..297 + 0: JS_REFERENCE_IDENTIFIER@286..297 + 0: IDENT@286..297 "satisfies" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 23: JS_BLOCK_STATEMENT@297..299 + 0: L_CURLY@297..298 "{" [] [] + 1: JS_STATEMENT_LIST@298..298 + 2: R_CURLY@298..299 "}" [] [] + 24: JS_EMPTY_STATEMENT@299..300 + 0: SEMICOLON@299..300 ";" [] [] + 25: JS_CLASS_DECLARATION@300..361 + 0: JS_DECORATOR_LIST@300..300 + 1: (empty) + 2: CLASS_KW@300..307 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@307..310 + 0: IDENT@307..310 "C5" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@310..311 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@311..359 + 0: JS_PROPERTY_CLASS_MEMBER@311..359 + 0: JS_PROPERTY_MODIFIER_LIST@311..326 + 0: TS_ACCESSIBILITY_MODIFIER@311..326 + 0: PROTECTED_KW@311..326 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@326..337 + 0: IDENT@326..337 "specialFoo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@337..359 + 0: EQ@337..339 "=" [] [Whitespace(" ")] + 1: JS_ASSIGNMENT_EXPRESSION@339..359 + 0: JS_BOGUS_ASSIGNMENT@339..354 + 0: JS_BINARY_EXPRESSION@339..347 + 0: JS_IDENTIFIER_EXPRESSION@339..340 + 0: JS_REFERENCE_IDENTIFIER@339..340 + 0: IDENT@339..340 "f" [] [] + 1: L_ANGLE@340..341 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@341..347 + 0: JS_REFERENCE_IDENTIFIER@341..347 + 0: IDENT@341..347 "string" [] [] + 1: R_ANGLE@347..349 ">" [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@349..354 + 0: HASH@349..350 "#" [] [] + 1: IDENT@350..354 "bar" [] [Whitespace(" ")] + 1: EQ@354..356 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@356..359 + 0: JS_NUMBER_LITERAL@356..359 "123" [] [] + 4: (empty) + 9: R_CURLY@359..361 "}" [Newline("\n")] [] + 26: JS_FOR_IN_STATEMENT@361..401 + 0: FOR_KW@361..366 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@366..367 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@367..392 + 0: (empty) + 1: CONST_KW@367..373 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@373..392 + 0: JS_IDENTIFIER_BINDING@373..375 + 0: IDENT@373..375 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@375..392 + 0: EQ@375..377 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@377..392 + 0: JS_STATIC_MEMBER_EXPRESSION@377..383 + 0: JS_IDENTIFIER_EXPRESSION@377..378 + 0: JS_REFERENCE_IDENTIFIER@377..378 + 0: IDENT@377..378 "b" [] [] + 1: DOT@378..379 "." [] [] + 2: JS_NAME@379..383 + 0: IDENT@379..383 "test" [] [] + 1: TS_TYPE_ARGUMENTS@383..392 + 0: L_ANGLE@383..384 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@384..390 + 0: TS_STRING_TYPE@384..390 + 0: STRING_KW@384..390 "string" [] [] + 2: R_ANGLE@390..392 ">" [] [Whitespace(" ")] + 3: IN_KW@392..395 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@395..397 + 0: L_BRACK@395..396 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@396..396 + 2: R_BRACK@396..397 "]" [] [] + 5: R_PAREN@397..399 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@399..401 + 0: L_CURLY@399..400 "{" [] [] + 1: JS_STATEMENT_LIST@400..400 + 2: R_CURLY@400..401 "}" [] [] + 4: EOF@401..402 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_instantiation_expressions_1.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ';'. + + > 1 │ const a8 = f; // Relational operator error + │ ^ + 2 │ const b1 = f?.; // Error, `(` expected + 3 │ f << f; + + i Expected an expression here. + + > 1 │ const a8 = f; // Relational operator error + │ ^ + 2 │ const b1 = f?.; // Error, `(` expected + 3 │ f << f; + +ts_instantiation_expressions_1.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `;` + + 1 │ const a8 = f; // Relational operator error + > 2 │ const b1 = f?.; // Error, `(` expected + │ ^ + 3 │ f << f; + 4 │ f = g; + + i Remove ; + +ts_instantiation_expressions_1.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `<` + + 1 │ const a8 = f; // Relational operator error + 2 │ const b1 = f?.; // Error, `(` expected + > 3 │ f << f; + │ ^ + 4 │ f = g; + 5 │ f >> f; + + i Remove < + +ts_instantiation_expressions_1.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a parenthesis '(' but instead found ';'. + + 1 │ const a8 = f; // Relational operator error + 2 │ const b1 = f?.; // Error, `(` expected + > 3 │ f << f; + │ ^ + 4 │ f = g; + 5 │ f >> f; + + i Expected a parenthesis '(' here. + + 1 │ const a8 = f; // Relational operator error + 2 │ const b1 = f?.; // Error, `(` expected + > 3 │ f << f; + │ ^ + 4 │ f = g; + 5 │ f >> f; + +ts_instantiation_expressions_1.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `f` + + 2 │ const b1 = f?.; // Error, `(` expected + 3 │ f << f; + > 4 │ f = g; + │ ^^^^ + 5 │ f >> f; + 6 │ f >= f; + + i This expression cannot be assigned to + +ts_instantiation_expressions_1.ts:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression for the left hand side of the `>>` operator. + + 3 │ f << f; + 4 │ f = g; + > 5 │ f >> f; + │ ^^ + 6 │ f >= f; + 7 │ f < f; + + i This operator requires a left hand side value + +ts_instantiation_expressions_1.ts:6:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '>='. + + 4 │ f = g; + 5 │ f >> f; + > 6 │ f >= f; + │ ^^ + 7 │ f < f; + 8 │ f > f; + + i Expected an expression here. + + 4 │ f = g; + 5 │ f >> f; + > 6 │ f >= f; + │ ^^ + 7 │ f < f; + 8 │ f > f; + +ts_instantiation_expressions_1.ts:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `;` + + 5 │ f >> f; + 6 │ f >= f; + > 7 │ f < f; + │ ^ + 8 │ f > f; + 9 │ f import<1>; + + i Remove ; + +ts_instantiation_expressions_1.ts:8:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '>'. + + 6 │ f >= f; + 7 │ f < f; + > 8 │ f > f; + │ ^ + 9 │ f import<1>; + 10 │ f yield; + + i Expected an expression here. + + 6 │ f >= f; + 7 │ f < f; + > 8 │ f > f; + │ ^ + 9 │ f import<1>; + 10 │ f yield; + +ts_instantiation_expressions_1.ts:9:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found 'import'. + + 7 │ f < f; + 8 │ f > f; + > 9 │ f import<1>; + │ ^^^^^^ + 10 │ f yield; + 11 │ f ++; + + i Expected an expression here. + + 7 │ f < f; + 8 │ f > f; + > 9 │ f import<1>; + │ ^^^^^^ + 10 │ f yield; + 11 │ f ++; + +ts_instantiation_expressions_1.ts:9:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a default import, a namespace import, or a named import but instead found '<'. + + 7 │ f < f; + 8 │ f > f; + > 9 │ f import<1>; + │ ^ + 10 │ f yield; + 11 │ f ++; + + i Expected a default import, a namespace import, or a named import here. + + 7 │ f < f; + 8 │ f > f; + > 9 │ f import<1>; + │ ^ + 10 │ f yield; + 11 │ f ++; + +ts_instantiation_expressions_1.ts:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ';'. + + 7 │ f < f; + 8 │ f > f; + > 9 │ f import<1>; + │ ^ + 10 │ f yield; + 11 │ f ++; + + i Expected an expression here. + + 7 │ f < f; + 8 │ f > f; + > 9 │ f import<1>; + │ ^ + 10 │ f yield; + 11 │ f ++; + +ts_instantiation_expressions_1.ts:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + 8 │ f > f; + 9 │ f import<1>; + > 10 │ f yield; + │ ^^^^^ + 11 │ f ++; + 12 │ f --; + +ts_instantiation_expressions_1.ts:11:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or a member expression but instead found ';'. + + 9 │ f import<1>; + 10 │ f yield; + > 11 │ f ++; + │ ^ + 12 │ f --; + 13 │ f /= 1; + + i Expected an identifier, or a member expression here. + + 9 │ f import<1>; + 10 │ f yield; + > 11 │ f ++; + │ ^ + 12 │ f --; + 13 │ f /= 1; + +ts_instantiation_expressions_1.ts:12:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or a member expression but instead found ';'. + + 10 │ f yield; + 11 │ f ++; + > 12 │ f --; + │ ^ + 13 │ f /= 1; + 14 │ f <= f; + + i Expected an identifier, or a member expression here. + + 10 │ f yield; + 11 │ f ++; + > 12 │ f --; + │ ^ + 13 │ f /= 1; + 14 │ f <= f; + +ts_instantiation_expressions_1.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated regex literal + + 11 │ f ++; + 12 │ f --; + > 13 │ f /= 1; + │ + 14 │ f <= f; + 15 │ f + + i ...but the line ends here + + 11 │ f ++; + 12 │ f --; + > 13 │ f /= 1; + │ + 14 │ f <= f; + 15 │ f + + i a regex literal starts there... + + 11 │ f ++; + 12 │ f --; + > 13 │ f /= 1; + │ ^ + 14 │ f <= f; + 15 │ f + +ts_instantiation_expressions_1.ts:16:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found ']'. + + 14 │ f <= f; + 15 │ f + > 16 │ []; + │ ^ + 17 │ f + 18 │ as {}; + + i Expected an expression here. + + 14 │ f <= f; + 15 │ f + > 16 │ []; + │ ^ + 17 │ f + 18 │ as {}; + +ts_instantiation_expressions_1.ts:18:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 16 │ []; + 17 │ f + > 18 │ as {}; + │ ^ + 19 │ f + 20 │ satisfies {}; + + i An explicit or implicit semicolon is expected here... + + 16 │ []; + 17 │ f + > 18 │ as {}; + │ ^ + 19 │ f + 20 │ satisfies {}; + + i ...Which is required to end this statement + + 16 │ []; + 17 │ f + > 18 │ as {}; + │ ^^^^ + 19 │ f + 20 │ satisfies {}; + +ts_instantiation_expressions_1.ts:20:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 18 │ as {}; + 19 │ f + > 20 │ satisfies {}; + │ ^ + 21 │ class C5 { + 22 │ protected specialFoo = f #bar = 123 + + i An explicit or implicit semicolon is expected here... + + 18 │ as {}; + 19 │ f + > 20 │ satisfies {}; + │ ^ + 21 │ class C5 { + 22 │ protected specialFoo = f #bar = 123 + + i ...Which is required to end this statement + + 18 │ as {}; + 19 │ f + > 20 │ satisfies {}; + │ ^^^^^^^^^^^ + 21 │ class C5 { + 22 │ protected specialFoo = f #bar = 123 + +ts_instantiation_expressions_1.ts:22:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Private names are only allowed on the left side of a 'in' expression + + 20 │ satisfies {}; + 21 │ class C5 { + > 22 │ protected specialFoo = f #bar = 123 + │ ^^^^ + 23 │ } + 24 │ for (const a = b.test in []) {} + +ts_instantiation_expressions_1.ts:22:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `f #bar` + + 20 │ satisfies {}; + 21 │ class C5 { + > 22 │ protected specialFoo = f #bar = 123 + │ ^^^^^^^^^^^^^^ + 23 │ } + 24 │ for (const a = b.test in []) {} + + i This expression cannot be assigned to + +ts_instantiation_expressions_1.ts:24:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 22 │ protected specialFoo = f #bar = 123 + 23 │ } + > 24 │ for (const a = b.test in []) {} + │ ^^^^^^^^^^^^^^^^ + 25 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap new file mode 100644 index 000000000000..1c35be9d9fd3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap @@ -0,0 +1,271 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A {} +interface B implements A {} +interface C extends A extends B {} +interface D extends {} +interface E extends A, {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@12..13 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@13..14 "}" [] [], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@25..27 "B" [] [Whitespace(" ")], + }, + TsImplementsClause { + implements_token: IMPLEMENTS_KW@27..38 "implements" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@38..40 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + L_CURLY@40..41 "{" [] [], + TsTypeMemberList [], + R_CURLY@41..42 "}" [] [], + ], + }, + JsBogusStatement { + items: [ + INTERFACE_KW@42..53 "interface" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@53..55 "C" [] [Whitespace(" ")], + }, + TsExtendsClause { + extends_token: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@63..65 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + TsExtendsClause { + extends_token: EXTENDS_KW@65..73 "extends" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@73..75 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + L_CURLY@75..76 "{" [] [], + TsTypeMemberList [], + R_CURLY@76..77 "}" [] [], + ], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@77..88 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@88..90 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: TsExtendsClause { + extends_token: EXTENDS_KW@90..98 "extends" [] [Whitespace(" ")], + types: TsTypeList [], + }, + l_curly_token: L_CURLY@98..99 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@99..100 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@100..111 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@111..113 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: TsExtendsClause { + extends_token: EXTENDS_KW@113..121 "extends" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@121..122 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@122..124 "," [] [Whitespace(" ")], + missing element, + ], + }, + l_curly_token: L_CURLY@124..125 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + ], + eof_token: EOF@126..127 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..127 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..126 + 0: TS_INTERFACE_DECLARATION@0..14 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@12..13 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@13..13 + 6: R_CURLY@13..14 "}" [] [] + 1: JS_BOGUS_STATEMENT@14..42 + 0: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "B" [] [Whitespace(" ")] + 2: TS_IMPLEMENTS_CLAUSE@27..40 + 0: IMPLEMENTS_KW@27..38 "implements" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@38..40 + 0: TS_REFERENCE_TYPE@38..40 + 0: JS_REFERENCE_IDENTIFIER@38..40 + 0: IDENT@38..40 "A" [] [Whitespace(" ")] + 1: (empty) + 3: L_CURLY@40..41 "{" [] [] + 4: TS_TYPE_MEMBER_LIST@41..41 + 5: R_CURLY@41..42 "}" [] [] + 2: JS_BOGUS_STATEMENT@42..77 + 0: INTERFACE_KW@42..53 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@53..55 + 0: IDENT@53..55 "C" [] [Whitespace(" ")] + 2: TS_EXTENDS_CLAUSE@55..65 + 0: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@63..65 + 0: TS_REFERENCE_TYPE@63..65 + 0: JS_REFERENCE_IDENTIFIER@63..65 + 0: IDENT@63..65 "A" [] [Whitespace(" ")] + 1: (empty) + 3: TS_EXTENDS_CLAUSE@65..75 + 0: EXTENDS_KW@65..73 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@73..75 + 0: TS_REFERENCE_TYPE@73..75 + 0: JS_REFERENCE_IDENTIFIER@73..75 + 0: IDENT@73..75 "B" [] [Whitespace(" ")] + 1: (empty) + 4: L_CURLY@75..76 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@76..76 + 6: R_CURLY@76..77 "}" [] [] + 3: TS_INTERFACE_DECLARATION@77..100 + 0: INTERFACE_KW@77..88 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@88..90 + 0: IDENT@88..90 "D" [] [Whitespace(" ")] + 2: (empty) + 3: TS_EXTENDS_CLAUSE@90..98 + 0: EXTENDS_KW@90..98 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@98..98 + 4: L_CURLY@98..99 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@99..99 + 6: R_CURLY@99..100 "}" [] [] + 4: TS_INTERFACE_DECLARATION@100..126 + 0: INTERFACE_KW@100..111 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@111..113 + 0: IDENT@111..113 "E" [] [Whitespace(" ")] + 2: (empty) + 3: TS_EXTENDS_CLAUSE@113..124 + 0: EXTENDS_KW@113..121 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@121..124 + 0: TS_REFERENCE_TYPE@121..122 + 0: JS_REFERENCE_IDENTIFIER@121..122 + 0: IDENT@121..122 "A" [] [] + 1: (empty) + 1: COMMA@122..124 "," [] [Whitespace(" ")] + 2: (empty) + 4: L_CURLY@124..125 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@125..125 + 6: R_CURLY@125..126 "}" [] [] + 4: EOF@126..127 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_interface_heritage_clause_error.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Interface declaration cannot have 'implements' clause. + + 1 │ interface A {} + > 2 │ interface B implements A {} + │ ^^^^^^^^^^^^ + 3 │ interface C extends A extends B {} + 4 │ interface D extends {} + +ts_interface_heritage_clause_error.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'extends' clause already seen. + + 1 │ interface A {} + 2 │ interface B implements A {} + > 3 │ interface C extends A extends B {} + │ ^^^^^^^^^ + 4 │ interface D extends {} + 5 │ interface E extends A, {} + + i first 'extends' clause + + 1 │ interface A {} + 2 │ interface B implements A {} + > 3 │ interface C extends A extends B {} + │ ^^^^^^^^^ + 4 │ interface D extends {} + 5 │ interface E extends A, {} + +ts_interface_heritage_clause_error.ts:4:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'extends' list cannot be empty. + + 2 │ interface B implements A {} + 3 │ interface C extends A extends B {} + > 4 │ interface D extends {} + │ + 5 │ interface E extends A, {} + 6 │ + +ts_interface_heritage_clause_error.ts:5:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Trailing comma not allowed. + + 3 │ interface C extends A extends B {} + 4 │ interface D extends {} + > 5 │ interface E extends A, {} + │ ^ + 6 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap new file mode 100644 index 000000000000..d43fc757ba0d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap @@ -0,0 +1,464 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class Test { + @test constructor() {} + @test declare prop; + @test method(); + @test [index: string]: string; + @test abstract method2(); + @test abstract get getter(); + @test abstract set setter(val); +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..20 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@20..21 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@21..25 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@25..30 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + JsLiteralMemberName { + value: IDENT@30..41 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@41..42 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@44..45 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@45..46 "}" [] [], + }, + ], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + JsDecorator { + at_token: AT@46..50 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@50..55 "test" [] [Whitespace(" ")], + }, + }, + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@55..63 "declare" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@63..67 "prop" [] [], + }, + property_annotation: missing (optional), + semicolon_token: SEMICOLON@67..68 ";" [] [], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@68..72 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@72..77 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + JsLiteralMemberName { + value: IDENT@77..83 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@83..84 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@84..85 ")" [] [], + }, + SEMICOLON@85..86 ";" [] [], + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + JsDecorator { + at_token: AT@86..90 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@90..95 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + L_BRACK@95..96 "[" [] [], + TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@96..101 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@101..103 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@103..109 "string" [] [], + }, + }, + }, + R_BRACK@109..110 "]" [] [], + TsTypeAnnotation { + colon_token: COLON@110..112 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@112..118 "string" [] [], + }, + }, + SEMICOLON@118..119 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@119..123 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@123..128 "test" [] [Whitespace(" ")], + }, + }, + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@128..137 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@137..144 "method2" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@144..145 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@145..146 ")" [] [], + }, + SEMICOLON@146..147 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@147..151 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@151..156 "test" [] [Whitespace(" ")], + }, + }, + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")], + }, + ], + GET_KW@165..169 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@169..175 "getter" [] [], + }, + L_PAREN@175..176 "(" [] [], + R_PAREN@176..177 ")" [] [], + SEMICOLON@177..178 ";" [] [], + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsDecorator { + at_token: AT@178..182 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@182..187 "test" [] [Whitespace(" ")], + }, + }, + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@187..196 "abstract" [] [Whitespace(" ")], + }, + ], + SET_KW@196..200 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@200..206 "setter" [] [], + }, + L_PAREN@206..207 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@207..210 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + R_PAREN@210..211 ")" [] [], + SEMICOLON@211..212 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@212..214 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@214..215 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..215 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..214 + 0: JS_CLASS_DECLARATION@0..214 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..20 + 0: IDENT@15..20 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@20..21 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@21..212 + 0: JS_BOGUS_MEMBER@21..46 + 0: JS_BOGUS@21..30 + 0: JS_DECORATOR@21..30 + 0: AT@21..25 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@25..30 + 0: JS_REFERENCE_IDENTIFIER@25..30 + 0: IDENT@25..30 "test" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@30..41 + 0: IDENT@30..41 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@41..44 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@42..42 + 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@44..46 + 0: L_CURLY@44..45 "{" [] [] + 1: JS_DIRECTIVE_LIST@45..45 + 2: JS_STATEMENT_LIST@45..45 + 3: R_CURLY@45..46 "}" [] [] + 1: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@46..68 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@46..63 + 0: JS_DECORATOR@46..55 + 0: AT@46..50 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@50..55 + 0: JS_REFERENCE_IDENTIFIER@50..55 + 0: IDENT@50..55 "test" [] [Whitespace(" ")] + 1: TS_DECLARE_MODIFIER@55..63 + 0: DECLARE_KW@55..63 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@63..67 + 0: IDENT@63..67 "prop" [] [] + 2: (empty) + 3: SEMICOLON@67..68 ";" [] [] + 2: JS_BOGUS_MEMBER@68..86 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@68..77 + 0: JS_DECORATOR@68..77 + 0: AT@68..72 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@72..77 + 0: JS_REFERENCE_IDENTIFIER@72..77 + 0: IDENT@72..77 "test" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@77..83 + 0: IDENT@77..83 "method" [] [] + 2: JS_PARAMETERS@83..85 + 0: L_PAREN@83..84 "(" [] [] + 1: JS_PARAMETER_LIST@84..84 + 2: R_PAREN@84..85 ")" [] [] + 3: SEMICOLON@85..86 ";" [] [] + 3: JS_BOGUS_MEMBER@86..119 + 0: JS_BOGUS@86..95 + 0: JS_DECORATOR@86..95 + 0: AT@86..90 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@90..95 + 0: JS_REFERENCE_IDENTIFIER@90..95 + 0: IDENT@90..95 "test" [] [Whitespace(" ")] + 1: L_BRACK@95..96 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@96..109 + 0: JS_IDENTIFIER_BINDING@96..101 + 0: IDENT@96..101 "index" [] [] + 1: TS_TYPE_ANNOTATION@101..109 + 0: COLON@101..103 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@103..109 + 0: STRING_KW@103..109 "string" [] [] + 3: R_BRACK@109..110 "]" [] [] + 4: TS_TYPE_ANNOTATION@110..118 + 0: COLON@110..112 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@112..118 + 0: STRING_KW@112..118 "string" [] [] + 5: SEMICOLON@118..119 ";" [] [] + 4: JS_BOGUS_MEMBER@119..147 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@119..137 + 0: JS_DECORATOR@119..128 + 0: AT@119..123 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@123..128 + 0: JS_REFERENCE_IDENTIFIER@123..128 + 0: IDENT@123..128 "test" [] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@128..137 + 0: ABSTRACT_KW@128..137 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@137..144 + 0: IDENT@137..144 "method2" [] [] + 2: JS_PARAMETERS@144..146 + 0: L_PAREN@144..145 "(" [] [] + 1: JS_PARAMETER_LIST@145..145 + 2: R_PAREN@145..146 ")" [] [] + 3: SEMICOLON@146..147 ";" [] [] + 5: JS_BOGUS_MEMBER@147..178 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@147..165 + 0: JS_DECORATOR@147..156 + 0: AT@147..151 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@151..156 + 0: JS_REFERENCE_IDENTIFIER@151..156 + 0: IDENT@151..156 "test" [] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@156..165 + 0: ABSTRACT_KW@156..165 "abstract" [] [Whitespace(" ")] + 1: GET_KW@165..169 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@169..175 + 0: IDENT@169..175 "getter" [] [] + 3: L_PAREN@175..176 "(" [] [] + 4: R_PAREN@176..177 ")" [] [] + 5: SEMICOLON@177..178 ";" [] [] + 6: JS_BOGUS_MEMBER@178..212 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@178..196 + 0: JS_DECORATOR@178..187 + 0: AT@178..182 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@182..187 + 0: JS_REFERENCE_IDENTIFIER@182..187 + 0: IDENT@182..187 "test" [] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@187..196 + 0: ABSTRACT_KW@187..196 "abstract" [] [Whitespace(" ")] + 1: SET_KW@196..200 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@200..206 + 0: IDENT@200..206 "setter" [] [] + 3: L_PAREN@206..207 "(" [] [] + 4: JS_FORMAL_PARAMETER@207..210 + 0: JS_DECORATOR_LIST@207..207 + 1: JS_IDENTIFIER_BINDING@207..210 + 0: IDENT@207..210 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: R_PAREN@210..211 ")" [] [] + 6: SEMICOLON@211..212 ";" [] [] + 9: R_CURLY@212..214 "}" [Newline("\n")] [] + 4: EOF@214..215 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_invalid_decorated_class_members.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 1 │ abstract class Test { + > 2 │ @test constructor() {} + │ ^^^^^ + 3 │ @test declare prop; + 4 │ @test method(); + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_invalid_decorated_class_members.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 2 │ @test constructor() {} + 3 │ @test declare prop; + > 4 │ @test method(); + │ ^^^^^ + 5 │ @test [index: string]: string; + 6 │ @test abstract method2(); + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_invalid_decorated_class_members.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 3 │ @test declare prop; + 4 │ @test method(); + > 5 │ @test [index: string]: string; + │ ^^^^^ + 6 │ @test abstract method2(); + 7 │ @test abstract get getter(); + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_invalid_decorated_class_members.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 4 │ @test method(); + 5 │ @test [index: string]: string; + > 6 │ @test abstract method2(); + │ ^^^^^ + 7 │ @test abstract get getter(); + 8 │ @test abstract set setter(val); + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_invalid_decorated_class_members.ts:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 5 │ @test [index: string]: string; + 6 │ @test abstract method2(); + > 7 │ @test abstract get getter(); + │ ^^^^^ + 8 │ @test abstract set setter(val); + 9 │ } + + i Decorators are only valid on class declarations, class expressions, and class methods. + +ts_invalid_decorated_class_members.ts:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Decorators are not valid here. + + 6 │ @test abstract method2(); + 7 │ @test abstract get getter(); + > 8 │ @test abstract set setter(val); + │ ^^^^^ + 9 │ } + 10 │ + + i Decorators are only valid on class declarations, class expressions, and class methods. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap new file mode 100644 index 000000000000..dd39e2a41e61 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap @@ -0,0 +1,253 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + constructor() method() get test() + set test(value) +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@29..30 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + body: missing (required), + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@32..38 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: missing (required), + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@41..45 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@45..49 "test" [] [], + }, + l_paren_token: L_PAREN@49..50 "(" [] [], + r_paren_token: R_PAREN@50..51 ")" [] [], + return_type: missing (optional), + body: missing (required), + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@51..61 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@61..65 "test" [] [], + }, + l_paren_token: L_PAREN@65..66 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@66..71 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@71..72 ")" [] [], + body: missing (required), + }, + ], + r_curly_token: R_CURLY@72..74 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: JS_CLASS_DECLARATION@0..74 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..72 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@12..32 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@12..12 + 1: JS_LITERAL_MEMBER_NAME@12..29 + 0: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@29..32 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@30..30 + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 3: (empty) + 1: JS_METHOD_CLASS_MEMBER@32..41 + 0: JS_METHOD_MODIFIER_LIST@32..32 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@32..38 + 0: IDENT@32..38 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@38..41 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..39 + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 7: (empty) + 8: (empty) + 2: JS_GETTER_CLASS_MEMBER@41..51 + 0: JS_METHOD_MODIFIER_LIST@41..41 + 1: GET_KW@41..45 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@45..49 + 0: IDENT@45..49 "test" [] [] + 3: L_PAREN@49..50 "(" [] [] + 4: R_PAREN@50..51 ")" [] [] + 5: (empty) + 6: (empty) + 3: JS_SETTER_CLASS_MEMBER@51..72 + 0: JS_METHOD_MODIFIER_LIST@51..51 + 1: SET_KW@51..61 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@61..65 + 0: IDENT@61..65 "test" [] [] + 3: L_PAREN@65..66 "(" [] [] + 4: JS_FORMAL_PARAMETER@66..71 + 0: JS_DECORATOR_LIST@66..66 + 1: JS_IDENTIFIER_BINDING@66..71 + 0: IDENT@66..71 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@71..72 ")" [] [] + 7: (empty) + 9: R_CURLY@72..74 "}" [Newline("\n")] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_method_members_with_missing_body.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found 'method'. + + 1 │ class Test { + > 2 │ constructor() method() get test() + │ ^^^^^^ + 3 │ set test(value) + 4 │ } + + i Expected a class method body here. + + 1 │ class Test { + > 2 │ constructor() method() get test() + │ ^^^^^^ + 3 │ set test(value) + 4 │ } + +ts_method_members_with_missing_body.ts:2:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found 'get'. + + 1 │ class Test { + > 2 │ constructor() method() get test() + │ ^^^ + 3 │ set test(value) + 4 │ } + + i Expected a class method body here. + + 1 │ class Test { + > 2 │ constructor() method() get test() + │ ^^^ + 3 │ set test(value) + 4 │ } + +ts_method_members_with_missing_body.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found 'set'. + + 1 │ class Test { + 2 │ constructor() method() get test() + > 3 │ set test(value) + │ ^^^ + 4 │ } + 5 │ + + i Expected a class method body here. + + 1 │ class Test { + 2 │ constructor() method() get test() + > 3 │ set test(value) + │ ^^^ + 4 │ } + 5 │ + +ts_method_members_with_missing_body.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class method body but instead found '}'. + + 2 │ constructor() method() get test() + 3 │ set test(value) + > 4 │ } + │ ^ + 5 │ + + i Expected a class method body here. + + 2 │ constructor() method() get test() + 3 │ set test(value) + > 4 │ } + │ ^ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap new file mode 100644 index 000000000000..70353ea83bb6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap @@ -0,0 +1,363 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ + x<>(maybeA: any): maybeA is A { return true }, + async *id<>(param: Promise): AsyncIterableIterator { yield await param }, +}) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..2 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@9..10 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@11..17 "maybeA" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@17..19 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@19..22 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@22..23 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@25..32 "maybeA" [] [Whitespace(" ")], + }, + is_token: IS_KW@32..35 "is" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@35..37 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@37..39 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@39..46 "return" [] [Whitespace(" ")], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@46..51 "true" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + }, + COMMA@52..53 "," [] [], + JsMethodObjectMember { + async_token: ASYNC_KW@53..64 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: STAR@64..65 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@65..67 "id" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@67..68 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@68..69 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@69..70 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@70..75 "param" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@75..77 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@77..84 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@84..85 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@85..86 "R" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@86..87 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@87..88 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@88..90 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@90..111 "AsyncIterableIterator" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@111..112 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@112..113 "R" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@113..115 ">" [] [Whitespace(" ")], + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@115..117 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@117..123 "yield" [] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: missing (optional), + expression: JsAwaitExpression { + await_token: AWAIT_KW@123..129 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@129..135 "param" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@135..136 "}" [] [], + }, + }, + COMMA@136..137 "," [] [], + ], + r_curly_token: R_CURLY@137..139 "}" [Newline("\n")] [], + }, + r_paren_token: R_PAREN@139..140 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@140..141 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..141 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..140 + 0: JS_EXPRESSION_STATEMENT@0..140 + 0: JS_PARENTHESIZED_EXPRESSION@0..140 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..139 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@2..137 + 0: JS_METHOD_OBJECT_MEMBER@2..52 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@2..8 + 0: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [] + 3: TS_TYPE_PARAMETERS@8..10 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..9 + 2: R_ANGLE@9..10 ">" [] [] + 4: JS_PARAMETERS@10..23 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..22 + 0: JS_FORMAL_PARAMETER@11..22 + 0: JS_DECORATOR_LIST@11..11 + 1: JS_IDENTIFIER_BINDING@11..17 + 0: IDENT@11..17 "maybeA" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@17..22 + 0: COLON@17..19 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@19..22 + 0: ANY_KW@19..22 "any" [] [] + 4: (empty) + 2: R_PAREN@22..23 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@23..37 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@25..37 + 0: JS_REFERENCE_IDENTIFIER@25..32 + 0: IDENT@25..32 "maybeA" [] [Whitespace(" ")] + 1: IS_KW@32..35 "is" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@35..37 + 0: JS_REFERENCE_IDENTIFIER@35..37 + 0: IDENT@35..37 "A" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@37..52 + 0: L_CURLY@37..39 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@39..39 + 2: JS_STATEMENT_LIST@39..51 + 0: JS_RETURN_STATEMENT@39..51 + 0: RETURN_KW@39..46 "return" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@46..51 + 0: TRUE_KW@46..51 "true" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@51..52 "}" [] [] + 1: COMMA@52..53 "," [] [] + 2: JS_METHOD_OBJECT_MEMBER@53..136 + 0: ASYNC_KW@53..64 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: STAR@64..65 "*" [] [] + 2: JS_LITERAL_MEMBER_NAME@65..67 + 0: IDENT@65..67 "id" [] [] + 3: TS_TYPE_PARAMETERS@67..69 + 0: L_ANGLE@67..68 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@68..68 + 2: R_ANGLE@68..69 ">" [] [] + 4: JS_PARAMETERS@69..88 + 0: L_PAREN@69..70 "(" [] [] + 1: JS_PARAMETER_LIST@70..87 + 0: JS_FORMAL_PARAMETER@70..87 + 0: JS_DECORATOR_LIST@70..70 + 1: JS_IDENTIFIER_BINDING@70..75 + 0: IDENT@70..75 "param" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@75..87 + 0: COLON@75..77 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@77..87 + 0: JS_REFERENCE_IDENTIFIER@77..84 + 0: IDENT@77..84 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@84..87 + 0: L_ANGLE@84..85 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@85..86 + 0: TS_REFERENCE_TYPE@85..86 + 0: JS_REFERENCE_IDENTIFIER@85..86 + 0: IDENT@85..86 "R" [] [] + 1: (empty) + 2: R_ANGLE@86..87 ">" [] [] + 4: (empty) + 2: R_PAREN@87..88 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@88..115 + 0: COLON@88..90 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@90..115 + 0: JS_REFERENCE_IDENTIFIER@90..111 + 0: IDENT@90..111 "AsyncIterableIterator" [] [] + 1: TS_TYPE_ARGUMENTS@111..115 + 0: L_ANGLE@111..112 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@112..113 + 0: TS_REFERENCE_TYPE@112..113 + 0: JS_REFERENCE_IDENTIFIER@112..113 + 0: IDENT@112..113 "R" [] [] + 1: (empty) + 2: R_ANGLE@113..115 ">" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@115..136 + 0: L_CURLY@115..117 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@117..117 + 2: JS_STATEMENT_LIST@117..135 + 0: JS_EXPRESSION_STATEMENT@117..135 + 0: JS_YIELD_EXPRESSION@117..135 + 0: YIELD_KW@117..123 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@123..135 + 0: (empty) + 1: JS_AWAIT_EXPRESSION@123..135 + 0: AWAIT_KW@123..129 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@129..135 + 0: JS_REFERENCE_IDENTIFIER@129..135 + 0: IDENT@129..135 "param" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@135..136 "}" [] [] + 3: COMMA@136..137 "," [] [] + 2: R_CURLY@137..139 "}" [Newline("\n")] [] + 2: R_PAREN@139..140 ")" [] [] + 1: (empty) + 4: EOF@140..141 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_method_object_member_body_error.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ ({ + > 2 │ x<>(maybeA: any): maybeA is A { return true }, + │ ^ + 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, + 4 │ }) + + i Expected a type parameter here. + + 1 │ ({ + > 2 │ x<>(maybeA: any): maybeA is A { return true }, + │ ^ + 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, + 4 │ }) + +ts_method_object_member_body_error.ts:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ ({ + 2 │ x<>(maybeA: any): maybeA is A { return true }, + > 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, + │ ^ + 4 │ }) + 5 │ + + i Expected a type parameter here. + + 1 │ ({ + 2 │ x<>(maybeA: any): maybeA is A { return true }, + > 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, + │ ^ + 4 │ }) + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts.snap new file mode 100644 index 000000000000..ce850fa521fa --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts.snap @@ -0,0 +1,283 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { * method(); } +abstract class B { abstract * method(); } +class C { + * overload(); + * overload() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + STAR@18..20 "*" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@20..26 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@26..27 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@27..28 ")" [] [], + }, + SEMICOLON@28..30 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@31..41 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@41..47 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@47..49 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@49..51 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@51..60 "abstract" [] [Whitespace(" ")], + }, + ], + STAR@60..62 "*" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@62..68 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@68..69 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@69..70 ")" [] [], + }, + SEMICOLON@70..72 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@72..73 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@73..80 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@80..82 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@82..83 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + STAR@83..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@91..99 "overload" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@99..100 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@100..101 ")" [] [], + }, + SEMICOLON@101..102 ";" [] [], + ], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: STAR@102..110 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@110..118 "overload" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@118..119 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@119..121 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@121..122 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@122..123 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@123..125 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@125..126 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..126 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..125 + 0: TS_DECLARE_STATEMENT@0..31 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..31 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..30 + 0: JS_BOGUS_MEMBER@18..30 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@18..18 + 1: STAR@18..20 "*" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@20..26 + 0: IDENT@20..26 "method" [] [] + 3: JS_PARAMETERS@26..28 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_PARAMETER_LIST@27..27 + 2: R_PAREN@27..28 ")" [] [] + 4: SEMICOLON@28..30 ";" [] [Whitespace(" ")] + 9: R_CURLY@30..31 "}" [] [] + 1: JS_CLASS_DECLARATION@31..73 + 0: JS_DECORATOR_LIST@31..31 + 1: ABSTRACT_KW@31..41 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@41..47 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@47..49 + 0: IDENT@47..49 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@49..51 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@51..72 + 0: JS_BOGUS_MEMBER@51..72 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@51..60 + 0: TS_ABSTRACT_MODIFIER@51..60 + 0: ABSTRACT_KW@51..60 "abstract" [] [Whitespace(" ")] + 1: STAR@60..62 "*" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@62..68 + 0: IDENT@62..68 "method" [] [] + 3: JS_PARAMETERS@68..70 + 0: L_PAREN@68..69 "(" [] [] + 1: JS_PARAMETER_LIST@69..69 + 2: R_PAREN@69..70 ")" [] [] + 4: SEMICOLON@70..72 ";" [] [Whitespace(" ")] + 9: R_CURLY@72..73 "}" [] [] + 2: JS_CLASS_DECLARATION@73..125 + 0: JS_DECORATOR_LIST@73..73 + 1: (empty) + 2: CLASS_KW@73..80 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@80..82 + 0: IDENT@80..82 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@82..83 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@83..123 + 0: JS_BOGUS_MEMBER@83..102 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@83..83 + 1: STAR@83..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@91..99 + 0: IDENT@91..99 "overload" [] [] + 3: JS_PARAMETERS@99..101 + 0: L_PAREN@99..100 "(" [] [] + 1: JS_PARAMETER_LIST@100..100 + 2: R_PAREN@100..101 ")" [] [] + 4: SEMICOLON@101..102 ";" [] [] + 1: JS_METHOD_CLASS_MEMBER@102..123 + 0: JS_METHOD_MODIFIER_LIST@102..102 + 1: (empty) + 2: STAR@102..110 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@110..118 + 0: IDENT@110..118 "overload" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@118..121 + 0: L_PAREN@118..119 "(" [] [] + 1: JS_PARAMETER_LIST@119..119 + 2: R_PAREN@119..121 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@121..123 + 0: L_CURLY@121..122 "{" [] [] + 1: JS_DIRECTIVE_LIST@122..122 + 2: JS_STATEMENT_LIST@122..122 + 3: R_CURLY@122..123 "}" [] [] + 9: R_CURLY@123..125 "}" [Newline("\n")] [] + 4: EOF@125..126 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_method_signature_generator.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A method signature cannot be declared as a generator. + + > 1 │ declare class A { * method(); } + │ ^^^^^^^^^^^ + 2 │ abstract class B { abstract * method(); } + 3 │ class C { + +ts_method_signature_generator.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A method signature cannot be declared as a generator. + + 1 │ declare class A { * method(); } + > 2 │ abstract class B { abstract * method(); } + │ ^^^^^^^^^^^^^^^^^^^^ + 3 │ class C { + 4 │ * overload(); + +ts_method_signature_generator.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A method signature cannot be declared as a generator. + + 2 │ abstract class B { abstract * method(); } + 3 │ class C { + > 4 │ * overload(); + │ ^^^^^^^^^^^^^ + 5 │ * overload() {} + 6 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_module_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_module_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts.snap new file mode 100644 index 000000000000..0acb392aae7a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts.snap @@ -0,0 +1,135 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a; // missing body +declare module "a" declare module "b"; // missing semi + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + body: missing (required), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@16..33 ";" [] [Whitespace(" "), Comments("// missing body")], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@33..42 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@42..49 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@49..53 "\"a\"" [] [Whitespace(" ")], + }, + body: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@53..61 "declare" [] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@61..68 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@68..71 "\"b\"" [] [], + }, + body: TsEmptyExternalModuleDeclarationBody { + semicolon_token: SEMICOLON@71..88 ";" [] [Whitespace(" "), Comments("// missing semi")], + }, + }, + }, + ], + eof_token: EOF@88..89 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..89 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..88 + 0: TS_DECLARE_STATEMENT@0..16 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..16 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 2: (empty) + 1: JS_EMPTY_STATEMENT@16..33 + 0: SEMICOLON@16..33 ";" [] [Whitespace(" "), Comments("// missing body")] + 2: TS_DECLARE_STATEMENT@33..53 + 0: DECLARE_KW@33..42 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@42..53 + 0: MODULE_KW@42..49 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@49..53 + 0: JS_STRING_LITERAL@49..53 "\"a\"" [] [Whitespace(" ")] + 2: (empty) + 3: TS_DECLARE_STATEMENT@53..88 + 0: DECLARE_KW@53..61 "declare" [] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@61..88 + 0: MODULE_KW@61..68 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@68..71 + 0: JS_STRING_LITERAL@68..71 "\"b\"" [] [] + 2: TS_EMPTY_EXTERNAL_MODULE_DECLARATION_BODY@71..88 + 0: SEMICOLON@71..88 ";" [] [Whitespace(" "), Comments("// missing semi")] + 4: EOF@88..89 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_module_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `{` but instead found `;` + + > 1 │ declare module a; // missing body + │ ^ + 2 │ declare module "a" declare module "b"; // missing semi + 3 │ + + i Remove ; + +ts_module_err.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ declare module a; // missing body + > 2 │ declare module "a" declare module "b"; // missing semi + │ ^^^^^^^ + 3 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ declare module a; // missing body + > 2 │ declare module "a" declare module "b"; // missing semi + │ ^^^^^^^ + 3 │ + + i ...Which is required to end this statement + + 1 │ declare module a; // missing body + > 2 │ declare module "a" declare module "b"; // missing semi + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap new file mode 100644 index 000000000000..635b990767b4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap @@ -0,0 +1,317 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import { default } from "./mod"; +import { type default } from "./mod"; +import { "literal-name" } from "./mod"; +import { type "literal-name" } from "./mod"; +import { + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@9..17 "default" [] [Whitespace(" ")], + }, + as_token: missing (required), + local_name: missing (required), + }, + ], + r_curly_token: R_CURLY@17..19 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@19..24 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@24..31 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@40..42 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: TYPE_KW@42..47 "type" [] [Whitespace(" ")], + name: JsLiteralExportName { + value: IDENT@47..55 "default" [] [Whitespace(" ")], + }, + as_token: missing (required), + local_name: missing (required), + }, + ], + r_curly_token: R_CURLY@55..57 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@57..62 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@62..69 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: JS_STRING_LITERAL@80..95 "\"literal-name\"" [] [Whitespace(" ")], + }, + as_token: missing (required), + local_name: missing (required), + }, + ], + r_curly_token: R_CURLY@95..97 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@97..102 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@102..109 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@109..110 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@110..118 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: TYPE_KW@120..125 "type" [] [Whitespace(" ")], + name: JsLiteralExportName { + value: JS_STRING_LITERAL@125..140 "\"literal-name\"" [] [Whitespace(" ")], + }, + as_token: missing (required), + local_name: missing (required), + }, + ], + r_curly_token: R_CURLY@140..142 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@142..147 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@147..154 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@154..155 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@155..163 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@163..164 "{" [] [], + specifiers: JsNamedImportSpecifierList [], + r_curly_token: missing (required), + }, + from_token: missing (required), + source: missing (required), + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@164..165 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..165 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..164 + 0: JS_IMPORT@0..32 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@7..31 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@7..19 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..17 + 0: JS_NAMED_IMPORT_SPECIFIER@9..17 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@9..17 + 0: IDENT@9..17 "default" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@17..19 "}" [] [Whitespace(" ")] + 2: FROM_KW@19..24 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@24..31 + 0: JS_STRING_LITERAL@24..31 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@31..32 ";" [] [] + 1: JS_IMPORT@32..70 + 0: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@40..69 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@40..57 + 0: L_CURLY@40..42 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@42..55 + 0: JS_NAMED_IMPORT_SPECIFIER@42..55 + 0: TYPE_KW@42..47 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@47..55 + 0: IDENT@47..55 "default" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@55..57 "}" [] [Whitespace(" ")] + 2: FROM_KW@57..62 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@62..69 + 0: JS_STRING_LITERAL@62..69 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@69..70 ";" [] [] + 2: JS_IMPORT@70..110 + 0: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@78..109 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@78..97 + 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@80..95 + 0: JS_NAMED_IMPORT_SPECIFIER@80..95 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@80..95 + 0: JS_STRING_LITERAL@80..95 "\"literal-name\"" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@95..97 "}" [] [Whitespace(" ")] + 2: FROM_KW@97..102 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@102..109 + 0: JS_STRING_LITERAL@102..109 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@109..110 ";" [] [] + 3: JS_IMPORT@110..155 + 0: IMPORT_KW@110..118 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@118..154 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@118..142 + 0: L_CURLY@118..120 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@120..140 + 0: JS_NAMED_IMPORT_SPECIFIER@120..140 + 0: TYPE_KW@120..125 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@125..140 + 0: JS_STRING_LITERAL@125..140 "\"literal-name\"" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 2: R_CURLY@140..142 "}" [] [Whitespace(" ")] + 2: FROM_KW@142..147 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@147..154 + 0: JS_STRING_LITERAL@147..154 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@154..155 ";" [] [] + 4: JS_IMPORT@155..164 + 0: IMPORT_KW@155..163 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@163..164 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@163..164 + 0: L_CURLY@163..164 "{" [] [] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@164..164 + 2: (empty) + 2: (empty) + 3: (empty) + 4: (empty) + 2: (empty) + 4: EOF@164..165 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_named_import_specifier_error.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `}` + + > 1 │ import { default } from "./mod"; + │ ^ + 2 │ import { type default } from "./mod"; + 3 │ import { "literal-name" } from "./mod"; + + i Remove } + +ts_named_import_specifier_error.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `}` + + 1 │ import { default } from "./mod"; + > 2 │ import { type default } from "./mod"; + │ ^ + 3 │ import { "literal-name" } from "./mod"; + 4 │ import { type "literal-name" } from "./mod"; + + i Remove } + +ts_named_import_specifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `}` + + 1 │ import { default } from "./mod"; + 2 │ import { type default } from "./mod"; + > 3 │ import { "literal-name" } from "./mod"; + │ ^ + 4 │ import { type "literal-name" } from "./mod"; + 5 │ import { + + i Remove } + +ts_named_import_specifier_error.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `as` but instead found `}` + + 2 │ import { type default } from "./mod"; + 3 │ import { "literal-name" } from "./mod"; + > 4 │ import { type "literal-name" } from "./mod"; + │ ^ + 5 │ import { + 6 │ + + i Remove } + +ts_named_import_specifier_error.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead the file ends + + 4 │ import { type "literal-name" } from "./mod"; + 5 │ import { + > 6 │ + │ + + i the file ends here + + 4 │ import { type "literal-name" } from "./mod"; + 5 │ import { + > 6 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_new_operator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_new_operator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts.snap new file mode 100644 index 000000000000..307a8cb0d5e6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts.snap @@ -0,0 +1,117 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +new A(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNewExpression { + new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..5 "A" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + operator_token: L_ANGLE@5..6 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@6..10 "test" [] [], + }, + }, + }, + operator_token: R_ANGLE@10..11 ">" [] [], + right: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@11..12 "<" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@12..16 "test" [] [], + }, + type_arguments: missing (optional), + }, + r_angle_token: R_ANGLE@16..17 ">" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@17..18 "(" [] [], + expression: missing (required), + r_paren_token: R_PAREN@18..19 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: JS_EXPRESSION_STATEMENT@0..20 + 0: JS_BINARY_EXPRESSION@0..19 + 0: JS_BINARY_EXPRESSION@0..10 + 0: JS_NEW_EXPRESSION@0..5 + 0: NEW_KW@0..4 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@4..5 + 0: JS_REFERENCE_IDENTIFIER@4..5 + 0: IDENT@4..5 "A" [] [] + 2: (empty) + 3: (empty) + 1: L_ANGLE@5..6 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@6..10 + 0: JS_REFERENCE_IDENTIFIER@6..10 + 0: IDENT@6..10 "test" [] [] + 1: R_ANGLE@10..11 ">" [] [] + 2: TS_TYPE_ASSERTION_EXPRESSION@11..19 + 0: L_ANGLE@11..12 "<" [] [] + 1: TS_REFERENCE_TYPE@12..16 + 0: JS_REFERENCE_IDENTIFIER@12..16 + 0: IDENT@12..16 "test" [] [] + 1: (empty) + 2: R_ANGLE@16..17 ">" [] [] + 3: JS_PARENTHESIZED_EXPRESSION@17..19 + 0: L_PAREN@17..18 "(" [] [] + 1: (empty) + 2: R_PAREN@18..19 ")" [] [] + 1: SEMICOLON@19..20 ";" [] [] + 4: EOF@20..21 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_new_operator.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parenthesized expression didnt contain anything + + > 1 │ new A(); + │ ^ + 2 │ + + i Expected an expression here + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap new file mode 100644 index 000000000000..be47faa80c3f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap @@ -0,0 +1,237 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ get a(): A {} }); +({ get a<>(): A {} }); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + GET_KW@3..7 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@7..8 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@9..10 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + L_PAREN@11..12 "(" [] [], + R_PAREN@12..13 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + r_paren_token: R_PAREN@21..22 ")" [] [], + }, + semicolon_token: SEMICOLON@22..23 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@23..25 "(" [Newline("\n")] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + GET_KW@27..31 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@31..32 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@32..33 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@33..34 ">" [] [], + }, + L_PAREN@34..35 "(" [] [], + R_PAREN@35..36 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@36..38 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@38..40 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@40..41 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@41..43 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + r_paren_token: R_PAREN@44..45 ")" [] [], + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + ], + eof_token: EOF@46..47 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..47 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..46 + 0: JS_EXPRESSION_STATEMENT@0..23 + 0: JS_PARENTHESIZED_EXPRESSION@0..22 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..21 + 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@3..20 + 0: JS_BOGUS_MEMBER@3..20 + 0: GET_KW@3..7 "get" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@7..8 + 0: IDENT@7..8 "a" [] [] + 2: TS_TYPE_PARAMETERS@8..11 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..10 + 0: TS_TYPE_PARAMETER@9..10 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 + 1: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@10..11 ">" [] [] + 3: L_PAREN@11..12 "(" [] [] + 4: R_PAREN@12..13 ")" [] [] + 5: TS_TYPE_ANNOTATION@13..17 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@15..17 + 0: JS_REFERENCE_IDENTIFIER@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@17..20 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..18 + 3: R_CURLY@18..20 "}" [] [Whitespace(" ")] + 2: R_CURLY@20..21 "}" [] [] + 2: R_PAREN@21..22 ")" [] [] + 1: SEMICOLON@22..23 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@23..46 + 0: JS_PARENTHESIZED_EXPRESSION@23..45 + 0: L_PAREN@23..25 "(" [Newline("\n")] [] + 1: JS_OBJECT_EXPRESSION@25..44 + 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@27..43 + 0: JS_BOGUS_MEMBER@27..43 + 0: GET_KW@27..31 "get" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@31..32 + 0: IDENT@31..32 "a" [] [] + 2: TS_TYPE_PARAMETERS@32..34 + 0: L_ANGLE@32..33 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@33..33 + 2: R_ANGLE@33..34 ">" [] [] + 3: L_PAREN@34..35 "(" [] [] + 4: R_PAREN@35..36 ")" [] [] + 5: TS_TYPE_ANNOTATION@36..40 + 0: COLON@36..38 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@38..40 + 0: JS_REFERENCE_IDENTIFIER@38..40 + 0: IDENT@38..40 "A" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@40..43 + 0: L_CURLY@40..41 "{" [] [] + 1: JS_DIRECTIVE_LIST@41..41 + 2: JS_STATEMENT_LIST@41..41 + 3: R_CURLY@41..43 "}" [] [Whitespace(" ")] + 2: R_CURLY@43..44 "}" [] [] + 2: R_PAREN@44..45 ")" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 4: EOF@46..47 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_object_getter_type_parameters.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + > 1 │ ({ get a(): A {} }); + │ ^^^ + 2 │ ({ get a<>(): A {} }); + 3 │ + +ts_object_getter_type_parameters.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ ({ get a(): A {} }); + > 2 │ ({ get a<>(): A {} }); + │ ^ + 3 │ + + i Expected a type parameter here. + + 1 │ ({ get a(): A {} }); + > 2 │ ({ get a<>(): A {} }); + │ ^ + 3 │ + +ts_object_getter_type_parameters.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + 1 │ ({ get a(): A {} }); + > 2 │ ({ get a<>(): A {} }); + │ ^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts.snap new file mode 100644 index 000000000000..29dfe6d89c2b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts.snap @@ -0,0 +1,132 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ set a(value: string): void {} }); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + SET_KW@3..7 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@7..8 "a" [] [], + }, + L_PAREN@8..9 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@9..14 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@14..16 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@16..22 "string" [] [], + }, + }, + initializer: missing (optional), + }, + R_PAREN@22..23 ")" [] [], + TsReturnTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@25..30 "void" [] [Whitespace(" ")], + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@30..31 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + r_paren_token: R_PAREN@34..35 ")" [] [], + }, + semicolon_token: SEMICOLON@35..36 ";" [] [], + }, + ], + eof_token: EOF@36..37 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..37 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..36 + 0: JS_EXPRESSION_STATEMENT@0..36 + 0: JS_PARENTHESIZED_EXPRESSION@0..35 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..34 + 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@3..33 + 0: JS_BOGUS_MEMBER@3..33 + 0: SET_KW@3..7 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@7..8 + 0: IDENT@7..8 "a" [] [] + 2: L_PAREN@8..9 "(" [] [] + 3: JS_FORMAL_PARAMETER@9..22 + 0: JS_DECORATOR_LIST@9..9 + 1: JS_IDENTIFIER_BINDING@9..14 + 0: IDENT@9..14 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@14..22 + 0: COLON@14..16 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@16..22 + 0: STRING_KW@16..22 "string" [] [] + 4: (empty) + 4: R_PAREN@22..23 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@23..30 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@25..30 + 0: VOID_KW@25..30 "void" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@30..33 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_DIRECTIVE_LIST@31..31 + 2: JS_STATEMENT_LIST@31..31 + 3: R_CURLY@31..33 "}" [] [Whitespace(" ")] + 2: R_CURLY@33..34 "}" [] [] + 2: R_PAREN@34..35 ")" [] [] + 1: SEMICOLON@35..36 ";" [] [] + 4: EOF@36..37 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_object_setter_return_type.ts:1:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A 'set' accessor cannot have a return type annotation. + + > 1 │ ({ set a(value: string): void {} }); + │ ^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap new file mode 100644 index 000000000000..57877709254d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap @@ -0,0 +1,265 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ set a(value: A) {} }); +({ set a<>(value: A) {} }); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + SET_KW@3..7 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@7..8 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@9..10 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + L_PAREN@11..12 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@12..17 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@17..19 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@19..20 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + R_PAREN@20..22 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..25 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@28..30 "(" [Newline("\n")] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@30..32 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + SET_KW@32..36 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@36..37 "a" [] [], + }, + TsTypeParameters { + l_angle_token: L_ANGLE@37..38 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@38..39 ">" [] [], + }, + L_PAREN@39..40 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@40..45 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@45..47 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@47..48 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + R_PAREN@48..50 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@50..51 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@51..53 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@53..54 "}" [] [], + }, + r_paren_token: R_PAREN@54..55 ")" [] [], + }, + semicolon_token: SEMICOLON@55..56 ";" [] [], + }, + ], + eof_token: EOF@56..57 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..57 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..56 + 0: JS_EXPRESSION_STATEMENT@0..28 + 0: JS_PARENTHESIZED_EXPRESSION@0..27 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..26 + 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@3..25 + 0: JS_BOGUS_MEMBER@3..25 + 0: SET_KW@3..7 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@7..8 + 0: IDENT@7..8 "a" [] [] + 2: TS_TYPE_PARAMETERS@8..11 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..10 + 0: TS_TYPE_PARAMETER@9..10 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 + 1: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@10..11 ">" [] [] + 3: L_PAREN@11..12 "(" [] [] + 4: JS_FORMAL_PARAMETER@12..20 + 0: JS_DECORATOR_LIST@12..12 + 1: JS_IDENTIFIER_BINDING@12..17 + 0: IDENT@12..17 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@17..20 + 0: COLON@17..19 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@19..20 + 0: JS_REFERENCE_IDENTIFIER@19..20 + 0: IDENT@19..20 "A" [] [] + 1: (empty) + 4: (empty) + 5: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@22..25 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..23 + 3: R_CURLY@23..25 "}" [] [Whitespace(" ")] + 2: R_CURLY@25..26 "}" [] [] + 2: R_PAREN@26..27 ")" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@28..56 + 0: JS_PARENTHESIZED_EXPRESSION@28..55 + 0: L_PAREN@28..30 "(" [Newline("\n")] [] + 1: JS_OBJECT_EXPRESSION@30..54 + 0: L_CURLY@30..32 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@32..53 + 0: JS_BOGUS_MEMBER@32..53 + 0: SET_KW@32..36 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@36..37 + 0: IDENT@36..37 "a" [] [] + 2: TS_TYPE_PARAMETERS@37..39 + 0: L_ANGLE@37..38 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@38..38 + 2: R_ANGLE@38..39 ">" [] [] + 3: L_PAREN@39..40 "(" [] [] + 4: JS_FORMAL_PARAMETER@40..48 + 0: JS_DECORATOR_LIST@40..40 + 1: JS_IDENTIFIER_BINDING@40..45 + 0: IDENT@40..45 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@45..48 + 0: COLON@45..47 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@47..48 + 0: JS_REFERENCE_IDENTIFIER@47..48 + 0: IDENT@47..48 "A" [] [] + 1: (empty) + 4: (empty) + 5: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@50..53 + 0: L_CURLY@50..51 "{" [] [] + 1: JS_DIRECTIVE_LIST@51..51 + 2: JS_STATEMENT_LIST@51..51 + 3: R_CURLY@51..53 "}" [] [Whitespace(" ")] + 2: R_CURLY@53..54 "}" [] [] + 2: R_PAREN@54..55 ")" [] [] + 1: SEMICOLON@55..56 ";" [] [] + 4: EOF@56..57 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_object_setter_type_parameters.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + > 1 │ ({ set a(value: A) {} }); + │ ^^^ + 2 │ ({ set a<>(value: A) {} }); + 3 │ + +ts_object_setter_type_parameters.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found '>'. + + 1 │ ({ set a(value: A) {} }); + > 2 │ ({ set a<>(value: A) {} }); + │ ^ + 3 │ + + i Expected a type parameter here. + + 1 │ ({ set a(value: A) {} }); + > 2 │ ({ set a<>(value: A) {} }); + │ ^ + 3 │ + +ts_object_setter_type_parameters.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × An accessor cannot have type parameters. + + 1 │ ({ set a(value: A) {} }); + > 2 │ ({ set a<>(value: A) {} }); + │ ^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap new file mode 100644 index 000000000000..55cf1fd887e9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap @@ -0,0 +1,173 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { prop = "test"; } +class B { declare prop = "test"; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [], + name: JsLiteralMemberName { + value: IDENT@18..23 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@23..25 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@25..31 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@31..33 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@41..43 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@45..53 "declare" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@53..58 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@58..60 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@60..66 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@66..68 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@68..69 "}" [] [], + }, + ], + eof_token: EOF@69..70 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..70 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..69 + 0: TS_DECLARE_STATEMENT@0..34 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..34 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..33 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@18..33 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..18 + 1: JS_LITERAL_MEMBER_NAME@18..23 + 0: IDENT@18..23 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@23..31 + 0: EQ@23..25 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@25..31 + 0: JS_STRING_LITERAL@25..31 "\"test\"" [] [] + 4: SEMICOLON@31..33 ";" [] [Whitespace(" ")] + 9: R_CURLY@33..34 "}" [] [] + 1: JS_CLASS_DECLARATION@34..69 + 0: JS_DECORATOR_LIST@34..34 + 1: (empty) + 2: CLASS_KW@34..41 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@41..43 + 0: IDENT@41..43 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@43..45 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@45..68 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@45..68 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@45..53 + 0: TS_DECLARE_MODIFIER@45..53 + 0: DECLARE_KW@45..53 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@53..58 + 0: IDENT@53..58 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@58..66 + 0: EQ@58..60 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@60..66 + 0: JS_STRING_LITERAL@60..66 "\"test\"" [] [] + 4: SEMICOLON@66..68 ";" [] [Whitespace(" ")] + 9: R_CURLY@68..69 "}" [] [] + 4: EOF@69..70 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_property_initializer_ambient_context.ts:1:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In ambient contexts, properties with initializers need to be readonly. + + > 1 │ declare class A { prop = "test"; } + │ ^^^^^^^^ + 2 │ class B { declare prop = "test"; } + 3 │ + +ts_property_initializer_ambient_context.ts:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × In ambient contexts, properties with initializers need to be readonly. + + 1 │ declare class A { prop = "test"; } + > 2 │ class B { declare prop = "test"; } + │ ^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap new file mode 100644 index 000000000000..2cb936d079fe --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap @@ -0,0 +1,221 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { constructor(private { x, y }, protected [a, b]) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..21 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsBogusParameter { + items: [ + JsDecoratorList [], + JsObjectBindingPattern { + l_curly_token: L_CURLY@30..32 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@32..33 "x" [] [], + }, + init: missing (optional), + }, + COMMA@33..35 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@35..37 "y" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + ], + }, + }, + COMMA@38..40 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@40..50 "protected" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsBogusParameter { + items: [ + JsDecoratorList [], + JsArrayBindingPattern { + l_brack_token: L_BRACK@50..51 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@51..52 "a" [] [], + }, + init: missing (optional), + }, + COMMA@52..54 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@54..55 "b" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@55..56 "]" [] [], + }, + ], + }, + }, + ], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@61..62 "}" [] [], + }, + ], + eof_token: EOF@62..63 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..63 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..62 + 0: JS_CLASS_DECLARATION@0..62 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..61 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..61 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..21 + 0: IDENT@10..21 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@21..58 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..56 + 0: TS_PROPERTY_PARAMETER@22..38 + 0: JS_DECORATOR_LIST@22..22 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..30 + 0: TS_ACCESSIBILITY_MODIFIER@22..30 + 0: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")] + 2: JS_BOGUS_PARAMETER@30..38 + 0: JS_DECORATOR_LIST@30..30 + 1: JS_OBJECT_BINDING_PATTERN@30..38 + 0: L_CURLY@30..32 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@32..37 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@32..33 + 0: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "x" [] [] + 1: (empty) + 1: COMMA@33..35 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@35..37 + 0: JS_IDENTIFIER_BINDING@35..37 + 0: IDENT@35..37 "y" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@37..38 "}" [] [] + 1: COMMA@38..40 "," [] [Whitespace(" ")] + 2: TS_PROPERTY_PARAMETER@40..56 + 0: JS_DECORATOR_LIST@40..40 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@40..50 + 0: TS_ACCESSIBILITY_MODIFIER@40..50 + 0: PROTECTED_KW@40..50 "protected" [] [Whitespace(" ")] + 2: JS_BOGUS_PARAMETER@50..56 + 0: JS_DECORATOR_LIST@50..50 + 1: JS_ARRAY_BINDING_PATTERN@50..56 + 0: L_BRACK@50..51 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@51..55 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@51..52 + 0: JS_IDENTIFIER_BINDING@51..52 + 0: IDENT@51..52 "a" [] [] + 1: (empty) + 1: COMMA@52..54 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@54..55 + 0: JS_IDENTIFIER_BINDING@54..55 + 0: IDENT@54..55 "b" [] [] + 1: (empty) + 2: R_BRACK@55..56 "]" [] [] + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@58..61 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] + 9: R_CURLY@61..62 "}" [] [] + 4: EOF@62..63 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_property_parameter_pattern.ts:1:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A parameter property may not be declared using a binding pattern. + + > 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } + │ ^^^^^^^^ + 2 │ + +ts_property_parameter_pattern.ts:1:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A parameter property may not be declared using a binding pattern. + + > 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } + │ ^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap new file mode 100644 index 000000000000..fcab826afabe --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap @@ -0,0 +1,307 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + readonly constructor() {} + readonly method() {} + readonly get test() { return "a"; } + readonly set test(value: string) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsReadonlyModifier { + modifier_token: READONLY_KW@12..24 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@24..35 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@35..36 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@36..38 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@38..39 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsReadonlyModifier { + modifier_token: READONLY_KW@40..52 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@52..58 "method" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@58..59 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@61..62 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsReadonlyModifier { + modifier_token: READONLY_KW@63..75 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + GET_KW@75..79 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@79..83 "test" [] [], + }, + L_PAREN@83..84 "(" [] [], + R_PAREN@84..86 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@86..88 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@88..95 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@95..98 "\"a\"" [] [], + }, + semicolon_token: SEMICOLON@98..100 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@100..101 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + JsBogus { + items: [ + TsReadonlyModifier { + modifier_token: READONLY_KW@101..113 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + SET_KW@113..117 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@117..121 "test" [] [], + }, + L_PAREN@121..122 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@122..127 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@127..129 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@129..135 "string" [] [], + }, + }, + initializer: missing (optional), + }, + R_PAREN@135..137 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@137..138 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@138..139 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@139..141 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@141..142 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..142 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..141 + 0: JS_CLASS_DECLARATION@0..141 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..139 + 0: JS_BOGUS_MEMBER@12..40 + 0: JS_BOGUS@12..24 + 0: TS_READONLY_MODIFIER@12..24 + 0: READONLY_KW@12..24 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@24..35 + 0: IDENT@24..35 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@35..38 + 0: L_PAREN@35..36 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@36..36 + 2: R_PAREN@36..38 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@38..40 + 0: L_CURLY@38..39 "{" [] [] + 1: JS_DIRECTIVE_LIST@39..39 + 2: JS_STATEMENT_LIST@39..39 + 3: R_CURLY@39..40 "}" [] [] + 1: JS_BOGUS_MEMBER@40..63 + 0: JS_BOGUS@40..52 + 0: TS_READONLY_MODIFIER@40..52 + 0: READONLY_KW@40..52 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@52..58 + 0: IDENT@52..58 "method" [] [] + 2: JS_PARAMETERS@58..61 + 0: L_PAREN@58..59 "(" [] [] + 1: JS_PARAMETER_LIST@59..59 + 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@61..63 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_DIRECTIVE_LIST@62..62 + 2: JS_STATEMENT_LIST@62..62 + 3: R_CURLY@62..63 "}" [] [] + 2: JS_BOGUS_MEMBER@63..101 + 0: JS_BOGUS@63..75 + 0: TS_READONLY_MODIFIER@63..75 + 0: READONLY_KW@63..75 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@75..79 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@79..83 + 0: IDENT@79..83 "test" [] [] + 3: L_PAREN@83..84 "(" [] [] + 4: R_PAREN@84..86 ")" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@86..101 + 0: L_CURLY@86..88 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@88..88 + 2: JS_STATEMENT_LIST@88..100 + 0: JS_RETURN_STATEMENT@88..100 + 0: RETURN_KW@88..95 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@95..98 + 0: JS_STRING_LITERAL@95..98 "\"a\"" [] [] + 2: SEMICOLON@98..100 ";" [] [Whitespace(" ")] + 3: R_CURLY@100..101 "}" [] [] + 3: JS_BOGUS_MEMBER@101..139 + 0: JS_BOGUS@101..113 + 0: TS_READONLY_MODIFIER@101..113 + 0: READONLY_KW@101..113 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@113..117 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@117..121 + 0: IDENT@117..121 "test" [] [] + 3: L_PAREN@121..122 "(" [] [] + 4: JS_FORMAL_PARAMETER@122..135 + 0: JS_DECORATOR_LIST@122..122 + 1: JS_IDENTIFIER_BINDING@122..127 + 0: IDENT@122..127 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@127..135 + 0: COLON@127..129 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@129..135 + 0: STRING_KW@129..135 "string" [] [] + 4: (empty) + 5: R_PAREN@135..137 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@137..139 + 0: L_CURLY@137..138 "{" [] [] + 1: JS_DIRECTIVE_LIST@138..138 + 2: JS_STATEMENT_LIST@138..138 + 3: R_CURLY@138..139 "}" [] [] + 9: R_CURLY@139..141 "}" [Newline("\n")] [] + 4: EOF@141..142 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_readonly_modifier_non_class_or_indexer.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'readonly' cannot appear on a constructor declaration. + + 1 │ class Test { + > 2 │ readonly constructor() {} + │ ^^^^^^^^ + 3 │ readonly method() {} + 4 │ readonly get test() { return "a"; } + +ts_readonly_modifier_non_class_or_indexer.ts:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Readonly can only appear on a property declaration or index signature. + + 1 │ class Test { + 2 │ readonly constructor() {} + > 3 │ readonly method() {} + │ ^^^^^^^^ + 4 │ readonly get test() { return "a"; } + 5 │ readonly set test(value: string) {} + +ts_readonly_modifier_non_class_or_indexer.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Readonly can only appear on a property declaration or index signature. + + 2 │ readonly constructor() {} + 3 │ readonly method() {} + > 4 │ readonly get test() { return "a"; } + │ ^^^^^^^^ + 5 │ readonly set test(value: string) {} + 6 │ } + +ts_readonly_modifier_non_class_or_indexer.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Readonly can only appear on a property declaration or index signature. + + 3 │ readonly method() {} + 4 │ readonly get test() { return "a"; } + > 5 │ readonly set test(value: string) {} + │ ^^^^^^^^ + 6 │ } + 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap new file mode 100644 index 000000000000..695cbfb4c0c0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap @@ -0,0 +1,174 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +a satisfies string = "string"; +(a() satisfies string) = "string"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@7..10 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@14..24 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@24..31 "string" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@31..33 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@33..41 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], + assignment: TsSatisfiesAssignment { + assignment: JsBogusAssignment { + items: [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "a" [] [], + }, + }, + JsCallArguments { + l_paren_token: L_PAREN@45..46 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + }, + ], + }, + satisfies_token: SATISFIES_KW@48..58 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@58..64 "string" [] [], + }, + }, + r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@66..68 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@68..76 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@76..77 ";" [] [], + }, + ], + eof_token: EOF@77..78 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..78 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..77 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_TYPE_ANNOTATION@5..10 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@7..10 + 0: ANY_KW@7..10 "any" [] [] + 2: (empty) + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@11..42 + 0: JS_ASSIGNMENT_EXPRESSION@11..41 + 0: TS_SATISFIES_ASSIGNMENT@11..31 + 0: JS_IDENTIFIER_ASSIGNMENT@11..14 + 0: IDENT@11..14 "a" [Newline("\n")] [Whitespace(" ")] + 1: SATISFIES_KW@14..24 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@24..31 + 0: STRING_KW@24..31 "string" [] [Whitespace(" ")] + 1: EQ@31..33 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@33..41 + 0: JS_STRING_LITERAL@33..41 "\"string\"" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@42..77 + 0: JS_ASSIGNMENT_EXPRESSION@42..76 + 0: JS_PARENTHESIZED_ASSIGNMENT@42..66 + 0: L_PAREN@42..44 "(" [Newline("\n")] [] + 1: TS_SATISFIES_ASSIGNMENT@44..64 + 0: JS_BOGUS_ASSIGNMENT@44..48 + 0: JS_IDENTIFIER_EXPRESSION@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "a" [] [] + 1: JS_CALL_ARGUMENTS@45..48 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@46..46 + 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 1: SATISFIES_KW@48..58 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@58..64 + 0: STRING_KW@58..64 "string" [] [] + 2: R_PAREN@64..66 ")" [] [Whitespace(" ")] + 1: EQ@66..68 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@68..76 + 0: JS_STRING_LITERAL@68..76 "\"string\"" [] [] + 1: SEMICOLON@76..77 ";" [] [] + 4: EOF@77..78 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_satisfies_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `a()` + + 1 │ let a: any; + 2 │ a satisfies string = "string"; + > 3 │ (a() satisfies string) = "string"; + │ ^^^ + 4 │ + + i This expression cannot be assigned to + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.js b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.js rename to crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js.snap new file mode 100644 index 000000000000..cdef9d67e797 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let x = "hello" satisfies string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@8..16 "\"hello\"" [] [Whitespace(" ")], + }, + SATISFIES_KW@16..26 "satisfies" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@26..32 "string" [] [], + }, + ], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + ], + eof_token: EOF@33..34 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..34 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..33 + 0: JS_VARIABLE_STATEMENT@0..33 + 0: JS_VARIABLE_DECLARATION@0..32 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..32 + 0: JS_VARIABLE_DECLARATOR@4..32 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..32 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@8..32 + 0: JS_STRING_LITERAL_EXPRESSION@8..16 + 0: JS_STRING_LITERAL@8..16 "\"hello\"" [] [Whitespace(" ")] + 1: SATISFIES_KW@16..26 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@26..32 + 0: STRING_KW@26..32 "string" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 4: EOF@33..34 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_satisfies_expression.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'satisfies' expression are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. + + > 1 │ let x = "hello" satisfies string; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ + + i TypeScript only syntax + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap new file mode 100644 index 000000000000..6cca46af41f1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap @@ -0,0 +1,143 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + set a(value: string): void {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + SET_KW@12..21 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@21..22 "a" [] [], + }, + L_PAREN@22..23 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@23..28 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@30..36 "string" [] [], + }, + }, + initializer: missing (optional), + }, + R_PAREN@36..37 ")" [] [], + TsReturnTypeAnnotation { + colon_token: COLON@37..39 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@39..44 "void" [] [Whitespace(" ")], + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@44..45 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@45..46 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@46..48 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@48..49 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..49 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..48 + 0: JS_CLASS_DECLARATION@0..48 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..46 + 0: JS_BOGUS_MEMBER@12..46 + 0: JS_METHOD_MODIFIER_LIST@12..12 + 1: SET_KW@12..21 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@21..22 + 0: IDENT@21..22 "a" [] [] + 3: L_PAREN@22..23 "(" [] [] + 4: JS_FORMAL_PARAMETER@23..36 + 0: JS_DECORATOR_LIST@23..23 + 1: JS_IDENTIFIER_BINDING@23..28 + 0: IDENT@23..28 "value" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@28..36 + 0: COLON@28..30 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@30..36 + 0: STRING_KW@30..36 "string" [] [] + 4: (empty) + 5: R_PAREN@36..37 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@37..44 + 0: COLON@37..39 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@39..44 + 0: VOID_KW@39..44 "void" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@44..46 + 0: L_CURLY@44..45 "{" [] [] + 1: JS_DIRECTIVE_LIST@45..45 + 2: JS_STATEMENT_LIST@45..45 + 3: R_CURLY@45..46 "}" [] [] + 9: R_CURLY@46..48 "}" [Newline("\n")] [] + 4: EOF@48..49 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_setter_return_type_annotation.ts:2:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A 'set' accessor cannot have a return type annotation. + + 1 │ class Test { + > 2 │ set a(value: string): void {} + │ ^^^^^^ + 3 │ } + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap new file mode 100644 index 000000000000..43c14b33f24c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap @@ -0,0 +1,139 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + @dec static { + this.a = "test"; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsDecorator { + at_token: AT@11..15 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..19 "dec" [] [Whitespace(" ")], + }, + }, + }, + STATIC_KW@19..26 "static" [] [Whitespace(" ")], + L_CURLY@26..27 "{" [] [], + JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsThisExpression { + this_token: THIS_KW@27..36 "this" [Newline("\n"), Whitespace(" ")] [], + }, + dot_token: DOT@36..37 "." [] [], + member: JsName { + value_token: IDENT@37..39 "a" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@39..41 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@41..47 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + ], + R_CURLY@48..52 "}" [Newline("\n"), Whitespace(" ")] [], + ], + }, + ], + r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_CLASS_DECLARATION@0..54 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..52 + 0: JS_BOGUS_MEMBER@11..52 + 0: JS_DECORATOR@11..19 + 0: AT@11..15 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@15..19 + 0: JS_REFERENCE_IDENTIFIER@15..19 + 0: IDENT@15..19 "dec" [] [Whitespace(" ")] + 1: STATIC_KW@19..26 "static" [] [Whitespace(" ")] + 2: L_CURLY@26..27 "{" [] [] + 3: JS_STATEMENT_LIST@27..48 + 0: JS_EXPRESSION_STATEMENT@27..48 + 0: JS_ASSIGNMENT_EXPRESSION@27..47 + 0: JS_STATIC_MEMBER_ASSIGNMENT@27..39 + 0: JS_THIS_EXPRESSION@27..36 + 0: THIS_KW@27..36 "this" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@36..37 "." [] [] + 2: JS_NAME@37..39 + 0: IDENT@37..39 "a" [] [Whitespace(" ")] + 1: EQ@39..41 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@41..47 + 0: JS_STRING_LITERAL@41..47 "\"test\"" [] [] + 1: SEMICOLON@47..48 ";" [] [] + 4: R_CURLY@48..52 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@52..54 "}" [Newline("\n")] [] + 4: EOF@54..55 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_static_initialization_block_member_with_decorators.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Static class blocks cannot have any modifier. + + 1 │ class Foo { + > 2 │ @dec static { + │ ^^^^ + 3 │ this.a = "test"; + 4 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts.snap new file mode 100644 index 000000000000..76b5c8b67cf1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts.snap @@ -0,0 +1,226 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = "a"; +type B = "b" +type C = `${A B}bcd` +type D = `${A B` + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@9..12 "\"a\"" [] [], + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@13..19 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@19..21 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + ty: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@23..26 "\"b\"" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@26..32 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@32..34 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@34..36 "=" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + BACKTICK@36..37 "`" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + DOLLAR_CURLY@37..39 "${" [] [], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@39..41 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + JsBogus { + items: [ + IDENT@41..42 "B" [] [], + ], + }, + R_CURLY@42..43 "}" [] [], + ], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@43..46 "bcd" [] [], + }, + ], + }, + BACKTICK@46..47 "`" [] [], + ], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@47..53 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@53..55 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@55..57 "=" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + BACKTICK@57..58 "`" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + DOLLAR_CURLY@58..60 "${" [] [], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@60..62 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + JsBogus { + items: [ + IDENT@62..63 "B" [] [], + ], + }, + ], + }, + ], + }, + BACKTICK@63..64 "`" [] [], + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: TS_TYPE_ALIAS_DECLARATION@0..13 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_STRING_LITERAL_TYPE@9..12 + 0: JS_STRING_LITERAL@9..12 "\"a\"" [] [] + 5: SEMICOLON@12..13 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@13..26 + 0: TYPE_KW@13..19 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@19..21 + 0: IDENT@19..21 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@21..23 "=" [] [Whitespace(" ")] + 4: TS_STRING_LITERAL_TYPE@23..26 + 0: JS_STRING_LITERAL@23..26 "\"b\"" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@26..47 + 0: TYPE_KW@26..32 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@32..34 + 0: IDENT@32..34 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@34..36 "=" [] [Whitespace(" ")] + 4: TS_BOGUS_TYPE@36..47 + 0: BACKTICK@36..37 "`" [] [] + 1: JS_BOGUS@37..46 + 0: JS_BOGUS@37..43 + 0: DOLLAR_CURLY@37..39 "${" [] [] + 1: TS_REFERENCE_TYPE@39..41 + 0: JS_REFERENCE_IDENTIFIER@39..41 + 0: IDENT@39..41 "A" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BOGUS@41..42 + 0: IDENT@41..42 "B" [] [] + 3: R_CURLY@42..43 "}" [] [] + 1: TS_TEMPLATE_CHUNK_ELEMENT@43..46 + 0: TEMPLATE_CHUNK@43..46 "bcd" [] [] + 2: BACKTICK@46..47 "`" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@47..64 + 0: TYPE_KW@47..53 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@53..55 + 0: IDENT@53..55 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@55..57 "=" [] [Whitespace(" ")] + 4: TS_BOGUS_TYPE@57..64 + 0: BACKTICK@57..58 "`" [] [] + 1: JS_BOGUS@58..63 + 0: JS_BOGUS@58..63 + 0: DOLLAR_CURLY@58..60 "${" [] [] + 1: TS_REFERENCE_TYPE@60..62 + 0: JS_REFERENCE_IDENTIFIER@60..62 + 0: IDENT@60..62 "A" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BOGUS@62..63 + 0: IDENT@62..63 "B" [] [] + 2: BACKTICK@63..64 "`" [] [] + 5: (empty) + 4: EOF@64..65 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_template_literal_error.ts:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `B` + + 1 │ type A = "a"; + 2 │ type B = "b" + > 3 │ type C = `${A B}bcd` + │ ^ + 4 │ type D = `${A B` + 5 │ + + i Remove B + +ts_template_literal_error.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead found `B` + + 2 │ type B = "b" + 3 │ type C = `${A B}bcd` + > 4 │ type D = `${A B` + │ ^ + 5 │ + + i Remove B + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap new file mode 100644 index 000000000000..4531f65ea49d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap @@ -0,0 +1,107 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = [ ...name?: string[] ] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + L_BRACK@9..11 "[" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + DOT3@11..14 "..." [] [], + JsName { + value_token: IDENT@14..18 "name" [] [], + }, + QUESTION@18..19 "?" [] [], + COLON@19..21 ":" [] [Whitespace(" ")], + TsArrayType { + element_type: TsStringType { + string_token: STRING_KW@21..27 "string" [] [], + }, + l_brack_token: L_BRACK@27..28 "[" [] [], + r_brack_token: R_BRACK@28..30 "]" [] [Whitespace(" ")], + }, + ], + }, + ], + }, + R_BRACK@30..31 "]" [] [], + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@31..32 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..32 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..31 + 0: TS_TYPE_ALIAS_DECLARATION@0..31 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_BOGUS_TYPE@9..31 + 0: L_BRACK@9..11 "[" [] [Whitespace(" ")] + 1: JS_BOGUS@11..30 + 0: JS_BOGUS@11..30 + 0: DOT3@11..14 "..." [] [] + 1: JS_NAME@14..18 + 0: IDENT@14..18 "name" [] [] + 2: QUESTION@18..19 "?" [] [] + 3: COLON@19..21 ":" [] [Whitespace(" ")] + 4: TS_ARRAY_TYPE@21..30 + 0: TS_STRING_TYPE@21..27 + 0: STRING_KW@21..27 "string" [] [] + 1: L_BRACK@27..28 "[" [] [] + 2: R_BRACK@28..30 "]" [] [Whitespace(" ")] + 2: R_BRACK@30..31 "]" [] [] + 5: (empty) + 4: EOF@31..32 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_tuple_type_cannot_be_optional_and_rest.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A tuple member cannot be both optional and rest. + + > 1 │ type A = [ ...name?: string[] ] + │ ^^^^^^^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap new file mode 100644 index 000000000000..7ea83b73e51b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap @@ -0,0 +1,88 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = [string, + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@9..10 "[" [] [], + elements: TsTupleTypeElementList [ + TsStringType { + string_token: STRING_KW@10..16 "string" [] [], + }, + COMMA@16..17 "," [] [], + ], + r_brack_token: missing (required), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: TS_TYPE_ALIAS_DECLARATION@0..17 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@9..17 + 0: L_BRACK@9..10 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@10..17 + 0: TS_STRING_TYPE@10..16 + 0: STRING_KW@10..16 "string" [] [] + 1: COMMA@16..17 "," [] [] + 2: (empty) + 5: (empty) + 4: EOF@17..18 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_tuple_type_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type but instead found the end of the file. + + 1 │ type A = [string, + > 2 │ + │ + + i Expected a type here. + + 1 │ type A = [string, + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap new file mode 100644 index 000000000000..2871ee864184 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap @@ -0,0 +1,141 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type undefined = any; +type any = any; +type string = any; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + TYPE_KW@0..5 "type" [] [Whitespace(" ")], + JsBogus { + items: [ + IDENT@5..15 "undefined" [] [Whitespace(" ")], + ], + }, + EQ@15..17 "=" [] [Whitespace(" ")], + TsAnyType { + any_token: ANY_KW@17..20 "any" [] [], + }, + SEMICOLON@20..21 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + IDENT@27..31 "any" [] [Whitespace(" ")], + ], + }, + EQ@31..33 "=" [] [Whitespace(" ")], + TsAnyType { + any_token: ANY_KW@33..36 "any" [] [], + }, + SEMICOLON@36..37 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], + JsBogus { + items: [ + IDENT@43..50 "string" [] [Whitespace(" ")], + ], + }, + EQ@50..52 "=" [] [Whitespace(" ")], + TsAnyType { + any_token: ANY_KW@52..55 "any" [] [], + }, + SEMICOLON@55..56 ";" [] [], + ], + }, + ], + eof_token: EOF@56..57 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..57 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..56 + 0: JS_BOGUS_STATEMENT@0..21 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: JS_BOGUS@5..15 + 0: IDENT@5..15 "undefined" [] [Whitespace(" ")] + 2: EQ@15..17 "=" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@17..20 + 0: ANY_KW@17..20 "any" [] [] + 4: SEMICOLON@20..21 ";" [] [] + 1: JS_BOGUS_STATEMENT@21..37 + 0: TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@27..31 + 0: IDENT@27..31 "any" [] [Whitespace(" ")] + 2: EQ@31..33 "=" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@33..36 + 0: ANY_KW@33..36 "any" [] [] + 4: SEMICOLON@36..37 ";" [] [] + 2: JS_BOGUS_STATEMENT@37..56 + 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS@43..50 + 0: IDENT@43..50 "string" [] [Whitespace(" ")] + 2: EQ@50..52 "=" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@52..55 + 0: ANY_KW@52..55 "any" [] [] + 4: SEMICOLON@55..56 ";" [] [] + 4: EOF@56..57 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_type_alias_cannot_be_reserved_word.ts:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type alias cannot be undefined + + > 1 │ type undefined = any; + │ ^^^^^^^^^ + 2 │ type any = any; + 3 │ type string = any; + +ts_type_alias_cannot_be_reserved_word.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type alias cannot be any + + 1 │ type undefined = any; + > 2 │ type any = any; + │ ^^^ + 3 │ type string = any; + 4 │ + +ts_type_alias_cannot_be_reserved_word.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Type alias cannot be string + + 1 │ type undefined = any; + 2 │ type any = any; + > 3 │ type string = any; + │ ^^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap new file mode 100644 index 000000000000..9a1f6e01b2d7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap @@ -0,0 +1,138 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +var test2 = new Test2(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..10 "test2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@10..12 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNewExpression { + new_token: NEW_KW@12..16 "new" [] [Whitespace(" ")], + callee: missing (required), + type_arguments: missing (optional), + arguments: missing (optional), + }, + operator_token: L_ANGLE@16..17 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..20 "any" [] [], + }, + }, + }, + operator_token: R_ANGLE@20..21 ">" [] [], + right: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..26 "Test2" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@26..27 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@27..28 ")" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_VARIABLE_STATEMENT@0..29 + 0: JS_VARIABLE_DECLARATION@0..28 + 0: (empty) + 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..28 + 0: JS_VARIABLE_DECLARATOR@4..28 + 0: JS_IDENTIFIER_BINDING@4..10 + 0: IDENT@4..10 "test2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@10..28 + 0: EQ@10..12 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@12..28 + 0: JS_BINARY_EXPRESSION@12..20 + 0: JS_NEW_EXPRESSION@12..16 + 0: NEW_KW@12..16 "new" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 1: L_ANGLE@16..17 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@17..20 + 0: JS_REFERENCE_IDENTIFIER@17..20 + 0: IDENT@17..20 "any" [] [] + 1: R_ANGLE@20..21 ">" [] [] + 2: JS_CALL_EXPRESSION@21..28 + 0: JS_IDENTIFIER_EXPRESSION@21..26 + 0: JS_REFERENCE_IDENTIFIER@21..26 + 0: IDENT@21..26 "Test2" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@26..28 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@27..27 + 2: R_PAREN@27..28 ")" [] [] + 1: SEMICOLON@28..29 ";" [] [] + 4: EOF@29..30 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_type_assertions_not_valid_at_new_expr.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression but instead found '<'. + + > 1 │ var test2 = new Test2(); + │ ^ + 2 │ + + i Expected an expression here. + + > 1 │ var test2 = new Test2(); + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap new file mode 100644 index 000000000000..0abd0bd78c54 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap @@ -0,0 +1,95 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A` but instead the file ends + + 1 │ type A 2 │ + │ + + i the file ends here + + 1 │ type A 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_typed_default_import_with_named.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_typed_default_import_with_named.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_typed_default_import_with_named.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_typed_default_import_with_named.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_typed_default_import_with_named.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_typed_default_import_with_named.ts.snap new file mode 100644 index 000000000000..bffb110db913 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_typed_default_import_with_named.ts.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import type A, { B, C } from './a'; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + JsBogus { + items: [ + TYPE_KW@7..12 "type" [] [Whitespace(" ")], + JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@12..13 "A" [] [], + }, + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsNamedImportSpecifiers { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@17..18 "B" [] [], + }, + }, + COMMA@18..20 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@20..22 "C" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@22..24 "}" [] [Whitespace(" ")], + }, + FROM_KW@24..29 "from" [] [Whitespace(" ")], + JsModuleSource { + value_token: JS_STRING_LITERAL@29..34 "'./a'" [] [], + }, + ], + }, + SEMICOLON@34..35 ";" [] [], + ], + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_BOGUS_STATEMENT@0..35 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_BOGUS@7..34 + 0: TYPE_KW@7..12 "type" [] [Whitespace(" ")] + 1: JS_DEFAULT_IMPORT_SPECIFIER@12..13 + 0: JS_IDENTIFIER_BINDING@12..13 + 0: IDENT@12..13 "A" [] [] + 2: COMMA@13..15 "," [] [Whitespace(" ")] + 3: JS_NAMED_IMPORT_SPECIFIERS@15..24 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@17..22 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@17..18 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@17..18 + 0: IDENT@17..18 "B" [] [] + 1: COMMA@18..20 "," [] [Whitespace(" ")] + 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@20..22 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@20..22 + 0: IDENT@20..22 "C" [] [Whitespace(" ")] + 2: R_CURLY@22..24 "}" [] [Whitespace(" ")] + 4: FROM_KW@24..29 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@29..34 + 0: JS_STRING_LITERAL@29..34 "'./a'" [] [] + 2: SEMICOLON@34..35 ";" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_typed_default_import_with_named.ts:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A type-only import can specify a default import or named bindings, but not both. + + > 1 │ import type A, { B, C } from './a'; + │ ^^^^^^^^^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_variable_annotation_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_variable_annotation_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_variable_annotation_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_variable_annotation_err.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_variable_annotation_err.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/ts_variable_annotation_err.ts.snap new file mode 100644 index 000000000000..066902ab777b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_variable_annotation_err.ts.snap @@ -0,0 +1,83 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a!; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsDefiniteVariableAnnotation { + excl_token: BANG@5..6 "!" [] [], + type_annotation: missing (required), + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@6..7 ";" [] [], + }, + ], + eof_token: EOF@7..8 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..8 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..7 + 0: JS_VARIABLE_STATEMENT@0..7 + 0: JS_VARIABLE_DECLARATION@0..6 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..6 + 0: JS_VARIABLE_DECLARATOR@4..6 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_DEFINITE_VARIABLE_ANNOTATION@5..6 + 0: BANG@5..6 "!" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@6..7 ";" [] [] + 4: EOF@7..8 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +ts_variable_annotation_err.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `;` + + > 1 │ let a!; + │ ^ + 2 │ + + i Remove ; + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/type_arguments_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/type_arguments_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/type_arguments_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/type_arguments_incomplete.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/type_arguments_incomplete.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/type_arguments_incomplete.ts.snap new file mode 100644 index 000000000000..cf74c6d9463d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/type_arguments_incomplete.ts.snap @@ -0,0 +1,88 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +func 2 │ + │ + + i Expected an expression here. + + 1 │ func 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/type_parameter_modifier.ts b/crates/biome_js_parser/tests/js_test_suite/error/type_parameter_modifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/type_parameter_modifier.ts rename to crates/biome_js_parser/tests/js_test_suite/error/type_parameter_modifier.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/type_parameter_modifier.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/type_parameter_modifier.ts.snap new file mode 100644 index 000000000000..307bd5e97e24 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/type_parameter_modifier.ts.snap @@ -0,0 +1,3844 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default function foo() {} +export function foo() {} +export function foo1() {} +export function foo2() {} +let foo: Foo +let foo: Foo +declare function foo() +declare function foo() +declare let foo: Foo +declare let foo: Foo +foo = function () {} +foo = function () {} +class Foo { foo(): T {} } +class Foo { foo(): T {} } +foo = { foo(): T {} }; +foo = { foo(): T {} }; +() => {}; +() => {}; +() => {}; +let x: () => {}; +let x: () => {}; +let x: () => {}; +let x: new () => {}; +let x: new () => {}; +let x: new () => {}; +let x: { y(): any }; +let x: { y(): any }; +let x: { y(): any }; +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +function foo() {} +function foo() {} +type Foo = {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + JsBogus { + items: [ + DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + JsBogus { + items: [ + FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@24..27 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@27..28 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@28..31 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@31..32 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@32..33 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@33..34 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@36..37 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + ], + }, + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@38..46 "export" [Newline("\n")] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@46..55 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@55..58 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@58..59 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@59..63 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@63..64 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@64..65 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@65..66 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@68..69 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@69..70 "}" [] [], + }, + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@70..78 "export" [Newline("\n")] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@78..87 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@87..91 "foo1" [] [], + }, + JsBogus { + items: [ + L_ANGLE@91..92 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@92..95 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@95..96 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@96..97 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@97..98 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@100..101 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + ], + }, + ], + }, + JsBogusStatement { + items: [ + JsDecoratorList [], + EXPORT_KW@102..110 "export" [Newline("\n")] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@110..119 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@119..123 "foo2" [] [], + }, + JsBogus { + items: [ + L_ANGLE@123..124 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@124..128 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@128..129 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@129..130 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@130..131 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@131..133 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@133..134 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@134..135 "}" [] [], + }, + ], + }, + ], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@140..143 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@143..145 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@145..148 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@148..149 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@149..152 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@152..153 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@153..154 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@159..162 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@162..164 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@164..167 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@167..168 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@168..172 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@172..173 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@173..174 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + DECLARE_KW@174..183 "declare" [Newline("\n")] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@183..192 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@192..195 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@195..196 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@196..199 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@199..200 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@200..201 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@201..202 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@202..203 ")" [] [], + }, + ], + }, + ], + }, + JsBogusStatement { + items: [ + DECLARE_KW@203..212 "declare" [Newline("\n")] [Whitespace(" ")], + JsBogusStatement { + items: [ + FUNCTION_KW@212..221 "function" [] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@221..224 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@224..225 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@225..229 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@229..230 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@230..231 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@231..232 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@232..233 ")" [] [], + }, + ], + }, + ], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@242..246 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@246..249 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@249..251 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@251..254 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@254..255 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@255..258 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@258..259 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@259..260 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@269..273 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@273..276 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@276..278 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@278..281 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@281..282 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@282..286 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@286..287 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@287..288 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@288..293 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@293..295 "=" [] [Whitespace(" ")], + right: JsBogusExpression { + items: [ + FUNCTION_KW@295..304 "function" [] [Whitespace(" ")], + JsBogus { + items: [ + L_ANGLE@304..305 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@305..308 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@308..309 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@309..310 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@310..311 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@311..313 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@313..314 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@314..315 "}" [] [], + }, + ], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@315..320 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@320..322 "=" [] [Whitespace(" ")], + right: JsBogusExpression { + items: [ + FUNCTION_KW@322..331 "function" [] [Whitespace(" ")], + JsBogus { + items: [ + L_ANGLE@331..332 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@332..336 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@336..337 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@337..338 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@338..339 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@339..341 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@341..342 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@342..343 "}" [] [], + }, + ], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@343..350 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@350..354 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@354..356 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@356..359 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@359..360 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@360..363 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@363..364 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@364..365 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@365..366 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@366..367 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@367..369 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@369..371 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@371..372 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@372..374 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@374..375 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@375..382 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@382..386 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@386..388 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsMethodModifierList [], + JsLiteralMemberName { + value: IDENT@388..391 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@391..392 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@392..396 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@396..397 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@397..398 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@398..399 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@399..400 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@400..402 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@402..404 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@404..405 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@405..407 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@407..408 "}" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@408..413 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@413..415 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@415..417 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + JsLiteralMemberName { + value: IDENT@417..420 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@420..421 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@421..424 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@424..425 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@425..426 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@426..427 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@427..428 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@428..430 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@430..432 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@432..433 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@433..435 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@435..436 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@436..437 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@437..442 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@442..444 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@444..446 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsBogusMember { + items: [ + JsLiteralMemberName { + value: IDENT@446..449 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@449..450 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@450..454 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@454..455 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@455..456 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@456..457 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@457..458 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@458..460 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@460..462 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@462..463 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@463..465 "}" [] [Whitespace(" ")], + }, + ], + }, + ], + r_curly_token: R_CURLY@465..466 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@466..467 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_ANGLE@467..469 "<" [Newline("\n")] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@469..472 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@472..473 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@473..474 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@474..475 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@475..477 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@477..480 "=>" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@480..481 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@481..482 "}" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@482..483 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_ANGLE@483..485 "<" [Newline("\n")] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@485..489 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@489..490 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@490..491 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@491..492 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@492..494 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@494..497 "=>" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@497..498 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@498..499 "}" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@499..500 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_ANGLE@500..502 "<" [Newline("\n")] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@502..505 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@505..506 "T" [] [], + }, + ], + }, + COMMA@506..508 "," [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@508..512 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@512..513 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@513..514 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@514..515 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@515..517 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@517..520 "=>" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@520..521 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@521..522 "}" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@522..523 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@528..529 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@529..531 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + JsBogus { + items: [ + L_ANGLE@531..532 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@532..535 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@535..536 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@536..537 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@537..538 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@538..540 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@540..543 "=>" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@543..544 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@544..545 "}" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@545..546 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@551..552 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@552..554 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + JsBogus { + items: [ + L_ANGLE@554..555 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@555..559 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@559..560 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@560..561 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@561..562 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@562..564 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@564..567 "=>" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@567..568 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@568..569 "}" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@569..570 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@575..576 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@576..578 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + JsBogus { + items: [ + L_ANGLE@578..579 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@579..582 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@582..583 "T" [] [], + }, + ], + }, + COMMA@583..585 "," [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@585..589 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@589..590 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@590..591 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@591..592 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@592..594 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@594..597 "=>" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@597..598 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@598..599 "}" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@599..600 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@605..606 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@606..608 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + NEW_KW@608..612 "new" [] [Whitespace(" ")], + JsBogus { + items: [ + L_ANGLE@612..613 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@613..616 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@616..617 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@617..618 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@618..619 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@619..621 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@621..624 "=>" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@624..625 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@625..626 "}" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@626..627 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@632..633 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@633..635 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + NEW_KW@635..639 "new" [] [Whitespace(" ")], + JsBogus { + items: [ + L_ANGLE@639..640 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@640..644 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@644..645 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@645..646 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@646..647 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@647..649 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@649..652 "=>" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@652..653 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@653..654 "}" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@654..655 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@660..661 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@661..663 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + NEW_KW@663..667 "new" [] [Whitespace(" ")], + JsBogus { + items: [ + L_ANGLE@667..668 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@668..671 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@671..672 "T" [] [], + }, + ], + }, + COMMA@672..674 "," [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@674..678 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@678..679 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@679..680 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@680..681 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@681..683 ")" [] [Whitespace(" ")], + }, + FAT_ARROW@683..686 "=>" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@686..687 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@687..688 "}" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@688..689 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@694..695 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@695..697 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + L_CURLY@697..699 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsLiteralMemberName { + value: IDENT@699..700 "y" [] [], + }, + JsBogus { + items: [ + L_ANGLE@700..701 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@701..704 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@704..705 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@705..706 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@706..707 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@707..708 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@708..710 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@710..714 "any" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + }, + R_CURLY@714..715 "}" [] [], + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@715..716 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@721..722 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@722..724 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + L_CURLY@724..726 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsLiteralMemberName { + value: IDENT@726..727 "y" [] [], + }, + JsBogus { + items: [ + L_ANGLE@727..728 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@728..732 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@732..733 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@733..734 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@734..735 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@735..736 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@736..738 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@738..742 "any" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + }, + R_CURLY@742..743 "}" [] [], + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@743..744 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@749..750 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@750..752 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + L_CURLY@752..754 "{" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsLiteralMemberName { + value: IDENT@754..755 "y" [] [], + }, + JsBogus { + items: [ + L_ANGLE@755..756 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@756..759 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@759..760 "T" [] [], + }, + ], + }, + COMMA@760..762 "," [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@762..766 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@766..767 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@767..768 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@768..769 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@769..770 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@770..772 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@772..776 "any" [] [Whitespace(" ")], + }, + }, + ], + }, + ], + }, + R_CURLY@776..777 "}" [] [], + ], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@777..778 ";" [] [], + }, + JsBogusStatement { + items: [ + TYPE_KW@778..784 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@784..787 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@787..788 "<" [] [], + JsBogus { + items: [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@788..789 "i" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameterModifierList [], + TsBogusType { + items: [ + ERROR_TOKEN@789..790 "\\" [] [], + ], + }, + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@790..797 "\\u006E" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@797..798 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + }, + R_ANGLE@798..800 ">" [] [Whitespace(" ")], + ], + }, + EQ@800..802 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@802..803 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@803..804 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@804..810 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@810..813 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@813..814 "<" [] [], + JsBogus { + items: [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@814..816 "ou" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameterModifierList [], + TsBogusType { + items: [ + ERROR_TOKEN@816..817 "\\" [] [], + ], + }, + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@817..824 "\\u0074" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@824..825 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + }, + R_ANGLE@825..827 ">" [] [Whitespace(" ")], + ], + }, + EQ@827..829 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@829..830 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@830..831 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@831..837 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@837..840 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@840..841 "<" [] [], + JsBogus { + items: [ + TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@841..844 "in" [] [Whitespace(" ")], + }, + ], + TsBogusType { + items: [ + IN_KW@844..846 "in" [] [], + ], + }, + ], + }, + R_ANGLE@846..848 ">" [] [Whitespace(" ")], + ], + }, + EQ@848..850 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@850..851 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@851..852 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@852..858 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@858..861 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@861..862 "<" [] [], + JsBogus { + items: [ + TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@862..866 "out" [] [Whitespace(" ")], + }, + ], + TsBogusType { + items: [ + IN_KW@866..868 "in" [] [], + ], + }, + ], + }, + R_ANGLE@868..870 ">" [] [Whitespace(" ")], + ], + }, + EQ@870..872 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@872..873 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@873..874 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@874..880 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@880..883 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@883..884 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + TsOutModifier { + modifier_token: OUT_KW@884..888 "out" [] [Whitespace(" ")], + }, + IN_KW@888..891 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@891..892 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@892..894 ">" [] [Whitespace(" ")], + ], + }, + EQ@894..896 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@896..897 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@897..898 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@898..904 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@904..907 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@907..908 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + TsTypeParameterModifierList [], + JsBogus { + items: [ + IDENT@908..915 "public" [] [Whitespace(" ")], + ], + }, + ], + }, + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@915..916 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + }, + R_ANGLE@916..918 ">" [] [Whitespace(" ")], + ], + }, + EQ@918..920 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@920..921 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@921..922 "}" [] [], + }, + ], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@922..928 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@928..931 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@931..932 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@932..937 "innn" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: missing (optional), + }, + missing separator, + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@937..938 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@938..940 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@940..942 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@942..943 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@943..944 "}" [] [], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + TYPE_KW@944..950 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@950..953 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@953..954 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + TsInModifier { + modifier_token: IN_KW@954..957 "in" [] [Whitespace(" ")], + }, + TsOutModifier { + modifier_token: OUT_KW@957..961 "out" [] [Whitespace(" ")], + }, + IN_KW@961..964 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@964..965 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@965..967 ">" [] [Whitespace(" ")], + ], + }, + EQ@967..969 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@969..970 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@970..971 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@971..977 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@977..980 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@980..981 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + TsInModifier { + modifier_token: IN_KW@981..984 "in" [] [Whitespace(" ")], + }, + TsOutModifier { + modifier_token: OUT_KW@984..988 "out" [] [Whitespace(" ")], + }, + OUT_KW@988..992 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@992..993 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@993..995 ">" [] [Whitespace(" ")], + ], + }, + EQ@995..997 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@997..998 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@998..999 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + FUNCTION_KW@999..1009 "function" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@1009..1012 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@1012..1013 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@1013..1016 "in" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@1016..1017 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@1017..1018 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@1018..1019 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1019..1021 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@1021..1022 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1022..1023 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + FUNCTION_KW@1023..1033 "function" [Newline("\n")] [Whitespace(" ")], + JsIdentifierBinding { + name_token: IDENT@1033..1036 "foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@1036..1037 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@1037..1041 "out" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@1041..1042 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@1042..1043 ">" [] [], + ], + }, + JsParameters { + l_paren_token: L_PAREN@1043..1044 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1044..1046 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@1046..1047 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1047..1048 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@1048..1054 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@1054..1057 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@1057..1058 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + CONST_KW@1058..1064 "const" [] [Whitespace(" ")], + ], + }, + TsTypeParameterName { + ident_token: IDENT@1064..1065 "U" [] [], + }, + ], + }, + ], + }, + R_ANGLE@1065..1067 ">" [] [Whitespace(" ")], + ], + }, + EQ@1067..1069 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@1069..1070 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@1070..1071 "}" [] [], + }, + SEMICOLON@1071..1072 ";" [] [], + ], + }, + ], + eof_token: EOF@1072..1073 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..1073 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..1072 + 0: JS_BOGUS_STATEMENT@0..38 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_BOGUS@7..38 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_BOGUS@15..38 + 0: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@24..27 + 0: IDENT@24..27 "foo" [] [] + 2: JS_BOGUS@27..33 + 0: L_ANGLE@27..28 "<" [] [] + 1: JS_BOGUS@28..32 + 0: JS_BOGUS@28..32 + 0: JS_BOGUS@28..31 + 0: IN_KW@28..31 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@31..32 + 0: IDENT@31..32 "T" [] [] + 2: R_ANGLE@32..33 ">" [] [] + 3: JS_PARAMETERS@33..36 + 0: L_PAREN@33..34 "(" [] [] + 1: JS_PARAMETER_LIST@34..34 + 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@36..38 + 0: L_CURLY@36..37 "{" [] [] + 1: JS_DIRECTIVE_LIST@37..37 + 2: JS_STATEMENT_LIST@37..37 + 3: R_CURLY@37..38 "}" [] [] + 1: JS_BOGUS_STATEMENT@38..70 + 0: JS_DECORATOR_LIST@38..38 + 1: EXPORT_KW@38..46 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@46..70 + 0: FUNCTION_KW@46..55 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@55..58 + 0: IDENT@55..58 "foo" [] [] + 2: JS_BOGUS@58..65 + 0: L_ANGLE@58..59 "<" [] [] + 1: JS_BOGUS@59..64 + 0: JS_BOGUS@59..64 + 0: JS_BOGUS@59..63 + 0: OUT_KW@59..63 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@63..64 + 0: IDENT@63..64 "T" [] [] + 2: R_ANGLE@64..65 ">" [] [] + 3: JS_PARAMETERS@65..68 + 0: L_PAREN@65..66 "(" [] [] + 1: JS_PARAMETER_LIST@66..66 + 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@68..70 + 0: L_CURLY@68..69 "{" [] [] + 1: JS_DIRECTIVE_LIST@69..69 + 2: JS_STATEMENT_LIST@69..69 + 3: R_CURLY@69..70 "}" [] [] + 2: JS_BOGUS_STATEMENT@70..102 + 0: JS_DECORATOR_LIST@70..70 + 1: EXPORT_KW@70..78 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@78..102 + 0: FUNCTION_KW@78..87 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@87..91 + 0: IDENT@87..91 "foo1" [] [] + 2: JS_BOGUS@91..97 + 0: L_ANGLE@91..92 "<" [] [] + 1: JS_BOGUS@92..96 + 0: JS_BOGUS@92..96 + 0: JS_BOGUS@92..95 + 0: IN_KW@92..95 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@95..96 + 0: IDENT@95..96 "T" [] [] + 2: R_ANGLE@96..97 ">" [] [] + 3: JS_PARAMETERS@97..100 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_PARAMETER_LIST@98..98 + 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@100..102 + 0: L_CURLY@100..101 "{" [] [] + 1: JS_DIRECTIVE_LIST@101..101 + 2: JS_STATEMENT_LIST@101..101 + 3: R_CURLY@101..102 "}" [] [] + 3: JS_BOGUS_STATEMENT@102..135 + 0: JS_DECORATOR_LIST@102..102 + 1: EXPORT_KW@102..110 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@110..135 + 0: FUNCTION_KW@110..119 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@119..123 + 0: IDENT@119..123 "foo2" [] [] + 2: JS_BOGUS@123..130 + 0: L_ANGLE@123..124 "<" [] [] + 1: JS_BOGUS@124..129 + 0: JS_BOGUS@124..129 + 0: JS_BOGUS@124..128 + 0: OUT_KW@124..128 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@128..129 + 0: IDENT@128..129 "T" [] [] + 2: R_ANGLE@129..130 ">" [] [] + 3: JS_PARAMETERS@130..133 + 0: L_PAREN@130..131 "(" [] [] + 1: JS_PARAMETER_LIST@131..131 + 2: R_PAREN@131..133 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@133..135 + 0: L_CURLY@133..134 "{" [] [] + 1: JS_DIRECTIVE_LIST@134..134 + 2: JS_STATEMENT_LIST@134..134 + 3: R_CURLY@134..135 "}" [] [] + 4: JS_VARIABLE_STATEMENT@135..154 + 0: JS_VARIABLE_DECLARATION@135..154 + 0: (empty) + 1: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@140..154 + 0: JS_VARIABLE_DECLARATOR@140..154 + 0: JS_IDENTIFIER_BINDING@140..143 + 0: IDENT@140..143 "foo" [] [] + 1: TS_TYPE_ANNOTATION@143..154 + 0: COLON@143..145 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@145..154 + 0: JS_REFERENCE_IDENTIFIER@145..148 + 0: IDENT@145..148 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@148..154 + 0: L_ANGLE@148..149 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@149..153 + 0: TS_REFERENCE_TYPE@149..152 + 0: JS_REFERENCE_IDENTIFIER@149..152 + 0: IDENT@149..152 "in" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@152..153 + 0: JS_REFERENCE_IDENTIFIER@152..153 + 0: IDENT@152..153 "T" [] [] + 1: (empty) + 2: R_ANGLE@153..154 ">" [] [] + 2: (empty) + 1: (empty) + 5: JS_VARIABLE_STATEMENT@154..174 + 0: JS_VARIABLE_DECLARATION@154..174 + 0: (empty) + 1: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@159..174 + 0: JS_VARIABLE_DECLARATOR@159..174 + 0: JS_IDENTIFIER_BINDING@159..162 + 0: IDENT@159..162 "foo" [] [] + 1: TS_TYPE_ANNOTATION@162..174 + 0: COLON@162..164 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@164..174 + 0: JS_REFERENCE_IDENTIFIER@164..167 + 0: IDENT@164..167 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@167..174 + 0: L_ANGLE@167..168 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@168..173 + 0: TS_REFERENCE_TYPE@168..172 + 0: JS_REFERENCE_IDENTIFIER@168..172 + 0: IDENT@168..172 "out" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@172..173 + 0: JS_REFERENCE_IDENTIFIER@172..173 + 0: IDENT@172..173 "T" [] [] + 1: (empty) + 2: R_ANGLE@173..174 ">" [] [] + 2: (empty) + 1: (empty) + 6: JS_BOGUS_STATEMENT@174..203 + 0: DECLARE_KW@174..183 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@183..203 + 0: FUNCTION_KW@183..192 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@192..195 + 0: IDENT@192..195 "foo" [] [] + 2: JS_BOGUS@195..201 + 0: L_ANGLE@195..196 "<" [] [] + 1: JS_BOGUS@196..200 + 0: JS_BOGUS@196..200 + 0: JS_BOGUS@196..199 + 0: IN_KW@196..199 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@199..200 + 0: IDENT@199..200 "T" [] [] + 2: R_ANGLE@200..201 ">" [] [] + 3: JS_PARAMETERS@201..203 + 0: L_PAREN@201..202 "(" [] [] + 1: JS_PARAMETER_LIST@202..202 + 2: R_PAREN@202..203 ")" [] [] + 7: JS_BOGUS_STATEMENT@203..233 + 0: DECLARE_KW@203..212 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS_STATEMENT@212..233 + 0: FUNCTION_KW@212..221 "function" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@221..224 + 0: IDENT@221..224 "foo" [] [] + 2: JS_BOGUS@224..231 + 0: L_ANGLE@224..225 "<" [] [] + 1: JS_BOGUS@225..230 + 0: JS_BOGUS@225..230 + 0: JS_BOGUS@225..229 + 0: OUT_KW@225..229 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@229..230 + 0: IDENT@229..230 "T" [] [] + 2: R_ANGLE@230..231 ">" [] [] + 3: JS_PARAMETERS@231..233 + 0: L_PAREN@231..232 "(" [] [] + 1: JS_PARAMETER_LIST@232..232 + 2: R_PAREN@232..233 ")" [] [] + 8: TS_DECLARE_STATEMENT@233..260 + 0: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@242..260 + 0: JS_VARIABLE_DECLARATION@242..260 + 0: (empty) + 1: LET_KW@242..246 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@246..260 + 0: JS_VARIABLE_DECLARATOR@246..260 + 0: JS_IDENTIFIER_BINDING@246..249 + 0: IDENT@246..249 "foo" [] [] + 1: TS_TYPE_ANNOTATION@249..260 + 0: COLON@249..251 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@251..260 + 0: JS_REFERENCE_IDENTIFIER@251..254 + 0: IDENT@251..254 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@254..260 + 0: L_ANGLE@254..255 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@255..259 + 0: TS_REFERENCE_TYPE@255..258 + 0: JS_REFERENCE_IDENTIFIER@255..258 + 0: IDENT@255..258 "in" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@258..259 + 0: JS_REFERENCE_IDENTIFIER@258..259 + 0: IDENT@258..259 "T" [] [] + 1: (empty) + 2: R_ANGLE@259..260 ">" [] [] + 2: (empty) + 1: (empty) + 9: TS_DECLARE_STATEMENT@260..288 + 0: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@269..288 + 0: JS_VARIABLE_DECLARATION@269..288 + 0: (empty) + 1: LET_KW@269..273 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@273..288 + 0: JS_VARIABLE_DECLARATOR@273..288 + 0: JS_IDENTIFIER_BINDING@273..276 + 0: IDENT@273..276 "foo" [] [] + 1: TS_TYPE_ANNOTATION@276..288 + 0: COLON@276..278 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@278..288 + 0: JS_REFERENCE_IDENTIFIER@278..281 + 0: IDENT@278..281 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@281..288 + 0: L_ANGLE@281..282 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@282..287 + 0: TS_REFERENCE_TYPE@282..286 + 0: JS_REFERENCE_IDENTIFIER@282..286 + 0: IDENT@282..286 "out" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@286..287 + 0: JS_REFERENCE_IDENTIFIER@286..287 + 0: IDENT@286..287 "T" [] [] + 1: (empty) + 2: R_ANGLE@287..288 ">" [] [] + 2: (empty) + 1: (empty) + 10: JS_EXPRESSION_STATEMENT@288..315 + 0: JS_ASSIGNMENT_EXPRESSION@288..315 + 0: JS_IDENTIFIER_ASSIGNMENT@288..293 + 0: IDENT@288..293 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@293..295 "=" [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@295..315 + 0: FUNCTION_KW@295..304 "function" [] [Whitespace(" ")] + 1: JS_BOGUS@304..310 + 0: L_ANGLE@304..305 "<" [] [] + 1: JS_BOGUS@305..309 + 0: JS_BOGUS@305..309 + 0: JS_BOGUS@305..308 + 0: IN_KW@305..308 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@308..309 + 0: IDENT@308..309 "T" [] [] + 2: R_ANGLE@309..310 ">" [] [] + 2: JS_PARAMETERS@310..313 + 0: L_PAREN@310..311 "(" [] [] + 1: JS_PARAMETER_LIST@311..311 + 2: R_PAREN@311..313 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@313..315 + 0: L_CURLY@313..314 "{" [] [] + 1: JS_DIRECTIVE_LIST@314..314 + 2: JS_STATEMENT_LIST@314..314 + 3: R_CURLY@314..315 "}" [] [] + 1: (empty) + 11: JS_EXPRESSION_STATEMENT@315..343 + 0: JS_ASSIGNMENT_EXPRESSION@315..343 + 0: JS_IDENTIFIER_ASSIGNMENT@315..320 + 0: IDENT@315..320 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@320..322 "=" [] [Whitespace(" ")] + 2: JS_BOGUS_EXPRESSION@322..343 + 0: FUNCTION_KW@322..331 "function" [] [Whitespace(" ")] + 1: JS_BOGUS@331..338 + 0: L_ANGLE@331..332 "<" [] [] + 1: JS_BOGUS@332..337 + 0: JS_BOGUS@332..337 + 0: JS_BOGUS@332..336 + 0: OUT_KW@332..336 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@336..337 + 0: IDENT@336..337 "T" [] [] + 2: R_ANGLE@337..338 ">" [] [] + 2: JS_PARAMETERS@338..341 + 0: L_PAREN@338..339 "(" [] [] + 1: JS_PARAMETER_LIST@339..339 + 2: R_PAREN@339..341 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@341..343 + 0: L_CURLY@341..342 "{" [] [] + 1: JS_DIRECTIVE_LIST@342..342 + 2: JS_STATEMENT_LIST@342..342 + 3: R_CURLY@342..343 "}" [] [] + 1: (empty) + 12: JS_CLASS_DECLARATION@343..375 + 0: JS_DECORATOR_LIST@343..343 + 1: (empty) + 2: CLASS_KW@343..350 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@350..354 + 0: IDENT@350..354 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@354..356 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@356..374 + 0: JS_BOGUS_MEMBER@356..374 + 0: JS_METHOD_MODIFIER_LIST@356..356 + 1: JS_LITERAL_MEMBER_NAME@356..359 + 0: IDENT@356..359 "foo" [] [] + 2: JS_BOGUS@359..365 + 0: L_ANGLE@359..360 "<" [] [] + 1: JS_BOGUS@360..364 + 0: JS_BOGUS@360..364 + 0: JS_BOGUS@360..363 + 0: IN_KW@360..363 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@363..364 + 0: IDENT@363..364 "T" [] [] + 2: R_ANGLE@364..365 ">" [] [] + 3: JS_PARAMETERS@365..367 + 0: L_PAREN@365..366 "(" [] [] + 1: JS_PARAMETER_LIST@366..366 + 2: R_PAREN@366..367 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@367..371 + 0: COLON@367..369 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@369..371 + 0: JS_REFERENCE_IDENTIFIER@369..371 + 0: IDENT@369..371 "T" [] [Whitespace(" ")] + 1: (empty) + 5: JS_FUNCTION_BODY@371..374 + 0: L_CURLY@371..372 "{" [] [] + 1: JS_DIRECTIVE_LIST@372..372 + 2: JS_STATEMENT_LIST@372..372 + 3: R_CURLY@372..374 "}" [] [Whitespace(" ")] + 9: R_CURLY@374..375 "}" [] [] + 13: JS_CLASS_DECLARATION@375..408 + 0: JS_DECORATOR_LIST@375..375 + 1: (empty) + 2: CLASS_KW@375..382 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@382..386 + 0: IDENT@382..386 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@386..388 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@388..407 + 0: JS_BOGUS_MEMBER@388..407 + 0: JS_METHOD_MODIFIER_LIST@388..388 + 1: JS_LITERAL_MEMBER_NAME@388..391 + 0: IDENT@388..391 "foo" [] [] + 2: JS_BOGUS@391..398 + 0: L_ANGLE@391..392 "<" [] [] + 1: JS_BOGUS@392..397 + 0: JS_BOGUS@392..397 + 0: JS_BOGUS@392..396 + 0: OUT_KW@392..396 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@396..397 + 0: IDENT@396..397 "T" [] [] + 2: R_ANGLE@397..398 ">" [] [] + 3: JS_PARAMETERS@398..400 + 0: L_PAREN@398..399 "(" [] [] + 1: JS_PARAMETER_LIST@399..399 + 2: R_PAREN@399..400 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@400..404 + 0: COLON@400..402 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@402..404 + 0: JS_REFERENCE_IDENTIFIER@402..404 + 0: IDENT@402..404 "T" [] [Whitespace(" ")] + 1: (empty) + 5: JS_FUNCTION_BODY@404..407 + 0: L_CURLY@404..405 "{" [] [] + 1: JS_DIRECTIVE_LIST@405..405 + 2: JS_STATEMENT_LIST@405..405 + 3: R_CURLY@405..407 "}" [] [Whitespace(" ")] + 9: R_CURLY@407..408 "}" [] [] + 14: JS_EXPRESSION_STATEMENT@408..437 + 0: JS_ASSIGNMENT_EXPRESSION@408..436 + 0: JS_IDENTIFIER_ASSIGNMENT@408..413 + 0: IDENT@408..413 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@413..415 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@415..436 + 0: L_CURLY@415..417 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@417..435 + 0: JS_BOGUS_MEMBER@417..435 + 0: JS_LITERAL_MEMBER_NAME@417..420 + 0: IDENT@417..420 "foo" [] [] + 1: JS_BOGUS@420..426 + 0: L_ANGLE@420..421 "<" [] [] + 1: JS_BOGUS@421..425 + 0: JS_BOGUS@421..425 + 0: JS_BOGUS@421..424 + 0: IN_KW@421..424 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@424..425 + 0: IDENT@424..425 "T" [] [] + 2: R_ANGLE@425..426 ">" [] [] + 2: JS_PARAMETERS@426..428 + 0: L_PAREN@426..427 "(" [] [] + 1: JS_PARAMETER_LIST@427..427 + 2: R_PAREN@427..428 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@428..432 + 0: COLON@428..430 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@430..432 + 0: JS_REFERENCE_IDENTIFIER@430..432 + 0: IDENT@430..432 "T" [] [Whitespace(" ")] + 1: (empty) + 4: JS_FUNCTION_BODY@432..435 + 0: L_CURLY@432..433 "{" [] [] + 1: JS_DIRECTIVE_LIST@433..433 + 2: JS_STATEMENT_LIST@433..433 + 3: R_CURLY@433..435 "}" [] [Whitespace(" ")] + 2: R_CURLY@435..436 "}" [] [] + 1: SEMICOLON@436..437 ";" [] [] + 15: JS_EXPRESSION_STATEMENT@437..467 + 0: JS_ASSIGNMENT_EXPRESSION@437..466 + 0: JS_IDENTIFIER_ASSIGNMENT@437..442 + 0: IDENT@437..442 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@442..444 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@444..466 + 0: L_CURLY@444..446 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@446..465 + 0: JS_BOGUS_MEMBER@446..465 + 0: JS_LITERAL_MEMBER_NAME@446..449 + 0: IDENT@446..449 "foo" [] [] + 1: JS_BOGUS@449..456 + 0: L_ANGLE@449..450 "<" [] [] + 1: JS_BOGUS@450..455 + 0: JS_BOGUS@450..455 + 0: JS_BOGUS@450..454 + 0: OUT_KW@450..454 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@454..455 + 0: IDENT@454..455 "T" [] [] + 2: R_ANGLE@455..456 ">" [] [] + 2: JS_PARAMETERS@456..458 + 0: L_PAREN@456..457 "(" [] [] + 1: JS_PARAMETER_LIST@457..457 + 2: R_PAREN@457..458 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@458..462 + 0: COLON@458..460 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@460..462 + 0: JS_REFERENCE_IDENTIFIER@460..462 + 0: IDENT@460..462 "T" [] [Whitespace(" ")] + 1: (empty) + 4: JS_FUNCTION_BODY@462..465 + 0: L_CURLY@462..463 "{" [] [] + 1: JS_DIRECTIVE_LIST@463..463 + 2: JS_STATEMENT_LIST@463..463 + 3: R_CURLY@463..465 "}" [] [Whitespace(" ")] + 2: R_CURLY@465..466 "}" [] [] + 1: SEMICOLON@466..467 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@467..483 + 0: JS_BOGUS_EXPRESSION@467..482 + 0: JS_BOGUS@467..474 + 0: L_ANGLE@467..469 "<" [Newline("\n")] [] + 1: JS_BOGUS@469..473 + 0: JS_BOGUS@469..473 + 0: JS_BOGUS@469..472 + 0: IN_KW@469..472 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@472..473 + 0: IDENT@472..473 "T" [] [] + 2: R_ANGLE@473..474 ">" [] [] + 1: JS_PARAMETERS@474..477 + 0: L_PAREN@474..475 "(" [] [] + 1: JS_PARAMETER_LIST@475..475 + 2: R_PAREN@475..477 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@477..480 "=>" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@480..482 + 0: L_CURLY@480..481 "{" [] [] + 1: JS_DIRECTIVE_LIST@481..481 + 2: JS_STATEMENT_LIST@481..481 + 3: R_CURLY@481..482 "}" [] [] + 1: SEMICOLON@482..483 ";" [] [] + 17: JS_EXPRESSION_STATEMENT@483..500 + 0: JS_BOGUS_EXPRESSION@483..499 + 0: JS_BOGUS@483..491 + 0: L_ANGLE@483..485 "<" [Newline("\n")] [] + 1: JS_BOGUS@485..490 + 0: JS_BOGUS@485..490 + 0: JS_BOGUS@485..489 + 0: OUT_KW@485..489 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@489..490 + 0: IDENT@489..490 "T" [] [] + 2: R_ANGLE@490..491 ">" [] [] + 1: JS_PARAMETERS@491..494 + 0: L_PAREN@491..492 "(" [] [] + 1: JS_PARAMETER_LIST@492..492 + 2: R_PAREN@492..494 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@494..497 "=>" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@497..499 + 0: L_CURLY@497..498 "{" [] [] + 1: JS_DIRECTIVE_LIST@498..498 + 2: JS_STATEMENT_LIST@498..498 + 3: R_CURLY@498..499 "}" [] [] + 1: SEMICOLON@499..500 ";" [] [] + 18: JS_EXPRESSION_STATEMENT@500..523 + 0: JS_BOGUS_EXPRESSION@500..522 + 0: JS_BOGUS@500..514 + 0: L_ANGLE@500..502 "<" [Newline("\n")] [] + 1: JS_BOGUS@502..513 + 0: JS_BOGUS@502..506 + 0: JS_BOGUS@502..505 + 0: IN_KW@502..505 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@505..506 + 0: IDENT@505..506 "T" [] [] + 1: COMMA@506..508 "," [] [Whitespace(" ")] + 2: JS_BOGUS@508..513 + 0: JS_BOGUS@508..512 + 0: OUT_KW@508..512 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@512..513 + 0: IDENT@512..513 "T" [] [] + 2: R_ANGLE@513..514 ">" [] [] + 1: JS_PARAMETERS@514..517 + 0: L_PAREN@514..515 "(" [] [] + 1: JS_PARAMETER_LIST@515..515 + 2: R_PAREN@515..517 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@517..520 "=>" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@520..522 + 0: L_CURLY@520..521 "{" [] [] + 1: JS_DIRECTIVE_LIST@521..521 + 2: JS_STATEMENT_LIST@521..521 + 3: R_CURLY@521..522 "}" [] [] + 1: SEMICOLON@522..523 ";" [] [] + 19: JS_VARIABLE_STATEMENT@523..546 + 0: JS_VARIABLE_DECLARATION@523..545 + 0: (empty) + 1: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@528..545 + 0: JS_VARIABLE_DECLARATOR@528..545 + 0: JS_IDENTIFIER_BINDING@528..529 + 0: IDENT@528..529 "x" [] [] + 1: TS_TYPE_ANNOTATION@529..545 + 0: COLON@529..531 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@531..545 + 0: JS_BOGUS@531..537 + 0: L_ANGLE@531..532 "<" [] [] + 1: JS_BOGUS@532..536 + 0: JS_BOGUS@532..536 + 0: JS_BOGUS@532..535 + 0: IN_KW@532..535 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@535..536 + 0: IDENT@535..536 "T" [] [] + 2: R_ANGLE@536..537 ">" [] [] + 1: JS_PARAMETERS@537..540 + 0: L_PAREN@537..538 "(" [] [] + 1: JS_PARAMETER_LIST@538..538 + 2: R_PAREN@538..540 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@540..543 "=>" [] [Whitespace(" ")] + 3: TS_OBJECT_TYPE@543..545 + 0: L_CURLY@543..544 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@544..544 + 2: R_CURLY@544..545 "}" [] [] + 2: (empty) + 1: SEMICOLON@545..546 ";" [] [] + 20: JS_VARIABLE_STATEMENT@546..570 + 0: JS_VARIABLE_DECLARATION@546..569 + 0: (empty) + 1: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@551..569 + 0: JS_VARIABLE_DECLARATOR@551..569 + 0: JS_IDENTIFIER_BINDING@551..552 + 0: IDENT@551..552 "x" [] [] + 1: TS_TYPE_ANNOTATION@552..569 + 0: COLON@552..554 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@554..569 + 0: JS_BOGUS@554..561 + 0: L_ANGLE@554..555 "<" [] [] + 1: JS_BOGUS@555..560 + 0: JS_BOGUS@555..560 + 0: JS_BOGUS@555..559 + 0: OUT_KW@555..559 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@559..560 + 0: IDENT@559..560 "T" [] [] + 2: R_ANGLE@560..561 ">" [] [] + 1: JS_PARAMETERS@561..564 + 0: L_PAREN@561..562 "(" [] [] + 1: JS_PARAMETER_LIST@562..562 + 2: R_PAREN@562..564 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@564..567 "=>" [] [Whitespace(" ")] + 3: TS_OBJECT_TYPE@567..569 + 0: L_CURLY@567..568 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@568..568 + 2: R_CURLY@568..569 "}" [] [] + 2: (empty) + 1: SEMICOLON@569..570 ";" [] [] + 21: JS_VARIABLE_STATEMENT@570..600 + 0: JS_VARIABLE_DECLARATION@570..599 + 0: (empty) + 1: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@575..599 + 0: JS_VARIABLE_DECLARATOR@575..599 + 0: JS_IDENTIFIER_BINDING@575..576 + 0: IDENT@575..576 "x" [] [] + 1: TS_TYPE_ANNOTATION@576..599 + 0: COLON@576..578 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@578..599 + 0: JS_BOGUS@578..591 + 0: L_ANGLE@578..579 "<" [] [] + 1: JS_BOGUS@579..590 + 0: JS_BOGUS@579..583 + 0: JS_BOGUS@579..582 + 0: IN_KW@579..582 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@582..583 + 0: IDENT@582..583 "T" [] [] + 1: COMMA@583..585 "," [] [Whitespace(" ")] + 2: JS_BOGUS@585..590 + 0: JS_BOGUS@585..589 + 0: OUT_KW@585..589 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@589..590 + 0: IDENT@589..590 "T" [] [] + 2: R_ANGLE@590..591 ">" [] [] + 1: JS_PARAMETERS@591..594 + 0: L_PAREN@591..592 "(" [] [] + 1: JS_PARAMETER_LIST@592..592 + 2: R_PAREN@592..594 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@594..597 "=>" [] [Whitespace(" ")] + 3: TS_OBJECT_TYPE@597..599 + 0: L_CURLY@597..598 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@598..598 + 2: R_CURLY@598..599 "}" [] [] + 2: (empty) + 1: SEMICOLON@599..600 ";" [] [] + 22: JS_VARIABLE_STATEMENT@600..627 + 0: JS_VARIABLE_DECLARATION@600..626 + 0: (empty) + 1: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@605..626 + 0: JS_VARIABLE_DECLARATOR@605..626 + 0: JS_IDENTIFIER_BINDING@605..606 + 0: IDENT@605..606 "x" [] [] + 1: TS_TYPE_ANNOTATION@606..626 + 0: COLON@606..608 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@608..626 + 0: NEW_KW@608..612 "new" [] [Whitespace(" ")] + 1: JS_BOGUS@612..618 + 0: L_ANGLE@612..613 "<" [] [] + 1: JS_BOGUS@613..617 + 0: JS_BOGUS@613..617 + 0: JS_BOGUS@613..616 + 0: IN_KW@613..616 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@616..617 + 0: IDENT@616..617 "T" [] [] + 2: R_ANGLE@617..618 ">" [] [] + 2: JS_PARAMETERS@618..621 + 0: L_PAREN@618..619 "(" [] [] + 1: JS_PARAMETER_LIST@619..619 + 2: R_PAREN@619..621 ")" [] [Whitespace(" ")] + 3: FAT_ARROW@621..624 "=>" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@624..626 + 0: L_CURLY@624..625 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@625..625 + 2: R_CURLY@625..626 "}" [] [] + 2: (empty) + 1: SEMICOLON@626..627 ";" [] [] + 23: JS_VARIABLE_STATEMENT@627..655 + 0: JS_VARIABLE_DECLARATION@627..654 + 0: (empty) + 1: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@632..654 + 0: JS_VARIABLE_DECLARATOR@632..654 + 0: JS_IDENTIFIER_BINDING@632..633 + 0: IDENT@632..633 "x" [] [] + 1: TS_TYPE_ANNOTATION@633..654 + 0: COLON@633..635 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@635..654 + 0: NEW_KW@635..639 "new" [] [Whitespace(" ")] + 1: JS_BOGUS@639..646 + 0: L_ANGLE@639..640 "<" [] [] + 1: JS_BOGUS@640..645 + 0: JS_BOGUS@640..645 + 0: JS_BOGUS@640..644 + 0: OUT_KW@640..644 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@644..645 + 0: IDENT@644..645 "T" [] [] + 2: R_ANGLE@645..646 ">" [] [] + 2: JS_PARAMETERS@646..649 + 0: L_PAREN@646..647 "(" [] [] + 1: JS_PARAMETER_LIST@647..647 + 2: R_PAREN@647..649 ")" [] [Whitespace(" ")] + 3: FAT_ARROW@649..652 "=>" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@652..654 + 0: L_CURLY@652..653 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@653..653 + 2: R_CURLY@653..654 "}" [] [] + 2: (empty) + 1: SEMICOLON@654..655 ";" [] [] + 24: JS_VARIABLE_STATEMENT@655..689 + 0: JS_VARIABLE_DECLARATION@655..688 + 0: (empty) + 1: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@660..688 + 0: JS_VARIABLE_DECLARATOR@660..688 + 0: JS_IDENTIFIER_BINDING@660..661 + 0: IDENT@660..661 "x" [] [] + 1: TS_TYPE_ANNOTATION@661..688 + 0: COLON@661..663 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@663..688 + 0: NEW_KW@663..667 "new" [] [Whitespace(" ")] + 1: JS_BOGUS@667..680 + 0: L_ANGLE@667..668 "<" [] [] + 1: JS_BOGUS@668..679 + 0: JS_BOGUS@668..672 + 0: JS_BOGUS@668..671 + 0: IN_KW@668..671 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@671..672 + 0: IDENT@671..672 "T" [] [] + 1: COMMA@672..674 "," [] [Whitespace(" ")] + 2: JS_BOGUS@674..679 + 0: JS_BOGUS@674..678 + 0: OUT_KW@674..678 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@678..679 + 0: IDENT@678..679 "T" [] [] + 2: R_ANGLE@679..680 ">" [] [] + 2: JS_PARAMETERS@680..683 + 0: L_PAREN@680..681 "(" [] [] + 1: JS_PARAMETER_LIST@681..681 + 2: R_PAREN@681..683 ")" [] [Whitespace(" ")] + 3: FAT_ARROW@683..686 "=>" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@686..688 + 0: L_CURLY@686..687 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@687..687 + 2: R_CURLY@687..688 "}" [] [] + 2: (empty) + 1: SEMICOLON@688..689 ";" [] [] + 25: JS_VARIABLE_STATEMENT@689..716 + 0: JS_VARIABLE_DECLARATION@689..715 + 0: (empty) + 1: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@694..715 + 0: JS_VARIABLE_DECLARATOR@694..715 + 0: JS_IDENTIFIER_BINDING@694..695 + 0: IDENT@694..695 "x" [] [] + 1: TS_TYPE_ANNOTATION@695..715 + 0: COLON@695..697 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@697..715 + 0: L_CURLY@697..699 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@699..714 + 0: JS_BOGUS@699..714 + 0: JS_LITERAL_MEMBER_NAME@699..700 + 0: IDENT@699..700 "y" [] [] + 1: JS_BOGUS@700..706 + 0: L_ANGLE@700..701 "<" [] [] + 1: JS_BOGUS@701..705 + 0: JS_BOGUS@701..705 + 0: JS_BOGUS@701..704 + 0: IN_KW@701..704 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@704..705 + 0: IDENT@704..705 "T" [] [] + 2: R_ANGLE@705..706 ">" [] [] + 2: JS_PARAMETERS@706..708 + 0: L_PAREN@706..707 "(" [] [] + 1: JS_PARAMETER_LIST@707..707 + 2: R_PAREN@707..708 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@708..714 + 0: COLON@708..710 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@710..714 + 0: ANY_KW@710..714 "any" [] [Whitespace(" ")] + 2: R_CURLY@714..715 "}" [] [] + 2: (empty) + 1: SEMICOLON@715..716 ";" [] [] + 26: JS_VARIABLE_STATEMENT@716..744 + 0: JS_VARIABLE_DECLARATION@716..743 + 0: (empty) + 1: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@721..743 + 0: JS_VARIABLE_DECLARATOR@721..743 + 0: JS_IDENTIFIER_BINDING@721..722 + 0: IDENT@721..722 "x" [] [] + 1: TS_TYPE_ANNOTATION@722..743 + 0: COLON@722..724 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@724..743 + 0: L_CURLY@724..726 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@726..742 + 0: JS_BOGUS@726..742 + 0: JS_LITERAL_MEMBER_NAME@726..727 + 0: IDENT@726..727 "y" [] [] + 1: JS_BOGUS@727..734 + 0: L_ANGLE@727..728 "<" [] [] + 1: JS_BOGUS@728..733 + 0: JS_BOGUS@728..733 + 0: JS_BOGUS@728..732 + 0: OUT_KW@728..732 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@732..733 + 0: IDENT@732..733 "T" [] [] + 2: R_ANGLE@733..734 ">" [] [] + 2: JS_PARAMETERS@734..736 + 0: L_PAREN@734..735 "(" [] [] + 1: JS_PARAMETER_LIST@735..735 + 2: R_PAREN@735..736 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@736..742 + 0: COLON@736..738 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@738..742 + 0: ANY_KW@738..742 "any" [] [Whitespace(" ")] + 2: R_CURLY@742..743 "}" [] [] + 2: (empty) + 1: SEMICOLON@743..744 ";" [] [] + 27: JS_VARIABLE_STATEMENT@744..778 + 0: JS_VARIABLE_DECLARATION@744..777 + 0: (empty) + 1: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@749..777 + 0: JS_VARIABLE_DECLARATOR@749..777 + 0: JS_IDENTIFIER_BINDING@749..750 + 0: IDENT@749..750 "x" [] [] + 1: TS_TYPE_ANNOTATION@750..777 + 0: COLON@750..752 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@752..777 + 0: L_CURLY@752..754 "{" [] [Whitespace(" ")] + 1: JS_BOGUS@754..776 + 0: JS_BOGUS@754..776 + 0: JS_LITERAL_MEMBER_NAME@754..755 + 0: IDENT@754..755 "y" [] [] + 1: JS_BOGUS@755..768 + 0: L_ANGLE@755..756 "<" [] [] + 1: JS_BOGUS@756..767 + 0: JS_BOGUS@756..760 + 0: JS_BOGUS@756..759 + 0: IN_KW@756..759 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@759..760 + 0: IDENT@759..760 "T" [] [] + 1: COMMA@760..762 "," [] [Whitespace(" ")] + 2: JS_BOGUS@762..767 + 0: JS_BOGUS@762..766 + 0: OUT_KW@762..766 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@766..767 + 0: IDENT@766..767 "T" [] [] + 2: R_ANGLE@767..768 ">" [] [] + 2: JS_PARAMETERS@768..770 + 0: L_PAREN@768..769 "(" [] [] + 1: JS_PARAMETER_LIST@769..769 + 2: R_PAREN@769..770 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@770..776 + 0: COLON@770..772 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@772..776 + 0: ANY_KW@772..776 "any" [] [Whitespace(" ")] + 2: R_CURLY@776..777 "}" [] [] + 2: (empty) + 1: SEMICOLON@777..778 ";" [] [] + 28: JS_BOGUS_STATEMENT@778..804 + 0: TYPE_KW@778..784 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@784..787 + 0: IDENT@784..787 "Foo" [] [] + 2: JS_BOGUS@787..800 + 0: L_ANGLE@787..788 "<" [] [] + 1: JS_BOGUS@788..798 + 0: TS_TYPE_PARAMETER@788..789 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@788..788 + 1: TS_TYPE_PARAMETER_NAME@788..789 + 0: IDENT@788..789 "i" [] [] + 2: (empty) + 3: (empty) + 1: TS_TYPE_PARAMETER_MODIFIER_LIST@789..789 + 2: TS_BOGUS_TYPE@789..790 + 0: ERROR_TOKEN@789..790 "\\" [] [] + 3: TS_TYPE_PARAMETER@790..797 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@790..790 + 1: TS_TYPE_PARAMETER_NAME@790..797 + 0: IDENT@790..797 "\\u006E" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETER@797..798 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@797..797 + 1: TS_TYPE_PARAMETER_NAME@797..798 + 0: IDENT@797..798 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@798..800 ">" [] [Whitespace(" ")] + 3: EQ@800..802 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@802..804 + 0: L_CURLY@802..803 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@803..803 + 2: R_CURLY@803..804 "}" [] [] + 29: JS_BOGUS_STATEMENT@804..831 + 0: TYPE_KW@804..810 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@810..813 + 0: IDENT@810..813 "Foo" [] [] + 2: JS_BOGUS@813..827 + 0: L_ANGLE@813..814 "<" [] [] + 1: JS_BOGUS@814..825 + 0: TS_TYPE_PARAMETER@814..816 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@814..814 + 1: TS_TYPE_PARAMETER_NAME@814..816 + 0: IDENT@814..816 "ou" [] [] + 2: (empty) + 3: (empty) + 1: TS_TYPE_PARAMETER_MODIFIER_LIST@816..816 + 2: TS_BOGUS_TYPE@816..817 + 0: ERROR_TOKEN@816..817 "\\" [] [] + 3: TS_TYPE_PARAMETER@817..824 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@817..817 + 1: TS_TYPE_PARAMETER_NAME@817..824 + 0: IDENT@817..824 "\\u0074" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETER@824..825 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@824..824 + 1: TS_TYPE_PARAMETER_NAME@824..825 + 0: IDENT@824..825 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@825..827 ">" [] [Whitespace(" ")] + 3: EQ@827..829 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@829..831 + 0: L_CURLY@829..830 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@830..830 + 2: R_CURLY@830..831 "}" [] [] + 30: JS_BOGUS_STATEMENT@831..852 + 0: TYPE_KW@831..837 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@837..840 + 0: IDENT@837..840 "Foo" [] [] + 2: JS_BOGUS@840..848 + 0: L_ANGLE@840..841 "<" [] [] + 1: JS_BOGUS@841..846 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@841..844 + 0: TS_IN_MODIFIER@841..844 + 0: IN_KW@841..844 "in" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@844..846 + 0: IN_KW@844..846 "in" [] [] + 2: R_ANGLE@846..848 ">" [] [Whitespace(" ")] + 3: EQ@848..850 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@850..852 + 0: L_CURLY@850..851 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@851..851 + 2: R_CURLY@851..852 "}" [] [] + 31: JS_BOGUS_STATEMENT@852..874 + 0: TYPE_KW@852..858 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@858..861 + 0: IDENT@858..861 "Foo" [] [] + 2: JS_BOGUS@861..870 + 0: L_ANGLE@861..862 "<" [] [] + 1: JS_BOGUS@862..868 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@862..866 + 0: TS_OUT_MODIFIER@862..866 + 0: OUT_KW@862..866 "out" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@866..868 + 0: IN_KW@866..868 "in" [] [] + 2: R_ANGLE@868..870 ">" [] [Whitespace(" ")] + 3: EQ@870..872 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@872..874 + 0: L_CURLY@872..873 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@873..873 + 2: R_CURLY@873..874 "}" [] [] + 32: JS_BOGUS_STATEMENT@874..898 + 0: TYPE_KW@874..880 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@880..883 + 0: IDENT@880..883 "Foo" [] [] + 2: JS_BOGUS@883..894 + 0: L_ANGLE@883..884 "<" [] [] + 1: JS_BOGUS@884..892 + 0: JS_BOGUS@884..892 + 0: JS_BOGUS@884..891 + 0: TS_OUT_MODIFIER@884..888 + 0: OUT_KW@884..888 "out" [] [Whitespace(" ")] + 1: IN_KW@888..891 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@891..892 + 0: IDENT@891..892 "T" [] [] + 2: R_ANGLE@892..894 ">" [] [Whitespace(" ")] + 3: EQ@894..896 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@896..898 + 0: L_CURLY@896..897 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@897..897 + 2: R_CURLY@897..898 "}" [] [] + 33: JS_BOGUS_STATEMENT@898..922 + 0: TYPE_KW@898..904 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@904..907 + 0: IDENT@904..907 "Foo" [] [] + 2: JS_BOGUS@907..918 + 0: L_ANGLE@907..908 "<" [] [] + 1: JS_BOGUS@908..916 + 0: JS_BOGUS@908..915 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@908..908 + 1: JS_BOGUS@908..915 + 0: IDENT@908..915 "public" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER@915..916 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@915..915 + 1: TS_TYPE_PARAMETER_NAME@915..916 + 0: IDENT@915..916 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@916..918 ">" [] [Whitespace(" ")] + 3: EQ@918..920 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@920..922 + 0: L_CURLY@920..921 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@921..921 + 2: R_CURLY@921..922 "}" [] [] + 34: TS_TYPE_ALIAS_DECLARATION@922..944 + 0: TYPE_KW@922..928 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@928..931 + 0: IDENT@928..931 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@931..940 + 0: L_ANGLE@931..932 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@932..938 + 0: TS_TYPE_PARAMETER@932..937 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@932..932 + 1: TS_TYPE_PARAMETER_NAME@932..937 + 0: IDENT@932..937 "innn" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER@937..938 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@937..937 + 1: TS_TYPE_PARAMETER_NAME@937..938 + 0: IDENT@937..938 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@938..940 ">" [] [Whitespace(" ")] + 3: EQ@940..942 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@942..944 + 0: L_CURLY@942..943 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@943..943 + 2: R_CURLY@943..944 "}" [] [] + 5: (empty) + 35: JS_BOGUS_STATEMENT@944..971 + 0: TYPE_KW@944..950 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@950..953 + 0: IDENT@950..953 "Foo" [] [] + 2: JS_BOGUS@953..967 + 0: L_ANGLE@953..954 "<" [] [] + 1: JS_BOGUS@954..965 + 0: JS_BOGUS@954..965 + 0: JS_BOGUS@954..964 + 0: TS_IN_MODIFIER@954..957 + 0: IN_KW@954..957 "in" [] [Whitespace(" ")] + 1: TS_OUT_MODIFIER@957..961 + 0: OUT_KW@957..961 "out" [] [Whitespace(" ")] + 2: IN_KW@961..964 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@964..965 + 0: IDENT@964..965 "T" [] [] + 2: R_ANGLE@965..967 ">" [] [Whitespace(" ")] + 3: EQ@967..969 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@969..971 + 0: L_CURLY@969..970 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@970..970 + 2: R_CURLY@970..971 "}" [] [] + 36: JS_BOGUS_STATEMENT@971..999 + 0: TYPE_KW@971..977 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@977..980 + 0: IDENT@977..980 "Foo" [] [] + 2: JS_BOGUS@980..995 + 0: L_ANGLE@980..981 "<" [] [] + 1: JS_BOGUS@981..993 + 0: JS_BOGUS@981..993 + 0: JS_BOGUS@981..992 + 0: TS_IN_MODIFIER@981..984 + 0: IN_KW@981..984 "in" [] [Whitespace(" ")] + 1: TS_OUT_MODIFIER@984..988 + 0: OUT_KW@984..988 "out" [] [Whitespace(" ")] + 2: OUT_KW@988..992 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@992..993 + 0: IDENT@992..993 "T" [] [] + 2: R_ANGLE@993..995 ">" [] [Whitespace(" ")] + 3: EQ@995..997 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@997..999 + 0: L_CURLY@997..998 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@998..998 + 2: R_CURLY@998..999 "}" [] [] + 37: JS_BOGUS_STATEMENT@999..1023 + 0: FUNCTION_KW@999..1009 "function" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@1009..1012 + 0: IDENT@1009..1012 "foo" [] [] + 2: JS_BOGUS@1012..1018 + 0: L_ANGLE@1012..1013 "<" [] [] + 1: JS_BOGUS@1013..1017 + 0: JS_BOGUS@1013..1017 + 0: JS_BOGUS@1013..1016 + 0: IN_KW@1013..1016 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1016..1017 + 0: IDENT@1016..1017 "T" [] [] + 2: R_ANGLE@1017..1018 ">" [] [] + 3: JS_PARAMETERS@1018..1021 + 0: L_PAREN@1018..1019 "(" [] [] + 1: JS_PARAMETER_LIST@1019..1019 + 2: R_PAREN@1019..1021 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@1021..1023 + 0: L_CURLY@1021..1022 "{" [] [] + 1: JS_DIRECTIVE_LIST@1022..1022 + 2: JS_STATEMENT_LIST@1022..1022 + 3: R_CURLY@1022..1023 "}" [] [] + 38: JS_BOGUS_STATEMENT@1023..1048 + 0: FUNCTION_KW@1023..1033 "function" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@1033..1036 + 0: IDENT@1033..1036 "foo" [] [] + 2: JS_BOGUS@1036..1043 + 0: L_ANGLE@1036..1037 "<" [] [] + 1: JS_BOGUS@1037..1042 + 0: JS_BOGUS@1037..1042 + 0: JS_BOGUS@1037..1041 + 0: OUT_KW@1037..1041 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1041..1042 + 0: IDENT@1041..1042 "T" [] [] + 2: R_ANGLE@1042..1043 ">" [] [] + 3: JS_PARAMETERS@1043..1046 + 0: L_PAREN@1043..1044 "(" [] [] + 1: JS_PARAMETER_LIST@1044..1044 + 2: R_PAREN@1044..1046 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@1046..1048 + 0: L_CURLY@1046..1047 "{" [] [] + 1: JS_DIRECTIVE_LIST@1047..1047 + 2: JS_STATEMENT_LIST@1047..1047 + 3: R_CURLY@1047..1048 "}" [] [] + 39: JS_BOGUS_STATEMENT@1048..1072 + 0: TYPE_KW@1048..1054 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1054..1057 + 0: IDENT@1054..1057 "Foo" [] [] + 2: JS_BOGUS@1057..1067 + 0: L_ANGLE@1057..1058 "<" [] [] + 1: JS_BOGUS@1058..1065 + 0: JS_BOGUS@1058..1065 + 0: JS_BOGUS@1058..1064 + 0: CONST_KW@1058..1064 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1064..1065 + 0: IDENT@1064..1065 "U" [] [] + 2: R_ANGLE@1065..1067 ">" [] [Whitespace(" ")] + 3: EQ@1067..1069 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@1069..1071 + 0: L_CURLY@1069..1070 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@1070..1070 + 2: R_CURLY@1070..1071 "}" [] [] + 5: SEMICOLON@1071..1072 ";" [] [] + 4: EOF@1072..1073 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +type_parameter_modifier.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + > 1 │ export default function foo() {} + │ ^^ + 2 │ export function foo() {} + 3 │ export function foo1() {} + +type_parameter_modifier.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 1 │ export default function foo() {} + > 2 │ export function foo() {} + │ ^^^ + 3 │ export function foo1() {} + 4 │ export function foo2() {} + +type_parameter_modifier.ts:3:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 1 │ export default function foo() {} + 2 │ export function foo() {} + > 3 │ export function foo1() {} + │ ^^ + 4 │ export function foo2() {} + 5 │ let foo: Foo + +type_parameter_modifier.ts:4:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 2 │ export function foo() {} + 3 │ export function foo1() {} + > 4 │ export function foo2() {} + │ ^^^ + 5 │ let foo: Foo + 6 │ let foo: Foo + +type_parameter_modifier.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 3 │ export function foo1() {} + 4 │ export function foo2() {} + > 5 │ let foo: Foo + │ ^ + 6 │ let foo: Foo + 7 │ declare function foo() + + i Remove T + +type_parameter_modifier.ts:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 4 │ export function foo2() {} + 5 │ let foo: Foo + > 6 │ let foo: Foo + │ ^ + 7 │ declare function foo() + 8 │ declare function foo() + + i Remove T + +type_parameter_modifier.ts:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 5 │ let foo: Foo + 6 │ let foo: Foo + > 7 │ declare function foo() + │ ^^ + 8 │ declare function foo() + 9 │ declare let foo: Foo + +type_parameter_modifier.ts:8:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 6 │ let foo: Foo + 7 │ declare function foo() + > 8 │ declare function foo() + │ ^^^ + 9 │ declare let foo: Foo + 10 │ declare let foo: Foo + +type_parameter_modifier.ts:9:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 7 │ declare function foo() + 8 │ declare function foo() + > 9 │ declare let foo: Foo + │ ^ + 10 │ declare let foo: Foo + 11 │ foo = function () {} + + i Remove T + +type_parameter_modifier.ts:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 8 │ declare function foo() + 9 │ declare let foo: Foo + > 10 │ declare let foo: Foo + │ ^ + 11 │ foo = function () {} + 12 │ foo = function () {} + + i Remove T + +type_parameter_modifier.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 9 │ declare let foo: Foo + 10 │ declare let foo: Foo + > 11 │ foo = function () {} + │ ^^ + 12 │ foo = function () {} + 13 │ class Foo { foo(): T {} } + +type_parameter_modifier.ts:12:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 10 │ declare let foo: Foo + 11 │ foo = function () {} + > 12 │ foo = function () {} + │ ^^^ + 13 │ class Foo { foo(): T {} } + 14 │ class Foo { foo(): T {} } + +type_parameter_modifier.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 11 │ foo = function () {} + 12 │ foo = function () {} + > 13 │ class Foo { foo(): T {} } + │ ^^ + 14 │ class Foo { foo(): T {} } + 15 │ foo = { foo(): T {} }; + +type_parameter_modifier.ts:14:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 12 │ foo = function () {} + 13 │ class Foo { foo(): T {} } + > 14 │ class Foo { foo(): T {} } + │ ^^^ + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + +type_parameter_modifier.ts:15:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 13 │ class Foo { foo(): T {} } + 14 │ class Foo { foo(): T {} } + > 15 │ foo = { foo(): T {} }; + │ ^^ + 16 │ foo = { foo(): T {} }; + 17 │ () => {}; + +type_parameter_modifier.ts:16:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 14 │ class Foo { foo(): T {} } + 15 │ foo = { foo(): T {} }; + > 16 │ foo = { foo(): T {} }; + │ ^^^ + 17 │ () => {}; + 18 │ () => {}; + +type_parameter_modifier.ts:17:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + > 17 │ () => {}; + │ ^^ + 18 │ () => {}; + 19 │ () => {}; + +type_parameter_modifier.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 16 │ foo = { foo(): T {} }; + 17 │ () => {}; + > 18 │ () => {}; + │ ^^^ + 19 │ () => {}; + 20 │ let x: () => {}; + +type_parameter_modifier.ts:19:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + +type_parameter_modifier.ts:19:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^^^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + +type_parameter_modifier.ts:20:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 18 │ () => {}; + 19 │ () => {}; + > 20 │ let x: () => {}; + │ ^^ + 21 │ let x: () => {}; + 22 │ let x: () => {}; + +type_parameter_modifier.ts:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 19 │ () => {}; + 20 │ let x: () => {}; + > 21 │ let x: () => {}; + │ ^^^ + 22 │ let x: () => {}; + 23 │ let x: new () => {}; + +type_parameter_modifier.ts:22:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 20 │ let x: () => {}; + 21 │ let x: () => {}; + > 22 │ let x: () => {}; + │ ^^ + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + +type_parameter_modifier.ts:22:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 20 │ let x: () => {}; + 21 │ let x: () => {}; + > 22 │ let x: () => {}; + │ ^^^ + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + +type_parameter_modifier.ts:23:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 21 │ let x: () => {}; + 22 │ let x: () => {}; + > 23 │ let x: new () => {}; + │ ^^ + 24 │ let x: new () => {}; + 25 │ let x: new () => {}; + +type_parameter_modifier.ts:24:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 22 │ let x: () => {}; + 23 │ let x: new () => {}; + > 24 │ let x: new () => {}; + │ ^^^ + 25 │ let x: new () => {}; + 26 │ let x: { y(): any }; + +type_parameter_modifier.ts:25:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + > 25 │ let x: new () => {}; + │ ^^ + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + +type_parameter_modifier.ts:25:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + > 25 │ let x: new () => {}; + │ ^^^ + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + +type_parameter_modifier.ts:26:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 24 │ let x: new () => {}; + 25 │ let x: new () => {}; + > 26 │ let x: { y(): any }; + │ ^^ + 27 │ let x: { y(): any }; + 28 │ let x: { y(): any }; + +type_parameter_modifier.ts:27:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 25 │ let x: new () => {}; + 26 │ let x: { y(): any }; + > 27 │ let x: { y(): any }; + │ ^^^ + 28 │ let x: { y(): any }; + 29 │ type Foo = {} + +type_parameter_modifier.ts:28:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + > 28 │ let x: { y(): any }; + │ ^^ + 29 │ type Foo = {} + 30 │ type Foo = {} + +type_parameter_modifier.ts:28:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + > 28 │ let x: { y(): any }; + │ ^^^ + 29 │ type Foo = {} + 30 │ type Foo = {} + +type_parameter_modifier.ts:29:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unexpected token `\` + + 27 │ let x: { y(): any }; + 28 │ let x: { y(): any }; + > 29 │ type Foo = {} + │ ^ + 30 │ type Foo = {} + 31 │ type Foo = {} + +type_parameter_modifier.ts:29:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `\u006E` + + 27 │ let x: { y(): any }; + 28 │ let x: { y(): any }; + > 29 │ type Foo = {} + │ ^^^^^^ + 30 │ type Foo = {} + 31 │ type Foo = {} + + i Remove \u006E + +type_parameter_modifier.ts:29:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 27 │ let x: { y(): any }; + 28 │ let x: { y(): any }; + > 29 │ type Foo = {} + │ ^ + 30 │ type Foo = {} + 31 │ type Foo = {} + + i Remove T + +type_parameter_modifier.ts:30:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unexpected token `\` + + 28 │ let x: { y(): any }; + 29 │ type Foo = {} + > 30 │ type Foo = {} + │ ^ + 31 │ type Foo = {} + 32 │ type Foo = {} + +type_parameter_modifier.ts:30:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `\u0074` + + 28 │ let x: { y(): any }; + 29 │ type Foo = {} + > 30 │ type Foo = {} + │ ^^^^^^ + 31 │ type Foo = {} + 32 │ type Foo = {} + + i Remove \u0074 + +type_parameter_modifier.ts:30:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 28 │ let x: { y(): any }; + 29 │ type Foo = {} + > 30 │ type Foo = {} + │ ^ + 31 │ type Foo = {} + 32 │ type Foo = {} + + i Remove T + +type_parameter_modifier.ts:31:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found 'in'. + + 29 │ type Foo = {} + 30 │ type Foo = {} + > 31 │ type Foo = {} + │ ^^ + 32 │ type Foo = {} + 33 │ type Foo = {} + + i Expected a type parameter here. + + 29 │ type Foo = {} + 30 │ type Foo = {} + > 31 │ type Foo = {} + │ ^^ + 32 │ type Foo = {} + 33 │ type Foo = {} + +type_parameter_modifier.ts:32:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a type parameter but instead found 'in'. + + 30 │ type Foo = {} + 31 │ type Foo = {} + > 32 │ type Foo = {} + │ ^^ + 33 │ type Foo = {} + 34 │ type Foo = {} + + i Expected a type parameter here. + + 30 │ type Foo = {} + 31 │ type Foo = {} + > 32 │ type Foo = {} + │ ^^ + 33 │ type Foo = {} + 34 │ type Foo = {} + +type_parameter_modifier.ts:33:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' must precede 'out' + + 31 │ type Foo = {} + 32 │ type Foo = {} + > 33 │ type Foo = {} + │ ^^ + 34 │ type Foo = {} + 35 │ type Foo = {} + + i move this modifier + + 31 │ type Foo = {} + 32 │ type Foo = {} + > 33 │ type Foo = {} + │ ^^ + 34 │ type Foo = {} + 35 │ type Foo = {} + + i before this modifier + + 31 │ type Foo = {} + 32 │ type Foo = {} + > 33 │ type Foo = {} + │ ^^^ + 34 │ type Foo = {} + 35 │ type Foo = {} + +type_parameter_modifier.ts:34:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `public` as an identifier in strict mode + + 32 │ type Foo = {} + 33 │ type Foo = {} + > 34 │ type Foo = {} + │ ^^^^^^ + 35 │ type Foo = {} + 36 │ type Foo = {} + +type_parameter_modifier.ts:34:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 32 │ type Foo = {} + 33 │ type Foo = {} + > 34 │ type Foo = {} + │ ^ + 35 │ type Foo = {} + 36 │ type Foo = {} + + i Remove T + +type_parameter_modifier.ts:35:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 33 │ type Foo = {} + 34 │ type Foo = {} + > 35 │ type Foo = {} + │ ^ + 36 │ type Foo = {} + 37 │ type Foo = {} + + i Remove T + +type_parameter_modifier.ts:36:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' already seen + + 34 │ type Foo = {} + 35 │ type Foo = {} + > 36 │ type Foo = {} + │ ^^ + 37 │ type Foo = {} + 38 │ function foo() {} + + i duplicate modifier + + 34 │ type Foo = {} + 35 │ type Foo = {} + > 36 │ type Foo = {} + │ ^^ + 37 │ type Foo = {} + 38 │ function foo() {} + + i first seen here + + 34 │ type Foo = {} + 35 │ type Foo = {} + > 36 │ type Foo = {} + │ ^^ + 37 │ type Foo = {} + 38 │ function foo() {} + +type_parameter_modifier.ts:37:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' already seen + + 35 │ type Foo = {} + 36 │ type Foo = {} + > 37 │ type Foo = {} + │ ^^^ + 38 │ function foo() {} + 39 │ function foo() {} + + i duplicate modifier + + 35 │ type Foo = {} + 36 │ type Foo = {} + > 37 │ type Foo = {} + │ ^^^ + 38 │ function foo() {} + 39 │ function foo() {} + + i first seen here + + 35 │ type Foo = {} + 36 │ type Foo = {} + > 37 │ type Foo = {} + │ ^^^ + 38 │ function foo() {} + 39 │ function foo() {} + +type_parameter_modifier.ts:38:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 36 │ type Foo = {} + 37 │ type Foo = {} + > 38 │ function foo() {} + │ ^^ + 39 │ function foo() {} + 40 │ type Foo = {}; + +type_parameter_modifier.ts:39:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 37 │ type Foo = {} + 38 │ function foo() {} + > 39 │ function foo() {} + │ ^^^ + 40 │ type Foo = {}; + 41 │ + +type_parameter_modifier.ts:40:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'const' modifier can only appear on a type parameter of a function, method or class. + + 38 │ function foo() {} + 39 │ function foo() {} + > 40 │ type Foo = {}; + │ ^^^^^ + 41 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap new file mode 100644 index 000000000000..a01f4045eb3c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap @@ -0,0 +1,353 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class AbstractMembers { + abstract constructor() { } + abstract display(): void { } + abstract get my_name() { } + abstract set my_name(name) { } + abstract #private_name() { } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..31 "AbstractMembers" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@31..32 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@32..46 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@46..57 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@57..58 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@58..60 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@60..62 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@63..77 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@77..84 "display" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@84..85 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@85..86 ")" [] [], + }, + TsReturnTypeAnnotation { + colon_token: COLON@86..88 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@88..93 "void" [] [Whitespace(" ")], + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@95..96 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@96..110 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + GET_KW@110..114 "get" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@114..121 "my_name" [] [], + }, + L_PAREN@121..122 "(" [] [], + R_PAREN@122..124 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@124..126 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@126..127 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@127..141 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + SET_KW@141..145 "set" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@145..152 "my_name" [] [], + }, + L_PAREN@152..153 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@153..157 "name" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + R_PAREN@157..159 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@159..161 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@161..162 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@162..176 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@176..177 "#" [] [], + id_token: IDENT@177..189 "private_name" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@189..190 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@190..192 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@192..194 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@194..195 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@195..197 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@197..198 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..198 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..197 + 0: JS_CLASS_DECLARATION@0..197 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..31 + 0: IDENT@15..31 "AbstractMembers" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@31..32 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@32..195 + 0: JS_BOGUS_MEMBER@32..63 + 0: JS_BOGUS@32..46 + 0: TS_ABSTRACT_MODIFIER@32..46 + 0: ABSTRACT_KW@32..46 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@46..57 + 0: IDENT@46..57 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@57..60 + 0: L_PAREN@57..58 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@58..58 + 2: R_PAREN@58..60 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@60..63 + 0: L_CURLY@60..62 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@62..62 + 2: JS_STATEMENT_LIST@62..62 + 3: R_CURLY@62..63 "}" [] [] + 1: JS_BOGUS_MEMBER@63..96 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@63..77 + 0: TS_ABSTRACT_MODIFIER@63..77 + 0: ABSTRACT_KW@63..77 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@77..84 + 0: IDENT@77..84 "display" [] [] + 2: JS_PARAMETERS@84..86 + 0: L_PAREN@84..85 "(" [] [] + 1: JS_PARAMETER_LIST@85..85 + 2: R_PAREN@85..86 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@86..93 + 0: COLON@86..88 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@88..93 + 0: VOID_KW@88..93 "void" [] [Whitespace(" ")] + 4: JS_FUNCTION_BODY@93..96 + 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@95..95 + 2: JS_STATEMENT_LIST@95..95 + 3: R_CURLY@95..96 "}" [] [] + 2: JS_BOGUS_MEMBER@96..127 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@96..110 + 0: TS_ABSTRACT_MODIFIER@96..110 + 0: ABSTRACT_KW@96..110 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@110..114 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@114..121 + 0: IDENT@114..121 "my_name" [] [] + 3: L_PAREN@121..122 "(" [] [] + 4: R_PAREN@122..124 ")" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@124..127 + 0: L_CURLY@124..126 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@126..126 + 2: JS_STATEMENT_LIST@126..126 + 3: R_CURLY@126..127 "}" [] [] + 3: JS_BOGUS_MEMBER@127..162 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@127..141 + 0: TS_ABSTRACT_MODIFIER@127..141 + 0: ABSTRACT_KW@127..141 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@141..145 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@145..152 + 0: IDENT@145..152 "my_name" [] [] + 3: L_PAREN@152..153 "(" [] [] + 4: JS_FORMAL_PARAMETER@153..157 + 0: JS_DECORATOR_LIST@153..153 + 1: JS_IDENTIFIER_BINDING@153..157 + 0: IDENT@153..157 "name" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: R_PAREN@157..159 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@159..162 + 0: L_CURLY@159..161 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@161..161 + 2: JS_STATEMENT_LIST@161..161 + 3: R_CURLY@161..162 "}" [] [] + 4: JS_BOGUS_MEMBER@162..195 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@162..176 + 0: TS_ABSTRACT_MODIFIER@162..176 + 0: ABSTRACT_KW@162..176 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@176..189 + 0: HASH@176..177 "#" [] [] + 1: IDENT@177..189 "private_name" [] [] + 2: JS_PARAMETERS@189..192 + 0: L_PAREN@189..190 "(" [] [] + 1: JS_PARAMETER_LIST@190..190 + 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@192..195 + 0: L_CURLY@192..194 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@194..194 + 2: JS_STATEMENT_LIST@194..194 + 3: R_CURLY@194..195 "}" [] [] + 9: R_CURLY@195..197 "}" [Newline("\n")] [] + 4: EOF@197..198 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_class_member_should_not_have_body.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' cannot appear on a constructor declaration. + + 1 │ abstract class AbstractMembers { + > 2 │ abstract constructor() { } + │ ^^^^^^^^ + 3 │ abstract display(): void { } + 4 │ abstract get my_name() { } + +typescript_abstract_class_member_should_not_have_body.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × abstract members should not have a body + + 1 │ abstract class AbstractMembers { + 2 │ abstract constructor() { } + > 3 │ abstract display(): void { } + │ ^^^ + 4 │ abstract get my_name() { } + 5 │ abstract set my_name(name) { } + +typescript_abstract_class_member_should_not_have_body.ts:4:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × abstract members should not have a body + + 2 │ abstract constructor() { } + 3 │ abstract display(): void { } + > 4 │ abstract get my_name() { } + │ ^^^ + 5 │ abstract set my_name(name) { } + 6 │ abstract #private_name() { } + +typescript_abstract_class_member_should_not_have_body.ts:5:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × abstract members should not have a body + + 3 │ abstract display(): void { } + 4 │ abstract get my_name() { } + > 5 │ abstract set my_name(name) { } + │ ^^^ + 6 │ abstract #private_name() { } + 7 │ } + +typescript_abstract_class_member_should_not_have_body.ts:6:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × abstract members should not have a body + + 4 │ abstract get my_name() { } + 5 │ abstract set my_name(name) { } + > 6 │ abstract #private_name() { } + │ ^^^ + 7 │ } + 8 │ + +typescript_abstract_class_member_should_not_have_body.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' modifier cannot be used with a private identifier'. + + 4 │ abstract get my_name() { } + 5 │ abstract set my_name(name) { } + > 6 │ abstract #private_name() { } + │ ^^^^^^^^ + 7 │ } + 8 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap new file mode 100644 index 000000000000..d97b61a7dc08 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap @@ -0,0 +1,123 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { accessor abstract foo: number; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsPropertySignatureModifierList [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@19..28 "accessor" [] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@28..37 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@37..40 "foo" [] [], + }, + TsTypeAnnotation { + colon_token: COLON@40..42 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@42..48 "number" [] [], + }, + }, + SEMICOLON@48..50 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + ], + eof_token: EOF@51..52 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..52 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..51 + 0: JS_CLASS_DECLARATION@0..51 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@19..50 + 0: JS_BOGUS_MEMBER@19..50 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@19..37 + 0: JS_ACCESSOR_MODIFIER@19..28 + 0: ACCESSOR_KW@19..28 "accessor" [] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@28..37 + 0: ABSTRACT_KW@28..37 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@37..40 + 0: IDENT@37..40 "foo" [] [] + 2: TS_TYPE_ANNOTATION@40..48 + 0: COLON@40..42 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@42..48 + 0: NUMBER_KW@42..48 "number" [] [] + 3: SEMICOLON@48..50 ";" [] [Whitespace(" ")] + 9: R_CURLY@50..51 "}" [] [] + 4: EOF@51..52 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_classes_abstract_accessor_precedence.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' must precede 'accessor' + + > 1 │ abstract class A { accessor abstract foo: number; } + │ ^^^^^^^^ + 2 │ + + i move this modifier + + > 1 │ abstract class A { accessor abstract foo: number; } + │ ^^^^^^^^ + 2 │ + + i before this modifier + + > 1 │ abstract class A { accessor abstract foo: number; } + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap new file mode 100644 index 000000000000..88a5426f90bc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: missing (required), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@15..16 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + ], + eof_token: EOF@18..19 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..19 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..18 + 0: JS_CLASS_DECLARATION@0..17 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@15..16 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@16..16 + 9: R_CURLY@16..17 "}" [] [] + 1: JS_EMPTY_STATEMENT@17..18 + 0: SEMICOLON@17..18 ";" [] [] + 4: EOF@18..19 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_classes_incomplete.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × class declarations must have a name + + > 1 │ abstract class {}; + │ ^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap new file mode 100644 index 000000000000..a6923c385b60 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap @@ -0,0 +1,104 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class B { abstract async a(); } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], + }, + ASYNC_KW@28..34 "async" [] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@34..35 "a" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@35..36 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@36..37 ")" [] [], + }, + SEMICOLON@37..39 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: JS_CLASS_DECLARATION@0..40 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@19..39 + 0: JS_BOGUS_MEMBER@19..39 + 0: TS_ABSTRACT_MODIFIER@19..28 + 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] + 1: ASYNC_KW@28..34 "async" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@34..35 + 0: IDENT@34..35 "a" [] [] + 3: JS_PARAMETERS@35..37 + 0: L_PAREN@35..36 "(" [] [] + 1: JS_PARAMETER_LIST@36..36 + 2: R_PAREN@36..37 ")" [] [] + 4: SEMICOLON@37..39 ";" [] [Whitespace(" ")] + 9: R_CURLY@39..40 "}" [] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_classes_invalid_abstract_async_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × async members cannot be abstract + + > 1 │ abstract class B { abstract async a(); } + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap new file mode 100644 index 000000000000..ef09dae9e1f6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap @@ -0,0 +1,112 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract constructor();}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsBogus { + items: [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], + }, + ], + }, + JsLiteralMemberName { + value: IDENT@28..39 "constructor" [] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@39..40 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@40..41 ")" [] [], + }, + SEMICOLON@41..42 ";" [] [], + ], + }, + ], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: JS_CLASS_DECLARATION@0..43 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@19..42 + 0: JS_BOGUS_MEMBER@19..42 + 0: JS_BOGUS@19..28 + 0: TS_ABSTRACT_MODIFIER@19..28 + 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@28..39 + 0: IDENT@28..39 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@39..41 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@40..40 + 2: R_PAREN@40..41 ")" [] [] + 3: SEMICOLON@41..42 ";" [] [] + 9: R_CURLY@42..43 "}" [] [] + 1: JS_EMPTY_STATEMENT@43..44 + 0: SEMICOLON@43..44 ";" [] [] + 4: EOF@44..45 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_classes_invalid_abstract_constructor.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' cannot appear on a constructor declaration. + + > 1 │ abstract class A { abstract constructor();}; + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap new file mode 100644 index 000000000000..06e9e0008671 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap @@ -0,0 +1,112 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract #name(); }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@28..29 "#" [] [], + id_token: IDENT@29..33 "name" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@33..34 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@34..35 ")" [] [], + }, + SEMICOLON@35..37 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_CLASS_DECLARATION@0..38 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@19..37 + 0: JS_BOGUS_MEMBER@19..37 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@19..28 + 0: TS_ABSTRACT_MODIFIER@19..28 + 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@28..33 + 0: HASH@28..29 "#" [] [] + 1: IDENT@29..33 "name" [] [] + 2: JS_PARAMETERS@33..35 + 0: L_PAREN@33..34 "(" [] [] + 1: JS_PARAMETER_LIST@34..34 + 2: R_PAREN@34..35 ")" [] [] + 3: SEMICOLON@35..37 ";" [] [Whitespace(" ")] + 9: R_CURLY@37..38 "}" [] [] + 1: JS_EMPTY_STATEMENT@38..39 + 0: SEMICOLON@38..39 ";" [] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_classes_invalid_abstract_private_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' modifier cannot be used with a private identifier'. + + > 1 │ abstract class A { abstract #name(); }; + │ ^^^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap new file mode 100644 index 000000000000..d7662c8747d4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap @@ -0,0 +1,210 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract static fn1(); } +abstract class B { static abstract fn1(); } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@28..35 "static" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@35..38 "fn1" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@39..40 ")" [] [], + }, + SEMICOLON@40..42 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@43..53 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@53..59 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@59..61 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@61..63 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + TsMethodSignatureModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@63..70 "static" [] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@70..79 "abstract" [] [Whitespace(" ")], + }, + ], + JsLiteralMemberName { + value: IDENT@79..82 "fn1" [] [], + }, + JsParameters { + l_paren_token: L_PAREN@82..83 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@83..84 ")" [] [], + }, + SEMICOLON@84..86 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@86..87 "}" [] [], + }, + ], + eof_token: EOF@87..88 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..88 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..87 + 0: JS_CLASS_DECLARATION@0..43 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@19..42 + 0: JS_BOGUS_MEMBER@19..42 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@19..35 + 0: TS_ABSTRACT_MODIFIER@19..28 + 0: ABSTRACT_KW@19..28 "abstract" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@28..35 + 0: STATIC_KW@28..35 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@35..38 + 0: IDENT@35..38 "fn1" [] [] + 2: JS_PARAMETERS@38..40 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..39 + 2: R_PAREN@39..40 ")" [] [] + 3: SEMICOLON@40..42 ";" [] [Whitespace(" ")] + 9: R_CURLY@42..43 "}" [] [] + 1: JS_CLASS_DECLARATION@43..87 + 0: JS_DECORATOR_LIST@43..43 + 1: ABSTRACT_KW@43..53 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@53..59 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@59..61 + 0: IDENT@59..61 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@61..63 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@63..86 + 0: JS_BOGUS_MEMBER@63..86 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@63..79 + 0: JS_STATIC_MODIFIER@63..70 + 0: STATIC_KW@63..70 "static" [] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@70..79 + 0: ABSTRACT_KW@70..79 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@79..82 + 0: IDENT@79..82 "fn1" [] [] + 2: JS_PARAMETERS@82..84 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_PARAMETER_LIST@83..83 + 2: R_PAREN@83..84 ")" [] [] + 3: SEMICOLON@84..86 ";" [] [Whitespace(" ")] + 9: R_CURLY@86..87 "}" [] [] + 4: EOF@87..88 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_abstract_classes_invalid_static_abstract_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' cannot be used with 'static' modifier. + + > 1 │ abstract class A { abstract static fn1(); } + │ ^^^^^^^^ + 2 │ abstract class B { static abstract fn1(); } + 3 │ + + i 'abstract' modifier + + > 1 │ abstract class A { abstract static fn1(); } + │ ^^^^^^^^ + 2 │ abstract class B { static abstract fn1(); } + 3 │ + + i 'static' modifier + + > 1 │ abstract class A { abstract static fn1(); } + │ ^^^^^^ + 2 │ abstract class B { static abstract fn1(); } + 3 │ + +typescript_abstract_classes_invalid_static_abstract_member.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'abstract' cannot be used with 'static' modifier. + + 1 │ abstract class A { abstract static fn1(); } + > 2 │ abstract class B { static abstract fn1(); } + │ ^^^^^^^^ + 3 │ + + i 'abstract' modifier + + 1 │ abstract class A { abstract static fn1(); } + > 2 │ abstract class B { static abstract fn1(); } + │ ^^^^^^^^ + 3 │ + + i 'static' modifier + + 1 │ abstract class A { abstract static fn1(); } + > 2 │ abstract class B { static abstract fn1(); } + │ ^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap new file mode 100644 index 000000000000..77fc66c38bea --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap @@ -0,0 +1,163 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { private #name; protected #other; public #baz; }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@10..18 "private" [] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@18..19 "#" [] [], + id_token: IDENT@19..23 "name" [] [], + }, + SEMICOLON@23..25 ";" [] [Whitespace(" ")], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@25..35 "protected" [] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@35..36 "#" [] [], + id_token: IDENT@36..41 "other" [] [], + }, + SEMICOLON@41..43 ";" [] [Whitespace(" ")], + ], + }, + JsBogusMember { + items: [ + JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@43..50 "public" [] [Whitespace(" ")], + }, + ], + JsPrivateClassMemberName { + hash_token: HASH@50..51 "#" [] [], + id_token: IDENT@51..54 "baz" [] [], + }, + SEMICOLON@54..56 ";" [] [Whitespace(" ")], + ], + }, + ], + r_curly_token: R_CURLY@56..57 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@57..58 ";" [] [], + }, + ], + eof_token: EOF@58..59 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..59 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..58 + 0: JS_CLASS_DECLARATION@0..57 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..56 + 0: JS_BOGUS_MEMBER@10..25 + 0: JS_PROPERTY_MODIFIER_LIST@10..18 + 0: TS_ACCESSIBILITY_MODIFIER@10..18 + 0: PRIVATE_KW@10..18 "private" [] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@18..23 + 0: HASH@18..19 "#" [] [] + 1: IDENT@19..23 "name" [] [] + 2: SEMICOLON@23..25 ";" [] [Whitespace(" ")] + 1: JS_BOGUS_MEMBER@25..43 + 0: JS_PROPERTY_MODIFIER_LIST@25..35 + 0: TS_ACCESSIBILITY_MODIFIER@25..35 + 0: PROTECTED_KW@25..35 "protected" [] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@35..41 + 0: HASH@35..36 "#" [] [] + 1: IDENT@36..41 "other" [] [] + 2: SEMICOLON@41..43 ";" [] [Whitespace(" ")] + 2: JS_BOGUS_MEMBER@43..56 + 0: JS_PROPERTY_MODIFIER_LIST@43..50 + 0: TS_ACCESSIBILITY_MODIFIER@43..50 + 0: PUBLIC_KW@43..50 "public" [] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@50..54 + 0: HASH@50..51 "#" [] [] + 1: IDENT@51..54 "baz" [] [] + 2: SEMICOLON@54..56 ";" [] [Whitespace(" ")] + 9: R_CURLY@56..57 "}" [] [] + 1: JS_EMPTY_STATEMENT@57..58 + 0: SEMICOLON@57..58 ";" [] [] + 4: EOF@58..59 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_classes_invalid_accessibility_modifier_private_member.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━ + + × An accessibility modifier cannot be used with a private identifier. + + > 1 │ class A { private #name; protected #other; public #baz; }; + │ ^^^^^^^ + 2 │ + +typescript_classes_invalid_accessibility_modifier_private_member.ts:1:26 parse ━━━━━━━━━━━━━━━━━━━━━ + + × An accessibility modifier cannot be used with a private identifier. + + > 1 │ class A { private #name; protected #other; public #baz; }; + │ ^^^^^^^^^ + 2 │ + +typescript_classes_invalid_accessibility_modifier_private_member.ts:1:44 parse ━━━━━━━━━━━━━━━━━━━━━ + + × An accessibility modifier cannot be used with a private identifier. + + > 1 │ class A { private #name; protected #other; public #baz; }; + │ ^^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts.snap new file mode 100644 index 000000000000..358cf177c960 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum A { + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@7..8 "{" [] [], + members: TsEnumMemberList [], + r_curly_token: missing (required), + }, + ], + eof_token: EOF@8..9 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..9 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..8 + 0: TS_ENUM_DECLARATION@0..8 + 0: (empty) + 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 3: L_CURLY@7..8 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@8..8 + 5: (empty) + 4: EOF@8..9 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_enum_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `}` but instead the file ends + + 1 │ enum A { + > 2 │ + │ + + i the file ends here + + 1 │ enum A { + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap b/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap new file mode 100644 index 000000000000..bbab360ca691 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap @@ -0,0 +1,547 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class Test { + constructor() {} + name() {} + get test(): string { return ""; } + set test(v) {} +} +declare namespace n { + class Test { + constructor() {} + name() {} + get test(): string { return ""; } + set test(v) {} + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..19 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@19..20 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@39..40 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + JsLiteralMemberName { + value: IDENT@41..50 "name" [Newline("\n"), Whitespace(" ")] [], + }, + JsParameters { + l_paren_token: L_PAREN@50..51 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@53..54 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + GET_KW@55..64 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@64..68 "test" [] [], + }, + L_PAREN@68..69 "(" [] [], + R_PAREN@69..70 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@70..72 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@72..79 "string" [] [Whitespace(" ")], + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@79..81 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@81..88 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@88..90 "\"\"" [] [], + }, + semicolon_token: SEMICOLON@90..92 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + SET_KW@93..102 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@102..106 "test" [] [], + }, + L_PAREN@106..107 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@107..108 "v" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + R_PAREN@108..110 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@110..111 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@111..112 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@112..114 "}" [Newline("\n")] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@114..123 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@123..133 "namespace" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@133..135 "n" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@135..136 "{" [] [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@136..148 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@148..153 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@153..154 "{" [] [], + members: JsClassMemberList [ + JsBogusMember { + items: [ + JsConstructorModifierList [], + JsLiteralMemberName { + value: IDENT@154..175 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + JsConstructorParameters { + l_paren_token: L_PAREN@175..176 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@176..178 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@178..179 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@179..180 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + JsLiteralMemberName { + value: IDENT@180..194 "name" [Newline("\n"), Whitespace(" ")] [], + }, + JsParameters { + l_paren_token: L_PAREN@194..195 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@195..197 ")" [] [Whitespace(" ")], + }, + JsFunctionBody { + l_curly_token: L_CURLY@197..198 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@198..199 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + GET_KW@199..213 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@213..217 "test" [] [], + }, + L_PAREN@217..218 "(" [] [], + R_PAREN@218..219 ")" [] [], + TsTypeAnnotation { + colon_token: COLON@219..221 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@221..228 "string" [] [Whitespace(" ")], + }, + }, + JsFunctionBody { + l_curly_token: L_CURLY@228..230 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@230..237 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@237..239 "\"\"" [] [], + }, + semicolon_token: SEMICOLON@239..241 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@241..242 "}" [] [], + }, + ], + }, + JsBogusMember { + items: [ + TsMethodSignatureModifierList [], + SET_KW@242..256 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + JsLiteralMemberName { + value: IDENT@256..260 "test" [] [], + }, + L_PAREN@260..261 "(" [] [], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@261..262 "v" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + R_PAREN@262..264 ")" [] [Whitespace(" ")], + JsFunctionBody { + l_curly_token: L_CURLY@264..265 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@265..266 "}" [] [], + }, + ], + }, + ], + r_curly_token: R_CURLY@266..273 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@273..275 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@275..276 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..276 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..275 + 0: TS_DECLARE_STATEMENT@0..114 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..114 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..19 + 0: IDENT@14..19 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@19..20 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@20..112 + 0: JS_BOGUS_MEMBER@20..41 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..36 + 0: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@36..39 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@37..37 + 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@39..41 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..40 + 3: R_CURLY@40..41 "}" [] [] + 1: JS_BOGUS_MEMBER@41..55 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@41..41 + 1: JS_LITERAL_MEMBER_NAME@41..50 + 0: IDENT@41..50 "name" [Newline("\n"), Whitespace(" ")] [] + 2: JS_PARAMETERS@50..53 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_PARAMETER_LIST@51..51 + 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@53..55 + 0: L_CURLY@53..54 "{" [] [] + 1: JS_DIRECTIVE_LIST@54..54 + 2: JS_STATEMENT_LIST@54..54 + 3: R_CURLY@54..55 "}" [] [] + 2: JS_BOGUS_MEMBER@55..93 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@55..55 + 1: GET_KW@55..64 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@64..68 + 0: IDENT@64..68 "test" [] [] + 3: L_PAREN@68..69 "(" [] [] + 4: R_PAREN@69..70 ")" [] [] + 5: TS_TYPE_ANNOTATION@70..79 + 0: COLON@70..72 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@72..79 + 0: STRING_KW@72..79 "string" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@79..93 + 0: L_CURLY@79..81 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@81..81 + 2: JS_STATEMENT_LIST@81..92 + 0: JS_RETURN_STATEMENT@81..92 + 0: RETURN_KW@81..88 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@88..90 + 0: JS_STRING_LITERAL@88..90 "\"\"" [] [] + 2: SEMICOLON@90..92 ";" [] [Whitespace(" ")] + 3: R_CURLY@92..93 "}" [] [] + 3: JS_BOGUS_MEMBER@93..112 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@93..93 + 1: SET_KW@93..102 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@102..106 + 0: IDENT@102..106 "test" [] [] + 3: L_PAREN@106..107 "(" [] [] + 4: JS_FORMAL_PARAMETER@107..108 + 0: JS_DECORATOR_LIST@107..107 + 1: JS_IDENTIFIER_BINDING@107..108 + 0: IDENT@107..108 "v" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: R_PAREN@108..110 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@110..112 + 0: L_CURLY@110..111 "{" [] [] + 1: JS_DIRECTIVE_LIST@111..111 + 2: JS_STATEMENT_LIST@111..111 + 3: R_CURLY@111..112 "}" [] [] + 9: R_CURLY@112..114 "}" [Newline("\n")] [] + 1: TS_DECLARE_STATEMENT@114..275 + 0: DECLARE_KW@114..123 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@123..275 + 0: NAMESPACE_KW@123..133 "namespace" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@133..135 + 0: IDENT@133..135 "n" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@135..275 + 0: L_CURLY@135..136 "{" [] [] + 1: JS_MODULE_ITEM_LIST@136..273 + 0: JS_CLASS_DECLARATION@136..273 + 0: JS_DECORATOR_LIST@136..136 + 1: (empty) + 2: CLASS_KW@136..148 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@148..153 + 0: IDENT@148..153 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@153..154 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@154..266 + 0: JS_BOGUS_MEMBER@154..180 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@154..154 + 1: JS_LITERAL_MEMBER_NAME@154..175 + 0: IDENT@154..175 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@175..178 + 0: L_PAREN@175..176 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@176..176 + 2: R_PAREN@176..178 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@178..180 + 0: L_CURLY@178..179 "{" [] [] + 1: JS_DIRECTIVE_LIST@179..179 + 2: JS_STATEMENT_LIST@179..179 + 3: R_CURLY@179..180 "}" [] [] + 1: JS_BOGUS_MEMBER@180..199 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@180..180 + 1: JS_LITERAL_MEMBER_NAME@180..194 + 0: IDENT@180..194 "name" [Newline("\n"), Whitespace(" ")] [] + 2: JS_PARAMETERS@194..197 + 0: L_PAREN@194..195 "(" [] [] + 1: JS_PARAMETER_LIST@195..195 + 2: R_PAREN@195..197 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@197..199 + 0: L_CURLY@197..198 "{" [] [] + 1: JS_DIRECTIVE_LIST@198..198 + 2: JS_STATEMENT_LIST@198..198 + 3: R_CURLY@198..199 "}" [] [] + 2: JS_BOGUS_MEMBER@199..242 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@199..199 + 1: GET_KW@199..213 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@213..217 + 0: IDENT@213..217 "test" [] [] + 3: L_PAREN@217..218 "(" [] [] + 4: R_PAREN@218..219 ")" [] [] + 5: TS_TYPE_ANNOTATION@219..228 + 0: COLON@219..221 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@221..228 + 0: STRING_KW@221..228 "string" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@228..242 + 0: L_CURLY@228..230 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@230..230 + 2: JS_STATEMENT_LIST@230..241 + 0: JS_RETURN_STATEMENT@230..241 + 0: RETURN_KW@230..237 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@237..239 + 0: JS_STRING_LITERAL@237..239 "\"\"" [] [] + 2: SEMICOLON@239..241 ";" [] [Whitespace(" ")] + 3: R_CURLY@241..242 "}" [] [] + 3: JS_BOGUS_MEMBER@242..266 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@242..242 + 1: SET_KW@242..256 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@256..260 + 0: IDENT@256..260 "test" [] [] + 3: L_PAREN@260..261 "(" [] [] + 4: JS_FORMAL_PARAMETER@261..262 + 0: JS_DECORATOR_LIST@261..261 + 1: JS_IDENTIFIER_BINDING@261..262 + 0: IDENT@261..262 "v" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: R_PAREN@262..264 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@264..266 + 0: L_CURLY@264..265 "{" [] [] + 1: JS_DIRECTIVE_LIST@265..265 + 2: JS_STATEMENT_LIST@265..265 + 3: R_CURLY@265..266 "}" [] [] + 9: R_CURLY@266..273 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@273..275 "}" [Newline("\n")] [] + 4: EOF@275..276 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +typescript_members_with_body_in_ambient_context_should_err.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 1 │ declare class Test { + > 2 │ constructor() {} + │ ^^ + 3 │ name() {} + 4 │ get test(): string { return ""; } + +typescript_members_with_body_in_ambient_context_should_err.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 1 │ declare class Test { + 2 │ constructor() {} + > 3 │ name() {} + │ ^^ + 4 │ get test(): string { return ""; } + 5 │ set test(v) {} + +typescript_members_with_body_in_ambient_context_should_err.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 2 │ constructor() {} + 3 │ name() {} + > 4 │ get test(): string { return ""; } + │ ^^^^^^^^^^^^^^ + 5 │ set test(v) {} + 6 │ } + +typescript_members_with_body_in_ambient_context_should_err.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 3 │ name() {} + 4 │ get test(): string { return ""; } + > 5 │ set test(v) {} + │ ^^ + 6 │ } + 7 │ declare namespace n { + +typescript_members_with_body_in_ambient_context_should_err.ts:9:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 7 │ declare namespace n { + 8 │ class Test { + > 9 │ constructor() {} + │ ^^ + 10 │ name() {} + 11 │ get test(): string { return ""; } + +typescript_members_with_body_in_ambient_context_should_err.ts:10:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 8 │ class Test { + 9 │ constructor() {} + > 10 │ name() {} + │ ^^ + 11 │ get test(): string { return ""; } + 12 │ set test(v) {} + +typescript_members_with_body_in_ambient_context_should_err.ts:11:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 9 │ constructor() {} + 10 │ name() {} + > 11 │ get test(): string { return ""; } + │ ^^^^^^^^^^^^^^ + 12 │ set test(v) {} + 13 │ } + +typescript_members_with_body_in_ambient_context_should_err.ts:12:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × members inside ambient contexts should not have a body + + 10 │ name() {} + 11 │ get test(): string { return ""; } + > 12 │ set test(v) {} + │ ^^ + 13 │ } + 14 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete.js b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unary_delete.js rename to crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js.snap new file mode 100644 index 000000000000..7d6d213e09c7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js.snap @@ -0,0 +1,270 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete ident; +delete obj.#member; +delete func().#member; +delete obj?.#member; +delete obj?.inner.#member; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@0..7 "delete" [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..12 "ident" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@13..21 "delete" [Newline("\n")] [Whitespace(" ")], + JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..24 "obj" [] [], + }, + }, + operator_token: DOT@24..25 "." [] [], + member: JsPrivateName { + hash_token: HASH@25..26 "#" [] [], + value_token: IDENT@26..32 "member" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")], + JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..45 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@45..46 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@46..47 ")" [] [], + }, + }, + operator_token: DOT@47..48 "." [] [], + member: JsPrivateName { + hash_token: HASH@48..49 "#" [] [], + value_token: IDENT@49..55 "member" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@55..56 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@56..64 "delete" [Newline("\n")] [Whitespace(" ")], + JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@64..67 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@67..69 "?." [] [], + member: JsPrivateName { + hash_token: HASH@69..70 "#" [] [], + value_token: IDENT@70..76 "member" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@76..77 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@77..85 "delete" [Newline("\n")] [Whitespace(" ")], + JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@85..88 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@88..90 "?." [] [], + member: JsName { + value_token: IDENT@90..95 "inner" [] [], + }, + }, + operator_token: DOT@95..96 "." [] [], + member: JsPrivateName { + hash_token: HASH@96..97 "#" [] [], + value_token: IDENT@97..103 "member" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + ], + eof_token: EOF@104..105 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..105 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..104 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_BOGUS_EXPRESSION@0..12 + 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@7..12 + 0: JS_REFERENCE_IDENTIFIER@7..12 + 0: IDENT@7..12 "ident" [] [] + 1: SEMICOLON@12..13 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@13..33 + 0: JS_BOGUS_EXPRESSION@13..32 + 0: DELETE_KW@13..21 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@21..32 + 0: JS_IDENTIFIER_EXPRESSION@21..24 + 0: JS_REFERENCE_IDENTIFIER@21..24 + 0: IDENT@21..24 "obj" [] [] + 1: DOT@24..25 "." [] [] + 2: JS_PRIVATE_NAME@25..32 + 0: HASH@25..26 "#" [] [] + 1: IDENT@26..32 "member" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..56 + 0: JS_BOGUS_EXPRESSION@33..55 + 0: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@41..55 + 0: JS_CALL_EXPRESSION@41..47 + 0: JS_IDENTIFIER_EXPRESSION@41..45 + 0: JS_REFERENCE_IDENTIFIER@41..45 + 0: IDENT@41..45 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@45..47 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@46..46 + 2: R_PAREN@46..47 ")" [] [] + 1: DOT@47..48 "." [] [] + 2: JS_PRIVATE_NAME@48..55 + 0: HASH@48..49 "#" [] [] + 1: IDENT@49..55 "member" [] [] + 1: SEMICOLON@55..56 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@56..77 + 0: JS_BOGUS_EXPRESSION@56..76 + 0: DELETE_KW@56..64 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@64..76 + 0: JS_IDENTIFIER_EXPRESSION@64..67 + 0: JS_REFERENCE_IDENTIFIER@64..67 + 0: IDENT@64..67 "obj" [] [] + 1: QUESTIONDOT@67..69 "?." [] [] + 2: JS_PRIVATE_NAME@69..76 + 0: HASH@69..70 "#" [] [] + 1: IDENT@70..76 "member" [] [] + 1: SEMICOLON@76..77 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@77..104 + 0: JS_BOGUS_EXPRESSION@77..103 + 0: DELETE_KW@77..85 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@85..103 + 0: JS_STATIC_MEMBER_EXPRESSION@85..95 + 0: JS_IDENTIFIER_EXPRESSION@85..88 + 0: JS_REFERENCE_IDENTIFIER@85..88 + 0: IDENT@85..88 "obj" [] [] + 1: QUESTIONDOT@88..90 "?." [] [] + 2: JS_NAME@90..95 + 0: IDENT@90..95 "inner" [] [] + 1: DOT@95..96 "." [] [] + 2: JS_PRIVATE_NAME@96..103 + 0: HASH@96..97 "#" [] [] + 1: IDENT@97..103 "member" [] [] + 1: SEMICOLON@103..104 ";" [] [] + 4: EOF@104..105 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +unary_delete.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a single identifier + + > 1 │ delete ident; + │ ^^^^^ + 2 │ delete obj.#member; + 3 │ delete func().#member; + +unary_delete.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 1 │ delete ident; + > 2 │ delete obj.#member; + │ ^^^^^^^^^^^ + 3 │ delete func().#member; + 4 │ delete obj?.#member; + +unary_delete.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 1 │ delete ident; + 2 │ delete obj.#member; + > 3 │ delete func().#member; + │ ^^^^^^^^^^^^^^ + 4 │ delete obj?.#member; + 5 │ delete obj?.inner.#member; + +unary_delete.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 2 │ delete obj.#member; + 3 │ delete func().#member; + > 4 │ delete obj?.#member; + │ ^^^^^^^^^^^^ + 5 │ delete obj?.inner.#member; + 6 │ + +unary_delete.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 3 │ delete func().#member; + 4 │ delete obj?.#member; + > 5 │ delete obj?.inner.#member; + │ ^^^^^^^^^^^^^^^^^^ + 6 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.js b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.js rename to crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js.snap new file mode 100644 index 000000000000..36b50e26c0a4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js.snap @@ -0,0 +1,487 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete (ident); +delete ((ident)); +delete (obj.key, ident); +delete (obj.#member); +delete (func().#member); +delete (obj?.#member); +delete (obj?.inner.#member); +delete (obj.key, obj.#key); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@0..7 "delete" [] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@7..8 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..13 "ident" [] [], + }, + }, + r_paren_token: R_PAREN@13..14 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@23..24 "(" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@24..25 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@25..30 "ident" [] [], + }, + }, + r_paren_token: R_PAREN@30..31 ")" [] [], + }, + r_paren_token: R_PAREN@31..32 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@41..42 "(" [] [], + expression: JsSequenceExpression { + left: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..45 "obj" [] [], + }, + }, + operator_token: DOT@45..46 "." [] [], + member: JsName { + value_token: IDENT@46..49 "key" [] [], + }, + }, + comma_token: COMMA@49..51 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@51..56 "ident" [] [], + }, + }, + }, + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@57..58 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@58..66 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@66..67 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@67..70 "obj" [] [], + }, + }, + operator_token: DOT@70..71 "." [] [], + member: JsPrivateName { + hash_token: HASH@71..72 "#" [] [], + value_token: IDENT@72..78 "member" [] [], + }, + }, + r_paren_token: R_PAREN@78..79 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@79..80 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@80..88 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@88..89 "(" [] [], + expression: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@89..93 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@93..94 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@94..95 ")" [] [], + }, + }, + operator_token: DOT@95..96 "." [] [], + member: JsPrivateName { + hash_token: HASH@96..97 "#" [] [], + value_token: IDENT@97..103 "member" [] [], + }, + }, + r_paren_token: R_PAREN@103..104 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@104..105 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@105..113 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@113..114 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@114..117 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@117..119 "?." [] [], + member: JsPrivateName { + hash_token: HASH@119..120 "#" [] [], + value_token: IDENT@120..126 "member" [] [], + }, + }, + r_paren_token: R_PAREN@126..127 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@127..128 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@128..136 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@136..137 "(" [] [], + expression: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..140 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@140..142 "?." [] [], + member: JsName { + value_token: IDENT@142..147 "inner" [] [], + }, + }, + operator_token: DOT@147..148 "." [] [], + member: JsPrivateName { + hash_token: HASH@148..149 "#" [] [], + value_token: IDENT@149..155 "member" [] [], + }, + }, + r_paren_token: R_PAREN@155..156 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@156..157 ";" [] [], + }, + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + DELETE_KW@157..165 "delete" [Newline("\n")] [Whitespace(" ")], + JsParenthesizedExpression { + l_paren_token: L_PAREN@165..166 "(" [] [], + expression: JsSequenceExpression { + left: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@166..169 "obj" [] [], + }, + }, + operator_token: DOT@169..170 "." [] [], + member: JsName { + value_token: IDENT@170..173 "key" [] [], + }, + }, + comma_token: COMMA@173..175 "," [] [Whitespace(" ")], + right: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@175..178 "obj" [] [], + }, + }, + operator_token: DOT@178..179 "." [] [], + member: JsPrivateName { + hash_token: HASH@179..180 "#" [] [], + value_token: IDENT@180..183 "key" [] [], + }, + }, + }, + r_paren_token: R_PAREN@183..184 ")" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@184..185 ";" [] [], + }, + ], + eof_token: EOF@185..186 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..186 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..185 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JS_BOGUS_EXPRESSION@0..14 + 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@7..14 + 0: L_PAREN@7..8 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@8..13 + 0: JS_REFERENCE_IDENTIFIER@8..13 + 0: IDENT@8..13 "ident" [] [] + 2: R_PAREN@13..14 ")" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@15..33 + 0: JS_BOGUS_EXPRESSION@15..32 + 0: DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@23..32 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@24..31 + 0: L_PAREN@24..25 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@25..30 + 0: JS_REFERENCE_IDENTIFIER@25..30 + 0: IDENT@25..30 "ident" [] [] + 2: R_PAREN@30..31 ")" [] [] + 2: R_PAREN@31..32 ")" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..58 + 0: JS_BOGUS_EXPRESSION@33..57 + 0: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@41..57 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@42..56 + 0: JS_STATIC_MEMBER_EXPRESSION@42..49 + 0: JS_IDENTIFIER_EXPRESSION@42..45 + 0: JS_REFERENCE_IDENTIFIER@42..45 + 0: IDENT@42..45 "obj" [] [] + 1: DOT@45..46 "." [] [] + 2: JS_NAME@46..49 + 0: IDENT@46..49 "key" [] [] + 1: COMMA@49..51 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@51..56 + 0: JS_REFERENCE_IDENTIFIER@51..56 + 0: IDENT@51..56 "ident" [] [] + 2: R_PAREN@56..57 ")" [] [] + 1: SEMICOLON@57..58 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@58..80 + 0: JS_BOGUS_EXPRESSION@58..79 + 0: DELETE_KW@58..66 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@66..79 + 0: L_PAREN@66..67 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@67..78 + 0: JS_IDENTIFIER_EXPRESSION@67..70 + 0: JS_REFERENCE_IDENTIFIER@67..70 + 0: IDENT@67..70 "obj" [] [] + 1: DOT@70..71 "." [] [] + 2: JS_PRIVATE_NAME@71..78 + 0: HASH@71..72 "#" [] [] + 1: IDENT@72..78 "member" [] [] + 2: R_PAREN@78..79 ")" [] [] + 1: SEMICOLON@79..80 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@80..105 + 0: JS_BOGUS_EXPRESSION@80..104 + 0: DELETE_KW@80..88 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@88..104 + 0: L_PAREN@88..89 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@89..103 + 0: JS_CALL_EXPRESSION@89..95 + 0: JS_IDENTIFIER_EXPRESSION@89..93 + 0: JS_REFERENCE_IDENTIFIER@89..93 + 0: IDENT@89..93 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@93..95 + 0: L_PAREN@93..94 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@94..94 + 2: R_PAREN@94..95 ")" [] [] + 1: DOT@95..96 "." [] [] + 2: JS_PRIVATE_NAME@96..103 + 0: HASH@96..97 "#" [] [] + 1: IDENT@97..103 "member" [] [] + 2: R_PAREN@103..104 ")" [] [] + 1: SEMICOLON@104..105 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@105..128 + 0: JS_BOGUS_EXPRESSION@105..127 + 0: DELETE_KW@105..113 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@113..127 + 0: L_PAREN@113..114 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@114..126 + 0: JS_IDENTIFIER_EXPRESSION@114..117 + 0: JS_REFERENCE_IDENTIFIER@114..117 + 0: IDENT@114..117 "obj" [] [] + 1: QUESTIONDOT@117..119 "?." [] [] + 2: JS_PRIVATE_NAME@119..126 + 0: HASH@119..120 "#" [] [] + 1: IDENT@120..126 "member" [] [] + 2: R_PAREN@126..127 ")" [] [] + 1: SEMICOLON@127..128 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@128..157 + 0: JS_BOGUS_EXPRESSION@128..156 + 0: DELETE_KW@128..136 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@136..156 + 0: L_PAREN@136..137 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@137..155 + 0: JS_STATIC_MEMBER_EXPRESSION@137..147 + 0: JS_IDENTIFIER_EXPRESSION@137..140 + 0: JS_REFERENCE_IDENTIFIER@137..140 + 0: IDENT@137..140 "obj" [] [] + 1: QUESTIONDOT@140..142 "?." [] [] + 2: JS_NAME@142..147 + 0: IDENT@142..147 "inner" [] [] + 1: DOT@147..148 "." [] [] + 2: JS_PRIVATE_NAME@148..155 + 0: HASH@148..149 "#" [] [] + 1: IDENT@149..155 "member" [] [] + 2: R_PAREN@155..156 ")" [] [] + 1: SEMICOLON@156..157 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@157..185 + 0: JS_BOGUS_EXPRESSION@157..184 + 0: DELETE_KW@157..165 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@165..184 + 0: L_PAREN@165..166 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@166..183 + 0: JS_STATIC_MEMBER_EXPRESSION@166..173 + 0: JS_IDENTIFIER_EXPRESSION@166..169 + 0: JS_REFERENCE_IDENTIFIER@166..169 + 0: IDENT@166..169 "obj" [] [] + 1: DOT@169..170 "." [] [] + 2: JS_NAME@170..173 + 0: IDENT@170..173 "key" [] [] + 1: COMMA@173..175 "," [] [Whitespace(" ")] + 2: JS_STATIC_MEMBER_EXPRESSION@175..183 + 0: JS_IDENTIFIER_EXPRESSION@175..178 + 0: JS_REFERENCE_IDENTIFIER@175..178 + 0: IDENT@175..178 "obj" [] [] + 1: DOT@178..179 "." [] [] + 2: JS_PRIVATE_NAME@179..183 + 0: HASH@179..180 "#" [] [] + 1: IDENT@180..183 "key" [] [] + 2: R_PAREN@183..184 ")" [] [] + 1: SEMICOLON@184..185 ";" [] [] + 4: EOF@185..186 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +unary_delete_parenthesized.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a single identifier + + > 1 │ delete (ident); + │ ^^^^^ + 2 │ delete ((ident)); + 3 │ delete (obj.key, ident); + +unary_delete_parenthesized.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a single identifier + + 1 │ delete (ident); + > 2 │ delete ((ident)); + │ ^^^^^ + 3 │ delete (obj.key, ident); + 4 │ delete (obj.#member); + +unary_delete_parenthesized.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a single identifier + + 1 │ delete (ident); + 2 │ delete ((ident)); + > 3 │ delete (obj.key, ident); + │ ^^^^^ + 4 │ delete (obj.#member); + 5 │ delete (func().#member); + +unary_delete_parenthesized.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 2 │ delete ((ident)); + 3 │ delete (obj.key, ident); + > 4 │ delete (obj.#member); + │ ^^^^^^^^^^^ + 5 │ delete (func().#member); + 6 │ delete (obj?.#member); + +unary_delete_parenthesized.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 3 │ delete (obj.key, ident); + 4 │ delete (obj.#member); + > 5 │ delete (func().#member); + │ ^^^^^^^^^^^^^^ + 6 │ delete (obj?.#member); + 7 │ delete (obj?.inner.#member); + +unary_delete_parenthesized.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 4 │ delete (obj.#member); + 5 │ delete (func().#member); + > 6 │ delete (obj?.#member); + │ ^^^^^^^^^^^^ + 7 │ delete (obj?.inner.#member); + 8 │ delete (obj.key, obj.#key); + +unary_delete_parenthesized.js:7:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 5 │ delete (func().#member); + 6 │ delete (obj?.#member); + > 7 │ delete (obj?.inner.#member); + │ ^^^^^^^^^^^^^^^^^^ + 8 │ delete (obj.key, obj.#key); + 9 │ + +unary_delete_parenthesized.js:8:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × the target for a delete operator cannot be a private member + + 6 │ delete (obj?.#member); + 7 │ delete (obj?.inner.#member); + > 8 │ delete (obj.key, obj.#key); + │ ^^^^^^^^ + 9 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unary_expr.js b/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unary_expr.js rename to crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js.snap new file mode 100644 index 000000000000..95b07e0fd297 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js.snap @@ -0,0 +1,113 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +++ ; +-- ; +-; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsPreUpdateExpression { + operator_token: PLUS2@0..3 "++" [] [Whitespace(" ")], + operand: missing (required), + }, + semicolon_token: SEMICOLON@3..4 ";" [] [], + }, + JsExpressionStatement { + expression: JsPreUpdateExpression { + operator_token: MINUS2@4..8 "--" [Newline("\n")] [Whitespace(" ")], + operand: missing (required), + }, + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: MINUS@9..11 "-" [Newline("\n")] [], + argument: missing (required), + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + ], + eof_token: EOF@12..13 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..13 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..12 + 0: JS_EXPRESSION_STATEMENT@0..4 + 0: JS_PRE_UPDATE_EXPRESSION@0..3 + 0: PLUS2@0..3 "++" [] [Whitespace(" ")] + 1: (empty) + 1: SEMICOLON@3..4 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@4..9 + 0: JS_PRE_UPDATE_EXPRESSION@4..8 + 0: MINUS2@4..8 "--" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 1: SEMICOLON@8..9 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@9..12 + 0: JS_UNARY_EXPRESSION@9..11 + 0: MINUS@9..11 "-" [Newline("\n")] [] + 1: (empty) + 1: SEMICOLON@11..12 ";" [] [] + 4: EOF@12..13 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +unary_expr.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or a member expression but instead found ';'. + + > 1 │ ++ ; + │ ^ + 2 │ -- ; + 3 │ -; + + i Expected an identifier, or a member expression here. + + > 1 │ ++ ; + │ ^ + 2 │ -- ; + 3 │ -; + +unary_expr.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, or a member expression but instead found ';'. + + 1 │ ++ ; + > 2 │ -- ; + │ ^ + 3 │ -; + 4 │ + + i Expected an identifier, or a member expression here. + + 1 │ ++ ; + > 2 │ -- ; + │ ^ + 3 │ -; + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_string.jsx b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unterminated_string.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx.snap new file mode 100644 index 000000000000..68d8debec187 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx.snap @@ -0,0 +1,185 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const f = () => ( +
+ ); +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..8 "f" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], + body: JsParenthesizedExpression { + l_paren_token: L_PAREN@16..17 "(" [] [], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + L_ANGLE@17..23 "<" [Newline("\n"), Whitespace(" ")] [], + JsxName { + value_token: JSX_IDENT@23..26 "div" [] [], + }, + JsBogus { + items: [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@26..70 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" [Newline("\n"), Whitespace(" ")] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@70..71 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@71..118 "\"a'\n bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=\"" [] [], + }, + }, + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@118..119 "b" [] [], + }, + initializer: missing (optional), + }, + JsBogus { + items: [ + ERROR_TOKEN@119..120 "\"" [] [], + ], + }, + ], + }, + SLASH@120..126 "/" [Newline("\n"), Whitespace(" ")] [], + R_ANGLE@126..127 ">" [] [], + ], + }, + ], + }, + r_paren_token: R_PAREN@127..131 ")" [Newline("\n"), Whitespace(" ")] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@131..132 ";" [] [], + }, + ], + eof_token: EOF@132..132 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..132 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..132 + 0: JS_VARIABLE_STATEMENT@0..132 + 0: JS_VARIABLE_DECLARATION@0..131 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..131 + 0: JS_VARIABLE_DECLARATOR@6..131 + 0: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "f" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..131 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@10..131 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] + 5: JS_PARENTHESIZED_EXPRESSION@16..131 + 0: L_PAREN@16..17 "(" [] [] + 1: JS_BOGUS_EXPRESSION@17..127 + 0: JS_BOGUS@17..127 + 0: L_ANGLE@17..23 "<" [Newline("\n"), Whitespace(" ")] [] + 1: JSX_NAME@23..26 + 0: JSX_IDENT@23..26 "div" [] [] + 2: JS_BOGUS@26..120 + 0: JSX_ATTRIBUTE@26..118 + 0: JSX_NAME@26..70 + 0: JSX_IDENT@26..70 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" [Newline("\n"), Whitespace(" ")] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@70..118 + 0: EQ@70..71 "=" [] [] + 1: JSX_STRING@71..118 + 0: JSX_STRING_LITERAL@71..118 "\"a'\n bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb=\"" [] [] + 1: JSX_ATTRIBUTE@118..119 + 0: JSX_NAME@118..119 + 0: JSX_IDENT@118..119 "b" [] [] + 1: (empty) + 2: JS_BOGUS@119..120 + 0: ERROR_TOKEN@119..120 "\"" [] [] + 3: SLASH@120..126 "/" [Newline("\n"), Whitespace(" ")] [] + 4: R_ANGLE@126..127 ">" [] [] + 2: R_PAREN@127..131 ")" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@131..132 ";" [] [] + 4: EOF@132..132 "" [] [] + +``` + +## Diagnostics + +``` +unterminated_string.jsx:4:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unterminated string literal + + 2 │
+ 6 │ ); + + i + + 2 │
+ 6 │ ); + + i The closing quote must be on the same line. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.js b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.js rename to crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap new file mode 100644 index 000000000000..574a84af974d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap @@ -0,0 +1,92 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let s = "\u{200"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsBogus { + items: [ + LET_KW@0..4 "let" [] [Whitespace(" ")], + JsBogus { + items: [ + JsBogus { + items: [ + JsIdentifierBinding { + name_token: IDENT@4..6 "s" [] [Whitespace(" ")], + }, + JsBogus { + items: [ + EQ@6..8 "=" [] [Whitespace(" ")], + JsBogus { + items: [ + ERROR_TOKEN@8..16 "\"\\u{200\"" [] [], + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + SEMICOLON@16..17 ";" [] [], + ], + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: JS_BOGUS_STATEMENT@0..17 + 0: JS_BOGUS@0..16 + 0: LET_KW@0..4 "let" [] [Whitespace(" ")] + 1: JS_BOGUS@4..16 + 0: JS_BOGUS@4..16 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "s" [] [Whitespace(" ")] + 1: JS_BOGUS@6..16 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_BOGUS@8..16 + 0: ERROR_TOKEN@8..16 "\"\\u{200\"" [] [] + 1: SEMICOLON@16..17 ";" [] [] + 4: EOF@17..18 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +unterminated_unicode_codepoint.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected hex digits for a unicode code point escape, but encountered an invalid character + + > 1 │ let s = "\u{200"; + │ ^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js rename to crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap new file mode 100644 index 000000000000..f4111f312f1a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap @@ -0,0 +1,164 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (using x in y) {}; +for (await using x in y) {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForInStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: USING_KW@5..11 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@11..13 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + in_token: IN_KW@13..16 "in" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "y" [] [], + }, + }, + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@19..20 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsForInStatement { + for_token: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@27..28 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: AWAIT_KW@28..34 "await" [] [Whitespace(" ")], + kind_token: USING_KW@34..40 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@40..42 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + in_token: IN_KW@42..45 "in" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..46 "y" [] [], + }, + }, + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@48..49 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@49..50 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + ], + eof_token: EOF@51..52 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..52 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..51 + 0: JS_FOR_IN_STATEMENT@0..21 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@5..13 + 0: (empty) + 1: USING_KW@5..11 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@11..13 + 0: JS_IDENTIFIER_BINDING@11..13 + 0: IDENT@11..13 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: IN_KW@13..16 "in" [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "y" [] [] + 5: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@19..21 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_STATEMENT_LIST@20..20 + 2: R_CURLY@20..21 "}" [] [] + 1: JS_EMPTY_STATEMENT@21..22 + 0: SEMICOLON@21..22 ";" [] [] + 2: JS_FOR_IN_STATEMENT@22..50 + 0: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@27..28 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@28..42 + 0: AWAIT_KW@28..34 "await" [] [Whitespace(" ")] + 1: USING_KW@34..40 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@40..42 + 0: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: IN_KW@42..45 "in" [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@45..46 + 0: JS_REFERENCE_IDENTIFIER@45..46 + 0: IDENT@45..46 "y" [] [] + 5: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@48..50 + 0: L_CURLY@48..49 "{" [] [] + 1: JS_STATEMENT_LIST@49..49 + 2: R_CURLY@49..50 "}" [] [] + 3: JS_EMPTY_STATEMENT@50..51 + 0: SEMICOLON@50..51 ";" [] [] + 4: EOF@51..52 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +using_declaration_not_allowed_in_for_in_statement.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × The left-hand side of a 'for...in' statement cannot be a 'using' declaration + + > 1 │ for (using x in y) {}; + │ ^ + 2 │ for (await using x in y) {}; + 3 │ + +using_declaration_not_allowed_in_for_in_statement.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × The left-hand side of a 'for...in' statement cannot be a 'using' declaration + + 1 │ for (using x in y) {}; + > 2 │ for (await using x in y) {}; + │ ^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.js b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js.snap new file mode 100644 index 000000000000..dc1007deeaf9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js.snap @@ -0,0 +1,662 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +using a; +using {b}; +using c = d, e; +export using m = n; +await using f; +await using g = h, j; +await using [o] = p; +export await using q = r; +await let s; +await const t = 1; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@0..6 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..7 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@7..8 ";" [] [], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..15 "using" [Newline("\n")] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@15..16 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "b" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@17..18 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@19..26 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@26..28 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..31 "d" [] [], + }, + }, + }, + }, + COMMA@31..33 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..34 "e" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@35..43 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: missing (required), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@43..49 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@49..51 "m" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@51..53 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..54 "n" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@54..55 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: AWAIT_KW@55..62 "await" [Newline("\n")] [Whitespace(" ")], + kind: USING_KW@62..68 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@68..69 "f" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: AWAIT_KW@70..77 "await" [Newline("\n")] [Whitespace(" ")], + kind: USING_KW@77..83 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@83..85 "g" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@85..87 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@87..88 "h" [] [], + }, + }, + }, + }, + COMMA@88..90 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@90..91 "j" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@91..92 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsBogusAssignment { + items: [ + AWAIT_KW@92..99 "await" [Newline("\n")] [Whitespace(" ")], + JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@99..105 "using" [] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@105..106 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@106..107 "o" [] [], + }, + }, + r_brack_token: R_BRACK@107..109 "]" [] [Whitespace(" ")], + }, + ], + }, + operator_token: EQ@109..111 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@111..112 "p" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@112..113 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@113..121 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: missing (required), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: AWAIT_KW@121..127 "await" [] [Whitespace(" ")], + kind: USING_KW@127..133 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@133..135 "q" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@135..137 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..138 "r" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@138..139 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")], + argument: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@146..150 "let" [] [Whitespace(" ")], + ], + }, + ], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@150..151 "s" [] [], + }, + }, + semicolon_token: SEMICOLON@151..152 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@152..159 "await" [Newline("\n")] [Whitespace(" ")], + argument: missing (required), + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@159..165 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@165..167 "t" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@167..169 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@169..170 "1" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@170..171 ";" [] [], + }, + ], + eof_token: EOF@171..172 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..172 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..171 + 0: JS_VARIABLE_STATEMENT@0..8 + 0: JS_VARIABLE_DECLARATION@0..7 + 0: (empty) + 1: USING_KW@0..6 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..7 + 0: JS_VARIABLE_DECLARATOR@6..7 + 0: JS_IDENTIFIER_BINDING@6..7 + 0: IDENT@6..7 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@7..8 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@8..15 + 0: JS_IDENTIFIER_EXPRESSION@8..15 + 0: JS_REFERENCE_IDENTIFIER@8..15 + 0: IDENT@8..15 "using" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_BLOCK_STATEMENT@15..18 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_STATEMENT_LIST@16..17 + 0: JS_EXPRESSION_STATEMENT@16..17 + 0: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "b" [] [] + 1: (empty) + 2: R_CURLY@17..18 "}" [] [] + 3: JS_EMPTY_STATEMENT@18..19 + 0: SEMICOLON@18..19 ";" [] [] + 4: JS_VARIABLE_STATEMENT@19..35 + 0: JS_VARIABLE_DECLARATION@19..34 + 0: (empty) + 1: USING_KW@19..26 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@26..34 + 0: JS_VARIABLE_DECLARATOR@26..31 + 0: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@28..31 + 0: EQ@28..30 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@30..31 + 0: JS_REFERENCE_IDENTIFIER@30..31 + 0: IDENT@30..31 "d" [] [] + 1: COMMA@31..33 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@33..34 + 0: JS_IDENTIFIER_BINDING@33..34 + 0: IDENT@33..34 "e" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@34..35 ";" [] [] + 5: JS_EXPORT@35..43 + 0: JS_DECORATOR_LIST@35..35 + 1: EXPORT_KW@35..43 "export" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 6: JS_VARIABLE_STATEMENT@43..55 + 0: JS_VARIABLE_DECLARATION@43..54 + 0: (empty) + 1: USING_KW@43..49 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@49..54 + 0: JS_VARIABLE_DECLARATOR@49..54 + 0: JS_IDENTIFIER_BINDING@49..51 + 0: IDENT@49..51 "m" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@51..54 + 0: EQ@51..53 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@53..54 + 0: JS_REFERENCE_IDENTIFIER@53..54 + 0: IDENT@53..54 "n" [] [] + 1: SEMICOLON@54..55 ";" [] [] + 7: JS_VARIABLE_STATEMENT@55..70 + 0: JS_VARIABLE_DECLARATION@55..69 + 0: AWAIT_KW@55..62 "await" [Newline("\n")] [Whitespace(" ")] + 1: USING_KW@62..68 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@68..69 + 0: JS_VARIABLE_DECLARATOR@68..69 + 0: JS_IDENTIFIER_BINDING@68..69 + 0: IDENT@68..69 "f" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@69..70 ";" [] [] + 8: JS_VARIABLE_STATEMENT@70..92 + 0: JS_VARIABLE_DECLARATION@70..91 + 0: AWAIT_KW@70..77 "await" [Newline("\n")] [Whitespace(" ")] + 1: USING_KW@77..83 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@83..91 + 0: JS_VARIABLE_DECLARATOR@83..88 + 0: JS_IDENTIFIER_BINDING@83..85 + 0: IDENT@83..85 "g" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@85..88 + 0: EQ@85..87 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@87..88 + 0: JS_REFERENCE_IDENTIFIER@87..88 + 0: IDENT@87..88 "h" [] [] + 1: COMMA@88..90 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@90..91 + 0: JS_IDENTIFIER_BINDING@90..91 + 0: IDENT@90..91 "j" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@91..92 ";" [] [] + 9: JS_EXPRESSION_STATEMENT@92..113 + 0: JS_ASSIGNMENT_EXPRESSION@92..112 + 0: JS_BOGUS_ASSIGNMENT@92..109 + 0: AWAIT_KW@92..99 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@99..109 + 0: JS_IDENTIFIER_EXPRESSION@99..105 + 0: JS_REFERENCE_IDENTIFIER@99..105 + 0: IDENT@99..105 "using" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@105..106 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@106..107 + 0: JS_REFERENCE_IDENTIFIER@106..107 + 0: IDENT@106..107 "o" [] [] + 4: R_BRACK@107..109 "]" [] [Whitespace(" ")] + 1: EQ@109..111 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@111..112 + 0: JS_REFERENCE_IDENTIFIER@111..112 + 0: IDENT@111..112 "p" [] [] + 1: SEMICOLON@112..113 ";" [] [] + 10: JS_EXPORT@113..121 + 0: JS_DECORATOR_LIST@113..113 + 1: EXPORT_KW@113..121 "export" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 11: JS_VARIABLE_STATEMENT@121..139 + 0: JS_VARIABLE_DECLARATION@121..138 + 0: AWAIT_KW@121..127 "await" [] [Whitespace(" ")] + 1: USING_KW@127..133 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@133..138 + 0: JS_VARIABLE_DECLARATOR@133..138 + 0: JS_IDENTIFIER_BINDING@133..135 + 0: IDENT@133..135 "q" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@135..138 + 0: EQ@135..137 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@137..138 + 0: JS_REFERENCE_IDENTIFIER@137..138 + 0: IDENT@137..138 "r" [] [] + 1: SEMICOLON@138..139 ";" [] [] + 12: JS_EXPRESSION_STATEMENT@139..150 + 0: JS_AWAIT_EXPRESSION@139..150 + 0: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@146..150 + 0: JS_BOGUS@146..150 + 0: IDENT@146..150 "let" [] [Whitespace(" ")] + 1: (empty) + 13: JS_EXPRESSION_STATEMENT@150..152 + 0: JS_IDENTIFIER_EXPRESSION@150..151 + 0: JS_REFERENCE_IDENTIFIER@150..151 + 0: IDENT@150..151 "s" [] [] + 1: SEMICOLON@151..152 ";" [] [] + 14: JS_EXPRESSION_STATEMENT@152..159 + 0: JS_AWAIT_EXPRESSION@152..159 + 0: AWAIT_KW@152..159 "await" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 15: JS_VARIABLE_STATEMENT@159..171 + 0: JS_VARIABLE_DECLARATION@159..170 + 0: (empty) + 1: CONST_KW@159..165 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@165..170 + 0: JS_VARIABLE_DECLARATOR@165..170 + 0: JS_IDENTIFIER_BINDING@165..167 + 0: IDENT@165..167 "t" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@167..170 + 0: EQ@167..169 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@169..170 + 0: JS_NUMBER_LITERAL@169..170 "1" [] [] + 1: SEMICOLON@170..171 ";" [] [] + 4: EOF@171..172 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +using_declaration_statement_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + > 1 │ using a; + │ ^ + 2 │ using {b}; + 3 │ using c = d, e; + + i This variable needs to be initialized. + +using_declaration_statement_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ using a; + > 2 │ using {b}; + │ ^ + 3 │ using c = d, e; + 4 │ export using m = n; + + i An explicit or implicit semicolon is expected here... + + 1 │ using a; + > 2 │ using {b}; + │ ^ + 3 │ using c = d, e; + 4 │ export using m = n; + + i ...Which is required to end this statement + + 1 │ using a; + > 2 │ using {b}; + │ ^^^^^^^ + 3 │ using c = d, e; + 4 │ export using m = n; + +using_declaration_statement_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + 1 │ using a; + 2 │ using {b}; + > 3 │ using c = d, e; + │ ^ + 4 │ export using m = n; + 5 │ await using f; + + i This variable needs to be initialized. + +using_declaration_statement_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found 'using'. + + 2 │ using {b}; + 3 │ using c = d, e; + > 4 │ export using m = n; + │ ^^^^^ + 5 │ await using f; + 6 │ await using g = h, j; + + i Expected a class, a function, or a variable declaration here. + + 2 │ using {b}; + 3 │ using c = d, e; + > 4 │ export using m = n; + │ ^^^^^ + 5 │ await using f; + 6 │ await using g = h, j; + +using_declaration_statement_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + 3 │ using c = d, e; + 4 │ export using m = n; + > 5 │ await using f; + │ ^ + 6 │ await using g = h, j; + 7 │ await using [o] = p; + + i This variable needs to be initialized. + +using_declaration_statement_err.js:6:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Using declarations must have an initialized value. + + 4 │ export using m = n; + 5 │ await using f; + > 6 │ await using g = h, j; + │ ^ + 7 │ await using [o] = p; + 8 │ export await using q = r; + + i This variable needs to be initialized. + +using_declaration_statement_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Invalid assignment to `await using [o]` + + 5 │ await using f; + 6 │ await using g = h, j; + > 7 │ await using [o] = p; + │ ^^^^^^^^^^^^^^^ + 8 │ export await using q = r; + 9 │ await let s; + + i This expression cannot be assigned to + +using_declaration_statement_err.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a class, a function, or a variable declaration but instead found 'await'. + + 6 │ await using g = h, j; + 7 │ await using [o] = p; + > 8 │ export await using q = r; + │ ^^^^^ + 9 │ await let s; + 10 │ await const t = 1; + + i Expected a class, a function, or a variable declaration here. + + 6 │ await using g = h, j; + 7 │ await using [o] = p; + > 8 │ export await using q = r; + │ ^^^^^ + 9 │ await let s; + 10 │ await const t = 1; + +using_declaration_statement_err.js:9:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 7 │ await using [o] = p; + 8 │ export await using q = r; + > 9 │ await let s; + │ ^^^ + 10 │ await const t = 1; + 11 │ + +using_declaration_statement_err.js:9:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 7 │ await using [o] = p; + 8 │ export await using q = r; + > 9 │ await let s; + │ ^ + 10 │ await const t = 1; + 11 │ + + i An explicit or implicit semicolon is expected here... + + 7 │ await using [o] = p; + 8 │ export await using q = r; + > 9 │ await let s; + │ ^ + 10 │ await const t = 1; + 11 │ + + i ...Which is required to end this statement + + 7 │ await using [o] = p; + 8 │ export await using q = r; + > 9 │ await let s; + │ ^^^^^^^^^^^ + 10 │ await const t = 1; + 11 │ + +using_declaration_statement_err.js:10:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an unary expression but instead found 'const'. + + 8 │ export await using q = r; + 9 │ await let s; + > 10 │ await const t = 1; + │ ^^^^^ + 11 │ + + i Expected an unary expression here. + + 8 │ export await using q = r; + 9 │ await let s; + > 10 │ await const t = 1; + │ ^^^^^ + 11 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/var_decl_err.js b/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/var_decl_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js.snap new file mode 100644 index 000000000000..c9f03af11eb9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js.snap @@ -0,0 +1,183 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +var a =; +const b = 5 let c = 5; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..7 "=" [] [], + expression: missing (required), + }, + }, + ], + }, + semicolon_token: SEMICOLON@7..8 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@8..15 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@15..17 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@17..19 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@19..21 "5" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@21..25 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@25..27 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@27..29 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@29..30 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + ], + eof_token: EOF@31..32 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..32 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..31 + 0: JS_VARIABLE_STATEMENT@0..8 + 0: JS_VARIABLE_DECLARATION@0..7 + 0: (empty) + 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..7 + 0: JS_VARIABLE_DECLARATOR@4..7 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..7 + 0: EQ@6..7 "=" [] [] + 1: (empty) + 1: SEMICOLON@7..8 ";" [] [] + 1: JS_VARIABLE_STATEMENT@8..21 + 0: JS_VARIABLE_DECLARATION@8..21 + 0: (empty) + 1: CONST_KW@8..15 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@15..21 + 0: JS_VARIABLE_DECLARATOR@15..21 + 0: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@17..21 + 0: EQ@17..19 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@19..21 + 0: JS_NUMBER_LITERAL@19..21 "5" [] [Whitespace(" ")] + 1: (empty) + 2: JS_VARIABLE_STATEMENT@21..31 + 0: JS_VARIABLE_DECLARATION@21..30 + 0: (empty) + 1: LET_KW@21..25 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@25..30 + 0: JS_VARIABLE_DECLARATOR@25..30 + 0: JS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@27..30 + 0: EQ@27..29 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@29..30 + 0: JS_NUMBER_LITERAL@29..30 "5" [] [] + 1: SEMICOLON@30..31 ";" [] [] + 4: EOF@31..32 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +var_decl_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an expression, or an assignment but instead found ';'. + + > 1 │ var a =; + │ ^ + 2 │ const b = 5 let c = 5; + 3 │ + + i Expected an expression, or an assignment here. + + > 1 │ var a =; + │ ^ + 2 │ const b = 5 let c = 5; + 3 │ + +var_decl_err.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 1 │ var a =; + > 2 │ const b = 5 let c = 5; + │ ^^^ + 3 │ + + i An explicit or implicit semicolon is expected here... + + 1 │ var a =; + > 2 │ const b = 5 let c = 5; + │ ^^^ + 3 │ + + i ...Which is required to end this statement + + 1 │ var a =; + > 2 │ const b = 5 let c = 5; + │ ^^^^^^^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.js b/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js.snap new file mode 100644 index 000000000000..5298bdc01a79 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js.snap @@ -0,0 +1,370 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a, { b } = { a: 10 } +const c = 1, { d } = { a: 10 } +const e; +let [f]; +const { g }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@5..7 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@9..11 "b" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@13..15 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@17..18 "a" [] [], + }, + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + value: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..23 "10" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@31..33 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "1" [] [], + }, + }, + }, + COMMA@36..38 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@40..42 "d" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@42..44 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@44..46 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@48..49 "a" [] [], + }, + colon_token: COLON@49..51 ":" [] [Whitespace(" ")], + value: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@51..54 "10" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@62..63 "e" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@69..70 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@70..71 "f" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@71..72 "]" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@72..73 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@82..84 "g" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@84..85 "}" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@85..86 ";" [] [], + }, + ], + eof_token: EOF@86..87 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..87 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..86 + 0: JS_VARIABLE_STATEMENT@0..24 + 0: JS_VARIABLE_DECLARATION@0..24 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..24 + 0: JS_VARIABLE_DECLARATOR@4..5 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@5..7 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@7..24 + 0: JS_OBJECT_BINDING_PATTERN@7..13 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@9..11 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@9..11 + 0: JS_IDENTIFIER_BINDING@9..11 + 0: IDENT@9..11 "b" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@13..24 + 0: EQ@13..15 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@15..24 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@17..23 + 0: JS_PROPERTY_OBJECT_MEMBER@17..23 + 0: JS_LITERAL_MEMBER_NAME@17..18 + 0: IDENT@17..18 "a" [] [] + 1: COLON@18..20 ":" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@20..23 + 0: JS_NUMBER_LITERAL@20..23 "10" [] [Whitespace(" ")] + 2: R_CURLY@23..24 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@24..55 + 0: JS_VARIABLE_DECLARATION@24..55 + 0: (empty) + 1: CONST_KW@24..31 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@31..55 + 0: JS_VARIABLE_DECLARATOR@31..36 + 0: JS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@33..36 + 0: EQ@33..35 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "1" [] [] + 1: COMMA@36..38 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@38..55 + 0: JS_OBJECT_BINDING_PATTERN@38..44 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@40..42 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@40..42 + 0: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "d" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@42..44 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@44..55 + 0: EQ@44..46 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@46..55 + 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@48..54 + 0: JS_PROPERTY_OBJECT_MEMBER@48..54 + 0: JS_LITERAL_MEMBER_NAME@48..49 + 0: IDENT@48..49 "a" [] [] + 1: COLON@49..51 ":" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@51..54 + 0: JS_NUMBER_LITERAL@51..54 "10" [] [Whitespace(" ")] + 2: R_CURLY@54..55 "}" [] [] + 1: (empty) + 2: JS_VARIABLE_STATEMENT@55..64 + 0: JS_VARIABLE_DECLARATION@55..63 + 0: (empty) + 1: CONST_KW@55..62 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@62..63 + 0: JS_VARIABLE_DECLARATOR@62..63 + 0: JS_IDENTIFIER_BINDING@62..63 + 0: IDENT@62..63 "e" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@63..64 ";" [] [] + 3: JS_VARIABLE_STATEMENT@64..73 + 0: JS_VARIABLE_DECLARATION@64..72 + 0: (empty) + 1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@69..72 + 0: JS_VARIABLE_DECLARATOR@69..72 + 0: JS_ARRAY_BINDING_PATTERN@69..72 + 0: L_BRACK@69..70 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@70..71 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@70..71 + 0: JS_IDENTIFIER_BINDING@70..71 + 0: IDENT@70..71 "f" [] [] + 1: (empty) + 2: R_BRACK@71..72 "]" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@72..73 ";" [] [] + 4: JS_VARIABLE_STATEMENT@73..86 + 0: JS_VARIABLE_DECLARATION@73..85 + 0: (empty) + 1: CONST_KW@73..80 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@80..85 + 0: JS_VARIABLE_DECLARATOR@80..85 + 0: JS_OBJECT_BINDING_PATTERN@80..85 + 0: L_CURLY@80..82 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@82..84 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@82..84 + 0: JS_IDENTIFIER_BINDING@82..84 + 0: IDENT@82..84 "g" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@84..85 "}" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@85..86 ";" [] [] + 4: EOF@86..87 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Const declarations must have an initialized value. + + 1 │ let a, { b } = { a: 10 } + 2 │ const c = 1, { d } = { a: 10 } + > 3 │ const e; + │ ^ + 4 │ let [f]; + 5 │ const { g }; + + i This variable needs to be initialized. + +variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Object and Array patterns require initializers. + + 2 │ const c = 1, { d } = { a: 10 } + 3 │ const e; + > 4 │ let [f]; + │ ^^^ + 5 │ const { g }; + 6 │ + + i This pattern is declared, but it is not given an initialized value. + +variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Object and Array patterns require initializers. + + 3 │ const e; + 4 │ let [f]; + > 5 │ const { g }; + │ ^^^^^ + 6 │ + + i This pattern is declared, but it is not given an initialized value. + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.js b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.js rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js.snap new file mode 100644 index 000000000000..6abece3d6c9b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js.snap @@ -0,0 +1,108 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const; +const + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + JsBogus { + items: [ + CONST_KW@0..5 "const" [] [], + JsBogus { + items: [], + }, + ], + }, + SEMICOLON@5..6 ";" [] [], + ], + }, + JsBogusStatement { + items: [ + JsBogus { + items: [ + CONST_KW@6..12 "const" [Newline("\n")] [], + JsBogus { + items: [], + }, + ], + }, + ], + }, + ], + eof_token: EOF@12..13 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..13 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..12 + 0: JS_BOGUS_STATEMENT@0..6 + 0: JS_BOGUS@0..5 + 0: CONST_KW@0..5 "const" [] [] + 1: JS_BOGUS@5..5 + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_BOGUS_STATEMENT@6..12 + 0: JS_BOGUS@6..12 + 0: CONST_KW@6..12 "const" [Newline("\n")] [] + 1: JS_BOGUS@12..12 + 4: EOF@12..13 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +variable_declarator_list_empty.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found ';'. + + > 1 │ const; + │ ^ + 2 │ const + 3 │ + + i Expected an identifier, an array pattern, or an object pattern here. + + > 1 │ const; + │ ^ + 2 │ const + 3 │ + +variable_declarator_list_empty.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found the end of the file. + + 1 │ const; + 2 │ const + > 3 │ + │ + + i Expected an identifier, an array pattern, or an object pattern here. + + 1 │ const; + 2 │ const + > 3 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.js b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.js rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap new file mode 100644 index 000000000000..c1424db1e3e5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap @@ -0,0 +1,94 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const a = 1, + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..8 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@10..11 "1" [] [], + }, + }, + }, + COMMA@11..12 "," [] [], + missing element, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@12..13 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..13 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..12 + 0: JS_VARIABLE_STATEMENT@0..12 + 0: JS_VARIABLE_DECLARATION@0..12 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..12 + 0: JS_VARIABLE_DECLARATOR@6..11 + 0: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..11 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@10..11 + 0: JS_NUMBER_LITERAL@10..11 "1" [] [] + 1: COMMA@11..12 "," [] [] + 2: (empty) + 1: (empty) + 4: EOF@12..13 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +variable_declarator_list_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an identifier, an array pattern, or an object pattern but instead found the end of the file. + + 1 │ const a = 1, + > 2 │ + │ + + i Expected an identifier, an array pattern, or an object pattern here. + + 1 │ const a = 1, + > 2 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/while_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/while_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js.snap new file mode 100644 index 000000000000..ef73535472e7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js.snap @@ -0,0 +1,210 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while true {} +while {} +while (true {} +while true) } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsWhileStatement { + while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], + l_paren_token: missing (required), + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@6..11 "true" [] [Whitespace(" ")], + }, + r_paren_token: missing (required), + body: JsBlockStatement { + l_curly_token: L_CURLY@11..12 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@12..13 "}" [] [], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@13..20 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + test: missing (required), + r_paren_token: missing (required), + body: JsBlockStatement { + l_curly_token: L_CURLY@20..21 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@22..29 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@29..30 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@30..35 "true" [] [Whitespace(" ")], + }, + r_paren_token: missing (required), + body: JsBlockStatement { + l_curly_token: L_CURLY@35..36 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@37..44 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: missing (required), + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@44..48 "true" [] [], + }, + r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], + body: missing (required), + }, + JsBogusStatement { + items: [ + R_CURLY@50..51 "}" [] [], + ], + }, + ], + eof_token: EOF@51..52 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..52 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..51 + 0: JS_WHILE_STATEMENT@0..13 + 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BOOLEAN_LITERAL_EXPRESSION@6..11 + 0: TRUE_KW@6..11 "true" [] [Whitespace(" ")] + 3: (empty) + 4: JS_BLOCK_STATEMENT@11..13 + 0: L_CURLY@11..12 "{" [] [] + 1: JS_STATEMENT_LIST@12..12 + 2: R_CURLY@12..13 "}" [] [] + 1: JS_WHILE_STATEMENT@13..22 + 0: WHILE_KW@13..20 "while" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: (empty) + 4: JS_BLOCK_STATEMENT@20..22 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_STATEMENT_LIST@21..21 + 2: R_CURLY@21..22 "}" [] [] + 2: JS_WHILE_STATEMENT@22..37 + 0: WHILE_KW@22..29 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@29..30 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@30..35 + 0: TRUE_KW@30..35 "true" [] [Whitespace(" ")] + 3: (empty) + 4: JS_BLOCK_STATEMENT@35..37 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_STATEMENT_LIST@36..36 + 2: R_CURLY@36..37 "}" [] [] + 3: JS_WHILE_STATEMENT@37..50 + 0: WHILE_KW@37..44 "while" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_BOOLEAN_LITERAL_EXPRESSION@44..48 + 0: TRUE_KW@44..48 "true" [] [] + 3: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 4: (empty) + 4: JS_BOGUS_STATEMENT@50..51 + 0: R_CURLY@50..51 "}" [] [] + 4: EOF@51..52 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +while_stmt_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `true` + + > 1 │ while true {} + │ ^^^^ + 2 │ while {} + 3 │ while (true {} + + i Remove true + +while_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + > 1 │ while true {} + │ ^ + 2 │ while {} + 3 │ while (true {} + + i Remove { + +while_stmt_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `{` + + 1 │ while true {} + > 2 │ while {} + │ ^ + 3 │ while (true {} + 4 │ while true) } + + i Remove { + +while_stmt_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `{` + + 1 │ while true {} + 2 │ while {} + > 3 │ while (true {} + │ ^ + 4 │ while true) } + 5 │ + + i Remove { + +while_stmt_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `(` but instead found `true` + + 2 │ while {} + 3 │ while (true {} + > 4 │ while true) } + │ ^^^^ + 5 │ + + i Remove true + +while_stmt_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a statement but instead found '}'. + + 2 │ while {} + 3 │ while (true {} + > 4 │ while true) } + │ ^ + 5 │ + + i Expected a statement here. + + 2 │ while {} + 3 │ while (true {} + > 4 │ while true) } + │ ^ + 5 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js.snap new file mode 100644 index 000000000000..7d70596444e9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js.snap @@ -0,0 +1,71 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +yield 10; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@0..6 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@6..8 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_EXPRESSION_STATEMENT@0..9 + 0: JS_BOGUS_EXPRESSION@0..8 + 0: YIELD_KW@0..6 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@6..8 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@6..8 + 0: JS_NUMBER_LITERAL@6..8 "10" [] [] + 1: SEMICOLON@8..9 ";" [] [] + 4: EOF@9..10 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_at_top_level_module.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + > 1 │ yield 10; + │ ^^^^^ + 2 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap new file mode 100644 index 000000000000..2b8d2517a04c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +yield 10; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@16..18 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..19 + 0: JS_EXPRESSION_STATEMENT@0..19 + 0: JS_BOGUS_EXPRESSION@0..18 + 0: YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@16..18 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@16..18 + 0: JS_NUMBER_LITERAL@16..18 "10" [] [] + 1: SEMICOLON@18..19 ";" [] [] + 4: EOF@19..20 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_at_top_level_script.cjs:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + > 2 │ yield 10; + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.js.snap new file mode 100644 index 000000000000..d2e8bbf11ed9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.js.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +yield 10; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@16..18 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..19 + 0: JS_EXPRESSION_STATEMENT@0..19 + 0: JS_BOGUS_EXPRESSION@0..18 + 0: YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@16..18 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@16..18 + 0: JS_NUMBER_LITERAL@16..18 "10" [] [] + 1: SEMICOLON@18..19 ";" [] [] + 4: EOF@19..20 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_at_top_level_script.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + > 2 │ yield 10; + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap new file mode 100644 index 000000000000..92a71fd94661 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap @@ -0,0 +1,210 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function* test(a = yield "test") {} +function test2(a = yield "test") {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..8 "function" [] [], + star_token: STAR@8..10 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@10..14 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@14..15 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@15..17 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@17..19 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + YIELD_KW@19..25 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@25..31 "\"test\"" [] [], + }, + }, + ], + }, + }, + }, + ], + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@33..34 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@35..45 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@45..50 "test2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@50..51 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@51..53 "a" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@53..55 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + YIELD_KW@55..61 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@61..67 "\"test\"" [] [], + }, + }, + ], + }, + }, + }, + ], + r_paren_token: R_PAREN@67..69 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@69..70 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@70..71 "}" [] [], + }, + }, + ], + eof_token: EOF@71..72 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..72 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..71 + 0: JS_FUNCTION_DECLARATION@0..35 + 0: (empty) + 1: FUNCTION_KW@0..8 "function" [] [] + 2: STAR@8..10 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@10..14 + 0: IDENT@10..14 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@14..33 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_PARAMETER_LIST@15..31 + 0: JS_FORMAL_PARAMETER@15..31 + 0: JS_DECORATOR_LIST@15..15 + 1: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@17..31 + 0: EQ@17..19 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@19..31 + 0: YIELD_KW@19..25 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@25..31 + 0: (empty) + 1: JS_STRING_LITERAL_EXPRESSION@25..31 + 0: JS_STRING_LITERAL@25..31 "\"test\"" [] [] + 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@33..35 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_DIRECTIVE_LIST@34..34 + 2: JS_STATEMENT_LIST@34..34 + 3: R_CURLY@34..35 "}" [] [] + 1: JS_FUNCTION_DECLARATION@35..71 + 0: (empty) + 1: FUNCTION_KW@35..45 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@45..50 + 0: IDENT@45..50 "test2" [] [] + 4: (empty) + 5: JS_PARAMETERS@50..69 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_PARAMETER_LIST@51..67 + 0: JS_FORMAL_PARAMETER@51..67 + 0: JS_DECORATOR_LIST@51..51 + 1: JS_IDENTIFIER_BINDING@51..53 + 0: IDENT@51..53 "a" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@53..67 + 0: EQ@53..55 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@55..67 + 0: YIELD_KW@55..61 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@61..67 + 0: (empty) + 1: JS_STRING_LITERAL_EXPRESSION@61..67 + 0: JS_STRING_LITERAL@61..67 "\"test\"" [] [] + 2: R_PAREN@67..69 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@69..71 + 0: L_CURLY@69..70 "{" [] [] + 1: JS_DIRECTIVE_LIST@70..70 + 2: JS_STATEMENT_LIST@70..70 + 3: R_CURLY@70..71 "}" [] [] + 4: EOF@71..72 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_expr_in_parameter_initializer.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + > 1 │ function* test(a = yield "test") {} + │ ^^^^^ + 2 │ function test2(a = yield "test") {} + 3 │ + +yield_expr_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ function* test(a = yield "test") {} + > 2 │ function test2(a = yield "test") {} + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js.snap new file mode 100644 index 000000000000..3a0db6d00674 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js.snap @@ -0,0 +1,185 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { yield bar; } +function foo() { yield 10; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@17..23 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..26 "bar" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@39..42 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@42..43 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@47..53 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@53..55 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + }, + ], + eof_token: EOF@58..59 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..59 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..58 + 0: JS_FUNCTION_DECLARATION@0..29 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..29 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..28 + 0: JS_EXPRESSION_STATEMENT@17..28 + 0: JS_BOGUS_EXPRESSION@17..26 + 0: YIELD_KW@17..23 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@23..26 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@23..26 + 0: JS_REFERENCE_IDENTIFIER@23..26 + 0: IDENT@23..26 "bar" [] [] + 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] + 3: R_CURLY@28..29 "}" [] [] + 1: JS_FUNCTION_DECLARATION@29..58 + 0: (empty) + 1: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@39..42 + 0: IDENT@39..42 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@42..45 + 0: L_PAREN@42..43 "(" [] [] + 1: JS_PARAMETER_LIST@43..43 + 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@45..58 + 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@47..47 + 2: JS_STATEMENT_LIST@47..57 + 0: JS_EXPRESSION_STATEMENT@47..57 + 0: JS_BOGUS_EXPRESSION@47..55 + 0: YIELD_KW@47..53 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@53..55 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@53..55 + 0: JS_NUMBER_LITERAL@53..55 "10" [] [] + 1: SEMICOLON@55..57 ";" [] [Whitespace(" ")] + 3: R_CURLY@57..58 "}" [] [] + 4: EOF@58..59 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_in_non_generator_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + > 1 │ function foo() { yield bar; } + │ ^^^^^ + 2 │ function foo() { yield 10; } + 3 │ + +yield_in_non_generator_function.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ function foo() { yield bar; } + > 2 │ function foo() { yield 10; } + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap new file mode 100644 index 000000000000..14c9550a5df5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap @@ -0,0 +1,261 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { yield; } +function foo() { yield foo; } +function foo() { yield *foo; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@17..22 "yield" [] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@25..35 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@35..38 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@43..49 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..52 "foo" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@52..54 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@55..65 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@65..68 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@68..69 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@71..73 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@73..79 "yield" [] [Whitespace(" ")], + ], + }, + ], + }, + operator_token: STAR@79..80 "*" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@80..83 "foo" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@83..85 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + ], + eof_token: EOF@86..87 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..87 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..86 + 0: JS_FUNCTION_DECLARATION@0..25 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..25 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..24 + 0: JS_EXPRESSION_STATEMENT@17..24 + 0: JS_BOGUS_EXPRESSION@17..22 + 0: JS_BOGUS@17..22 + 0: IDENT@17..22 "yield" [] [] + 1: SEMICOLON@22..24 ";" [] [Whitespace(" ")] + 3: R_CURLY@24..25 "}" [] [] + 1: JS_FUNCTION_DECLARATION@25..55 + 0: (empty) + 1: FUNCTION_KW@25..35 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@35..38 + 0: IDENT@35..38 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@38..41 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..39 + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@41..55 + 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@43..43 + 2: JS_STATEMENT_LIST@43..54 + 0: JS_EXPRESSION_STATEMENT@43..54 + 0: JS_BOGUS_EXPRESSION@43..52 + 0: YIELD_KW@43..49 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@49..52 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@49..52 + 0: JS_REFERENCE_IDENTIFIER@49..52 + 0: IDENT@49..52 "foo" [] [] + 1: SEMICOLON@52..54 ";" [] [Whitespace(" ")] + 3: R_CURLY@54..55 "}" [] [] + 2: JS_FUNCTION_DECLARATION@55..86 + 0: (empty) + 1: FUNCTION_KW@55..65 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@65..68 + 0: IDENT@65..68 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@68..71 + 0: L_PAREN@68..69 "(" [] [] + 1: JS_PARAMETER_LIST@69..69 + 2: R_PAREN@69..71 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@71..86 + 0: L_CURLY@71..73 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@73..73 + 2: JS_STATEMENT_LIST@73..85 + 0: JS_EXPRESSION_STATEMENT@73..85 + 0: JS_BINARY_EXPRESSION@73..83 + 0: JS_BOGUS_EXPRESSION@73..79 + 0: JS_BOGUS@73..79 + 0: IDENT@73..79 "yield" [] [Whitespace(" ")] + 1: STAR@79..80 "*" [] [] + 2: JS_IDENTIFIER_EXPRESSION@80..83 + 0: JS_REFERENCE_IDENTIFIER@80..83 + 0: IDENT@80..83 "foo" [] [] + 1: SEMICOLON@83..85 ";" [] [Whitespace(" ")] + 3: R_CURLY@85..86 "}" [] [] + 4: EOF@86..87 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_in_non_generator_function_module.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + > 1 │ function foo() { yield; } + │ ^^^^^ + 2 │ function foo() { yield foo; } + 3 │ function foo() { yield *foo; } + +yield_in_non_generator_function_module.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ function foo() { yield; } + > 2 │ function foo() { yield foo; } + │ ^^^^^ + 3 │ function foo() { yield *foo; } + 4 │ + +yield_in_non_generator_function_module.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + 1 │ function foo() { yield; } + 2 │ function foo() { yield foo; } + > 3 │ function foo() { yield *foo; } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap new file mode 100644 index 000000000000..db10deb8b3dc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap @@ -0,0 +1,188 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function foo() { yield bar; } +function foo() { yield 10; } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..22 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@27..33 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..36 "bar" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@36..38 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@49..52 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@57..63 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@63..65 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..67 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..68 + 0: JS_FUNCTION_DECLARATION@0..39 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..22 + 0: IDENT@19..22 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@25..39 + 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..38 + 0: JS_EXPRESSION_STATEMENT@27..38 + 0: JS_BOGUS_EXPRESSION@27..36 + 0: YIELD_KW@27..33 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@33..36 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@33..36 + 0: JS_REFERENCE_IDENTIFIER@33..36 + 0: IDENT@33..36 "bar" [] [] + 1: SEMICOLON@36..38 ";" [] [Whitespace(" ")] + 3: R_CURLY@38..39 "}" [] [] + 1: JS_FUNCTION_DECLARATION@39..68 + 0: (empty) + 1: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@49..52 + 0: IDENT@49..52 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@55..68 + 0: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..67 + 0: JS_EXPRESSION_STATEMENT@57..67 + 0: JS_BOGUS_EXPRESSION@57..65 + 0: YIELD_KW@57..63 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@63..65 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@63..65 + 0: JS_NUMBER_LITERAL@63..65 "10" [] [] + 1: SEMICOLON@65..67 ";" [] [Whitespace(" ")] + 3: R_CURLY@67..68 "}" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_in_non_generator_function_script.cjs:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + > 2 │ function foo() { yield bar; } + │ ^^^^^ + 3 │ function foo() { yield 10; } + 4 │ + +yield_in_non_generator_function_script.cjs:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + 2 │ function foo() { yield bar; } + > 3 │ function foo() { yield 10; } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap new file mode 100644 index 000000000000..cb7d0c7591ad --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap @@ -0,0 +1,188 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +function foo() { yield bar; } +function foo() { yield 10; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..22 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@27..33 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..36 "bar" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@36..38 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@49..52 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@57..63 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@63..65 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..67 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..68 + 0: JS_FUNCTION_DECLARATION@0..39 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..22 + 0: IDENT@19..22 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@25..39 + 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..38 + 0: JS_EXPRESSION_STATEMENT@27..38 + 0: JS_BOGUS_EXPRESSION@27..36 + 0: YIELD_KW@27..33 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@33..36 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@33..36 + 0: JS_REFERENCE_IDENTIFIER@33..36 + 0: IDENT@33..36 "bar" [] [] + 1: SEMICOLON@36..38 ";" [] [Whitespace(" ")] + 3: R_CURLY@38..39 "}" [] [] + 1: JS_FUNCTION_DECLARATION@39..68 + 0: (empty) + 1: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@49..52 + 0: IDENT@49..52 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@55..68 + 0: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..67 + 0: JS_EXPRESSION_STATEMENT@57..67 + 0: JS_BOGUS_EXPRESSION@57..65 + 0: YIELD_KW@57..63 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@63..65 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@63..65 + 0: JS_NUMBER_LITERAL@63..65 "10" [] [] + 1: SEMICOLON@65..67 ";" [] [Whitespace(" ")] + 3: R_CURLY@67..68 "}" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_in_non_generator_function_script.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + > 2 │ function foo() { yield bar; } + │ ^^^^^ + 3 │ function foo() { yield 10; } + 4 │ + +yield_in_non_generator_function_script.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + 2 │ function foo() { yield bar; } + > 3 │ function foo() { yield 10; } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.ts b/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap new file mode 100644 index 000000000000..a203b355b3bb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap @@ -0,0 +1,101 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(...arguments: any[]): void; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@11..14 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@14..23 "arguments" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@25..28 "any" [] [], + }, + l_brack_token: L_BRACK@28..29 "[" [] [], + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@30..31 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@33..37 "void" [] [], + }, + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + ], + eof_token: EOF@38..39 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..39 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..38 + 0: TS_DECLARE_FUNCTION_DECLARATION@0..38 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 3: (empty) + 4: JS_PARAMETERS@10..31 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..30 + 0: JS_REST_PARAMETER@11..30 + 0: JS_DECORATOR_LIST@11..11 + 1: DOT3@11..14 "..." [] [] + 2: JS_IDENTIFIER_BINDING@14..23 + 0: IDENT@14..23 "arguments" [] [] + 3: TS_TYPE_ANNOTATION@23..30 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@25..30 + 0: TS_ANY_TYPE@25..28 + 0: ANY_KW@25..28 "any" [] [] + 1: L_BRACK@28..29 "[" [] [] + 2: R_BRACK@29..30 "]" [] [] + 2: R_PAREN@30..31 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@31..37 + 0: COLON@31..33 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@33..37 + 0: VOID_KW@33..37 "void" [] [] + 6: SEMICOLON@37..38 ";" [] [] + 4: EOF@38..39 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js.snap new file mode 100644 index 000000000000..039249adbe6c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js.snap @@ -0,0 +1,321 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[foo, bar] = baz; +[,,,b,,c,] = baz; +[a = "test", a.b, call().b] = baz; +[((a))] = baz; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@0..1 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@1..4 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@4..6 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@6..9 "bar" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@9..11 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@11..13 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..16 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@17..19 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayHole, + COMMA@19..20 "," [] [], + JsArrayHole, + COMMA@20..21 "," [] [], + JsArrayHole, + COMMA@21..22 "," [] [], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@22..23 "b" [] [], + }, + init: missing (optional), + }, + COMMA@23..24 "," [] [], + JsArrayHole, + COMMA@24..25 "," [] [], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@25..26 "c" [] [], + }, + init: missing (optional), + }, + COMMA@26..27 "," [] [], + ], + r_brack_token: R_BRACK@27..29 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@29..31 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..34 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@35..37 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@37..39 "a" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@39..41 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@41..47 "\"test\"" [] [], + }, + }, + }, + COMMA@47..49 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsStaticMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..50 "a" [] [], + }, + }, + dot_token: DOT@50..51 "." [] [], + member: JsName { + value_token: IDENT@51..52 "b" [] [], + }, + }, + init: missing (optional), + }, + COMMA@52..54 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsStaticMemberAssignment { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@54..58 "call" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@58..59 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@59..60 ")" [] [], + }, + }, + dot_token: DOT@60..61 "." [] [], + member: JsName { + value_token: IDENT@61..62 "b" [] [], + }, + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@62..64 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@64..66 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@66..69 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@70..72 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsParenthesizedAssignment { + l_paren_token: L_PAREN@72..73 "(" [] [], + assignment: JsParenthesizedAssignment { + l_paren_token: L_PAREN@73..74 "(" [] [], + assignment: JsIdentifierAssignment { + name_token: IDENT@74..75 "a" [] [], + }, + r_paren_token: R_PAREN@75..76 ")" [] [], + }, + r_paren_token: R_PAREN@76..77 ")" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@77..79 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@79..81 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@81..84 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@84..85 ";" [] [], + }, + ], + eof_token: EOF@85..86 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..86 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..85 + 0: JS_EXPRESSION_STATEMENT@0..17 + 0: JS_ASSIGNMENT_EXPRESSION@0..16 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@0..11 + 0: L_BRACK@0..1 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@1..9 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@1..4 + 0: JS_IDENTIFIER_ASSIGNMENT@1..4 + 0: IDENT@1..4 "foo" [] [] + 1: (empty) + 1: COMMA@4..6 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@6..9 + 0: JS_IDENTIFIER_ASSIGNMENT@6..9 + 0: IDENT@6..9 "bar" [] [] + 1: (empty) + 2: R_BRACK@9..11 "]" [] [Whitespace(" ")] + 1: EQ@11..13 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@13..16 + 0: JS_REFERENCE_IDENTIFIER@13..16 + 0: IDENT@13..16 "baz" [] [] + 1: SEMICOLON@16..17 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@17..35 + 0: JS_ASSIGNMENT_EXPRESSION@17..34 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@17..29 + 0: L_BRACK@17..19 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@19..27 + 0: JS_ARRAY_HOLE@19..19 + 1: COMMA@19..20 "," [] [] + 2: JS_ARRAY_HOLE@20..20 + 3: COMMA@20..21 "," [] [] + 4: JS_ARRAY_HOLE@21..21 + 5: COMMA@21..22 "," [] [] + 6: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@22..23 + 0: JS_IDENTIFIER_ASSIGNMENT@22..23 + 0: IDENT@22..23 "b" [] [] + 1: (empty) + 7: COMMA@23..24 "," [] [] + 8: JS_ARRAY_HOLE@24..24 + 9: COMMA@24..25 "," [] [] + 10: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@25..26 + 0: JS_IDENTIFIER_ASSIGNMENT@25..26 + 0: IDENT@25..26 "c" [] [] + 1: (empty) + 11: COMMA@26..27 "," [] [] + 2: R_BRACK@27..29 "]" [] [Whitespace(" ")] + 1: EQ@29..31 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@31..34 + 0: JS_REFERENCE_IDENTIFIER@31..34 + 0: IDENT@31..34 "baz" [] [] + 1: SEMICOLON@34..35 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@35..70 + 0: JS_ASSIGNMENT_EXPRESSION@35..69 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@35..64 + 0: L_BRACK@35..37 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@37..62 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@37..47 + 0: JS_IDENTIFIER_ASSIGNMENT@37..39 + 0: IDENT@37..39 "a" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@39..47 + 0: EQ@39..41 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@41..47 + 0: JS_STRING_LITERAL@41..47 "\"test\"" [] [] + 1: COMMA@47..49 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@49..52 + 0: JS_STATIC_MEMBER_ASSIGNMENT@49..52 + 0: JS_IDENTIFIER_EXPRESSION@49..50 + 0: JS_REFERENCE_IDENTIFIER@49..50 + 0: IDENT@49..50 "a" [] [] + 1: DOT@50..51 "." [] [] + 2: JS_NAME@51..52 + 0: IDENT@51..52 "b" [] [] + 1: (empty) + 3: COMMA@52..54 "," [] [Whitespace(" ")] + 4: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@54..62 + 0: JS_STATIC_MEMBER_ASSIGNMENT@54..62 + 0: JS_CALL_EXPRESSION@54..60 + 0: JS_IDENTIFIER_EXPRESSION@54..58 + 0: JS_REFERENCE_IDENTIFIER@54..58 + 0: IDENT@54..58 "call" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@58..60 + 0: L_PAREN@58..59 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@59..59 + 2: R_PAREN@59..60 ")" [] [] + 1: DOT@60..61 "." [] [] + 2: JS_NAME@61..62 + 0: IDENT@61..62 "b" [] [] + 1: (empty) + 2: R_BRACK@62..64 "]" [] [Whitespace(" ")] + 1: EQ@64..66 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@66..69 + 0: JS_REFERENCE_IDENTIFIER@66..69 + 0: IDENT@66..69 "baz" [] [] + 1: SEMICOLON@69..70 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@70..85 + 0: JS_ASSIGNMENT_EXPRESSION@70..84 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@70..79 + 0: L_BRACK@70..72 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@72..77 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@72..77 + 0: JS_PARENTHESIZED_ASSIGNMENT@72..77 + 0: L_PAREN@72..73 "(" [] [] + 1: JS_PARENTHESIZED_ASSIGNMENT@73..76 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@74..75 + 0: IDENT@74..75 "a" [] [] + 2: R_PAREN@75..76 ")" [] [] + 2: R_PAREN@76..77 ")" [] [] + 1: (empty) + 2: R_BRACK@77..79 "]" [] [Whitespace(" ")] + 1: EQ@79..81 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@81..84 + 0: JS_REFERENCE_IDENTIFIER@81..84 + 0: IDENT@81..84 "baz" [] [] + 1: SEMICOLON@84..85 ";" [] [] + 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js.snap new file mode 100644 index 000000000000..23ef6362ccbd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js.snap @@ -0,0 +1,492 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +([ ...abcd ] = a); +([ ...(abcd) ] = a); +([ ...m.test ] = c); +([ ...m[call()] ] = c); +([ ...any.expression().b ] = c); +([ ...[x, y] ] = b); +([ ...[ ...a ] ] = c); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@1..3 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@3..6 "..." [] [], + pattern: JsIdentifierAssignment { + name_token: IDENT@6..11 "abcd" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@11..13 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@13..15 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "a" [] [], + }, + }, + }, + r_paren_token: R_PAREN@16..17 ")" [] [], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@20..22 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@22..25 "..." [] [], + pattern: JsParenthesizedAssignment { + l_paren_token: L_PAREN@25..26 "(" [] [], + assignment: JsIdentifierAssignment { + name_token: IDENT@26..30 "abcd" [] [], + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@32..34 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@34..36 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@36..37 "a" [] [], + }, + }, + }, + r_paren_token: R_PAREN@37..38 ")" [] [], + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@39..41 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@41..43 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@43..46 "..." [] [], + pattern: JsStaticMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..47 "m" [] [], + }, + }, + dot_token: DOT@47..48 "." [] [], + member: JsName { + value_token: IDENT@48..53 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + r_brack_token: R_BRACK@53..55 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@55..57 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..58 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@58..59 ")" [] [], + }, + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@60..62 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@62..64 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@64..67 "..." [] [], + pattern: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@67..68 "m" [] [], + }, + }, + l_brack_token: L_BRACK@68..69 "[" [] [], + member: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@69..73 "call" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@73..74 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@74..75 ")" [] [], + }, + }, + r_brack_token: R_BRACK@75..77 "]" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@77..79 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@79..81 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@81..82 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@84..86 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@86..88 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@88..91 "..." [] [], + pattern: JsStaticMemberAssignment { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@91..94 "any" [] [], + }, + }, + operator_token: DOT@94..95 "." [] [], + member: JsName { + value_token: IDENT@95..105 "expression" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@105..106 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@106..107 ")" [] [], + }, + }, + dot_token: DOT@107..108 "." [] [], + member: JsName { + value_token: IDENT@108..110 "b" [] [Whitespace(" ")], + }, + }, + }, + ], + r_brack_token: R_BRACK@110..112 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@112..114 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@114..115 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@115..116 ")" [] [], + }, + semicolon_token: SEMICOLON@116..117 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@117..119 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@119..121 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@121..124 "..." [] [], + pattern: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@124..125 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@125..126 "x" [] [], + }, + init: missing (optional), + }, + COMMA@126..128 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@128..129 "y" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@129..131 "]" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@131..133 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@133..135 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@135..136 "b" [] [], + }, + }, + }, + r_paren_token: R_PAREN@136..137 ")" [] [], + }, + semicolon_token: SEMICOLON@137..138 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@138..140 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@140..142 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@142..145 "..." [] [], + pattern: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@145..147 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@147..150 "..." [] [], + pattern: JsIdentifierAssignment { + name_token: IDENT@150..152 "a" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@152..154 "]" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@154..156 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@156..158 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@158..159 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@159..160 ")" [] [], + }, + semicolon_token: SEMICOLON@160..161 ";" [] [], + }, + ], + eof_token: EOF@161..162 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..162 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..161 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JS_PARENTHESIZED_EXPRESSION@0..17 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..16 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@1..13 + 0: L_BRACK@1..3 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@3..11 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@3..11 + 0: DOT3@3..6 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@6..11 + 0: IDENT@6..11 "abcd" [] [Whitespace(" ")] + 2: R_BRACK@11..13 "]" [] [Whitespace(" ")] + 1: EQ@13..15 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "a" [] [] + 2: R_PAREN@16..17 ")" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@18..39 + 0: JS_PARENTHESIZED_EXPRESSION@18..38 + 0: L_PAREN@18..20 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@20..37 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@20..34 + 0: L_BRACK@20..22 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@22..32 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@22..32 + 0: DOT3@22..25 "..." [] [] + 1: JS_PARENTHESIZED_ASSIGNMENT@25..32 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@26..30 + 0: IDENT@26..30 "abcd" [] [] + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 2: R_BRACK@32..34 "]" [] [Whitespace(" ")] + 1: EQ@34..36 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@36..37 + 0: JS_REFERENCE_IDENTIFIER@36..37 + 0: IDENT@36..37 "a" [] [] + 2: R_PAREN@37..38 ")" [] [] + 1: SEMICOLON@38..39 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@39..60 + 0: JS_PARENTHESIZED_EXPRESSION@39..59 + 0: L_PAREN@39..41 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@41..58 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@41..55 + 0: L_BRACK@41..43 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@43..53 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@43..53 + 0: DOT3@43..46 "..." [] [] + 1: JS_STATIC_MEMBER_ASSIGNMENT@46..53 + 0: JS_IDENTIFIER_EXPRESSION@46..47 + 0: JS_REFERENCE_IDENTIFIER@46..47 + 0: IDENT@46..47 "m" [] [] + 1: DOT@47..48 "." [] [] + 2: JS_NAME@48..53 + 0: IDENT@48..53 "test" [] [Whitespace(" ")] + 2: R_BRACK@53..55 "]" [] [Whitespace(" ")] + 1: EQ@55..57 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@57..58 + 0: JS_REFERENCE_IDENTIFIER@57..58 + 0: IDENT@57..58 "c" [] [] + 2: R_PAREN@58..59 ")" [] [] + 1: SEMICOLON@59..60 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@60..84 + 0: JS_PARENTHESIZED_EXPRESSION@60..83 + 0: L_PAREN@60..62 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@62..82 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@62..79 + 0: L_BRACK@62..64 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@64..77 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@64..77 + 0: DOT3@64..67 "..." [] [] + 1: JS_COMPUTED_MEMBER_ASSIGNMENT@67..77 + 0: JS_IDENTIFIER_EXPRESSION@67..68 + 0: JS_REFERENCE_IDENTIFIER@67..68 + 0: IDENT@67..68 "m" [] [] + 1: L_BRACK@68..69 "[" [] [] + 2: JS_CALL_EXPRESSION@69..75 + 0: JS_IDENTIFIER_EXPRESSION@69..73 + 0: JS_REFERENCE_IDENTIFIER@69..73 + 0: IDENT@69..73 "call" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@73..75 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@74..74 + 2: R_PAREN@74..75 ")" [] [] + 3: R_BRACK@75..77 "]" [] [Whitespace(" ")] + 2: R_BRACK@77..79 "]" [] [Whitespace(" ")] + 1: EQ@79..81 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@81..82 + 0: JS_REFERENCE_IDENTIFIER@81..82 + 0: IDENT@81..82 "c" [] [] + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@84..117 + 0: JS_PARENTHESIZED_EXPRESSION@84..116 + 0: L_PAREN@84..86 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@86..115 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@86..112 + 0: L_BRACK@86..88 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@88..110 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@88..110 + 0: DOT3@88..91 "..." [] [] + 1: JS_STATIC_MEMBER_ASSIGNMENT@91..110 + 0: JS_CALL_EXPRESSION@91..107 + 0: JS_STATIC_MEMBER_EXPRESSION@91..105 + 0: JS_IDENTIFIER_EXPRESSION@91..94 + 0: JS_REFERENCE_IDENTIFIER@91..94 + 0: IDENT@91..94 "any" [] [] + 1: DOT@94..95 "." [] [] + 2: JS_NAME@95..105 + 0: IDENT@95..105 "expression" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@105..107 + 0: L_PAREN@105..106 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@106..106 + 2: R_PAREN@106..107 ")" [] [] + 1: DOT@107..108 "." [] [] + 2: JS_NAME@108..110 + 0: IDENT@108..110 "b" [] [Whitespace(" ")] + 2: R_BRACK@110..112 "]" [] [Whitespace(" ")] + 1: EQ@112..114 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@114..115 + 0: JS_REFERENCE_IDENTIFIER@114..115 + 0: IDENT@114..115 "c" [] [] + 2: R_PAREN@115..116 ")" [] [] + 1: SEMICOLON@116..117 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@117..138 + 0: JS_PARENTHESIZED_EXPRESSION@117..137 + 0: L_PAREN@117..119 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@119..136 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@119..133 + 0: L_BRACK@119..121 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@121..131 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@121..131 + 0: DOT3@121..124 "..." [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN@124..131 + 0: L_BRACK@124..125 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@125..129 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@125..126 + 0: JS_IDENTIFIER_ASSIGNMENT@125..126 + 0: IDENT@125..126 "x" [] [] + 1: (empty) + 1: COMMA@126..128 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@128..129 + 0: JS_IDENTIFIER_ASSIGNMENT@128..129 + 0: IDENT@128..129 "y" [] [] + 1: (empty) + 2: R_BRACK@129..131 "]" [] [Whitespace(" ")] + 2: R_BRACK@131..133 "]" [] [Whitespace(" ")] + 1: EQ@133..135 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@135..136 + 0: JS_REFERENCE_IDENTIFIER@135..136 + 0: IDENT@135..136 "b" [] [] + 2: R_PAREN@136..137 ")" [] [] + 1: SEMICOLON@137..138 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@138..161 + 0: JS_PARENTHESIZED_EXPRESSION@138..160 + 0: L_PAREN@138..140 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@140..159 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@140..156 + 0: L_BRACK@140..142 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@142..154 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@142..154 + 0: DOT3@142..145 "..." [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN@145..154 + 0: L_BRACK@145..147 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@147..152 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@147..152 + 0: DOT3@147..150 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@150..152 + 0: IDENT@150..152 "a" [] [Whitespace(" ")] + 2: R_BRACK@152..154 "]" [] [Whitespace(" ")] + 2: R_BRACK@154..156 "]" [] [Whitespace(" ")] + 1: EQ@156..158 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@158..159 + 0: JS_REFERENCE_IDENTIFIER@158..159 + 0: IDENT@158..159 "c" [] [] + 2: R_PAREN@159..160 ")" [] [] + 1: SEMICOLON@160..161 ";" [] [] + 4: EOF@161..162 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js.snap new file mode 100644 index 000000000000..b50da03da83c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js.snap @@ -0,0 +1,467 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = "b"; +let [c, b] = [1, 2]; +let [d, ...abcd] = [1]; +let [e = "default", x] = [] +let [, f, ...rest] = [] +let [[...rest2], { g }] = [] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@8..11 "\"b\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@12..17 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@17..18 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@18..19 "c" [] [], + }, + init: missing (optional), + }, + COMMA@19..21 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@21..22 "b" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@22..24 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@26..27 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@27..28 "1" [] [], + }, + COMMA@28..30 "," [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@30..31 "2" [] [], + }, + ], + r_brack_token: R_BRACK@31..32 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@38..39 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@39..40 "d" [] [], + }, + init: missing (optional), + }, + COMMA@40..42 "," [] [Whitespace(" ")], + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@42..45 "..." [] [], + pattern: JsIdentifierBinding { + name_token: IDENT@45..49 "abcd" [] [], + }, + }, + ], + r_brack_token: R_BRACK@49..51 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@51..53 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@53..54 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@54..55 "1" [] [], + }, + ], + r_brack_token: R_BRACK@55..56 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@56..57 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@57..62 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@62..63 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@63..65 "e" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@65..67 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@67..76 "\"default\"" [] [], + }, + }, + }, + COMMA@76..78 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@78..79 "x" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@79..81 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@81..83 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@83..84 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@84..85 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@85..90 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@90..91 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayHole, + COMMA@91..93 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@93..94 "f" [] [], + }, + init: missing (optional), + }, + COMMA@94..96 "," [] [Whitespace(" ")], + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@96..99 "..." [] [], + pattern: JsIdentifierBinding { + name_token: IDENT@99..103 "rest" [] [], + }, + }, + ], + r_brack_token: R_BRACK@103..105 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@105..107 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@107..108 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@108..109 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@109..114 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@114..115 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsArrayBindingPattern { + l_brack_token: L_BRACK@115..116 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@116..119 "..." [] [], + pattern: JsIdentifierBinding { + name_token: IDENT@119..124 "rest2" [] [], + }, + }, + ], + r_brack_token: R_BRACK@124..125 "]" [] [], + }, + init: missing (optional), + }, + COMMA@125..127 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsObjectBindingPattern { + l_curly_token: L_CURLY@127..129 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@129..131 "g" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@131..132 "}" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@132..134 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@134..136 "=" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@136..137 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@137..138 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@138..139 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..139 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..138 + 0: JS_VARIABLE_STATEMENT@0..12 + 0: JS_VARIABLE_DECLARATION@0..11 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..11 + 0: JS_VARIABLE_DECLARATOR@4..11 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..11 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@8..11 + 0: JS_STRING_LITERAL@8..11 "\"b\"" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_VARIABLE_STATEMENT@12..33 + 0: JS_VARIABLE_DECLARATION@12..32 + 0: (empty) + 1: LET_KW@12..17 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@17..32 + 0: JS_VARIABLE_DECLARATOR@17..32 + 0: JS_ARRAY_BINDING_PATTERN@17..24 + 0: L_BRACK@17..18 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@18..22 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "c" [] [] + 1: (empty) + 1: COMMA@19..21 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@21..22 + 0: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "b" [] [] + 1: (empty) + 2: R_BRACK@22..24 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@24..32 + 0: EQ@24..26 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@26..32 + 0: L_BRACK@26..27 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@27..31 + 0: JS_NUMBER_LITERAL_EXPRESSION@27..28 + 0: JS_NUMBER_LITERAL@27..28 "1" [] [] + 1: COMMA@28..30 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@30..31 + 0: JS_NUMBER_LITERAL@30..31 "2" [] [] + 2: R_BRACK@31..32 "]" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_VARIABLE_STATEMENT@33..57 + 0: JS_VARIABLE_DECLARATION@33..56 + 0: (empty) + 1: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@38..56 + 0: JS_VARIABLE_DECLARATOR@38..56 + 0: JS_ARRAY_BINDING_PATTERN@38..51 + 0: L_BRACK@38..39 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@39..49 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@39..40 + 0: JS_IDENTIFIER_BINDING@39..40 + 0: IDENT@39..40 "d" [] [] + 1: (empty) + 1: COMMA@40..42 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@42..49 + 0: DOT3@42..45 "..." [] [] + 1: JS_IDENTIFIER_BINDING@45..49 + 0: IDENT@45..49 "abcd" [] [] + 2: R_BRACK@49..51 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@51..56 + 0: EQ@51..53 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@53..56 + 0: L_BRACK@53..54 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@54..55 + 0: JS_NUMBER_LITERAL_EXPRESSION@54..55 + 0: JS_NUMBER_LITERAL@54..55 "1" [] [] + 2: R_BRACK@55..56 "]" [] [] + 1: SEMICOLON@56..57 ";" [] [] + 3: JS_VARIABLE_STATEMENT@57..85 + 0: JS_VARIABLE_DECLARATION@57..85 + 0: (empty) + 1: LET_KW@57..62 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@62..85 + 0: JS_VARIABLE_DECLARATOR@62..85 + 0: JS_ARRAY_BINDING_PATTERN@62..81 + 0: L_BRACK@62..63 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@63..79 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@63..76 + 0: JS_IDENTIFIER_BINDING@63..65 + 0: IDENT@63..65 "e" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@65..76 + 0: EQ@65..67 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@67..76 + 0: JS_STRING_LITERAL@67..76 "\"default\"" [] [] + 1: COMMA@76..78 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@78..79 + 0: JS_IDENTIFIER_BINDING@78..79 + 0: IDENT@78..79 "x" [] [] + 1: (empty) + 2: R_BRACK@79..81 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@81..85 + 0: EQ@81..83 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@83..85 + 0: L_BRACK@83..84 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@84..84 + 2: R_BRACK@84..85 "]" [] [] + 1: (empty) + 4: JS_VARIABLE_STATEMENT@85..109 + 0: JS_VARIABLE_DECLARATION@85..109 + 0: (empty) + 1: LET_KW@85..90 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@90..109 + 0: JS_VARIABLE_DECLARATOR@90..109 + 0: JS_ARRAY_BINDING_PATTERN@90..105 + 0: L_BRACK@90..91 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@91..103 + 0: JS_ARRAY_HOLE@91..91 + 1: COMMA@91..93 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@93..94 + 0: JS_IDENTIFIER_BINDING@93..94 + 0: IDENT@93..94 "f" [] [] + 1: (empty) + 3: COMMA@94..96 "," [] [Whitespace(" ")] + 4: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@96..103 + 0: DOT3@96..99 "..." [] [] + 1: JS_IDENTIFIER_BINDING@99..103 + 0: IDENT@99..103 "rest" [] [] + 2: R_BRACK@103..105 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@105..109 + 0: EQ@105..107 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@107..109 + 0: L_BRACK@107..108 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@108..108 + 2: R_BRACK@108..109 "]" [] [] + 1: (empty) + 5: JS_VARIABLE_STATEMENT@109..138 + 0: JS_VARIABLE_DECLARATION@109..138 + 0: (empty) + 1: LET_KW@109..114 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@114..138 + 0: JS_VARIABLE_DECLARATOR@114..138 + 0: JS_ARRAY_BINDING_PATTERN@114..134 + 0: L_BRACK@114..115 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@115..132 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@115..125 + 0: JS_ARRAY_BINDING_PATTERN@115..125 + 0: L_BRACK@115..116 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@116..124 + 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@116..124 + 0: DOT3@116..119 "..." [] [] + 1: JS_IDENTIFIER_BINDING@119..124 + 0: IDENT@119..124 "rest2" [] [] + 2: R_BRACK@124..125 "]" [] [] + 1: (empty) + 1: COMMA@125..127 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@127..132 + 0: JS_OBJECT_BINDING_PATTERN@127..132 + 0: L_CURLY@127..129 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@129..131 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@129..131 + 0: JS_IDENTIFIER_BINDING@129..131 + 0: IDENT@129..131 "g" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@131..132 "}" [] [] + 1: (empty) + 2: R_BRACK@132..134 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@134..138 + 0: EQ@134..136 "=" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@136..138 + 0: L_BRACK@136..137 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@137..137 + 2: R_BRACK@137..138 "]" [] [] + 1: (empty) + 4: EOF@138..139 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_binding_rest.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js.snap new file mode 100644 index 000000000000..91d49bbc7e01 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js.snap @@ -0,0 +1,239 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let [ ...abcd ] = a; +let [ ...[x, y] ] = b; +let [ ...[ ...a ] ] = c; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@4..6 "[" [] [Whitespace(" ")], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@6..9 "..." [] [], + pattern: JsIdentifierBinding { + name_token: IDENT@9..14 "abcd" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@14..16 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@16..18 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..19 "a" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@25..27 "[" [] [Whitespace(" ")], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@27..30 "..." [] [], + pattern: JsArrayBindingPattern { + l_brack_token: L_BRACK@30..31 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@31..32 "x" [] [], + }, + init: missing (optional), + }, + COMMA@32..34 "," [] [Whitespace(" ")], + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@34..35 "y" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@35..37 "]" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@37..39 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@39..41 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..42 "b" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@48..50 "[" [] [Whitespace(" ")], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@50..53 "..." [] [], + pattern: JsArrayBindingPattern { + l_brack_token: L_BRACK@53..55 "[" [] [Whitespace(" ")], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@55..58 "..." [] [], + pattern: JsIdentifierBinding { + name_token: IDENT@58..60 "a" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@60..62 "]" [] [Whitespace(" ")], + }, + }, + ], + r_brack_token: R_BRACK@62..64 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@64..66 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@66..67 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@67..68 ";" [] [], + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..68 + 0: JS_VARIABLE_STATEMENT@0..20 + 0: JS_VARIABLE_DECLARATION@0..19 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..19 + 0: JS_VARIABLE_DECLARATOR@4..19 + 0: JS_ARRAY_BINDING_PATTERN@4..16 + 0: L_BRACK@4..6 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@6..14 + 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@6..14 + 0: DOT3@6..9 "..." [] [] + 1: JS_IDENTIFIER_BINDING@9..14 + 0: IDENT@9..14 "abcd" [] [Whitespace(" ")] + 2: R_BRACK@14..16 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@16..19 + 0: EQ@16..18 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@18..19 + 0: JS_REFERENCE_IDENTIFIER@18..19 + 0: IDENT@18..19 "a" [] [] + 1: SEMICOLON@19..20 ";" [] [] + 1: JS_VARIABLE_STATEMENT@20..43 + 0: JS_VARIABLE_DECLARATION@20..42 + 0: (empty) + 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@25..42 + 0: JS_VARIABLE_DECLARATOR@25..42 + 0: JS_ARRAY_BINDING_PATTERN@25..39 + 0: L_BRACK@25..27 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@27..37 + 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@27..37 + 0: DOT3@27..30 "..." [] [] + 1: JS_ARRAY_BINDING_PATTERN@30..37 + 0: L_BRACK@30..31 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@31..35 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@31..32 + 0: JS_IDENTIFIER_BINDING@31..32 + 0: IDENT@31..32 "x" [] [] + 1: (empty) + 1: COMMA@32..34 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_ELEMENT@34..35 + 0: JS_IDENTIFIER_BINDING@34..35 + 0: IDENT@34..35 "y" [] [] + 1: (empty) + 2: R_BRACK@35..37 "]" [] [Whitespace(" ")] + 2: R_BRACK@37..39 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@39..42 + 0: EQ@39..41 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@41..42 + 0: JS_REFERENCE_IDENTIFIER@41..42 + 0: IDENT@41..42 "b" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 2: JS_VARIABLE_STATEMENT@43..68 + 0: JS_VARIABLE_DECLARATION@43..67 + 0: (empty) + 1: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@48..67 + 0: JS_VARIABLE_DECLARATOR@48..67 + 0: JS_ARRAY_BINDING_PATTERN@48..64 + 0: L_BRACK@48..50 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@50..62 + 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@50..62 + 0: DOT3@50..53 "..." [] [] + 1: JS_ARRAY_BINDING_PATTERN@53..62 + 0: L_BRACK@53..55 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@55..60 + 0: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@55..60 + 0: DOT3@55..58 "..." [] [] + 1: JS_IDENTIFIER_BINDING@58..60 + 0: IDENT@58..60 "a" [] [Whitespace(" ")] + 2: R_BRACK@60..62 "]" [] [Whitespace(" ")] + 2: R_BRACK@62..64 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@64..67 + 0: EQ@64..66 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@66..67 + 0: JS_REFERENCE_IDENTIFIER@66..67 + 0: IDENT@66..67 "c" [] [] + 1: SEMICOLON@67..68 ";" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js.snap new file mode 100644 index 000000000000..0702f8559794 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for(["a" in {}];;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..3 "for" [] [], + l_paren_token: L_PAREN@3..4 "(" [] [], + initializer: JsArrayExpression { + l_brack_token: L_BRACK@4..5 "[" [] [], + elements: JsArrayElementList [ + JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@5..9 "\"a\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@9..12 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@12..13 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@13..14 "}" [] [], + }, + }, + ], + r_brack_token: R_BRACK@14..15 "]" [] [], + }, + first_semi_token: SEMICOLON@15..16 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@16..17 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@19..20 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_FOR_STATEMENT@0..21 + 0: FOR_KW@0..3 "for" [] [] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_ARRAY_EXPRESSION@4..15 + 0: L_BRACK@4..5 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@5..14 + 0: JS_IN_EXPRESSION@5..14 + 0: JS_STRING_LITERAL_EXPRESSION@5..9 + 0: JS_STRING_LITERAL@5..9 "\"a\"" [] [Whitespace(" ")] + 1: IN_KW@9..12 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@12..14 + 0: L_CURLY@12..13 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@13..13 + 2: R_CURLY@13..14 "}" [] [] + 2: R_BRACK@14..15 "]" [] [] + 3: SEMICOLON@15..16 ";" [] [] + 4: (empty) + 5: SEMICOLON@16..17 ";" [] [] + 6: (empty) + 7: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@19..21 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_STATEMENT_LIST@20..20 + 2: R_CURLY@20..21 "}" [] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js.snap new file mode 100644 index 000000000000..6d4671b41fed --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js.snap @@ -0,0 +1,249 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[foo, bar]; +[foo]; +[,foo]; +[foo,]; +[,,,,,foo,,,,]; +[...a, ...b]; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@0..1 "[" [] [], + elements: JsArrayElementList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..4 "foo" [] [], + }, + }, + COMMA@4..6 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@6..9 "bar" [] [], + }, + }, + ], + r_brack_token: R_BRACK@9..10 "]" [] [], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@11..13 "[" [Newline("\n")] [], + elements: JsArrayElementList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..16 "foo" [] [], + }, + }, + ], + r_brack_token: R_BRACK@16..17 "]" [] [], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@18..20 "[" [Newline("\n")] [], + elements: JsArrayElementList [ + JsArrayHole, + COMMA@20..21 "," [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..24 "foo" [] [], + }, + }, + ], + r_brack_token: R_BRACK@24..25 "]" [] [], + }, + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@26..28 "[" [Newline("\n")] [], + elements: JsArrayElementList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..31 "foo" [] [], + }, + }, + COMMA@31..32 "," [] [], + ], + r_brack_token: R_BRACK@32..33 "]" [] [], + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@34..36 "[" [Newline("\n")] [], + elements: JsArrayElementList [ + JsArrayHole, + COMMA@36..37 "," [] [], + JsArrayHole, + COMMA@37..38 "," [] [], + JsArrayHole, + COMMA@38..39 "," [] [], + JsArrayHole, + COMMA@39..40 "," [] [], + JsArrayHole, + COMMA@40..41 "," [] [], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..44 "foo" [] [], + }, + }, + COMMA@44..45 "," [] [], + JsArrayHole, + COMMA@45..46 "," [] [], + JsArrayHole, + COMMA@46..47 "," [] [], + JsArrayHole, + COMMA@47..48 "," [] [], + ], + r_brack_token: R_BRACK@48..49 "]" [] [], + }, + semicolon_token: SEMICOLON@49..50 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@50..52 "[" [Newline("\n")] [], + elements: JsArrayElementList [ + JsSpread { + dotdotdot_token: DOT3@52..55 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..56 "a" [] [], + }, + }, + }, + COMMA@56..58 "," [] [Whitespace(" ")], + JsSpread { + dotdotdot_token: DOT3@58..61 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@61..62 "b" [] [], + }, + }, + }, + ], + r_brack_token: R_BRACK@62..63 "]" [] [], + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: JS_EXPRESSION_STATEMENT@0..11 + 0: JS_ARRAY_EXPRESSION@0..10 + 0: L_BRACK@0..1 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@1..9 + 0: JS_IDENTIFIER_EXPRESSION@1..4 + 0: JS_REFERENCE_IDENTIFIER@1..4 + 0: IDENT@1..4 "foo" [] [] + 1: COMMA@4..6 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@6..9 + 0: JS_REFERENCE_IDENTIFIER@6..9 + 0: IDENT@6..9 "bar" [] [] + 2: R_BRACK@9..10 "]" [] [] + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@11..18 + 0: JS_ARRAY_EXPRESSION@11..17 + 0: L_BRACK@11..13 "[" [Newline("\n")] [] + 1: JS_ARRAY_ELEMENT_LIST@13..16 + 0: JS_IDENTIFIER_EXPRESSION@13..16 + 0: JS_REFERENCE_IDENTIFIER@13..16 + 0: IDENT@13..16 "foo" [] [] + 2: R_BRACK@16..17 "]" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@18..26 + 0: JS_ARRAY_EXPRESSION@18..25 + 0: L_BRACK@18..20 "[" [Newline("\n")] [] + 1: JS_ARRAY_ELEMENT_LIST@20..24 + 0: JS_ARRAY_HOLE@20..20 + 1: COMMA@20..21 "," [] [] + 2: JS_IDENTIFIER_EXPRESSION@21..24 + 0: JS_REFERENCE_IDENTIFIER@21..24 + 0: IDENT@21..24 "foo" [] [] + 2: R_BRACK@24..25 "]" [] [] + 1: SEMICOLON@25..26 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@26..34 + 0: JS_ARRAY_EXPRESSION@26..33 + 0: L_BRACK@26..28 "[" [Newline("\n")] [] + 1: JS_ARRAY_ELEMENT_LIST@28..32 + 0: JS_IDENTIFIER_EXPRESSION@28..31 + 0: JS_REFERENCE_IDENTIFIER@28..31 + 0: IDENT@28..31 "foo" [] [] + 1: COMMA@31..32 "," [] [] + 2: R_BRACK@32..33 "]" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@34..50 + 0: JS_ARRAY_EXPRESSION@34..49 + 0: L_BRACK@34..36 "[" [Newline("\n")] [] + 1: JS_ARRAY_ELEMENT_LIST@36..48 + 0: JS_ARRAY_HOLE@36..36 + 1: COMMA@36..37 "," [] [] + 2: JS_ARRAY_HOLE@37..37 + 3: COMMA@37..38 "," [] [] + 4: JS_ARRAY_HOLE@38..38 + 5: COMMA@38..39 "," [] [] + 6: JS_ARRAY_HOLE@39..39 + 7: COMMA@39..40 "," [] [] + 8: JS_ARRAY_HOLE@40..40 + 9: COMMA@40..41 "," [] [] + 10: JS_IDENTIFIER_EXPRESSION@41..44 + 0: JS_REFERENCE_IDENTIFIER@41..44 + 0: IDENT@41..44 "foo" [] [] + 11: COMMA@44..45 "," [] [] + 12: JS_ARRAY_HOLE@45..45 + 13: COMMA@45..46 "," [] [] + 14: JS_ARRAY_HOLE@46..46 + 15: COMMA@46..47 "," [] [] + 16: JS_ARRAY_HOLE@47..47 + 17: COMMA@47..48 "," [] [] + 2: R_BRACK@48..49 "]" [] [] + 1: SEMICOLON@49..50 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@50..64 + 0: JS_ARRAY_EXPRESSION@50..63 + 0: L_BRACK@50..52 "[" [Newline("\n")] [] + 1: JS_ARRAY_ELEMENT_LIST@52..62 + 0: JS_SPREAD@52..56 + 0: DOT3@52..55 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@55..56 + 0: JS_REFERENCE_IDENTIFIER@55..56 + 0: IDENT@55..56 "a" [] [] + 1: COMMA@56..58 "," [] [Whitespace(" ")] + 2: JS_SPREAD@58..62 + 0: DOT3@58..61 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@61..62 + 0: JS_REFERENCE_IDENTIFIER@61..62 + 0: IDENT@61..62 "b" [] [] + 2: R_BRACK@62..63 "]" [] [] + 1: SEMICOLON@63..64 ";" [] [] + 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js.snap new file mode 100644 index 000000000000..9b1d7049b521 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js.snap @@ -0,0 +1,479 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[{ + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42] = [23]; +({ x: { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42 } = { x: 23 }); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@0..1 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsStaticMemberAssignment { + object: JsObjectExpression { + l_curly_token: L_CURLY@1..2 "{" [] [], + members: JsObjectMemberList [ + JsGetterObjectMember { + get_token: GET_KW@2..9 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@9..10 "y" [] [], + }, + l_paren_token: L_PAREN@10..11 "(" [] [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsThrowStatement { + throw_token: THROW_KW@14..25 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsNewExpression { + new_token: NEW_KW@25..29 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@29..41 "Test262Error" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@41..42 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@42..80 "'The property should not be accessed.'" [] [], + }, + ], + r_paren_token: R_PAREN@80..81 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@81..82 ";" [] [], + }, + ], + r_curly_token: R_CURLY@82..86 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@86..87 "," [] [], + JsSetterObjectMember { + set_token: SET_KW@87..94 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@94..95 "y" [] [], + }, + l_paren_token: L_PAREN@95..96 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@96..99 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@101..102 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@102..116 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + operator_token: EQ@116..118 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@118..121 "val" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@121..122 ";" [] [], + }, + ], + r_curly_token: R_CURLY@122..126 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@126..128 "}" [Newline("\n")] [], + }, + dot_token: DOT@128..129 "." [] [], + member: JsName { + value_token: IDENT@129..131 "y" [] [Whitespace(" ")], + }, + }, + init: JsInitializerClause { + eq_token: EQ@131..133 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@133..135 "42" [] [], + }, + }, + }, + ], + r_brack_token: R_BRACK@135..137 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@137..139 "=" [] [Whitespace(" ")], + right: JsArrayExpression { + l_brack_token: L_BRACK@139..140 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@140..142 "23" [] [], + }, + ], + r_brack_token: R_BRACK@142..143 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@143..144 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@144..146 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@146..148 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@148..149 "x" [] [], + }, + colon_token: COLON@149..151 ":" [] [Whitespace(" ")], + pattern: JsStaticMemberAssignment { + object: JsObjectExpression { + l_curly_token: L_CURLY@151..152 "{" [] [], + members: JsObjectMemberList [ + JsGetterObjectMember { + get_token: GET_KW@152..159 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@159..160 "y" [] [], + }, + l_paren_token: L_PAREN@160..161 "(" [] [], + r_paren_token: R_PAREN@161..163 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@163..164 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsThrowStatement { + throw_token: THROW_KW@164..175 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsNewExpression { + new_token: NEW_KW@175..179 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@179..191 "Test262Error" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@191..192 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@192..230 "'The property should not be accessed.'" [] [], + }, + ], + r_paren_token: R_PAREN@230..231 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@231..232 ";" [] [], + }, + ], + r_curly_token: R_CURLY@232..236 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@236..237 "," [] [], + JsSetterObjectMember { + set_token: SET_KW@237..244 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@244..245 "y" [] [], + }, + l_paren_token: L_PAREN@245..246 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@246..249 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@249..251 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@251..252 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@252..266 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + operator_token: EQ@266..268 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@268..271 "val" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@271..272 ";" [] [], + }, + ], + r_curly_token: R_CURLY@272..276 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@276..278 "}" [Newline("\n")] [], + }, + dot_token: DOT@278..279 "." [] [], + member: JsName { + value_token: IDENT@279..281 "y" [] [Whitespace(" ")], + }, + }, + init: JsInitializerClause { + eq_token: EQ@281..283 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@283..286 "42" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@286..288 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@288..290 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@290..292 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@292..293 "x" [] [], + }, + colon_token: COLON@293..295 ":" [] [Whitespace(" ")], + value: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@295..298 "23" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@298..299 "}" [] [], + }, + }, + r_paren_token: R_PAREN@299..300 ")" [] [], + }, + semicolon_token: SEMICOLON@300..301 ";" [] [], + }, + ], + eof_token: EOF@301..302 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..302 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..301 + 0: JS_EXPRESSION_STATEMENT@0..144 + 0: JS_ASSIGNMENT_EXPRESSION@0..143 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@0..137 + 0: L_BRACK@0..1 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@1..135 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@1..135 + 0: JS_STATIC_MEMBER_ASSIGNMENT@1..131 + 0: JS_OBJECT_EXPRESSION@1..128 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@2..126 + 0: JS_GETTER_OBJECT_MEMBER@2..86 + 0: GET_KW@2..9 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@9..10 + 0: IDENT@9..10 "y" [] [] + 2: L_PAREN@10..11 "(" [] [] + 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_FUNCTION_BODY@13..86 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..82 + 0: JS_THROW_STATEMENT@14..82 + 0: THROW_KW@14..25 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@25..81 + 0: NEW_KW@25..29 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@29..41 + 0: JS_REFERENCE_IDENTIFIER@29..41 + 0: IDENT@29..41 "Test262Error" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@41..81 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@42..80 + 0: JS_STRING_LITERAL_EXPRESSION@42..80 + 0: JS_STRING_LITERAL@42..80 "'The property should not be accessed.'" [] [] + 2: R_PAREN@80..81 ")" [] [] + 2: SEMICOLON@81..82 ";" [] [] + 3: R_CURLY@82..86 "}" [Newline("\n"), Whitespace(" ")] [] + 1: COMMA@86..87 "," [] [] + 2: JS_SETTER_OBJECT_MEMBER@87..126 + 0: SET_KW@87..94 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@94..95 + 0: IDENT@94..95 "y" [] [] + 2: L_PAREN@95..96 "(" [] [] + 3: JS_FORMAL_PARAMETER@96..99 + 0: JS_DECORATOR_LIST@96..96 + 1: JS_IDENTIFIER_BINDING@96..99 + 0: IDENT@96..99 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@99..101 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@101..126 + 0: L_CURLY@101..102 "{" [] [] + 1: JS_DIRECTIVE_LIST@102..102 + 2: JS_STATEMENT_LIST@102..122 + 0: JS_EXPRESSION_STATEMENT@102..122 + 0: JS_ASSIGNMENT_EXPRESSION@102..121 + 0: JS_IDENTIFIER_ASSIGNMENT@102..116 + 0: IDENT@102..116 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: EQ@116..118 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@118..121 + 0: JS_REFERENCE_IDENTIFIER@118..121 + 0: IDENT@118..121 "val" [] [] + 1: SEMICOLON@121..122 ";" [] [] + 3: R_CURLY@122..126 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@126..128 "}" [Newline("\n")] [] + 1: DOT@128..129 "." [] [] + 2: JS_NAME@129..131 + 0: IDENT@129..131 "y" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@131..135 + 0: EQ@131..133 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@133..135 + 0: JS_NUMBER_LITERAL@133..135 "42" [] [] + 2: R_BRACK@135..137 "]" [] [Whitespace(" ")] + 1: EQ@137..139 "=" [] [Whitespace(" ")] + 2: JS_ARRAY_EXPRESSION@139..143 + 0: L_BRACK@139..140 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@140..142 + 0: JS_NUMBER_LITERAL_EXPRESSION@140..142 + 0: JS_NUMBER_LITERAL@140..142 "23" [] [] + 2: R_BRACK@142..143 "]" [] [] + 1: SEMICOLON@143..144 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@144..301 + 0: JS_PARENTHESIZED_EXPRESSION@144..300 + 0: L_PAREN@144..146 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@146..299 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@146..288 + 0: L_CURLY@146..148 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@148..286 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@148..286 + 0: JS_LITERAL_MEMBER_NAME@148..149 + 0: IDENT@148..149 "x" [] [] + 1: COLON@149..151 ":" [] [Whitespace(" ")] + 2: JS_STATIC_MEMBER_ASSIGNMENT@151..281 + 0: JS_OBJECT_EXPRESSION@151..278 + 0: L_CURLY@151..152 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@152..276 + 0: JS_GETTER_OBJECT_MEMBER@152..236 + 0: GET_KW@152..159 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@159..160 + 0: IDENT@159..160 "y" [] [] + 2: L_PAREN@160..161 "(" [] [] + 3: R_PAREN@161..163 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_FUNCTION_BODY@163..236 + 0: L_CURLY@163..164 "{" [] [] + 1: JS_DIRECTIVE_LIST@164..164 + 2: JS_STATEMENT_LIST@164..232 + 0: JS_THROW_STATEMENT@164..232 + 0: THROW_KW@164..175 "throw" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@175..231 + 0: NEW_KW@175..179 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@179..191 + 0: JS_REFERENCE_IDENTIFIER@179..191 + 0: IDENT@179..191 "Test262Error" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@191..231 + 0: L_PAREN@191..192 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@192..230 + 0: JS_STRING_LITERAL_EXPRESSION@192..230 + 0: JS_STRING_LITERAL@192..230 "'The property should not be accessed.'" [] [] + 2: R_PAREN@230..231 ")" [] [] + 2: SEMICOLON@231..232 ";" [] [] + 3: R_CURLY@232..236 "}" [Newline("\n"), Whitespace(" ")] [] + 1: COMMA@236..237 "," [] [] + 2: JS_SETTER_OBJECT_MEMBER@237..276 + 0: SET_KW@237..244 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@244..245 + 0: IDENT@244..245 "y" [] [] + 2: L_PAREN@245..246 "(" [] [] + 3: JS_FORMAL_PARAMETER@246..249 + 0: JS_DECORATOR_LIST@246..246 + 1: JS_IDENTIFIER_BINDING@246..249 + 0: IDENT@246..249 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@249..251 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@251..276 + 0: L_CURLY@251..252 "{" [] [] + 1: JS_DIRECTIVE_LIST@252..252 + 2: JS_STATEMENT_LIST@252..272 + 0: JS_EXPRESSION_STATEMENT@252..272 + 0: JS_ASSIGNMENT_EXPRESSION@252..271 + 0: JS_IDENTIFIER_ASSIGNMENT@252..266 + 0: IDENT@252..266 "setValue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: EQ@266..268 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@268..271 + 0: JS_REFERENCE_IDENTIFIER@268..271 + 0: IDENT@268..271 "val" [] [] + 1: SEMICOLON@271..272 ";" [] [] + 3: R_CURLY@272..276 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@276..278 "}" [Newline("\n")] [] + 1: DOT@278..279 "." [] [] + 2: JS_NAME@279..281 + 0: IDENT@279..281 "y" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@281..286 + 0: EQ@281..283 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@283..286 + 0: JS_NUMBER_LITERAL@283..286 "42" [] [Whitespace(" ")] + 2: R_CURLY@286..288 "}" [] [Whitespace(" ")] + 1: EQ@288..290 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@290..299 + 0: L_CURLY@290..292 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@292..298 + 0: JS_PROPERTY_OBJECT_MEMBER@292..298 + 0: JS_LITERAL_MEMBER_NAME@292..293 + 0: IDENT@292..293 "x" [] [] + 1: COLON@293..295 ":" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@295..298 + 0: JS_NUMBER_LITERAL@295..298 "23" [] [Whitespace(" ")] + 2: R_CURLY@298..299 "}" [] [] + 2: R_PAREN@299..300 ")" [] [] + 1: SEMICOLON@300..301 ";" [] [] + 4: EOF@301..302 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.js b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.js rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap new file mode 100644 index 000000000000..66157258fd51 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +a ? (b) : a => {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..2 "a" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2..4 "?" [] [Whitespace(" ")], + consequent: JsParenthesizedExpression { + l_paren_token: L_PAREN@4..5 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@5..6 "b" [] [], + }, + }, + r_paren_token: R_PAREN@6..8 ")" [] [Whitespace(" ")], + }, + colon_token: COLON@8..10 ":" [] [Whitespace(" ")], + alternate: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@10..12 "a" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + ], + eof_token: EOF@18..19 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..19 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..18 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JS_CONDITIONAL_EXPRESSION@0..17 + 0: JS_IDENTIFIER_EXPRESSION@0..2 + 0: JS_REFERENCE_IDENTIFIER@0..2 + 0: IDENT@0..2 "a" [] [Whitespace(" ")] + 1: QUESTION@2..4 "?" [] [Whitespace(" ")] + 2: JS_PARENTHESIZED_EXPRESSION@4..8 + 0: L_PAREN@4..5 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@5..6 + 0: JS_REFERENCE_IDENTIFIER@5..6 + 0: IDENT@5..6 "b" [] [] + 2: R_PAREN@6..8 ")" [] [Whitespace(" ")] + 3: COLON@8..10 ":" [] [Whitespace(" ")] + 4: JS_ARROW_FUNCTION_EXPRESSION@10..17 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "a" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@15..17 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..16 + 3: R_CURLY@16..17 "}" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 4: EOF@18..19 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.js b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.js rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap new file mode 100644 index 000000000000..35cc1324fa05 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap @@ -0,0 +1,169 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +foo => {} +yield => {} +await => {} +baz => +{} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@0..14 "foo" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@19..26 "yield" [Newline("\n")] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@29..30 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@31..38 "await" [Newline("\n")] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@38..41 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@41..42 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@43..48 "baz" [Newline("\n")] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@48..50 "=>" [] [], + body: JsFunctionBody { + l_curly_token: L_CURLY@50..52 "{" [Newline("\n")] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@53..54 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..54 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..53 + 0: JS_EXPRESSION_STATEMENT@0..19 + 0: JS_ARROW_FUNCTION_EXPRESSION@0..19 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@0..14 + 0: IDENT@0..14 "foo" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@14..17 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..18 + 3: R_CURLY@18..19 "}" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@19..31 + 0: JS_ARROW_FUNCTION_EXPRESSION@19..31 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@19..26 + 0: IDENT@19..26 "yield" [Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@29..31 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_DIRECTIVE_LIST@30..30 + 2: JS_STATEMENT_LIST@30..30 + 3: R_CURLY@30..31 "}" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@31..43 + 0: JS_ARROW_FUNCTION_EXPRESSION@31..43 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@31..38 + 0: IDENT@31..38 "await" [Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@38..41 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@41..43 + 0: L_CURLY@41..42 "{" [] [] + 1: JS_DIRECTIVE_LIST@42..42 + 2: JS_STATEMENT_LIST@42..42 + 3: R_CURLY@42..43 "}" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@43..53 + 0: JS_ARROW_FUNCTION_EXPRESSION@43..53 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@43..48 + 0: IDENT@43..48 "baz" [Newline("\n")] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@48..50 "=>" [] [] + 5: JS_FUNCTION_BODY@50..53 + 0: L_CURLY@50..52 "{" [Newline("\n")] [] + 1: JS_DIRECTIVE_LIST@52..52 + 2: JS_STATEMENT_LIST@52..52 + 3: R_CURLY@52..53 "}" [] [] + 1: (empty) + 4: EOF@53..54 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.js b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.js rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js.snap new file mode 100644 index 000000000000..fd6069b9cf01 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js.snap @@ -0,0 +1,208 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + constructor() { + () => { super() }; + () => super(); + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@9..23 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@27..33 "(" [Newline("\n"), Whitespace(" ")] [], + items: JsParameterList [], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@40..45 "super" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@45..46 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@49..50 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@50..56 "(" [Newline("\n"), Whitespace(" ")] [], + items: JsParameterList [], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")], + body: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@61..66 "super" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@66..67 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@67..68 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@68..69 ";" [] [], + }, + ], + r_curly_token: R_CURLY@69..72 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@72..74 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: JS_CLASS_DECLARATION@0..74 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..72 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..72 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..23 + 0: IDENT@9..23 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@26..72 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..69 + 0: JS_EXPRESSION_STATEMENT@27..50 + 0: JS_ARROW_FUNCTION_EXPRESSION@27..49 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@27..35 + 0: L_PAREN@27..33 "(" [Newline("\n"), Whitespace(" ")] [] + 1: JS_PARAMETER_LIST@33..33 + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@38..49 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..48 + 0: JS_EXPRESSION_STATEMENT@40..48 + 0: JS_CALL_EXPRESSION@40..48 + 0: JS_SUPER_EXPRESSION@40..45 + 0: SUPER_KW@40..45 "super" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@45..48 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@46..46 + 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@48..49 "}" [] [] + 1: SEMICOLON@49..50 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@50..69 + 0: JS_ARROW_FUNCTION_EXPRESSION@50..68 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@50..58 + 0: L_PAREN@50..56 "(" [Newline("\n"), Whitespace(" ")] [] + 1: JS_PARAMETER_LIST@56..56 + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")] + 5: JS_CALL_EXPRESSION@61..68 + 0: JS_SUPER_EXPRESSION@61..66 + 0: SUPER_KW@61..66 "super" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@66..68 + 0: L_PAREN@66..67 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@67..67 + 2: R_PAREN@67..68 ")" [] [] + 1: SEMICOLON@68..69 ";" [] [] + 3: R_CURLY@69..72 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@72..74 "}" [Newline("\n")] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap new file mode 100644 index 000000000000..435d83496101 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap @@ -0,0 +1,141 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +eval.foo = 10 +arguments[1] = "baz" +eval[2] = "Chungking Express" + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "eval" [] [], + }, + }, + dot_token: DOT@4..5 "." [] [], + member: JsName { + value_token: IDENT@5..9 "foo" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@9..11 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@11..13 "10" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..23 "arguments" [Newline("\n")] [], + }, + }, + l_brack_token: L_BRACK@23..24 "[" [] [], + member: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@24..25 "1" [] [], + }, + r_brack_token: R_BRACK@25..27 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@27..29 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@29..34 "\"baz\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@34..39 "eval" [Newline("\n")] [], + }, + }, + l_brack_token: L_BRACK@39..40 "[" [] [], + member: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@40..41 "2" [] [], + }, + r_brack_token: R_BRACK@41..43 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@43..45 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@45..64 "\"Chungking Express\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_ASSIGNMENT_EXPRESSION@0..13 + 0: JS_STATIC_MEMBER_ASSIGNMENT@0..9 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "eval" [] [] + 1: DOT@4..5 "." [] [] + 2: JS_NAME@5..9 + 0: IDENT@5..9 "foo" [] [Whitespace(" ")] + 1: EQ@9..11 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@11..13 + 0: JS_NUMBER_LITERAL@11..13 "10" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@13..34 + 0: JS_ASSIGNMENT_EXPRESSION@13..34 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@13..27 + 0: JS_IDENTIFIER_EXPRESSION@13..23 + 0: JS_REFERENCE_IDENTIFIER@13..23 + 0: IDENT@13..23 "arguments" [Newline("\n")] [] + 1: L_BRACK@23..24 "[" [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@24..25 + 0: JS_NUMBER_LITERAL@24..25 "1" [] [] + 3: R_BRACK@25..27 "]" [] [Whitespace(" ")] + 1: EQ@27..29 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@29..34 + 0: JS_STRING_LITERAL@29..34 "\"baz\"" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@34..64 + 0: JS_ASSIGNMENT_EXPRESSION@34..64 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@34..43 + 0: JS_IDENTIFIER_EXPRESSION@34..39 + 0: JS_REFERENCE_IDENTIFIER@34..39 + 0: IDENT@34..39 "eval" [Newline("\n")] [] + 1: L_BRACK@39..40 "[" [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@40..41 + 0: JS_NUMBER_LITERAL@40..41 "2" [] [] + 3: R_BRACK@41..43 "]" [] [Whitespace(" ")] + 1: EQ@43..45 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@45..64 + 0: JS_STRING_LITERAL@45..64 "\"Chungking Express\"" [] [] + 1: (empty) + 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assign_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js.snap new file mode 100644 index 000000000000..c6a07bd4312c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js.snap @@ -0,0 +1,484 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo += bar = b ??= 3; +foo -= bar; +(foo = bar); +[foo, bar] = baz; +[foo, bar = "default", ...rest] = baz; +[,,,foo,bar] = baz; +({ bar, baz } = {}); +({ bar: [baz = "baz"], foo = "foo", ...rest } = {}); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@0..4 "foo" [] [Whitespace(" ")], + }, + operator_token: PLUSEQ@4..7 "+=" [] [Whitespace(" ")], + right: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@7..11 "bar" [] [Whitespace(" ")], + }, + operator_token: EQ@11..13 "=" [] [Whitespace(" ")], + right: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@13..15 "b" [] [Whitespace(" ")], + }, + operator_token: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@19..20 "3" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@21..26 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: MINUSEQ@26..29 "-=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@29..32 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@33..35 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@35..39 "foo" [] [Whitespace(" ")], + }, + operator_token: EQ@39..41 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..44 "bar" [] [], + }, + }, + }, + r_paren_token: R_PAREN@44..45 ")" [] [], + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@46..48 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@48..51 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@51..53 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@53..56 "bar" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@56..58 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@58..60 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@60..63 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@64..66 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@66..69 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@69..71 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@71..75 "bar" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@75..77 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@77..86 "\"default\"" [] [], + }, + }, + }, + COMMA@86..88 "," [] [Whitespace(" ")], + JsArrayAssignmentPatternRestElement { + dotdotdot_token: DOT3@88..91 "..." [] [], + pattern: JsIdentifierAssignment { + name_token: IDENT@91..95 "rest" [] [], + }, + }, + ], + r_brack_token: R_BRACK@95..97 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@97..99 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@99..102 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@102..103 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@103..105 "[" [Newline("\n")] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayHole, + COMMA@105..106 "," [] [], + JsArrayHole, + COMMA@106..107 "," [] [], + JsArrayHole, + COMMA@107..108 "," [] [], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@108..111 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@111..112 "," [] [], + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@112..115 "bar" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@115..117 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@117..119 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@119..122 "baz" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@122..123 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@123..125 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@125..127 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@127..130 "bar" [] [], + }, + init: missing (optional), + }, + COMMA@130..132 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@132..136 "baz" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@136..138 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@138..140 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@140..141 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@141..142 "}" [] [], + }, + }, + r_paren_token: R_PAREN@142..143 ")" [] [], + }, + semicolon_token: SEMICOLON@143..144 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@144..146 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@146..148 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@148..151 "bar" [] [], + }, + colon_token: COLON@151..153 ":" [] [Whitespace(" ")], + pattern: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@153..154 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@154..158 "baz" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@158..160 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@160..165 "\"baz\"" [] [], + }, + }, + }, + ], + r_brack_token: R_BRACK@165..166 "]" [] [], + }, + init: missing (optional), + }, + COMMA@166..168 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@168..172 "foo" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@172..174 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@174..179 "\"foo\"" [] [], + }, + }, + }, + COMMA@179..181 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@181..184 "..." [] [], + target: JsIdentifierAssignment { + name_token: IDENT@184..189 "rest" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@189..191 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@191..193 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@193..194 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@194..195 "}" [] [], + }, + }, + r_paren_token: R_PAREN@195..196 ")" [] [], + }, + semicolon_token: SEMICOLON@196..197 ";" [] [], + }, + ], + eof_token: EOF@197..198 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..198 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..197 + 0: JS_EXPRESSION_STATEMENT@0..21 + 0: JS_ASSIGNMENT_EXPRESSION@0..20 + 0: JS_IDENTIFIER_ASSIGNMENT@0..4 + 0: IDENT@0..4 "foo" [] [Whitespace(" ")] + 1: PLUSEQ@4..7 "+=" [] [Whitespace(" ")] + 2: JS_ASSIGNMENT_EXPRESSION@7..20 + 0: JS_IDENTIFIER_ASSIGNMENT@7..11 + 0: IDENT@7..11 "bar" [] [Whitespace(" ")] + 1: EQ@11..13 "=" [] [Whitespace(" ")] + 2: JS_ASSIGNMENT_EXPRESSION@13..20 + 0: JS_IDENTIFIER_ASSIGNMENT@13..15 + 0: IDENT@13..15 "b" [] [Whitespace(" ")] + 1: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@19..20 + 0: JS_NUMBER_LITERAL@19..20 "3" [] [] + 1: SEMICOLON@20..21 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@21..33 + 0: JS_ASSIGNMENT_EXPRESSION@21..32 + 0: JS_IDENTIFIER_ASSIGNMENT@21..26 + 0: IDENT@21..26 "foo" [Newline("\n")] [Whitespace(" ")] + 1: MINUSEQ@26..29 "-=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@29..32 + 0: JS_REFERENCE_IDENTIFIER@29..32 + 0: IDENT@29..32 "bar" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..46 + 0: JS_PARENTHESIZED_EXPRESSION@33..45 + 0: L_PAREN@33..35 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@35..44 + 0: JS_IDENTIFIER_ASSIGNMENT@35..39 + 0: IDENT@35..39 "foo" [] [Whitespace(" ")] + 1: EQ@39..41 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@41..44 + 0: JS_REFERENCE_IDENTIFIER@41..44 + 0: IDENT@41..44 "bar" [] [] + 2: R_PAREN@44..45 ")" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@46..64 + 0: JS_ASSIGNMENT_EXPRESSION@46..63 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@46..58 + 0: L_BRACK@46..48 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@48..56 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@48..51 + 0: JS_IDENTIFIER_ASSIGNMENT@48..51 + 0: IDENT@48..51 "foo" [] [] + 1: (empty) + 1: COMMA@51..53 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@53..56 + 0: JS_IDENTIFIER_ASSIGNMENT@53..56 + 0: IDENT@53..56 "bar" [] [] + 1: (empty) + 2: R_BRACK@56..58 "]" [] [Whitespace(" ")] + 1: EQ@58..60 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@60..63 + 0: JS_REFERENCE_IDENTIFIER@60..63 + 0: IDENT@60..63 "baz" [] [] + 1: SEMICOLON@63..64 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@64..103 + 0: JS_ASSIGNMENT_EXPRESSION@64..102 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@64..97 + 0: L_BRACK@64..66 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@66..95 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@66..69 + 0: JS_IDENTIFIER_ASSIGNMENT@66..69 + 0: IDENT@66..69 "foo" [] [] + 1: (empty) + 1: COMMA@69..71 "," [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@71..86 + 0: JS_IDENTIFIER_ASSIGNMENT@71..75 + 0: IDENT@71..75 "bar" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@75..86 + 0: EQ@75..77 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@77..86 + 0: JS_STRING_LITERAL@77..86 "\"default\"" [] [] + 3: COMMA@86..88 "," [] [Whitespace(" ")] + 4: JS_ARRAY_ASSIGNMENT_PATTERN_REST_ELEMENT@88..95 + 0: DOT3@88..91 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@91..95 + 0: IDENT@91..95 "rest" [] [] + 2: R_BRACK@95..97 "]" [] [Whitespace(" ")] + 1: EQ@97..99 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@99..102 + 0: JS_REFERENCE_IDENTIFIER@99..102 + 0: IDENT@99..102 "baz" [] [] + 1: SEMICOLON@102..103 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@103..123 + 0: JS_ASSIGNMENT_EXPRESSION@103..122 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@103..117 + 0: L_BRACK@103..105 "[" [Newline("\n")] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@105..115 + 0: JS_ARRAY_HOLE@105..105 + 1: COMMA@105..106 "," [] [] + 2: JS_ARRAY_HOLE@106..106 + 3: COMMA@106..107 "," [] [] + 4: JS_ARRAY_HOLE@107..107 + 5: COMMA@107..108 "," [] [] + 6: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@108..111 + 0: JS_IDENTIFIER_ASSIGNMENT@108..111 + 0: IDENT@108..111 "foo" [] [] + 1: (empty) + 7: COMMA@111..112 "," [] [] + 8: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@112..115 + 0: JS_IDENTIFIER_ASSIGNMENT@112..115 + 0: IDENT@112..115 "bar" [] [] + 1: (empty) + 2: R_BRACK@115..117 "]" [] [Whitespace(" ")] + 1: EQ@117..119 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@119..122 + 0: JS_REFERENCE_IDENTIFIER@119..122 + 0: IDENT@119..122 "baz" [] [] + 1: SEMICOLON@122..123 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@123..144 + 0: JS_PARENTHESIZED_EXPRESSION@123..143 + 0: L_PAREN@123..125 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@125..142 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@125..138 + 0: L_CURLY@125..127 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@127..136 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@127..130 + 0: JS_IDENTIFIER_ASSIGNMENT@127..130 + 0: IDENT@127..130 "bar" [] [] + 1: (empty) + 1: COMMA@130..132 "," [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@132..136 + 0: JS_IDENTIFIER_ASSIGNMENT@132..136 + 0: IDENT@132..136 "baz" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@136..138 "}" [] [Whitespace(" ")] + 1: EQ@138..140 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@140..142 + 0: L_CURLY@140..141 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@141..141 + 2: R_CURLY@141..142 "}" [] [] + 2: R_PAREN@142..143 ")" [] [] + 1: SEMICOLON@143..144 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@144..197 + 0: JS_PARENTHESIZED_EXPRESSION@144..196 + 0: L_PAREN@144..146 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@146..195 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@146..191 + 0: L_CURLY@146..148 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@148..189 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@148..166 + 0: JS_LITERAL_MEMBER_NAME@148..151 + 0: IDENT@148..151 "bar" [] [] + 1: COLON@151..153 ":" [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN@153..166 + 0: L_BRACK@153..154 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@154..165 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@154..165 + 0: JS_IDENTIFIER_ASSIGNMENT@154..158 + 0: IDENT@154..158 "baz" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@158..165 + 0: EQ@158..160 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@160..165 + 0: JS_STRING_LITERAL@160..165 "\"baz\"" [] [] + 2: R_BRACK@165..166 "]" [] [] + 3: (empty) + 1: COMMA@166..168 "," [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@168..179 + 0: JS_IDENTIFIER_ASSIGNMENT@168..172 + 0: IDENT@168..172 "foo" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@172..179 + 0: EQ@172..174 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@174..179 + 0: JS_STRING_LITERAL@174..179 "\"foo\"" [] [] + 3: COMMA@179..181 "," [] [Whitespace(" ")] + 4: JS_OBJECT_ASSIGNMENT_PATTERN_REST@181..189 + 0: DOT3@181..184 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@184..189 + 0: IDENT@184..189 "rest" [] [Whitespace(" ")] + 2: R_CURLY@189..191 "}" [] [Whitespace(" ")] + 1: EQ@191..193 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@193..195 + 0: L_CURLY@193..194 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@194..194 + 2: R_CURLY@194..195 "}" [] [] + 2: R_PAREN@195..196 ")" [] [] + 1: SEMICOLON@196..197 ";" [] [] + 4: EOF@197..198 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.js b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap new file mode 100644 index 000000000000..280be59d60f8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap @@ -0,0 +1,131 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({ arrow = () => {} } of [{}]) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForOfStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@5..7 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@7..13 "arrow" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@13..15 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@15..16 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@21..22 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@22..24 "}" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], + }, + of_token: OF_KW@26..29 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@29..30 "[" [] [], + elements: JsArrayElementList [ + JsObjectExpression { + l_curly_token: L_CURLY@30..31 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + ], + r_brack_token: R_BRACK@32..33 "]" [] [], + }, + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@35..36 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + }, + ], + eof_token: EOF@37..38 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..38 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..37 + 0: JS_FOR_OF_STATEMENT@0..37 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@4..5 "(" [] [] + 3: JS_OBJECT_ASSIGNMENT_PATTERN@5..26 + 0: L_CURLY@5..7 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@7..24 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@7..24 + 0: JS_IDENTIFIER_ASSIGNMENT@7..13 + 0: IDENT@7..13 "arrow" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@13..24 + 0: EQ@13..15 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@15..24 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@15..18 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_PARAMETER_LIST@16..16 + 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@21..24 + 0: L_CURLY@21..22 "{" [] [] + 1: JS_DIRECTIVE_LIST@22..22 + 2: JS_STATEMENT_LIST@22..22 + 3: R_CURLY@22..24 "}" [] [Whitespace(" ")] + 2: R_CURLY@24..26 "}" [] [Whitespace(" ")] + 4: OF_KW@26..29 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@29..33 + 0: L_BRACK@29..30 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@30..32 + 0: JS_OBJECT_EXPRESSION@30..32 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@31..31 + 2: R_CURLY@31..32 "}" [] [] + 2: R_BRACK@32..33 "]" [] [] + 6: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@35..37 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_STATEMENT_LIST@36..36 + 2: R_CURLY@36..37 "}" [] [] + 4: EOF@37..38 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js.snap new file mode 100644 index 000000000000..af3e791ca8c9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js.snap @@ -0,0 +1,407 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo += bar = b ??= 3; +a.foo -= bar; +(foo = bar); +(((foo))) = bar; +a["test"] = bar; +a.call().chain().member = x; +++count === 3 +a['b'] = c[d] = "test" + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@0..4 "foo" [] [Whitespace(" ")], + }, + operator_token: PLUSEQ@4..7 "+=" [] [Whitespace(" ")], + right: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@7..11 "bar" [] [Whitespace(" ")], + }, + operator_token: EQ@11..13 "=" [] [Whitespace(" ")], + right: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@13..15 "b" [] [Whitespace(" ")], + }, + operator_token: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@19..20 "3" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..23 "a" [Newline("\n")] [], + }, + }, + dot_token: DOT@23..24 "." [] [], + member: JsName { + value_token: IDENT@24..28 "foo" [] [Whitespace(" ")], + }, + }, + operator_token: MINUSEQ@28..31 "-=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..34 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@35..37 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@37..41 "foo" [] [Whitespace(" ")], + }, + operator_token: EQ@41..43 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@43..46 "bar" [] [], + }, + }, + }, + r_paren_token: R_PAREN@46..47 ")" [] [], + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@48..50 "(" [Newline("\n")] [], + assignment: JsParenthesizedAssignment { + l_paren_token: L_PAREN@50..51 "(" [] [], + assignment: JsParenthesizedAssignment { + l_paren_token: L_PAREN@51..52 "(" [] [], + assignment: JsIdentifierAssignment { + name_token: IDENT@52..55 "foo" [] [], + }, + r_paren_token: R_PAREN@55..56 ")" [] [], + }, + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@59..61 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@61..64 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@64..65 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@65..67 "a" [Newline("\n")] [], + }, + }, + l_brack_token: L_BRACK@67..68 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@68..74 "\"test\"" [] [], + }, + r_brack_token: R_BRACK@74..76 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@76..78 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..81 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@81..82 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@82..84 "a" [Newline("\n")] [], + }, + }, + operator_token: DOT@84..85 "." [] [], + member: JsName { + value_token: IDENT@85..89 "call" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@89..90 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@90..91 ")" [] [], + }, + }, + operator_token: DOT@91..92 "." [] [], + member: JsName { + value_token: IDENT@92..97 "chain" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@97..98 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@98..99 ")" [] [], + }, + }, + dot_token: DOT@99..100 "." [] [], + member: JsName { + value_token: IDENT@100..107 "member" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@107..109 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@109..110 "x" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@110..111 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsPreUpdateExpression { + operator_token: PLUS2@111..114 "++" [Newline("\n")] [], + operand: JsIdentifierAssignment { + name_token: IDENT@114..120 "count" [] [Whitespace(" ")], + }, + }, + operator_token: EQ3@120..124 "===" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@124..125 "3" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@125..127 "a" [Newline("\n")] [], + }, + }, + l_brack_token: L_BRACK@127..128 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@128..131 "'b'" [] [], + }, + r_brack_token: R_BRACK@131..133 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@133..135 "=" [] [Whitespace(" ")], + right: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@135..136 "c" [] [], + }, + }, + l_brack_token: L_BRACK@136..137 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..138 "d" [] [], + }, + }, + r_brack_token: R_BRACK@138..140 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@140..142 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@142..148 "\"test\"" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@148..149 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..149 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..148 + 0: JS_EXPRESSION_STATEMENT@0..21 + 0: JS_ASSIGNMENT_EXPRESSION@0..20 + 0: JS_IDENTIFIER_ASSIGNMENT@0..4 + 0: IDENT@0..4 "foo" [] [Whitespace(" ")] + 1: PLUSEQ@4..7 "+=" [] [Whitespace(" ")] + 2: JS_ASSIGNMENT_EXPRESSION@7..20 + 0: JS_IDENTIFIER_ASSIGNMENT@7..11 + 0: IDENT@7..11 "bar" [] [Whitespace(" ")] + 1: EQ@11..13 "=" [] [Whitespace(" ")] + 2: JS_ASSIGNMENT_EXPRESSION@13..20 + 0: JS_IDENTIFIER_ASSIGNMENT@13..15 + 0: IDENT@13..15 "b" [] [Whitespace(" ")] + 1: QUESTION2EQ@15..19 "??=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@19..20 + 0: JS_NUMBER_LITERAL@19..20 "3" [] [] + 1: SEMICOLON@20..21 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@21..35 + 0: JS_ASSIGNMENT_EXPRESSION@21..34 + 0: JS_STATIC_MEMBER_ASSIGNMENT@21..28 + 0: JS_IDENTIFIER_EXPRESSION@21..23 + 0: JS_REFERENCE_IDENTIFIER@21..23 + 0: IDENT@21..23 "a" [Newline("\n")] [] + 1: DOT@23..24 "." [] [] + 2: JS_NAME@24..28 + 0: IDENT@24..28 "foo" [] [Whitespace(" ")] + 1: MINUSEQ@28..31 "-=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@31..34 + 0: JS_REFERENCE_IDENTIFIER@31..34 + 0: IDENT@31..34 "bar" [] [] + 1: SEMICOLON@34..35 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@35..48 + 0: JS_PARENTHESIZED_EXPRESSION@35..47 + 0: L_PAREN@35..37 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@37..46 + 0: JS_IDENTIFIER_ASSIGNMENT@37..41 + 0: IDENT@37..41 "foo" [] [Whitespace(" ")] + 1: EQ@41..43 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@43..46 + 0: JS_REFERENCE_IDENTIFIER@43..46 + 0: IDENT@43..46 "bar" [] [] + 2: R_PAREN@46..47 ")" [] [] + 1: SEMICOLON@47..48 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@48..65 + 0: JS_ASSIGNMENT_EXPRESSION@48..64 + 0: JS_PARENTHESIZED_ASSIGNMENT@48..59 + 0: L_PAREN@48..50 "(" [Newline("\n")] [] + 1: JS_PARENTHESIZED_ASSIGNMENT@50..57 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_PARENTHESIZED_ASSIGNMENT@51..56 + 0: L_PAREN@51..52 "(" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@52..55 + 0: IDENT@52..55 "foo" [] [] + 2: R_PAREN@55..56 ")" [] [] + 2: R_PAREN@56..57 ")" [] [] + 2: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 1: EQ@59..61 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@61..64 + 0: JS_REFERENCE_IDENTIFIER@61..64 + 0: IDENT@61..64 "bar" [] [] + 1: SEMICOLON@64..65 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@65..82 + 0: JS_ASSIGNMENT_EXPRESSION@65..81 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@65..76 + 0: JS_IDENTIFIER_EXPRESSION@65..67 + 0: JS_REFERENCE_IDENTIFIER@65..67 + 0: IDENT@65..67 "a" [Newline("\n")] [] + 1: L_BRACK@67..68 "[" [] [] + 2: JS_STRING_LITERAL_EXPRESSION@68..74 + 0: JS_STRING_LITERAL@68..74 "\"test\"" [] [] + 3: R_BRACK@74..76 "]" [] [Whitespace(" ")] + 1: EQ@76..78 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@78..81 + 0: JS_REFERENCE_IDENTIFIER@78..81 + 0: IDENT@78..81 "bar" [] [] + 1: SEMICOLON@81..82 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@82..111 + 0: JS_ASSIGNMENT_EXPRESSION@82..110 + 0: JS_STATIC_MEMBER_ASSIGNMENT@82..107 + 0: JS_CALL_EXPRESSION@82..99 + 0: JS_STATIC_MEMBER_EXPRESSION@82..97 + 0: JS_CALL_EXPRESSION@82..91 + 0: JS_STATIC_MEMBER_EXPRESSION@82..89 + 0: JS_IDENTIFIER_EXPRESSION@82..84 + 0: JS_REFERENCE_IDENTIFIER@82..84 + 0: IDENT@82..84 "a" [Newline("\n")] [] + 1: DOT@84..85 "." [] [] + 2: JS_NAME@85..89 + 0: IDENT@85..89 "call" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@89..91 + 0: L_PAREN@89..90 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@90..90 + 2: R_PAREN@90..91 ")" [] [] + 1: DOT@91..92 "." [] [] + 2: JS_NAME@92..97 + 0: IDENT@92..97 "chain" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@97..99 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@98..98 + 2: R_PAREN@98..99 ")" [] [] + 1: DOT@99..100 "." [] [] + 2: JS_NAME@100..107 + 0: IDENT@100..107 "member" [] [Whitespace(" ")] + 1: EQ@107..109 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@109..110 + 0: JS_REFERENCE_IDENTIFIER@109..110 + 0: IDENT@109..110 "x" [] [] + 1: SEMICOLON@110..111 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@111..125 + 0: JS_BINARY_EXPRESSION@111..125 + 0: JS_PRE_UPDATE_EXPRESSION@111..120 + 0: PLUS2@111..114 "++" [Newline("\n")] [] + 1: JS_IDENTIFIER_ASSIGNMENT@114..120 + 0: IDENT@114..120 "count" [] [Whitespace(" ")] + 1: EQ3@120..124 "===" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@124..125 + 0: JS_NUMBER_LITERAL@124..125 "3" [] [] + 1: (empty) + 7: JS_EXPRESSION_STATEMENT@125..148 + 0: JS_ASSIGNMENT_EXPRESSION@125..148 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@125..133 + 0: JS_IDENTIFIER_EXPRESSION@125..127 + 0: JS_REFERENCE_IDENTIFIER@125..127 + 0: IDENT@125..127 "a" [Newline("\n")] [] + 1: L_BRACK@127..128 "[" [] [] + 2: JS_STRING_LITERAL_EXPRESSION@128..131 + 0: JS_STRING_LITERAL@128..131 "'b'" [] [] + 3: R_BRACK@131..133 "]" [] [Whitespace(" ")] + 1: EQ@133..135 "=" [] [Whitespace(" ")] + 2: JS_ASSIGNMENT_EXPRESSION@135..148 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@135..140 + 0: JS_IDENTIFIER_EXPRESSION@135..136 + 0: JS_REFERENCE_IDENTIFIER@135..136 + 0: IDENT@135..136 "c" [] [] + 1: L_BRACK@136..137 "[" [] [] + 2: JS_IDENTIFIER_EXPRESSION@137..138 + 0: JS_REFERENCE_IDENTIFIER@137..138 + 0: IDENT@137..138 "d" [] [] + 3: R_BRACK@138..140 "]" [] [Whitespace(" ")] + 1: EQ@140..142 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@142..148 + 0: JS_STRING_LITERAL@142..148 "\"test\"" [] [] + 1: (empty) + 4: EOF@148..149 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js.snap new file mode 100644 index 000000000000..2d6f502479c6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js.snap @@ -0,0 +1,257 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async foo => {} +let b = async (bar) => {} +async (foo, bar, ...baz) => foo + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@8..14 "async" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@14..18 "foo" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@21..22 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@28..30 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@30..32 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@32..38 "async" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@39..42 "bar" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@47..48 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@49..56 "async" [Newline("\n")] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@56..57 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@57..60 "foo" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@62..65 "bar" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@65..67 "," [] [Whitespace(" ")], + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@67..70 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@70..73 "baz" [] [], + }, + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@73..75 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@75..78 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..81 "foo" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@81..82 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..82 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..81 + 0: JS_VARIABLE_STATEMENT@0..23 + 0: JS_VARIABLE_DECLARATION@0..23 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..23 + 0: JS_VARIABLE_DECLARATOR@4..23 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..23 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@8..23 + 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_BINDING@14..18 + 0: IDENT@14..18 "foo" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@18..21 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@21..23 + 0: L_CURLY@21..22 "{" [] [] + 1: JS_DIRECTIVE_LIST@22..22 + 2: JS_STATEMENT_LIST@22..22 + 3: R_CURLY@22..23 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@23..49 + 0: JS_VARIABLE_DECLARATION@23..49 + 0: (empty) + 1: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@28..49 + 0: JS_VARIABLE_DECLARATOR@28..49 + 0: JS_IDENTIFIER_BINDING@28..30 + 0: IDENT@28..30 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@30..49 + 0: EQ@30..32 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@32..49 + 0: ASYNC_KW@32..38 "async" [] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@38..44 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..42 + 0: JS_FORMAL_PARAMETER@39..42 + 0: JS_DECORATOR_LIST@39..39 + 1: JS_IDENTIFIER_BINDING@39..42 + 0: IDENT@39..42 "bar" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@47..49 + 0: L_CURLY@47..48 "{" [] [] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..48 + 3: R_CURLY@48..49 "}" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@49..81 + 0: JS_ARROW_FUNCTION_EXPRESSION@49..81 + 0: ASYNC_KW@49..56 "async" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@56..75 + 0: L_PAREN@56..57 "(" [] [] + 1: JS_PARAMETER_LIST@57..73 + 0: JS_FORMAL_PARAMETER@57..60 + 0: JS_DECORATOR_LIST@57..57 + 1: JS_IDENTIFIER_BINDING@57..60 + 0: IDENT@57..60 "foo" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@60..62 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@62..65 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_IDENTIFIER_BINDING@62..65 + 0: IDENT@62..65 "bar" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@65..67 "," [] [Whitespace(" ")] + 4: JS_REST_PARAMETER@67..73 + 0: JS_DECORATOR_LIST@67..67 + 1: DOT3@67..70 "..." [] [] + 2: JS_IDENTIFIER_BINDING@70..73 + 0: IDENT@70..73 "baz" [] [] + 3: (empty) + 2: R_PAREN@73..75 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@75..78 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@78..81 + 0: JS_REFERENCE_IDENTIFIER@78..81 + 0: IDENT@78..81 "foo" [] [] + 1: (empty) + 4: EOF@81..82 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js.snap new file mode 100644 index 000000000000..d38647ec8d3d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js.snap @@ -0,0 +1,84 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async: for(a of b) continue async; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..5 "async" [] [], + }, + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + body: JsForOfStatement { + for_token: FOR_KW@7..10 "for" [] [], + await_token: missing (optional), + l_paren_token: L_PAREN@10..11 "(" [] [], + initializer: JsIdentifierAssignment { + name_token: IDENT@11..13 "a" [] [Whitespace(" ")], + }, + of_token: OF_KW@13..16 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "b" [] [], + }, + }, + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + body: JsContinueStatement { + continue_token: CONTINUE_KW@19..28 "continue" [] [Whitespace(" ")], + label: JsLabel { + value_token: IDENT@28..33 "async" [] [], + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + }, + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_LABELED_STATEMENT@0..34 + 0: JS_LABEL@0..5 + 0: IDENT@0..5 "async" [] [] + 1: COLON@5..7 ":" [] [Whitespace(" ")] + 2: JS_FOR_OF_STATEMENT@7..34 + 0: FOR_KW@7..10 "for" [] [] + 1: (empty) + 2: L_PAREN@10..11 "(" [] [] + 3: JS_IDENTIFIER_ASSIGNMENT@11..13 + 0: IDENT@11..13 "a" [] [Whitespace(" ")] + 4: OF_KW@13..16 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "b" [] [] + 6: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 7: JS_CONTINUE_STATEMENT@19..34 + 0: CONTINUE_KW@19..28 "continue" [] [Whitespace(" ")] + 1: JS_LABEL@28..33 + 0: IDENT@28..33 "async" [] [] + 2: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_function_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_function_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js.snap new file mode 100644 index 000000000000..2ce88bbff2f2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js.snap @@ -0,0 +1,170 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async function() {}; +let b = async function foo() {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: ASYNC_KW@8..14 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@14..22 "function" [] [], + star_token: missing (optional), + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..35 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@35..37 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: ASYNC_KW@37..43 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@43..52 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@52..55 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@55..56 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + ], + eof_token: EOF@61..62 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..62 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..61 + 0: JS_VARIABLE_STATEMENT@0..28 + 0: JS_VARIABLE_DECLARATION@0..27 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..27 + 0: JS_VARIABLE_DECLARATOR@4..27 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..27 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@8..27 + 0: ASYNC_KW@8..14 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@14..22 "function" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@25..27 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..26 + 3: R_CURLY@26..27 "}" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_VARIABLE_STATEMENT@28..61 + 0: JS_VARIABLE_DECLARATION@28..60 + 0: (empty) + 1: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@33..60 + 0: JS_VARIABLE_DECLARATOR@33..60 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@35..60 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@37..60 + 0: ASYNC_KW@37..43 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@43..52 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@52..55 + 0: IDENT@52..55 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@55..58 + 0: L_PAREN@55..56 "(" [] [] + 1: JS_PARAMETER_LIST@56..56 + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@58..60 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..60 "}" [] [] + 1: SEMICOLON@60..61 ";" [] [] + 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_ident.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_ident.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js.snap new file mode 100644 index 000000000000..d551ada4318d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js.snap @@ -0,0 +1,74 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..13 "async" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + ], + eof_token: EOF@14..15 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..15 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..14 + 0: JS_VARIABLE_STATEMENT@0..14 + 0: JS_VARIABLE_DECLARATION@0..13 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..13 + 0: JS_VARIABLE_DECLARATOR@4..13 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..13 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@8..13 + 0: JS_REFERENCE_IDENTIFIER@8..13 + 0: IDENT@8..13 "async" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 4: EOF@14..15 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js.snap new file mode 100644 index 000000000000..9f9d19c1a36a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js.snap @@ -0,0 +1,146 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + async foo() {} + async *foo() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@11..19 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@19..22 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@27..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: STAR@35..36 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@36..39 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@39..40 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@42..43 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@44..46 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@46..47 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..47 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..46 + 0: JS_CLASS_DECLARATION@0..46 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..44 + 0: JS_METHOD_CLASS_MEMBER@11..27 + 0: JS_METHOD_MODIFIER_LIST@11..11 + 1: ASYNC_KW@11..19 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@19..22 + 0: IDENT@19..22 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@25..27 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..26 + 3: R_CURLY@26..27 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@27..44 + 0: JS_METHOD_MODIFIER_LIST@27..27 + 1: ASYNC_KW@27..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: STAR@35..36 "*" [] [] + 3: JS_LITERAL_MEMBER_NAME@36..39 + 0: IDENT@36..39 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@39..42 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_PARAMETER_LIST@40..40 + 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@42..44 + 0: L_CURLY@42..43 "{" [] [] + 1: JS_DIRECTIVE_LIST@43..43 + 2: JS_STATEMENT_LIST@43..43 + 3: R_CURLY@43..44 "}" [] [] + 9: R_CURLY@44..46 "}" [Newline("\n")] [] + 4: EOF@46..47 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/await_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/await_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js.snap new file mode 100644 index 000000000000..28c0a9d8648d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js.snap @@ -0,0 +1,276 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async function test() { + await inner(); + await (inner()) + await inner(); +} +async function inner() { + return 4; +} +await test(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..6 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@15..19 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@19..20 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@23..32 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..37 "inner" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@37..38 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@38..39 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@39..40 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsAwaitExpression { + await_token: AWAIT_KW@40..49 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@49..50 "(" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@50..55 "inner" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@55..56 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@59..61 "+" [] [Whitespace(" ")], + right: JsAwaitExpression { + await_token: AWAIT_KW@61..67 "await" [] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@67..72 "inner" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@72..73 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@73..74 ")" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@74..75 ";" [] [], + }, + ], + r_curly_token: R_CURLY@75..77 "}" [Newline("\n")] [], + }, + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@93..98 "inner" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@98..99 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@101..102 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@102..112 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@112..113 "4" [] [], + }, + semicolon_token: SEMICOLON@113..114 ";" [] [], + }, + ], + r_curly_token: R_CURLY@114..116 "}" [Newline("\n")] [], + }, + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@123..127 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@127..128 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@128..129 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@129..130 ";" [] [], + }, + ], + eof_token: EOF@130..131 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..131 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..130 + 0: JS_FUNCTION_DECLARATION@0..77 + 0: ASYNC_KW@0..6 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@6..15 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@15..19 + 0: IDENT@15..19 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@19..22 + 0: L_PAREN@19..20 "(" [] [] + 1: JS_PARAMETER_LIST@20..20 + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@22..77 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..75 + 0: JS_EXPRESSION_STATEMENT@23..40 + 0: JS_AWAIT_EXPRESSION@23..39 + 0: AWAIT_KW@23..32 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@32..39 + 0: JS_IDENTIFIER_EXPRESSION@32..37 + 0: JS_REFERENCE_IDENTIFIER@32..37 + 0: IDENT@32..37 "inner" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@37..39 + 0: L_PAREN@37..38 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@38..38 + 2: R_PAREN@38..39 ")" [] [] + 1: SEMICOLON@39..40 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@40..75 + 0: JS_BINARY_EXPRESSION@40..74 + 0: JS_AWAIT_EXPRESSION@40..59 + 0: AWAIT_KW@40..49 "await" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@49..59 + 0: L_PAREN@49..50 "(" [] [] + 1: JS_CALL_EXPRESSION@50..57 + 0: JS_IDENTIFIER_EXPRESSION@50..55 + 0: JS_REFERENCE_IDENTIFIER@50..55 + 0: IDENT@50..55 "inner" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@55..57 + 0: L_PAREN@55..56 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@56..56 + 2: R_PAREN@56..57 ")" [] [] + 2: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 1: PLUS@59..61 "+" [] [Whitespace(" ")] + 2: JS_AWAIT_EXPRESSION@61..74 + 0: AWAIT_KW@61..67 "await" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@67..74 + 0: JS_IDENTIFIER_EXPRESSION@67..72 + 0: JS_REFERENCE_IDENTIFIER@67..72 + 0: IDENT@67..72 "inner" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@72..74 + 0: L_PAREN@72..73 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@73..73 + 2: R_PAREN@73..74 ")" [] [] + 1: SEMICOLON@74..75 ";" [] [] + 3: R_CURLY@75..77 "}" [Newline("\n")] [] + 1: JS_FUNCTION_DECLARATION@77..116 + 0: ASYNC_KW@77..84 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@84..93 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@93..98 + 0: IDENT@93..98 "inner" [] [] + 4: (empty) + 5: JS_PARAMETERS@98..101 + 0: L_PAREN@98..99 "(" [] [] + 1: JS_PARAMETER_LIST@99..99 + 2: R_PAREN@99..101 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@101..116 + 0: L_CURLY@101..102 "{" [] [] + 1: JS_DIRECTIVE_LIST@102..102 + 2: JS_STATEMENT_LIST@102..114 + 0: JS_RETURN_STATEMENT@102..114 + 0: RETURN_KW@102..112 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@112..113 + 0: JS_NUMBER_LITERAL@112..113 "4" [] [] + 2: SEMICOLON@113..114 ";" [] [] + 3: R_CURLY@114..116 "}" [Newline("\n")] [] + 2: JS_EXPRESSION_STATEMENT@116..130 + 0: JS_AWAIT_EXPRESSION@116..129 + 0: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@123..129 + 0: JS_IDENTIFIER_EXPRESSION@123..127 + 0: JS_REFERENCE_IDENTIFIER@123..127 + 0: IDENT@123..127 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@127..129 + 0: L_PAREN@127..128 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@128..128 + 2: R_PAREN@128..129 ")" [] [] + 1: SEMICOLON@129..130 ";" [] [] + 4: EOF@130..131 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts.snap new file mode 100644 index 000000000000..224be29c8a21 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts.snap @@ -0,0 +1,76 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const await: any; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..19 "await" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@19..21 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@21..24 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..25 + 0: TS_DECLARE_STATEMENT@0..25 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@8..25 + 0: JS_VARIABLE_DECLARATION@8..24 + 0: (empty) + 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..24 + 0: JS_VARIABLE_DECLARATOR@14..24 + 0: JS_IDENTIFIER_BINDING@14..19 + 0: IDENT@14..19 "await" [] [] + 1: TS_TYPE_ANNOTATION@19..24 + 0: COLON@19..21 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@21..24 + 0: ANY_KW@21..24 "any" [] [] + 2: (empty) + 1: SEMICOLON@24..25 ";" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/binary_expressions.js b/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/binary_expressions.js rename to crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js.snap new file mode 100644 index 000000000000..6e5e8d8ae140 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js.snap @@ -0,0 +1,539 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +5 * 5 +6 ** 6 ** 7 +1 + 2 * 3 +(1 + 2) * 3 +1 / 2 +74 in foo +foo instanceof Array +foo ?? bar +a >> b +a >>> b +1 + 1 + 1 + 1 +5 + 6 - 1 * 2 / 1 ** 6 +class Test { #name; test() { true && #name in {} } } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..2 "5" [] [Whitespace(" ")], + }, + operator_token: STAR@2..4 "*" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@4..5 "5" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@5..8 "6" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: STAR2@8..11 "**" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@11..13 "6" [] [Whitespace(" ")], + }, + operator_token: STAR2@13..16 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@16..17 "7" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@17..20 "1" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: PLUS@20..22 "+" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@22..24 "2" [] [Whitespace(" ")], + }, + operator_token: STAR@24..26 "*" [] [Whitespace(" ")], + right: JsCallExpression { + callee: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@26..27 "3" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@27..29 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@29..31 "1" [] [Whitespace(" ")], + }, + operator_token: PLUS@31..33 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@33..34 "2" [] [], + }, + }, + ], + r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], + }, + }, + }, + operator_token: STAR@36..38 "*" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@38..39 "3" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@39..42 "1" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: SLASH@42..44 "/" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@44..45 "2" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsInExpression { + property: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@45..49 "74" [Newline("\n")] [Whitespace(" ")], + }, + in_token: IN_KW@49..52 "in" [] [Whitespace(" ")], + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@52..55 "foo" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsInstanceofExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..60 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + instanceof_token: INSTANCEOF_KW@60..71 "instanceof" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@71..76 "Array" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@76..81 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: QUESTION2@81..84 "??" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..87 "bar" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@87..90 "a" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: SHR@90..93 ">>" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@93..94 "b" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@94..97 "a" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: USHR@97..101 ">>>" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@101..102 "b" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@102..105 "1" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: PLUS@105..107 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@107..109 "1" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@109..111 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@111..113 "1" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@113..115 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@115..116 "1" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@116..119 "5" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: PLUS@119..121 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@121..123 "6" [] [Whitespace(" ")], + }, + }, + operator_token: MINUS@123..125 "-" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@125..127 "1" [] [Whitespace(" ")], + }, + operator_token: STAR@127..129 "*" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@129..131 "2" [] [Whitespace(" ")], + }, + }, + operator_token: SLASH@131..133 "/" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@133..135 "1" [] [Whitespace(" ")], + }, + operator_token: STAR2@135..138 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@138..139 "6" [] [], + }, + }, + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@146..151 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@151..153 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@153..154 "#" [] [], + id_token: IDENT@154..158 "name" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@158..160 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@160..164 "test" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@164..165 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@165..167 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@167..169 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsBooleanLiteralExpression { + value_token: TRUE_KW@169..174 "true" [] [Whitespace(" ")], + }, + operator_token: AMP2@174..177 "&&" [] [Whitespace(" ")], + right: JsInExpression { + property: JsPrivateName { + hash_token: HASH@177..178 "#" [] [], + value_token: IDENT@178..183 "name" [] [Whitespace(" ")], + }, + in_token: IN_KW@183..186 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@186..187 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@187..189 "}" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@189..191 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@191..192 "}" [] [], + }, + ], + eof_token: EOF@192..193 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..193 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..192 + 0: JS_EXPRESSION_STATEMENT@0..5 + 0: JS_BINARY_EXPRESSION@0..5 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 + 0: JS_NUMBER_LITERAL@0..2 "5" [] [Whitespace(" ")] + 1: STAR@2..4 "*" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@4..5 + 0: JS_NUMBER_LITERAL@4..5 "5" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@5..17 + 0: JS_BINARY_EXPRESSION@5..17 + 0: JS_NUMBER_LITERAL_EXPRESSION@5..8 + 0: JS_NUMBER_LITERAL@5..8 "6" [Newline("\n")] [Whitespace(" ")] + 1: STAR2@8..11 "**" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@11..17 + 0: JS_NUMBER_LITERAL_EXPRESSION@11..13 + 0: JS_NUMBER_LITERAL@11..13 "6" [] [Whitespace(" ")] + 1: STAR2@13..16 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@16..17 + 0: JS_NUMBER_LITERAL@16..17 "7" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@17..39 + 0: JS_BINARY_EXPRESSION@17..39 + 0: JS_NUMBER_LITERAL_EXPRESSION@17..20 + 0: JS_NUMBER_LITERAL@17..20 "1" [Newline("\n")] [Whitespace(" ")] + 1: PLUS@20..22 "+" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@22..39 + 0: JS_BINARY_EXPRESSION@22..36 + 0: JS_NUMBER_LITERAL_EXPRESSION@22..24 + 0: JS_NUMBER_LITERAL@22..24 "2" [] [Whitespace(" ")] + 1: STAR@24..26 "*" [] [Whitespace(" ")] + 2: JS_CALL_EXPRESSION@26..36 + 0: JS_NUMBER_LITERAL_EXPRESSION@26..27 + 0: JS_NUMBER_LITERAL@26..27 "3" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@27..36 + 0: L_PAREN@27..29 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@29..34 + 0: JS_BINARY_EXPRESSION@29..34 + 0: JS_NUMBER_LITERAL_EXPRESSION@29..31 + 0: JS_NUMBER_LITERAL@29..31 "1" [] [Whitespace(" ")] + 1: PLUS@31..33 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@33..34 + 0: JS_NUMBER_LITERAL@33..34 "2" [] [] + 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] + 1: STAR@36..38 "*" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@38..39 + 0: JS_NUMBER_LITERAL@38..39 "3" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@39..45 + 0: JS_BINARY_EXPRESSION@39..45 + 0: JS_NUMBER_LITERAL_EXPRESSION@39..42 + 0: JS_NUMBER_LITERAL@39..42 "1" [Newline("\n")] [Whitespace(" ")] + 1: SLASH@42..44 "/" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@44..45 + 0: JS_NUMBER_LITERAL@44..45 "2" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@45..55 + 0: JS_IN_EXPRESSION@45..55 + 0: JS_NUMBER_LITERAL_EXPRESSION@45..49 + 0: JS_NUMBER_LITERAL@45..49 "74" [Newline("\n")] [Whitespace(" ")] + 1: IN_KW@49..52 "in" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@52..55 + 0: JS_REFERENCE_IDENTIFIER@52..55 + 0: IDENT@52..55 "foo" [] [] + 1: (empty) + 5: JS_EXPRESSION_STATEMENT@55..76 + 0: JS_INSTANCEOF_EXPRESSION@55..76 + 0: JS_IDENTIFIER_EXPRESSION@55..60 + 0: JS_REFERENCE_IDENTIFIER@55..60 + 0: IDENT@55..60 "foo" [Newline("\n")] [Whitespace(" ")] + 1: INSTANCEOF_KW@60..71 "instanceof" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@71..76 + 0: JS_REFERENCE_IDENTIFIER@71..76 + 0: IDENT@71..76 "Array" [] [] + 1: (empty) + 6: JS_EXPRESSION_STATEMENT@76..87 + 0: JS_LOGICAL_EXPRESSION@76..87 + 0: JS_IDENTIFIER_EXPRESSION@76..81 + 0: JS_REFERENCE_IDENTIFIER@76..81 + 0: IDENT@76..81 "foo" [Newline("\n")] [Whitespace(" ")] + 1: QUESTION2@81..84 "??" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@84..87 + 0: JS_REFERENCE_IDENTIFIER@84..87 + 0: IDENT@84..87 "bar" [] [] + 1: (empty) + 7: JS_EXPRESSION_STATEMENT@87..94 + 0: JS_BINARY_EXPRESSION@87..94 + 0: JS_IDENTIFIER_EXPRESSION@87..90 + 0: JS_REFERENCE_IDENTIFIER@87..90 + 0: IDENT@87..90 "a" [Newline("\n")] [Whitespace(" ")] + 1: SHR@90..93 ">>" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@93..94 + 0: JS_REFERENCE_IDENTIFIER@93..94 + 0: IDENT@93..94 "b" [] [] + 1: (empty) + 8: JS_EXPRESSION_STATEMENT@94..102 + 0: JS_BINARY_EXPRESSION@94..102 + 0: JS_IDENTIFIER_EXPRESSION@94..97 + 0: JS_REFERENCE_IDENTIFIER@94..97 + 0: IDENT@94..97 "a" [Newline("\n")] [Whitespace(" ")] + 1: USHR@97..101 ">>>" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@101..102 + 0: JS_REFERENCE_IDENTIFIER@101..102 + 0: IDENT@101..102 "b" [] [] + 1: (empty) + 9: JS_EXPRESSION_STATEMENT@102..116 + 0: JS_BINARY_EXPRESSION@102..116 + 0: JS_BINARY_EXPRESSION@102..113 + 0: JS_BINARY_EXPRESSION@102..109 + 0: JS_NUMBER_LITERAL_EXPRESSION@102..105 + 0: JS_NUMBER_LITERAL@102..105 "1" [Newline("\n")] [Whitespace(" ")] + 1: PLUS@105..107 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@107..109 + 0: JS_NUMBER_LITERAL@107..109 "1" [] [Whitespace(" ")] + 1: PLUS@109..111 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@111..113 + 0: JS_NUMBER_LITERAL@111..113 "1" [] [Whitespace(" ")] + 1: PLUS@113..115 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@115..116 + 0: JS_NUMBER_LITERAL@115..116 "1" [] [] + 1: (empty) + 10: JS_EXPRESSION_STATEMENT@116..139 + 0: JS_BINARY_EXPRESSION@116..139 + 0: JS_BINARY_EXPRESSION@116..123 + 0: JS_NUMBER_LITERAL_EXPRESSION@116..119 + 0: JS_NUMBER_LITERAL@116..119 "5" [Newline("\n")] [Whitespace(" ")] + 1: PLUS@119..121 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@121..123 + 0: JS_NUMBER_LITERAL@121..123 "6" [] [Whitespace(" ")] + 1: MINUS@123..125 "-" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@125..139 + 0: JS_BINARY_EXPRESSION@125..131 + 0: JS_NUMBER_LITERAL_EXPRESSION@125..127 + 0: JS_NUMBER_LITERAL@125..127 "1" [] [Whitespace(" ")] + 1: STAR@127..129 "*" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@129..131 + 0: JS_NUMBER_LITERAL@129..131 "2" [] [Whitespace(" ")] + 1: SLASH@131..133 "/" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@133..139 + 0: JS_NUMBER_LITERAL_EXPRESSION@133..135 + 0: JS_NUMBER_LITERAL@133..135 "1" [] [Whitespace(" ")] + 1: STAR2@135..138 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@138..139 + 0: JS_NUMBER_LITERAL@138..139 "6" [] [] + 1: (empty) + 11: JS_CLASS_DECLARATION@139..192 + 0: JS_DECORATOR_LIST@139..139 + 1: (empty) + 2: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@146..151 + 0: IDENT@146..151 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@151..153 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@153..191 + 0: JS_PROPERTY_CLASS_MEMBER@153..160 + 0: JS_PROPERTY_MODIFIER_LIST@153..153 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@153..158 + 0: HASH@153..154 "#" [] [] + 1: IDENT@154..158 "name" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@158..160 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@160..191 + 0: JS_METHOD_MODIFIER_LIST@160..160 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@160..164 + 0: IDENT@160..164 "test" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@164..167 + 0: L_PAREN@164..165 "(" [] [] + 1: JS_PARAMETER_LIST@165..165 + 2: R_PAREN@165..167 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@167..191 + 0: L_CURLY@167..169 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@169..169 + 2: JS_STATEMENT_LIST@169..189 + 0: JS_EXPRESSION_STATEMENT@169..189 + 0: JS_LOGICAL_EXPRESSION@169..189 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@169..174 + 0: TRUE_KW@169..174 "true" [] [Whitespace(" ")] + 1: AMP2@174..177 "&&" [] [Whitespace(" ")] + 2: JS_IN_EXPRESSION@177..189 + 0: JS_PRIVATE_NAME@177..183 + 0: HASH@177..178 "#" [] [] + 1: IDENT@178..183 "name" [] [Whitespace(" ")] + 1: IN_KW@183..186 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@186..189 + 0: L_CURLY@186..187 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@187..187 + 2: R_CURLY@187..189 "}" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@189..191 "}" [] [Whitespace(" ")] + 9: R_CURLY@191..192 "}" [] [] + 4: EOF@192..193 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/block_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/block_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js.snap new file mode 100644 index 000000000000..990173152ce4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js.snap @@ -0,0 +1,119 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{} +{{{{}}}} +{ foo = bar; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBlockStatement { + l_curly_token: L_CURLY@0..1 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1..2 "}" [] [], + }, + JsBlockStatement { + l_curly_token: L_CURLY@2..4 "{" [Newline("\n")] [], + statements: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@4..5 "{" [] [], + statements: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@5..6 "{" [] [], + statements: JsStatementList [ + JsBlockStatement { + l_curly_token: L_CURLY@6..7 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@7..8 "}" [] [], + }, + ], + r_curly_token: R_CURLY@8..9 "}" [] [], + }, + ], + r_curly_token: R_CURLY@9..10 "}" [] [], + }, + ], + r_curly_token: R_CURLY@10..11 "}" [] [], + }, + JsBlockStatement { + l_curly_token: L_CURLY@11..14 "{" [Newline("\n")] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@14..18 "foo" [] [Whitespace(" ")], + }, + operator_token: EQ@18..20 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..23 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@23..25 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + ], + eof_token: EOF@26..27 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..27 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..26 + 0: JS_BLOCK_STATEMENT@0..2 + 0: L_CURLY@0..1 "{" [] [] + 1: JS_STATEMENT_LIST@1..1 + 2: R_CURLY@1..2 "}" [] [] + 1: JS_BLOCK_STATEMENT@2..11 + 0: L_CURLY@2..4 "{" [Newline("\n")] [] + 1: JS_STATEMENT_LIST@4..10 + 0: JS_BLOCK_STATEMENT@4..10 + 0: L_CURLY@4..5 "{" [] [] + 1: JS_STATEMENT_LIST@5..9 + 0: JS_BLOCK_STATEMENT@5..9 + 0: L_CURLY@5..6 "{" [] [] + 1: JS_STATEMENT_LIST@6..8 + 0: JS_BLOCK_STATEMENT@6..8 + 0: L_CURLY@6..7 "{" [] [] + 1: JS_STATEMENT_LIST@7..7 + 2: R_CURLY@7..8 "}" [] [] + 2: R_CURLY@8..9 "}" [] [] + 2: R_CURLY@9..10 "}" [] [] + 2: R_CURLY@10..11 "}" [] [] + 2: JS_BLOCK_STATEMENT@11..26 + 0: L_CURLY@11..14 "{" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@14..25 + 0: JS_EXPRESSION_STATEMENT@14..25 + 0: JS_ASSIGNMENT_EXPRESSION@14..23 + 0: JS_IDENTIFIER_ASSIGNMENT@14..18 + 0: IDENT@14..18 "foo" [] [Whitespace(" ")] + 1: EQ@18..20 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@20..23 + 0: JS_REFERENCE_IDENTIFIER@20..23 + 0: IDENT@20..23 "bar" [] [] + 1: SEMICOLON@23..25 ";" [] [Whitespace(" ")] + 2: R_CURLY@25..26 "}" [] [] + 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/bom_character.js b/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/bom_character.js rename to crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js.snap new file mode 100644 index 000000000000..e0e3dc771576 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo ( ) {} +``` + + +## AST + +``` +JsModule { + bom_token: UNICODE_BOM@0..3 "\u{feff}" [] [], + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@3..12 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@12..16 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@16..18 "(" [] [Whitespace(" ")], + items: JsParameterList [], + r_paren_token: R_PAREN@18..20 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@20..21 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + ], + eof_token: EOF@22..22 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: UNICODE_BOM@0..3 "\u{feff}" [] [] + 1: (empty) + 2: JS_DIRECTIVE_LIST@3..3 + 3: JS_MODULE_ITEM_LIST@3..22 + 0: JS_FUNCTION_DECLARATION@3..22 + 0: (empty) + 1: FUNCTION_KW@3..12 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@12..16 + 0: IDENT@12..16 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: JS_PARAMETERS@16..20 + 0: L_PAREN@16..18 "(" [] [Whitespace(" ")] + 1: JS_PARAMETER_LIST@18..18 + 2: R_PAREN@18..20 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@20..22 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_DIRECTIVE_LIST@21..21 + 2: JS_STATEMENT_LIST@21..21 + 3: R_CURLY@21..22 "}" [] [] + 4: EOF@22..22 "" [] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/break_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/break_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js.snap new file mode 100644 index 000000000000..38b680bede8a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js.snap @@ -0,0 +1,155 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while (true) { + break; + foo: { + break foo; + } +} +out: while (true) { + break out; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsWhileStatement { + while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@6..7 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@7..11 "true" [] [], + }, + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@13..14 "{" [] [], + statements: JsStatementList [ + JsBreakStatement { + break_token: BREAK_KW@14..22 "break" [Newline("\n"), Whitespace(" ")] [], + label: missing (optional), + semicolon_token: SEMICOLON@22..23 ";" [] [], + }, + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@23..29 "foo" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@29..31 ":" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@31..32 "{" [] [], + statements: JsStatementList [ + JsBreakStatement { + break_token: BREAK_KW@32..42 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + label: JsLabel { + value_token: IDENT@42..45 "foo" [] [], + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + ], + r_curly_token: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], + }, + }, + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@52..56 "out" [Newline("\n")] [], + }, + colon_token: COLON@56..58 ":" [] [Whitespace(" ")], + body: JsWhileStatement { + while_token: WHILE_KW@58..64 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@64..65 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@65..69 "true" [] [], + }, + r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@71..72 "{" [] [], + statements: JsStatementList [ + JsBreakStatement { + break_token: BREAK_KW@72..81 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + label: JsLabel { + value_token: IDENT@81..84 "out" [] [], + }, + semicolon_token: SEMICOLON@84..85 ";" [] [], + }, + ], + r_curly_token: R_CURLY@85..87 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@87..88 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..88 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..87 + 0: JS_WHILE_STATEMENT@0..52 + 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] + 1: L_PAREN@6..7 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11 + 0: TRUE_KW@7..11 "true" [] [] + 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@13..52 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_STATEMENT_LIST@14..50 + 0: JS_BREAK_STATEMENT@14..23 + 0: BREAK_KW@14..22 "break" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: SEMICOLON@22..23 ";" [] [] + 1: JS_LABELED_STATEMENT@23..50 + 0: JS_LABEL@23..29 + 0: IDENT@23..29 "foo" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@29..31 ":" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@31..50 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_STATEMENT_LIST@32..46 + 0: JS_BREAK_STATEMENT@32..46 + 0: BREAK_KW@32..42 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LABEL@42..45 + 0: IDENT@42..45 "foo" [] [] + 2: SEMICOLON@45..46 ";" [] [] + 2: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@50..52 "}" [Newline("\n")] [] + 1: JS_LABELED_STATEMENT@52..87 + 0: JS_LABEL@52..56 + 0: IDENT@52..56 "out" [Newline("\n")] [] + 1: COLON@56..58 ":" [] [Whitespace(" ")] + 2: JS_WHILE_STATEMENT@58..87 + 0: WHILE_KW@58..64 "while" [] [Whitespace(" ")] + 1: L_PAREN@64..65 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@65..69 + 0: TRUE_KW@65..69 "true" [] [] + 3: R_PAREN@69..71 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@71..87 + 0: L_CURLY@71..72 "{" [] [] + 1: JS_STATEMENT_LIST@72..85 + 0: JS_BREAK_STATEMENT@72..85 + 0: BREAK_KW@72..81 "break" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LABEL@81..84 + 0: IDENT@81..84 "out" [] [] + 2: SEMICOLON@84..85 ";" [] [] + 2: R_CURLY@85..87 "}" [Newline("\n")] [] + 4: EOF@87..88 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.ts b/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/built_in_module_name.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts.snap new file mode 100644 index 000000000000..ca2ce6b0ab31 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts.snap @@ -0,0 +1,101 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +// https://github.com/rome/tools/issues/2959 +module number {} +module string {} +declare module never {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsModuleDeclaration { + module_or_namespace: MODULE_KW@0..52 "module" [Comments("// https://github.com ..."), Newline("\n")] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@52..59 "number" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@59..60 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + TsModuleDeclaration { + module_or_namespace: MODULE_KW@61..69 "module" [Newline("\n")] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@69..76 "string" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@76..77 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@77..78 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@78..87 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@87..94 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@94..100 "never" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@100..101 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@102..103 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..103 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..102 + 0: TS_MODULE_DECLARATION@0..61 + 0: MODULE_KW@0..52 "module" [Comments("// https://github.com ..."), Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@52..59 + 0: IDENT@52..59 "number" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_MODULE_ITEM_LIST@60..60 + 2: R_CURLY@60..61 "}" [] [] + 1: TS_MODULE_DECLARATION@61..78 + 0: MODULE_KW@61..69 "module" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@69..76 + 0: IDENT@69..76 "string" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@76..78 + 0: L_CURLY@76..77 "{" [] [] + 1: JS_MODULE_ITEM_LIST@77..77 + 2: R_CURLY@77..78 "}" [] [] + 2: TS_DECLARE_STATEMENT@78..102 + 0: DECLARE_KW@78..87 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@87..102 + 0: MODULE_KW@87..94 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@94..100 + 0: IDENT@94..100 "never" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@100..102 + 0: L_CURLY@100..101 "{" [] [] + 1: JS_MODULE_ITEM_LIST@101..101 + 2: R_CURLY@101..102 "}" [] [] + 4: EOF@102..103 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/call_arguments.js b/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/call_arguments.js rename to crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js.snap new file mode 100644 index 000000000000..25c92b64fc75 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js.snap @@ -0,0 +1,399 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo(...args) {} +let a, b, c, d; +foo(a); +foo(a, b,); +foo(a, b, ...c); +foo(...a, ...b, c, ...d,); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@13..16 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@16..20 "args" [] [], + }, + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@29..30 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@32..33 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@33..35 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@35..36 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@36..38 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@38..39 "d" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@39..40 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..44 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@44..45 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..46 "a" [] [], + }, + }, + ], + r_paren_token: R_PAREN@46..47 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@48..52 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@52..53 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..54 "a" [] [], + }, + }, + COMMA@54..56 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@56..57 "b" [] [], + }, + }, + COMMA@57..58 "," [] [], + ], + r_paren_token: R_PAREN@58..59 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@60..64 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@64..65 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@65..66 "a" [] [], + }, + }, + COMMA@66..68 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@68..69 "b" [] [], + }, + }, + COMMA@69..71 "," [] [Whitespace(" ")], + JsSpread { + dotdotdot_token: DOT3@71..74 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..75 "c" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@75..76 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@76..77 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@77..81 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@81..82 "(" [] [], + args: JsCallArgumentList [ + JsSpread { + dotdotdot_token: DOT3@82..85 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@85..86 "a" [] [], + }, + }, + }, + COMMA@86..88 "," [] [Whitespace(" ")], + JsSpread { + dotdotdot_token: DOT3@88..91 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@91..92 "b" [] [], + }, + }, + }, + COMMA@92..94 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@94..95 "c" [] [], + }, + }, + COMMA@95..97 "," [] [Whitespace(" ")], + JsSpread { + dotdotdot_token: DOT3@97..100 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@100..101 "d" [] [], + }, + }, + }, + COMMA@101..102 "," [] [], + ], + r_paren_token: R_PAREN@102..103 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + ], + eof_token: EOF@104..105 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..105 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..104 + 0: JS_FUNCTION_DECLARATION@0..24 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..22 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..20 + 0: JS_REST_PARAMETER@13..20 + 0: JS_DECORATOR_LIST@13..13 + 1: DOT3@13..16 "..." [] [] + 2: JS_IDENTIFIER_BINDING@16..20 + 0: IDENT@16..20 "args" [] [] + 3: (empty) + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@22..24 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..23 + 3: R_CURLY@23..24 "}" [] [] + 1: JS_VARIABLE_STATEMENT@24..40 + 0: JS_VARIABLE_DECLARATION@24..39 + 0: (empty) + 1: LET_KW@24..29 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..39 + 0: JS_VARIABLE_DECLARATOR@29..30 + 0: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@30..32 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@32..33 + 0: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "b" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@33..35 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@35..36 + 0: JS_IDENTIFIER_BINDING@35..36 + 0: IDENT@35..36 "c" [] [] + 1: (empty) + 2: (empty) + 5: COMMA@36..38 "," [] [Whitespace(" ")] + 6: JS_VARIABLE_DECLARATOR@38..39 + 0: JS_IDENTIFIER_BINDING@38..39 + 0: IDENT@38..39 "d" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@39..40 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@40..48 + 0: JS_CALL_EXPRESSION@40..47 + 0: JS_IDENTIFIER_EXPRESSION@40..44 + 0: JS_REFERENCE_IDENTIFIER@40..44 + 0: IDENT@40..44 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@45..46 + 0: JS_IDENTIFIER_EXPRESSION@45..46 + 0: JS_REFERENCE_IDENTIFIER@45..46 + 0: IDENT@45..46 "a" [] [] + 2: R_PAREN@46..47 ")" [] [] + 1: SEMICOLON@47..48 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@48..60 + 0: JS_CALL_EXPRESSION@48..59 + 0: JS_IDENTIFIER_EXPRESSION@48..52 + 0: JS_REFERENCE_IDENTIFIER@48..52 + 0: IDENT@48..52 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@52..59 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@53..58 + 0: JS_IDENTIFIER_EXPRESSION@53..54 + 0: JS_REFERENCE_IDENTIFIER@53..54 + 0: IDENT@53..54 "a" [] [] + 1: COMMA@54..56 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@56..57 + 0: JS_REFERENCE_IDENTIFIER@56..57 + 0: IDENT@56..57 "b" [] [] + 3: COMMA@57..58 "," [] [] + 2: R_PAREN@58..59 ")" [] [] + 1: SEMICOLON@59..60 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@60..77 + 0: JS_CALL_EXPRESSION@60..76 + 0: JS_IDENTIFIER_EXPRESSION@60..64 + 0: JS_REFERENCE_IDENTIFIER@60..64 + 0: IDENT@60..64 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@64..76 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@65..75 + 0: JS_IDENTIFIER_EXPRESSION@65..66 + 0: JS_REFERENCE_IDENTIFIER@65..66 + 0: IDENT@65..66 "a" [] [] + 1: COMMA@66..68 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@68..69 + 0: JS_REFERENCE_IDENTIFIER@68..69 + 0: IDENT@68..69 "b" [] [] + 3: COMMA@69..71 "," [] [Whitespace(" ")] + 4: JS_SPREAD@71..75 + 0: DOT3@71..74 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@74..75 + 0: JS_REFERENCE_IDENTIFIER@74..75 + 0: IDENT@74..75 "c" [] [] + 2: R_PAREN@75..76 ")" [] [] + 1: SEMICOLON@76..77 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@77..104 + 0: JS_CALL_EXPRESSION@77..103 + 0: JS_IDENTIFIER_EXPRESSION@77..81 + 0: JS_REFERENCE_IDENTIFIER@77..81 + 0: IDENT@77..81 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@81..103 + 0: L_PAREN@81..82 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@82..102 + 0: JS_SPREAD@82..86 + 0: DOT3@82..85 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@85..86 + 0: JS_REFERENCE_IDENTIFIER@85..86 + 0: IDENT@85..86 "a" [] [] + 1: COMMA@86..88 "," [] [Whitespace(" ")] + 2: JS_SPREAD@88..92 + 0: DOT3@88..91 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@91..92 + 0: JS_REFERENCE_IDENTIFIER@91..92 + 0: IDENT@91..92 "b" [] [] + 3: COMMA@92..94 "," [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@94..95 + 0: JS_REFERENCE_IDENTIFIER@94..95 + 0: IDENT@94..95 "c" [] [] + 5: COMMA@95..97 "," [] [Whitespace(" ")] + 6: JS_SPREAD@97..101 + 0: DOT3@97..100 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@100..101 + 0: JS_REFERENCE_IDENTIFIER@100..101 + 0: IDENT@100..101 "d" [] [] + 7: COMMA@101..102 "," [] [] + 2: R_PAREN@102..103 ")" [] [] + 1: SEMICOLON@103..104 ";" [] [] + 4: EOF@104..105 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs.snap new file mode 100644 index 000000000000..a4f9f4d13fa4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs.snap @@ -0,0 +1,134 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +async function* test() { + class A { + prop = await; + } +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@16..24 "function" [] [], + star_token: STAR@24..26 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@26..30 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@33..34 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@43..45 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..46 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@58..63 "await" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + ], + r_curly_token: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@68..70 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..70 + 0: JS_FUNCTION_DECLARATION@0..70 + 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@16..24 "function" [] [] + 2: STAR@24..26 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@26..30 + 0: IDENT@26..30 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@30..33 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..31 + 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@33..70 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_DIRECTIVE_LIST@34..34 + 2: JS_STATEMENT_LIST@34..68 + 0: JS_CLASS_DECLARATION@34..68 + 0: JS_DECORATOR_LIST@34..34 + 1: (empty) + 2: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..46 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@46..64 + 0: JS_PROPERTY_CLASS_MEMBER@46..64 + 0: JS_PROPERTY_MODIFIER_LIST@46..46 + 1: JS_LITERAL_MEMBER_NAME@46..56 + 0: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@56..63 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@58..63 + 0: JS_REFERENCE_IDENTIFIER@58..63 + 0: IDENT@58..63 "await" [] [] + 4: SEMICOLON@63..64 ";" [] [] + 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@68..70 "}" [Newline("\n")] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap new file mode 100644 index 000000000000..1dcfe4f1e2d3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap @@ -0,0 +1,466 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { name!: string; other!: string } +class Sub extends Base { + constructor(private priv: string, protected prot: string, public pub: string, override name: string, readonly read: string, protected override readonly other: string) { + super(); + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..13 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@13..17 "name" [] [], + }, + property_annotation: TsDefinitePropertyAnnotation { + excl_token: BANG@17..18 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@20..26 "string" [] [], + }, + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@28..33 "other" [] [], + }, + property_annotation: TsDefinitePropertyAnnotation { + excl_token: BANG@33..34 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@36..43 "string" [] [Whitespace(" ")], + }, + }, + }, + value: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@51..55 "Sub" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@63..68 "Base" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@68..69 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@69..82 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@82..83 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@83..91 "private" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@91..95 "priv" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@95..97 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@97..103 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + COMMA@103..105 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@105..115 "protected" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@115..119 "prot" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@121..127 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + COMMA@127..129 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@129..136 "public" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@136..139 "pub" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@139..141 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@141..147 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + COMMA@147..149 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsOverrideModifier { + modifier_token: OVERRIDE_KW@149..158 "override" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@158..162 "name" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@162..164 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@164..170 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + COMMA@170..172 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@181..185 "read" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@185..187 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@187..193 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + COMMA@193..195 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@195..205 "protected" [] [Whitespace(" ")], + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@205..214 "override" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@214..223 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@223..228 "other" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@228..230 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@230..236 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@236..238 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@238..239 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@239..250 "super" [Newline("\n"), Whitespace(" ")] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@250..251 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@251..252 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@252..253 ";" [] [], + }, + ], + r_curly_token: R_CURLY@253..256 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@256..258 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@258..259 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..259 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..258 + 0: JS_CLASS_DECLARATION@0..44 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Base" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..13 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@13..43 + 0: JS_PROPERTY_CLASS_MEMBER@13..28 + 0: JS_PROPERTY_MODIFIER_LIST@13..13 + 1: JS_LITERAL_MEMBER_NAME@13..17 + 0: IDENT@13..17 "name" [] [] + 2: TS_DEFINITE_PROPERTY_ANNOTATION@17..26 + 0: BANG@17..18 "!" [] [] + 1: TS_TYPE_ANNOTATION@18..26 + 0: COLON@18..20 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@20..26 + 0: STRING_KW@20..26 "string" [] [] + 3: (empty) + 4: SEMICOLON@26..28 ";" [] [Whitespace(" ")] + 1: JS_PROPERTY_CLASS_MEMBER@28..43 + 0: JS_PROPERTY_MODIFIER_LIST@28..28 + 1: JS_LITERAL_MEMBER_NAME@28..33 + 0: IDENT@28..33 "other" [] [] + 2: TS_DEFINITE_PROPERTY_ANNOTATION@33..43 + 0: BANG@33..34 "!" [] [] + 1: TS_TYPE_ANNOTATION@34..43 + 0: COLON@34..36 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@36..43 + 0: STRING_KW@36..43 "string" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 9: R_CURLY@43..44 "}" [] [] + 1: JS_CLASS_DECLARATION@44..258 + 0: JS_DECORATOR_LIST@44..44 + 1: (empty) + 2: CLASS_KW@44..51 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@51..55 + 0: IDENT@51..55 "Sub" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@55..68 + 0: EXTENDS_KW@55..63 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@63..68 + 0: JS_REFERENCE_IDENTIFIER@63..68 + 0: IDENT@63..68 "Base" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@68..69 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@69..256 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@69..256 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@69..69 + 1: JS_LITERAL_MEMBER_NAME@69..82 + 0: IDENT@69..82 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@82..238 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@83..236 + 0: TS_PROPERTY_PARAMETER@83..103 + 0: JS_DECORATOR_LIST@83..83 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@83..91 + 0: TS_ACCESSIBILITY_MODIFIER@83..91 + 0: PRIVATE_KW@83..91 "private" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@91..103 + 0: JS_DECORATOR_LIST@91..91 + 1: JS_IDENTIFIER_BINDING@91..95 + 0: IDENT@91..95 "priv" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@95..103 + 0: COLON@95..97 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@97..103 + 0: STRING_KW@97..103 "string" [] [] + 4: (empty) + 1: COMMA@103..105 "," [] [Whitespace(" ")] + 2: TS_PROPERTY_PARAMETER@105..127 + 0: JS_DECORATOR_LIST@105..105 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@105..115 + 0: TS_ACCESSIBILITY_MODIFIER@105..115 + 0: PROTECTED_KW@105..115 "protected" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@115..127 + 0: JS_DECORATOR_LIST@115..115 + 1: JS_IDENTIFIER_BINDING@115..119 + 0: IDENT@115..119 "prot" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@119..127 + 0: COLON@119..121 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@121..127 + 0: STRING_KW@121..127 "string" [] [] + 4: (empty) + 3: COMMA@127..129 "," [] [Whitespace(" ")] + 4: TS_PROPERTY_PARAMETER@129..147 + 0: JS_DECORATOR_LIST@129..129 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@129..136 + 0: TS_ACCESSIBILITY_MODIFIER@129..136 + 0: PUBLIC_KW@129..136 "public" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@136..147 + 0: JS_DECORATOR_LIST@136..136 + 1: JS_IDENTIFIER_BINDING@136..139 + 0: IDENT@136..139 "pub" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@139..147 + 0: COLON@139..141 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@141..147 + 0: STRING_KW@141..147 "string" [] [] + 4: (empty) + 5: COMMA@147..149 "," [] [Whitespace(" ")] + 6: TS_PROPERTY_PARAMETER@149..170 + 0: JS_DECORATOR_LIST@149..149 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@149..158 + 0: TS_OVERRIDE_MODIFIER@149..158 + 0: OVERRIDE_KW@149..158 "override" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@158..170 + 0: JS_DECORATOR_LIST@158..158 + 1: JS_IDENTIFIER_BINDING@158..162 + 0: IDENT@158..162 "name" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@162..170 + 0: COLON@162..164 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@164..170 + 0: STRING_KW@164..170 "string" [] [] + 4: (empty) + 7: COMMA@170..172 "," [] [Whitespace(" ")] + 8: TS_PROPERTY_PARAMETER@172..193 + 0: JS_DECORATOR_LIST@172..172 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@172..181 + 0: TS_READONLY_MODIFIER@172..181 + 0: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@181..193 + 0: JS_DECORATOR_LIST@181..181 + 1: JS_IDENTIFIER_BINDING@181..185 + 0: IDENT@181..185 "read" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@185..193 + 0: COLON@185..187 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@187..193 + 0: STRING_KW@187..193 "string" [] [] + 4: (empty) + 9: COMMA@193..195 "," [] [Whitespace(" ")] + 10: TS_PROPERTY_PARAMETER@195..236 + 0: JS_DECORATOR_LIST@195..195 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@195..223 + 0: TS_ACCESSIBILITY_MODIFIER@195..205 + 0: PROTECTED_KW@195..205 "protected" [] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@205..214 + 0: OVERRIDE_KW@205..214 "override" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@214..223 + 0: READONLY_KW@214..223 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@223..236 + 0: JS_DECORATOR_LIST@223..223 + 1: JS_IDENTIFIER_BINDING@223..228 + 0: IDENT@223..228 "other" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@228..236 + 0: COLON@228..230 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@230..236 + 0: STRING_KW@230..236 "string" [] [] + 4: (empty) + 2: R_PAREN@236..238 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@238..256 + 0: L_CURLY@238..239 "{" [] [] + 1: JS_DIRECTIVE_LIST@239..239 + 2: JS_STATEMENT_LIST@239..253 + 0: JS_EXPRESSION_STATEMENT@239..253 + 0: JS_CALL_EXPRESSION@239..252 + 0: JS_SUPER_EXPRESSION@239..250 + 0: SUPER_KW@239..250 "super" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@250..252 + 0: L_PAREN@250..251 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@251..251 + 2: R_PAREN@251..252 ")" [] [] + 1: SEMICOLON@252..253 ";" [] [] + 3: R_CURLY@253..256 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@256..258 "}" [Newline("\n")] [] + 4: EOF@258..259 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declaration.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js.snap new file mode 100644 index 000000000000..07aae911a3f7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js.snap @@ -0,0 +1,152 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo {} +class foo extends bar {} +class foo extends foo.bar {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@11..12 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@12..19 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@19..23 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@23..31 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..35 "bar" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@35..36 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@44..48 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@48..56 "extends" [] [Whitespace(" ")], + super_class: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@56..59 "foo" [] [], + }, + }, + operator_token: DOT@59..60 "." [] [], + member: JsName { + value_token: IDENT@60..64 "bar" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@64..65 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@65..66 "}" [] [], + }, + ], + eof_token: EOF@66..67 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..67 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..66 + 0: JS_CLASS_DECLARATION@0..12 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..11 + 9: R_CURLY@11..12 "}" [] [] + 1: JS_CLASS_DECLARATION@12..37 + 0: JS_DECORATOR_LIST@12..12 + 1: (empty) + 2: CLASS_KW@12..19 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@19..23 + 0: IDENT@19..23 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@23..35 + 0: EXTENDS_KW@23..31 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@31..35 + 0: JS_REFERENCE_IDENTIFIER@31..35 + 0: IDENT@31..35 "bar" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@35..36 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@36..36 + 9: R_CURLY@36..37 "}" [] [] + 2: JS_CLASS_DECLARATION@37..66 + 0: JS_DECORATOR_LIST@37..37 + 1: (empty) + 2: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@44..48 + 0: IDENT@44..48 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@48..64 + 0: EXTENDS_KW@48..56 "extends" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@56..64 + 0: JS_IDENTIFIER_EXPRESSION@56..59 + 0: JS_REFERENCE_IDENTIFIER@56..59 + 0: IDENT@56..59 "foo" [] [] + 1: DOT@59..60 "." [] [] + 2: JS_NAME@60..64 + 0: IDENT@60..64 "bar" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@64..65 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@65..65 + 9: R_CURLY@65..66 "}" [] [] + 4: EOF@66..67 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declare.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_declare.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js.snap new file mode 100644 index 000000000000..e46095cbd0ac --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js.snap @@ -0,0 +1,158 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { declare() {} } +class B { declare = foo } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@10..17 "declare" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@17..18 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@18..20 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@20..21 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@21..23 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@31..33 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@35..43 "declare" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@43..45 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..49 "foo" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@49..50 "}" [] [], + }, + ], + eof_token: EOF@50..51 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..51 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..50 + 0: JS_CLASS_DECLARATION@0..24 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..23 + 0: JS_METHOD_CLASS_MEMBER@10..23 + 0: JS_METHOD_MODIFIER_LIST@10..10 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@10..17 + 0: IDENT@10..17 "declare" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@17..20 + 0: L_PAREN@17..18 "(" [] [] + 1: JS_PARAMETER_LIST@18..18 + 2: R_PAREN@18..20 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@20..23 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_DIRECTIVE_LIST@21..21 + 2: JS_STATEMENT_LIST@21..21 + 3: R_CURLY@21..23 "}" [] [Whitespace(" ")] + 9: R_CURLY@23..24 "}" [] [] + 1: JS_CLASS_DECLARATION@24..50 + 0: JS_DECORATOR_LIST@24..24 + 1: (empty) + 2: CLASS_KW@24..31 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@33..35 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@35..49 + 0: JS_PROPERTY_CLASS_MEMBER@35..49 + 0: JS_PROPERTY_MODIFIER_LIST@35..35 + 1: JS_LITERAL_MEMBER_NAME@35..43 + 0: IDENT@35..43 "declare" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@43..49 + 0: EQ@43..45 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@45..49 + 0: JS_REFERENCE_IDENTIFIER@45..49 + 0: IDENT@45..49 "foo" [] [Whitespace(" ")] + 4: (empty) + 9: R_CURLY@49..50 "}" [] [] + 4: EOF@50..51 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_decorator.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_decorator.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js.snap new file mode 100644 index 000000000000..04ee832a1e26 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@17..21 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_CLASS_DECLARATION@0..24 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: (empty) + 2: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@17..21 + 0: IDENT@17..21 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@21..23 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@23..23 + 9: R_CURLY@23..24 "}" [] [] + 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_empty_element.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_empty_element.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js.snap new file mode 100644 index 000000000000..1b6958e600d2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js.snap @@ -0,0 +1,162 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { ;;;;;;;;;; get foo() {};;;;} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..12 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsEmptyClassMember { + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@23..27 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@27..30 "foo" [] [], + }, + l_paren_token: L_PAREN@30..31 "(" [] [], + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@33..34 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@35..36 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + ], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: JS_CLASS_DECLARATION@0..40 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..12 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@12..39 + 0: JS_EMPTY_CLASS_MEMBER@12..13 + 0: SEMICOLON@12..13 ";" [] [] + 1: JS_EMPTY_CLASS_MEMBER@13..14 + 0: SEMICOLON@13..14 ";" [] [] + 2: JS_EMPTY_CLASS_MEMBER@14..15 + 0: SEMICOLON@14..15 ";" [] [] + 3: JS_EMPTY_CLASS_MEMBER@15..16 + 0: SEMICOLON@15..16 ";" [] [] + 4: JS_EMPTY_CLASS_MEMBER@16..17 + 0: SEMICOLON@16..17 ";" [] [] + 5: JS_EMPTY_CLASS_MEMBER@17..18 + 0: SEMICOLON@17..18 ";" [] [] + 6: JS_EMPTY_CLASS_MEMBER@18..19 + 0: SEMICOLON@18..19 ";" [] [] + 7: JS_EMPTY_CLASS_MEMBER@19..20 + 0: SEMICOLON@19..20 ";" [] [] + 8: JS_EMPTY_CLASS_MEMBER@20..21 + 0: SEMICOLON@20..21 ";" [] [] + 9: JS_EMPTY_CLASS_MEMBER@21..23 + 0: SEMICOLON@21..23 ";" [] [Whitespace(" ")] + 10: JS_GETTER_CLASS_MEMBER@23..35 + 0: JS_METHOD_MODIFIER_LIST@23..23 + 1: GET_KW@23..27 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@27..30 + 0: IDENT@27..30 "foo" [] [] + 3: L_PAREN@30..31 "(" [] [] + 4: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@33..35 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_DIRECTIVE_LIST@34..34 + 2: JS_STATEMENT_LIST@34..34 + 3: R_CURLY@34..35 "}" [] [] + 11: JS_EMPTY_CLASS_MEMBER@35..36 + 0: SEMICOLON@35..36 ";" [] [] + 12: JS_EMPTY_CLASS_MEMBER@36..37 + 0: SEMICOLON@36..37 ";" [] [] + 13: JS_EMPTY_CLASS_MEMBER@37..38 + 0: SEMICOLON@37..38 ";" [] [] + 14: JS_EMPTY_CLASS_MEMBER@38..39 + 0: SEMICOLON@38..39 ";" [] [] + 9: R_CURLY@39..40 "}" [] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js.snap new file mode 100644 index 000000000000..53f5ab3bda1b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js.snap @@ -0,0 +1,219 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = class {}; +let b = class foo { + constructor() {} +} +foo[class {}] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@15..16 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@22..24 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@32..36 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@36..37 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@37..50 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@50..51 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@53..54 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@55..57 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..61 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@61..62 "[" [] [], + member: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@62..68 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@68..69 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@69..70 "}" [] [], + }, + r_brack_token: R_BRACK@70..71 "]" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@71..72 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..72 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..71 + 0: JS_VARIABLE_STATEMENT@0..17 + 0: JS_VARIABLE_DECLARATION@0..16 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..16 + 0: JS_VARIABLE_DECLARATOR@4..16 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..16 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@8..16 + 0: JS_DECORATOR_LIST@8..8 + 1: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@14..15 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@15..15 + 8: R_CURLY@15..16 "}" [] [] + 1: SEMICOLON@16..17 ";" [] [] + 1: JS_VARIABLE_STATEMENT@17..57 + 0: JS_VARIABLE_DECLARATION@17..57 + 0: (empty) + 1: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@22..57 + 0: JS_VARIABLE_DECLARATOR@22..57 + 0: JS_IDENTIFIER_BINDING@22..24 + 0: IDENT@22..24 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@24..57 + 0: EQ@24..26 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@26..57 + 0: JS_DECORATOR_LIST@26..26 + 1: CLASS_KW@26..32 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@32..36 + 0: IDENT@32..36 "foo" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@36..37 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@37..55 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@37..55 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@37..37 + 1: JS_LITERAL_MEMBER_NAME@37..50 + 0: IDENT@37..50 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@50..53 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@51..51 + 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@53..55 + 0: L_CURLY@53..54 "{" [] [] + 1: JS_DIRECTIVE_LIST@54..54 + 2: JS_STATEMENT_LIST@54..54 + 3: R_CURLY@54..55 "}" [] [] + 8: R_CURLY@55..57 "}" [Newline("\n")] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@57..71 + 0: JS_COMPUTED_MEMBER_EXPRESSION@57..71 + 0: JS_IDENTIFIER_EXPRESSION@57..61 + 0: JS_REFERENCE_IDENTIFIER@57..61 + 0: IDENT@57..61 "foo" [Newline("\n")] [] + 1: (empty) + 2: L_BRACK@61..62 "[" [] [] + 3: JS_CLASS_EXPRESSION@62..70 + 0: JS_DECORATOR_LIST@62..62 + 1: CLASS_KW@62..68 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@68..69 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@69..69 + 8: R_CURLY@69..70 "}" [] [] + 4: R_BRACK@70..71 "]" [] [] + 1: (empty) + 4: EOF@71..72 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js.snap new file mode 100644 index 000000000000..1f81e0ce22b5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js.snap @@ -0,0 +1,221 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { public() {} } +class A { static protected() {} } +class A { static } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@10..16 "public" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@16..17 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@19..20 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..22 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@23..30 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@30..32 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@32..34 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@34..41 "static" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@41..50 "protected" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@50..51 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@53..54 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@54..56 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@56..57 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@64..66 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@68..75 "static" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@75..76 "}" [] [], + }, + ], + eof_token: EOF@76..77 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..77 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..76 + 0: JS_CLASS_DECLARATION@0..23 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..22 + 0: JS_METHOD_CLASS_MEMBER@10..22 + 0: JS_METHOD_MODIFIER_LIST@10..10 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@10..16 + 0: IDENT@10..16 "public" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@16..19 + 0: L_PAREN@16..17 "(" [] [] + 1: JS_PARAMETER_LIST@17..17 + 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@19..22 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_DIRECTIVE_LIST@20..20 + 2: JS_STATEMENT_LIST@20..20 + 3: R_CURLY@20..22 "}" [] [Whitespace(" ")] + 9: R_CURLY@22..23 "}" [] [] + 1: JS_CLASS_DECLARATION@23..57 + 0: JS_DECORATOR_LIST@23..23 + 1: (empty) + 2: CLASS_KW@23..30 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@30..32 + 0: IDENT@30..32 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@32..34 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@34..56 + 0: JS_METHOD_CLASS_MEMBER@34..56 + 0: JS_METHOD_MODIFIER_LIST@34..41 + 0: JS_STATIC_MODIFIER@34..41 + 0: STATIC_KW@34..41 "static" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@41..50 + 0: IDENT@41..50 "protected" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@50..53 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_PARAMETER_LIST@51..51 + 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@53..56 + 0: L_CURLY@53..54 "{" [] [] + 1: JS_DIRECTIVE_LIST@54..54 + 2: JS_STATEMENT_LIST@54..54 + 3: R_CURLY@54..56 "}" [] [Whitespace(" ")] + 9: R_CURLY@56..57 "}" [] [] + 2: JS_CLASS_DECLARATION@57..76 + 0: JS_DECORATOR_LIST@57..57 + 1: (empty) + 2: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@64..66 + 0: IDENT@64..66 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@66..68 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@68..75 + 0: JS_PROPERTY_CLASS_MEMBER@68..75 + 0: JS_PROPERTY_MODIFIER_LIST@68..68 + 1: JS_LITERAL_MEMBER_NAME@68..75 + 0: IDENT@68..75 "static" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 9: R_CURLY@75..76 "}" [] [] + 4: EOF@76..77 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap new file mode 100644 index 000000000000..960f199212d2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap @@ -0,0 +1,112 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + static + foo() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace(" ")] [], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@18..24 "foo" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@24..25 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@27..28 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@29..31 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@31..32 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..32 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..31 + 0: JS_CLASS_DECLARATION@0..31 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..29 + 0: JS_METHOD_CLASS_MEMBER@9..29 + 0: JS_METHOD_MODIFIER_LIST@9..18 + 0: JS_STATIC_MODIFIER@9..18 + 0: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@18..24 + 0: IDENT@18..24 "foo" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@24..27 + 0: L_PAREN@24..25 "(" [] [] + 1: JS_PARAMETER_LIST@25..25 + 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@27..29 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..28 + 3: R_CURLY@28..29 "}" [] [] + 9: R_CURLY@29..31 "}" [Newline("\n")] [] + 4: EOF@31..32 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap new file mode 100644 index 000000000000..a861efcc11cb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap @@ -0,0 +1,62 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class abstract {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..15 "abstract" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@15..16 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: JS_CLASS_DECLARATION@0..17 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..15 + 0: IDENT@6..15 "abstract" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@15..16 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@16..16 + 9: R_CURLY@16..17 "}" [] [] + 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js.snap new file mode 100644 index 000000000000..9cec67c69cc0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js.snap @@ -0,0 +1,109 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { static constructor() {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@10..17 "static" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@17..28 "constructor" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@31..32 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@32..34 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_CLASS_DECLARATION@0..35 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..34 + 0: JS_METHOD_CLASS_MEMBER@10..34 + 0: JS_METHOD_MODIFIER_LIST@10..17 + 0: JS_STATIC_MODIFIER@10..17 + 0: STATIC_KW@10..17 "static" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@17..28 + 0: IDENT@17..28 "constructor" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@28..31 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..29 + 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@31..34 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_DIRECTIVE_LIST@32..32 + 2: JS_STATEMENT_LIST@32..32 + 3: R_CURLY@32..34 "}" [] [Whitespace(" ")] + 9: R_CURLY@34..35 "}" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js.snap new file mode 100644 index 000000000000..3b3bfb0f0187 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js.snap @@ -0,0 +1,211 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo[bar] +foo[5 + 5] +foo["bar"] +foo[bar][baz] +foo?.[bar] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@3..4 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..7 "bar" [] [], + }, + }, + r_brack_token: R_BRACK@7..8 "]" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..12 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@12..13 "[" [] [], + member: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..15 "5" [] [Whitespace(" ")], + }, + operator_token: PLUS@15..17 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@17..18 "5" [] [], + }, + }, + r_brack_token: R_BRACK@18..19 "]" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@19..23 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@23..24 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@24..29 "\"bar\"" [] [], + }, + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..34 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@34..35 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..38 "bar" [] [], + }, + }, + r_brack_token: R_BRACK@38..39 "]" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@39..40 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..43 "baz" [] [], + }, + }, + r_brack_token: R_BRACK@43..44 "]" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..48 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: QUESTIONDOT@48..50 "?." [] [], + l_brack_token: L_BRACK@50..51 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@51..54 "bar" [] [], + }, + }, + r_brack_token: R_BRACK@54..55 "]" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@55..56 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..56 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..55 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_COMPUTED_MEMBER_EXPRESSION@0..8 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: (empty) + 2: L_BRACK@3..4 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@4..7 + 0: JS_REFERENCE_IDENTIFIER@4..7 + 0: IDENT@4..7 "bar" [] [] + 4: R_BRACK@7..8 "]" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@8..19 + 0: JS_COMPUTED_MEMBER_EXPRESSION@8..19 + 0: JS_IDENTIFIER_EXPRESSION@8..12 + 0: JS_REFERENCE_IDENTIFIER@8..12 + 0: IDENT@8..12 "foo" [Newline("\n")] [] + 1: (empty) + 2: L_BRACK@12..13 "[" [] [] + 3: JS_BINARY_EXPRESSION@13..18 + 0: JS_NUMBER_LITERAL_EXPRESSION@13..15 + 0: JS_NUMBER_LITERAL@13..15 "5" [] [Whitespace(" ")] + 1: PLUS@15..17 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@17..18 + 0: JS_NUMBER_LITERAL@17..18 "5" [] [] + 4: R_BRACK@18..19 "]" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@19..30 + 0: JS_COMPUTED_MEMBER_EXPRESSION@19..30 + 0: JS_IDENTIFIER_EXPRESSION@19..23 + 0: JS_REFERENCE_IDENTIFIER@19..23 + 0: IDENT@19..23 "foo" [Newline("\n")] [] + 1: (empty) + 2: L_BRACK@23..24 "[" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@24..29 + 0: JS_STRING_LITERAL@24..29 "\"bar\"" [] [] + 4: R_BRACK@29..30 "]" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@30..44 + 0: JS_COMPUTED_MEMBER_EXPRESSION@30..44 + 0: JS_COMPUTED_MEMBER_EXPRESSION@30..39 + 0: JS_IDENTIFIER_EXPRESSION@30..34 + 0: JS_REFERENCE_IDENTIFIER@30..34 + 0: IDENT@30..34 "foo" [Newline("\n")] [] + 1: (empty) + 2: L_BRACK@34..35 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@35..38 + 0: JS_REFERENCE_IDENTIFIER@35..38 + 0: IDENT@35..38 "bar" [] [] + 4: R_BRACK@38..39 "]" [] [] + 1: (empty) + 2: L_BRACK@39..40 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@40..43 + 0: JS_REFERENCE_IDENTIFIER@40..43 + 0: IDENT@40..43 "baz" [] [] + 4: R_BRACK@43..44 "]" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@44..55 + 0: JS_COMPUTED_MEMBER_EXPRESSION@44..55 + 0: JS_IDENTIFIER_EXPRESSION@44..48 + 0: JS_REFERENCE_IDENTIFIER@44..48 + 0: IDENT@44..48 "foo" [Newline("\n")] [] + 1: QUESTIONDOT@48..50 "?." [] [] + 2: L_BRACK@50..51 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@51..54 + 0: JS_REFERENCE_IDENTIFIER@51..54 + 0: IDENT@51..54 "bar" [] [] + 4: R_BRACK@54..55 "]" [] [] + 1: (empty) + 4: EOF@55..56 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_in.js b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_in.js rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js.snap new file mode 100644 index 000000000000..6b2175fd923c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js.snap @@ -0,0 +1,99 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({}["x" in {}];;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsComputedMemberExpression { + object: JsObjectExpression { + l_curly_token: L_CURLY@5..6 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@6..7 "}" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@7..8 "[" [] [], + member: JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@8..12 "\"x\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@12..15 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@15..16 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + r_brack_token: R_BRACK@17..18 "]" [] [], + }, + first_semi_token: SEMICOLON@18..19 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@19..20 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@22..23 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_FOR_STATEMENT@0..24 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_COMPUTED_MEMBER_EXPRESSION@5..18 + 0: JS_OBJECT_EXPRESSION@5..7 + 0: L_CURLY@5..6 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@6..6 + 2: R_CURLY@6..7 "}" [] [] + 1: (empty) + 2: L_BRACK@7..8 "[" [] [] + 3: JS_IN_EXPRESSION@8..17 + 0: JS_STRING_LITERAL_EXPRESSION@8..12 + 0: JS_STRING_LITERAL@8..12 "\"x\"" [] [Whitespace(" ")] + 1: IN_KW@12..15 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@15..17 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@16..16 + 2: R_CURLY@16..17 "}" [] [] + 4: R_BRACK@17..18 "]" [] [] + 3: SEMICOLON@18..19 ";" [] [] + 4: (empty) + 5: SEMICOLON@19..20 ";" [] [] + 6: (empty) + 7: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@22..24 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_STATEMENT_LIST@23..23 + 2: R_CURLY@23..24 "}" [] [] + 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.js b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.js rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js.snap new file mode 100644 index 000000000000..18f1b4ecc5cd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js.snap @@ -0,0 +1,108 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({["x" in {}]: 3} ;;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsObjectExpression { + l_curly_token: L_CURLY@5..6 "{" [] [], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsComputedMemberName { + l_brack_token: L_BRACK@6..7 "[" [] [], + expression: JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@11..14 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@15..16 "}" [] [], + }, + }, + r_brack_token: R_BRACK@16..17 "]" [] [], + }, + colon_token: COLON@17..19 ":" [] [Whitespace(" ")], + value: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@19..20 "3" [] [], + }, + }, + ], + r_curly_token: R_CURLY@20..22 "}" [] [Whitespace(" ")], + }, + first_semi_token: SEMICOLON@22..23 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@23..24 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@26..27 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_FOR_STATEMENT@0..28 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_OBJECT_EXPRESSION@5..22 + 0: L_CURLY@5..6 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@6..20 + 0: JS_PROPERTY_OBJECT_MEMBER@6..20 + 0: JS_COMPUTED_MEMBER_NAME@6..17 + 0: L_BRACK@6..7 "[" [] [] + 1: JS_IN_EXPRESSION@7..16 + 0: JS_STRING_LITERAL_EXPRESSION@7..11 + 0: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")] + 1: IN_KW@11..14 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@14..16 + 0: L_CURLY@14..15 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@15..15 + 2: R_CURLY@15..16 "}" [] [] + 2: R_BRACK@16..17 "]" [] [] + 1: COLON@17..19 ":" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@19..20 + 0: JS_NUMBER_LITERAL@19..20 "3" [] [] + 2: R_CURLY@20..22 "}" [] [Whitespace(" ")] + 3: SEMICOLON@22..23 ";" [] [] + 4: (empty) + 5: SEMICOLON@23..24 ";" [] [] + 6: (empty) + 7: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@26..28 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_STATEMENT_LIST@27..27 + 2: R_CURLY@27..28 "}" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/conditional_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/conditional_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js.snap new file mode 100644 index 000000000000..e83ccfd634b8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js.snap @@ -0,0 +1,132 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ? bar : baz +foo ? bar : baz ? bar : baz + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@4..6 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@6..10 "bar" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@10..12 ":" [] [Whitespace(" ")], + alternate: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..15 "baz" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..20 "foo" [Newline("\n")] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@20..22 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@22..26 "bar" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@26..28 ":" [] [Whitespace(" ")], + alternate: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..32 "baz" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@32..34 "?" [] [Whitespace(" ")], + consequent: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@34..38 "bar" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + alternate: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..43 "baz" [] [], + }, + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@43..44 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..44 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..43 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JS_CONDITIONAL_EXPRESSION@0..15 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "foo" [] [Whitespace(" ")] + 1: QUESTION@4..6 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@6..10 + 0: JS_REFERENCE_IDENTIFIER@6..10 + 0: IDENT@6..10 "bar" [] [Whitespace(" ")] + 3: COLON@10..12 ":" [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@12..15 + 0: JS_REFERENCE_IDENTIFIER@12..15 + 0: IDENT@12..15 "baz" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@15..43 + 0: JS_CONDITIONAL_EXPRESSION@15..43 + 0: JS_IDENTIFIER_EXPRESSION@15..20 + 0: JS_REFERENCE_IDENTIFIER@15..20 + 0: IDENT@15..20 "foo" [Newline("\n")] [Whitespace(" ")] + 1: QUESTION@20..22 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@22..26 + 0: JS_REFERENCE_IDENTIFIER@22..26 + 0: IDENT@22..26 "bar" [] [Whitespace(" ")] + 3: COLON@26..28 ":" [] [Whitespace(" ")] + 4: JS_CONDITIONAL_EXPRESSION@28..43 + 0: JS_IDENTIFIER_EXPRESSION@28..32 + 0: JS_REFERENCE_IDENTIFIER@28..32 + 0: IDENT@28..32 "baz" [] [Whitespace(" ")] + 1: QUESTION@32..34 "?" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@34..38 + 0: JS_REFERENCE_IDENTIFIER@34..38 + 0: IDENT@34..38 "bar" [] [Whitespace(" ")] + 3: COLON@38..40 ":" [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@40..43 + 0: JS_REFERENCE_IDENTIFIER@40..43 + 0: IDENT@40..43 "baz" [] [] + 1: (empty) + 4: EOF@43..44 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/constructor_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js.snap new file mode 100644 index 000000000000..e291c329fc5c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js.snap @@ -0,0 +1,261 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Foo { + constructor(a) { + this.a = a; + } +} +class Bar { + "constructor"(b) { + this.b = b; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@11..25 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@25..26 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@26..27 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@29..30 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsThisExpression { + this_token: THIS_KW@30..39 "this" [Newline("\n"), Whitespace(" ")] [], + }, + dot_token: DOT@39..40 "." [] [], + member: JsName { + value_token: IDENT@40..42 "a" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@42..44 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "a" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + ], + r_curly_token: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@50..52 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@52..59 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@59..63 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@63..64 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@64..80 "\"constructor\"" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@80..81 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@81..82 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@84..85 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsThisExpression { + this_token: THIS_KW@85..94 "this" [Newline("\n"), Whitespace(" ")] [], + }, + dot_token: DOT@94..95 "." [] [], + member: JsName { + value_token: IDENT@95..97 "b" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@97..99 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@99..100 "b" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@100..101 ";" [] [], + }, + ], + r_curly_token: R_CURLY@101..105 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@105..107 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@107..108 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..108 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..107 + 0: JS_CLASS_DECLARATION@0..52 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..50 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@11..50 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@11..11 + 1: JS_LITERAL_MEMBER_NAME@11..25 + 0: IDENT@11..25 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@25..29 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@26..27 + 0: JS_FORMAL_PARAMETER@26..27 + 0: JS_DECORATOR_LIST@26..26 + 1: JS_IDENTIFIER_BINDING@26..27 + 0: IDENT@26..27 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@27..29 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@29..50 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_DIRECTIVE_LIST@30..30 + 2: JS_STATEMENT_LIST@30..46 + 0: JS_EXPRESSION_STATEMENT@30..46 + 0: JS_ASSIGNMENT_EXPRESSION@30..45 + 0: JS_STATIC_MEMBER_ASSIGNMENT@30..42 + 0: JS_THIS_EXPRESSION@30..39 + 0: THIS_KW@30..39 "this" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@39..40 "." [] [] + 2: JS_NAME@40..42 + 0: IDENT@40..42 "a" [] [Whitespace(" ")] + 1: EQ@42..44 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "a" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 3: R_CURLY@46..50 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@50..52 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@52..107 + 0: JS_DECORATOR_LIST@52..52 + 1: (empty) + 2: CLASS_KW@52..59 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@59..63 + 0: IDENT@59..63 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@63..64 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@64..105 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@64..105 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@64..64 + 1: JS_LITERAL_MEMBER_NAME@64..80 + 0: JS_STRING_LITERAL@64..80 "\"constructor\"" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@80..84 + 0: L_PAREN@80..81 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@81..82 + 0: JS_FORMAL_PARAMETER@81..82 + 0: JS_DECORATOR_LIST@81..81 + 1: JS_IDENTIFIER_BINDING@81..82 + 0: IDENT@81..82 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@84..105 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_DIRECTIVE_LIST@85..85 + 2: JS_STATEMENT_LIST@85..101 + 0: JS_EXPRESSION_STATEMENT@85..101 + 0: JS_ASSIGNMENT_EXPRESSION@85..100 + 0: JS_STATIC_MEMBER_ASSIGNMENT@85..97 + 0: JS_THIS_EXPRESSION@85..94 + 0: THIS_KW@85..94 "this" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@94..95 "." [] [] + 2: JS_NAME@95..97 + 0: IDENT@95..97 "b" [] [Whitespace(" ")] + 1: EQ@97..99 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@99..100 + 0: JS_REFERENCE_IDENTIFIER@99..100 + 0: IDENT@99..100 "b" [] [] + 1: SEMICOLON@100..101 ";" [] [] + 3: R_CURLY@101..105 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@105..107 "}" [Newline("\n")] [] + 4: EOF@107..108 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/continue_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/continue_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js.snap new file mode 100644 index 000000000000..9dd22a37ba92 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js.snap @@ -0,0 +1,130 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +outer: while(true) { +while (true) { + continue; + continue outer; + } + continue +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..5 "outer" [] [], + }, + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + body: JsWhileStatement { + while_token: WHILE_KW@7..12 "while" [] [], + l_paren_token: L_PAREN@12..13 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@13..17 "true" [] [], + }, + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@19..20 "{" [] [], + statements: JsStatementList [ + JsWhileStatement { + while_token: WHILE_KW@20..27 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@27..28 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@28..32 "true" [] [], + }, + r_paren_token: R_PAREN@32..34 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@34..35 "{" [] [], + statements: JsStatementList [ + JsContinueStatement { + continue_token: CONTINUE_KW@35..46 "continue" [Newline("\n"), Whitespace(" ")] [], + label: missing (optional), + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsContinueStatement { + continue_token: CONTINUE_KW@47..61 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + label: JsLabel { + value_token: IDENT@61..66 "outer" [] [], + }, + semicolon_token: SEMICOLON@66..67 ";" [] [], + }, + ], + r_curly_token: R_CURLY@67..72 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + JsContinueStatement { + continue_token: CONTINUE_KW@72..83 "continue" [Newline("\n"), Whitespace(" ")] [], + label: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@83..85 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@85..86 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..86 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..85 + 0: JS_LABELED_STATEMENT@0..85 + 0: JS_LABEL@0..5 + 0: IDENT@0..5 "outer" [] [] + 1: COLON@5..7 ":" [] [Whitespace(" ")] + 2: JS_WHILE_STATEMENT@7..85 + 0: WHILE_KW@7..12 "while" [] [] + 1: L_PAREN@12..13 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@13..17 + 0: TRUE_KW@13..17 "true" [] [] + 3: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@19..85 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_STATEMENT_LIST@20..83 + 0: JS_WHILE_STATEMENT@20..72 + 0: WHILE_KW@20..27 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@27..28 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@28..32 + 0: TRUE_KW@28..32 "true" [] [] + 3: R_PAREN@32..34 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@34..72 + 0: L_CURLY@34..35 "{" [] [] + 1: JS_STATEMENT_LIST@35..67 + 0: JS_CONTINUE_STATEMENT@35..47 + 0: CONTINUE_KW@35..46 "continue" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: SEMICOLON@46..47 ";" [] [] + 1: JS_CONTINUE_STATEMENT@47..67 + 0: CONTINUE_KW@47..61 "continue" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LABEL@61..66 + 0: IDENT@61..66 "outer" [] [] + 2: SEMICOLON@66..67 ";" [] [] + 2: R_CURLY@67..72 "}" [Newline("\n"), Whitespace(" ")] [] + 1: JS_CONTINUE_STATEMENT@72..83 + 0: CONTINUE_KW@72..83 "continue" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 2: R_CURLY@83..85 "}" [Newline("\n")] [] + 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/debugger_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js.snap new file mode 100644 index 000000000000..799691dcee13 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js.snap @@ -0,0 +1,43 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +debugger; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsDebuggerStatement { + debugger_token: DEBUGGER_KW@0..8 "debugger" [] [], + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + ], + eof_token: EOF@9..10 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..10 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..9 + 0: JS_DEBUGGER_STATEMENT@0..9 + 0: DEBUGGER_KW@0..8 "debugger" [] [] + 1: SEMICOLON@8..9 ";" [] [] + 4: EOF@9..10 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts.snap new file mode 100644 index 000000000000..272ff0038727 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts.snap @@ -0,0 +1,1369 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +// class expressions +let a = @decorator class {}; +let b = @decorator @functionDecorator(1,2,3) class {}; +let c = @first @second class Foo {} +// class declarations +@decorator class Foo {}; +@decorator @functionDecorator(1,2,3) class Bar {}; +@first @second class Baz {} +// abstract class declarations +@decorator abstract class Foo {}; +@decorator @functionDecorator(1,2,3) abstract class Bar {}; +@first @second abstract class Baz {} +// exported class declarations +export @decorator class Foo {}; +export @decorator @functionDecorator(1,2,3) class Bar {}; +export @first @second class Baz {} +@decorator +export class Foo { } +@first.field @second @(() => decorator)() +export class Bar {} +@before +export @after class Foo { } +@before.field @before @(() => decorator)() +export @after.field @after @(() => decorator)() class Bar {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..25 "let" [Comments("// class expressions"), Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@25..27 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@27..29 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@29..30 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..40 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + class_token: CLASS_KW@40..46 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@46..47 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@47..48 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@48..49 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@54..56 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@58..59 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..69 "decorator" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@69..70 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@70..87 "functionDecorator" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@87..88 "(" [] [], + args: JsCallArgumentList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@88..89 "1" [] [], + }, + COMMA@89..90 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@90..91 "2" [] [], + }, + COMMA@91..92 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@92..93 "3" [] [], + }, + ], + r_paren_token: R_PAREN@93..95 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + class_token: CLASS_KW@95..101 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@101..102 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@102..103 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@104..109 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@109..111 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@111..113 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@113..114 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@114..120 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@120..121 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@121..128 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + class_token: CLASS_KW@128..134 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@134..138 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@138..139 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@139..140 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@140..164 "@" [Newline("\n"), Comments("// class declarations"), Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@164..174 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@174..180 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@180..184 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@184..185 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@185..186 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@186..187 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@187..189 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@189..199 "decorator" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@199..200 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@200..217 "functionDecorator" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@217..218 "(" [] [], + args: JsCallArgumentList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@218..219 "1" [] [], + }, + COMMA@219..220 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@220..221 "2" [] [], + }, + COMMA@221..222 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@222..223 "3" [] [], + }, + ], + r_paren_token: R_PAREN@223..225 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@225..231 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@231..235 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@235..236 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@236..237 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@237..238 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@238..240 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@240..246 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@246..247 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@247..254 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@254..260 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@260..264 "Baz" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@264..265 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@265..266 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@266..299 "@" [Newline("\n"), Comments("// abstract class dec ..."), Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@299..309 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@309..318 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@318..324 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@324..328 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@328..329 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@329..330 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@330..331 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@331..333 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@333..343 "decorator" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@343..344 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@344..361 "functionDecorator" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@361..362 "(" [] [], + args: JsCallArgumentList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@362..363 "1" [] [], + }, + COMMA@363..364 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@364..365 "2" [] [], + }, + COMMA@365..366 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@366..367 "3" [] [], + }, + ], + r_paren_token: R_PAREN@367..369 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@369..378 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@378..384 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@384..388 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@388..389 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@389..390 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@390..391 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@391..393 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@393..399 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@399..400 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@400..407 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@407..416 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@416..422 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@422..426 "Baz" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@426..427 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@427..428 "}" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@428..467 "export" [Newline("\n"), Comments("// exported class dec ..."), Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@467..468 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@468..478 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@478..484 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@484..488 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@488..489 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@489..490 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@490..491 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@491..499 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@499..500 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@500..510 "decorator" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@510..511 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@511..528 "functionDecorator" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@528..529 "(" [] [], + args: JsCallArgumentList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@529..530 "1" [] [], + }, + COMMA@530..531 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@531..532 "2" [] [], + }, + COMMA@532..533 "," [] [], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@533..534 "3" [] [], + }, + ], + r_paren_token: R_PAREN@534..536 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@536..542 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@542..546 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@546..547 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@547..548 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@548..549 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@549..557 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@557..558 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@558..564 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@564..565 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@565..572 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@572..578 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@578..582 "Baz" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@582..583 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@583..584 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@584..586 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@586..595 "decorator" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@595..603 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@603..609 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@609..613 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@613..615 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@615..616 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@616..618 "@" [Newline("\n")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@618..623 "first" [] [], + }, + }, + operator_token: DOT@623..624 "." [] [], + member: JsName { + value_token: IDENT@624..630 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@630..631 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@631..638 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@638..639 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@639..640 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@640..641 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@641..643 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@643..646 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@646..655 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@655..656 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@656..657 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@657..658 ")" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@658..666 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@666..672 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@672..676 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@676..677 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@677..678 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@678..680 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@680..686 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@686..694 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@694..695 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@695..701 "after" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@701..707 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@707..711 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@711..713 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@713..714 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@714..716 "@" [Newline("\n")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@716..722 "before" [] [], + }, + }, + operator_token: DOT@722..723 "." [] [], + member: JsName { + value_token: IDENT@723..729 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@729..730 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@730..737 "before" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@737..738 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@738..739 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@739..740 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@740..742 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@742..745 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@745..754 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@754..755 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@755..756 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@756..757 ")" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@757..765 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@765..766 "@" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@766..771 "after" [] [], + }, + }, + operator_token: DOT@771..772 "." [] [], + member: JsName { + value_token: IDENT@772..778 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@778..779 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@779..785 "after" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@785..786 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@786..787 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@787..788 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@788..790 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@790..793 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@793..802 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@802..803 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@803..804 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@804..806 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@806..812 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@812..816 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@816..817 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@817..818 "}" [] [], + }, + }, + ], + eof_token: EOF@818..819 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..819 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..818 + 0: JS_VARIABLE_STATEMENT@0..49 + 0: JS_VARIABLE_DECLARATION@0..48 + 0: (empty) + 1: LET_KW@0..25 "let" [Comments("// class expressions"), Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@25..48 + 0: JS_VARIABLE_DECLARATOR@25..48 + 0: JS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@27..48 + 0: EQ@27..29 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@29..48 + 0: JS_DECORATOR_LIST@29..40 + 0: JS_DECORATOR@29..40 + 0: AT@29..30 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@30..40 + 0: JS_REFERENCE_IDENTIFIER@30..40 + 0: IDENT@30..40 "decorator" [] [Whitespace(" ")] + 1: CLASS_KW@40..46 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@46..47 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@47..47 + 8: R_CURLY@47..48 "}" [] [] + 1: SEMICOLON@48..49 ";" [] [] + 1: JS_VARIABLE_STATEMENT@49..104 + 0: JS_VARIABLE_DECLARATION@49..103 + 0: (empty) + 1: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@54..103 + 0: JS_VARIABLE_DECLARATOR@54..103 + 0: JS_IDENTIFIER_BINDING@54..56 + 0: IDENT@54..56 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@56..103 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@58..103 + 0: JS_DECORATOR_LIST@58..95 + 0: JS_DECORATOR@58..69 + 0: AT@58..59 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@59..69 + 0: JS_REFERENCE_IDENTIFIER@59..69 + 0: IDENT@59..69 "decorator" [] [Whitespace(" ")] + 1: JS_DECORATOR@69..95 + 0: AT@69..70 "@" [] [] + 1: JS_CALL_EXPRESSION@70..95 + 0: JS_IDENTIFIER_EXPRESSION@70..87 + 0: JS_REFERENCE_IDENTIFIER@70..87 + 0: IDENT@70..87 "functionDecorator" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@87..95 + 0: L_PAREN@87..88 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@88..93 + 0: JS_NUMBER_LITERAL_EXPRESSION@88..89 + 0: JS_NUMBER_LITERAL@88..89 "1" [] [] + 1: COMMA@89..90 "," [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@90..91 + 0: JS_NUMBER_LITERAL@90..91 "2" [] [] + 3: COMMA@91..92 "," [] [] + 4: JS_NUMBER_LITERAL_EXPRESSION@92..93 + 0: JS_NUMBER_LITERAL@92..93 "3" [] [] + 2: R_PAREN@93..95 ")" [] [Whitespace(" ")] + 1: CLASS_KW@95..101 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@101..102 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@102..102 + 8: R_CURLY@102..103 "}" [] [] + 1: SEMICOLON@103..104 ";" [] [] + 2: JS_VARIABLE_STATEMENT@104..140 + 0: JS_VARIABLE_DECLARATION@104..140 + 0: (empty) + 1: LET_KW@104..109 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@109..140 + 0: JS_VARIABLE_DECLARATOR@109..140 + 0: JS_IDENTIFIER_BINDING@109..111 + 0: IDENT@109..111 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@111..140 + 0: EQ@111..113 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@113..140 + 0: JS_DECORATOR_LIST@113..128 + 0: JS_DECORATOR@113..120 + 0: AT@113..114 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@114..120 + 0: JS_REFERENCE_IDENTIFIER@114..120 + 0: IDENT@114..120 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@120..128 + 0: AT@120..121 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@121..128 + 0: JS_REFERENCE_IDENTIFIER@121..128 + 0: IDENT@121..128 "second" [] [Whitespace(" ")] + 1: CLASS_KW@128..134 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@134..138 + 0: IDENT@134..138 "Foo" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@138..139 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@139..139 + 8: R_CURLY@139..140 "}" [] [] + 1: (empty) + 3: JS_CLASS_DECLARATION@140..186 + 0: JS_DECORATOR_LIST@140..174 + 0: JS_DECORATOR@140..174 + 0: AT@140..164 "@" [Newline("\n"), Comments("// class declarations"), Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@164..174 + 0: JS_REFERENCE_IDENTIFIER@164..174 + 0: IDENT@164..174 "decorator" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@174..180 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@180..184 + 0: IDENT@180..184 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@184..185 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@185..185 + 9: R_CURLY@185..186 "}" [] [] + 4: JS_EMPTY_STATEMENT@186..187 + 0: SEMICOLON@186..187 ";" [] [] + 5: JS_CLASS_DECLARATION@187..237 + 0: JS_DECORATOR_LIST@187..225 + 0: JS_DECORATOR@187..199 + 0: AT@187..189 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@189..199 + 0: JS_REFERENCE_IDENTIFIER@189..199 + 0: IDENT@189..199 "decorator" [] [Whitespace(" ")] + 1: JS_DECORATOR@199..225 + 0: AT@199..200 "@" [] [] + 1: JS_CALL_EXPRESSION@200..225 + 0: JS_IDENTIFIER_EXPRESSION@200..217 + 0: JS_REFERENCE_IDENTIFIER@200..217 + 0: IDENT@200..217 "functionDecorator" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@217..225 + 0: L_PAREN@217..218 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@218..223 + 0: JS_NUMBER_LITERAL_EXPRESSION@218..219 + 0: JS_NUMBER_LITERAL@218..219 "1" [] [] + 1: COMMA@219..220 "," [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@220..221 + 0: JS_NUMBER_LITERAL@220..221 "2" [] [] + 3: COMMA@221..222 "," [] [] + 4: JS_NUMBER_LITERAL_EXPRESSION@222..223 + 0: JS_NUMBER_LITERAL@222..223 "3" [] [] + 2: R_PAREN@223..225 ")" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@225..231 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@231..235 + 0: IDENT@231..235 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@235..236 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@236..236 + 9: R_CURLY@236..237 "}" [] [] + 6: JS_EMPTY_STATEMENT@237..238 + 0: SEMICOLON@237..238 ";" [] [] + 7: JS_CLASS_DECLARATION@238..266 + 0: JS_DECORATOR_LIST@238..254 + 0: JS_DECORATOR@238..246 + 0: AT@238..240 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@240..246 + 0: JS_REFERENCE_IDENTIFIER@240..246 + 0: IDENT@240..246 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@246..254 + 0: AT@246..247 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@247..254 + 0: JS_REFERENCE_IDENTIFIER@247..254 + 0: IDENT@247..254 "second" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@254..260 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@260..264 + 0: IDENT@260..264 "Baz" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@264..265 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@265..265 + 9: R_CURLY@265..266 "}" [] [] + 8: JS_CLASS_DECLARATION@266..330 + 0: JS_DECORATOR_LIST@266..309 + 0: JS_DECORATOR@266..309 + 0: AT@266..299 "@" [Newline("\n"), Comments("// abstract class dec ..."), Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@299..309 + 0: JS_REFERENCE_IDENTIFIER@299..309 + 0: IDENT@299..309 "decorator" [] [Whitespace(" ")] + 1: ABSTRACT_KW@309..318 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@318..324 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@324..328 + 0: IDENT@324..328 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@328..329 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@329..329 + 9: R_CURLY@329..330 "}" [] [] + 9: JS_EMPTY_STATEMENT@330..331 + 0: SEMICOLON@330..331 ";" [] [] + 10: JS_CLASS_DECLARATION@331..390 + 0: JS_DECORATOR_LIST@331..369 + 0: JS_DECORATOR@331..343 + 0: AT@331..333 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@333..343 + 0: JS_REFERENCE_IDENTIFIER@333..343 + 0: IDENT@333..343 "decorator" [] [Whitespace(" ")] + 1: JS_DECORATOR@343..369 + 0: AT@343..344 "@" [] [] + 1: JS_CALL_EXPRESSION@344..369 + 0: JS_IDENTIFIER_EXPRESSION@344..361 + 0: JS_REFERENCE_IDENTIFIER@344..361 + 0: IDENT@344..361 "functionDecorator" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@361..369 + 0: L_PAREN@361..362 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@362..367 + 0: JS_NUMBER_LITERAL_EXPRESSION@362..363 + 0: JS_NUMBER_LITERAL@362..363 "1" [] [] + 1: COMMA@363..364 "," [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@364..365 + 0: JS_NUMBER_LITERAL@364..365 "2" [] [] + 3: COMMA@365..366 "," [] [] + 4: JS_NUMBER_LITERAL_EXPRESSION@366..367 + 0: JS_NUMBER_LITERAL@366..367 "3" [] [] + 2: R_PAREN@367..369 ")" [] [Whitespace(" ")] + 1: ABSTRACT_KW@369..378 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@378..384 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@384..388 + 0: IDENT@384..388 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@388..389 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@389..389 + 9: R_CURLY@389..390 "}" [] [] + 11: JS_EMPTY_STATEMENT@390..391 + 0: SEMICOLON@390..391 ";" [] [] + 12: JS_CLASS_DECLARATION@391..428 + 0: JS_DECORATOR_LIST@391..407 + 0: JS_DECORATOR@391..399 + 0: AT@391..393 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@393..399 + 0: JS_REFERENCE_IDENTIFIER@393..399 + 0: IDENT@393..399 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@399..407 + 0: AT@399..400 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@400..407 + 0: JS_REFERENCE_IDENTIFIER@400..407 + 0: IDENT@400..407 "second" [] [Whitespace(" ")] + 1: ABSTRACT_KW@407..416 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@416..422 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@422..426 + 0: IDENT@422..426 "Baz" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@426..427 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@427..427 + 9: R_CURLY@427..428 "}" [] [] + 13: JS_EXPORT@428..490 + 0: JS_DECORATOR_LIST@428..428 + 1: EXPORT_KW@428..467 "export" [Newline("\n"), Comments("// exported class dec ..."), Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@467..490 + 0: JS_DECORATOR_LIST@467..478 + 0: JS_DECORATOR@467..478 + 0: AT@467..468 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@468..478 + 0: JS_REFERENCE_IDENTIFIER@468..478 + 0: IDENT@468..478 "decorator" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@478..484 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@484..488 + 0: IDENT@484..488 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@488..489 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@489..489 + 9: R_CURLY@489..490 "}" [] [] + 14: JS_EMPTY_STATEMENT@490..491 + 0: SEMICOLON@490..491 ";" [] [] + 15: JS_EXPORT@491..548 + 0: JS_DECORATOR_LIST@491..491 + 1: EXPORT_KW@491..499 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@499..548 + 0: JS_DECORATOR_LIST@499..536 + 0: JS_DECORATOR@499..510 + 0: AT@499..500 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@500..510 + 0: JS_REFERENCE_IDENTIFIER@500..510 + 0: IDENT@500..510 "decorator" [] [Whitespace(" ")] + 1: JS_DECORATOR@510..536 + 0: AT@510..511 "@" [] [] + 1: JS_CALL_EXPRESSION@511..536 + 0: JS_IDENTIFIER_EXPRESSION@511..528 + 0: JS_REFERENCE_IDENTIFIER@511..528 + 0: IDENT@511..528 "functionDecorator" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@528..536 + 0: L_PAREN@528..529 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@529..534 + 0: JS_NUMBER_LITERAL_EXPRESSION@529..530 + 0: JS_NUMBER_LITERAL@529..530 "1" [] [] + 1: COMMA@530..531 "," [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@531..532 + 0: JS_NUMBER_LITERAL@531..532 "2" [] [] + 3: COMMA@532..533 "," [] [] + 4: JS_NUMBER_LITERAL_EXPRESSION@533..534 + 0: JS_NUMBER_LITERAL@533..534 "3" [] [] + 2: R_PAREN@534..536 ")" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@536..542 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@542..546 + 0: IDENT@542..546 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@546..547 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@547..547 + 9: R_CURLY@547..548 "}" [] [] + 16: JS_EMPTY_STATEMENT@548..549 + 0: SEMICOLON@548..549 ";" [] [] + 17: JS_EXPORT@549..584 + 0: JS_DECORATOR_LIST@549..549 + 1: EXPORT_KW@549..557 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@557..584 + 0: JS_DECORATOR_LIST@557..572 + 0: JS_DECORATOR@557..564 + 0: AT@557..558 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@558..564 + 0: JS_REFERENCE_IDENTIFIER@558..564 + 0: IDENT@558..564 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@564..572 + 0: AT@564..565 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@565..572 + 0: JS_REFERENCE_IDENTIFIER@565..572 + 0: IDENT@565..572 "second" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@572..578 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@578..582 + 0: IDENT@578..582 "Baz" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@582..583 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@583..583 + 9: R_CURLY@583..584 "}" [] [] + 18: JS_EXPORT@584..616 + 0: JS_DECORATOR_LIST@584..595 + 0: JS_DECORATOR@584..595 + 0: AT@584..586 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@586..595 + 0: JS_REFERENCE_IDENTIFIER@586..595 + 0: IDENT@586..595 "decorator" [] [] + 1: EXPORT_KW@595..603 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@603..616 + 0: JS_DECORATOR_LIST@603..603 + 1: (empty) + 2: CLASS_KW@603..609 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@609..613 + 0: IDENT@609..613 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@613..615 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@615..615 + 9: R_CURLY@615..616 "}" [] [] + 19: JS_EXPORT@616..678 + 0: JS_DECORATOR_LIST@616..658 + 0: JS_DECORATOR@616..630 + 0: AT@616..618 "@" [Newline("\n")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@618..630 + 0: JS_IDENTIFIER_EXPRESSION@618..623 + 0: JS_REFERENCE_IDENTIFIER@618..623 + 0: IDENT@618..623 "first" [] [] + 1: DOT@623..624 "." [] [] + 2: JS_NAME@624..630 + 0: IDENT@624..630 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@630..638 + 0: AT@630..631 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@631..638 + 0: JS_REFERENCE_IDENTIFIER@631..638 + 0: IDENT@631..638 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@638..658 + 0: AT@638..639 "@" [] [] + 1: JS_CALL_EXPRESSION@639..658 + 0: JS_PARENTHESIZED_EXPRESSION@639..656 + 0: L_PAREN@639..640 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@640..655 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@640..643 + 0: L_PAREN@640..641 "(" [] [] + 1: JS_PARAMETER_LIST@641..641 + 2: R_PAREN@641..643 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@643..646 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@646..655 + 0: JS_REFERENCE_IDENTIFIER@646..655 + 0: IDENT@646..655 "decorator" [] [] + 2: R_PAREN@655..656 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@656..658 + 0: L_PAREN@656..657 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@657..657 + 2: R_PAREN@657..658 ")" [] [] + 1: EXPORT_KW@658..666 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@666..678 + 0: JS_DECORATOR_LIST@666..666 + 1: (empty) + 2: CLASS_KW@666..672 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@672..676 + 0: IDENT@672..676 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@676..677 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@677..677 + 9: R_CURLY@677..678 "}" [] [] + 20: JS_EXPORT@678..714 + 0: JS_DECORATOR_LIST@678..686 + 0: JS_DECORATOR@678..686 + 0: AT@678..680 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@680..686 + 0: JS_REFERENCE_IDENTIFIER@680..686 + 0: IDENT@680..686 "before" [] [] + 1: EXPORT_KW@686..694 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@694..714 + 0: JS_DECORATOR_LIST@694..701 + 0: JS_DECORATOR@694..701 + 0: AT@694..695 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@695..701 + 0: JS_REFERENCE_IDENTIFIER@695..701 + 0: IDENT@695..701 "after" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@701..707 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@707..711 + 0: IDENT@707..711 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@711..713 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@713..713 + 9: R_CURLY@713..714 "}" [] [] + 21: JS_EXPORT@714..818 + 0: JS_DECORATOR_LIST@714..757 + 0: JS_DECORATOR@714..729 + 0: AT@714..716 "@" [Newline("\n")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@716..729 + 0: JS_IDENTIFIER_EXPRESSION@716..722 + 0: JS_REFERENCE_IDENTIFIER@716..722 + 0: IDENT@716..722 "before" [] [] + 1: DOT@722..723 "." [] [] + 2: JS_NAME@723..729 + 0: IDENT@723..729 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@729..737 + 0: AT@729..730 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@730..737 + 0: JS_REFERENCE_IDENTIFIER@730..737 + 0: IDENT@730..737 "before" [] [Whitespace(" ")] + 2: JS_DECORATOR@737..757 + 0: AT@737..738 "@" [] [] + 1: JS_CALL_EXPRESSION@738..757 + 0: JS_PARENTHESIZED_EXPRESSION@738..755 + 0: L_PAREN@738..739 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@739..754 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@739..742 + 0: L_PAREN@739..740 "(" [] [] + 1: JS_PARAMETER_LIST@740..740 + 2: R_PAREN@740..742 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@742..745 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@745..754 + 0: JS_REFERENCE_IDENTIFIER@745..754 + 0: IDENT@745..754 "decorator" [] [] + 2: R_PAREN@754..755 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@755..757 + 0: L_PAREN@755..756 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@756..756 + 2: R_PAREN@756..757 ")" [] [] + 1: EXPORT_KW@757..765 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@765..818 + 0: JS_DECORATOR_LIST@765..806 + 0: JS_DECORATOR@765..778 + 0: AT@765..766 "@" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@766..778 + 0: JS_IDENTIFIER_EXPRESSION@766..771 + 0: JS_REFERENCE_IDENTIFIER@766..771 + 0: IDENT@766..771 "after" [] [] + 1: DOT@771..772 "." [] [] + 2: JS_NAME@772..778 + 0: IDENT@772..778 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@778..785 + 0: AT@778..779 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@779..785 + 0: JS_REFERENCE_IDENTIFIER@779..785 + 0: IDENT@779..785 "after" [] [Whitespace(" ")] + 2: JS_DECORATOR@785..806 + 0: AT@785..786 "@" [] [] + 1: JS_CALL_EXPRESSION@786..806 + 0: JS_PARENTHESIZED_EXPRESSION@786..803 + 0: L_PAREN@786..787 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@787..802 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@787..790 + 0: L_PAREN@787..788 "(" [] [] + 1: JS_PARAMETER_LIST@788..788 + 2: R_PAREN@788..790 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@790..793 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@793..802 + 0: JS_REFERENCE_IDENTIFIER@793..802 + 0: IDENT@793..802 "decorator" [] [] + 2: R_PAREN@802..803 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@803..806 + 0: L_PAREN@803..804 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@804..804 + 2: R_PAREN@804..806 ")" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@806..812 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@812..816 + 0: IDENT@812..816 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@816..817 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@817..817 + 9: R_CURLY@817..818 "}" [] [] + 4: EOF@818..819 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap new file mode 100644 index 000000000000..bf51612b5d82 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap @@ -0,0 +1,238 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function foo() { + @decorator abstract class A {} + @first.field @second @(() => decorator)() + abstract class Bar {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..33 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@33..42 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@42..48 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@48..50 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@50..51 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@52..59 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..64 "first" [] [], + }, + }, + operator_token: DOT@64..65 "." [] [], + member: JsName { + value_token: IDENT@65..71 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@71..72 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@72..79 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@79..80 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@80..81 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@81..82 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@87..96 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@96..97 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@97..98 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@98..99 ")" [] [], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@99..114 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + class_token: CLASS_KW@114..120 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@120..124 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@124..125 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + ], + r_curly_token: R_CURLY@126..128 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@128..129 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..129 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..128 + 0: JS_FUNCTION_DECLARATION@0..128 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..128 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..126 + 0: JS_CLASS_DECLARATION@16..52 + 0: JS_DECORATOR_LIST@16..33 + 0: JS_DECORATOR@16..33 + 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@23..33 + 0: JS_REFERENCE_IDENTIFIER@23..33 + 0: IDENT@23..33 "decorator" [] [Whitespace(" ")] + 1: ABSTRACT_KW@33..42 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@42..48 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@48..50 + 0: IDENT@48..50 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@50..51 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@51..51 + 9: R_CURLY@51..52 "}" [] [] + 1: JS_CLASS_DECLARATION@52..126 + 0: JS_DECORATOR_LIST@52..99 + 0: JS_DECORATOR@52..71 + 0: AT@52..59 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@59..71 + 0: JS_IDENTIFIER_EXPRESSION@59..64 + 0: JS_REFERENCE_IDENTIFIER@59..64 + 0: IDENT@59..64 "first" [] [] + 1: DOT@64..65 "." [] [] + 2: JS_NAME@65..71 + 0: IDENT@65..71 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@71..79 + 0: AT@71..72 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@72..79 + 0: JS_REFERENCE_IDENTIFIER@72..79 + 0: IDENT@72..79 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@79..99 + 0: AT@79..80 "@" [] [] + 1: JS_CALL_EXPRESSION@80..99 + 0: JS_PARENTHESIZED_EXPRESSION@80..97 + 0: L_PAREN@80..81 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@81..96 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@81..84 + 0: L_PAREN@81..82 "(" [] [] + 1: JS_PARAMETER_LIST@82..82 + 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@87..96 + 0: JS_REFERENCE_IDENTIFIER@87..96 + 0: IDENT@87..96 "decorator" [] [] + 2: R_PAREN@96..97 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@97..99 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@98..98 + 2: R_PAREN@98..99 ")" [] [] + 1: ABSTRACT_KW@99..114 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: CLASS_KW@114..120 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@120..124 + 0: IDENT@120..124 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@124..125 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@125..125 + 9: R_CURLY@125..126 "}" [] [] + 3: R_CURLY@126..128 "}" [Newline("\n")] [] + 4: EOF@128..129 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap new file mode 100644 index 000000000000..f93dd93ee5d8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap @@ -0,0 +1,197 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator abstract class A {} +@first.field @second @(() => decorator)() +abstract class Bar {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..11 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@11..20 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@20..26 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@26..28 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@28..29 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@30..32 "@" [Newline("\n")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..37 "first" [] [], + }, + }, + operator_token: DOT@37..38 "." [] [], + member: JsName { + value_token: IDENT@38..44 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@44..45 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..52 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@52..53 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@53..54 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@54..55 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@55..57 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@57..60 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@60..69 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@69..70 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@70..71 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@71..72 ")" [] [], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@72..82 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@82..88 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@88..92 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@92..93 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@93..94 "}" [] [], + }, + ], + eof_token: EOF@94..95 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..95 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..94 + 0: JS_CLASS_DECLARATION@0..30 + 0: JS_DECORATOR_LIST@0..11 + 0: JS_DECORATOR@0..11 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..11 + 0: JS_REFERENCE_IDENTIFIER@1..11 + 0: IDENT@1..11 "decorator" [] [Whitespace(" ")] + 1: ABSTRACT_KW@11..20 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@20..26 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@28..29 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@29..29 + 9: R_CURLY@29..30 "}" [] [] + 1: JS_CLASS_DECLARATION@30..94 + 0: JS_DECORATOR_LIST@30..72 + 0: JS_DECORATOR@30..44 + 0: AT@30..32 "@" [Newline("\n")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@32..44 + 0: JS_IDENTIFIER_EXPRESSION@32..37 + 0: JS_REFERENCE_IDENTIFIER@32..37 + 0: IDENT@32..37 "first" [] [] + 1: DOT@37..38 "." [] [] + 2: JS_NAME@38..44 + 0: IDENT@38..44 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@44..52 + 0: AT@44..45 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@45..52 + 0: JS_REFERENCE_IDENTIFIER@45..52 + 0: IDENT@45..52 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@52..72 + 0: AT@52..53 "@" [] [] + 1: JS_CALL_EXPRESSION@53..72 + 0: JS_PARENTHESIZED_EXPRESSION@53..70 + 0: L_PAREN@53..54 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@54..69 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@54..57 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_PARAMETER_LIST@55..55 + 2: R_PAREN@55..57 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@57..60 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@60..69 + 0: JS_REFERENCE_IDENTIFIER@60..69 + 0: IDENT@60..69 "decorator" [] [] + 2: R_PAREN@69..70 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@70..72 + 0: L_PAREN@70..71 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@71..71 + 2: R_PAREN@71..72 ")" [] [] + 1: ABSTRACT_KW@72..82 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@82..88 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@88..92 + 0: IDENT@88..92 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@92..93 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@93..93 + 9: R_CURLY@93..94 "}" [] [] + 4: EOF@94..95 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap new file mode 100644 index 000000000000..c0786eb0dad3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default abstract class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@26..35 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@35..41 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@41..45 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@47..48 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@48..49 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..49 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..48 + 0: JS_EXPORT@0..48 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..48 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@26..48 + 0: JS_DECORATOR_LIST@26..26 + 1: ABSTRACT_KW@26..35 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@35..41 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@41..45 + 0: IDENT@41..45 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..47 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@47..47 + 9: R_CURLY@47..48 "}" [] [] + 2: (empty) + 4: EOF@48..49 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js.snap new file mode 100644 index 000000000000..d1edfb328cbc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js.snap @@ -0,0 +1,239 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { + @decorator + class Foo { } + @first.field @second @(() => decorator)() + class Bar {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..32 "decorator" [] [], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@32..44 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@44..48 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@51..58 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@58..63 "first" [] [], + }, + }, + operator_token: DOT@63..64 "." [] [], + member: JsName { + value_token: IDENT@64..70 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@70..71 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@71..78 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@78..79 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@79..80 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@80..81 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@83..86 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@86..95 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@95..96 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@96..97 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@97..98 ")" [] [], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@98..110 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@110..114 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@114..115 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@115..116 "}" [] [], + }, + ], + r_curly_token: R_CURLY@116..118 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@118..119 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..119 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..118 + 0: JS_FUNCTION_DECLARATION@0..118 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..118 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..116 + 0: JS_CLASS_DECLARATION@16..51 + 0: JS_DECORATOR_LIST@16..32 + 0: JS_DECORATOR@16..32 + 0: AT@16..23 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@23..32 + 0: JS_REFERENCE_IDENTIFIER@23..32 + 0: IDENT@23..32 "decorator" [] [] + 1: (empty) + 2: CLASS_KW@32..44 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@44..48 + 0: IDENT@44..48 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@48..50 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@50..50 + 9: R_CURLY@50..51 "}" [] [] + 1: JS_CLASS_DECLARATION@51..116 + 0: JS_DECORATOR_LIST@51..98 + 0: JS_DECORATOR@51..70 + 0: AT@51..58 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@58..70 + 0: JS_IDENTIFIER_EXPRESSION@58..63 + 0: JS_REFERENCE_IDENTIFIER@58..63 + 0: IDENT@58..63 "first" [] [] + 1: DOT@63..64 "." [] [] + 2: JS_NAME@64..70 + 0: IDENT@64..70 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@70..78 + 0: AT@70..71 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@71..78 + 0: JS_REFERENCE_IDENTIFIER@71..78 + 0: IDENT@71..78 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@78..98 + 0: AT@78..79 "@" [] [] + 1: JS_CALL_EXPRESSION@79..98 + 0: JS_PARENTHESIZED_EXPRESSION@79..96 + 0: L_PAREN@79..80 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@80..95 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@80..83 + 0: L_PAREN@80..81 "(" [] [] + 1: JS_PARAMETER_LIST@81..81 + 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@83..86 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@86..95 + 0: JS_REFERENCE_IDENTIFIER@86..95 + 0: IDENT@86..95 "decorator" [] [] + 2: R_PAREN@95..96 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@96..98 + 0: L_PAREN@96..97 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@97..97 + 2: R_PAREN@97..98 ")" [] [] + 1: (empty) + 2: CLASS_KW@98..110 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@110..114 + 0: IDENT@110..114 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@114..115 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@115..115 + 9: R_CURLY@115..116 "}" [] [] + 3: R_CURLY@116..118 "}" [Newline("\n")] [] + 4: EOF@118..119 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap new file mode 100644 index 000000000000..77d3ff5a210b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap @@ -0,0 +1,198 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +class Foo { } +@first.field @second @(() => decorator)() +class Bar {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@17..21 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@24..26 "@" [Newline("\n")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..31 "first" [] [], + }, + }, + operator_token: DOT@31..32 "." [] [], + member: JsName { + value_token: IDENT@32..38 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@38..39 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@39..46 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@46..47 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@47..48 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@48..49 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@54..63 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@63..64 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@64..65 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@65..66 ")" [] [], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@66..73 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@73..77 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@77..78 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@78..79 "}" [] [], + }, + ], + eof_token: EOF@79..80 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..80 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..79 + 0: JS_CLASS_DECLARATION@0..24 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: (empty) + 2: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@17..21 + 0: IDENT@17..21 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@21..23 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@23..23 + 9: R_CURLY@23..24 "}" [] [] + 1: JS_CLASS_DECLARATION@24..79 + 0: JS_DECORATOR_LIST@24..66 + 0: JS_DECORATOR@24..38 + 0: AT@24..26 "@" [Newline("\n")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@26..38 + 0: JS_IDENTIFIER_EXPRESSION@26..31 + 0: JS_REFERENCE_IDENTIFIER@26..31 + 0: IDENT@26..31 "first" [] [] + 1: DOT@31..32 "." [] [] + 2: JS_NAME@32..38 + 0: IDENT@32..38 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@38..46 + 0: AT@38..39 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@39..46 + 0: JS_REFERENCE_IDENTIFIER@39..46 + 0: IDENT@39..46 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@46..66 + 0: AT@46..47 "@" [] [] + 1: JS_CALL_EXPRESSION@47..66 + 0: JS_PARENTHESIZED_EXPRESSION@47..64 + 0: L_PAREN@47..48 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@48..63 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@48..51 + 0: L_PAREN@48..49 "(" [] [] + 1: JS_PARAMETER_LIST@49..49 + 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@51..54 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@54..63 + 0: JS_REFERENCE_IDENTIFIER@54..63 + 0: IDENT@54..63 "decorator" [] [] + 2: R_PAREN@63..64 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@64..66 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@65..65 + 2: R_PAREN@65..66 ")" [] [] + 1: (empty) + 2: CLASS_KW@66..73 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@73..77 + 0: IDENT@73..77 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@77..78 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@78..78 + 9: R_CURLY@78..79 "}" [] [] + 4: EOF@79..80 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap new file mode 100644 index 000000000000..f432a1761b26 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@32..36 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@36..38 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_EXPORT@0..39 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..39 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@26..39 + 0: JS_DECORATOR_LIST@26..26 + 1: (empty) + 2: CLASS_KW@26..32 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@32..36 + 0: IDENT@32..36 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@36..38 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@38..38 + 9: R_CURLY@38..39 "}" [] [] + 2: (empty) + 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts.snap new file mode 100644 index 000000000000..706946ea79c4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts.snap @@ -0,0 +1,2920 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { +// properties +@dec foo = 2; +@dec @(await dec) @dec() foo = 2; +@dec public foo = 1; +@dec @(await dec) @dec() public foo = 1; +@dec static foo = 2; +@dec @(await dec) @dec() static foo = 2; +@dec accessor foo = 2; +@dec @(await dec) @dec() accessor foo = 2; +@dec readonly foo = 2; +@dec @(await dec) @dec() readonly foo = 2; +@dec override foo = 2; +@dec @(await dec) @dec() override foo = 2; +// methods +@dec foo() {} +@dec @(await dec) @dec() foo() {} +@dec public foo() {} +@dec @(await dec) @dec() public foo() {} +@dec static foo() {} +@dec @(await dec) @dec() static foo() {} +@dec override foo() {} +@dec @(await dec) @dec() override foo() {} +// getters +@dec get foo() {} +@dec @(await dec) @dec() get foo() {} +@dec public get foo() {} +@dec @(await dec) @dec() public get foo() {} +@dec static get foo() {} +@dec @(await dec) @dec() static get foo() {} +@dec override get foo() {} +@dec @(await dec) @dec() override get foo() {} +// setters +@dec set foo(val) {} +@dec @(await dec) @dec() set foo(val) {} +@dec public set foo(val) {} +@dec @(await dec) @dec() public set foo(val) {} +@dec static set foo(val) {} +@dec @(await dec) @dec() static set foo(val) {} +@dec override set foo(val) {} +@dec @(await dec) @dec() override set foo(val) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@11..27 "@" [Newline("\n"), Comments("// properties"), Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..31 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + name: JsLiteralMemberName { + value: IDENT@31..35 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@35..37 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@37..38 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@39..41 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..45 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@45..46 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@46..47 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@47..53 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..56 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@58..59 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..62 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@62..63 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + name: JsLiteralMemberName { + value: IDENT@65..69 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@69..71 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@71..72 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@72..73 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@73..75 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@75..79 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@79..86 "public" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@86..90 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@90..92 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@92..93 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@93..94 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@94..96 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@96..100 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@100..101 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@101..102 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@102..108 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@108..111 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@111..113 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@113..114 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@114..117 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@117..118 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@118..120 ")" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@120..127 "public" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@127..131 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@131..133 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@133..134 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@134..135 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@135..137 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..141 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@141..148 "static" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@148..152 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@152..154 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@154..155 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@155..156 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@156..158 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@158..162 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@162..163 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@163..164 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@164..170 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@170..173 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@173..175 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@175..176 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@176..179 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@179..180 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@180..182 ")" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@182..189 "static" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@189..193 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@193..195 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@195..196 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@196..197 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@197..199 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@199..203 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@203..212 "accessor" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@212..216 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@216..218 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@218..219 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@219..220 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@220..222 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@222..226 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@226..227 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@227..228 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@228..234 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@234..237 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@237..239 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@239..240 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@240..243 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@243..244 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@244..246 ")" [] [Whitespace(" ")], + }, + }, + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@246..255 "accessor" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@255..259 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@259..261 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@261..262 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@262..263 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@263..265 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@265..269 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@269..278 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@278..282 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@282..284 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@284..285 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@285..286 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@286..288 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@288..292 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@292..293 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@293..294 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@294..300 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@300..303 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@303..305 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@305..306 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@306..309 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@309..310 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@310..312 ")" [] [Whitespace(" ")], + }, + }, + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@312..321 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@321..325 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@325..327 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@327..328 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@328..329 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@329..331 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@331..335 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@335..344 "override" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@344..348 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@348..350 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@350..351 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@351..352 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@352..354 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@354..358 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@358..359 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@359..360 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@360..366 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@366..369 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@369..371 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@371..372 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@372..375 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@375..376 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@376..378 ")" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@378..387 "override" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@387..391 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@391..393 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@393..394 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@394..395 ";" [] [], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@395..408 "@" [Newline("\n"), Comments("// methods"), Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@408..412 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@412..415 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@415..416 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@416..418 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@418..419 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@419..420 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@420..422 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@422..426 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@426..427 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@427..428 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@428..434 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@434..437 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@437..439 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@439..440 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@440..443 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@443..444 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@444..446 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@446..449 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@449..450 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@450..452 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@452..453 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@453..454 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@454..456 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@456..460 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@460..467 "public" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@467..470 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@470..471 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@471..473 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@473..474 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@474..475 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@475..477 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@477..481 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@481..482 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@482..483 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@483..489 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@489..492 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@492..494 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@494..495 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@495..498 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@498..499 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@499..501 ")" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@501..508 "public" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@508..511 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@511..512 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@512..514 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@514..515 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@515..516 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@516..518 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@518..522 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@522..529 "static" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@529..532 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@532..533 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@533..535 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@535..536 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@536..537 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@537..539 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@539..543 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@543..544 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@544..545 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@545..551 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@551..554 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@554..556 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@556..557 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@557..560 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@560..561 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@561..563 ")" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@563..570 "static" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@570..573 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@573..574 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@574..576 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@576..577 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@577..578 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@578..580 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@580..584 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@584..593 "override" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@593..596 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@596..597 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@597..599 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@599..600 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@600..601 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@601..603 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@603..607 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@607..608 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@608..609 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@609..615 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@615..618 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@618..620 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@620..621 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@621..624 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@624..625 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@625..627 ")" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@627..636 "override" [] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@636..639 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@639..640 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@640..642 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@642..643 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@643..644 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@644..657 "@" [Newline("\n"), Comments("// getters"), Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@657..661 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + get_token: GET_KW@661..665 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@665..668 "foo" [] [], + }, + l_paren_token: L_PAREN@668..669 "(" [] [], + r_paren_token: R_PAREN@669..671 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@671..672 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@672..673 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@673..675 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@675..679 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@679..680 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@680..681 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@681..687 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@687..690 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@690..692 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@692..693 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@693..696 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@696..697 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@697..699 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + get_token: GET_KW@699..703 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@703..706 "foo" [] [], + }, + l_paren_token: L_PAREN@706..707 "(" [] [], + r_paren_token: R_PAREN@707..709 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@709..710 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@710..711 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@711..713 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@713..717 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@717..724 "public" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@724..728 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@728..731 "foo" [] [], + }, + l_paren_token: L_PAREN@731..732 "(" [] [], + r_paren_token: R_PAREN@732..734 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@734..735 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@735..736 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@736..738 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@738..742 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@742..743 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@743..744 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@744..750 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@750..753 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@753..755 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@755..756 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@756..759 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@759..760 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@760..762 ")" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@762..769 "public" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@769..773 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@773..776 "foo" [] [], + }, + l_paren_token: L_PAREN@776..777 "(" [] [], + r_paren_token: R_PAREN@777..779 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@779..780 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@780..781 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@781..783 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@783..787 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@787..794 "static" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@794..798 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@798..801 "foo" [] [], + }, + l_paren_token: L_PAREN@801..802 "(" [] [], + r_paren_token: R_PAREN@802..804 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@804..805 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@805..806 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@806..808 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@808..812 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@812..813 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@813..814 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@814..820 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@820..823 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@823..825 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@825..826 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@826..829 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@829..830 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@830..832 ")" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@832..839 "static" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@839..843 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@843..846 "foo" [] [], + }, + l_paren_token: L_PAREN@846..847 "(" [] [], + r_paren_token: R_PAREN@847..849 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@849..850 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@850..851 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@851..853 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@853..857 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@857..866 "override" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@866..870 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@870..873 "foo" [] [], + }, + l_paren_token: L_PAREN@873..874 "(" [] [], + r_paren_token: R_PAREN@874..876 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@876..877 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@877..878 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@878..880 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@880..884 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@884..885 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@885..886 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@886..892 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@892..895 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@895..897 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@897..898 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@898..901 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@901..902 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@902..904 ")" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@904..913 "override" [] [Whitespace(" ")], + }, + ], + get_token: GET_KW@913..917 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@917..920 "foo" [] [], + }, + l_paren_token: L_PAREN@920..921 "(" [] [], + r_paren_token: R_PAREN@921..923 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@923..924 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@924..925 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@925..938 "@" [Newline("\n"), Comments("// setters"), Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@938..942 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + set_token: SET_KW@942..946 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@946..949 "foo" [] [], + }, + l_paren_token: L_PAREN@949..950 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@950..953 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@953..955 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@955..956 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@956..957 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@957..959 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@959..963 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@963..964 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@964..965 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@965..971 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@971..974 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@974..976 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@976..977 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@977..980 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@980..981 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@981..983 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + set_token: SET_KW@983..987 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@987..990 "foo" [] [], + }, + l_paren_token: L_PAREN@990..991 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@991..994 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@994..996 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@996..997 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@997..998 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@998..1000 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1000..1004 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@1004..1011 "public" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@1011..1015 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@1015..1018 "foo" [] [], + }, + l_paren_token: L_PAREN@1018..1019 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1019..1022 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@1022..1024 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@1024..1025 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1025..1026 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@1026..1028 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1028..1032 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@1032..1033 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@1033..1034 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@1034..1040 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1040..1043 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@1043..1045 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@1045..1046 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1046..1049 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@1049..1050 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@1050..1052 ")" [] [Whitespace(" ")], + }, + }, + }, + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@1052..1059 "public" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@1059..1063 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@1063..1066 "foo" [] [], + }, + l_paren_token: L_PAREN@1066..1067 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1067..1070 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@1070..1072 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@1072..1073 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1073..1074 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@1074..1076 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1076..1080 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@1080..1087 "static" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@1087..1091 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@1091..1094 "foo" [] [], + }, + l_paren_token: L_PAREN@1094..1095 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1095..1098 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@1098..1100 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@1100..1101 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1101..1102 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@1102..1104 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1104..1108 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@1108..1109 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@1109..1110 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@1110..1116 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1116..1119 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@1119..1121 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@1121..1122 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1122..1125 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@1125..1126 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@1126..1128 ")" [] [Whitespace(" ")], + }, + }, + }, + JsStaticModifier { + modifier_token: STATIC_KW@1128..1135 "static" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@1135..1139 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@1139..1142 "foo" [] [], + }, + l_paren_token: L_PAREN@1142..1143 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1143..1146 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@1146..1148 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@1148..1149 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1149..1150 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@1150..1152 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1152..1156 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@1156..1165 "override" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@1165..1169 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@1169..1172 "foo" [] [], + }, + l_paren_token: L_PAREN@1172..1173 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1173..1176 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@1176..1178 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@1178..1179 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1179..1180 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@1180..1182 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1182..1186 "dec" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@1186..1187 "@" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@1187..1188 "(" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@1188..1194 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1194..1197 "dec" [] [], + }, + }, + }, + r_paren_token: R_PAREN@1197..1199 ")" [] [Whitespace(" ")], + }, + }, + JsDecorator { + at_token: AT@1199..1200 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1200..1203 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@1203..1204 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@1204..1206 ")" [] [Whitespace(" ")], + }, + }, + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@1206..1215 "override" [] [Whitespace(" ")], + }, + ], + set_token: SET_KW@1215..1219 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@1219..1222 "foo" [] [], + }, + l_paren_token: L_PAREN@1222..1223 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1223..1226 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@1226..1228 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@1228..1229 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1229..1230 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@1230..1232 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@1232..1233 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..1233 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..1232 + 0: JS_CLASS_DECLARATION@0..1232 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..1230 + 0: JS_PROPERTY_CLASS_MEMBER@11..39 + 0: JS_PROPERTY_MODIFIER_LIST@11..31 + 0: JS_DECORATOR@11..31 + 0: AT@11..27 "@" [Newline("\n"), Comments("// properties"), Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@27..31 + 0: JS_REFERENCE_IDENTIFIER@27..31 + 0: IDENT@27..31 "dec" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@31..35 + 0: IDENT@31..35 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@35..38 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@37..38 + 0: JS_NUMBER_LITERAL@37..38 "2" [] [] + 4: SEMICOLON@38..39 ";" [] [] + 1: JS_PROPERTY_CLASS_MEMBER@39..73 + 0: JS_PROPERTY_MODIFIER_LIST@39..65 + 0: JS_DECORATOR@39..45 + 0: AT@39..41 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@41..45 + 0: JS_REFERENCE_IDENTIFIER@41..45 + 0: IDENT@41..45 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@45..58 + 0: AT@45..46 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@46..58 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_AWAIT_EXPRESSION@47..56 + 0: AWAIT_KW@47..53 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@53..56 + 0: JS_REFERENCE_IDENTIFIER@53..56 + 0: IDENT@53..56 "dec" [] [] + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@58..65 + 0: AT@58..59 "@" [] [] + 1: JS_CALL_EXPRESSION@59..65 + 0: JS_IDENTIFIER_EXPRESSION@59..62 + 0: JS_REFERENCE_IDENTIFIER@59..62 + 0: IDENT@59..62 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@62..65 + 0: L_PAREN@62..63 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@63..63 + 2: R_PAREN@63..65 ")" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@65..69 + 0: IDENT@65..69 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@69..72 + 0: EQ@69..71 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@71..72 + 0: JS_NUMBER_LITERAL@71..72 "2" [] [] + 4: SEMICOLON@72..73 ";" [] [] + 2: JS_PROPERTY_CLASS_MEMBER@73..94 + 0: JS_PROPERTY_MODIFIER_LIST@73..86 + 0: JS_DECORATOR@73..79 + 0: AT@73..75 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@75..79 + 0: JS_REFERENCE_IDENTIFIER@75..79 + 0: IDENT@75..79 "dec" [] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@79..86 + 0: PUBLIC_KW@79..86 "public" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@86..90 + 0: IDENT@86..90 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@90..93 + 0: EQ@90..92 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@92..93 + 0: JS_NUMBER_LITERAL@92..93 "1" [] [] + 4: SEMICOLON@93..94 ";" [] [] + 3: JS_PROPERTY_CLASS_MEMBER@94..135 + 0: JS_PROPERTY_MODIFIER_LIST@94..127 + 0: JS_DECORATOR@94..100 + 0: AT@94..96 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@96..100 + 0: JS_REFERENCE_IDENTIFIER@96..100 + 0: IDENT@96..100 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@100..113 + 0: AT@100..101 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@101..113 + 0: L_PAREN@101..102 "(" [] [] + 1: JS_AWAIT_EXPRESSION@102..111 + 0: AWAIT_KW@102..108 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@108..111 + 0: JS_REFERENCE_IDENTIFIER@108..111 + 0: IDENT@108..111 "dec" [] [] + 2: R_PAREN@111..113 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@113..120 + 0: AT@113..114 "@" [] [] + 1: JS_CALL_EXPRESSION@114..120 + 0: JS_IDENTIFIER_EXPRESSION@114..117 + 0: JS_REFERENCE_IDENTIFIER@114..117 + 0: IDENT@114..117 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@117..120 + 0: L_PAREN@117..118 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@118..118 + 2: R_PAREN@118..120 ")" [] [Whitespace(" ")] + 3: TS_ACCESSIBILITY_MODIFIER@120..127 + 0: PUBLIC_KW@120..127 "public" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@127..131 + 0: IDENT@127..131 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@131..134 + 0: EQ@131..133 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@133..134 + 0: JS_NUMBER_LITERAL@133..134 "1" [] [] + 4: SEMICOLON@134..135 ";" [] [] + 4: JS_PROPERTY_CLASS_MEMBER@135..156 + 0: JS_PROPERTY_MODIFIER_LIST@135..148 + 0: JS_DECORATOR@135..141 + 0: AT@135..137 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@137..141 + 0: JS_REFERENCE_IDENTIFIER@137..141 + 0: IDENT@137..141 "dec" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@141..148 + 0: STATIC_KW@141..148 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@148..152 + 0: IDENT@148..152 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@152..155 + 0: EQ@152..154 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@154..155 + 0: JS_NUMBER_LITERAL@154..155 "2" [] [] + 4: SEMICOLON@155..156 ";" [] [] + 5: JS_PROPERTY_CLASS_MEMBER@156..197 + 0: JS_PROPERTY_MODIFIER_LIST@156..189 + 0: JS_DECORATOR@156..162 + 0: AT@156..158 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@158..162 + 0: JS_REFERENCE_IDENTIFIER@158..162 + 0: IDENT@158..162 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@162..175 + 0: AT@162..163 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@163..175 + 0: L_PAREN@163..164 "(" [] [] + 1: JS_AWAIT_EXPRESSION@164..173 + 0: AWAIT_KW@164..170 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@170..173 + 0: JS_REFERENCE_IDENTIFIER@170..173 + 0: IDENT@170..173 "dec" [] [] + 2: R_PAREN@173..175 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@175..182 + 0: AT@175..176 "@" [] [] + 1: JS_CALL_EXPRESSION@176..182 + 0: JS_IDENTIFIER_EXPRESSION@176..179 + 0: JS_REFERENCE_IDENTIFIER@176..179 + 0: IDENT@176..179 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@179..182 + 0: L_PAREN@179..180 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@180..180 + 2: R_PAREN@180..182 ")" [] [Whitespace(" ")] + 3: JS_STATIC_MODIFIER@182..189 + 0: STATIC_KW@182..189 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@189..193 + 0: IDENT@189..193 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@193..196 + 0: EQ@193..195 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@195..196 + 0: JS_NUMBER_LITERAL@195..196 "2" [] [] + 4: SEMICOLON@196..197 ";" [] [] + 6: JS_PROPERTY_CLASS_MEMBER@197..220 + 0: JS_PROPERTY_MODIFIER_LIST@197..212 + 0: JS_DECORATOR@197..203 + 0: AT@197..199 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@199..203 + 0: JS_REFERENCE_IDENTIFIER@199..203 + 0: IDENT@199..203 "dec" [] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@203..212 + 0: ACCESSOR_KW@203..212 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@212..216 + 0: IDENT@212..216 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@216..219 + 0: EQ@216..218 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@218..219 + 0: JS_NUMBER_LITERAL@218..219 "2" [] [] + 4: SEMICOLON@219..220 ";" [] [] + 7: JS_PROPERTY_CLASS_MEMBER@220..263 + 0: JS_PROPERTY_MODIFIER_LIST@220..255 + 0: JS_DECORATOR@220..226 + 0: AT@220..222 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@222..226 + 0: JS_REFERENCE_IDENTIFIER@222..226 + 0: IDENT@222..226 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@226..239 + 0: AT@226..227 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@227..239 + 0: L_PAREN@227..228 "(" [] [] + 1: JS_AWAIT_EXPRESSION@228..237 + 0: AWAIT_KW@228..234 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@234..237 + 0: JS_REFERENCE_IDENTIFIER@234..237 + 0: IDENT@234..237 "dec" [] [] + 2: R_PAREN@237..239 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@239..246 + 0: AT@239..240 "@" [] [] + 1: JS_CALL_EXPRESSION@240..246 + 0: JS_IDENTIFIER_EXPRESSION@240..243 + 0: JS_REFERENCE_IDENTIFIER@240..243 + 0: IDENT@240..243 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@243..246 + 0: L_PAREN@243..244 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@244..244 + 2: R_PAREN@244..246 ")" [] [Whitespace(" ")] + 3: JS_ACCESSOR_MODIFIER@246..255 + 0: ACCESSOR_KW@246..255 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@255..259 + 0: IDENT@255..259 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@259..262 + 0: EQ@259..261 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@261..262 + 0: JS_NUMBER_LITERAL@261..262 "2" [] [] + 4: SEMICOLON@262..263 ";" [] [] + 8: JS_PROPERTY_CLASS_MEMBER@263..286 + 0: JS_PROPERTY_MODIFIER_LIST@263..278 + 0: JS_DECORATOR@263..269 + 0: AT@263..265 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@265..269 + 0: JS_REFERENCE_IDENTIFIER@265..269 + 0: IDENT@265..269 "dec" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@269..278 + 0: READONLY_KW@269..278 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@278..282 + 0: IDENT@278..282 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@282..285 + 0: EQ@282..284 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@284..285 + 0: JS_NUMBER_LITERAL@284..285 "2" [] [] + 4: SEMICOLON@285..286 ";" [] [] + 9: JS_PROPERTY_CLASS_MEMBER@286..329 + 0: JS_PROPERTY_MODIFIER_LIST@286..321 + 0: JS_DECORATOR@286..292 + 0: AT@286..288 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@288..292 + 0: JS_REFERENCE_IDENTIFIER@288..292 + 0: IDENT@288..292 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@292..305 + 0: AT@292..293 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@293..305 + 0: L_PAREN@293..294 "(" [] [] + 1: JS_AWAIT_EXPRESSION@294..303 + 0: AWAIT_KW@294..300 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@300..303 + 0: JS_REFERENCE_IDENTIFIER@300..303 + 0: IDENT@300..303 "dec" [] [] + 2: R_PAREN@303..305 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@305..312 + 0: AT@305..306 "@" [] [] + 1: JS_CALL_EXPRESSION@306..312 + 0: JS_IDENTIFIER_EXPRESSION@306..309 + 0: JS_REFERENCE_IDENTIFIER@306..309 + 0: IDENT@306..309 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@309..312 + 0: L_PAREN@309..310 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@310..310 + 2: R_PAREN@310..312 ")" [] [Whitespace(" ")] + 3: TS_READONLY_MODIFIER@312..321 + 0: READONLY_KW@312..321 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@321..325 + 0: IDENT@321..325 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@325..328 + 0: EQ@325..327 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@327..328 + 0: JS_NUMBER_LITERAL@327..328 "2" [] [] + 4: SEMICOLON@328..329 ";" [] [] + 10: JS_PROPERTY_CLASS_MEMBER@329..352 + 0: JS_PROPERTY_MODIFIER_LIST@329..344 + 0: JS_DECORATOR@329..335 + 0: AT@329..331 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@331..335 + 0: JS_REFERENCE_IDENTIFIER@331..335 + 0: IDENT@331..335 "dec" [] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@335..344 + 0: OVERRIDE_KW@335..344 "override" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@344..348 + 0: IDENT@344..348 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@348..351 + 0: EQ@348..350 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@350..351 + 0: JS_NUMBER_LITERAL@350..351 "2" [] [] + 4: SEMICOLON@351..352 ";" [] [] + 11: JS_PROPERTY_CLASS_MEMBER@352..395 + 0: JS_PROPERTY_MODIFIER_LIST@352..387 + 0: JS_DECORATOR@352..358 + 0: AT@352..354 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@354..358 + 0: JS_REFERENCE_IDENTIFIER@354..358 + 0: IDENT@354..358 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@358..371 + 0: AT@358..359 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@359..371 + 0: L_PAREN@359..360 "(" [] [] + 1: JS_AWAIT_EXPRESSION@360..369 + 0: AWAIT_KW@360..366 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@366..369 + 0: JS_REFERENCE_IDENTIFIER@366..369 + 0: IDENT@366..369 "dec" [] [] + 2: R_PAREN@369..371 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@371..378 + 0: AT@371..372 "@" [] [] + 1: JS_CALL_EXPRESSION@372..378 + 0: JS_IDENTIFIER_EXPRESSION@372..375 + 0: JS_REFERENCE_IDENTIFIER@372..375 + 0: IDENT@372..375 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@375..378 + 0: L_PAREN@375..376 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@376..376 + 2: R_PAREN@376..378 ")" [] [Whitespace(" ")] + 3: TS_OVERRIDE_MODIFIER@378..387 + 0: OVERRIDE_KW@378..387 "override" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@387..391 + 0: IDENT@387..391 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@391..394 + 0: EQ@391..393 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@393..394 + 0: JS_NUMBER_LITERAL@393..394 "2" [] [] + 4: SEMICOLON@394..395 ";" [] [] + 12: JS_METHOD_CLASS_MEMBER@395..420 + 0: JS_METHOD_MODIFIER_LIST@395..412 + 0: JS_DECORATOR@395..412 + 0: AT@395..408 "@" [Newline("\n"), Comments("// methods"), Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@408..412 + 0: JS_REFERENCE_IDENTIFIER@408..412 + 0: IDENT@408..412 "dec" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@412..415 + 0: IDENT@412..415 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@415..418 + 0: L_PAREN@415..416 "(" [] [] + 1: JS_PARAMETER_LIST@416..416 + 2: R_PAREN@416..418 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@418..420 + 0: L_CURLY@418..419 "{" [] [] + 1: JS_DIRECTIVE_LIST@419..419 + 2: JS_STATEMENT_LIST@419..419 + 3: R_CURLY@419..420 "}" [] [] + 13: JS_METHOD_CLASS_MEMBER@420..454 + 0: JS_METHOD_MODIFIER_LIST@420..446 + 0: JS_DECORATOR@420..426 + 0: AT@420..422 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@422..426 + 0: JS_REFERENCE_IDENTIFIER@422..426 + 0: IDENT@422..426 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@426..439 + 0: AT@426..427 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@427..439 + 0: L_PAREN@427..428 "(" [] [] + 1: JS_AWAIT_EXPRESSION@428..437 + 0: AWAIT_KW@428..434 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@434..437 + 0: JS_REFERENCE_IDENTIFIER@434..437 + 0: IDENT@434..437 "dec" [] [] + 2: R_PAREN@437..439 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@439..446 + 0: AT@439..440 "@" [] [] + 1: JS_CALL_EXPRESSION@440..446 + 0: JS_IDENTIFIER_EXPRESSION@440..443 + 0: JS_REFERENCE_IDENTIFIER@440..443 + 0: IDENT@440..443 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@443..446 + 0: L_PAREN@443..444 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@444..444 + 2: R_PAREN@444..446 ")" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@446..449 + 0: IDENT@446..449 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@449..452 + 0: L_PAREN@449..450 "(" [] [] + 1: JS_PARAMETER_LIST@450..450 + 2: R_PAREN@450..452 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@452..454 + 0: L_CURLY@452..453 "{" [] [] + 1: JS_DIRECTIVE_LIST@453..453 + 2: JS_STATEMENT_LIST@453..453 + 3: R_CURLY@453..454 "}" [] [] + 14: JS_METHOD_CLASS_MEMBER@454..475 + 0: JS_METHOD_MODIFIER_LIST@454..467 + 0: JS_DECORATOR@454..460 + 0: AT@454..456 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@456..460 + 0: JS_REFERENCE_IDENTIFIER@456..460 + 0: IDENT@456..460 "dec" [] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@460..467 + 0: PUBLIC_KW@460..467 "public" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@467..470 + 0: IDENT@467..470 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@470..473 + 0: L_PAREN@470..471 "(" [] [] + 1: JS_PARAMETER_LIST@471..471 + 2: R_PAREN@471..473 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@473..475 + 0: L_CURLY@473..474 "{" [] [] + 1: JS_DIRECTIVE_LIST@474..474 + 2: JS_STATEMENT_LIST@474..474 + 3: R_CURLY@474..475 "}" [] [] + 15: JS_METHOD_CLASS_MEMBER@475..516 + 0: JS_METHOD_MODIFIER_LIST@475..508 + 0: JS_DECORATOR@475..481 + 0: AT@475..477 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@477..481 + 0: JS_REFERENCE_IDENTIFIER@477..481 + 0: IDENT@477..481 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@481..494 + 0: AT@481..482 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@482..494 + 0: L_PAREN@482..483 "(" [] [] + 1: JS_AWAIT_EXPRESSION@483..492 + 0: AWAIT_KW@483..489 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@489..492 + 0: JS_REFERENCE_IDENTIFIER@489..492 + 0: IDENT@489..492 "dec" [] [] + 2: R_PAREN@492..494 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@494..501 + 0: AT@494..495 "@" [] [] + 1: JS_CALL_EXPRESSION@495..501 + 0: JS_IDENTIFIER_EXPRESSION@495..498 + 0: JS_REFERENCE_IDENTIFIER@495..498 + 0: IDENT@495..498 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@498..501 + 0: L_PAREN@498..499 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@499..499 + 2: R_PAREN@499..501 ")" [] [Whitespace(" ")] + 3: TS_ACCESSIBILITY_MODIFIER@501..508 + 0: PUBLIC_KW@501..508 "public" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@508..511 + 0: IDENT@508..511 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@511..514 + 0: L_PAREN@511..512 "(" [] [] + 1: JS_PARAMETER_LIST@512..512 + 2: R_PAREN@512..514 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@514..516 + 0: L_CURLY@514..515 "{" [] [] + 1: JS_DIRECTIVE_LIST@515..515 + 2: JS_STATEMENT_LIST@515..515 + 3: R_CURLY@515..516 "}" [] [] + 16: JS_METHOD_CLASS_MEMBER@516..537 + 0: JS_METHOD_MODIFIER_LIST@516..529 + 0: JS_DECORATOR@516..522 + 0: AT@516..518 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@518..522 + 0: JS_REFERENCE_IDENTIFIER@518..522 + 0: IDENT@518..522 "dec" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@522..529 + 0: STATIC_KW@522..529 "static" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@529..532 + 0: IDENT@529..532 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@532..535 + 0: L_PAREN@532..533 "(" [] [] + 1: JS_PARAMETER_LIST@533..533 + 2: R_PAREN@533..535 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@535..537 + 0: L_CURLY@535..536 "{" [] [] + 1: JS_DIRECTIVE_LIST@536..536 + 2: JS_STATEMENT_LIST@536..536 + 3: R_CURLY@536..537 "}" [] [] + 17: JS_METHOD_CLASS_MEMBER@537..578 + 0: JS_METHOD_MODIFIER_LIST@537..570 + 0: JS_DECORATOR@537..543 + 0: AT@537..539 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@539..543 + 0: JS_REFERENCE_IDENTIFIER@539..543 + 0: IDENT@539..543 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@543..556 + 0: AT@543..544 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@544..556 + 0: L_PAREN@544..545 "(" [] [] + 1: JS_AWAIT_EXPRESSION@545..554 + 0: AWAIT_KW@545..551 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@551..554 + 0: JS_REFERENCE_IDENTIFIER@551..554 + 0: IDENT@551..554 "dec" [] [] + 2: R_PAREN@554..556 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@556..563 + 0: AT@556..557 "@" [] [] + 1: JS_CALL_EXPRESSION@557..563 + 0: JS_IDENTIFIER_EXPRESSION@557..560 + 0: JS_REFERENCE_IDENTIFIER@557..560 + 0: IDENT@557..560 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@560..563 + 0: L_PAREN@560..561 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@561..561 + 2: R_PAREN@561..563 ")" [] [Whitespace(" ")] + 3: JS_STATIC_MODIFIER@563..570 + 0: STATIC_KW@563..570 "static" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@570..573 + 0: IDENT@570..573 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@573..576 + 0: L_PAREN@573..574 "(" [] [] + 1: JS_PARAMETER_LIST@574..574 + 2: R_PAREN@574..576 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@576..578 + 0: L_CURLY@576..577 "{" [] [] + 1: JS_DIRECTIVE_LIST@577..577 + 2: JS_STATEMENT_LIST@577..577 + 3: R_CURLY@577..578 "}" [] [] + 18: JS_METHOD_CLASS_MEMBER@578..601 + 0: JS_METHOD_MODIFIER_LIST@578..593 + 0: JS_DECORATOR@578..584 + 0: AT@578..580 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@580..584 + 0: JS_REFERENCE_IDENTIFIER@580..584 + 0: IDENT@580..584 "dec" [] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@584..593 + 0: OVERRIDE_KW@584..593 "override" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@593..596 + 0: IDENT@593..596 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@596..599 + 0: L_PAREN@596..597 "(" [] [] + 1: JS_PARAMETER_LIST@597..597 + 2: R_PAREN@597..599 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@599..601 + 0: L_CURLY@599..600 "{" [] [] + 1: JS_DIRECTIVE_LIST@600..600 + 2: JS_STATEMENT_LIST@600..600 + 3: R_CURLY@600..601 "}" [] [] + 19: JS_METHOD_CLASS_MEMBER@601..644 + 0: JS_METHOD_MODIFIER_LIST@601..636 + 0: JS_DECORATOR@601..607 + 0: AT@601..603 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@603..607 + 0: JS_REFERENCE_IDENTIFIER@603..607 + 0: IDENT@603..607 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@607..620 + 0: AT@607..608 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@608..620 + 0: L_PAREN@608..609 "(" [] [] + 1: JS_AWAIT_EXPRESSION@609..618 + 0: AWAIT_KW@609..615 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@615..618 + 0: JS_REFERENCE_IDENTIFIER@615..618 + 0: IDENT@615..618 "dec" [] [] + 2: R_PAREN@618..620 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@620..627 + 0: AT@620..621 "@" [] [] + 1: JS_CALL_EXPRESSION@621..627 + 0: JS_IDENTIFIER_EXPRESSION@621..624 + 0: JS_REFERENCE_IDENTIFIER@621..624 + 0: IDENT@621..624 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@624..627 + 0: L_PAREN@624..625 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@625..625 + 2: R_PAREN@625..627 ")" [] [Whitespace(" ")] + 3: TS_OVERRIDE_MODIFIER@627..636 + 0: OVERRIDE_KW@627..636 "override" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@636..639 + 0: IDENT@636..639 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@639..642 + 0: L_PAREN@639..640 "(" [] [] + 1: JS_PARAMETER_LIST@640..640 + 2: R_PAREN@640..642 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@642..644 + 0: L_CURLY@642..643 "{" [] [] + 1: JS_DIRECTIVE_LIST@643..643 + 2: JS_STATEMENT_LIST@643..643 + 3: R_CURLY@643..644 "}" [] [] + 20: JS_GETTER_CLASS_MEMBER@644..673 + 0: JS_METHOD_MODIFIER_LIST@644..661 + 0: JS_DECORATOR@644..661 + 0: AT@644..657 "@" [Newline("\n"), Comments("// getters"), Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@657..661 + 0: JS_REFERENCE_IDENTIFIER@657..661 + 0: IDENT@657..661 "dec" [] [Whitespace(" ")] + 1: GET_KW@661..665 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@665..668 + 0: IDENT@665..668 "foo" [] [] + 3: L_PAREN@668..669 "(" [] [] + 4: R_PAREN@669..671 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@671..673 + 0: L_CURLY@671..672 "{" [] [] + 1: JS_DIRECTIVE_LIST@672..672 + 2: JS_STATEMENT_LIST@672..672 + 3: R_CURLY@672..673 "}" [] [] + 21: JS_GETTER_CLASS_MEMBER@673..711 + 0: JS_METHOD_MODIFIER_LIST@673..699 + 0: JS_DECORATOR@673..679 + 0: AT@673..675 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@675..679 + 0: JS_REFERENCE_IDENTIFIER@675..679 + 0: IDENT@675..679 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@679..692 + 0: AT@679..680 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@680..692 + 0: L_PAREN@680..681 "(" [] [] + 1: JS_AWAIT_EXPRESSION@681..690 + 0: AWAIT_KW@681..687 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@687..690 + 0: JS_REFERENCE_IDENTIFIER@687..690 + 0: IDENT@687..690 "dec" [] [] + 2: R_PAREN@690..692 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@692..699 + 0: AT@692..693 "@" [] [] + 1: JS_CALL_EXPRESSION@693..699 + 0: JS_IDENTIFIER_EXPRESSION@693..696 + 0: JS_REFERENCE_IDENTIFIER@693..696 + 0: IDENT@693..696 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@696..699 + 0: L_PAREN@696..697 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@697..697 + 2: R_PAREN@697..699 ")" [] [Whitespace(" ")] + 1: GET_KW@699..703 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@703..706 + 0: IDENT@703..706 "foo" [] [] + 3: L_PAREN@706..707 "(" [] [] + 4: R_PAREN@707..709 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@709..711 + 0: L_CURLY@709..710 "{" [] [] + 1: JS_DIRECTIVE_LIST@710..710 + 2: JS_STATEMENT_LIST@710..710 + 3: R_CURLY@710..711 "}" [] [] + 22: JS_GETTER_CLASS_MEMBER@711..736 + 0: JS_METHOD_MODIFIER_LIST@711..724 + 0: JS_DECORATOR@711..717 + 0: AT@711..713 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@713..717 + 0: JS_REFERENCE_IDENTIFIER@713..717 + 0: IDENT@713..717 "dec" [] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@717..724 + 0: PUBLIC_KW@717..724 "public" [] [Whitespace(" ")] + 1: GET_KW@724..728 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@728..731 + 0: IDENT@728..731 "foo" [] [] + 3: L_PAREN@731..732 "(" [] [] + 4: R_PAREN@732..734 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@734..736 + 0: L_CURLY@734..735 "{" [] [] + 1: JS_DIRECTIVE_LIST@735..735 + 2: JS_STATEMENT_LIST@735..735 + 3: R_CURLY@735..736 "}" [] [] + 23: JS_GETTER_CLASS_MEMBER@736..781 + 0: JS_METHOD_MODIFIER_LIST@736..769 + 0: JS_DECORATOR@736..742 + 0: AT@736..738 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@738..742 + 0: JS_REFERENCE_IDENTIFIER@738..742 + 0: IDENT@738..742 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@742..755 + 0: AT@742..743 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@743..755 + 0: L_PAREN@743..744 "(" [] [] + 1: JS_AWAIT_EXPRESSION@744..753 + 0: AWAIT_KW@744..750 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@750..753 + 0: JS_REFERENCE_IDENTIFIER@750..753 + 0: IDENT@750..753 "dec" [] [] + 2: R_PAREN@753..755 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@755..762 + 0: AT@755..756 "@" [] [] + 1: JS_CALL_EXPRESSION@756..762 + 0: JS_IDENTIFIER_EXPRESSION@756..759 + 0: JS_REFERENCE_IDENTIFIER@756..759 + 0: IDENT@756..759 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@759..762 + 0: L_PAREN@759..760 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@760..760 + 2: R_PAREN@760..762 ")" [] [Whitespace(" ")] + 3: TS_ACCESSIBILITY_MODIFIER@762..769 + 0: PUBLIC_KW@762..769 "public" [] [Whitespace(" ")] + 1: GET_KW@769..773 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@773..776 + 0: IDENT@773..776 "foo" [] [] + 3: L_PAREN@776..777 "(" [] [] + 4: R_PAREN@777..779 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@779..781 + 0: L_CURLY@779..780 "{" [] [] + 1: JS_DIRECTIVE_LIST@780..780 + 2: JS_STATEMENT_LIST@780..780 + 3: R_CURLY@780..781 "}" [] [] + 24: JS_GETTER_CLASS_MEMBER@781..806 + 0: JS_METHOD_MODIFIER_LIST@781..794 + 0: JS_DECORATOR@781..787 + 0: AT@781..783 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@783..787 + 0: JS_REFERENCE_IDENTIFIER@783..787 + 0: IDENT@783..787 "dec" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@787..794 + 0: STATIC_KW@787..794 "static" [] [Whitespace(" ")] + 1: GET_KW@794..798 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@798..801 + 0: IDENT@798..801 "foo" [] [] + 3: L_PAREN@801..802 "(" [] [] + 4: R_PAREN@802..804 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@804..806 + 0: L_CURLY@804..805 "{" [] [] + 1: JS_DIRECTIVE_LIST@805..805 + 2: JS_STATEMENT_LIST@805..805 + 3: R_CURLY@805..806 "}" [] [] + 25: JS_GETTER_CLASS_MEMBER@806..851 + 0: JS_METHOD_MODIFIER_LIST@806..839 + 0: JS_DECORATOR@806..812 + 0: AT@806..808 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@808..812 + 0: JS_REFERENCE_IDENTIFIER@808..812 + 0: IDENT@808..812 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@812..825 + 0: AT@812..813 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@813..825 + 0: L_PAREN@813..814 "(" [] [] + 1: JS_AWAIT_EXPRESSION@814..823 + 0: AWAIT_KW@814..820 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@820..823 + 0: JS_REFERENCE_IDENTIFIER@820..823 + 0: IDENT@820..823 "dec" [] [] + 2: R_PAREN@823..825 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@825..832 + 0: AT@825..826 "@" [] [] + 1: JS_CALL_EXPRESSION@826..832 + 0: JS_IDENTIFIER_EXPRESSION@826..829 + 0: JS_REFERENCE_IDENTIFIER@826..829 + 0: IDENT@826..829 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@829..832 + 0: L_PAREN@829..830 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@830..830 + 2: R_PAREN@830..832 ")" [] [Whitespace(" ")] + 3: JS_STATIC_MODIFIER@832..839 + 0: STATIC_KW@832..839 "static" [] [Whitespace(" ")] + 1: GET_KW@839..843 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@843..846 + 0: IDENT@843..846 "foo" [] [] + 3: L_PAREN@846..847 "(" [] [] + 4: R_PAREN@847..849 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@849..851 + 0: L_CURLY@849..850 "{" [] [] + 1: JS_DIRECTIVE_LIST@850..850 + 2: JS_STATEMENT_LIST@850..850 + 3: R_CURLY@850..851 "}" [] [] + 26: JS_GETTER_CLASS_MEMBER@851..878 + 0: JS_METHOD_MODIFIER_LIST@851..866 + 0: JS_DECORATOR@851..857 + 0: AT@851..853 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@853..857 + 0: JS_REFERENCE_IDENTIFIER@853..857 + 0: IDENT@853..857 "dec" [] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@857..866 + 0: OVERRIDE_KW@857..866 "override" [] [Whitespace(" ")] + 1: GET_KW@866..870 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@870..873 + 0: IDENT@870..873 "foo" [] [] + 3: L_PAREN@873..874 "(" [] [] + 4: R_PAREN@874..876 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@876..878 + 0: L_CURLY@876..877 "{" [] [] + 1: JS_DIRECTIVE_LIST@877..877 + 2: JS_STATEMENT_LIST@877..877 + 3: R_CURLY@877..878 "}" [] [] + 27: JS_GETTER_CLASS_MEMBER@878..925 + 0: JS_METHOD_MODIFIER_LIST@878..913 + 0: JS_DECORATOR@878..884 + 0: AT@878..880 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@880..884 + 0: JS_REFERENCE_IDENTIFIER@880..884 + 0: IDENT@880..884 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@884..897 + 0: AT@884..885 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@885..897 + 0: L_PAREN@885..886 "(" [] [] + 1: JS_AWAIT_EXPRESSION@886..895 + 0: AWAIT_KW@886..892 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@892..895 + 0: JS_REFERENCE_IDENTIFIER@892..895 + 0: IDENT@892..895 "dec" [] [] + 2: R_PAREN@895..897 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@897..904 + 0: AT@897..898 "@" [] [] + 1: JS_CALL_EXPRESSION@898..904 + 0: JS_IDENTIFIER_EXPRESSION@898..901 + 0: JS_REFERENCE_IDENTIFIER@898..901 + 0: IDENT@898..901 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@901..904 + 0: L_PAREN@901..902 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@902..902 + 2: R_PAREN@902..904 ")" [] [Whitespace(" ")] + 3: TS_OVERRIDE_MODIFIER@904..913 + 0: OVERRIDE_KW@904..913 "override" [] [Whitespace(" ")] + 1: GET_KW@913..917 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@917..920 + 0: IDENT@917..920 "foo" [] [] + 3: L_PAREN@920..921 "(" [] [] + 4: R_PAREN@921..923 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@923..925 + 0: L_CURLY@923..924 "{" [] [] + 1: JS_DIRECTIVE_LIST@924..924 + 2: JS_STATEMENT_LIST@924..924 + 3: R_CURLY@924..925 "}" [] [] + 28: JS_SETTER_CLASS_MEMBER@925..957 + 0: JS_METHOD_MODIFIER_LIST@925..942 + 0: JS_DECORATOR@925..942 + 0: AT@925..938 "@" [Newline("\n"), Comments("// setters"), Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@938..942 + 0: JS_REFERENCE_IDENTIFIER@938..942 + 0: IDENT@938..942 "dec" [] [Whitespace(" ")] + 1: SET_KW@942..946 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@946..949 + 0: IDENT@946..949 "foo" [] [] + 3: L_PAREN@949..950 "(" [] [] + 4: JS_FORMAL_PARAMETER@950..953 + 0: JS_DECORATOR_LIST@950..950 + 1: JS_IDENTIFIER_BINDING@950..953 + 0: IDENT@950..953 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@953..955 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@955..957 + 0: L_CURLY@955..956 "{" [] [] + 1: JS_DIRECTIVE_LIST@956..956 + 2: JS_STATEMENT_LIST@956..956 + 3: R_CURLY@956..957 "}" [] [] + 29: JS_SETTER_CLASS_MEMBER@957..998 + 0: JS_METHOD_MODIFIER_LIST@957..983 + 0: JS_DECORATOR@957..963 + 0: AT@957..959 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@959..963 + 0: JS_REFERENCE_IDENTIFIER@959..963 + 0: IDENT@959..963 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@963..976 + 0: AT@963..964 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@964..976 + 0: L_PAREN@964..965 "(" [] [] + 1: JS_AWAIT_EXPRESSION@965..974 + 0: AWAIT_KW@965..971 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@971..974 + 0: JS_REFERENCE_IDENTIFIER@971..974 + 0: IDENT@971..974 "dec" [] [] + 2: R_PAREN@974..976 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@976..983 + 0: AT@976..977 "@" [] [] + 1: JS_CALL_EXPRESSION@977..983 + 0: JS_IDENTIFIER_EXPRESSION@977..980 + 0: JS_REFERENCE_IDENTIFIER@977..980 + 0: IDENT@977..980 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@980..983 + 0: L_PAREN@980..981 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@981..981 + 2: R_PAREN@981..983 ")" [] [Whitespace(" ")] + 1: SET_KW@983..987 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@987..990 + 0: IDENT@987..990 "foo" [] [] + 3: L_PAREN@990..991 "(" [] [] + 4: JS_FORMAL_PARAMETER@991..994 + 0: JS_DECORATOR_LIST@991..991 + 1: JS_IDENTIFIER_BINDING@991..994 + 0: IDENT@991..994 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@994..996 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@996..998 + 0: L_CURLY@996..997 "{" [] [] + 1: JS_DIRECTIVE_LIST@997..997 + 2: JS_STATEMENT_LIST@997..997 + 3: R_CURLY@997..998 "}" [] [] + 30: JS_SETTER_CLASS_MEMBER@998..1026 + 0: JS_METHOD_MODIFIER_LIST@998..1011 + 0: JS_DECORATOR@998..1004 + 0: AT@998..1000 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@1000..1004 + 0: JS_REFERENCE_IDENTIFIER@1000..1004 + 0: IDENT@1000..1004 "dec" [] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@1004..1011 + 0: PUBLIC_KW@1004..1011 "public" [] [Whitespace(" ")] + 1: SET_KW@1011..1015 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@1015..1018 + 0: IDENT@1015..1018 "foo" [] [] + 3: L_PAREN@1018..1019 "(" [] [] + 4: JS_FORMAL_PARAMETER@1019..1022 + 0: JS_DECORATOR_LIST@1019..1019 + 1: JS_IDENTIFIER_BINDING@1019..1022 + 0: IDENT@1019..1022 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@1022..1024 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@1024..1026 + 0: L_CURLY@1024..1025 "{" [] [] + 1: JS_DIRECTIVE_LIST@1025..1025 + 2: JS_STATEMENT_LIST@1025..1025 + 3: R_CURLY@1025..1026 "}" [] [] + 31: JS_SETTER_CLASS_MEMBER@1026..1074 + 0: JS_METHOD_MODIFIER_LIST@1026..1059 + 0: JS_DECORATOR@1026..1032 + 0: AT@1026..1028 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@1028..1032 + 0: JS_REFERENCE_IDENTIFIER@1028..1032 + 0: IDENT@1028..1032 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@1032..1045 + 0: AT@1032..1033 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@1033..1045 + 0: L_PAREN@1033..1034 "(" [] [] + 1: JS_AWAIT_EXPRESSION@1034..1043 + 0: AWAIT_KW@1034..1040 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@1040..1043 + 0: JS_REFERENCE_IDENTIFIER@1040..1043 + 0: IDENT@1040..1043 "dec" [] [] + 2: R_PAREN@1043..1045 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@1045..1052 + 0: AT@1045..1046 "@" [] [] + 1: JS_CALL_EXPRESSION@1046..1052 + 0: JS_IDENTIFIER_EXPRESSION@1046..1049 + 0: JS_REFERENCE_IDENTIFIER@1046..1049 + 0: IDENT@1046..1049 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@1049..1052 + 0: L_PAREN@1049..1050 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@1050..1050 + 2: R_PAREN@1050..1052 ")" [] [Whitespace(" ")] + 3: TS_ACCESSIBILITY_MODIFIER@1052..1059 + 0: PUBLIC_KW@1052..1059 "public" [] [Whitespace(" ")] + 1: SET_KW@1059..1063 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@1063..1066 + 0: IDENT@1063..1066 "foo" [] [] + 3: L_PAREN@1066..1067 "(" [] [] + 4: JS_FORMAL_PARAMETER@1067..1070 + 0: JS_DECORATOR_LIST@1067..1067 + 1: JS_IDENTIFIER_BINDING@1067..1070 + 0: IDENT@1067..1070 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@1070..1072 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@1072..1074 + 0: L_CURLY@1072..1073 "{" [] [] + 1: JS_DIRECTIVE_LIST@1073..1073 + 2: JS_STATEMENT_LIST@1073..1073 + 3: R_CURLY@1073..1074 "}" [] [] + 32: JS_SETTER_CLASS_MEMBER@1074..1102 + 0: JS_METHOD_MODIFIER_LIST@1074..1087 + 0: JS_DECORATOR@1074..1080 + 0: AT@1074..1076 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@1076..1080 + 0: JS_REFERENCE_IDENTIFIER@1076..1080 + 0: IDENT@1076..1080 "dec" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@1080..1087 + 0: STATIC_KW@1080..1087 "static" [] [Whitespace(" ")] + 1: SET_KW@1087..1091 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@1091..1094 + 0: IDENT@1091..1094 "foo" [] [] + 3: L_PAREN@1094..1095 "(" [] [] + 4: JS_FORMAL_PARAMETER@1095..1098 + 0: JS_DECORATOR_LIST@1095..1095 + 1: JS_IDENTIFIER_BINDING@1095..1098 + 0: IDENT@1095..1098 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@1098..1100 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@1100..1102 + 0: L_CURLY@1100..1101 "{" [] [] + 1: JS_DIRECTIVE_LIST@1101..1101 + 2: JS_STATEMENT_LIST@1101..1101 + 3: R_CURLY@1101..1102 "}" [] [] + 33: JS_SETTER_CLASS_MEMBER@1102..1150 + 0: JS_METHOD_MODIFIER_LIST@1102..1135 + 0: JS_DECORATOR@1102..1108 + 0: AT@1102..1104 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@1104..1108 + 0: JS_REFERENCE_IDENTIFIER@1104..1108 + 0: IDENT@1104..1108 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@1108..1121 + 0: AT@1108..1109 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@1109..1121 + 0: L_PAREN@1109..1110 "(" [] [] + 1: JS_AWAIT_EXPRESSION@1110..1119 + 0: AWAIT_KW@1110..1116 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@1116..1119 + 0: JS_REFERENCE_IDENTIFIER@1116..1119 + 0: IDENT@1116..1119 "dec" [] [] + 2: R_PAREN@1119..1121 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@1121..1128 + 0: AT@1121..1122 "@" [] [] + 1: JS_CALL_EXPRESSION@1122..1128 + 0: JS_IDENTIFIER_EXPRESSION@1122..1125 + 0: JS_REFERENCE_IDENTIFIER@1122..1125 + 0: IDENT@1122..1125 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@1125..1128 + 0: L_PAREN@1125..1126 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@1126..1126 + 2: R_PAREN@1126..1128 ")" [] [Whitespace(" ")] + 3: JS_STATIC_MODIFIER@1128..1135 + 0: STATIC_KW@1128..1135 "static" [] [Whitespace(" ")] + 1: SET_KW@1135..1139 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@1139..1142 + 0: IDENT@1139..1142 "foo" [] [] + 3: L_PAREN@1142..1143 "(" [] [] + 4: JS_FORMAL_PARAMETER@1143..1146 + 0: JS_DECORATOR_LIST@1143..1143 + 1: JS_IDENTIFIER_BINDING@1143..1146 + 0: IDENT@1143..1146 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@1146..1148 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@1148..1150 + 0: L_CURLY@1148..1149 "{" [] [] + 1: JS_DIRECTIVE_LIST@1149..1149 + 2: JS_STATEMENT_LIST@1149..1149 + 3: R_CURLY@1149..1150 "}" [] [] + 34: JS_SETTER_CLASS_MEMBER@1150..1180 + 0: JS_METHOD_MODIFIER_LIST@1150..1165 + 0: JS_DECORATOR@1150..1156 + 0: AT@1150..1152 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@1152..1156 + 0: JS_REFERENCE_IDENTIFIER@1152..1156 + 0: IDENT@1152..1156 "dec" [] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@1156..1165 + 0: OVERRIDE_KW@1156..1165 "override" [] [Whitespace(" ")] + 1: SET_KW@1165..1169 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@1169..1172 + 0: IDENT@1169..1172 "foo" [] [] + 3: L_PAREN@1172..1173 "(" [] [] + 4: JS_FORMAL_PARAMETER@1173..1176 + 0: JS_DECORATOR_LIST@1173..1173 + 1: JS_IDENTIFIER_BINDING@1173..1176 + 0: IDENT@1173..1176 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@1176..1178 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@1178..1180 + 0: L_CURLY@1178..1179 "{" [] [] + 1: JS_DIRECTIVE_LIST@1179..1179 + 2: JS_STATEMENT_LIST@1179..1179 + 3: R_CURLY@1179..1180 "}" [] [] + 35: JS_SETTER_CLASS_MEMBER@1180..1230 + 0: JS_METHOD_MODIFIER_LIST@1180..1215 + 0: JS_DECORATOR@1180..1186 + 0: AT@1180..1182 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@1182..1186 + 0: JS_REFERENCE_IDENTIFIER@1182..1186 + 0: IDENT@1182..1186 "dec" [] [Whitespace(" ")] + 1: JS_DECORATOR@1186..1199 + 0: AT@1186..1187 "@" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@1187..1199 + 0: L_PAREN@1187..1188 "(" [] [] + 1: JS_AWAIT_EXPRESSION@1188..1197 + 0: AWAIT_KW@1188..1194 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@1194..1197 + 0: JS_REFERENCE_IDENTIFIER@1194..1197 + 0: IDENT@1194..1197 "dec" [] [] + 2: R_PAREN@1197..1199 ")" [] [Whitespace(" ")] + 2: JS_DECORATOR@1199..1206 + 0: AT@1199..1200 "@" [] [] + 1: JS_CALL_EXPRESSION@1200..1206 + 0: JS_IDENTIFIER_EXPRESSION@1200..1203 + 0: JS_REFERENCE_IDENTIFIER@1200..1203 + 0: IDENT@1200..1203 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@1203..1206 + 0: L_PAREN@1203..1204 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@1204..1204 + 2: R_PAREN@1204..1206 ")" [] [Whitespace(" ")] + 3: TS_OVERRIDE_MODIFIER@1206..1215 + 0: OVERRIDE_KW@1206..1215 "override" [] [Whitespace(" ")] + 1: SET_KW@1215..1219 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@1219..1222 + 0: IDENT@1219..1222 "foo" [] [] + 3: L_PAREN@1222..1223 "(" [] [] + 4: JS_FORMAL_PARAMETER@1223..1226 + 0: JS_DECORATOR_LIST@1223..1223 + 1: JS_IDENTIFIER_BINDING@1223..1226 + 0: IDENT@1223..1226 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@1226..1228 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@1228..1230 + 0: L_CURLY@1228..1229 "{" [] [] + 1: JS_DIRECTIVE_LIST@1229..1229 + 2: JS_STATEMENT_LIST@1229..1229 + 3: R_CURLY@1229..1230 "}" [] [] + 9: R_CURLY@1230..1232 "}" [Newline("\n")] [] + 4: EOF@1232..1233 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap new file mode 100644 index 000000000000..c9df76cb8145 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap @@ -0,0 +1,184 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class Qux { + @dec declare static foo: string; +} +class Bar { + @dec readonly foo = '123'; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..19 "Qux" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@19..20 "{" [] [], + members: JsClassMemberList [ + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + JsDecorator { + at_token: AT@20..24 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..28 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@28..36 "declare" [] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@36..43 "static" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@43..46 "foo" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@46..48 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@48..54 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@54..55 ";" [] [], + }, + ], + r_curly_token: R_CURLY@55..57 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@64..68 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@68..69 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@69..74 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..78 "dec" [] [Whitespace(" ")], + }, + }, + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@78..87 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@87..91 "foo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@91..93 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@93..98 "'123'" [] [], + }, + }, + semicolon_token: SEMICOLON@98..99 ";" [] [], + }, + ], + r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@101..102 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..102 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..101 + 0: JS_CLASS_DECLARATION@0..57 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..19 + 0: IDENT@15..19 "Qux" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@19..20 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@20..55 + 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@20..55 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@20..43 + 0: JS_DECORATOR@20..28 + 0: AT@20..24 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@24..28 + 0: JS_REFERENCE_IDENTIFIER@24..28 + 0: IDENT@24..28 "dec" [] [Whitespace(" ")] + 1: TS_DECLARE_MODIFIER@28..36 + 0: DECLARE_KW@28..36 "declare" [] [Whitespace(" ")] + 2: JS_STATIC_MODIFIER@36..43 + 0: STATIC_KW@36..43 "static" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@43..46 + 0: IDENT@43..46 "foo" [] [] + 2: TS_TYPE_ANNOTATION@46..54 + 0: COLON@46..48 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@48..54 + 0: STRING_KW@48..54 "string" [] [] + 3: SEMICOLON@54..55 ";" [] [] + 9: R_CURLY@55..57 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@57..101 + 0: JS_DECORATOR_LIST@57..57 + 1: (empty) + 2: CLASS_KW@57..64 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@64..68 + 0: IDENT@64..68 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@68..69 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@69..99 + 0: JS_PROPERTY_CLASS_MEMBER@69..99 + 0: JS_PROPERTY_MODIFIER_LIST@69..87 + 0: JS_DECORATOR@69..78 + 0: AT@69..74 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@74..78 + 0: JS_REFERENCE_IDENTIFIER@74..78 + 0: IDENT@74..78 "dec" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@78..87 + 0: READONLY_KW@78..87 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@87..91 + 0: IDENT@87..91 "foo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@91..98 + 0: EQ@91..93 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@93..98 + 0: JS_STRING_LITERAL@93..98 "'123'" [] [] + 4: SEMICOLON@98..99 ";" [] [] + 9: R_CURLY@99..101 "}" [Newline("\n")] [] + 4: EOF@101..102 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap new file mode 100644 index 000000000000..f5e33aef83f1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap @@ -0,0 +1,189 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +if (a) { + @dec class MyClass {} +} +function foo() { + @dec class MyClass {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..5 "a" [] [], + }, + }, + r_paren_token: R_PAREN@5..7 ")" [] [Whitespace(" ")], + consequent: JsBlockStatement { + l_curly_token: L_CURLY@7..8 "{" [] [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@8..12 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..16 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@16..22 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@22..30 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@30..31 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + ], + r_curly_token: R_CURLY@32..34 "}" [Newline("\n")] [], + }, + else_clause: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@44..47 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@47..48 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@50..51 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@51..55 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..59 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@59..65 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@65..73 "MyClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@73..74 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@74..75 "}" [] [], + }, + ], + r_curly_token: R_CURLY@75..77 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@77..78 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..78 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..77 + 0: JS_IF_STATEMENT@0..34 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_IDENTIFIER_EXPRESSION@4..5 + 0: JS_REFERENCE_IDENTIFIER@4..5 + 0: IDENT@4..5 "a" [] [] + 3: R_PAREN@5..7 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@7..34 + 0: L_CURLY@7..8 "{" [] [] + 1: JS_STATEMENT_LIST@8..32 + 0: JS_CLASS_DECLARATION@8..32 + 0: JS_DECORATOR_LIST@8..16 + 0: JS_DECORATOR@8..16 + 0: AT@8..12 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@12..16 + 0: JS_REFERENCE_IDENTIFIER@12..16 + 0: IDENT@12..16 "dec" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@16..22 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@22..30 + 0: IDENT@22..30 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@30..31 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@31..31 + 9: R_CURLY@31..32 "}" [] [] + 2: R_CURLY@32..34 "}" [Newline("\n")] [] + 5: (empty) + 1: JS_FUNCTION_DECLARATION@34..77 + 0: (empty) + 1: FUNCTION_KW@34..44 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@44..47 + 0: IDENT@44..47 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@47..50 + 0: L_PAREN@47..48 "(" [] [] + 1: JS_PARAMETER_LIST@48..48 + 2: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@50..77 + 0: L_CURLY@50..51 "{" [] [] + 1: JS_DIRECTIVE_LIST@51..51 + 2: JS_STATEMENT_LIST@51..75 + 0: JS_CLASS_DECLARATION@51..75 + 0: JS_DECORATOR_LIST@51..59 + 0: JS_DECORATOR@51..59 + 0: AT@51..55 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@55..59 + 0: JS_REFERENCE_IDENTIFIER@55..59 + 0: IDENT@55..59 "dec" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@59..65 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@65..73 + 0: IDENT@65..73 "MyClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@73..74 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@74..74 + 9: R_CURLY@74..75 "}" [] [] + 3: R_CURLY@75..77 "}" [Newline("\n")] [] + 4: EOF@77..78 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js.snap new file mode 100644 index 000000000000..ac8b0a474dfb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js.snap @@ -0,0 +1,182 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export @decorator class Bar {}; +export @first @second class Foo { + constructor() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@7..8 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..18 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@18..24 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@24..28 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@28..29 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@39..40 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..46 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@46..47 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@47..54 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@54..60 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@60..64 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@64..65 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@65..81 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@81..82 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@84..85 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@86..88 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@88..89 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..89 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..88 + 0: JS_EXPORT@0..30 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@7..30 + 0: JS_DECORATOR_LIST@7..18 + 0: JS_DECORATOR@7..18 + 0: AT@7..8 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@8..18 + 0: JS_REFERENCE_IDENTIFIER@8..18 + 0: IDENT@8..18 "decorator" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@18..24 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@24..28 + 0: IDENT@24..28 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@28..29 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@29..29 + 9: R_CURLY@29..30 "}" [] [] + 1: JS_EMPTY_STATEMENT@30..31 + 0: SEMICOLON@30..31 ";" [] [] + 2: JS_EXPORT@31..88 + 0: JS_DECORATOR_LIST@31..31 + 1: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@39..88 + 0: JS_DECORATOR_LIST@39..54 + 0: JS_DECORATOR@39..46 + 0: AT@39..40 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@40..46 + 0: JS_REFERENCE_IDENTIFIER@40..46 + 0: IDENT@40..46 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@46..54 + 0: AT@46..47 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@47..54 + 0: JS_REFERENCE_IDENTIFIER@47..54 + 0: IDENT@47..54 "second" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@54..60 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@60..64 + 0: IDENT@60..64 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@64..65 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@65..86 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@65..86 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@65..65 + 1: JS_LITERAL_MEMBER_NAME@65..81 + 0: IDENT@65..81 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@81..84 + 0: L_PAREN@81..82 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@82..82 + 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@84..86 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_DIRECTIVE_LIST@85..85 + 2: JS_STATEMENT_LIST@85..85 + 3: R_CURLY@85..86 "}" [] [] + 9: R_CURLY@86..88 "}" [Newline("\n")] [] + 4: EOF@88..89 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap new file mode 100644 index 000000000000..e3891e138f0a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap @@ -0,0 +1,241 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A{}; +export default interface A{}; +export default class A{}; +export default interface A{}; +export default interface A{}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@25..26 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@26..27 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@55..56 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@56..57 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@75..81 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@81..82 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@82..83 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@83..84 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@84..85 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@93..101 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@101..111 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@111..112 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@112..113 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@113..114 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@115..123 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@123..131 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@131..141 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@141..142 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@142..143 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@143..144 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@144..145 ";" [] [], + }, + ], + eof_token: EOF@145..146 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..146 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..145 + 0: JS_EXPORT@0..28 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..28 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@15..28 + 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@26..27 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@27..27 + 6: R_CURLY@27..28 "}" [] [] + 2: (empty) + 1: JS_EMPTY_STATEMENT@28..29 + 0: SEMICOLON@28..29 ";" [] [] + 2: JS_EXPORT@29..58 + 0: JS_DECORATOR_LIST@29..29 + 1: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@37..58 + 0: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@45..58 + 0: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@55..56 + 0: IDENT@55..56 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@56..57 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@57..57 + 6: R_CURLY@57..58 "}" [] [] + 2: (empty) + 3: JS_EMPTY_STATEMENT@58..59 + 0: SEMICOLON@58..59 ";" [] [] + 4: JS_EXPORT@59..84 + 0: JS_DECORATOR_LIST@59..59 + 1: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@67..84 + 0: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@75..84 + 0: JS_DECORATOR_LIST@75..75 + 1: (empty) + 2: CLASS_KW@75..81 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@81..82 + 0: IDENT@81..82 "A" [] [] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@82..83 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@83..83 + 9: R_CURLY@83..84 "}" [] [] + 2: (empty) + 5: JS_EMPTY_STATEMENT@84..85 + 0: SEMICOLON@84..85 ";" [] [] + 6: JS_EXPORT@85..114 + 0: JS_DECORATOR_LIST@85..85 + 1: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@93..114 + 0: DEFAULT_KW@93..101 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@101..114 + 0: INTERFACE_KW@101..111 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@111..112 + 0: IDENT@111..112 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@112..113 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@113..113 + 6: R_CURLY@113..114 "}" [] [] + 2: (empty) + 7: JS_EMPTY_STATEMENT@114..115 + 0: SEMICOLON@114..115 ";" [] [] + 8: JS_EXPORT@115..144 + 0: JS_DECORATOR_LIST@115..115 + 1: EXPORT_KW@115..123 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@123..144 + 0: DEFAULT_KW@123..131 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@131..144 + 0: INTERFACE_KW@131..141 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@141..142 + 0: IDENT@141..142 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@142..143 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@143..143 + 6: R_CURLY@143..144 "}" [] [] + 2: (empty) + 9: JS_EMPTY_STATEMENT@144..145 + 0: SEMICOLON@144..145 ";" [] [] + 4: EOF@145..146 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap new file mode 100644 index 000000000000..52f27dad9414 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap @@ -0,0 +1,239 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default function a():void; +export default function a(v: number):void; +export default function a(v?: any){ +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: TsDeclareFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@24..25 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@25..26 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@27..28 ":" [] [], + ty: TsVoidType { + void_token: VOID_KW@28..32 "void" [] [], + }, + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@41..49 "default" [] [Whitespace(" ")], + declaration: TsDeclareFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@49..58 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@58..59 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@59..60 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@60..61 "v" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@61..63 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@63..69 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@69..70 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@70..71 ":" [] [], + ty: TsVoidType { + void_token: VOID_KW@71..75 "void" [] [], + }, + }, + semicolon_token: SEMICOLON@75..76 ";" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@76..84 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@84..92 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@92..101 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@101..102 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@102..103 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@103..104 "v" [] [], + }, + question_mark_token: QUESTION@104..105 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@105..107 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@107..110 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@110..111 ")" [] [], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@111..112 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@112..114 "}" [Newline("\n")] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@114..115 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..115 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..114 + 0: JS_EXPORT@0..33 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..33 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..33 + 0: (empty) + 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "a" [] [] + 3: (empty) + 4: JS_PARAMETERS@25..27 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_PARAMETER_LIST@26..26 + 2: R_PAREN@26..27 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@27..32 + 0: COLON@27..28 ":" [] [] + 1: TS_VOID_TYPE@28..32 + 0: VOID_KW@28..32 "void" [] [] + 6: SEMICOLON@32..33 ";" [] [] + 2: (empty) + 1: JS_EXPORT@33..76 + 0: JS_DECORATOR_LIST@33..33 + 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@41..76 + 0: DEFAULT_KW@41..49 "default" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@49..76 + 0: (empty) + 1: FUNCTION_KW@49..58 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@58..59 + 0: IDENT@58..59 "a" [] [] + 3: (empty) + 4: JS_PARAMETERS@59..70 + 0: L_PAREN@59..60 "(" [] [] + 1: JS_PARAMETER_LIST@60..69 + 0: JS_FORMAL_PARAMETER@60..69 + 0: JS_DECORATOR_LIST@60..60 + 1: JS_IDENTIFIER_BINDING@60..61 + 0: IDENT@60..61 "v" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@61..69 + 0: COLON@61..63 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@63..69 + 0: NUMBER_KW@63..69 "number" [] [] + 4: (empty) + 2: R_PAREN@69..70 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@70..75 + 0: COLON@70..71 ":" [] [] + 1: TS_VOID_TYPE@71..75 + 0: VOID_KW@71..75 "void" [] [] + 6: SEMICOLON@75..76 ";" [] [] + 2: (empty) + 2: JS_EXPORT@76..114 + 0: JS_DECORATOR_LIST@76..76 + 1: EXPORT_KW@76..84 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@84..114 + 0: DEFAULT_KW@84..92 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@92..114 + 0: (empty) + 1: FUNCTION_KW@92..101 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@101..102 + 0: IDENT@101..102 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@102..111 + 0: L_PAREN@102..103 "(" [] [] + 1: JS_PARAMETER_LIST@103..110 + 0: JS_FORMAL_PARAMETER@103..110 + 0: JS_DECORATOR_LIST@103..103 + 1: JS_IDENTIFIER_BINDING@103..104 + 0: IDENT@103..104 "v" [] [] + 2: QUESTION@104..105 "?" [] [] + 3: TS_TYPE_ANNOTATION@105..110 + 0: COLON@105..107 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@107..110 + 0: ANY_KW@107..110 "any" [] [] + 4: (empty) + 2: R_PAREN@110..111 ")" [] [] + 6: (empty) + 7: JS_FUNCTION_BODY@111..114 + 0: L_CURLY@111..112 "{" [] [] + 1: JS_DIRECTIVE_LIST@112..112 + 2: JS_STATEMENT_LIST@112..112 + 3: R_CURLY@112..114 "}" [Newline("\n")] [] + 2: (empty) + 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap new file mode 100644 index 000000000000..2f8c86edcde2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap @@ -0,0 +1,253 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A{}; +export default interface A{}; +export default function a(){}; +export default interface A{}; +export default interface A{}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@25..26 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@26..27 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@55..56 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@56..57 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@84..85 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@85..86 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@86..87 ")" [] [], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@87..88 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@88..89 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@89..90 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@106..116 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@116..117 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@117..118 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@118..119 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@119..120 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@120..128 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@128..136 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@136..146 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@146..147 "A" [] [], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@147..148 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@148..149 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@149..150 ";" [] [], + }, + ], + eof_token: EOF@150..151 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..151 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..150 + 0: JS_EXPORT@0..28 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..28 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@15..28 + 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@26..27 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@27..27 + 6: R_CURLY@27..28 "}" [] [] + 2: (empty) + 1: JS_EMPTY_STATEMENT@28..29 + 0: SEMICOLON@28..29 ";" [] [] + 2: JS_EXPORT@29..58 + 0: JS_DECORATOR_LIST@29..29 + 1: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@37..58 + 0: DEFAULT_KW@37..45 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@45..58 + 0: INTERFACE_KW@45..55 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@55..56 + 0: IDENT@55..56 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@56..57 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@57..57 + 6: R_CURLY@57..58 "}" [] [] + 2: (empty) + 3: JS_EMPTY_STATEMENT@58..59 + 0: SEMICOLON@58..59 ";" [] [] + 4: JS_EXPORT@59..89 + 0: JS_DECORATOR_LIST@59..59 + 1: EXPORT_KW@59..67 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@67..89 + 0: DEFAULT_KW@67..75 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@75..89 + 0: (empty) + 1: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@84..85 + 0: IDENT@84..85 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@85..87 + 0: L_PAREN@85..86 "(" [] [] + 1: JS_PARAMETER_LIST@86..86 + 2: R_PAREN@86..87 ")" [] [] + 6: (empty) + 7: JS_FUNCTION_BODY@87..89 + 0: L_CURLY@87..88 "{" [] [] + 1: JS_DIRECTIVE_LIST@88..88 + 2: JS_STATEMENT_LIST@88..88 + 3: R_CURLY@88..89 "}" [] [] + 2: (empty) + 5: JS_EMPTY_STATEMENT@89..90 + 0: SEMICOLON@89..90 ";" [] [] + 6: JS_EXPORT@90..119 + 0: JS_DECORATOR_LIST@90..90 + 1: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@98..119 + 0: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@106..119 + 0: INTERFACE_KW@106..116 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@116..117 + 0: IDENT@116..117 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@117..118 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@118..118 + 6: R_CURLY@118..119 "}" [] [] + 2: (empty) + 7: JS_EMPTY_STATEMENT@119..120 + 0: SEMICOLON@119..120 ";" [] [] + 8: JS_EXPORT@120..149 + 0: JS_DECORATOR_LIST@120..120 + 1: EXPORT_KW@120..128 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@128..149 + 0: DEFAULT_KW@128..136 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@136..149 + 0: INTERFACE_KW@136..146 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@146..147 + 0: IDENT@146..147 "A" [] [] + 2: (empty) + 3: (empty) + 4: L_CURLY@147..148 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@148..148 + 6: R_CURLY@148..149 "}" [] [] + 2: (empty) + 9: JS_EMPTY_STATEMENT@149..150 + 0: SEMICOLON@149..150 ";" [] [] + 4: EOF@150..151 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap new file mode 100644 index 000000000000..f432a1761b26 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@26..32 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@32..36 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@36..38 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_EXPORT@0..39 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@18..39 + 0: DEFAULT_KW@18..26 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@26..39 + 0: JS_DECORATOR_LIST@26..26 + 1: (empty) + 2: CLASS_KW@26..32 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@32..36 + 0: IDENT@32..36 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@36..38 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@38..38 + 9: R_CURLY@38..39 "}" [] [] + 2: (empty) + 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap new file mode 100644 index 000000000000..fc2f9e04006b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap @@ -0,0 +1,170 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@first.field @second @(() => decorator)() +export default class Bar {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..6 "first" [] [], + }, + }, + operator_token: DOT@6..7 "." [] [], + member: JsName { + value_token: IDENT@7..13 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@13..14 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..21 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@21..22 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@22..23 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@29..38 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@38..39 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@39..40 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@40..41 ")" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@57..63 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@63..67 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@67..68 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@68..69 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@69..70 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..70 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..69 + 0: JS_EXPORT@0..69 + 0: JS_DECORATOR_LIST@0..41 + 0: JS_DECORATOR@0..13 + 0: AT@0..1 "@" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@1..13 + 0: JS_IDENTIFIER_EXPRESSION@1..6 + 0: JS_REFERENCE_IDENTIFIER@1..6 + 0: IDENT@1..6 "first" [] [] + 1: DOT@6..7 "." [] [] + 2: JS_NAME@7..13 + 0: IDENT@7..13 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@13..21 + 0: AT@13..14 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@14..21 + 0: JS_REFERENCE_IDENTIFIER@14..21 + 0: IDENT@14..21 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@21..41 + 0: AT@21..22 "@" [] [] + 1: JS_CALL_EXPRESSION@22..41 + 0: JS_PARENTHESIZED_EXPRESSION@22..39 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@23..38 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@26..29 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@29..38 + 0: JS_REFERENCE_IDENTIFIER@29..38 + 0: IDENT@29..38 "decorator" [] [] + 2: R_PAREN@38..39 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@39..41 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@40..40 + 2: R_PAREN@40..41 ")" [] [] + 1: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@49..69 + 0: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@57..69 + 0: JS_DECORATOR_LIST@57..57 + 1: (empty) + 2: CLASS_KW@57..63 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@63..67 + 0: IDENT@63..67 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@67..68 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@68..68 + 9: R_CURLY@68..69 "}" [] [] + 2: (empty) + 4: EOF@69..70 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap new file mode 100644 index 000000000000..19f908015c77 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap @@ -0,0 +1,105 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@before +export default @after class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..7 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@7..15 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@15..23 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@23..24 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..30 "after" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@30..36 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@36..40 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@40..42 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@43..44 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..44 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..43 + 0: JS_EXPORT@0..43 + 0: JS_DECORATOR_LIST@0..7 + 0: JS_DECORATOR@0..7 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..7 + 0: JS_REFERENCE_IDENTIFIER@1..7 + 0: IDENT@1..7 "before" [] [] + 1: EXPORT_KW@7..15 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@15..43 + 0: DEFAULT_KW@15..23 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@23..43 + 0: JS_DECORATOR_LIST@23..30 + 0: JS_DECORATOR@23..30 + 0: AT@23..24 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@24..30 + 0: JS_REFERENCE_IDENTIFIER@24..30 + 0: IDENT@24..30 "after" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@30..36 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@36..40 + 0: IDENT@36..40 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@40..42 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@42..42 + 9: R_CURLY@42..43 "}" [] [] + 2: (empty) + 4: EOF@43..44 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap new file mode 100644 index 000000000000..d2a177a8ab11 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts + @before + export default abstract class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..2 "@" [Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@2..8 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@25..34 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@34..40 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@40..44 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@46..47 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_EXPORT@0..47 + 0: JS_DECORATOR_LIST@0..8 + 0: JS_DECORATOR@0..8 + 0: AT@0..2 "@" [Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@2..8 + 0: JS_REFERENCE_IDENTIFIER@2..8 + 0: IDENT@2..8 "before" [] [] + 1: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@17..47 + 0: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@25..47 + 0: JS_DECORATOR_LIST@25..25 + 1: ABSTRACT_KW@25..34 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@34..40 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@40..44 + 0: IDENT@40..44 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@44..46 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@46..46 + 9: R_CURLY@46..47 "}" [] [] + 2: (empty) + 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap new file mode 100644 index 000000000000..866463eee8d9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap @@ -0,0 +1,105 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts + @before + export default @after abstract class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..2 "@" [Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@2..8 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@25..26 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..32 "after" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@32..41 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@41..47 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@47..51 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@51..53 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@53..54 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_EXPORT@0..54 + 0: JS_DECORATOR_LIST@0..8 + 0: JS_DECORATOR@0..8 + 0: AT@0..2 "@" [Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@2..8 + 0: JS_REFERENCE_IDENTIFIER@2..8 + 0: IDENT@2..8 "before" [] [] + 1: EXPORT_KW@8..17 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@17..54 + 0: DEFAULT_KW@17..25 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@25..54 + 0: JS_DECORATOR_LIST@25..32 + 0: JS_DECORATOR@25..32 + 0: AT@25..26 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@26..32 + 0: JS_REFERENCE_IDENTIFIER@26..32 + 0: IDENT@26..32 "after" [] [Whitespace(" ")] + 1: ABSTRACT_KW@32..41 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@41..47 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@47..51 + 0: IDENT@47..51 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@51..53 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@53..53 + 9: R_CURLY@53..54 "}" [] [] + 2: (empty) + 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js.snap new file mode 100644 index 000000000000..1cf5f55cfc5a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js.snap @@ -0,0 +1,387 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +export class Foo { } +@first.field @second @(() => decorator)() +export class Bar {} +@before +export @after class Foo { } + @before + export abstract class Foo { } + @before + export @after abstract class Foo { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..10 "decorator" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@18..24 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@24..28 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@31..33 "@" [Newline("\n")] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..38 "first" [] [], + }, + }, + operator_token: DOT@38..39 "." [] [], + member: JsName { + value_token: IDENT@39..45 "field" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@45..46 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..53 "second" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@53..54 "@" [] [], + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@54..55 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@55..56 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@61..70 "decorator" [] [], + }, + }, + }, + r_paren_token: R_PAREN@70..71 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@71..72 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@72..73 ")" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@73..81 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@81..87 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@87..91 "Bar" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@91..92 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@93..95 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@95..101 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@101..109 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@109..110 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@110..116 "after" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@116..122 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@122..126 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@126..128 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@128..129 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@129..132 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@132..138 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@138..147 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@147..156 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@156..162 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@162..166 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@166..168 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@168..169 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@169..172 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@172..178 "before" [] [], + }, + }, + }, + ], + export_token: EXPORT_KW@178..187 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@187..188 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@188..194 "after" [] [Whitespace(" ")], + }, + }, + }, + ], + abstract_token: ABSTRACT_KW@194..203 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@203..209 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@209..213 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@213..215 "{" [] [Whitespace(" ")], + members: JsClassMemberList [], + r_curly_token: R_CURLY@215..216 "}" [] [], + }, + }, + ], + eof_token: EOF@216..217 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..217 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..216 + 0: JS_EXPORT@0..31 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..10 + 0: JS_REFERENCE_IDENTIFIER@1..10 + 0: IDENT@1..10 "decorator" [] [] + 1: EXPORT_KW@10..18 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@18..31 + 0: JS_DECORATOR_LIST@18..18 + 1: (empty) + 2: CLASS_KW@18..24 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@24..28 + 0: IDENT@24..28 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@28..30 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@30..30 + 9: R_CURLY@30..31 "}" [] [] + 1: JS_EXPORT@31..93 + 0: JS_DECORATOR_LIST@31..73 + 0: JS_DECORATOR@31..45 + 0: AT@31..33 "@" [Newline("\n")] [] + 1: JS_STATIC_MEMBER_EXPRESSION@33..45 + 0: JS_IDENTIFIER_EXPRESSION@33..38 + 0: JS_REFERENCE_IDENTIFIER@33..38 + 0: IDENT@33..38 "first" [] [] + 1: DOT@38..39 "." [] [] + 2: JS_NAME@39..45 + 0: IDENT@39..45 "field" [] [Whitespace(" ")] + 1: JS_DECORATOR@45..53 + 0: AT@45..46 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@46..53 + 0: JS_REFERENCE_IDENTIFIER@46..53 + 0: IDENT@46..53 "second" [] [Whitespace(" ")] + 2: JS_DECORATOR@53..73 + 0: AT@53..54 "@" [] [] + 1: JS_CALL_EXPRESSION@54..73 + 0: JS_PARENTHESIZED_EXPRESSION@54..71 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@55..70 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@55..58 + 0: L_PAREN@55..56 "(" [] [] + 1: JS_PARAMETER_LIST@56..56 + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@61..70 + 0: JS_REFERENCE_IDENTIFIER@61..70 + 0: IDENT@61..70 "decorator" [] [] + 2: R_PAREN@70..71 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@71..73 + 0: L_PAREN@71..72 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@72..72 + 2: R_PAREN@72..73 ")" [] [] + 1: EXPORT_KW@73..81 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@81..93 + 0: JS_DECORATOR_LIST@81..81 + 1: (empty) + 2: CLASS_KW@81..87 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@87..91 + 0: IDENT@87..91 "Bar" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@91..92 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@92..92 + 9: R_CURLY@92..93 "}" [] [] + 2: JS_EXPORT@93..129 + 0: JS_DECORATOR_LIST@93..101 + 0: JS_DECORATOR@93..101 + 0: AT@93..95 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@95..101 + 0: JS_REFERENCE_IDENTIFIER@95..101 + 0: IDENT@95..101 "before" [] [] + 1: EXPORT_KW@101..109 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@109..129 + 0: JS_DECORATOR_LIST@109..116 + 0: JS_DECORATOR@109..116 + 0: AT@109..110 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@110..116 + 0: JS_REFERENCE_IDENTIFIER@110..116 + 0: IDENT@110..116 "after" [] [Whitespace(" ")] + 1: (empty) + 2: CLASS_KW@116..122 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@122..126 + 0: IDENT@122..126 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@126..128 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@128..128 + 9: R_CURLY@128..129 "}" [] [] + 3: JS_EXPORT@129..169 + 0: JS_DECORATOR_LIST@129..138 + 0: JS_DECORATOR@129..138 + 0: AT@129..132 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@132..138 + 0: JS_REFERENCE_IDENTIFIER@132..138 + 0: IDENT@132..138 "before" [] [] + 1: EXPORT_KW@138..147 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@147..169 + 0: JS_DECORATOR_LIST@147..147 + 1: ABSTRACT_KW@147..156 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@156..162 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@162..166 + 0: IDENT@162..166 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@166..168 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@168..168 + 9: R_CURLY@168..169 "}" [] [] + 4: JS_EXPORT@169..216 + 0: JS_DECORATOR_LIST@169..178 + 0: JS_DECORATOR@169..178 + 0: AT@169..172 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@172..178 + 0: JS_REFERENCE_IDENTIFIER@172..178 + 0: IDENT@172..178 "before" [] [] + 1: EXPORT_KW@178..187 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@187..216 + 0: JS_DECORATOR_LIST@187..194 + 0: JS_DECORATOR@187..194 + 0: AT@187..188 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@188..194 + 0: JS_REFERENCE_IDENTIFIER@188..194 + 0: IDENT@188..194 "after" [] [Whitespace(" ")] + 1: ABSTRACT_KW@194..203 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@203..209 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@209..213 + 0: IDENT@209..213 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@213..215 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@215..215 + 9: R_CURLY@215..216 "}" [] [] + 4: EOF@216..217 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js.snap new file mode 100644 index 000000000000..bb6bf83c4619 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js.snap @@ -0,0 +1,216 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = @decorator class {}; +let b = @first @second class foo { + constructor() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@8..9 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..19 "decorator" [] [Whitespace(" ")], + }, + }, + }, + ], + class_token: CLASS_KW@19..25 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@25..26 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..35 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@35..37 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@37..38 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..44 "first" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@44..45 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..52 "second" [] [Whitespace(" ")], + }, + }, + }, + ], + class_token: CLASS_KW@52..58 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@58..62 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@62..63 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@63..76 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@76..77 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@77..79 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@79..80 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@81..83 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@83..84 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..84 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..83 + 0: JS_VARIABLE_STATEMENT@0..28 + 0: JS_VARIABLE_DECLARATION@0..27 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..27 + 0: JS_VARIABLE_DECLARATOR@4..27 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..27 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@8..27 + 0: JS_DECORATOR_LIST@8..19 + 0: JS_DECORATOR@8..19 + 0: AT@8..9 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@9..19 + 0: JS_REFERENCE_IDENTIFIER@9..19 + 0: IDENT@9..19 "decorator" [] [Whitespace(" ")] + 1: CLASS_KW@19..25 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@25..26 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@26..26 + 8: R_CURLY@26..27 "}" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_VARIABLE_STATEMENT@28..83 + 0: JS_VARIABLE_DECLARATION@28..83 + 0: (empty) + 1: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@33..83 + 0: JS_VARIABLE_DECLARATOR@33..83 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@35..83 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@37..83 + 0: JS_DECORATOR_LIST@37..52 + 0: JS_DECORATOR@37..44 + 0: AT@37..38 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@38..44 + 0: JS_REFERENCE_IDENTIFIER@38..44 + 0: IDENT@38..44 "first" [] [Whitespace(" ")] + 1: JS_DECORATOR@44..52 + 0: AT@44..45 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@45..52 + 0: JS_REFERENCE_IDENTIFIER@45..52 + 0: IDENT@45..52 "second" [] [Whitespace(" ")] + 1: CLASS_KW@52..58 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@58..62 + 0: IDENT@58..62 "foo" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@62..63 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@63..81 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@63..81 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@63..63 + 1: JS_LITERAL_MEMBER_NAME@63..76 + 0: IDENT@63..76 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@76..79 + 0: L_PAREN@76..77 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@77..77 + 2: R_PAREN@77..79 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@79..81 + 0: L_CURLY@79..80 "{" [] [] + 1: JS_DIRECTIVE_LIST@80..80 + 2: JS_STATEMENT_LIST@80..80 + 3: R_CURLY@80..81 "}" [] [] + 8: R_CURLY@81..83 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@83..84 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js.snap new file mode 100644 index 000000000000..4a586320a883 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js.snap @@ -0,0 +1,149 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const { value, f = (value) => value } = item + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@6..8 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@8..13 "value" [] [], + }, + init: missing (optional), + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@15..17 "f" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@17..19 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@19..20 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@20..25 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..36 "value" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + ], + r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..44 "item" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: JS_VARIABLE_STATEMENT@0..44 + 0: JS_VARIABLE_DECLARATION@0..44 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..44 + 0: JS_VARIABLE_DECLARATOR@6..44 + 0: JS_OBJECT_BINDING_PATTERN@6..38 + 0: L_CURLY@6..8 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@8..36 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@8..13 + 0: JS_IDENTIFIER_BINDING@8..13 + 0: IDENT@8..13 "value" [] [] + 1: (empty) + 1: COMMA@13..15 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@15..36 + 0: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "f" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@17..36 + 0: EQ@17..19 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@19..36 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@19..27 + 0: L_PAREN@19..20 "(" [] [] + 1: JS_PARAMETER_LIST@20..25 + 0: JS_FORMAL_PARAMETER@20..25 + 0: JS_DECORATOR_LIST@20..20 + 1: JS_IDENTIFIER_BINDING@20..25 + 0: IDENT@20..25 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@27..30 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@30..36 + 0: JS_REFERENCE_IDENTIFIER@30..36 + 0: IDENT@30..36 "value" [] [Whitespace(" ")] + 2: R_CURLY@36..38 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@38..44 + 0: EQ@38..40 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@40..44 + 0: JS_REFERENCE_IDENTIFIER@40..44 + 0: IDENT@40..44 "item" [] [] + 1: (empty) + 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/directives.js b/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/directives.js rename to crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs.snap new file mode 100644 index 000000000000..177a0838c83f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs.snap @@ -0,0 +1,465 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +"use new" +let a = 10; +"use strict"; // not a directive +function test() { + 'use strict'; + let b = 10; + 'use strict'; // not a directive +} +(function () { + "use strict"; + "use strict" + .length; // not a directive + let c = 10; + "use strict"; // not a directive +}); +let b = () => { + "use strict"; + let e = 10; + "use strict"; // not a directive +} +{ + "use strict"; // not a directive +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@0..19 "\"use new\"" [Comments("// SCRIPT"), Newline("\n")] [], + semicolon_token: missing (optional), + }, + ], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@24..26 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@26..28 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@28..30 "10" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@31..44 "\"use strict\"" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@44..64 ";" [] [Whitespace(" "), Comments("// not a directive")], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@64..74 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@74..78 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@78..79 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@79..81 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@81..82 "{" [] [], + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@82..97 "'use strict'" [Newline("\n"), Whitespace(" ")] [], + semicolon_token: SEMICOLON@97..98 ";" [] [], + }, + ], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@98..105 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@105..107 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@107..109 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@109..111 "10" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@112..127 "'use strict'" [Newline("\n"), Whitespace(" ")] [], + }, + semicolon_token: SEMICOLON@127..147 ";" [] [Whitespace(" "), Comments("// not a directive")], + }, + ], + r_curly_token: R_CURLY@147..149 "}" [Newline("\n")] [], + }, + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@149..151 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@151..160 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@160..161 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@161..163 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@163..164 "{" [] [], + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@164..179 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + semicolon_token: SEMICOLON@179..180 ";" [] [], + }, + ], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@180..195 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + }, + operator_token: DOT@195..201 "." [Newline("\n"), Whitespace(" ")] [], + member: JsName { + value_token: IDENT@201..207 "length" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@207..227 ";" [] [Whitespace(" "), Comments("// not a directive")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@227..234 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@234..236 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@236..238 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@238..240 "10" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@240..241 ";" [] [], + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@241..256 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + }, + semicolon_token: SEMICOLON@256..276 ";" [] [Whitespace(" "), Comments("// not a directive")], + }, + ], + r_curly_token: R_CURLY@276..278 "}" [Newline("\n")] [], + }, + }, + r_paren_token: R_PAREN@278..279 ")" [] [], + }, + semicolon_token: SEMICOLON@279..280 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@280..285 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@285..287 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@287..289 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@289..290 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@290..292 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@292..295 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@295..296 "{" [] [], + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@296..311 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + semicolon_token: SEMICOLON@311..312 ";" [] [], + }, + ], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@312..319 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@319..321 "e" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@321..323 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@323..325 "10" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@325..326 ";" [] [], + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@326..341 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + }, + semicolon_token: SEMICOLON@341..362 ";" [] [Whitespace(" "), Comments("// not a directive")], + }, + ], + r_curly_token: R_CURLY@362..364 "}" [Newline("\n")] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@364..366 "{" [Newline("\n")] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@366..381 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + }, + semicolon_token: SEMICOLON@381..401 ";" [] [Whitespace(" "), Comments("// not a directive")], + }, + ], + r_curly_token: R_CURLY@401..403 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@403..404 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..404 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..19 + 0: JS_DIRECTIVE@0..19 + 0: JS_STRING_LITERAL@0..19 "\"use new\"" [Comments("// SCRIPT"), Newline("\n")] [] + 1: (empty) + 3: JS_STATEMENT_LIST@19..403 + 0: JS_VARIABLE_STATEMENT@19..31 + 0: JS_VARIABLE_DECLARATION@19..30 + 0: (empty) + 1: LET_KW@19..24 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@24..30 + 0: JS_VARIABLE_DECLARATOR@24..30 + 0: JS_IDENTIFIER_BINDING@24..26 + 0: IDENT@24..26 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@26..30 + 0: EQ@26..28 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@28..30 + 0: JS_NUMBER_LITERAL@28..30 "10" [] [] + 1: SEMICOLON@30..31 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@31..64 + 0: JS_STRING_LITERAL_EXPRESSION@31..44 + 0: JS_STRING_LITERAL@31..44 "\"use strict\"" [Newline("\n")] [] + 1: SEMICOLON@44..64 ";" [] [Whitespace(" "), Comments("// not a directive")] + 2: JS_FUNCTION_DECLARATION@64..149 + 0: (empty) + 1: FUNCTION_KW@64..74 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@74..78 + 0: IDENT@74..78 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@78..81 + 0: L_PAREN@78..79 "(" [] [] + 1: JS_PARAMETER_LIST@79..79 + 2: R_PAREN@79..81 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@81..149 + 0: L_CURLY@81..82 "{" [] [] + 1: JS_DIRECTIVE_LIST@82..98 + 0: JS_DIRECTIVE@82..98 + 0: JS_STRING_LITERAL@82..97 "'use strict'" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@97..98 ";" [] [] + 2: JS_STATEMENT_LIST@98..147 + 0: JS_VARIABLE_STATEMENT@98..112 + 0: JS_VARIABLE_DECLARATION@98..111 + 0: (empty) + 1: LET_KW@98..105 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@105..111 + 0: JS_VARIABLE_DECLARATOR@105..111 + 0: JS_IDENTIFIER_BINDING@105..107 + 0: IDENT@105..107 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@107..111 + 0: EQ@107..109 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@109..111 + 0: JS_NUMBER_LITERAL@109..111 "10" [] [] + 1: SEMICOLON@111..112 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@112..147 + 0: JS_STRING_LITERAL_EXPRESSION@112..127 + 0: JS_STRING_LITERAL@112..127 "'use strict'" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@127..147 ";" [] [Whitespace(" "), Comments("// not a directive")] + 3: R_CURLY@147..149 "}" [Newline("\n")] [] + 3: JS_EXPRESSION_STATEMENT@149..280 + 0: JS_PARENTHESIZED_EXPRESSION@149..279 + 0: L_PAREN@149..151 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@151..278 + 0: (empty) + 1: FUNCTION_KW@151..160 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@160..163 + 0: L_PAREN@160..161 "(" [] [] + 1: JS_PARAMETER_LIST@161..161 + 2: R_PAREN@161..163 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@163..278 + 0: L_CURLY@163..164 "{" [] [] + 1: JS_DIRECTIVE_LIST@164..180 + 0: JS_DIRECTIVE@164..180 + 0: JS_STRING_LITERAL@164..179 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@179..180 ";" [] [] + 2: JS_STATEMENT_LIST@180..276 + 0: JS_EXPRESSION_STATEMENT@180..207 + 0: JS_STATIC_MEMBER_EXPRESSION@180..207 + 0: JS_STRING_LITERAL_EXPRESSION@180..195 + 0: JS_STRING_LITERAL@180..195 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@195..201 "." [Newline("\n"), Whitespace(" ")] [] + 2: JS_NAME@201..207 + 0: IDENT@201..207 "length" [] [] + 1: (empty) + 1: JS_EMPTY_STATEMENT@207..227 + 0: SEMICOLON@207..227 ";" [] [Whitespace(" "), Comments("// not a directive")] + 2: JS_VARIABLE_STATEMENT@227..241 + 0: JS_VARIABLE_DECLARATION@227..240 + 0: (empty) + 1: LET_KW@227..234 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@234..240 + 0: JS_VARIABLE_DECLARATOR@234..240 + 0: JS_IDENTIFIER_BINDING@234..236 + 0: IDENT@234..236 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@236..240 + 0: EQ@236..238 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@238..240 + 0: JS_NUMBER_LITERAL@238..240 "10" [] [] + 1: SEMICOLON@240..241 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@241..276 + 0: JS_STRING_LITERAL_EXPRESSION@241..256 + 0: JS_STRING_LITERAL@241..256 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@256..276 ";" [] [Whitespace(" "), Comments("// not a directive")] + 3: R_CURLY@276..278 "}" [Newline("\n")] [] + 2: R_PAREN@278..279 ")" [] [] + 1: SEMICOLON@279..280 ";" [] [] + 4: JS_VARIABLE_STATEMENT@280..364 + 0: JS_VARIABLE_DECLARATION@280..364 + 0: (empty) + 1: LET_KW@280..285 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@285..364 + 0: JS_VARIABLE_DECLARATOR@285..364 + 0: JS_IDENTIFIER_BINDING@285..287 + 0: IDENT@285..287 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@287..364 + 0: EQ@287..289 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@289..364 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@289..292 + 0: L_PAREN@289..290 "(" [] [] + 1: JS_PARAMETER_LIST@290..290 + 2: R_PAREN@290..292 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@292..295 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@295..364 + 0: L_CURLY@295..296 "{" [] [] + 1: JS_DIRECTIVE_LIST@296..312 + 0: JS_DIRECTIVE@296..312 + 0: JS_STRING_LITERAL@296..311 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@311..312 ";" [] [] + 2: JS_STATEMENT_LIST@312..362 + 0: JS_VARIABLE_STATEMENT@312..326 + 0: JS_VARIABLE_DECLARATION@312..325 + 0: (empty) + 1: LET_KW@312..319 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@319..325 + 0: JS_VARIABLE_DECLARATOR@319..325 + 0: JS_IDENTIFIER_BINDING@319..321 + 0: IDENT@319..321 "e" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@321..325 + 0: EQ@321..323 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@323..325 + 0: JS_NUMBER_LITERAL@323..325 "10" [] [] + 1: SEMICOLON@325..326 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@326..362 + 0: JS_STRING_LITERAL_EXPRESSION@326..341 + 0: JS_STRING_LITERAL@326..341 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@341..362 ";" [] [Whitespace(" "), Comments("// not a directive")] + 3: R_CURLY@362..364 "}" [Newline("\n")] [] + 1: (empty) + 5: JS_BLOCK_STATEMENT@364..403 + 0: L_CURLY@364..366 "{" [Newline("\n")] [] + 1: JS_STATEMENT_LIST@366..401 + 0: JS_EXPRESSION_STATEMENT@366..401 + 0: JS_STRING_LITERAL_EXPRESSION@366..381 + 0: JS_STRING_LITERAL@366..381 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@381..401 ";" [] [Whitespace(" "), Comments("// not a directive")] + 2: R_CURLY@401..403 "}" [Newline("\n")] [] + 4: EOF@403..404 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/directives_redundant.js b/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/directives_redundant.js rename to crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs.snap new file mode 100644 index 000000000000..9a2e66a046ba --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs.snap @@ -0,0 +1,225 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test() { + "use strict"; + function inner_a() { + "use strict"; + } + function inner_b() { + function inner_inner() { + "use strict"; + } + } +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..23 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@27..42 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + ], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@43..55 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@55..62 "inner_a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@62..63 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@65..66 "{" [] [], + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@66..83 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + ], + statements: JsStatementList [], + r_curly_token: R_CURLY@84..88 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@88..100 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@100..107 "inner_b" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@107..108 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@110..111 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@111..125 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@125..136 "inner_inner" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@136..137 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@137..139 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@139..140 "{" [] [], + directives: JsDirectiveList [ + JsDirective { + value_token: JS_STRING_LITERAL@140..159 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [], + semicolon_token: SEMICOLON@159..160 ";" [] [], + }, + ], + statements: JsStatementList [], + r_curly_token: R_CURLY@160..166 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@166..170 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@170..172 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@172..173 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..173 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..172 + 0: JS_FUNCTION_DECLARATION@0..172 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..23 + 0: IDENT@19..23 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@26..172 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..43 + 0: JS_DIRECTIVE@27..43 + 0: JS_STRING_LITERAL@27..42 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@42..43 ";" [] [] + 2: JS_STATEMENT_LIST@43..170 + 0: JS_FUNCTION_DECLARATION@43..88 + 0: (empty) + 1: FUNCTION_KW@43..55 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@55..62 + 0: IDENT@55..62 "inner_a" [] [] + 4: (empty) + 5: JS_PARAMETERS@62..65 + 0: L_PAREN@62..63 "(" [] [] + 1: JS_PARAMETER_LIST@63..63 + 2: R_PAREN@63..65 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@65..88 + 0: L_CURLY@65..66 "{" [] [] + 1: JS_DIRECTIVE_LIST@66..84 + 0: JS_DIRECTIVE@66..84 + 0: JS_STRING_LITERAL@66..83 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@83..84 ";" [] [] + 2: JS_STATEMENT_LIST@84..84 + 3: R_CURLY@84..88 "}" [Newline("\n"), Whitespace(" ")] [] + 1: JS_FUNCTION_DECLARATION@88..170 + 0: (empty) + 1: FUNCTION_KW@88..100 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@100..107 + 0: IDENT@100..107 "inner_b" [] [] + 4: (empty) + 5: JS_PARAMETERS@107..110 + 0: L_PAREN@107..108 "(" [] [] + 1: JS_PARAMETER_LIST@108..108 + 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@110..170 + 0: L_CURLY@110..111 "{" [] [] + 1: JS_DIRECTIVE_LIST@111..111 + 2: JS_STATEMENT_LIST@111..166 + 0: JS_FUNCTION_DECLARATION@111..166 + 0: (empty) + 1: FUNCTION_KW@111..125 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@125..136 + 0: IDENT@125..136 "inner_inner" [] [] + 4: (empty) + 5: JS_PARAMETERS@136..139 + 0: L_PAREN@136..137 "(" [] [] + 1: JS_PARAMETER_LIST@137..137 + 2: R_PAREN@137..139 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@139..166 + 0: L_CURLY@139..140 "{" [] [] + 1: JS_DIRECTIVE_LIST@140..160 + 0: JS_DIRECTIVE@140..160 + 0: JS_STRING_LITERAL@140..159 "\"use strict\"" [Newline("\n"), Whitespace(" ")] [] + 1: SEMICOLON@159..160 ";" [] [] + 2: JS_STATEMENT_LIST@160..160 + 3: R_CURLY@160..166 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@166..170 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@170..172 "}" [Newline("\n")] [] + 4: EOF@172..173 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/do-while-asi.js b/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/do-while-asi.js rename to crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js.snap new file mode 100644 index 000000000000..35b186817f9b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js.snap @@ -0,0 +1,192 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do do do ; while (x) while (x) while (x) x = 39; +do do ; while (x); while (x) x = 39 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsDoWhileStatement { + do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], + body: JsDoWhileStatement { + do_token: DO_KW@3..6 "do" [] [Whitespace(" ")], + body: JsDoWhileStatement { + do_token: DO_KW@6..9 "do" [] [Whitespace(" ")], + body: JsEmptyStatement { + semicolon_token: SEMICOLON@9..11 ";" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@11..17 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@17..18 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..19 "x" [] [], + }, + }, + r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], + semicolon_token: missing (optional), + }, + while_token: WHILE_KW@21..27 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@27..28 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..29 "x" [] [], + }, + }, + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + semicolon_token: missing (optional), + }, + while_token: WHILE_KW@31..37 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@37..38 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..39 "x" [] [], + }, + }, + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@41..43 "x" [] [Whitespace(" ")], + }, + operator_token: EQ@43..45 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@45..47 "39" [] [], + }, + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + JsDoWhileStatement { + do_token: DO_KW@48..52 "do" [Newline("\n")] [Whitespace(" ")], + body: JsDoWhileStatement { + do_token: DO_KW@52..55 "do" [] [Whitespace(" ")], + body: JsEmptyStatement { + semicolon_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@57..63 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@63..64 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@64..65 "x" [] [], + }, + }, + r_paren_token: R_PAREN@65..66 ")" [] [], + semicolon_token: SEMICOLON@66..68 ";" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@68..74 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@74..75 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@75..76 "x" [] [], + }, + }, + r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@78..80 "x" [] [Whitespace(" ")], + }, + operator_token: EQ@80..82 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@82..84 "39" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: JS_DO_WHILE_STATEMENT@0..41 + 0: DO_KW@0..3 "do" [] [Whitespace(" ")] + 1: JS_DO_WHILE_STATEMENT@3..31 + 0: DO_KW@3..6 "do" [] [Whitespace(" ")] + 1: JS_DO_WHILE_STATEMENT@6..21 + 0: DO_KW@6..9 "do" [] [Whitespace(" ")] + 1: JS_EMPTY_STATEMENT@9..11 + 0: SEMICOLON@9..11 ";" [] [Whitespace(" ")] + 2: WHILE_KW@11..17 "while" [] [Whitespace(" ")] + 3: L_PAREN@17..18 "(" [] [] + 4: JS_IDENTIFIER_EXPRESSION@18..19 + 0: JS_REFERENCE_IDENTIFIER@18..19 + 0: IDENT@18..19 "x" [] [] + 5: R_PAREN@19..21 ")" [] [Whitespace(" ")] + 6: (empty) + 2: WHILE_KW@21..27 "while" [] [Whitespace(" ")] + 3: L_PAREN@27..28 "(" [] [] + 4: JS_IDENTIFIER_EXPRESSION@28..29 + 0: JS_REFERENCE_IDENTIFIER@28..29 + 0: IDENT@28..29 "x" [] [] + 5: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 6: (empty) + 2: WHILE_KW@31..37 "while" [] [Whitespace(" ")] + 3: L_PAREN@37..38 "(" [] [] + 4: JS_IDENTIFIER_EXPRESSION@38..39 + 0: JS_REFERENCE_IDENTIFIER@38..39 + 0: IDENT@38..39 "x" [] [] + 5: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 6: (empty) + 1: JS_EXPRESSION_STATEMENT@41..48 + 0: JS_ASSIGNMENT_EXPRESSION@41..47 + 0: JS_IDENTIFIER_ASSIGNMENT@41..43 + 0: IDENT@41..43 "x" [] [Whitespace(" ")] + 1: EQ@43..45 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@45..47 + 0: JS_NUMBER_LITERAL@45..47 "39" [] [] + 1: SEMICOLON@47..48 ";" [] [] + 2: JS_DO_WHILE_STATEMENT@48..78 + 0: DO_KW@48..52 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_DO_WHILE_STATEMENT@52..68 + 0: DO_KW@52..55 "do" [] [Whitespace(" ")] + 1: JS_EMPTY_STATEMENT@55..57 + 0: SEMICOLON@55..57 ";" [] [Whitespace(" ")] + 2: WHILE_KW@57..63 "while" [] [Whitespace(" ")] + 3: L_PAREN@63..64 "(" [] [] + 4: JS_IDENTIFIER_EXPRESSION@64..65 + 0: JS_REFERENCE_IDENTIFIER@64..65 + 0: IDENT@64..65 "x" [] [] + 5: R_PAREN@65..66 ")" [] [] + 6: SEMICOLON@66..68 ";" [] [Whitespace(" ")] + 2: WHILE_KW@68..74 "while" [] [Whitespace(" ")] + 3: L_PAREN@74..75 "(" [] [] + 4: JS_IDENTIFIER_EXPRESSION@75..76 + 0: JS_REFERENCE_IDENTIFIER@75..76 + 0: IDENT@75..76 "x" [] [] + 5: R_PAREN@76..78 ")" [] [Whitespace(" ")] + 6: (empty) + 3: JS_EXPRESSION_STATEMENT@78..84 + 0: JS_ASSIGNMENT_EXPRESSION@78..84 + 0: JS_IDENTIFIER_ASSIGNMENT@78..80 + 0: IDENT@78..80 "x" [] [Whitespace(" ")] + 1: EQ@80..82 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@82..84 + 0: JS_NUMBER_LITERAL@82..84 "39" [] [] + 1: (empty) + 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/do_while_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js.snap new file mode 100644 index 000000000000..d1f71b425e58 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js.snap @@ -0,0 +1,321 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do console.log("test"); while(true) +do { + console.log("test") +} while (true); +let a = 1; +do +do { + a = a + 1 +} while(a < 5) +while (a < 100) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsDoWhileStatement { + do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@3..10 "console" [] [], + }, + }, + operator_token: DOT@10..11 "." [] [], + member: JsName { + value_token: IDENT@11..14 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@14..15 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@15..21 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@21..22 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@24..29 "while" [] [], + l_paren_token: L_PAREN@29..30 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@30..34 "true" [] [], + }, + r_paren_token: R_PAREN@34..35 ")" [] [], + semicolon_token: missing (optional), + }, + JsDoWhileStatement { + do_token: DO_KW@35..39 "do" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@39..40 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..50 "console" [Newline("\n"), Whitespace(" ")] [], + }, + }, + operator_token: DOT@50..51 "." [] [], + member: JsName { + value_token: IDENT@51..54 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@54..55 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@55..61 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@61..62 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@62..65 "}" [Newline("\n")] [Whitespace(" ")], + }, + while_token: WHILE_KW@65..71 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@71..72 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@72..76 "true" [] [], + }, + r_paren_token: R_PAREN@76..77 ")" [] [], + semicolon_token: SEMICOLON@77..78 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@78..83 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@83..85 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@85..87 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@87..88 "1" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@88..89 ";" [] [], + }, + JsDoWhileStatement { + do_token: DO_KW@89..92 "do" [Newline("\n")] [], + body: JsDoWhileStatement { + do_token: DO_KW@92..96 "do" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@96..97 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@97..102 "a" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + operator_token: EQ@102..104 "=" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@104..106 "a" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@106..108 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@108..109 "1" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@109..112 "}" [Newline("\n")] [Whitespace(" ")], + }, + while_token: WHILE_KW@112..117 "while" [] [], + l_paren_token: L_PAREN@117..118 "(" [] [], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@118..120 "a" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@120..122 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@122..123 "5" [] [], + }, + }, + r_paren_token: R_PAREN@123..124 ")" [] [], + semicolon_token: missing (optional), + }, + while_token: WHILE_KW@124..131 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@131..132 "(" [] [], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@132..134 "a" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@134..136 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@136..139 "100" [] [], + }, + }, + r_paren_token: R_PAREN@139..140 ")" [] [], + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@140..141 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..141 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..140 + 0: JS_DO_WHILE_STATEMENT@0..35 + 0: DO_KW@0..3 "do" [] [Whitespace(" ")] + 1: JS_EXPRESSION_STATEMENT@3..24 + 0: JS_CALL_EXPRESSION@3..22 + 0: JS_STATIC_MEMBER_EXPRESSION@3..14 + 0: JS_IDENTIFIER_EXPRESSION@3..10 + 0: JS_REFERENCE_IDENTIFIER@3..10 + 0: IDENT@3..10 "console" [] [] + 1: DOT@10..11 "." [] [] + 2: JS_NAME@11..14 + 0: IDENT@11..14 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@14..22 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@15..21 + 0: JS_STRING_LITERAL_EXPRESSION@15..21 + 0: JS_STRING_LITERAL@15..21 "\"test\"" [] [] + 2: R_PAREN@21..22 ")" [] [] + 1: SEMICOLON@22..24 ";" [] [Whitespace(" ")] + 2: WHILE_KW@24..29 "while" [] [] + 3: L_PAREN@29..30 "(" [] [] + 4: JS_BOOLEAN_LITERAL_EXPRESSION@30..34 + 0: TRUE_KW@30..34 "true" [] [] + 5: R_PAREN@34..35 ")" [] [] + 6: (empty) + 1: JS_DO_WHILE_STATEMENT@35..78 + 0: DO_KW@35..39 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@39..65 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_STATEMENT_LIST@40..62 + 0: JS_EXPRESSION_STATEMENT@40..62 + 0: JS_CALL_EXPRESSION@40..62 + 0: JS_STATIC_MEMBER_EXPRESSION@40..54 + 0: JS_IDENTIFIER_EXPRESSION@40..50 + 0: JS_REFERENCE_IDENTIFIER@40..50 + 0: IDENT@40..50 "console" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@50..51 "." [] [] + 2: JS_NAME@51..54 + 0: IDENT@51..54 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@54..62 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@55..61 + 0: JS_STRING_LITERAL_EXPRESSION@55..61 + 0: JS_STRING_LITERAL@55..61 "\"test\"" [] [] + 2: R_PAREN@61..62 ")" [] [] + 1: (empty) + 2: R_CURLY@62..65 "}" [Newline("\n")] [Whitespace(" ")] + 2: WHILE_KW@65..71 "while" [] [Whitespace(" ")] + 3: L_PAREN@71..72 "(" [] [] + 4: JS_BOOLEAN_LITERAL_EXPRESSION@72..76 + 0: TRUE_KW@72..76 "true" [] [] + 5: R_PAREN@76..77 ")" [] [] + 6: SEMICOLON@77..78 ";" [] [] + 2: JS_VARIABLE_STATEMENT@78..89 + 0: JS_VARIABLE_DECLARATION@78..88 + 0: (empty) + 1: LET_KW@78..83 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@83..88 + 0: JS_VARIABLE_DECLARATOR@83..88 + 0: JS_IDENTIFIER_BINDING@83..85 + 0: IDENT@83..85 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@85..88 + 0: EQ@85..87 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@87..88 + 0: JS_NUMBER_LITERAL@87..88 "1" [] [] + 1: SEMICOLON@88..89 ";" [] [] + 3: JS_DO_WHILE_STATEMENT@89..140 + 0: DO_KW@89..92 "do" [Newline("\n")] [] + 1: JS_DO_WHILE_STATEMENT@92..124 + 0: DO_KW@92..96 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@96..112 + 0: L_CURLY@96..97 "{" [] [] + 1: JS_STATEMENT_LIST@97..109 + 0: JS_EXPRESSION_STATEMENT@97..109 + 0: JS_ASSIGNMENT_EXPRESSION@97..109 + 0: JS_IDENTIFIER_ASSIGNMENT@97..102 + 0: IDENT@97..102 "a" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: EQ@102..104 "=" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@104..109 + 0: JS_IDENTIFIER_EXPRESSION@104..106 + 0: JS_REFERENCE_IDENTIFIER@104..106 + 0: IDENT@104..106 "a" [] [Whitespace(" ")] + 1: PLUS@106..108 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@108..109 + 0: JS_NUMBER_LITERAL@108..109 "1" [] [] + 1: (empty) + 2: R_CURLY@109..112 "}" [Newline("\n")] [Whitespace(" ")] + 2: WHILE_KW@112..117 "while" [] [] + 3: L_PAREN@117..118 "(" [] [] + 4: JS_BINARY_EXPRESSION@118..123 + 0: JS_IDENTIFIER_EXPRESSION@118..120 + 0: JS_REFERENCE_IDENTIFIER@118..120 + 0: IDENT@118..120 "a" [] [Whitespace(" ")] + 1: L_ANGLE@120..122 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@122..123 + 0: JS_NUMBER_LITERAL@122..123 "5" [] [] + 5: R_PAREN@123..124 ")" [] [] + 6: (empty) + 2: WHILE_KW@124..131 "while" [Newline("\n")] [Whitespace(" ")] + 3: L_PAREN@131..132 "(" [] [] + 4: JS_BINARY_EXPRESSION@132..139 + 0: JS_IDENTIFIER_EXPRESSION@132..134 + 0: JS_REFERENCE_IDENTIFIER@132..134 + 0: IDENT@132..134 "a" [] [Whitespace(" ")] + 1: L_ANGLE@134..136 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@136..139 + 0: JS_NUMBER_LITERAL@136..139 "100" [] [] + 5: R_PAREN@139..140 ")" [] [] + 6: (empty) + 4: EOF@140..141 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/do_while_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js.snap new file mode 100644 index 000000000000..c41d3200e2ec --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js.snap @@ -0,0 +1,167 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do { } while (true) +do { throw Error("foo") } while (true) +do { break; } while (true) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsDoWhileStatement { + do_token: DO_KW@0..3 "do" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@3..5 "{" [] [Whitespace(" ")], + statements: JsStatementList [], + r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@7..13 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@13..14 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@14..18 "true" [] [], + }, + r_paren_token: R_PAREN@18..19 ")" [] [], + semicolon_token: missing (optional), + }, + JsDoWhileStatement { + do_token: DO_KW@19..23 "do" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@23..25 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsThrowStatement { + throw_token: THROW_KW@25..31 "throw" [] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..36 "Error" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@36..37 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@37..42 "\"foo\"" [] [], + }, + ], + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@44..46 "}" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@46..52 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@52..53 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@53..57 "true" [] [], + }, + r_paren_token: R_PAREN@57..58 ")" [] [], + semicolon_token: missing (optional), + }, + JsDoWhileStatement { + do_token: DO_KW@58..62 "do" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@62..64 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsBreakStatement { + break_token: BREAK_KW@64..69 "break" [] [], + label: missing (optional), + semicolon_token: SEMICOLON@69..71 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], + }, + while_token: WHILE_KW@73..79 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@79..80 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@80..84 "true" [] [], + }, + r_paren_token: R_PAREN@84..85 ")" [] [], + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@85..86 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..86 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..85 + 0: JS_DO_WHILE_STATEMENT@0..19 + 0: DO_KW@0..3 "do" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@3..7 + 0: L_CURLY@3..5 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@5..5 + 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] + 2: WHILE_KW@7..13 "while" [] [Whitespace(" ")] + 3: L_PAREN@13..14 "(" [] [] + 4: JS_BOOLEAN_LITERAL_EXPRESSION@14..18 + 0: TRUE_KW@14..18 "true" [] [] + 5: R_PAREN@18..19 ")" [] [] + 6: (empty) + 1: JS_DO_WHILE_STATEMENT@19..58 + 0: DO_KW@19..23 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@23..46 + 0: L_CURLY@23..25 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@25..44 + 0: JS_THROW_STATEMENT@25..44 + 0: THROW_KW@25..31 "throw" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@31..44 + 0: JS_IDENTIFIER_EXPRESSION@31..36 + 0: JS_REFERENCE_IDENTIFIER@31..36 + 0: IDENT@31..36 "Error" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@36..44 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@37..42 + 0: JS_STRING_LITERAL_EXPRESSION@37..42 + 0: JS_STRING_LITERAL@37..42 "\"foo\"" [] [] + 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 2: (empty) + 2: R_CURLY@44..46 "}" [] [Whitespace(" ")] + 2: WHILE_KW@46..52 "while" [] [Whitespace(" ")] + 3: L_PAREN@52..53 "(" [] [] + 4: JS_BOOLEAN_LITERAL_EXPRESSION@53..57 + 0: TRUE_KW@53..57 "true" [] [] + 5: R_PAREN@57..58 ")" [] [] + 6: (empty) + 2: JS_DO_WHILE_STATEMENT@58..85 + 0: DO_KW@58..62 "do" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@62..73 + 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@64..71 + 0: JS_BREAK_STATEMENT@64..71 + 0: BREAK_KW@64..69 "break" [] [] + 1: (empty) + 2: SEMICOLON@69..71 ";" [] [Whitespace(" ")] + 2: R_CURLY@71..73 "}" [] [Whitespace(" ")] + 2: WHILE_KW@73..79 "while" [] [Whitespace(" ")] + 3: L_PAREN@79..80 "(" [] [] + 4: JS_BOOLEAN_LITERAL_EXPRESSION@80..84 + 0: TRUE_KW@80..84 "true" [] [] + 5: R_PAREN@84..85 ")" [] [] + 6: (empty) + 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/empty_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/empty_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js.snap new file mode 100644 index 000000000000..5c4e6f1b6105 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js.snap @@ -0,0 +1,41 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsEmptyStatement { + semicolon_token: SEMICOLON@0..1 ";" [] [], + }, + ], + eof_token: EOF@1..2 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..2 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..1 + 0: JS_EMPTY_STATEMENT@0..1 + 0: SEMICOLON@0..1 ";" [] [] + 4: EOF@1..2 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.js b/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.js rename to crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap new file mode 100644 index 000000000000..783336c2e5ad --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap @@ -0,0 +1,285 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(delete a.b) ** 2; +(void ident) ** 2; +(typeof ident) ** 2; +(-3) ** 2; +(+3) ** 2; +(~3) ** 2; +(!true) ** 2; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsUnaryExpression { + operator_token: DELETE_KW@1..8 "delete" [] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..9 "a" [] [], + }, + }, + operator_token: DOT@9..10 "." [] [], + member: JsName { + value_token: IDENT@10..11 "b" [] [], + }, + }, + }, + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@13..16 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@16..17 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], + expression: JsUnaryExpression { + operator_token: VOID_KW@20..25 "void" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@25..30 "ident" [] [], + }, + }, + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@32..35 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@37..39 "(" [Newline("\n")] [], + expression: JsUnaryExpression { + operator_token: TYPEOF_KW@39..46 "typeof" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..51 "ident" [] [], + }, + }, + }, + r_paren_token: R_PAREN@51..53 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@53..56 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@56..57 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@57..58 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@58..60 "(" [Newline("\n")] [], + expression: JsUnaryExpression { + operator_token: MINUS@60..61 "-" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@61..62 "3" [] [], + }, + }, + r_paren_token: R_PAREN@62..64 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@64..67 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@67..68 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@68..69 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@69..71 "(" [Newline("\n")] [], + expression: JsUnaryExpression { + operator_token: PLUS@71..72 "+" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@72..73 "3" [] [], + }, + }, + r_paren_token: R_PAREN@73..75 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@75..78 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@78..79 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@79..80 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@80..82 "(" [Newline("\n")] [], + expression: JsUnaryExpression { + operator_token: TILDE@82..83 "~" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@83..84 "3" [] [], + }, + }, + r_paren_token: R_PAREN@84..86 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@86..89 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@89..90 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@90..91 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@91..93 "(" [Newline("\n")] [], + expression: JsUnaryExpression { + operator_token: BANG@93..94 "!" [] [], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@94..98 "true" [] [], + }, + }, + r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], + }, + operator_token: STAR2@100..103 "**" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@103..104 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@104..105 ";" [] [], + }, + ], + eof_token: EOF@105..106 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..106 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..105 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JS_BINARY_EXPRESSION@0..17 + 0: JS_PARENTHESIZED_EXPRESSION@0..13 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_UNARY_EXPRESSION@1..11 + 0: DELETE_KW@1..8 "delete" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@8..11 + 0: JS_IDENTIFIER_EXPRESSION@8..9 + 0: JS_REFERENCE_IDENTIFIER@8..9 + 0: IDENT@8..9 "a" [] [] + 1: DOT@9..10 "." [] [] + 2: JS_NAME@10..11 + 0: IDENT@10..11 "b" [] [] + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 1: STAR2@13..16 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@16..17 + 0: JS_NUMBER_LITERAL@16..17 "2" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@18..37 + 0: JS_BINARY_EXPRESSION@18..36 + 0: JS_PARENTHESIZED_EXPRESSION@18..32 + 0: L_PAREN@18..20 "(" [Newline("\n")] [] + 1: JS_UNARY_EXPRESSION@20..30 + 0: VOID_KW@20..25 "void" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@25..30 + 0: JS_REFERENCE_IDENTIFIER@25..30 + 0: IDENT@25..30 "ident" [] [] + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 1: STAR2@32..35 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "2" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@37..58 + 0: JS_BINARY_EXPRESSION@37..57 + 0: JS_PARENTHESIZED_EXPRESSION@37..53 + 0: L_PAREN@37..39 "(" [Newline("\n")] [] + 1: JS_UNARY_EXPRESSION@39..51 + 0: TYPEOF_KW@39..46 "typeof" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@46..51 + 0: JS_REFERENCE_IDENTIFIER@46..51 + 0: IDENT@46..51 "ident" [] [] + 2: R_PAREN@51..53 ")" [] [Whitespace(" ")] + 1: STAR2@53..56 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@56..57 + 0: JS_NUMBER_LITERAL@56..57 "2" [] [] + 1: SEMICOLON@57..58 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@58..69 + 0: JS_BINARY_EXPRESSION@58..68 + 0: JS_PARENTHESIZED_EXPRESSION@58..64 + 0: L_PAREN@58..60 "(" [Newline("\n")] [] + 1: JS_UNARY_EXPRESSION@60..62 + 0: MINUS@60..61 "-" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@61..62 + 0: JS_NUMBER_LITERAL@61..62 "3" [] [] + 2: R_PAREN@62..64 ")" [] [Whitespace(" ")] + 1: STAR2@64..67 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@67..68 + 0: JS_NUMBER_LITERAL@67..68 "2" [] [] + 1: SEMICOLON@68..69 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@69..80 + 0: JS_BINARY_EXPRESSION@69..79 + 0: JS_PARENTHESIZED_EXPRESSION@69..75 + 0: L_PAREN@69..71 "(" [Newline("\n")] [] + 1: JS_UNARY_EXPRESSION@71..73 + 0: PLUS@71..72 "+" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@72..73 + 0: JS_NUMBER_LITERAL@72..73 "3" [] [] + 2: R_PAREN@73..75 ")" [] [Whitespace(" ")] + 1: STAR2@75..78 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@78..79 + 0: JS_NUMBER_LITERAL@78..79 "2" [] [] + 1: SEMICOLON@79..80 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@80..91 + 0: JS_BINARY_EXPRESSION@80..90 + 0: JS_PARENTHESIZED_EXPRESSION@80..86 + 0: L_PAREN@80..82 "(" [Newline("\n")] [] + 1: JS_UNARY_EXPRESSION@82..84 + 0: TILDE@82..83 "~" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@83..84 + 0: JS_NUMBER_LITERAL@83..84 "3" [] [] + 2: R_PAREN@84..86 ")" [] [Whitespace(" ")] + 1: STAR2@86..89 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@89..90 + 0: JS_NUMBER_LITERAL@89..90 "2" [] [] + 1: SEMICOLON@90..91 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@91..105 + 0: JS_BINARY_EXPRESSION@91..104 + 0: JS_PARENTHESIZED_EXPRESSION@91..100 + 0: L_PAREN@91..93 "(" [Newline("\n")] [] + 1: JS_UNARY_EXPRESSION@93..98 + 0: BANG@93..94 "!" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@94..98 + 0: TRUE_KW@94..98 "true" [] [] + 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] + 1: STAR2@100..103 "**" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@103..104 + 0: JS_NUMBER_LITERAL@103..104 "2" [] [] + 1: SEMICOLON@104..105 ";" [] [] + 4: EOF@105..106 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js.snap new file mode 100644 index 000000000000..0b90fdef5510 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js.snap @@ -0,0 +1,106 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { as }; +export { as as as } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@9..12 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@12..13 "}" [] [], + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@14..22 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@22..24 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@24..27 "as" [] [Whitespace(" ")], + }, + as_token: AS_KW@27..30 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@30..33 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_EXPORT@0..14 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@7..14 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..12 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@9..12 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@9..12 + 0: IDENT@9..12 "as" [] [Whitespace(" ")] + 3: R_CURLY@12..13 "}" [] [] + 4: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPORT@14..34 + 0: JS_DECORATOR_LIST@14..14 + 1: EXPORT_KW@14..22 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@22..34 + 0: (empty) + 1: L_CURLY@22..24 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@24..33 + 0: JS_EXPORT_NAMED_SPECIFIER@24..33 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@24..27 + 0: IDENT@24..27 "as" [] [Whitespace(" ")] + 2: AS_KW@27..30 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@30..33 + 0: IDENT@30..33 "as" [] [Whitespace(" ")] + 3: R_CURLY@33..34 "}" [] [] + 4: (empty) + 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js.snap new file mode 100644 index 000000000000..e5b7429865d2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js.snap @@ -0,0 +1,116 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export class A {} +export class A extends B {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@7..13 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@13..15 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@15..16 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@17..25 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@25..31 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@31..33 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..43 "B" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@43..44 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@44..45 "}" [] [], + }, + }, + ], + eof_token: EOF@45..46 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..46 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..45 + 0: JS_EXPORT@0..17 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@7..17 + 0: JS_DECORATOR_LIST@7..7 + 1: (empty) + 2: CLASS_KW@7..13 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@13..15 + 0: IDENT@13..15 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@15..16 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@16..16 + 9: R_CURLY@16..17 "}" [] [] + 1: JS_EXPORT@17..45 + 0: JS_DECORATOR_LIST@17..17 + 1: EXPORT_KW@17..25 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@25..45 + 0: JS_DECORATOR_LIST@25..25 + 1: (empty) + 2: CLASS_KW@25..31 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "A" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@33..43 + 0: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@41..43 + 0: JS_REFERENCE_IDENTIFIER@41..43 + 0: IDENT@41..43 "B" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@43..44 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@44..44 + 9: R_CURLY@44..45 "}" [] [] + 4: EOF@45..46 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js.snap new file mode 100644 index 000000000000..98acd13b9c74 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default class {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@15..21 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@21..22 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@22..23 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_EXPORT@0..23 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..23 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@15..23 + 0: JS_DECORATOR_LIST@15..15 + 1: (empty) + 2: CLASS_KW@15..21 "class" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@21..22 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@22..22 + 9: R_CURLY@22..23 "}" [] [] + 2: (empty) + 4: EOF@23..24 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js.snap new file mode 100644 index 000000000000..85f48461d946 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js.snap @@ -0,0 +1,58 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultExpressionClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "a" [] [], + }, + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: JS_EXPORT@0..17 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_EXPRESSION_CLAUSE@7..17 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "a" [] [] + 2: SEMICOLON@16..17 ";" [] [] + 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js.snap new file mode 100644 index 000000000000..26c14102e22b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js.snap @@ -0,0 +1,123 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default function test(a, b) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@24..28 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@29..30 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..33 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@35..36 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@37..38 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..38 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..37 + 0: JS_EXPORT@0..37 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..37 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..37 + 0: (empty) + 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@24..28 + 0: IDENT@24..28 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@28..35 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..33 + 0: JS_FORMAL_PARAMETER@29..30 + 0: JS_DECORATOR_LIST@29..29 + 1: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@30..32 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@32..33 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@35..37 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_DIRECTIVE_LIST@36..36 + 2: JS_STATEMENT_LIST@36..36 + 3: R_CURLY@36..37 "}" [] [] + 2: (empty) + 4: EOF@37..38 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_from_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_from_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js.snap new file mode 100644 index 000000000000..142ade6a13ca --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js.snap @@ -0,0 +1,349 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { + default as a } from "b"; +export { default as a } from "b"; +export * from "a"; +export * as c from "b"; +export * as default from "b" +export * from "mod" assert { type: "json" } +export type * from "types"; +export type * as types from "types"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..8 "{" [] [], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@8..21 "default" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@21..24 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@24..26 "a" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@26..28 "}" [] [Whitespace(" ")], + from_token: FROM_KW@28..33 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@33..36 "\"b\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@37..45 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@47..55 "default" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@55..58 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@58..60 "a" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@60..62 "}" [] [Whitespace(" ")], + from_token: FROM_KW@62..67 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@67..70 "\"b\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@70..71 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@71..79 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: STAR@79..81 "*" [] [Whitespace(" ")], + export_as: missing (optional), + from_token: FROM_KW@81..86 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@86..89 "\"a\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@89..90 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: STAR@98..100 "*" [] [Whitespace(" ")], + export_as: JsExportAsClause { + as_token: AS_KW@100..103 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@103..105 "c" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@105..110 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@110..113 "\"b\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@113..114 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@114..122 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: STAR@122..124 "*" [] [Whitespace(" ")], + export_as: JsExportAsClause { + as_token: AS_KW@124..127 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@127..135 "default" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@135..140 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@140..143 "\"b\"" [] [], + }, + assertion: missing (optional), + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@143..151 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: missing (optional), + star_token: STAR@151..153 "*" [] [Whitespace(" ")], + export_as: missing (optional), + from_token: FROM_KW@153..158 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@158..164 "\"mod\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@164..171 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@171..173 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@173..177 "type" [] [], + colon_token: COLON@177..179 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@179..186 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@186..187 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@187..195 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: TYPE_KW@195..200 "type" [] [Whitespace(" ")], + star_token: STAR@200..202 "*" [] [Whitespace(" ")], + export_as: missing (optional), + from_token: FROM_KW@202..207 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@207..214 "\"types\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@214..215 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@215..223 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportFromClause { + type_token: TYPE_KW@223..228 "type" [] [Whitespace(" ")], + star_token: STAR@228..230 "*" [] [Whitespace(" ")], + export_as: JsExportAsClause { + as_token: AS_KW@230..233 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@233..239 "types" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@239..244 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@244..251 "\"types\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@251..252 ";" [] [], + }, + }, + ], + eof_token: EOF@252..253 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..253 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..252 + 0: JS_EXPORT@0..37 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..37 + 0: (empty) + 1: L_CURLY@7..8 "{" [] [] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@8..26 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@8..26 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@8..21 + 0: IDENT@8..21 "default" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@21..26 + 0: AS_KW@21..24 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@24..26 + 0: IDENT@24..26 "a" [] [Whitespace(" ")] + 3: R_CURLY@26..28 "}" [] [Whitespace(" ")] + 4: FROM_KW@28..33 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@33..36 + 0: JS_STRING_LITERAL@33..36 "\"b\"" [] [] + 6: (empty) + 7: SEMICOLON@36..37 ";" [] [] + 1: JS_EXPORT@37..71 + 0: JS_DECORATOR_LIST@37..37 + 1: EXPORT_KW@37..45 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@45..71 + 0: (empty) + 1: L_CURLY@45..47 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@47..60 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@47..60 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@47..55 + 0: IDENT@47..55 "default" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@55..60 + 0: AS_KW@55..58 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@58..60 + 0: IDENT@58..60 "a" [] [Whitespace(" ")] + 3: R_CURLY@60..62 "}" [] [Whitespace(" ")] + 4: FROM_KW@62..67 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@67..70 + 0: JS_STRING_LITERAL@67..70 "\"b\"" [] [] + 6: (empty) + 7: SEMICOLON@70..71 ";" [] [] + 2: JS_EXPORT@71..90 + 0: JS_DECORATOR_LIST@71..71 + 1: EXPORT_KW@71..79 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@79..90 + 0: (empty) + 1: STAR@79..81 "*" [] [Whitespace(" ")] + 2: (empty) + 3: FROM_KW@81..86 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@86..89 + 0: JS_STRING_LITERAL@86..89 "\"a\"" [] [] + 5: (empty) + 6: SEMICOLON@89..90 ";" [] [] + 3: JS_EXPORT@90..114 + 0: JS_DECORATOR_LIST@90..90 + 1: EXPORT_KW@90..98 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@98..114 + 0: (empty) + 1: STAR@98..100 "*" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@100..105 + 0: AS_KW@100..103 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@103..105 + 0: IDENT@103..105 "c" [] [Whitespace(" ")] + 3: FROM_KW@105..110 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@110..113 + 0: JS_STRING_LITERAL@110..113 "\"b\"" [] [] + 5: (empty) + 6: SEMICOLON@113..114 ";" [] [] + 4: JS_EXPORT@114..143 + 0: JS_DECORATOR_LIST@114..114 + 1: EXPORT_KW@114..122 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@122..143 + 0: (empty) + 1: STAR@122..124 "*" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@124..135 + 0: AS_KW@124..127 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@127..135 + 0: IDENT@127..135 "default" [] [Whitespace(" ")] + 3: FROM_KW@135..140 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@140..143 + 0: JS_STRING_LITERAL@140..143 "\"b\"" [] [] + 5: (empty) + 6: (empty) + 5: JS_EXPORT@143..187 + 0: JS_DECORATOR_LIST@143..143 + 1: EXPORT_KW@143..151 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@151..187 + 0: (empty) + 1: STAR@151..153 "*" [] [Whitespace(" ")] + 2: (empty) + 3: FROM_KW@153..158 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@158..164 + 0: JS_STRING_LITERAL@158..164 "\"mod\"" [] [Whitespace(" ")] + 5: JS_IMPORT_ASSERTION@164..187 + 0: ASSERT_KW@164..171 "assert" [] [Whitespace(" ")] + 1: L_CURLY@171..173 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@173..186 + 0: JS_IMPORT_ASSERTION_ENTRY@173..186 + 0: IDENT@173..177 "type" [] [] + 1: COLON@177..179 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@179..186 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@186..187 "}" [] [] + 6: (empty) + 6: JS_EXPORT@187..215 + 0: JS_DECORATOR_LIST@187..187 + 1: EXPORT_KW@187..195 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@195..215 + 0: TYPE_KW@195..200 "type" [] [Whitespace(" ")] + 1: STAR@200..202 "*" [] [Whitespace(" ")] + 2: (empty) + 3: FROM_KW@202..207 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@207..214 + 0: JS_STRING_LITERAL@207..214 "\"types\"" [] [] + 5: (empty) + 6: SEMICOLON@214..215 ";" [] [] + 7: JS_EXPORT@215..252 + 0: JS_DECORATOR_LIST@215..215 + 1: EXPORT_KW@215..223 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_FROM_CLAUSE@223..252 + 0: TYPE_KW@223..228 "type" [] [Whitespace(" ")] + 1: STAR@228..230 "*" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@230..239 + 0: AS_KW@230..233 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@233..239 + 0: IDENT@233..239 "types" [] [Whitespace(" ")] + 3: FROM_KW@239..244 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@244..251 + 0: JS_STRING_LITERAL@244..251 "\"types\"" [] [] + 5: (empty) + 6: SEMICOLON@251..252 ";" [] [] + 4: EOF@252..253 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_function_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_function_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js.snap new file mode 100644 index 000000000000..141410540011 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js.snap @@ -0,0 +1,280 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export function test(a, b) {} +export function* test2(a, b) {} +export async function test3(a, b, ) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@16..20 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@21..22 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..25 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@27..28 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@37..45 "function" [] [], + star_token: STAR@45..47 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@47..52 "test2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@53..54 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@54..56 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@56..57 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@59..60 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: ASYNC_KW@69..75 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@84..89 "test3" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@89..90 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@90..91 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@91..93 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@93..94 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@94..96 "," [] [Whitespace(" ")], + ], + r_paren_token: R_PAREN@96..98 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@98..99 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@99..100 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@100..101 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..101 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..100 + 0: JS_EXPORT@0..29 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@7..29 + 0: (empty) + 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@16..20 + 0: IDENT@16..20 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@20..27 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..25 + 0: JS_FORMAL_PARAMETER@21..22 + 0: JS_DECORATOR_LIST@21..21 + 1: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@24..25 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@27..29 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..28 + 3: R_CURLY@28..29 "}" [] [] + 1: JS_EXPORT@29..61 + 0: JS_DECORATOR_LIST@29..29 + 1: EXPORT_KW@29..37 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@37..61 + 0: (empty) + 1: FUNCTION_KW@37..45 "function" [] [] + 2: STAR@45..47 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@47..52 + 0: IDENT@47..52 "test2" [] [] + 4: (empty) + 5: JS_PARAMETERS@52..59 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..57 + 0: JS_FORMAL_PARAMETER@53..54 + 0: JS_DECORATOR_LIST@53..53 + 1: JS_IDENTIFIER_BINDING@53..54 + 0: IDENT@53..54 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@54..56 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@56..57 + 0: JS_DECORATOR_LIST@56..56 + 1: JS_IDENTIFIER_BINDING@56..57 + 0: IDENT@56..57 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_DIRECTIVE_LIST@60..60 + 2: JS_STATEMENT_LIST@60..60 + 3: R_CURLY@60..61 "}" [] [] + 2: JS_EXPORT@61..100 + 0: JS_DECORATOR_LIST@61..61 + 1: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@69..100 + 0: ASYNC_KW@69..75 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@75..84 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@84..89 + 0: IDENT@84..89 "test3" [] [] + 4: (empty) + 5: JS_PARAMETERS@89..98 + 0: L_PAREN@89..90 "(" [] [] + 1: JS_PARAMETER_LIST@90..96 + 0: JS_FORMAL_PARAMETER@90..91 + 0: JS_DECORATOR_LIST@90..90 + 1: JS_IDENTIFIER_BINDING@90..91 + 0: IDENT@90..91 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@91..93 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@93..94 + 0: JS_DECORATOR_LIST@93..93 + 1: JS_IDENTIFIER_BINDING@93..94 + 0: IDENT@93..94 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@94..96 "," [] [Whitespace(" ")] + 2: R_PAREN@96..98 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@98..100 + 0: L_CURLY@98..99 "{" [] [] + 1: JS_DIRECTIVE_LIST@99..99 + 2: JS_STATEMENT_LIST@99..99 + 3: R_CURLY@99..100 "}" [] [] + 4: EOF@100..101 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_named_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js.snap new file mode 100644 index 000000000000..fd130683c16b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js.snap @@ -0,0 +1,176 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { a }; +export { a as z, b as "y", c as default } +export { as }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@9..11 "a" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@11..12 "}" [] [], + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@23..25 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@25..28 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@28..29 "z" [] [], + }, + }, + COMMA@29..31 "," [] [Whitespace(" ")], + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@31..33 "b" [] [Whitespace(" ")], + }, + as_token: AS_KW@33..36 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: JS_STRING_LITERAL@36..39 "\"y\"" [] [], + }, + }, + COMMA@39..41 "," [] [Whitespace(" ")], + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@41..43 "c" [] [Whitespace(" ")], + }, + as_token: AS_KW@43..46 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@46..54 "default" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@54..55 "}" [] [], + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@55..63 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@63..65 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@65..68 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@68..69 "}" [] [], + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..70 + 0: JS_EXPORT@0..13 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@7..13 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..11 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@9..11 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@9..11 + 0: IDENT@9..11 "a" [] [Whitespace(" ")] + 3: R_CURLY@11..12 "}" [] [] + 4: SEMICOLON@12..13 ";" [] [] + 1: JS_EXPORT@13..55 + 0: JS_DECORATOR_LIST@13..13 + 1: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@21..55 + 0: (empty) + 1: L_CURLY@21..23 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@23..54 + 0: JS_EXPORT_NAMED_SPECIFIER@23..29 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@23..25 + 0: IDENT@23..25 "a" [] [Whitespace(" ")] + 2: AS_KW@25..28 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@28..29 + 0: IDENT@28..29 "z" [] [] + 1: COMMA@29..31 "," [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER@31..39 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@31..33 + 0: IDENT@31..33 "b" [] [Whitespace(" ")] + 2: AS_KW@33..36 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@36..39 + 0: JS_STRING_LITERAL@36..39 "\"y\"" [] [] + 3: COMMA@39..41 "," [] [Whitespace(" ")] + 4: JS_EXPORT_NAMED_SPECIFIER@41..54 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@41..43 + 0: IDENT@41..43 "c" [] [Whitespace(" ")] + 2: AS_KW@43..46 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@46..54 + 0: IDENT@46..54 "default" [] [Whitespace(" ")] + 3: R_CURLY@54..55 "}" [] [] + 4: (empty) + 2: JS_EXPORT@55..70 + 0: JS_DECORATOR_LIST@55..55 + 1: EXPORT_KW@55..63 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@63..70 + 0: (empty) + 1: L_CURLY@63..65 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@65..68 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@65..68 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@65..68 + 0: IDENT@65..68 "as" [] [Whitespace(" ")] + 3: R_CURLY@68..69 "}" [] [] + 4: SEMICOLON@69..70 ";" [] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js.snap new file mode 100644 index 000000000000..ecce26706cbc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js.snap @@ -0,0 +1,482 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { a, default } from "mod"; +export { a as z, b as "y", c as default } from "mod" +export { as } from "mod"; +export { default as "b" } from "mod"; +export { "a" as b } from "mod"; +export { a } from "mod" assert { type: "json" } +export { "a" } from "./mod"; +export { + "a" +} from "./mod"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@9..10 "a" [] [], + }, + export_as: missing (optional), + }, + COMMA@10..12 "," [] [Whitespace(" ")], + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@12..20 "default" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@20..22 "}" [] [Whitespace(" ")], + from_token: FROM_KW@22..27 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@27..32 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@43..45 "a" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@45..48 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@48..49 "z" [] [], + }, + }, + }, + COMMA@49..51 "," [] [Whitespace(" ")], + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@51..53 "b" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@53..56 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: JS_STRING_LITERAL@56..59 "\"y\"" [] [], + }, + }, + }, + COMMA@59..61 "," [] [Whitespace(" ")], + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@61..63 "c" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@63..66 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@66..74 "default" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@74..76 "}" [] [Whitespace(" ")], + from_token: FROM_KW@76..81 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@81..86 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@94..96 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@96..99 "as" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@99..101 "}" [] [Whitespace(" ")], + from_token: FROM_KW@101..106 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@106..111 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@112..120 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@120..122 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@122..130 "default" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@130..133 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: JS_STRING_LITERAL@133..137 "\"b\"" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@137..139 "}" [] [Whitespace(" ")], + from_token: FROM_KW@139..144 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@144..149 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@149..150 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@150..158 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@158..160 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: JS_STRING_LITERAL@160..164 "\"a\"" [] [Whitespace(" ")], + }, + export_as: JsExportAsClause { + as_token: AS_KW@164..167 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@167..169 "b" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@169..171 "}" [] [Whitespace(" ")], + from_token: FROM_KW@171..176 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@176..181 "\"mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@181..182 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@182..190 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@190..192 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@192..194 "a" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@194..196 "}" [] [Whitespace(" ")], + from_token: FROM_KW@196..201 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@201..207 "\"mod\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@207..214 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@214..216 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@216..220 "type" [] [], + colon_token: COLON@220..222 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@222..229 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@229..230 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@230..238 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@238..240 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: JS_STRING_LITERAL@240..244 "\"a\"" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@244..246 "}" [] [Whitespace(" ")], + from_token: FROM_KW@246..251 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@251..258 "\"./mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@258..259 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@259..267 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@267..268 "{" [] [], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: JS_STRING_LITERAL@268..277 "\"a\"" [Newline("\n"), Whitespace(" ")] [], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@277..280 "}" [Newline("\n")] [Whitespace(" ")], + from_token: FROM_KW@280..285 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@285..292 "\"./mod\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@292..293 ";" [] [], + }, + }, + ], + eof_token: EOF@293..294 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..294 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..293 + 0: JS_EXPORT@0..33 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..33 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@9..20 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@9..10 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@9..10 + 0: IDENT@9..10 "a" [] [] + 2: (empty) + 1: COMMA@10..12 "," [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER@12..20 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@12..20 + 0: IDENT@12..20 "default" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@20..22 "}" [] [Whitespace(" ")] + 4: FROM_KW@22..27 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@27..32 + 0: JS_STRING_LITERAL@27..32 "\"mod\"" [] [] + 6: (empty) + 7: SEMICOLON@32..33 ";" [] [] + 1: JS_EXPORT@33..86 + 0: JS_DECORATOR_LIST@33..33 + 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@41..86 + 0: (empty) + 1: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@43..74 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@43..49 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@43..45 + 0: IDENT@43..45 "a" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@45..49 + 0: AS_KW@45..48 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@48..49 + 0: IDENT@48..49 "z" [] [] + 1: COMMA@49..51 "," [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER@51..59 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@51..53 + 0: IDENT@51..53 "b" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@53..59 + 0: AS_KW@53..56 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@56..59 + 0: JS_STRING_LITERAL@56..59 "\"y\"" [] [] + 3: COMMA@59..61 "," [] [Whitespace(" ")] + 4: JS_EXPORT_NAMED_FROM_SPECIFIER@61..74 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@61..63 + 0: IDENT@61..63 "c" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@63..74 + 0: AS_KW@63..66 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@66..74 + 0: IDENT@66..74 "default" [] [Whitespace(" ")] + 3: R_CURLY@74..76 "}" [] [Whitespace(" ")] + 4: FROM_KW@76..81 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@81..86 + 0: JS_STRING_LITERAL@81..86 "\"mod\"" [] [] + 6: (empty) + 7: (empty) + 2: JS_EXPORT@86..112 + 0: JS_DECORATOR_LIST@86..86 + 1: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@94..112 + 0: (empty) + 1: L_CURLY@94..96 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@96..99 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@96..99 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@96..99 + 0: IDENT@96..99 "as" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@99..101 "}" [] [Whitespace(" ")] + 4: FROM_KW@101..106 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@106..111 + 0: JS_STRING_LITERAL@106..111 "\"mod\"" [] [] + 6: (empty) + 7: SEMICOLON@111..112 ";" [] [] + 3: JS_EXPORT@112..150 + 0: JS_DECORATOR_LIST@112..112 + 1: EXPORT_KW@112..120 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@120..150 + 0: (empty) + 1: L_CURLY@120..122 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@122..137 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@122..137 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@122..130 + 0: IDENT@122..130 "default" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@130..137 + 0: AS_KW@130..133 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@133..137 + 0: JS_STRING_LITERAL@133..137 "\"b\"" [] [Whitespace(" ")] + 3: R_CURLY@137..139 "}" [] [Whitespace(" ")] + 4: FROM_KW@139..144 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@144..149 + 0: JS_STRING_LITERAL@144..149 "\"mod\"" [] [] + 6: (empty) + 7: SEMICOLON@149..150 ";" [] [] + 4: JS_EXPORT@150..182 + 0: JS_DECORATOR_LIST@150..150 + 1: EXPORT_KW@150..158 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@158..182 + 0: (empty) + 1: L_CURLY@158..160 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@160..169 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@160..169 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@160..164 + 0: JS_STRING_LITERAL@160..164 "\"a\"" [] [Whitespace(" ")] + 2: JS_EXPORT_AS_CLAUSE@164..169 + 0: AS_KW@164..167 "as" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@167..169 + 0: IDENT@167..169 "b" [] [Whitespace(" ")] + 3: R_CURLY@169..171 "}" [] [Whitespace(" ")] + 4: FROM_KW@171..176 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@176..181 + 0: JS_STRING_LITERAL@176..181 "\"mod\"" [] [] + 6: (empty) + 7: SEMICOLON@181..182 ";" [] [] + 5: JS_EXPORT@182..230 + 0: JS_DECORATOR_LIST@182..182 + 1: EXPORT_KW@182..190 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@190..230 + 0: (empty) + 1: L_CURLY@190..192 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@192..194 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@192..194 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@192..194 + 0: IDENT@192..194 "a" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@194..196 "}" [] [Whitespace(" ")] + 4: FROM_KW@196..201 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@201..207 + 0: JS_STRING_LITERAL@201..207 "\"mod\"" [] [Whitespace(" ")] + 6: JS_IMPORT_ASSERTION@207..230 + 0: ASSERT_KW@207..214 "assert" [] [Whitespace(" ")] + 1: L_CURLY@214..216 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@216..229 + 0: JS_IMPORT_ASSERTION_ENTRY@216..229 + 0: IDENT@216..220 "type" [] [] + 1: COLON@220..222 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@222..229 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@229..230 "}" [] [] + 7: (empty) + 6: JS_EXPORT@230..259 + 0: JS_DECORATOR_LIST@230..230 + 1: EXPORT_KW@230..238 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@238..259 + 0: (empty) + 1: L_CURLY@238..240 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@240..244 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@240..244 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@240..244 + 0: JS_STRING_LITERAL@240..244 "\"a\"" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@244..246 "}" [] [Whitespace(" ")] + 4: FROM_KW@246..251 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@251..258 + 0: JS_STRING_LITERAL@251..258 "\"./mod\"" [] [] + 6: (empty) + 7: SEMICOLON@258..259 ";" [] [] + 7: JS_EXPORT@259..293 + 0: JS_DECORATOR_LIST@259..259 + 1: EXPORT_KW@259..267 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@267..293 + 0: (empty) + 1: L_CURLY@267..268 "{" [] [] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@268..277 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@268..277 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@268..277 + 0: JS_STRING_LITERAL@268..277 "\"a\"" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: R_CURLY@277..280 "}" [Newline("\n")] [Whitespace(" ")] + 4: FROM_KW@280..285 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@285..292 + 0: JS_STRING_LITERAL@285..292 "\"./mod\"" [] [] + 6: (empty) + 7: SEMICOLON@292..293 ";" [] [] + 4: EOF@293..294 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_variable_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js.snap new file mode 100644 index 000000000000..8a3d69a4d891 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js.snap @@ -0,0 +1,184 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export let a; +export const b = 3; +export var c, d, e = 3; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@7..11 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@11..12 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@21..27 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@27..29 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@29..31 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@31..32 "3" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@41..45 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@45..46 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@46..48 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@48..49 "d" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@49..51 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@51..53 "e" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@53..55 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@55..56 "3" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@56..57 ";" [] [], + }, + }, + ], + eof_token: EOF@57..58 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..58 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..57 + 0: JS_EXPORT@0..13 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@7..13 + 0: JS_VARIABLE_DECLARATION@7..12 + 0: (empty) + 1: LET_KW@7..11 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@11..12 + 0: JS_VARIABLE_DECLARATOR@11..12 + 0: JS_IDENTIFIER_BINDING@11..12 + 0: IDENT@11..12 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@12..13 ";" [] [] + 1: JS_EXPORT@13..33 + 0: JS_DECORATOR_LIST@13..13 + 1: EXPORT_KW@13..21 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@21..33 + 0: JS_VARIABLE_DECLARATION@21..32 + 0: (empty) + 1: CONST_KW@21..27 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@27..32 + 0: JS_VARIABLE_DECLARATOR@27..32 + 0: JS_IDENTIFIER_BINDING@27..29 + 0: IDENT@27..29 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@29..32 + 0: EQ@29..31 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@31..32 + 0: JS_NUMBER_LITERAL@31..32 "3" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPORT@33..57 + 0: JS_DECORATOR_LIST@33..33 + 1: EXPORT_KW@33..41 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATION_CLAUSE@41..57 + 0: JS_VARIABLE_DECLARATION@41..56 + 0: (empty) + 1: VAR_KW@41..45 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@45..56 + 0: JS_VARIABLE_DECLARATOR@45..46 + 0: JS_IDENTIFIER_BINDING@45..46 + 0: IDENT@45..46 "c" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@46..48 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@48..49 + 0: JS_IDENTIFIER_BINDING@48..49 + 0: IDENT@48..49 "d" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@49..51 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@51..56 + 0: JS_IDENTIFIER_BINDING@51..53 + 0: IDENT@51..53 "e" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@53..56 + 0: EQ@53..55 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@55..56 + 0: JS_NUMBER_LITERAL@55..56 "3" [] [] + 1: SEMICOLON@56..57 ";" [] [] + 4: EOF@57..58 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js.snap new file mode 100644 index 000000000000..622fdd24302b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js.snap @@ -0,0 +1,143 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let async; +async function fn() { + for await (async of [7]); +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..9 "async" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@10..17 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@26..28 "fn" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@31..32 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsForOfStatement { + for_token: FOR_KW@32..39 "for" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + await_token: AWAIT_KW@39..45 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@45..46 "(" [] [], + initializer: JsIdentifierAssignment { + name_token: IDENT@46..52 "async" [] [Whitespace(" ")], + }, + of_token: OF_KW@52..55 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@55..56 "[" [] [], + elements: JsArrayElementList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@56..57 "7" [] [], + }, + ], + r_brack_token: R_BRACK@57..58 "]" [] [], + }, + r_paren_token: R_PAREN@58..59 ")" [] [], + body: JsEmptyStatement { + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + }, + ], + r_curly_token: R_CURLY@60..62 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@62..63 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..63 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..62 + 0: JS_VARIABLE_STATEMENT@0..10 + 0: JS_VARIABLE_DECLARATION@0..9 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..9 + 0: JS_VARIABLE_DECLARATOR@4..9 + 0: JS_IDENTIFIER_BINDING@4..9 + 0: IDENT@4..9 "async" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_FUNCTION_DECLARATION@10..62 + 0: ASYNC_KW@10..17 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@17..26 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "fn" [] [] + 4: (empty) + 5: JS_PARAMETERS@28..31 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..29 + 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@31..62 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_DIRECTIVE_LIST@32..32 + 2: JS_STATEMENT_LIST@32..60 + 0: JS_FOR_OF_STATEMENT@32..60 + 0: FOR_KW@32..39 "for" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: AWAIT_KW@39..45 "await" [] [Whitespace(" ")] + 2: L_PAREN@45..46 "(" [] [] + 3: JS_IDENTIFIER_ASSIGNMENT@46..52 + 0: IDENT@46..52 "async" [] [Whitespace(" ")] + 4: OF_KW@52..55 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@55..58 + 0: L_BRACK@55..56 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@56..57 + 0: JS_NUMBER_LITERAL_EXPRESSION@56..57 + 0: JS_NUMBER_LITERAL@56..57 "7" [] [] + 2: R_BRACK@57..58 "]" [] [] + 6: R_PAREN@58..59 ")" [] [] + 7: JS_EMPTY_STATEMENT@59..60 + 0: SEMICOLON@59..60 ";" [] [] + 3: R_CURLY@60..62 "}" [Newline("\n")] [] + 4: EOF@62..63 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap new file mode 100644 index 000000000000..7d33989611e2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap @@ -0,0 +1,93 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +for (var i = 0 in []) {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsForInStatement { + for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@14..15 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@15..19 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@19..21 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@25..28 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@28..29 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@32..33 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..34 + 0: JS_FOR_IN_STATEMENT@0..34 + 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@14..15 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@15..25 + 0: (empty) + 1: VAR_KW@15..19 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@19..25 + 0: JS_IDENTIFIER_BINDING@19..21 + 0: IDENT@19..21 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..25 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..25 + 0: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")] + 3: IN_KW@25..28 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@28..30 + 0: L_BRACK@28..29 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@29..29 + 2: R_BRACK@29..30 "]" [] [] + 5: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@32..34 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_STATEMENT_LIST@33..33 + 2: R_CURLY@33..34 "}" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js.snap new file mode 100644 index 000000000000..b49ebd4d8f96 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js.snap @@ -0,0 +1,466 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (let i = 5; i < 10; i++) {} +for (let { foo, bar } of {}) {} +for (foo in {}) {} +for (;;) {} +for (let foo of []) {} +for (let i = 5, j = 6; i < j; ++j) {} +for await (let a of []) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@5..9 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@9..11 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@11..13 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..14 "5" [] [], + }, + }, + }, + ], + }, + first_semi_token: SEMICOLON@14..16 ";" [] [Whitespace(" ")], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..18 "i" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@18..20 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..22 "10" [] [], + }, + }, + second_semi_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], + update: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@24..25 "i" [] [], + }, + operator_token: PLUS2@25..27 "++" [] [], + }, + r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@29..30 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@31..36 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@36..37 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@37..41 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@43..46 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@46..48 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@48..52 "bar" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@52..54 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@54..57 "of" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@57..58 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@58..59 "}" [] [], + }, + r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@61..62 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@63..68 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@68..69 "(" [] [], + initializer: JsIdentifierAssignment { + name_token: IDENT@69..73 "foo" [] [Whitespace(" ")], + }, + in_token: IN_KW@73..76 "in" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@76..77 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@77..78 "}" [] [], + }, + r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@80..81 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@81..82 "}" [] [], + }, + }, + JsForStatement { + for_token: FOR_KW@82..87 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@87..88 "(" [] [], + initializer: missing (optional), + first_semi_token: SEMICOLON@88..89 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@89..90 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@90..92 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@92..93 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@93..94 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@94..99 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@99..100 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@100..104 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@104..108 "foo" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@108..111 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@111..112 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@112..113 "]" [] [], + }, + r_paren_token: R_PAREN@113..115 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@115..116 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@116..117 "}" [] [], + }, + }, + JsForStatement { + for_token: FOR_KW@117..122 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@122..123 "(" [] [], + initializer: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@123..127 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@127..129 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@129..131 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@131..132 "5" [] [], + }, + }, + }, + COMMA@132..134 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@134..136 "j" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@136..138 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@138..139 "6" [] [], + }, + }, + }, + ], + }, + first_semi_token: SEMICOLON@139..141 ";" [] [Whitespace(" ")], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@141..143 "i" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@143..145 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@145..146 "j" [] [], + }, + }, + }, + second_semi_token: SEMICOLON@146..148 ";" [] [Whitespace(" ")], + update: JsPreUpdateExpression { + operator_token: PLUS2@148..150 "++" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@150..151 "j" [] [], + }, + }, + r_paren_token: R_PAREN@151..153 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@153..154 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@154..155 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@155..160 "for" [Newline("\n")] [Whitespace(" ")], + await_token: AWAIT_KW@160..166 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@166..167 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@167..171 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@171..173 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@173..176 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@176..177 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@177..178 "]" [] [], + }, + r_paren_token: R_PAREN@178..180 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@180..181 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@181..182 "}" [] [], + }, + }, + ], + eof_token: EOF@182..183 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..183 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..182 + 0: JS_FOR_STATEMENT@0..31 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_VARIABLE_DECLARATION@5..14 + 0: (empty) + 1: LET_KW@5..9 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@9..14 + 0: JS_VARIABLE_DECLARATOR@9..14 + 0: JS_IDENTIFIER_BINDING@9..11 + 0: IDENT@9..11 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@11..14 + 0: EQ@11..13 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@13..14 + 0: JS_NUMBER_LITERAL@13..14 "5" [] [] + 3: SEMICOLON@14..16 ";" [] [Whitespace(" ")] + 4: JS_BINARY_EXPRESSION@16..22 + 0: JS_IDENTIFIER_EXPRESSION@16..18 + 0: JS_REFERENCE_IDENTIFIER@16..18 + 0: IDENT@16..18 "i" [] [Whitespace(" ")] + 1: L_ANGLE@18..20 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@20..22 + 0: JS_NUMBER_LITERAL@20..22 "10" [] [] + 5: SEMICOLON@22..24 ";" [] [Whitespace(" ")] + 6: JS_POST_UPDATE_EXPRESSION@24..27 + 0: JS_IDENTIFIER_ASSIGNMENT@24..25 + 0: IDENT@24..25 "i" [] [] + 1: PLUS2@25..27 "++" [] [] + 7: R_PAREN@27..29 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@29..31 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_STATEMENT_LIST@30..30 + 2: R_CURLY@30..31 "}" [] [] + 1: JS_FOR_OF_STATEMENT@31..63 + 0: FOR_KW@31..36 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@36..37 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@37..54 + 0: (empty) + 1: LET_KW@37..41 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@41..54 + 0: JS_OBJECT_BINDING_PATTERN@41..54 + 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@43..52 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@43..46 + 0: JS_IDENTIFIER_BINDING@43..46 + 0: IDENT@43..46 "foo" [] [] + 1: (empty) + 1: COMMA@46..48 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@48..52 + 0: JS_IDENTIFIER_BINDING@48..52 + 0: IDENT@48..52 "bar" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@52..54 "}" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@54..57 "of" [] [Whitespace(" ")] + 5: JS_OBJECT_EXPRESSION@57..59 + 0: L_CURLY@57..58 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@58..58 + 2: R_CURLY@58..59 "}" [] [] + 6: R_PAREN@59..61 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@61..63 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_STATEMENT_LIST@62..62 + 2: R_CURLY@62..63 "}" [] [] + 2: JS_FOR_IN_STATEMENT@63..82 + 0: FOR_KW@63..68 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@68..69 "(" [] [] + 2: JS_IDENTIFIER_ASSIGNMENT@69..73 + 0: IDENT@69..73 "foo" [] [Whitespace(" ")] + 3: IN_KW@73..76 "in" [] [Whitespace(" ")] + 4: JS_OBJECT_EXPRESSION@76..78 + 0: L_CURLY@76..77 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@77..77 + 2: R_CURLY@77..78 "}" [] [] + 5: R_PAREN@78..80 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@80..82 + 0: L_CURLY@80..81 "{" [] [] + 1: JS_STATEMENT_LIST@81..81 + 2: R_CURLY@81..82 "}" [] [] + 3: JS_FOR_STATEMENT@82..94 + 0: FOR_KW@82..87 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@87..88 "(" [] [] + 2: (empty) + 3: SEMICOLON@88..89 ";" [] [] + 4: (empty) + 5: SEMICOLON@89..90 ";" [] [] + 6: (empty) + 7: R_PAREN@90..92 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@92..94 + 0: L_CURLY@92..93 "{" [] [] + 1: JS_STATEMENT_LIST@93..93 + 2: R_CURLY@93..94 "}" [] [] + 4: JS_FOR_OF_STATEMENT@94..117 + 0: FOR_KW@94..99 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@99..100 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@100..108 + 0: (empty) + 1: LET_KW@100..104 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@104..108 + 0: JS_IDENTIFIER_BINDING@104..108 + 0: IDENT@104..108 "foo" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@108..111 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@111..113 + 0: L_BRACK@111..112 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@112..112 + 2: R_BRACK@112..113 "]" [] [] + 6: R_PAREN@113..115 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@115..117 + 0: L_CURLY@115..116 "{" [] [] + 1: JS_STATEMENT_LIST@116..116 + 2: R_CURLY@116..117 "}" [] [] + 5: JS_FOR_STATEMENT@117..155 + 0: FOR_KW@117..122 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@122..123 "(" [] [] + 2: JS_VARIABLE_DECLARATION@123..139 + 0: (empty) + 1: LET_KW@123..127 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@127..139 + 0: JS_VARIABLE_DECLARATOR@127..132 + 0: JS_IDENTIFIER_BINDING@127..129 + 0: IDENT@127..129 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@129..132 + 0: EQ@129..131 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@131..132 + 0: JS_NUMBER_LITERAL@131..132 "5" [] [] + 1: COMMA@132..134 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@134..139 + 0: JS_IDENTIFIER_BINDING@134..136 + 0: IDENT@134..136 "j" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@136..139 + 0: EQ@136..138 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@138..139 + 0: JS_NUMBER_LITERAL@138..139 "6" [] [] + 3: SEMICOLON@139..141 ";" [] [Whitespace(" ")] + 4: JS_BINARY_EXPRESSION@141..146 + 0: JS_IDENTIFIER_EXPRESSION@141..143 + 0: JS_REFERENCE_IDENTIFIER@141..143 + 0: IDENT@141..143 "i" [] [Whitespace(" ")] + 1: L_ANGLE@143..145 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@145..146 + 0: JS_REFERENCE_IDENTIFIER@145..146 + 0: IDENT@145..146 "j" [] [] + 5: SEMICOLON@146..148 ";" [] [Whitespace(" ")] + 6: JS_PRE_UPDATE_EXPRESSION@148..151 + 0: PLUS2@148..150 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@150..151 + 0: IDENT@150..151 "j" [] [] + 7: R_PAREN@151..153 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@153..155 + 0: L_CURLY@153..154 "{" [] [] + 1: JS_STATEMENT_LIST@154..154 + 2: R_CURLY@154..155 "}" [] [] + 6: JS_FOR_OF_STATEMENT@155..182 + 0: FOR_KW@155..160 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@160..166 "await" [] [Whitespace(" ")] + 2: L_PAREN@166..167 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@167..173 + 0: (empty) + 1: LET_KW@167..171 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@171..173 + 0: JS_IDENTIFIER_BINDING@171..173 + 0: IDENT@171..173 "a" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@173..176 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@176..178 + 0: L_BRACK@176..177 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@177..177 + 2: R_BRACK@177..178 "]" [] [] + 6: R_PAREN@178..180 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@180..182 + 0: L_CURLY@180..181 "{" [] [] + 1: JS_STATEMENT_LIST@181..181 + 2: R_CURLY@181..182 "}" [] [] + 4: EOF@182..183 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap new file mode 100644 index 000000000000..6511ade4bf62 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap @@ -0,0 +1,94 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for((true,"selectionStart"in true);;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..3 "for" [] [], + l_paren_token: L_PAREN@3..4 "(" [] [], + initializer: JsParenthesizedExpression { + l_paren_token: L_PAREN@4..5 "(" [] [], + expression: JsSequenceExpression { + left: JsBooleanLiteralExpression { + value_token: TRUE_KW@5..9 "true" [] [], + }, + comma_token: COMMA@9..10 "," [] [], + right: JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@10..26 "\"selectionStart\"" [] [], + }, + in_token: IN_KW@26..29 "in" [] [Whitespace(" ")], + object: JsBooleanLiteralExpression { + value_token: TRUE_KW@29..33 "true" [] [], + }, + }, + }, + r_paren_token: R_PAREN@33..34 ")" [] [], + }, + first_semi_token: SEMICOLON@34..35 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@35..36 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@36..38 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@38..39 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + }, + ], + eof_token: EOF@40..41 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..41 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..40 + 0: JS_FOR_STATEMENT@0..40 + 0: FOR_KW@0..3 "for" [] [] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_PARENTHESIZED_EXPRESSION@4..34 + 0: L_PAREN@4..5 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@5..33 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@5..9 + 0: TRUE_KW@5..9 "true" [] [] + 1: COMMA@9..10 "," [] [] + 2: JS_IN_EXPRESSION@10..33 + 0: JS_STRING_LITERAL_EXPRESSION@10..26 + 0: JS_STRING_LITERAL@10..26 "\"selectionStart\"" [] [] + 1: IN_KW@26..29 "in" [] [Whitespace(" ")] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@29..33 + 0: TRUE_KW@29..33 "true" [] [] + 2: R_PAREN@33..34 ")" [] [] + 3: SEMICOLON@34..35 ";" [] [] + 4: (empty) + 5: SEMICOLON@35..36 ";" [] [] + 6: (empty) + 7: R_PAREN@36..38 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@38..40 + 0: L_CURLY@38..39 "{" [] [] + 1: JS_STATEMENT_LIST@39..39 + 2: R_CURLY@39..40 "}" [] [] + 4: EOF@40..41 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_decl.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_decl.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js.snap new file mode 100644 index 000000000000..0b111141af0d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js.snap @@ -0,0 +1,256 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo1() {} +function *foo2() {} +async function *foo3() {} +async function foo4() {} +function *foo5() { + yield foo; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..13 "foo1" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@16..17 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@17..18 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@18..28 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@28..29 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@29..33 "foo2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@33..34 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@36..37 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@38..45 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@45..54 "function" [] [Whitespace(" ")], + star_token: STAR@54..55 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@55..59 "foo3" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@59..60 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@60..62 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@62..63 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@63..64 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@64..71 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@71..80 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@80..84 "foo4" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@84..85 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@85..87 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@87..88 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@88..89 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@89..99 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@99..100 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@100..104 "foo5" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@104..105 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@105..107 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@107..108 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@108..117 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@117..120 "foo" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@120..121 ";" [] [], + }, + ], + r_curly_token: R_CURLY@121..123 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@123..124 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..124 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..123 + 0: JS_FUNCTION_DECLARATION@0..18 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..13 + 0: IDENT@9..13 "foo1" [] [] + 4: (empty) + 5: JS_PARAMETERS@13..16 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..14 + 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@16..18 + 0: L_CURLY@16..17 "{" [] [] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..17 + 3: R_CURLY@17..18 "}" [] [] + 1: JS_FUNCTION_DECLARATION@18..38 + 0: (empty) + 1: FUNCTION_KW@18..28 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@28..29 "*" [] [] + 3: JS_IDENTIFIER_BINDING@29..33 + 0: IDENT@29..33 "foo2" [] [] + 4: (empty) + 5: JS_PARAMETERS@33..36 + 0: L_PAREN@33..34 "(" [] [] + 1: JS_PARAMETER_LIST@34..34 + 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@36..38 + 0: L_CURLY@36..37 "{" [] [] + 1: JS_DIRECTIVE_LIST@37..37 + 2: JS_STATEMENT_LIST@37..37 + 3: R_CURLY@37..38 "}" [] [] + 2: JS_FUNCTION_DECLARATION@38..64 + 0: ASYNC_KW@38..45 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@45..54 "function" [] [Whitespace(" ")] + 2: STAR@54..55 "*" [] [] + 3: JS_IDENTIFIER_BINDING@55..59 + 0: IDENT@55..59 "foo3" [] [] + 4: (empty) + 5: JS_PARAMETERS@59..62 + 0: L_PAREN@59..60 "(" [] [] + 1: JS_PARAMETER_LIST@60..60 + 2: R_PAREN@60..62 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@62..64 + 0: L_CURLY@62..63 "{" [] [] + 1: JS_DIRECTIVE_LIST@63..63 + 2: JS_STATEMENT_LIST@63..63 + 3: R_CURLY@63..64 "}" [] [] + 3: JS_FUNCTION_DECLARATION@64..89 + 0: ASYNC_KW@64..71 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@71..80 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@80..84 + 0: IDENT@80..84 "foo4" [] [] + 4: (empty) + 5: JS_PARAMETERS@84..87 + 0: L_PAREN@84..85 "(" [] [] + 1: JS_PARAMETER_LIST@85..85 + 2: R_PAREN@85..87 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@87..89 + 0: L_CURLY@87..88 "{" [] [] + 1: JS_DIRECTIVE_LIST@88..88 + 2: JS_STATEMENT_LIST@88..88 + 3: R_CURLY@88..89 "}" [] [] + 4: JS_FUNCTION_DECLARATION@89..123 + 0: (empty) + 1: FUNCTION_KW@89..99 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@99..100 "*" [] [] + 3: JS_IDENTIFIER_BINDING@100..104 + 0: IDENT@100..104 "foo5" [] [] + 4: (empty) + 5: JS_PARAMETERS@104..107 + 0: L_PAREN@104..105 "(" [] [] + 1: JS_PARAMETER_LIST@105..105 + 2: R_PAREN@105..107 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@107..123 + 0: L_CURLY@107..108 "{" [] [] + 1: JS_DIRECTIVE_LIST@108..108 + 2: JS_STATEMENT_LIST@108..121 + 0: JS_EXPRESSION_STATEMENT@108..121 + 0: JS_YIELD_EXPRESSION@108..120 + 0: YIELD_KW@108..117 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@117..120 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@117..120 + 0: JS_REFERENCE_IDENTIFIER@117..120 + 0: IDENT@117..120 "foo" [] [] + 1: SEMICOLON@120..121 ";" [] [] + 3: R_CURLY@121..123 "}" [Newline("\n")] [] + 4: EOF@123..124 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_declaration_script.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs.snap new file mode 100644 index 000000000000..4f2dc92c508f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs.snap @@ -0,0 +1,92 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test(await) {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..23 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..29 "await" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@31..32 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + }, + ], + eof_token: EOF@33..34 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..34 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..33 + 0: JS_FUNCTION_DECLARATION@0..33 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..23 + 0: IDENT@19..23 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@23..31 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..29 + 0: JS_FORMAL_PARAMETER@24..29 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..29 + 0: IDENT@24..29 "await" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@31..33 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_DIRECTIVE_LIST@32..32 + 2: JS_STATEMENT_LIST@32..32 + 3: R_CURLY@32..33 "}" [] [] + 4: EOF@33..34 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js.snap new file mode 100644 index 000000000000..623189b790fb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js.snap @@ -0,0 +1,170 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = function() {} +let b = function foo() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@8..16 "function" [] [], + star_token: missing (optional), + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@16..17 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@19..20 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@26..28 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@39..42 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@42..43 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@45..46 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@46..47 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_VARIABLE_STATEMENT@0..21 + 0: JS_VARIABLE_DECLARATION@0..21 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..21 + 0: JS_VARIABLE_DECLARATOR@4..21 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..21 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@8..21 + 0: (empty) + 1: FUNCTION_KW@8..16 "function" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@16..19 + 0: L_PAREN@16..17 "(" [] [] + 1: JS_PARAMETER_LIST@17..17 + 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@19..21 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_DIRECTIVE_LIST@20..20 + 2: JS_STATEMENT_LIST@20..20 + 3: R_CURLY@20..21 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@21..47 + 0: JS_VARIABLE_DECLARATION@21..47 + 0: (empty) + 1: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@26..47 + 0: JS_VARIABLE_DECLARATOR@26..47 + 0: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@28..47 + 0: EQ@28..30 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@30..47 + 0: (empty) + 1: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@39..42 + 0: IDENT@39..42 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@42..45 + 0: L_PAREN@42..43 "(" [] [] + 1: JS_PARAMETER_LIST@43..43 + 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@45..47 + 0: L_CURLY@45..46 "{" [] [] + 1: JS_DIRECTIVE_LIST@46..46 + 2: JS_STATEMENT_LIST@46..46 + 3: R_CURLY@46..47 "}" [] [] + 1: (empty) + 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expression_id.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_expression_id.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs.snap new file mode 100644 index 000000000000..e3a9b2dc0b86 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs.snap @@ -0,0 +1,240 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +(function await() {}); +(function yield() {}); +(async function yield() {}); +(function* await() {}) + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..11 "(" [Comments("// SCRIPT"), Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@11..20 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@20..25 "await" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@25..26 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + r_paren_token: R_PAREN@30..31 ")" [] [], + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@32..34 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@34..43 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@43..48 "yield" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@48..49 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@51..52 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + }, + r_paren_token: R_PAREN@53..54 ")" [] [], + }, + semicolon_token: SEMICOLON@54..55 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@55..57 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: ASYNC_KW@57..63 "async" [] [Whitespace(" ")], + function_token: FUNCTION_KW@63..72 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@72..77 "yield" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@77..78 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@80..81 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@81..82 "}" [] [], + }, + }, + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@84..86 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@86..94 "function" [] [], + star_token: STAR@94..96 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@96..101 "await" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@101..102 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@104..105 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@105..106 "}" [] [], + }, + }, + r_paren_token: R_PAREN@106..107 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@107..108 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..108 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..107 + 0: JS_EXPRESSION_STATEMENT@0..32 + 0: JS_PARENTHESIZED_EXPRESSION@0..31 + 0: L_PAREN@0..11 "(" [Comments("// SCRIPT"), Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@11..30 + 0: (empty) + 1: FUNCTION_KW@11..20 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@20..25 + 0: IDENT@20..25 "await" [] [] + 4: (empty) + 5: JS_PARAMETERS@25..28 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_PARAMETER_LIST@26..26 + 2: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..30 "}" [] [] + 2: R_PAREN@30..31 ")" [] [] + 1: SEMICOLON@31..32 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@32..55 + 0: JS_PARENTHESIZED_EXPRESSION@32..54 + 0: L_PAREN@32..34 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@34..53 + 0: (empty) + 1: FUNCTION_KW@34..43 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@43..48 + 0: IDENT@43..48 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@48..51 + 0: L_PAREN@48..49 "(" [] [] + 1: JS_PARAMETER_LIST@49..49 + 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@51..53 + 0: L_CURLY@51..52 "{" [] [] + 1: JS_DIRECTIVE_LIST@52..52 + 2: JS_STATEMENT_LIST@52..52 + 3: R_CURLY@52..53 "}" [] [] + 2: R_PAREN@53..54 ")" [] [] + 1: SEMICOLON@54..55 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@55..84 + 0: JS_PARENTHESIZED_EXPRESSION@55..83 + 0: L_PAREN@55..57 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@57..82 + 0: ASYNC_KW@57..63 "async" [] [Whitespace(" ")] + 1: FUNCTION_KW@63..72 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@72..77 + 0: IDENT@72..77 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@77..80 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_PARAMETER_LIST@78..78 + 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@80..82 + 0: L_CURLY@80..81 "{" [] [] + 1: JS_DIRECTIVE_LIST@81..81 + 2: JS_STATEMENT_LIST@81..81 + 3: R_CURLY@81..82 "}" [] [] + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@84..107 + 0: JS_PARENTHESIZED_EXPRESSION@84..107 + 0: L_PAREN@84..86 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@86..106 + 0: (empty) + 1: FUNCTION_KW@86..94 "function" [] [] + 2: STAR@94..96 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@96..101 + 0: IDENT@96..101 "await" [] [] + 4: (empty) + 5: JS_PARAMETERS@101..104 + 0: L_PAREN@101..102 "(" [] [] + 1: JS_PARAMETER_LIST@102..102 + 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@104..106 + 0: L_CURLY@104..105 "{" [] [] + 1: JS_DIRECTIVE_LIST@105..105 + 2: JS_STATEMENT_LIST@105..105 + 3: R_CURLY@105..106 "}" [] [] + 2: R_PAREN@106..107 ")" [] [] + 1: (empty) + 4: EOF@107..108 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_id.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_id.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs.snap new file mode 100644 index 000000000000..44e1256e5322 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs.snap @@ -0,0 +1,299 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test() {} +function await(test) {} +async function await(test) {} +function yield(test) {} +function* yield(test) {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..23 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@28..38 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@38..43 "await" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@43..44 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@44..48 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@50..51 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@52..59 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@59..68 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@68..73 "await" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@73..74 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@74..78 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@80..81 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@81..82 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@82..92 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@92..97 "yield" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@97..98 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@98..102 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@104..105 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@105..106 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@106..115 "function" [Newline("\n")] [], + star_token: STAR@115..117 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@117..122 "yield" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@122..123 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@123..127 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@129..130 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@130..131 "}" [] [], + }, + }, + ], + eof_token: EOF@131..132 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..132 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..131 + 0: JS_FUNCTION_DECLARATION@0..28 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..23 + 0: IDENT@19..23 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@26..28 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..27 + 3: R_CURLY@27..28 "}" [] [] + 1: JS_FUNCTION_DECLARATION@28..52 + 0: (empty) + 1: FUNCTION_KW@28..38 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@38..43 + 0: IDENT@38..43 "await" [] [] + 4: (empty) + 5: JS_PARAMETERS@43..50 + 0: L_PAREN@43..44 "(" [] [] + 1: JS_PARAMETER_LIST@44..48 + 0: JS_FORMAL_PARAMETER@44..48 + 0: JS_DECORATOR_LIST@44..44 + 1: JS_IDENTIFIER_BINDING@44..48 + 0: IDENT@44..48 "test" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@50..52 + 0: L_CURLY@50..51 "{" [] [] + 1: JS_DIRECTIVE_LIST@51..51 + 2: JS_STATEMENT_LIST@51..51 + 3: R_CURLY@51..52 "}" [] [] + 2: JS_FUNCTION_DECLARATION@52..82 + 0: ASYNC_KW@52..59 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@59..68 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@68..73 + 0: IDENT@68..73 "await" [] [] + 4: (empty) + 5: JS_PARAMETERS@73..80 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_PARAMETER_LIST@74..78 + 0: JS_FORMAL_PARAMETER@74..78 + 0: JS_DECORATOR_LIST@74..74 + 1: JS_IDENTIFIER_BINDING@74..78 + 0: IDENT@74..78 "test" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@80..82 + 0: L_CURLY@80..81 "{" [] [] + 1: JS_DIRECTIVE_LIST@81..81 + 2: JS_STATEMENT_LIST@81..81 + 3: R_CURLY@81..82 "}" [] [] + 3: JS_FUNCTION_DECLARATION@82..106 + 0: (empty) + 1: FUNCTION_KW@82..92 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@92..97 + 0: IDENT@92..97 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@97..104 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_PARAMETER_LIST@98..102 + 0: JS_FORMAL_PARAMETER@98..102 + 0: JS_DECORATOR_LIST@98..98 + 1: JS_IDENTIFIER_BINDING@98..102 + 0: IDENT@98..102 "test" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@104..106 + 0: L_CURLY@104..105 "{" [] [] + 1: JS_DIRECTIVE_LIST@105..105 + 2: JS_STATEMENT_LIST@105..105 + 3: R_CURLY@105..106 "}" [] [] + 4: JS_FUNCTION_DECLARATION@106..131 + 0: (empty) + 1: FUNCTION_KW@106..115 "function" [Newline("\n")] [] + 2: STAR@115..117 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@117..122 + 0: IDENT@117..122 "yield" [] [] + 4: (empty) + 5: JS_PARAMETERS@122..129 + 0: L_PAREN@122..123 "(" [] [] + 1: JS_PARAMETER_LIST@123..127 + 0: JS_FORMAL_PARAMETER@123..127 + 0: JS_DECORATOR_LIST@123..123 + 1: JS_IDENTIFIER_BINDING@123..127 + 0: IDENT@123..127 "test" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@129..131 + 0: L_CURLY@129..130 "{" [] [] + 1: JS_DIRECTIVE_LIST@130..130 + 2: JS_STATEMENT_LIST@130..130 + 3: R_CURLY@130..131 "}" [] [] + 4: EOF@131..132 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap new file mode 100644 index 000000000000..4131f66ccba8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap @@ -0,0 +1,304 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +label1: function a() {} +if (true) function b() {} else function c() {} +if (true) function d() {} +if (true) "test"; else function e() {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [], + }, + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + body: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@27..28 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@31..32 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + }, + }, + JsIfStatement { + if_token: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@37..38 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@38..42 "true" [] [], + }, + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + consequent: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@44..53 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@53..54 "b" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@54..55 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@55..57 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@57..58 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@58..60 "}" [] [Whitespace(" ")], + }, + }, + else_clause: JsElseClause { + else_token: ELSE_KW@60..65 "else" [] [Whitespace(" ")], + alternate: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@65..74 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@74..75 "c" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@75..76 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@78..79 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@79..80 "}" [] [], + }, + }, + }, + }, + JsIfStatement { + if_token: IF_KW@80..84 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@84..85 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@85..89 "true" [] [], + }, + r_paren_token: R_PAREN@89..91 ")" [] [Whitespace(" ")], + consequent: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@91..100 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@100..101 "d" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@101..102 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@104..105 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@105..106 "}" [] [], + }, + }, + else_clause: missing (optional), + }, + JsIfStatement { + if_token: IF_KW@106..110 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@110..111 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@111..115 "true" [] [], + }, + r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], + consequent: JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@117..123 "\"test\"" [] [], + }, + semicolon_token: SEMICOLON@123..125 ";" [] [Whitespace(" ")], + }, + else_clause: JsElseClause { + else_token: ELSE_KW@125..130 "else" [] [Whitespace(" ")], + alternate: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@130..139 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@139..140 "e" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@140..141 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@141..143 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@143..144 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@144..145 "}" [] [], + }, + }, + }, + }, + ], + eof_token: EOF@145..146 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..146 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..145 + 0: JS_LABELED_STATEMENT@0..33 + 0: JS_LABEL@0..16 + 0: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [] + 1: COLON@16..18 ":" [] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@18..33 + 0: (empty) + 1: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@27..28 + 0: IDENT@27..28 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@28..31 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..29 + 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@31..33 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_DIRECTIVE_LIST@32..32 + 2: JS_STATEMENT_LIST@32..32 + 3: R_CURLY@32..33 "}" [] [] + 1: JS_IF_STATEMENT@33..80 + 0: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@37..38 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@38..42 + 0: TRUE_KW@38..42 "true" [] [] + 3: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_DECLARATION@44..60 + 0: (empty) + 1: FUNCTION_KW@44..53 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@53..54 + 0: IDENT@53..54 "b" [] [] + 4: (empty) + 5: JS_PARAMETERS@54..57 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_PARAMETER_LIST@55..55 + 2: R_PAREN@55..57 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@57..60 + 0: L_CURLY@57..58 "{" [] [] + 1: JS_DIRECTIVE_LIST@58..58 + 2: JS_STATEMENT_LIST@58..58 + 3: R_CURLY@58..60 "}" [] [Whitespace(" ")] + 5: JS_ELSE_CLAUSE@60..80 + 0: ELSE_KW@60..65 "else" [] [Whitespace(" ")] + 1: JS_FUNCTION_DECLARATION@65..80 + 0: (empty) + 1: FUNCTION_KW@65..74 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@74..75 + 0: IDENT@74..75 "c" [] [] + 4: (empty) + 5: JS_PARAMETERS@75..78 + 0: L_PAREN@75..76 "(" [] [] + 1: JS_PARAMETER_LIST@76..76 + 2: R_PAREN@76..78 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@78..80 + 0: L_CURLY@78..79 "{" [] [] + 1: JS_DIRECTIVE_LIST@79..79 + 2: JS_STATEMENT_LIST@79..79 + 3: R_CURLY@79..80 "}" [] [] + 2: JS_IF_STATEMENT@80..106 + 0: IF_KW@80..84 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@84..85 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@85..89 + 0: TRUE_KW@85..89 "true" [] [] + 3: R_PAREN@89..91 ")" [] [Whitespace(" ")] + 4: JS_FUNCTION_DECLARATION@91..106 + 0: (empty) + 1: FUNCTION_KW@91..100 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@100..101 + 0: IDENT@100..101 "d" [] [] + 4: (empty) + 5: JS_PARAMETERS@101..104 + 0: L_PAREN@101..102 "(" [] [] + 1: JS_PARAMETER_LIST@102..102 + 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@104..106 + 0: L_CURLY@104..105 "{" [] [] + 1: JS_DIRECTIVE_LIST@105..105 + 2: JS_STATEMENT_LIST@105..105 + 3: R_CURLY@105..106 "}" [] [] + 5: (empty) + 3: JS_IF_STATEMENT@106..145 + 0: IF_KW@106..110 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@110..111 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@111..115 + 0: TRUE_KW@111..115 "true" [] [] + 3: R_PAREN@115..117 ")" [] [Whitespace(" ")] + 4: JS_EXPRESSION_STATEMENT@117..125 + 0: JS_STRING_LITERAL_EXPRESSION@117..123 + 0: JS_STRING_LITERAL@117..123 "\"test\"" [] [] + 1: SEMICOLON@123..125 ";" [] [Whitespace(" ")] + 5: JS_ELSE_CLAUSE@125..145 + 0: ELSE_KW@125..130 "else" [] [Whitespace(" ")] + 1: JS_FUNCTION_DECLARATION@130..145 + 0: (empty) + 1: FUNCTION_KW@130..139 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@139..140 + 0: IDENT@139..140 "e" [] [] + 4: (empty) + 5: JS_PARAMETERS@140..143 + 0: L_PAREN@140..141 "(" [] [] + 1: JS_PARAMETER_LIST@141..141 + 2: R_PAREN@141..143 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@143..145 + 0: L_CURLY@143..144 "{" [] [] + 1: JS_DIRECTIVE_LIST@144..144 + 2: JS_STATEMENT_LIST@144..144 + 3: R_CURLY@144..145 "}" [] [] + 4: EOF@145..146 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/getter_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js.snap new file mode 100644 index 000000000000..c995d0d853f8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js.snap @@ -0,0 +1,457 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Getters { + get foo() {} + get static() {} + static get bar() {} + get "baz"() {} + get ["a" + "b"]() {} + get 5() {} + get #private() {} +} +class NotGetters { + get() {} + async get() {} + static get() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..14 "Getters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsClassMemberList [ + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@22..25 "foo" [] [], + }, + l_paren_token: L_PAREN@25..26 "(" [] [], + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@28..29 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@30..37 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@37..43 "static" [] [], + }, + l_paren_token: L_PAREN@43..44 "(" [] [], + r_paren_token: R_PAREN@44..46 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@46..47 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@47..48 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@48..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + get_token: GET_KW@58..62 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@62..65 "bar" [] [], + }, + l_paren_token: L_PAREN@65..66 "(" [] [], + r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@68..69 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@69..70 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@70..77 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@77..82 "\"baz\"" [] [], + }, + l_paren_token: L_PAREN@82..83 "(" [] [], + r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@85..86 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@86..87 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@87..94 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsComputedMemberName { + l_brack_token: L_BRACK@94..95 "[" [] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@95..99 "\"a\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@99..101 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@101..104 "\"b\"" [] [], + }, + }, + r_brack_token: R_BRACK@104..105 "]" [] [], + }, + l_paren_token: L_PAREN@105..106 "(" [] [], + r_paren_token: R_PAREN@106..108 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@108..109 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@109..110 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@110..117 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@117..118 "5" [] [], + }, + l_paren_token: L_PAREN@118..119 "(" [] [], + r_paren_token: R_PAREN@119..121 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@121..122 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@122..123 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [], + get_token: GET_KW@123..130 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsPrivateClassMemberName { + hash_token: HASH@130..131 "#" [] [], + id_token: IDENT@131..138 "private" [] [], + }, + l_paren_token: L_PAREN@138..139 "(" [] [], + r_paren_token: R_PAREN@139..141 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@141..142 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@142..143 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@143..145 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@152..163 "NotGetters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@163..164 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@164..170 "get" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@170..171 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@171..173 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@173..174 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@174..175 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@175..184 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@184..187 "get" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@187..188 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@188..190 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@190..191 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@191..192 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@192..202 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@202..205 "get" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@205..206 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@206..208 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@208..209 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@209..210 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@210..212 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@212..213 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..213 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..212 + 0: JS_CLASS_DECLARATION@0..145 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..14 + 0: IDENT@6..14 "Getters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@14..15 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@15..143 + 0: JS_GETTER_CLASS_MEMBER@15..30 + 0: JS_METHOD_MODIFIER_LIST@15..15 + 1: GET_KW@15..22 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@22..25 + 0: IDENT@22..25 "foo" [] [] + 3: L_PAREN@25..26 "(" [] [] + 4: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_DIRECTIVE_LIST@29..29 + 2: JS_STATEMENT_LIST@29..29 + 3: R_CURLY@29..30 "}" [] [] + 1: JS_GETTER_CLASS_MEMBER@30..48 + 0: JS_METHOD_MODIFIER_LIST@30..30 + 1: GET_KW@30..37 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@37..43 + 0: IDENT@37..43 "static" [] [] + 3: L_PAREN@43..44 "(" [] [] + 4: R_PAREN@44..46 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@46..48 + 0: L_CURLY@46..47 "{" [] [] + 1: JS_DIRECTIVE_LIST@47..47 + 2: JS_STATEMENT_LIST@47..47 + 3: R_CURLY@47..48 "}" [] [] + 2: JS_GETTER_CLASS_MEMBER@48..70 + 0: JS_METHOD_MODIFIER_LIST@48..58 + 0: JS_STATIC_MODIFIER@48..58 + 0: STATIC_KW@48..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@58..62 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@62..65 + 0: IDENT@62..65 "bar" [] [] + 3: L_PAREN@65..66 "(" [] [] + 4: R_PAREN@66..68 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@68..70 + 0: L_CURLY@68..69 "{" [] [] + 1: JS_DIRECTIVE_LIST@69..69 + 2: JS_STATEMENT_LIST@69..69 + 3: R_CURLY@69..70 "}" [] [] + 3: JS_GETTER_CLASS_MEMBER@70..87 + 0: JS_METHOD_MODIFIER_LIST@70..70 + 1: GET_KW@70..77 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@77..82 + 0: JS_STRING_LITERAL@77..82 "\"baz\"" [] [] + 3: L_PAREN@82..83 "(" [] [] + 4: R_PAREN@83..85 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@85..87 + 0: L_CURLY@85..86 "{" [] [] + 1: JS_DIRECTIVE_LIST@86..86 + 2: JS_STATEMENT_LIST@86..86 + 3: R_CURLY@86..87 "}" [] [] + 4: JS_GETTER_CLASS_MEMBER@87..110 + 0: JS_METHOD_MODIFIER_LIST@87..87 + 1: GET_KW@87..94 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_COMPUTED_MEMBER_NAME@94..105 + 0: L_BRACK@94..95 "[" [] [] + 1: JS_BINARY_EXPRESSION@95..104 + 0: JS_STRING_LITERAL_EXPRESSION@95..99 + 0: JS_STRING_LITERAL@95..99 "\"a\"" [] [Whitespace(" ")] + 1: PLUS@99..101 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@101..104 + 0: JS_STRING_LITERAL@101..104 "\"b\"" [] [] + 2: R_BRACK@104..105 "]" [] [] + 3: L_PAREN@105..106 "(" [] [] + 4: R_PAREN@106..108 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@108..110 + 0: L_CURLY@108..109 "{" [] [] + 1: JS_DIRECTIVE_LIST@109..109 + 2: JS_STATEMENT_LIST@109..109 + 3: R_CURLY@109..110 "}" [] [] + 5: JS_GETTER_CLASS_MEMBER@110..123 + 0: JS_METHOD_MODIFIER_LIST@110..110 + 1: GET_KW@110..117 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@117..118 + 0: JS_NUMBER_LITERAL@117..118 "5" [] [] + 3: L_PAREN@118..119 "(" [] [] + 4: R_PAREN@119..121 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@121..123 + 0: L_CURLY@121..122 "{" [] [] + 1: JS_DIRECTIVE_LIST@122..122 + 2: JS_STATEMENT_LIST@122..122 + 3: R_CURLY@122..123 "}" [] [] + 6: JS_GETTER_CLASS_MEMBER@123..143 + 0: JS_METHOD_MODIFIER_LIST@123..123 + 1: GET_KW@123..130 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_PRIVATE_CLASS_MEMBER_NAME@130..138 + 0: HASH@130..131 "#" [] [] + 1: IDENT@131..138 "private" [] [] + 3: L_PAREN@138..139 "(" [] [] + 4: R_PAREN@139..141 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@141..143 + 0: L_CURLY@141..142 "{" [] [] + 1: JS_DIRECTIVE_LIST@142..142 + 2: JS_STATEMENT_LIST@142..142 + 3: R_CURLY@142..143 "}" [] [] + 9: R_CURLY@143..145 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@145..212 + 0: JS_DECORATOR_LIST@145..145 + 1: (empty) + 2: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@152..163 + 0: IDENT@152..163 "NotGetters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@163..164 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@164..210 + 0: JS_METHOD_CLASS_MEMBER@164..175 + 0: JS_METHOD_MODIFIER_LIST@164..164 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@164..170 + 0: IDENT@164..170 "get" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@170..173 + 0: L_PAREN@170..171 "(" [] [] + 1: JS_PARAMETER_LIST@171..171 + 2: R_PAREN@171..173 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@173..175 + 0: L_CURLY@173..174 "{" [] [] + 1: JS_DIRECTIVE_LIST@174..174 + 2: JS_STATEMENT_LIST@174..174 + 3: R_CURLY@174..175 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@175..192 + 0: JS_METHOD_MODIFIER_LIST@175..175 + 1: ASYNC_KW@175..184 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@184..187 + 0: IDENT@184..187 "get" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@187..190 + 0: L_PAREN@187..188 "(" [] [] + 1: JS_PARAMETER_LIST@188..188 + 2: R_PAREN@188..190 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@190..192 + 0: L_CURLY@190..191 "{" [] [] + 1: JS_DIRECTIVE_LIST@191..191 + 2: JS_STATEMENT_LIST@191..191 + 3: R_CURLY@191..192 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@192..210 + 0: JS_METHOD_MODIFIER_LIST@192..202 + 0: JS_STATIC_MODIFIER@192..202 + 0: STATIC_KW@192..202 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@202..205 + 0: IDENT@202..205 "get" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@205..208 + 0: L_PAREN@205..206 "(" [] [] + 1: JS_PARAMETER_LIST@206..206 + 2: R_PAREN@206..208 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@208..210 + 0: L_CURLY@208..209 "{" [] [] + 1: JS_DIRECTIVE_LIST@209..209 + 2: JS_STATEMENT_LIST@209..209 + 3: R_CURLY@209..210 "}" [] [] + 9: R_CURLY@210..212 "}" [Newline("\n")] [] + 4: EOF@212..213 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_object_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/getter_object_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js.snap new file mode 100644 index 000000000000..4e47bfa43f3e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js.snap @@ -0,0 +1,339 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + get foo() { + return foo; + }, + get "bar"() { + return "bar"; + }, + get ["a" + "b"]() { + return "a" + "b" + }, + get 5() { + return 5; + }, + get() { + return "This is a method and not a getter"; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsGetterObjectMember { + get_token: GET_KW@9..16 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@16..19 "foo" [] [], + }, + l_paren_token: L_PAREN@19..20 "(" [] [], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@23..35 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..38 "foo" [] [], + }, + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + ], + r_curly_token: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@43..44 "," [] [], + JsGetterObjectMember { + get_token: GET_KW@44..51 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@51..56 "\"bar\"" [] [], + }, + l_paren_token: L_PAREN@56..57 "(" [] [], + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@59..60 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@60..72 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@72..77 "\"bar\"" [] [], + }, + semicolon_token: SEMICOLON@77..78 ";" [] [], + }, + ], + r_curly_token: R_CURLY@78..82 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@82..83 "," [] [], + JsGetterObjectMember { + get_token: GET_KW@83..90 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsComputedMemberName { + l_brack_token: L_BRACK@90..91 "[" [] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@91..95 "\"a\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@95..97 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@97..100 "\"b\"" [] [], + }, + }, + r_brack_token: R_BRACK@100..101 "]" [] [], + }, + l_paren_token: L_PAREN@101..102 "(" [] [], + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@104..105 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@105..117 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@117..121 "\"a\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@121..123 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@123..126 "\"b\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@126..130 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@130..131 "," [] [], + JsGetterObjectMember { + get_token: GET_KW@131..138 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@138..139 "5" [] [], + }, + l_paren_token: L_PAREN@139..140 "(" [] [], + r_paren_token: R_PAREN@140..142 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@142..143 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@143..155 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@155..156 "5" [] [], + }, + semicolon_token: SEMICOLON@156..157 ";" [] [], + }, + ], + r_curly_token: R_CURLY@157..161 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@161..162 "," [] [], + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@162..168 "get" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@168..169 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@169..171 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@171..172 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@172..183 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@183..218 "\"This is a method and not a getter\"" [] [], + }, + semicolon_token: SEMICOLON@218..219 ";" [] [], + }, + ], + r_curly_token: R_CURLY@219..223 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@223..225 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@225..226 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..226 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..225 + 0: JS_VARIABLE_STATEMENT@0..225 + 0: JS_VARIABLE_DECLARATION@0..225 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..225 + 0: JS_VARIABLE_DECLARATOR@4..225 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..225 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..225 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..223 + 0: JS_GETTER_OBJECT_MEMBER@9..43 + 0: GET_KW@9..16 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@16..19 + 0: IDENT@16..19 "foo" [] [] + 2: L_PAREN@19..20 "(" [] [] + 3: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_FUNCTION_BODY@22..43 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..39 + 0: JS_RETURN_STATEMENT@23..39 + 0: RETURN_KW@23..35 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@35..38 + 0: JS_REFERENCE_IDENTIFIER@35..38 + 0: IDENT@35..38 "foo" [] [] + 2: SEMICOLON@38..39 ";" [] [] + 3: R_CURLY@39..43 "}" [Newline("\n"), Whitespace(" ")] [] + 1: COMMA@43..44 "," [] [] + 2: JS_GETTER_OBJECT_MEMBER@44..82 + 0: GET_KW@44..51 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@51..56 + 0: JS_STRING_LITERAL@51..56 "\"bar\"" [] [] + 2: L_PAREN@56..57 "(" [] [] + 3: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_FUNCTION_BODY@59..82 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_DIRECTIVE_LIST@60..60 + 2: JS_STATEMENT_LIST@60..78 + 0: JS_RETURN_STATEMENT@60..78 + 0: RETURN_KW@60..72 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@72..77 + 0: JS_STRING_LITERAL@72..77 "\"bar\"" [] [] + 2: SEMICOLON@77..78 ";" [] [] + 3: R_CURLY@78..82 "}" [Newline("\n"), Whitespace(" ")] [] + 3: COMMA@82..83 "," [] [] + 4: JS_GETTER_OBJECT_MEMBER@83..130 + 0: GET_KW@83..90 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_NAME@90..101 + 0: L_BRACK@90..91 "[" [] [] + 1: JS_BINARY_EXPRESSION@91..100 + 0: JS_STRING_LITERAL_EXPRESSION@91..95 + 0: JS_STRING_LITERAL@91..95 "\"a\"" [] [Whitespace(" ")] + 1: PLUS@95..97 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@97..100 + 0: JS_STRING_LITERAL@97..100 "\"b\"" [] [] + 2: R_BRACK@100..101 "]" [] [] + 2: L_PAREN@101..102 "(" [] [] + 3: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_FUNCTION_BODY@104..130 + 0: L_CURLY@104..105 "{" [] [] + 1: JS_DIRECTIVE_LIST@105..105 + 2: JS_STATEMENT_LIST@105..126 + 0: JS_RETURN_STATEMENT@105..126 + 0: RETURN_KW@105..117 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@117..126 + 0: JS_STRING_LITERAL_EXPRESSION@117..121 + 0: JS_STRING_LITERAL@117..121 "\"a\"" [] [Whitespace(" ")] + 1: PLUS@121..123 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@123..126 + 0: JS_STRING_LITERAL@123..126 "\"b\"" [] [] + 2: (empty) + 3: R_CURLY@126..130 "}" [Newline("\n"), Whitespace(" ")] [] + 5: COMMA@130..131 "," [] [] + 6: JS_GETTER_OBJECT_MEMBER@131..161 + 0: GET_KW@131..138 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@138..139 + 0: JS_NUMBER_LITERAL@138..139 "5" [] [] + 2: L_PAREN@139..140 "(" [] [] + 3: R_PAREN@140..142 ")" [] [Whitespace(" ")] + 4: (empty) + 5: JS_FUNCTION_BODY@142..161 + 0: L_CURLY@142..143 "{" [] [] + 1: JS_DIRECTIVE_LIST@143..143 + 2: JS_STATEMENT_LIST@143..157 + 0: JS_RETURN_STATEMENT@143..157 + 0: RETURN_KW@143..155 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@155..156 + 0: JS_NUMBER_LITERAL@155..156 "5" [] [] + 2: SEMICOLON@156..157 ";" [] [] + 3: R_CURLY@157..161 "}" [Newline("\n"), Whitespace(" ")] [] + 7: COMMA@161..162 "," [] [] + 8: JS_METHOD_OBJECT_MEMBER@162..223 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@162..168 + 0: IDENT@162..168 "get" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@168..171 + 0: L_PAREN@168..169 "(" [] [] + 1: JS_PARAMETER_LIST@169..169 + 2: R_PAREN@169..171 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@171..223 + 0: L_CURLY@171..172 "{" [] [] + 1: JS_DIRECTIVE_LIST@172..172 + 2: JS_STATEMENT_LIST@172..219 + 0: JS_RETURN_STATEMENT@172..219 + 0: RETURN_KW@172..183 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@183..218 + 0: JS_STRING_LITERAL@183..218 "\"This is a method and not a getter\"" [] [] + 2: SEMICOLON@218..219 ";" [] [] + 3: R_CURLY@219..223 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@223..225 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@225..226 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/grouping_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/grouping_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js.snap new file mode 100644 index 000000000000..fac5df842600 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +((foo)) +(foo) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@1..2 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@2..5 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@5..6 ")" [] [], + }, + r_paren_token: R_PAREN@6..7 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@7..9 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..12 "foo" [] [], + }, + }, + ], + r_paren_token: R_PAREN@12..13 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_CALL_EXPRESSION@0..13 + 0: JS_PARENTHESIZED_EXPRESSION@0..7 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@1..6 + 0: L_PAREN@1..2 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@2..5 + 0: JS_REFERENCE_IDENTIFIER@2..5 + 0: IDENT@2..5 "foo" [] [] + 2: R_PAREN@5..6 ")" [] [] + 2: R_PAREN@6..7 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@7..13 + 0: L_PAREN@7..9 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@9..12 + 0: JS_IDENTIFIER_EXPRESSION@9..12 + 0: JS_REFERENCE_IDENTIFIER@9..12 + 0: IDENT@9..12 "foo" [] [] + 2: R_PAREN@12..13 ")" [] [] + 1: (empty) + 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap new file mode 100644 index 000000000000..9d27b076d3ea --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap @@ -0,0 +1,79 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) var a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@10..14 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + else_clause: missing (optional), + }, + ], + eof_token: EOF@16..17 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..17 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..16 + 0: JS_IF_STATEMENT@0..16 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_VARIABLE_STATEMENT@10..16 + 0: JS_VARIABLE_DECLARATION@10..15 + 0: (empty) + 1: VAR_KW@10..14 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..15 + 0: JS_VARIABLE_DECLARATOR@14..15 + 0: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@15..16 ";" [] [] + 5: (empty) + 4: EOF@16..17 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js.snap new file mode 100644 index 000000000000..ed675409db82 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js.snap @@ -0,0 +1,85 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo; +let accessor = 5; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + semicolon_token: SEMICOLON@3..4 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@4..9 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@9..18 "accessor" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..21 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + ], + eof_token: EOF@22..23 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..23 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..22 + 0: JS_EXPRESSION_STATEMENT@0..4 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: SEMICOLON@3..4 ";" [] [] + 1: JS_VARIABLE_STATEMENT@4..22 + 0: JS_VARIABLE_DECLARATION@4..21 + 0: (empty) + 1: LET_KW@4..9 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@9..21 + 0: JS_VARIABLE_DECLARATOR@9..21 + 0: JS_IDENTIFIER_BINDING@9..18 + 0: IDENT@9..18 "accessor" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@18..21 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@20..21 + 0: JS_NUMBER_LITERAL@20..21 "5" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 4: EOF@22..23 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs.snap new file mode 100644 index 000000000000..733bbd331aa2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs.snap @@ -0,0 +1,78 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +foo; +yield; +await; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..20 "yield" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..27 "await" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..28 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_IDENTIFIER_EXPRESSION@0..13 + 0: JS_REFERENCE_IDENTIFIER@0..13 + 0: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..21 + 0: JS_IDENTIFIER_EXPRESSION@14..20 + 0: JS_REFERENCE_IDENTIFIER@14..20 + 0: IDENT@14..20 "yield" [Newline("\n")] [] + 1: SEMICOLON@20..21 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@21..28 + 0: JS_IDENTIFIER_EXPRESSION@21..27 + 0: JS_REFERENCE_IDENTIFIER@21..27 + 0: IDENT@21..27 "await" [Newline("\n")] [] + 1: SEMICOLON@27..28 ";" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_reference.js b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/identifier_reference.js rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs.snap new file mode 100644 index 000000000000..733bbd331aa2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs.snap @@ -0,0 +1,78 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +foo; +yield; +await; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..20 "yield" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..27 "await" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..28 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JS_IDENTIFIER_EXPRESSION@0..13 + 0: JS_REFERENCE_IDENTIFIER@0..13 + 0: IDENT@0..13 "foo" [Comments("// SCRIPT"), Newline("\n")] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..21 + 0: JS_IDENTIFIER_EXPRESSION@14..20 + 0: JS_REFERENCE_IDENTIFIER@14..20 + 0: IDENT@14..20 "yield" [Newline("\n")] [] + 1: SEMICOLON@20..21 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@21..28 + 0: JS_IDENTIFIER_EXPRESSION@21..27 + 0: JS_REFERENCE_IDENTIFIER@21..27 + 0: IDENT@21..27 "await" [Newline("\n")] [] + 1: SEMICOLON@27..28 ";" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/if_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/if_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js.snap new file mode 100644 index 000000000000..fd78bf59f55b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js.snap @@ -0,0 +1,195 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) {} else {} +if (true) {} +if (true) false +if (bar) {} else if (true) {} else {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsBlockStatement { + l_curly_token: L_CURLY@10..11 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], + }, + else_clause: JsElseClause { + else_token: ELSE_KW@13..18 "else" [] [Whitespace(" ")], + alternate: JsBlockStatement { + l_curly_token: L_CURLY@18..19 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@19..20 "}" [] [], + }, + }, + }, + JsIfStatement { + if_token: IF_KW@20..24 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@24..25 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@25..29 "true" [] [], + }, + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + consequent: JsBlockStatement { + l_curly_token: L_CURLY@31..32 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + else_clause: missing (optional), + }, + JsIfStatement { + if_token: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@37..38 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@38..42 "true" [] [], + }, + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + consequent: JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: FALSE_KW@44..49 "false" [] [], + }, + semicolon_token: missing (optional), + }, + else_clause: missing (optional), + }, + JsIfStatement { + if_token: IF_KW@49..53 "if" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@53..54 "(" [] [], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@54..57 "bar" [] [], + }, + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + consequent: JsBlockStatement { + l_curly_token: L_CURLY@59..60 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..62 "}" [] [Whitespace(" ")], + }, + else_clause: JsElseClause { + else_token: ELSE_KW@62..67 "else" [] [Whitespace(" ")], + alternate: JsIfStatement { + if_token: IF_KW@67..70 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@70..71 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@71..75 "true" [] [], + }, + r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], + consequent: JsBlockStatement { + l_curly_token: L_CURLY@77..78 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@78..80 "}" [] [Whitespace(" ")], + }, + else_clause: JsElseClause { + else_token: ELSE_KW@80..85 "else" [] [Whitespace(" ")], + alternate: JsBlockStatement { + l_curly_token: L_CURLY@85..86 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@86..87 "}" [] [], + }, + }, + }, + }, + }, + ], + eof_token: EOF@87..88 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..88 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..87 + 0: JS_IF_STATEMENT@0..20 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@10..13 + 0: L_CURLY@10..11 "{" [] [] + 1: JS_STATEMENT_LIST@11..11 + 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] + 5: JS_ELSE_CLAUSE@13..20 + 0: ELSE_KW@13..18 "else" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@18..20 + 0: L_CURLY@18..19 "{" [] [] + 1: JS_STATEMENT_LIST@19..19 + 2: R_CURLY@19..20 "}" [] [] + 1: JS_IF_STATEMENT@20..33 + 0: IF_KW@20..24 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@24..25 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@25..29 + 0: TRUE_KW@25..29 "true" [] [] + 3: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@31..33 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_STATEMENT_LIST@32..32 + 2: R_CURLY@32..33 "}" [] [] + 5: (empty) + 2: JS_IF_STATEMENT@33..49 + 0: IF_KW@33..37 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@37..38 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@38..42 + 0: TRUE_KW@38..42 "true" [] [] + 3: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 4: JS_EXPRESSION_STATEMENT@44..49 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@44..49 + 0: FALSE_KW@44..49 "false" [] [] + 1: (empty) + 5: (empty) + 3: JS_IF_STATEMENT@49..87 + 0: IF_KW@49..53 "if" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@53..54 "(" [] [] + 2: JS_IDENTIFIER_EXPRESSION@54..57 + 0: JS_REFERENCE_IDENTIFIER@54..57 + 0: IDENT@54..57 "bar" [] [] + 3: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@59..62 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_STATEMENT_LIST@60..60 + 2: R_CURLY@60..62 "}" [] [Whitespace(" ")] + 5: JS_ELSE_CLAUSE@62..87 + 0: ELSE_KW@62..67 "else" [] [Whitespace(" ")] + 1: JS_IF_STATEMENT@67..87 + 0: IF_KW@67..70 "if" [] [Whitespace(" ")] + 1: L_PAREN@70..71 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@71..75 + 0: TRUE_KW@71..75 "true" [] [] + 3: R_PAREN@75..77 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@77..80 + 0: L_CURLY@77..78 "{" [] [] + 1: JS_STATEMENT_LIST@78..78 + 2: R_CURLY@78..80 "}" [] [Whitespace(" ")] + 5: JS_ELSE_CLAUSE@80..87 + 0: ELSE_KW@80..85 "else" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@85..87 + 0: L_CURLY@85..86 "{" [] [] + 1: JS_STATEMENT_LIST@86..86 + 2: R_CURLY@86..87 "}" [] [] + 4: EOF@87..88 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js.snap new file mode 100644 index 000000000000..f03f82c1fae6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js.snap @@ -0,0 +1,84 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import { as as as } from "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@9..12 "as" [] [Whitespace(" ")], + }, + as_token: AS_KW@12..15 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@15..18 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@20..25 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@25..31 "\"test\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + ], + eof_token: EOF@32..33 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..33 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..32 + 0: JS_IMPORT@0..32 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@7..31 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@7..20 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..18 + 0: JS_NAMED_IMPORT_SPECIFIER@9..18 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@9..12 + 0: IDENT@9..12 "as" [] [Whitespace(" ")] + 2: AS_KW@12..15 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..18 + 0: IDENT@15..18 "as" [] [Whitespace(" ")] + 2: R_CURLY@18..20 "}" [] [Whitespace(" ")] + 2: FROM_KW@20..25 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@25..31 + 0: JS_STRING_LITERAL@25..31 "\"test\"" [] [] + 4: (empty) + 2: SEMICOLON@31..32 ";" [] [] + 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js.snap new file mode 100644 index 000000000000..1b47926bdb3b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import { as } from "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@9..12 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@12..14 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@14..19 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@19..25 "\"test\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + ], + eof_token: EOF@26..27 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..27 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..26 + 0: JS_IMPORT@0..26 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@7..25 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@7..14 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..12 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@9..12 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "as" [] [Whitespace(" ")] + 2: R_CURLY@12..14 "}" [] [Whitespace(" ")] + 2: FROM_KW@14..19 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@19..25 + 0: JS_STRING_LITERAL@19..25 "\"test\"" [] [] + 4: (empty) + 2: SEMICOLON@25..26 ";" [] [] + 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_assertion.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_assertion.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js.snap new file mode 100644 index 000000000000..ef7dc54a6568 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js.snap @@ -0,0 +1,317 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "x" assert { type: "json" } +import "foo" assert { "type": "json" }; +import foo from "foo.json" assert { type: "json" }; +import {test} from "foo.json" assert { for: "for" } +import foo_json from "foo.json" assert { type: "json", hasOwnProperty: "true" }; +import "x" assert +{ type: "json" } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@11..18 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@20..24 "type" [] [], + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@34..42 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@42..48 "\"foo\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@48..55 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: JS_STRING_LITERAL@57..63 "\"type\"" [] [], + colon_token: COLON@63..65 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@65..72 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@72..73 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@73..74 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@74..82 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@82..86 "foo" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@86..91 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@91..102 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@102..109 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@109..111 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@111..115 "type" [] [], + colon_token: COLON@115..117 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@117..124 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@124..125 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@125..126 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@126..134 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@134..135 "{" [] [], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@135..139 "test" [] [], + }, + }, + ], + r_curly_token: R_CURLY@139..141 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@141..146 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@146..157 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@157..164 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@164..166 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@166..169 "for" [] [], + colon_token: COLON@169..171 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@171..177 "\"for\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@177..178 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@178..186 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@186..195 "foo_json" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@195..200 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@200..211 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@211..218 "assert" [] [Whitespace(" ")], + l_curly_token: L_CURLY@218..220 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@220..224 "type" [] [], + colon_token: COLON@224..226 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@226..232 "\"json\"" [] [], + }, + COMMA@232..234 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: IDENT@234..248 "hasOwnProperty" [] [], + colon_token: COLON@248..250 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@250..257 "\"true\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@257..258 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@258..259 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@259..267 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@267..271 "\"x\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: ASSERT_KW@271..277 "assert" [] [], + l_curly_token: L_CURLY@277..280 "{" [Newline("\n")] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@280..284 "type" [] [], + colon_token: COLON@284..286 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@286..293 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@293..294 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@294..295 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..295 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..294 + 0: JS_IMPORT@0..34 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@7..34 + 0: JS_MODULE_SOURCE@7..11 + 0: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@11..34 + 0: ASSERT_KW@11..18 "assert" [] [Whitespace(" ")] + 1: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@20..33 + 0: JS_IMPORT_ASSERTION_ENTRY@20..33 + 0: IDENT@20..24 "type" [] [] + 1: COLON@24..26 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@26..33 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@33..34 "}" [] [] + 2: (empty) + 1: JS_IMPORT@34..74 + 0: IMPORT_KW@34..42 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@42..73 + 0: JS_MODULE_SOURCE@42..48 + 0: JS_STRING_LITERAL@42..48 "\"foo\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@48..73 + 0: ASSERT_KW@48..55 "assert" [] [Whitespace(" ")] + 1: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@57..72 + 0: JS_IMPORT_ASSERTION_ENTRY@57..72 + 0: JS_STRING_LITERAL@57..63 "\"type\"" [] [] + 1: COLON@63..65 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@65..72 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@72..73 "}" [] [] + 2: SEMICOLON@73..74 ";" [] [] + 2: JS_IMPORT@74..126 + 0: IMPORT_KW@74..82 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@82..125 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@82..86 + 0: JS_IDENTIFIER_BINDING@82..86 + 0: IDENT@82..86 "foo" [] [Whitespace(" ")] + 2: FROM_KW@86..91 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@91..102 + 0: JS_STRING_LITERAL@91..102 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@102..125 + 0: ASSERT_KW@102..109 "assert" [] [Whitespace(" ")] + 1: L_CURLY@109..111 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@111..124 + 0: JS_IMPORT_ASSERTION_ENTRY@111..124 + 0: IDENT@111..115 "type" [] [] + 1: COLON@115..117 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@117..124 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@124..125 "}" [] [] + 2: SEMICOLON@125..126 ";" [] [] + 3: JS_IMPORT@126..178 + 0: IMPORT_KW@126..134 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@134..178 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@134..141 + 0: L_CURLY@134..135 "{" [] [] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@135..139 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@135..139 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@135..139 + 0: IDENT@135..139 "test" [] [] + 2: R_CURLY@139..141 "}" [] [Whitespace(" ")] + 2: FROM_KW@141..146 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@146..157 + 0: JS_STRING_LITERAL@146..157 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@157..178 + 0: ASSERT_KW@157..164 "assert" [] [Whitespace(" ")] + 1: L_CURLY@164..166 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@166..177 + 0: JS_IMPORT_ASSERTION_ENTRY@166..177 + 0: IDENT@166..169 "for" [] [] + 1: COLON@169..171 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@171..177 "\"for\"" [] [Whitespace(" ")] + 3: R_CURLY@177..178 "}" [] [] + 2: (empty) + 4: JS_IMPORT@178..259 + 0: IMPORT_KW@178..186 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@186..258 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@186..195 + 0: JS_IDENTIFIER_BINDING@186..195 + 0: IDENT@186..195 "foo_json" [] [Whitespace(" ")] + 2: FROM_KW@195..200 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@200..211 + 0: JS_STRING_LITERAL@200..211 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@211..258 + 0: ASSERT_KW@211..218 "assert" [] [Whitespace(" ")] + 1: L_CURLY@218..220 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@220..257 + 0: JS_IMPORT_ASSERTION_ENTRY@220..232 + 0: IDENT@220..224 "type" [] [] + 1: COLON@224..226 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@226..232 "\"json\"" [] [] + 1: COMMA@232..234 "," [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY@234..257 + 0: IDENT@234..248 "hasOwnProperty" [] [] + 1: COLON@248..250 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@250..257 "\"true\"" [] [Whitespace(" ")] + 3: R_CURLY@257..258 "}" [] [] + 2: SEMICOLON@258..259 ";" [] [] + 5: JS_IMPORT@259..294 + 0: IMPORT_KW@259..267 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@267..294 + 0: JS_MODULE_SOURCE@267..271 + 0: JS_STRING_LITERAL@267..271 "\"x\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@271..294 + 0: ASSERT_KW@271..277 "assert" [] [] + 1: L_CURLY@277..280 "{" [Newline("\n")] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@280..293 + 0: JS_IMPORT_ASSERTION_ENTRY@280..293 + 0: IDENT@280..284 "type" [] [] + 1: COLON@284..286 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@286..293 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@293..294 "}" [] [] + 2: (empty) + 4: EOF@294..295 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_attribute.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_attribute.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js.snap new file mode 100644 index 000000000000..7294f8d144b6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js.snap @@ -0,0 +1,317 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "x" with { type: "json" } +import "foo" with { "type": "json" }; +import foo from "foo.json" with { type: "json" }; +import {test} from "foo.json" with { for: "for" } +import foo_json from "foo.json" with { type: "json", hasOwnProperty: "true" }; +import "x" with +{ type: "json" } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@11..16 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@18..22 "type" [] [], + colon_token: COLON@22..24 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@24..31 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@40..46 "\"foo\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@46..51 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@51..53 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: JS_STRING_LITERAL@53..59 "\"type\"" [] [], + colon_token: COLON@59..61 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@61..68 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@68..69 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@78..82 "foo" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@82..87 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@87..98 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@98..103 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@103..105 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@105..109 "type" [] [], + colon_token: COLON@109..111 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@118..119 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@119..120 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@128..129 "{" [] [], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@129..133 "test" [] [], + }, + }, + ], + r_curly_token: R_CURLY@133..135 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@135..140 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@140..151 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@151..156 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@156..158 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@158..161 "for" [] [], + colon_token: COLON@161..163 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@163..169 "\"for\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@169..170 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@170..178 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@178..187 "foo_json" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@187..192 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@192..203 "\"foo.json\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@203..208 "with" [] [Whitespace(" ")], + l_curly_token: L_CURLY@208..210 "{" [] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@210..214 "type" [] [], + colon_token: COLON@214..216 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@216..222 "\"json\"" [] [], + }, + COMMA@222..224 "," [] [Whitespace(" ")], + JsImportAssertionEntry { + key: IDENT@224..238 "hasOwnProperty" [] [], + colon_token: COLON@238..240 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@240..247 "\"true\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@247..248 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@248..249 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@249..257 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@257..261 "\"x\"" [] [Whitespace(" ")], + }, + assertion: JsImportAssertion { + assertion_kind: WITH_KW@261..265 "with" [] [], + l_curly_token: L_CURLY@265..268 "{" [Newline("\n")] [Whitespace(" ")], + assertions: JsImportAssertionEntryList [ + JsImportAssertionEntry { + key: IDENT@268..272 "type" [] [], + colon_token: COLON@272..274 ":" [] [Whitespace(" ")], + value_token: JS_STRING_LITERAL@274..281 "\"json\"" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@281..282 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@282..283 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..283 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..282 + 0: JS_IMPORT@0..32 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@7..32 + 0: JS_MODULE_SOURCE@7..11 + 0: JS_STRING_LITERAL@7..11 "\"x\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@11..32 + 0: WITH_KW@11..16 "with" [] [Whitespace(" ")] + 1: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@18..31 + 0: JS_IMPORT_ASSERTION_ENTRY@18..31 + 0: IDENT@18..22 "type" [] [] + 1: COLON@22..24 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@24..31 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@31..32 "}" [] [] + 2: (empty) + 1: JS_IMPORT@32..70 + 0: IMPORT_KW@32..40 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@40..69 + 0: JS_MODULE_SOURCE@40..46 + 0: JS_STRING_LITERAL@40..46 "\"foo\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@46..69 + 0: WITH_KW@46..51 "with" [] [Whitespace(" ")] + 1: L_CURLY@51..53 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@53..68 + 0: JS_IMPORT_ASSERTION_ENTRY@53..68 + 0: JS_STRING_LITERAL@53..59 "\"type\"" [] [] + 1: COLON@59..61 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@61..68 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@68..69 "}" [] [] + 2: SEMICOLON@69..70 ";" [] [] + 2: JS_IMPORT@70..120 + 0: IMPORT_KW@70..78 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@78..119 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@78..82 + 0: JS_IDENTIFIER_BINDING@78..82 + 0: IDENT@78..82 "foo" [] [Whitespace(" ")] + 2: FROM_KW@82..87 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@87..98 + 0: JS_STRING_LITERAL@87..98 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@98..119 + 0: WITH_KW@98..103 "with" [] [Whitespace(" ")] + 1: L_CURLY@103..105 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@105..118 + 0: JS_IMPORT_ASSERTION_ENTRY@105..118 + 0: IDENT@105..109 "type" [] [] + 1: COLON@109..111 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@111..118 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@118..119 "}" [] [] + 2: SEMICOLON@119..120 ";" [] [] + 3: JS_IMPORT@120..170 + 0: IMPORT_KW@120..128 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@128..170 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@128..135 + 0: L_CURLY@128..129 "{" [] [] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@129..133 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@129..133 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@129..133 + 0: IDENT@129..133 "test" [] [] + 2: R_CURLY@133..135 "}" [] [Whitespace(" ")] + 2: FROM_KW@135..140 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@140..151 + 0: JS_STRING_LITERAL@140..151 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@151..170 + 0: WITH_KW@151..156 "with" [] [Whitespace(" ")] + 1: L_CURLY@156..158 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@158..169 + 0: JS_IMPORT_ASSERTION_ENTRY@158..169 + 0: IDENT@158..161 "for" [] [] + 1: COLON@161..163 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@163..169 "\"for\"" [] [Whitespace(" ")] + 3: R_CURLY@169..170 "}" [] [] + 2: (empty) + 4: JS_IMPORT@170..249 + 0: IMPORT_KW@170..178 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@178..248 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@178..187 + 0: JS_IDENTIFIER_BINDING@178..187 + 0: IDENT@178..187 "foo_json" [] [Whitespace(" ")] + 2: FROM_KW@187..192 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@192..203 + 0: JS_STRING_LITERAL@192..203 "\"foo.json\"" [] [Whitespace(" ")] + 4: JS_IMPORT_ASSERTION@203..248 + 0: WITH_KW@203..208 "with" [] [Whitespace(" ")] + 1: L_CURLY@208..210 "{" [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@210..247 + 0: JS_IMPORT_ASSERTION_ENTRY@210..222 + 0: IDENT@210..214 "type" [] [] + 1: COLON@214..216 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@216..222 "\"json\"" [] [] + 1: COMMA@222..224 "," [] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY@224..247 + 0: IDENT@224..238 "hasOwnProperty" [] [] + 1: COLON@238..240 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@240..247 "\"true\"" [] [Whitespace(" ")] + 3: R_CURLY@247..248 "}" [] [] + 2: SEMICOLON@248..249 ";" [] [] + 5: JS_IMPORT@249..282 + 0: IMPORT_KW@249..257 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@257..282 + 0: JS_MODULE_SOURCE@257..261 + 0: JS_STRING_LITERAL@257..261 "\"x\"" [] [Whitespace(" ")] + 1: JS_IMPORT_ASSERTION@261..282 + 0: WITH_KW@261..265 "with" [] [] + 1: L_CURLY@265..268 "{" [Newline("\n")] [Whitespace(" ")] + 2: JS_IMPORT_ASSERTION_ENTRY_LIST@268..281 + 0: JS_IMPORT_ASSERTION_ENTRY@268..281 + 0: IDENT@268..272 "type" [] [] + 1: COLON@272..274 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL@274..281 "\"json\"" [] [Whitespace(" ")] + 3: R_CURLY@281..282 "}" [] [] + 2: (empty) + 4: EOF@282..283 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_bare_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js.snap new file mode 100644 index 000000000000..fc1d41887358 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js.snap @@ -0,0 +1,71 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "test"; +import "no_semicolon" + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@7..13 "\"test\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@14..22 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportBareClause { + source: JsModuleSource { + value_token: JS_STRING_LITERAL@22..36 "\"no_semicolon\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@36..37 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..37 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..36 + 0: JS_IMPORT@0..14 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@7..13 + 0: JS_MODULE_SOURCE@7..13 + 0: JS_STRING_LITERAL@7..13 "\"test\"" [] [] + 1: (empty) + 2: SEMICOLON@13..14 ";" [] [] + 1: JS_IMPORT@14..36 + 0: IMPORT_KW@14..22 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_BARE_CLAUSE@22..36 + 0: JS_MODULE_SOURCE@22..36 + 0: JS_STRING_LITERAL@22..36 "\"no_semicolon\"" [] [] + 1: (empty) + 2: (empty) + 4: EOF@36..37 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_call.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_call.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_call.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js.snap new file mode 100644 index 000000000000..522699c2bb24 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js.snap @@ -0,0 +1,207 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import("foo") +import("foo", { assert: { type: 'json' } }) +import("foo", { with: { 'resolution-mode': 'import' } }) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@0..6 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@6..7 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@7..12 "\"foo\"" [] [], + }, + ], + r_paren_token: R_PAREN@12..13 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@13..20 "import" [Newline("\n")] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@20..21 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@21..26 "\"foo\"" [] [], + }, + COMMA@26..28 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@30..36 "assert" [] [], + }, + colon_token: COLON@36..38 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@40..44 "type" [] [], + }, + colon_token: COLON@44..46 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@46..53 "'json'" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@53..55 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@55..56 "}" [] [], + }, + ], + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@57..64 "import" [Newline("\n")] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@64..65 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@65..70 "\"foo\"" [] [], + }, + COMMA@70..72 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@72..74 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@74..78 "with" [] [], + }, + colon_token: COLON@78..80 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@82..99 "'resolution-mode'" [] [], + }, + colon_token: COLON@99..101 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@101..110 "'import'" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@110..112 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@112..113 "}" [] [], + }, + ], + r_paren_token: R_PAREN@113..114 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@114..115 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..115 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..114 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_IMPORT_CALL_EXPRESSION@0..13 + 0: IMPORT_KW@0..6 "import" [] [] + 1: JS_CALL_ARGUMENTS@6..13 + 0: L_PAREN@6..7 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@7..12 + 0: JS_STRING_LITERAL_EXPRESSION@7..12 + 0: JS_STRING_LITERAL@7..12 "\"foo\"" [] [] + 2: R_PAREN@12..13 ")" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@13..57 + 0: JS_IMPORT_CALL_EXPRESSION@13..57 + 0: IMPORT_KW@13..20 "import" [Newline("\n")] [] + 1: JS_CALL_ARGUMENTS@20..57 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@21..56 + 0: JS_STRING_LITERAL_EXPRESSION@21..26 + 0: JS_STRING_LITERAL@21..26 "\"foo\"" [] [] + 1: COMMA@26..28 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@28..56 + 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@30..55 + 0: JS_PROPERTY_OBJECT_MEMBER@30..55 + 0: JS_LITERAL_MEMBER_NAME@30..36 + 0: IDENT@30..36 "assert" [] [] + 1: COLON@36..38 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@38..55 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@40..53 + 0: JS_PROPERTY_OBJECT_MEMBER@40..53 + 0: JS_LITERAL_MEMBER_NAME@40..44 + 0: IDENT@40..44 "type" [] [] + 1: COLON@44..46 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@46..53 + 0: JS_STRING_LITERAL@46..53 "'json'" [] [Whitespace(" ")] + 2: R_CURLY@53..55 "}" [] [Whitespace(" ")] + 2: R_CURLY@55..56 "}" [] [] + 2: R_PAREN@56..57 ")" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@57..114 + 0: JS_IMPORT_CALL_EXPRESSION@57..114 + 0: IMPORT_KW@57..64 "import" [Newline("\n")] [] + 1: JS_CALL_ARGUMENTS@64..114 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@65..113 + 0: JS_STRING_LITERAL_EXPRESSION@65..70 + 0: JS_STRING_LITERAL@65..70 "\"foo\"" [] [] + 1: COMMA@70..72 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@72..113 + 0: L_CURLY@72..74 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@74..112 + 0: JS_PROPERTY_OBJECT_MEMBER@74..112 + 0: JS_LITERAL_MEMBER_NAME@74..78 + 0: IDENT@74..78 "with" [] [] + 1: COLON@78..80 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@80..112 + 0: L_CURLY@80..82 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@82..110 + 0: JS_PROPERTY_OBJECT_MEMBER@82..110 + 0: JS_LITERAL_MEMBER_NAME@82..99 + 0: JS_STRING_LITERAL@82..99 "'resolution-mode'" [] [] + 1: COLON@99..101 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@101..110 + 0: JS_STRING_LITERAL@101..110 "'import'" [] [Whitespace(" ")] + 2: R_CURLY@110..112 "}" [] [Whitespace(" ")] + 2: R_CURLY@112..113 "}" [] [] + 2: R_PAREN@113..114 ")" [] [] + 1: (empty) + 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_decl.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_decl.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js.snap new file mode 100644 index 000000000000..671b3ca7eb1b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js.snap @@ -0,0 +1,69 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import * as foo from "bla"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamespaceClause { + type_token: missing (optional), + namespace_specifier: JsNamespaceImportSpecifier { + star_token: STAR@7..9 "*" [] [Whitespace(" ")], + as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@12..16 "foo" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@21..26 "\"bla\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: JS_IMPORT@0..27 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMESPACE_CLAUSE@7..26 + 0: (empty) + 1: JS_NAMESPACE_IMPORT_SPECIFIER@7..16 + 0: STAR@7..9 "*" [] [Whitespace(" ")] + 1: AS_KW@9..12 "as" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@12..16 + 0: IDENT@12..16 "foo" [] [Whitespace(" ")] + 2: FROM_KW@16..21 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@21..26 + 0: JS_STRING_LITERAL@21..26 "\"bla\"" [] [] + 4: (empty) + 2: SEMICOLON@26..27 ";" [] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_default_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js.snap new file mode 100644 index 000000000000..d9a631d2b681 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js.snap @@ -0,0 +1,65 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import foo from "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@7..11 "foo" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@11..16 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@16..22 "\"test\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@22..23 ";" [] [], + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: JS_IMPORT@0..23 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@7..22 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@7..11 + 0: JS_IDENTIFIER_BINDING@7..11 + 0: IDENT@7..11 "foo" [] [Whitespace(" ")] + 2: FROM_KW@11..16 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@16..22 + 0: JS_STRING_LITERAL@16..22 "\"test\"" [] [] + 4: (empty) + 2: SEMICOLON@22..23 ";" [] [] + 4: EOF@23..24 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_default_clauses.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js.snap new file mode 100644 index 000000000000..42e2edfec0dc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js.snap @@ -0,0 +1,85 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import e, { f } from "b"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportCombinedClause { + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@7..8 "e" [] [], + }, + }, + comma_token: COMMA@8..10 "," [] [Whitespace(" ")], + specifier: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@10..12 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@12..14 "f" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@16..21 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@21..24 "\"b\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..25 + 0: JS_IMPORT@0..25 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_COMBINED_CLAUSE@7..24 + 0: JS_DEFAULT_IMPORT_SPECIFIER@7..8 + 0: JS_IDENTIFIER_BINDING@7..8 + 0: IDENT@7..8 "e" [] [] + 1: COMMA@8..10 "," [] [Whitespace(" ")] + 2: JS_NAMED_IMPORT_SPECIFIERS@10..16 + 0: L_CURLY@10..12 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@12..14 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@12..14 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@12..14 + 0: IDENT@12..14 "f" [] [Whitespace(" ")] + 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] + 3: FROM_KW@16..21 "from" [] [Whitespace(" ")] + 4: JS_MODULE_SOURCE@21..24 + 0: JS_STRING_LITERAL@21..24 "\"b\"" [] [] + 5: (empty) + 2: SEMICOLON@24..25 ";" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_meta.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_meta.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js.snap new file mode 100644 index 000000000000..bd9373844a80 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js.snap @@ -0,0 +1,50 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import.meta + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsImportMetaExpression { + import_token: IMPORT_KW@0..6 "import" [] [], + dot_token: DOT@6..7 "." [] [], + meta_token: META@7..11 "meta" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_EXPRESSION_STATEMENT@0..11 + 0: JS_IMPORT_META_EXPRESSION@0..11 + 0: IMPORT_KW@0..6 "import" [] [] + 1: DOT@6..7 "." [] [] + 2: META@7..11 "meta" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_named_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_named_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js.snap new file mode 100644 index 000000000000..b097ee82391d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js.snap @@ -0,0 +1,221 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import {} from "a"; +import { a, b, c, } from "b"; +import { f as x, default as w, "a-b-c" as y } from "b"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@7..8 "{" [] [], + specifiers: JsNamedImportSpecifierList [], + r_curly_token: R_CURLY@8..10 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@10..15 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@15..18 "\"a\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@19..27 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@29..30 "a" [] [], + }, + }, + COMMA@30..32 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@32..33 "b" [] [], + }, + }, + COMMA@33..35 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@35..36 "c" [] [], + }, + }, + COMMA@36..38 "," [] [Whitespace(" ")], + ], + r_curly_token: R_CURLY@38..40 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@40..45 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@45..48 "\"b\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@48..49 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@49..57 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@59..61 "f" [] [Whitespace(" ")], + }, + as_token: AS_KW@61..64 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@64..65 "x" [] [], + }, + }, + COMMA@65..67 "," [] [Whitespace(" ")], + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@67..75 "default" [] [Whitespace(" ")], + }, + as_token: AS_KW@75..78 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@78..79 "w" [] [], + }, + }, + COMMA@79..81 "," [] [Whitespace(" ")], + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: JS_STRING_LITERAL@81..89 "\"a-b-c\"" [] [Whitespace(" ")], + }, + as_token: AS_KW@89..92 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@92..94 "y" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@94..96 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@96..101 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@101..104 "\"b\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@104..105 ";" [] [], + }, + ], + eof_token: EOF@105..106 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..106 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..105 + 0: JS_IMPORT@0..19 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@7..18 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@7..10 + 0: L_CURLY@7..8 "{" [] [] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@8..8 + 2: R_CURLY@8..10 "}" [] [Whitespace(" ")] + 2: FROM_KW@10..15 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@15..18 + 0: JS_STRING_LITERAL@15..18 "\"a\"" [] [] + 4: (empty) + 2: SEMICOLON@18..19 ";" [] [] + 1: JS_IMPORT@19..49 + 0: IMPORT_KW@19..27 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@27..48 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@27..40 + 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@29..38 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@29..30 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "a" [] [] + 1: COMMA@30..32 "," [] [Whitespace(" ")] + 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@32..33 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "b" [] [] + 3: COMMA@33..35 "," [] [Whitespace(" ")] + 4: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@35..36 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@35..36 + 0: IDENT@35..36 "c" [] [] + 5: COMMA@36..38 "," [] [Whitespace(" ")] + 2: R_CURLY@38..40 "}" [] [Whitespace(" ")] + 2: FROM_KW@40..45 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@45..48 + 0: JS_STRING_LITERAL@45..48 "\"b\"" [] [] + 4: (empty) + 2: SEMICOLON@48..49 ";" [] [] + 2: JS_IMPORT@49..105 + 0: IMPORT_KW@49..57 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@57..104 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@57..96 + 0: L_CURLY@57..59 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@59..94 + 0: JS_NAMED_IMPORT_SPECIFIER@59..65 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@59..61 + 0: IDENT@59..61 "f" [] [Whitespace(" ")] + 2: AS_KW@61..64 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@64..65 + 0: IDENT@64..65 "x" [] [] + 1: COMMA@65..67 "," [] [Whitespace(" ")] + 2: JS_NAMED_IMPORT_SPECIFIER@67..79 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@67..75 + 0: IDENT@67..75 "default" [] [Whitespace(" ")] + 2: AS_KW@75..78 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@78..79 + 0: IDENT@78..79 "w" [] [] + 3: COMMA@79..81 "," [] [Whitespace(" ")] + 4: JS_NAMED_IMPORT_SPECIFIER@81..94 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@81..89 + 0: JS_STRING_LITERAL@81..89 "\"a-b-c\"" [] [Whitespace(" ")] + 2: AS_KW@89..92 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@92..94 + 0: IDENT@92..94 "y" [] [Whitespace(" ")] + 2: R_CURLY@94..96 "}" [] [Whitespace(" ")] + 2: FROM_KW@96..101 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@101..104 + 0: JS_STRING_LITERAL@101..104 "\"b\"" [] [] + 4: (empty) + 2: SEMICOLON@104..105 ";" [] [] + 4: EOF@105..106 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.js b/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.js rename to crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js.snap new file mode 100644 index 000000000000..29ff1b434df0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js.snap @@ -0,0 +1,144 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() {} +for (foo("call" in foo);;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..12 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + JsForStatement { + for_token: FOR_KW@17..22 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@22..23 "(" [] [], + initializer: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..26 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@26..27 "(" [] [], + args: JsCallArgumentList [ + JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@27..34 "\"call\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@34..37 "in" [] [Whitespace(" ")], + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@37..40 "foo" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@40..41 ")" [] [], + }, + }, + first_semi_token: SEMICOLON@41..42 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@42..43 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@45..46 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@46..47 "}" [] [], + }, + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_FUNCTION_DECLARATION@0..17 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..12 + 0: IDENT@9..12 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@12..15 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..13 + 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@15..17 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..16 + 3: R_CURLY@16..17 "}" [] [] + 1: JS_FOR_STATEMENT@17..47 + 0: FOR_KW@17..22 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@22..23 "(" [] [] + 2: JS_CALL_EXPRESSION@23..41 + 0: JS_IDENTIFIER_EXPRESSION@23..26 + 0: JS_REFERENCE_IDENTIFIER@23..26 + 0: IDENT@23..26 "foo" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@26..41 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@27..40 + 0: JS_IN_EXPRESSION@27..40 + 0: JS_STRING_LITERAL_EXPRESSION@27..34 + 0: JS_STRING_LITERAL@27..34 "\"call\"" [] [Whitespace(" ")] + 1: IN_KW@34..37 "in" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@37..40 + 0: JS_REFERENCE_IDENTIFIER@37..40 + 0: IDENT@37..40 "foo" [] [] + 2: R_PAREN@40..41 ")" [] [] + 3: SEMICOLON@41..42 ";" [] [] + 4: (empty) + 5: SEMICOLON@42..43 ";" [] [] + 6: (empty) + 7: R_PAREN@43..45 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@45..47 + 0: L_CURLY@45..46 "{" [] [] + 1: JS_STATEMENT_LIST@46..46 + 2: R_CURLY@46..47 "}" [] [] + 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/issue_2790.ts b/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/issue_2790.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts.snap new file mode 100644 index 000000000000..edae63abf76b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts.snap @@ -0,0 +1,129 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +var x: { + readonly [A in keyof B]?: any; +}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@7..8 "{" [] [], + readonly_modifier: TsMappedTypeReadonlyModifierClause { + operator_token: missing (optional), + readonly_token: READONLY_KW@8..20 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + l_brack_token: L_BRACK@20..21 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@21..23 "A" [] [Whitespace(" ")], + }, + in_token: IN_KW@23..26 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@26..32 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@32..33 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@33..34 "]" [] [], + optional_modifier: TsMappedTypeOptionalModifierClause { + operator_token: missing (optional), + question_mark_token: QUESTION@34..35 "?" [] [], + }, + mapped_type: TsTypeAnnotation { + colon_token: COLON@35..37 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@37..40 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@40..41 ";" [] [], + r_curly_token: R_CURLY@41..43 "}" [Newline("\n")] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: JS_VARIABLE_STATEMENT@0..44 + 0: JS_VARIABLE_DECLARATION@0..43 + 0: (empty) + 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..43 + 0: JS_VARIABLE_DECLARATOR@4..43 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "x" [] [] + 1: TS_TYPE_ANNOTATION@5..43 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_MAPPED_TYPE@7..43 + 0: L_CURLY@7..8 "{" [] [] + 1: TS_MAPPED_TYPE_READONLY_MODIFIER_CLAUSE@8..20 + 0: (empty) + 1: READONLY_KW@8..20 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: L_BRACK@20..21 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@21..23 + 0: IDENT@21..23 "A" [] [Whitespace(" ")] + 4: IN_KW@23..26 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@26..33 + 0: KEYOF_KW@26..32 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@32..33 + 0: JS_REFERENCE_IDENTIFIER@32..33 + 0: IDENT@32..33 "B" [] [] + 1: (empty) + 6: (empty) + 7: R_BRACK@33..34 "]" [] [] + 8: TS_MAPPED_TYPE_OPTIONAL_MODIFIER_CLAUSE@34..35 + 0: (empty) + 1: QUESTION@34..35 "?" [] [] + 9: TS_TYPE_ANNOTATION@35..40 + 0: COLON@35..37 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@37..40 + 0: ANY_KW@37..40 "any" [] [] + 10: SEMICOLON@40..41 ";" [] [] + 11: R_CURLY@41..43 "}" [Newline("\n")] [] + 2: (empty) + 1: SEMICOLON@43..44 ";" [] [] + 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.js b/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.js rename to crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap new file mode 100644 index 000000000000..41c975c307e1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap @@ -0,0 +1,225 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test { + static a = 1; + accessor b = 1; + static accessor c = 1; +} +class Foo { + accessor + foo +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@12..24 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@24..26 "a" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@26..28 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@28..29 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@29..30 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsAccessorModifier { + modifier_token: ACCESSOR_KW@30..44 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@44..46 "b" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@46..48 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@48..49 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@49..50 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@50..62 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@62..71 "accessor" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@71..73 "c" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@75..76 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@76..77 ";" [] [], + }, + ], + r_curly_token: R_CURLY@77..79 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@79..86 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@86..90 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@90..91 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@91..104 "accessor" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@104..112 "foo" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@112..114 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@114..115 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..115 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..114 + 0: JS_CLASS_DECLARATION@0..79 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..77 + 0: JS_PROPERTY_CLASS_MEMBER@12..30 + 0: JS_PROPERTY_MODIFIER_LIST@12..24 + 0: JS_STATIC_MODIFIER@12..24 + 0: STATIC_KW@12..24 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@24..26 + 0: IDENT@24..26 "a" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@26..29 + 0: EQ@26..28 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@28..29 + 0: JS_NUMBER_LITERAL@28..29 "1" [] [] + 4: SEMICOLON@29..30 ";" [] [] + 1: JS_PROPERTY_CLASS_MEMBER@30..50 + 0: JS_PROPERTY_MODIFIER_LIST@30..44 + 0: JS_ACCESSOR_MODIFIER@30..44 + 0: ACCESSOR_KW@30..44 "accessor" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@44..46 + 0: IDENT@44..46 "b" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@46..49 + 0: EQ@46..48 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@48..49 + 0: JS_NUMBER_LITERAL@48..49 "1" [] [] + 4: SEMICOLON@49..50 ";" [] [] + 2: JS_PROPERTY_CLASS_MEMBER@50..77 + 0: JS_PROPERTY_MODIFIER_LIST@50..71 + 0: JS_STATIC_MODIFIER@50..62 + 0: STATIC_KW@50..62 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_ACCESSOR_MODIFIER@62..71 + 0: ACCESSOR_KW@62..71 "accessor" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@71..73 + 0: IDENT@71..73 "c" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@73..76 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@75..76 + 0: JS_NUMBER_LITERAL@75..76 "1" [] [] + 4: SEMICOLON@76..77 ";" [] [] + 9: R_CURLY@77..79 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@79..114 + 0: JS_DECORATOR_LIST@79..79 + 1: (empty) + 2: CLASS_KW@79..86 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@86..90 + 0: IDENT@86..90 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@90..91 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@91..112 + 0: JS_PROPERTY_CLASS_MEMBER@91..104 + 0: JS_PROPERTY_MODIFIER_LIST@91..91 + 1: JS_LITERAL_MEMBER_NAME@91..104 + 0: IDENT@91..104 "accessor" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@104..112 + 0: JS_PROPERTY_MODIFIER_LIST@104..104 + 1: JS_LITERAL_MEMBER_NAME@104..112 + 0: IDENT@104..112 "foo" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: (empty) + 9: R_CURLY@112..114 "}" [Newline("\n")] [] + 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js.snap new file mode 100644 index 000000000000..fac5df842600 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +((foo)) +(foo) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@1..2 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@2..5 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@5..6 ")" [] [], + }, + r_paren_token: R_PAREN@6..7 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@7..9 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..12 "foo" [] [], + }, + }, + ], + r_paren_token: R_PAREN@12..13 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_CALL_EXPRESSION@0..13 + 0: JS_PARENTHESIZED_EXPRESSION@0..7 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@1..6 + 0: L_PAREN@1..2 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@2..5 + 0: JS_REFERENCE_IDENTIFIER@2..5 + 0: IDENT@2..5 "foo" [] [] + 2: R_PAREN@5..6 ")" [] [] + 2: R_PAREN@6..7 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@7..13 + 0: L_PAREN@7..9 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@9..12 + 0: JS_IDENTIFIER_EXPRESSION@9..12 + 0: JS_REFERENCE_IDENTIFIER@9..12 + 0: IDENT@9..12 "foo" [] [] + 2: R_PAREN@12..13 ")" [] [] + 1: (empty) + 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.js b/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.js rename to crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js.snap new file mode 100644 index 000000000000..d2b934333d47 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js.snap @@ -0,0 +1,225 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete a['test']; +void a; +typeof a; ++1; +-1; +~1; +!true; +-a + -b + +a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@0..7 "delete" [] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..8 "a" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@8..9 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@9..15 "'test'" [] [], + }, + r_brack_token: R_BRACK@15..16 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: VOID_KW@17..23 "void" [Newline("\n")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..24 "a" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: TYPEOF_KW@25..33 "typeof" [Newline("\n")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..34 "a" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: PLUS@35..37 "+" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@37..38 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: MINUS@39..41 "-" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@41..42 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: TILDE@43..45 "~" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@45..46 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: BANG@47..49 "!" [Newline("\n")] [], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@49..53 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@53..54 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsUnaryExpression { + operator_token: MINUS@54..56 "-" [Newline("\n")] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@56..58 "a" [] [Whitespace(" ")], + }, + }, + }, + operator_token: PLUS@58..60 "+" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: MINUS@60..61 "-" [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@61..63 "b" [] [Whitespace(" ")], + }, + }, + }, + }, + operator_token: PLUS@63..65 "+" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: PLUS@65..66 "+" [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@66..67 "a" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@67..68 ";" [] [], + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..68 + 0: JS_EXPRESSION_STATEMENT@0..17 + 0: JS_UNARY_EXPRESSION@0..16 + 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@7..16 + 0: JS_IDENTIFIER_EXPRESSION@7..8 + 0: JS_REFERENCE_IDENTIFIER@7..8 + 0: IDENT@7..8 "a" [] [] + 1: (empty) + 2: L_BRACK@8..9 "[" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@9..15 + 0: JS_STRING_LITERAL@9..15 "'test'" [] [] + 4: R_BRACK@15..16 "]" [] [] + 1: SEMICOLON@16..17 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@17..25 + 0: JS_UNARY_EXPRESSION@17..24 + 0: VOID_KW@17..23 "void" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@23..24 + 0: JS_REFERENCE_IDENTIFIER@23..24 + 0: IDENT@23..24 "a" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@25..35 + 0: JS_UNARY_EXPRESSION@25..34 + 0: TYPEOF_KW@25..33 "typeof" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@33..34 + 0: JS_REFERENCE_IDENTIFIER@33..34 + 0: IDENT@33..34 "a" [] [] + 1: SEMICOLON@34..35 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@35..39 + 0: JS_UNARY_EXPRESSION@35..38 + 0: PLUS@35..37 "+" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@37..38 + 0: JS_NUMBER_LITERAL@37..38 "1" [] [] + 1: SEMICOLON@38..39 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@39..43 + 0: JS_UNARY_EXPRESSION@39..42 + 0: MINUS@39..41 "-" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@41..42 + 0: JS_NUMBER_LITERAL@41..42 "1" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@43..47 + 0: JS_UNARY_EXPRESSION@43..46 + 0: TILDE@43..45 "~" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@45..46 + 0: JS_NUMBER_LITERAL@45..46 "1" [] [] + 1: SEMICOLON@46..47 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@47..54 + 0: JS_UNARY_EXPRESSION@47..53 + 0: BANG@47..49 "!" [Newline("\n")] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@49..53 + 0: TRUE_KW@49..53 "true" [] [] + 1: SEMICOLON@53..54 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@54..68 + 0: JS_BINARY_EXPRESSION@54..67 + 0: JS_BINARY_EXPRESSION@54..63 + 0: JS_UNARY_EXPRESSION@54..58 + 0: MINUS@54..56 "-" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@56..58 + 0: JS_REFERENCE_IDENTIFIER@56..58 + 0: IDENT@56..58 "a" [] [Whitespace(" ")] + 1: PLUS@58..60 "+" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@60..63 + 0: MINUS@60..61 "-" [] [] + 1: JS_IDENTIFIER_EXPRESSION@61..63 + 0: JS_REFERENCE_IDENTIFIER@61..63 + 0: IDENT@61..63 "b" [] [Whitespace(" ")] + 1: PLUS@63..65 "+" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@65..67 + 0: PLUS@65..66 "+" [] [] + 1: JS_IDENTIFIER_EXPRESSION@66..67 + 0: JS_REFERENCE_IDENTIFIER@66..67 + 0: IDENT@66..67 "a" [] [] + 1: SEMICOLON@67..68 ";" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_any_name.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx.snap new file mode 100644 index 000000000000..06a4ccc59c70 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx.snap @@ -0,0 +1,234 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; +; +; +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..10 "a-b-c-d-e" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@11..12 "<" [] [], + slash_token: SLASH@12..13 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@13..22 "a-b-c-d-e" [] [], + }, + r_angle_token: R_ANGLE@22..23 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@24..26 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@26..36 "a-b-c-d-e" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@36..37 "/" [] [], + r_angle_token: R_ANGLE@37..38 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@39..41 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@41..44 "if" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@44..45 "/" [] [], + r_angle_token: R_ANGLE@45..46 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@47..49 "<" [Newline("\n")] [], + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@49..58 "namespace" [] [], + }, + colon_token: COLON@58..59 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@59..63 "name" [] [], + }, + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@63..64 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@64..65 "<" [] [], + slash_token: SLASH@65..66 "/" [] [], + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@66..75 "namespace" [] [], + }, + colon_token: COLON@75..76 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@76..80 "name" [] [], + }, + }, + r_angle_token: R_ANGLE@80..81 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@81..82 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@82..84 "<" [Newline("\n")] [], + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@84..101 "dashed-namespaced" [] [], + }, + colon_token: COLON@101..102 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@102..114 "dashed-name" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@114..115 "/" [] [], + r_angle_token: R_ANGLE@115..116 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@116..117 ";" [] [], + }, + ], + eof_token: EOF@117..118 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..118 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..117 + 0: JS_EXPRESSION_STATEMENT@0..24 + 0: JSX_TAG_EXPRESSION@0..23 + 0: JSX_ELEMENT@0..23 + 0: JSX_OPENING_ELEMENT@0..11 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..10 + 0: JSX_IDENT@1..10 "a-b-c-d-e" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@10..10 + 4: R_ANGLE@10..11 ">" [] [] + 1: JSX_CHILD_LIST@11..11 + 2: JSX_CLOSING_ELEMENT@11..23 + 0: L_ANGLE@11..12 "<" [] [] + 1: SLASH@12..13 "/" [] [] + 2: JSX_NAME@13..22 + 0: JSX_IDENT@13..22 "a-b-c-d-e" [] [] + 3: R_ANGLE@22..23 ">" [] [] + 1: SEMICOLON@23..24 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@24..39 + 0: JSX_TAG_EXPRESSION@24..38 + 0: JSX_SELF_CLOSING_ELEMENT@24..38 + 0: L_ANGLE@24..26 "<" [Newline("\n")] [] + 1: JSX_NAME@26..36 + 0: JSX_IDENT@26..36 "a-b-c-d-e" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@36..36 + 4: SLASH@36..37 "/" [] [] + 5: R_ANGLE@37..38 ">" [] [] + 1: SEMICOLON@38..39 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@39..47 + 0: JSX_TAG_EXPRESSION@39..46 + 0: JSX_SELF_CLOSING_ELEMENT@39..46 + 0: L_ANGLE@39..41 "<" [Newline("\n")] [] + 1: JSX_NAME@41..44 + 0: JSX_IDENT@41..44 "if" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@44..44 + 4: SLASH@44..45 "/" [] [] + 5: R_ANGLE@45..46 ">" [] [] + 1: SEMICOLON@46..47 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@47..82 + 0: JSX_TAG_EXPRESSION@47..81 + 0: JSX_ELEMENT@47..81 + 0: JSX_OPENING_ELEMENT@47..64 + 0: L_ANGLE@47..49 "<" [Newline("\n")] [] + 1: JSX_NAMESPACE_NAME@49..63 + 0: JSX_NAME@49..58 + 0: JSX_IDENT@49..58 "namespace" [] [] + 1: COLON@58..59 ":" [] [] + 2: JSX_NAME@59..63 + 0: JSX_IDENT@59..63 "name" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@63..63 + 4: R_ANGLE@63..64 ">" [] [] + 1: JSX_CHILD_LIST@64..64 + 2: JSX_CLOSING_ELEMENT@64..81 + 0: L_ANGLE@64..65 "<" [] [] + 1: SLASH@65..66 "/" [] [] + 2: JSX_NAMESPACE_NAME@66..80 + 0: JSX_NAME@66..75 + 0: JSX_IDENT@66..75 "namespace" [] [] + 1: COLON@75..76 ":" [] [] + 2: JSX_NAME@76..80 + 0: JSX_IDENT@76..80 "name" [] [] + 3: R_ANGLE@80..81 ">" [] [] + 1: SEMICOLON@81..82 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@82..117 + 0: JSX_TAG_EXPRESSION@82..116 + 0: JSX_SELF_CLOSING_ELEMENT@82..116 + 0: L_ANGLE@82..84 "<" [Newline("\n")] [] + 1: JSX_NAMESPACE_NAME@84..114 + 0: JSX_NAME@84..101 + 0: JSX_IDENT@84..101 "dashed-namespaced" [] [] + 1: COLON@101..102 ":" [] [] + 2: JSX_NAME@102..114 + 0: JSX_IDENT@102..114 "dashed-name" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@114..114 + 4: SLASH@114..115 "/" [] [] + 5: R_ANGLE@115..116 ">" [] [] + 1: SEMICOLON@116..117 ";" [] [] + 4: EOF@117..118 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap new file mode 100644 index 000000000000..8238da1964ab --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap @@ -0,0 +1,155 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +bar ? (foo) : ({() => {}}); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "bar" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@4..6 "?" [] [Whitespace(" ")], + consequent: JsParenthesizedExpression { + l_paren_token: L_PAREN@6..7 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..10 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@10..12 ")" [] [Whitespace(" ")], + }, + colon_token: COLON@12..14 ":" [] [Whitespace(" ")], + alternate: JsParenthesizedExpression { + l_paren_token: L_PAREN@14..15 "(" [] [], + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@15..16 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@16..17 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@17..18 ">" [] [], + }, + children: JsxChildList [ + JsxExpressionChild { + l_curly_token: L_CURLY@18..19 "{" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@19..20 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@28..29 "<" [] [], + slash_token: SLASH@29..30 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@30..31 "a" [] [], + }, + r_angle_token: R_ANGLE@31..32 ">" [] [], + }, + }, + }, + r_paren_token: R_PAREN@32..33 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: JS_EXPRESSION_STATEMENT@0..34 + 0: JS_CONDITIONAL_EXPRESSION@0..33 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "bar" [] [Whitespace(" ")] + 1: QUESTION@4..6 "?" [] [Whitespace(" ")] + 2: JS_PARENTHESIZED_EXPRESSION@6..12 + 0: L_PAREN@6..7 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@7..10 + 0: JS_REFERENCE_IDENTIFIER@7..10 + 0: IDENT@7..10 "foo" [] [] + 2: R_PAREN@10..12 ")" [] [Whitespace(" ")] + 3: COLON@12..14 ":" [] [Whitespace(" ")] + 4: JS_PARENTHESIZED_EXPRESSION@14..33 + 0: L_PAREN@14..15 "(" [] [] + 1: JSX_TAG_EXPRESSION@15..32 + 0: JSX_ELEMENT@15..32 + 0: JSX_OPENING_ELEMENT@15..18 + 0: L_ANGLE@15..16 "<" [] [] + 1: JSX_NAME@16..17 + 0: JSX_IDENT@16..17 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@17..17 + 4: R_ANGLE@17..18 ">" [] [] + 1: JSX_CHILD_LIST@18..28 + 0: JSX_EXPRESSION_CHILD@18..28 + 0: L_CURLY@18..19 "{" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@19..27 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@19..22 + 0: L_PAREN@19..20 "(" [] [] + 1: JS_PARAMETER_LIST@20..20 + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@25..27 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..26 + 3: R_CURLY@26..27 "}" [] [] + 2: R_CURLY@27..28 "}" [] [] + 2: JSX_CLOSING_ELEMENT@28..32 + 0: L_ANGLE@28..29 "<" [] [] + 1: SLASH@29..30 "/" [] [] + 2: JSX_NAME@30..31 + 0: JSX_IDENT@30..31 "a" [] [] + 3: R_ANGLE@31..32 ">" [] [] + 2: R_PAREN@32..33 ")" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx.snap new file mode 100644 index 000000000000..7c79b1a80f65 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx.snap @@ -0,0 +1,1583 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let x; +let a; +let b; +let key; +let f = () => {}; +
+ {1} + {9007199254740991n} + {""} + {true} + {null} + {undefined} + {/a/} + {[]} + {x => console.log(x)} + {x = 1} + {await x} + {1 + 1} + {f()} + {a[b]} + {a?1:2} + {function f() {}} + {function () {}} + {a} + {import("a.js")} + {key in a} + {a instanceof Object} + {a && b} + {new f()} + {{}} + {(a)} + {a++} + {++a} + {a,b} + {a.b} + {super.a()} + {this} + {delete a.a} + {void a} + {typeof a} + {+a} + {-a} + {!a} + {~a} + {``} + {/* A JSX comment */} + {/* Multi + line + */} + {} +
+function *f() { + return
+ {yield a} +
; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "x" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@5..6 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@6..11 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@11..12 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@13..18 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@18..19 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@25..28 "key" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@34..36 "f" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@44..45 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@45..46 "}" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@47..49 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@49..52 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@52..53 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@53..56 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@56..57 "{" [] [], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@57..58 "1" [] [], + }, + r_curly_token: R_CURLY@58..59 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@59..62 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@62..63 "{" [] [], + expression: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@63..80 "9007199254740991n" [] [], + }, + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@81..84 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@84..85 "{" [] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@85..87 "\"\"" [] [], + }, + r_curly_token: R_CURLY@87..88 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@88..91 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@91..92 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@92..96 "true" [] [], + }, + r_curly_token: R_CURLY@96..97 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@97..100 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@100..101 "{" [] [], + expression: JsNullLiteralExpression { + value_token: NULL_KW@101..105 "null" [] [], + }, + r_curly_token: R_CURLY@105..106 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@106..109 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@109..110 "{" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@110..119 "undefined" [] [], + }, + }, + r_curly_token: R_CURLY@119..120 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@120..123 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@123..124 "{" [] [], + expression: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@124..127 "/a/" [] [], + }, + r_curly_token: R_CURLY@127..128 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@128..131 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@131..132 "{" [] [], + expression: JsArrayExpression { + l_brack_token: L_BRACK@132..133 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@133..134 "]" [] [], + }, + r_curly_token: R_CURLY@134..135 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@135..138 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@138..139 "{" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@139..141 "x" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@141..144 "=>" [] [Whitespace(" ")], + body: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@144..151 "console" [] [], + }, + }, + operator_token: DOT@151..152 "." [] [], + member: JsName { + value_token: IDENT@152..155 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@155..156 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@156..157 "x" [] [], + }, + }, + ], + r_paren_token: R_PAREN@157..158 ")" [] [], + }, + }, + }, + r_curly_token: R_CURLY@158..159 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@159..162 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@162..163 "{" [] [], + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@163..165 "x" [] [Whitespace(" ")], + }, + operator_token: EQ@165..167 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@167..168 "1" [] [], + }, + }, + r_curly_token: R_CURLY@168..169 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@169..172 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@172..173 "{" [] [], + expression: JsAwaitExpression { + await_token: AWAIT_KW@173..179 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@179..180 "x" [] [], + }, + }, + }, + r_curly_token: R_CURLY@180..181 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@181..184 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@184..185 "{" [] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@185..187 "1" [] [Whitespace(" ")], + }, + operator_token: PLUS@187..189 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@189..190 "1" [] [], + }, + }, + r_curly_token: R_CURLY@190..191 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@191..194 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@194..195 "{" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@195..196 "f" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@196..197 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@197..198 ")" [] [], + }, + }, + r_curly_token: R_CURLY@198..199 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@199..202 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@202..203 "{" [] [], + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@203..204 "a" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@204..205 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@205..206 "b" [] [], + }, + }, + r_brack_token: R_BRACK@206..207 "]" [] [], + }, + r_curly_token: R_CURLY@207..208 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@208..211 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@211..212 "{" [] [], + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@212..213 "a" [] [], + }, + }, + question_mark_token: QUESTION@213..214 "?" [] [], + consequent: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@214..215 "1" [] [], + }, + colon_token: COLON@215..216 ":" [] [], + alternate: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@216..217 "2" [] [], + }, + }, + r_curly_token: R_CURLY@217..218 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@218..221 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@221..222 "{" [] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@222..231 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@231..232 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@232..233 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@233..235 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@235..236 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@236..237 "}" [] [], + }, + }, + r_curly_token: R_CURLY@237..238 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@238..241 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@241..242 "{" [] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@242..251 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@251..252 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@252..254 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@254..255 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@255..256 "}" [] [], + }, + }, + r_curly_token: R_CURLY@256..257 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@257..260 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@260..261 "{" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@261..262 "a" [] [], + }, + }, + r_curly_token: R_CURLY@262..263 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@263..266 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@266..267 "{" [] [], + expression: JsImportCallExpression { + import_token: IMPORT_KW@267..273 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@273..274 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@274..280 "\"a.js\"" [] [], + }, + ], + r_paren_token: R_PAREN@280..281 ")" [] [], + }, + }, + r_curly_token: R_CURLY@281..282 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@282..285 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@285..286 "{" [] [], + expression: JsInExpression { + property: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@286..290 "key" [] [Whitespace(" ")], + }, + }, + in_token: IN_KW@290..293 "in" [] [Whitespace(" ")], + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@293..294 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@294..295 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@295..298 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@298..299 "{" [] [], + expression: JsInstanceofExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@299..301 "a" [] [Whitespace(" ")], + }, + }, + instanceof_token: INSTANCEOF_KW@301..312 "instanceof" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@312..318 "Object" [] [], + }, + }, + }, + r_curly_token: R_CURLY@318..319 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@319..322 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@322..323 "{" [] [], + expression: JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@323..325 "a" [] [Whitespace(" ")], + }, + }, + operator_token: AMP2@325..328 "&&" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@328..329 "b" [] [], + }, + }, + }, + r_curly_token: R_CURLY@329..330 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@330..333 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@333..334 "{" [] [], + expression: JsNewExpression { + new_token: NEW_KW@334..338 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@338..339 "f" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@339..340 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@340..341 ")" [] [], + }, + }, + r_curly_token: R_CURLY@341..342 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@342..345 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@345..346 "{" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@346..347 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@347..348 "}" [] [], + }, + r_curly_token: R_CURLY@348..349 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@349..352 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@352..353 "{" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@353..354 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@354..355 "a" [] [], + }, + }, + r_paren_token: R_PAREN@355..356 ")" [] [], + }, + r_curly_token: R_CURLY@356..357 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@357..360 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@360..361 "{" [] [], + expression: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@361..362 "a" [] [], + }, + operator_token: PLUS2@362..364 "++" [] [], + }, + r_curly_token: R_CURLY@364..365 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@365..368 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@368..369 "{" [] [], + expression: JsPreUpdateExpression { + operator_token: PLUS2@369..371 "++" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@371..372 "a" [] [], + }, + }, + r_curly_token: R_CURLY@372..373 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@373..376 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@376..377 "{" [] [], + expression: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@377..378 "a" [] [], + }, + }, + comma_token: COMMA@378..379 "," [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@379..380 "b" [] [], + }, + }, + }, + r_curly_token: R_CURLY@380..381 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@381..384 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@384..385 "{" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@385..386 "a" [] [], + }, + }, + operator_token: DOT@386..387 "." [] [], + member: JsName { + value_token: IDENT@387..388 "b" [] [], + }, + }, + r_curly_token: R_CURLY@388..389 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@389..392 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@392..393 "{" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsSuperExpression { + super_token: SUPER_KW@393..398 "super" [] [], + }, + operator_token: DOT@398..399 "." [] [], + member: JsName { + value_token: IDENT@399..400 "a" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@400..401 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@401..402 ")" [] [], + }, + }, + r_curly_token: R_CURLY@402..403 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@403..406 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@406..407 "{" [] [], + expression: JsThisExpression { + this_token: THIS_KW@407..411 "this" [] [], + }, + r_curly_token: R_CURLY@411..412 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@412..415 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@415..416 "{" [] [], + expression: JsUnaryExpression { + operator_token: DELETE_KW@416..423 "delete" [] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@423..424 "a" [] [], + }, + }, + operator_token: DOT@424..425 "." [] [], + member: JsName { + value_token: IDENT@425..426 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@426..427 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@427..430 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@430..431 "{" [] [], + expression: JsUnaryExpression { + operator_token: VOID_KW@431..436 "void" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@436..437 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@437..438 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@438..441 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@441..442 "{" [] [], + expression: JsUnaryExpression { + operator_token: TYPEOF_KW@442..449 "typeof" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@449..450 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@450..451 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@451..454 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@454..455 "{" [] [], + expression: JsUnaryExpression { + operator_token: PLUS@455..456 "+" [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@456..457 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@457..458 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@458..461 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@461..462 "{" [] [], + expression: JsUnaryExpression { + operator_token: MINUS@462..463 "-" [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@463..464 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@464..465 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@465..468 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@468..469 "{" [] [], + expression: JsUnaryExpression { + operator_token: BANG@469..470 "!" [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@470..471 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@471..472 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@472..475 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@475..476 "{" [] [], + expression: JsUnaryExpression { + operator_token: TILDE@476..477 "~" [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@477..478 "a" [] [], + }, + }, + }, + r_curly_token: R_CURLY@478..479 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@479..482 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@482..483 "{" [] [], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@483..484 "`" [] [], + elements: JsTemplateElementList [], + r_tick_token: BACKTICK@484..485 "`" [] [], + }, + r_curly_token: R_CURLY@485..486 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@486..489 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@489..509 "{" [] [Comments("/* A JSX comment */")], + expression: missing (optional), + r_curly_token: R_CURLY@509..510 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@510..513 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@513..538 "{" [] [Comments("/* Multi\n line\n */")], + expression: missing (optional), + r_curly_token: R_CURLY@538..539 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@539..542 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@542..543 "{" [] [], + expression: missing (optional), + r_curly_token: R_CURLY@543..544 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@544..545 "\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@545..546 "<" [] [], + slash_token: SLASH@546..547 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@547..550 "div" [] [], + }, + r_angle_token: R_ANGLE@550..551 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@551..561 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@561..562 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@562..563 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@563..564 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@564..566 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@566..567 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@567..579 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@579..580 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@580..583 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@583..584 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@584..593 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@593..594 "{" [] [], + expression: JsYieldExpression { + yield_token: YIELD_KW@594..600 "yield" [] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@600..601 "a" [] [], + }, + }, + }, + }, + r_curly_token: R_CURLY@601..602 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@602..607 "\n " [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@607..608 "<" [] [], + slash_token: SLASH@608..609 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@609..612 "div" [] [], + }, + r_angle_token: R_ANGLE@612..613 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@613..614 ";" [] [], + }, + ], + r_curly_token: R_CURLY@614..616 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@616..617 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..617 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..616 + 0: JS_VARIABLE_STATEMENT@0..6 + 0: JS_VARIABLE_DECLARATION@0..5 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..5 + 0: JS_VARIABLE_DECLARATOR@4..5 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "x" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_VARIABLE_STATEMENT@6..13 + 0: JS_VARIABLE_DECLARATION@6..12 + 0: (empty) + 1: LET_KW@6..11 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@11..12 + 0: JS_VARIABLE_DECLARATOR@11..12 + 0: JS_IDENTIFIER_BINDING@11..12 + 0: IDENT@11..12 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@12..13 ";" [] [] + 2: JS_VARIABLE_STATEMENT@13..20 + 0: JS_VARIABLE_DECLARATION@13..19 + 0: (empty) + 1: LET_KW@13..18 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@18..19 + 0: JS_VARIABLE_DECLARATOR@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "b" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@19..20 ";" [] [] + 3: JS_VARIABLE_STATEMENT@20..29 + 0: JS_VARIABLE_DECLARATION@20..28 + 0: (empty) + 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@25..28 + 0: JS_VARIABLE_DECLARATOR@25..28 + 0: JS_IDENTIFIER_BINDING@25..28 + 0: IDENT@25..28 "key" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@28..29 ";" [] [] + 4: JS_VARIABLE_STATEMENT@29..47 + 0: JS_VARIABLE_DECLARATION@29..46 + 0: (empty) + 1: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@34..46 + 0: JS_VARIABLE_DECLARATOR@34..46 + 0: JS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "f" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@36..46 + 0: EQ@36..38 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@38..46 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@38..41 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..39 + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@44..46 + 0: L_CURLY@44..45 "{" [] [] + 1: JS_DIRECTIVE_LIST@45..45 + 2: JS_STATEMENT_LIST@45..45 + 3: R_CURLY@45..46 "}" [] [] + 1: SEMICOLON@46..47 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@47..551 + 0: JSX_TAG_EXPRESSION@47..551 + 0: JSX_ELEMENT@47..551 + 0: JSX_OPENING_ELEMENT@47..53 + 0: L_ANGLE@47..49 "<" [Newline("\n")] [] + 1: JSX_NAME@49..52 + 0: JSX_IDENT@49..52 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@52..52 + 4: R_ANGLE@52..53 ">" [] [] + 1: JSX_CHILD_LIST@53..545 + 0: JSX_TEXT@53..56 + 0: JSX_TEXT_LITERAL@53..56 "\n " [] [] + 1: JSX_EXPRESSION_CHILD@56..59 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@57..58 + 0: JS_NUMBER_LITERAL@57..58 "1" [] [] + 2: R_CURLY@58..59 "}" [] [] + 2: JSX_TEXT@59..62 + 0: JSX_TEXT_LITERAL@59..62 "\n " [] [] + 3: JSX_EXPRESSION_CHILD@62..81 + 0: L_CURLY@62..63 "{" [] [] + 1: JS_BIGINT_LITERAL_EXPRESSION@63..80 + 0: JS_BIGINT_LITERAL@63..80 "9007199254740991n" [] [] + 2: R_CURLY@80..81 "}" [] [] + 4: JSX_TEXT@81..84 + 0: JSX_TEXT_LITERAL@81..84 "\n " [] [] + 5: JSX_EXPRESSION_CHILD@84..88 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_STRING_LITERAL_EXPRESSION@85..87 + 0: JS_STRING_LITERAL@85..87 "\"\"" [] [] + 2: R_CURLY@87..88 "}" [] [] + 6: JSX_TEXT@88..91 + 0: JSX_TEXT_LITERAL@88..91 "\n " [] [] + 7: JSX_EXPRESSION_CHILD@91..97 + 0: L_CURLY@91..92 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@92..96 + 0: TRUE_KW@92..96 "true" [] [] + 2: R_CURLY@96..97 "}" [] [] + 8: JSX_TEXT@97..100 + 0: JSX_TEXT_LITERAL@97..100 "\n " [] [] + 9: JSX_EXPRESSION_CHILD@100..106 + 0: L_CURLY@100..101 "{" [] [] + 1: JS_NULL_LITERAL_EXPRESSION@101..105 + 0: NULL_KW@101..105 "null" [] [] + 2: R_CURLY@105..106 "}" [] [] + 10: JSX_TEXT@106..109 + 0: JSX_TEXT_LITERAL@106..109 "\n " [] [] + 11: JSX_EXPRESSION_CHILD@109..120 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_IDENTIFIER_EXPRESSION@110..119 + 0: JS_REFERENCE_IDENTIFIER@110..119 + 0: IDENT@110..119 "undefined" [] [] + 2: R_CURLY@119..120 "}" [] [] + 12: JSX_TEXT@120..123 + 0: JSX_TEXT_LITERAL@120..123 "\n " [] [] + 13: JSX_EXPRESSION_CHILD@123..128 + 0: L_CURLY@123..124 "{" [] [] + 1: JS_REGEX_LITERAL_EXPRESSION@124..127 + 0: JS_REGEX_LITERAL@124..127 "/a/" [] [] + 2: R_CURLY@127..128 "}" [] [] + 14: JSX_TEXT@128..131 + 0: JSX_TEXT_LITERAL@128..131 "\n " [] [] + 15: JSX_EXPRESSION_CHILD@131..135 + 0: L_CURLY@131..132 "{" [] [] + 1: JS_ARRAY_EXPRESSION@132..134 + 0: L_BRACK@132..133 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@133..133 + 2: R_BRACK@133..134 "]" [] [] + 2: R_CURLY@134..135 "}" [] [] + 16: JSX_TEXT@135..138 + 0: JSX_TEXT_LITERAL@135..138 "\n " [] [] + 17: JSX_EXPRESSION_CHILD@138..159 + 0: L_CURLY@138..139 "{" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@139..158 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@139..141 + 0: IDENT@139..141 "x" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@141..144 "=>" [] [Whitespace(" ")] + 5: JS_CALL_EXPRESSION@144..158 + 0: JS_STATIC_MEMBER_EXPRESSION@144..155 + 0: JS_IDENTIFIER_EXPRESSION@144..151 + 0: JS_REFERENCE_IDENTIFIER@144..151 + 0: IDENT@144..151 "console" [] [] + 1: DOT@151..152 "." [] [] + 2: JS_NAME@152..155 + 0: IDENT@152..155 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@155..158 + 0: L_PAREN@155..156 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@156..157 + 0: JS_IDENTIFIER_EXPRESSION@156..157 + 0: JS_REFERENCE_IDENTIFIER@156..157 + 0: IDENT@156..157 "x" [] [] + 2: R_PAREN@157..158 ")" [] [] + 2: R_CURLY@158..159 "}" [] [] + 18: JSX_TEXT@159..162 + 0: JSX_TEXT_LITERAL@159..162 "\n " [] [] + 19: JSX_EXPRESSION_CHILD@162..169 + 0: L_CURLY@162..163 "{" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@163..168 + 0: JS_IDENTIFIER_ASSIGNMENT@163..165 + 0: IDENT@163..165 "x" [] [Whitespace(" ")] + 1: EQ@165..167 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@167..168 + 0: JS_NUMBER_LITERAL@167..168 "1" [] [] + 2: R_CURLY@168..169 "}" [] [] + 20: JSX_TEXT@169..172 + 0: JSX_TEXT_LITERAL@169..172 "\n " [] [] + 21: JSX_EXPRESSION_CHILD@172..181 + 0: L_CURLY@172..173 "{" [] [] + 1: JS_AWAIT_EXPRESSION@173..180 + 0: AWAIT_KW@173..179 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@179..180 + 0: JS_REFERENCE_IDENTIFIER@179..180 + 0: IDENT@179..180 "x" [] [] + 2: R_CURLY@180..181 "}" [] [] + 22: JSX_TEXT@181..184 + 0: JSX_TEXT_LITERAL@181..184 "\n " [] [] + 23: JSX_EXPRESSION_CHILD@184..191 + 0: L_CURLY@184..185 "{" [] [] + 1: JS_BINARY_EXPRESSION@185..190 + 0: JS_NUMBER_LITERAL_EXPRESSION@185..187 + 0: JS_NUMBER_LITERAL@185..187 "1" [] [Whitespace(" ")] + 1: PLUS@187..189 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@189..190 + 0: JS_NUMBER_LITERAL@189..190 "1" [] [] + 2: R_CURLY@190..191 "}" [] [] + 24: JSX_TEXT@191..194 + 0: JSX_TEXT_LITERAL@191..194 "\n " [] [] + 25: JSX_EXPRESSION_CHILD@194..199 + 0: L_CURLY@194..195 "{" [] [] + 1: JS_CALL_EXPRESSION@195..198 + 0: JS_IDENTIFIER_EXPRESSION@195..196 + 0: JS_REFERENCE_IDENTIFIER@195..196 + 0: IDENT@195..196 "f" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@196..198 + 0: L_PAREN@196..197 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@197..197 + 2: R_PAREN@197..198 ")" [] [] + 2: R_CURLY@198..199 "}" [] [] + 26: JSX_TEXT@199..202 + 0: JSX_TEXT_LITERAL@199..202 "\n " [] [] + 27: JSX_EXPRESSION_CHILD@202..208 + 0: L_CURLY@202..203 "{" [] [] + 1: JS_COMPUTED_MEMBER_EXPRESSION@203..207 + 0: JS_IDENTIFIER_EXPRESSION@203..204 + 0: JS_REFERENCE_IDENTIFIER@203..204 + 0: IDENT@203..204 "a" [] [] + 1: (empty) + 2: L_BRACK@204..205 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@205..206 + 0: JS_REFERENCE_IDENTIFIER@205..206 + 0: IDENT@205..206 "b" [] [] + 4: R_BRACK@206..207 "]" [] [] + 2: R_CURLY@207..208 "}" [] [] + 28: JSX_TEXT@208..211 + 0: JSX_TEXT_LITERAL@208..211 "\n " [] [] + 29: JSX_EXPRESSION_CHILD@211..218 + 0: L_CURLY@211..212 "{" [] [] + 1: JS_CONDITIONAL_EXPRESSION@212..217 + 0: JS_IDENTIFIER_EXPRESSION@212..213 + 0: JS_REFERENCE_IDENTIFIER@212..213 + 0: IDENT@212..213 "a" [] [] + 1: QUESTION@213..214 "?" [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@214..215 + 0: JS_NUMBER_LITERAL@214..215 "1" [] [] + 3: COLON@215..216 ":" [] [] + 4: JS_NUMBER_LITERAL_EXPRESSION@216..217 + 0: JS_NUMBER_LITERAL@216..217 "2" [] [] + 2: R_CURLY@217..218 "}" [] [] + 30: JSX_TEXT@218..221 + 0: JSX_TEXT_LITERAL@218..221 "\n " [] [] + 31: JSX_EXPRESSION_CHILD@221..238 + 0: L_CURLY@221..222 "{" [] [] + 1: JS_FUNCTION_EXPRESSION@222..237 + 0: (empty) + 1: FUNCTION_KW@222..231 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@231..232 + 0: IDENT@231..232 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@232..235 + 0: L_PAREN@232..233 "(" [] [] + 1: JS_PARAMETER_LIST@233..233 + 2: R_PAREN@233..235 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@235..237 + 0: L_CURLY@235..236 "{" [] [] + 1: JS_DIRECTIVE_LIST@236..236 + 2: JS_STATEMENT_LIST@236..236 + 3: R_CURLY@236..237 "}" [] [] + 2: R_CURLY@237..238 "}" [] [] + 32: JSX_TEXT@238..241 + 0: JSX_TEXT_LITERAL@238..241 "\n " [] [] + 33: JSX_EXPRESSION_CHILD@241..257 + 0: L_CURLY@241..242 "{" [] [] + 1: JS_FUNCTION_EXPRESSION@242..256 + 0: (empty) + 1: FUNCTION_KW@242..251 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@251..254 + 0: L_PAREN@251..252 "(" [] [] + 1: JS_PARAMETER_LIST@252..252 + 2: R_PAREN@252..254 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@254..256 + 0: L_CURLY@254..255 "{" [] [] + 1: JS_DIRECTIVE_LIST@255..255 + 2: JS_STATEMENT_LIST@255..255 + 3: R_CURLY@255..256 "}" [] [] + 2: R_CURLY@256..257 "}" [] [] + 34: JSX_TEXT@257..260 + 0: JSX_TEXT_LITERAL@257..260 "\n " [] [] + 35: JSX_EXPRESSION_CHILD@260..263 + 0: L_CURLY@260..261 "{" [] [] + 1: JS_IDENTIFIER_EXPRESSION@261..262 + 0: JS_REFERENCE_IDENTIFIER@261..262 + 0: IDENT@261..262 "a" [] [] + 2: R_CURLY@262..263 "}" [] [] + 36: JSX_TEXT@263..266 + 0: JSX_TEXT_LITERAL@263..266 "\n " [] [] + 37: JSX_EXPRESSION_CHILD@266..282 + 0: L_CURLY@266..267 "{" [] [] + 1: JS_IMPORT_CALL_EXPRESSION@267..281 + 0: IMPORT_KW@267..273 "import" [] [] + 1: JS_CALL_ARGUMENTS@273..281 + 0: L_PAREN@273..274 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@274..280 + 0: JS_STRING_LITERAL_EXPRESSION@274..280 + 0: JS_STRING_LITERAL@274..280 "\"a.js\"" [] [] + 2: R_PAREN@280..281 ")" [] [] + 2: R_CURLY@281..282 "}" [] [] + 38: JSX_TEXT@282..285 + 0: JSX_TEXT_LITERAL@282..285 "\n " [] [] + 39: JSX_EXPRESSION_CHILD@285..295 + 0: L_CURLY@285..286 "{" [] [] + 1: JS_IN_EXPRESSION@286..294 + 0: JS_IDENTIFIER_EXPRESSION@286..290 + 0: JS_REFERENCE_IDENTIFIER@286..290 + 0: IDENT@286..290 "key" [] [Whitespace(" ")] + 1: IN_KW@290..293 "in" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@293..294 + 0: JS_REFERENCE_IDENTIFIER@293..294 + 0: IDENT@293..294 "a" [] [] + 2: R_CURLY@294..295 "}" [] [] + 40: JSX_TEXT@295..298 + 0: JSX_TEXT_LITERAL@295..298 "\n " [] [] + 41: JSX_EXPRESSION_CHILD@298..319 + 0: L_CURLY@298..299 "{" [] [] + 1: JS_INSTANCEOF_EXPRESSION@299..318 + 0: JS_IDENTIFIER_EXPRESSION@299..301 + 0: JS_REFERENCE_IDENTIFIER@299..301 + 0: IDENT@299..301 "a" [] [Whitespace(" ")] + 1: INSTANCEOF_KW@301..312 "instanceof" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@312..318 + 0: JS_REFERENCE_IDENTIFIER@312..318 + 0: IDENT@312..318 "Object" [] [] + 2: R_CURLY@318..319 "}" [] [] + 42: JSX_TEXT@319..322 + 0: JSX_TEXT_LITERAL@319..322 "\n " [] [] + 43: JSX_EXPRESSION_CHILD@322..330 + 0: L_CURLY@322..323 "{" [] [] + 1: JS_LOGICAL_EXPRESSION@323..329 + 0: JS_IDENTIFIER_EXPRESSION@323..325 + 0: JS_REFERENCE_IDENTIFIER@323..325 + 0: IDENT@323..325 "a" [] [Whitespace(" ")] + 1: AMP2@325..328 "&&" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@328..329 + 0: JS_REFERENCE_IDENTIFIER@328..329 + 0: IDENT@328..329 "b" [] [] + 2: R_CURLY@329..330 "}" [] [] + 44: JSX_TEXT@330..333 + 0: JSX_TEXT_LITERAL@330..333 "\n " [] [] + 45: JSX_EXPRESSION_CHILD@333..342 + 0: L_CURLY@333..334 "{" [] [] + 1: JS_NEW_EXPRESSION@334..341 + 0: NEW_KW@334..338 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@338..339 + 0: JS_REFERENCE_IDENTIFIER@338..339 + 0: IDENT@338..339 "f" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@339..341 + 0: L_PAREN@339..340 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@340..340 + 2: R_PAREN@340..341 ")" [] [] + 2: R_CURLY@341..342 "}" [] [] + 46: JSX_TEXT@342..345 + 0: JSX_TEXT_LITERAL@342..345 "\n " [] [] + 47: JSX_EXPRESSION_CHILD@345..349 + 0: L_CURLY@345..346 "{" [] [] + 1: JS_OBJECT_EXPRESSION@346..348 + 0: L_CURLY@346..347 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@347..347 + 2: R_CURLY@347..348 "}" [] [] + 2: R_CURLY@348..349 "}" [] [] + 48: JSX_TEXT@349..352 + 0: JSX_TEXT_LITERAL@349..352 "\n " [] [] + 49: JSX_EXPRESSION_CHILD@352..357 + 0: L_CURLY@352..353 "{" [] [] + 1: JS_PARENTHESIZED_EXPRESSION@353..356 + 0: L_PAREN@353..354 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@354..355 + 0: JS_REFERENCE_IDENTIFIER@354..355 + 0: IDENT@354..355 "a" [] [] + 2: R_PAREN@355..356 ")" [] [] + 2: R_CURLY@356..357 "}" [] [] + 50: JSX_TEXT@357..360 + 0: JSX_TEXT_LITERAL@357..360 "\n " [] [] + 51: JSX_EXPRESSION_CHILD@360..365 + 0: L_CURLY@360..361 "{" [] [] + 1: JS_POST_UPDATE_EXPRESSION@361..364 + 0: JS_IDENTIFIER_ASSIGNMENT@361..362 + 0: IDENT@361..362 "a" [] [] + 1: PLUS2@362..364 "++" [] [] + 2: R_CURLY@364..365 "}" [] [] + 52: JSX_TEXT@365..368 + 0: JSX_TEXT_LITERAL@365..368 "\n " [] [] + 53: JSX_EXPRESSION_CHILD@368..373 + 0: L_CURLY@368..369 "{" [] [] + 1: JS_PRE_UPDATE_EXPRESSION@369..372 + 0: PLUS2@369..371 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@371..372 + 0: IDENT@371..372 "a" [] [] + 2: R_CURLY@372..373 "}" [] [] + 54: JSX_TEXT@373..376 + 0: JSX_TEXT_LITERAL@373..376 "\n " [] [] + 55: JSX_EXPRESSION_CHILD@376..381 + 0: L_CURLY@376..377 "{" [] [] + 1: JS_SEQUENCE_EXPRESSION@377..380 + 0: JS_IDENTIFIER_EXPRESSION@377..378 + 0: JS_REFERENCE_IDENTIFIER@377..378 + 0: IDENT@377..378 "a" [] [] + 1: COMMA@378..379 "," [] [] + 2: JS_IDENTIFIER_EXPRESSION@379..380 + 0: JS_REFERENCE_IDENTIFIER@379..380 + 0: IDENT@379..380 "b" [] [] + 2: R_CURLY@380..381 "}" [] [] + 56: JSX_TEXT@381..384 + 0: JSX_TEXT_LITERAL@381..384 "\n " [] [] + 57: JSX_EXPRESSION_CHILD@384..389 + 0: L_CURLY@384..385 "{" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@385..388 + 0: JS_IDENTIFIER_EXPRESSION@385..386 + 0: JS_REFERENCE_IDENTIFIER@385..386 + 0: IDENT@385..386 "a" [] [] + 1: DOT@386..387 "." [] [] + 2: JS_NAME@387..388 + 0: IDENT@387..388 "b" [] [] + 2: R_CURLY@388..389 "}" [] [] + 58: JSX_TEXT@389..392 + 0: JSX_TEXT_LITERAL@389..392 "\n " [] [] + 59: JSX_EXPRESSION_CHILD@392..403 + 0: L_CURLY@392..393 "{" [] [] + 1: JS_CALL_EXPRESSION@393..402 + 0: JS_STATIC_MEMBER_EXPRESSION@393..400 + 0: JS_SUPER_EXPRESSION@393..398 + 0: SUPER_KW@393..398 "super" [] [] + 1: DOT@398..399 "." [] [] + 2: JS_NAME@399..400 + 0: IDENT@399..400 "a" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@400..402 + 0: L_PAREN@400..401 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@401..401 + 2: R_PAREN@401..402 ")" [] [] + 2: R_CURLY@402..403 "}" [] [] + 60: JSX_TEXT@403..406 + 0: JSX_TEXT_LITERAL@403..406 "\n " [] [] + 61: JSX_EXPRESSION_CHILD@406..412 + 0: L_CURLY@406..407 "{" [] [] + 1: JS_THIS_EXPRESSION@407..411 + 0: THIS_KW@407..411 "this" [] [] + 2: R_CURLY@411..412 "}" [] [] + 62: JSX_TEXT@412..415 + 0: JSX_TEXT_LITERAL@412..415 "\n " [] [] + 63: JSX_EXPRESSION_CHILD@415..427 + 0: L_CURLY@415..416 "{" [] [] + 1: JS_UNARY_EXPRESSION@416..426 + 0: DELETE_KW@416..423 "delete" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@423..426 + 0: JS_IDENTIFIER_EXPRESSION@423..424 + 0: JS_REFERENCE_IDENTIFIER@423..424 + 0: IDENT@423..424 "a" [] [] + 1: DOT@424..425 "." [] [] + 2: JS_NAME@425..426 + 0: IDENT@425..426 "a" [] [] + 2: R_CURLY@426..427 "}" [] [] + 64: JSX_TEXT@427..430 + 0: JSX_TEXT_LITERAL@427..430 "\n " [] [] + 65: JSX_EXPRESSION_CHILD@430..438 + 0: L_CURLY@430..431 "{" [] [] + 1: JS_UNARY_EXPRESSION@431..437 + 0: VOID_KW@431..436 "void" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@436..437 + 0: JS_REFERENCE_IDENTIFIER@436..437 + 0: IDENT@436..437 "a" [] [] + 2: R_CURLY@437..438 "}" [] [] + 66: JSX_TEXT@438..441 + 0: JSX_TEXT_LITERAL@438..441 "\n " [] [] + 67: JSX_EXPRESSION_CHILD@441..451 + 0: L_CURLY@441..442 "{" [] [] + 1: JS_UNARY_EXPRESSION@442..450 + 0: TYPEOF_KW@442..449 "typeof" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@449..450 + 0: JS_REFERENCE_IDENTIFIER@449..450 + 0: IDENT@449..450 "a" [] [] + 2: R_CURLY@450..451 "}" [] [] + 68: JSX_TEXT@451..454 + 0: JSX_TEXT_LITERAL@451..454 "\n " [] [] + 69: JSX_EXPRESSION_CHILD@454..458 + 0: L_CURLY@454..455 "{" [] [] + 1: JS_UNARY_EXPRESSION@455..457 + 0: PLUS@455..456 "+" [] [] + 1: JS_IDENTIFIER_EXPRESSION@456..457 + 0: JS_REFERENCE_IDENTIFIER@456..457 + 0: IDENT@456..457 "a" [] [] + 2: R_CURLY@457..458 "}" [] [] + 70: JSX_TEXT@458..461 + 0: JSX_TEXT_LITERAL@458..461 "\n " [] [] + 71: JSX_EXPRESSION_CHILD@461..465 + 0: L_CURLY@461..462 "{" [] [] + 1: JS_UNARY_EXPRESSION@462..464 + 0: MINUS@462..463 "-" [] [] + 1: JS_IDENTIFIER_EXPRESSION@463..464 + 0: JS_REFERENCE_IDENTIFIER@463..464 + 0: IDENT@463..464 "a" [] [] + 2: R_CURLY@464..465 "}" [] [] + 72: JSX_TEXT@465..468 + 0: JSX_TEXT_LITERAL@465..468 "\n " [] [] + 73: JSX_EXPRESSION_CHILD@468..472 + 0: L_CURLY@468..469 "{" [] [] + 1: JS_UNARY_EXPRESSION@469..471 + 0: BANG@469..470 "!" [] [] + 1: JS_IDENTIFIER_EXPRESSION@470..471 + 0: JS_REFERENCE_IDENTIFIER@470..471 + 0: IDENT@470..471 "a" [] [] + 2: R_CURLY@471..472 "}" [] [] + 74: JSX_TEXT@472..475 + 0: JSX_TEXT_LITERAL@472..475 "\n " [] [] + 75: JSX_EXPRESSION_CHILD@475..479 + 0: L_CURLY@475..476 "{" [] [] + 1: JS_UNARY_EXPRESSION@476..478 + 0: TILDE@476..477 "~" [] [] + 1: JS_IDENTIFIER_EXPRESSION@477..478 + 0: JS_REFERENCE_IDENTIFIER@477..478 + 0: IDENT@477..478 "a" [] [] + 2: R_CURLY@478..479 "}" [] [] + 76: JSX_TEXT@479..482 + 0: JSX_TEXT_LITERAL@479..482 "\n " [] [] + 77: JSX_EXPRESSION_CHILD@482..486 + 0: L_CURLY@482..483 "{" [] [] + 1: JS_TEMPLATE_EXPRESSION@483..485 + 0: (empty) + 1: (empty) + 2: BACKTICK@483..484 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@484..484 + 4: BACKTICK@484..485 "`" [] [] + 2: R_CURLY@485..486 "}" [] [] + 78: JSX_TEXT@486..489 + 0: JSX_TEXT_LITERAL@486..489 "\n " [] [] + 79: JSX_EXPRESSION_CHILD@489..510 + 0: L_CURLY@489..509 "{" [] [Comments("/* A JSX comment */")] + 1: (empty) + 2: R_CURLY@509..510 "}" [] [] + 80: JSX_TEXT@510..513 + 0: JSX_TEXT_LITERAL@510..513 "\n " [] [] + 81: JSX_EXPRESSION_CHILD@513..539 + 0: L_CURLY@513..538 "{" [] [Comments("/* Multi\n line\n */")] + 1: (empty) + 2: R_CURLY@538..539 "}" [] [] + 82: JSX_TEXT@539..542 + 0: JSX_TEXT_LITERAL@539..542 "\n " [] [] + 83: JSX_EXPRESSION_CHILD@542..544 + 0: L_CURLY@542..543 "{" [] [] + 1: (empty) + 2: R_CURLY@543..544 "}" [] [] + 84: JSX_TEXT@544..545 + 0: JSX_TEXT_LITERAL@544..545 "\n" [] [] + 2: JSX_CLOSING_ELEMENT@545..551 + 0: L_ANGLE@545..546 "<" [] [] + 1: SLASH@546..547 "/" [] [] + 2: JSX_NAME@547..550 + 0: JSX_IDENT@547..550 "div" [] [] + 3: R_ANGLE@550..551 ">" [] [] + 1: (empty) + 6: JS_FUNCTION_DECLARATION@551..616 + 0: (empty) + 1: FUNCTION_KW@551..561 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@561..562 "*" [] [] + 3: JS_IDENTIFIER_BINDING@562..563 + 0: IDENT@562..563 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@563..566 + 0: L_PAREN@563..564 "(" [] [] + 1: JS_PARAMETER_LIST@564..564 + 2: R_PAREN@564..566 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@566..616 + 0: L_CURLY@566..567 "{" [] [] + 1: JS_DIRECTIVE_LIST@567..567 + 2: JS_STATEMENT_LIST@567..614 + 0: JS_RETURN_STATEMENT@567..614 + 0: RETURN_KW@567..579 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@579..613 + 0: JSX_ELEMENT@579..613 + 0: JSX_OPENING_ELEMENT@579..584 + 0: L_ANGLE@579..580 "<" [] [] + 1: JSX_NAME@580..583 + 0: JSX_IDENT@580..583 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@583..583 + 4: R_ANGLE@583..584 ">" [] [] + 1: JSX_CHILD_LIST@584..607 + 0: JSX_TEXT@584..593 + 0: JSX_TEXT_LITERAL@584..593 "\n " [] [] + 1: JSX_EXPRESSION_CHILD@593..602 + 0: L_CURLY@593..594 "{" [] [] + 1: JS_YIELD_EXPRESSION@594..601 + 0: YIELD_KW@594..600 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@600..601 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@600..601 + 0: JS_REFERENCE_IDENTIFIER@600..601 + 0: IDENT@600..601 "a" [] [] + 2: R_CURLY@601..602 "}" [] [] + 2: JSX_TEXT@602..607 + 0: JSX_TEXT_LITERAL@602..607 "\n " [] [] + 2: JSX_CLOSING_ELEMENT@607..613 + 0: L_ANGLE@607..608 "<" [] [] + 1: SLASH@608..609 "/" [] [] + 2: JSX_NAME@609..612 + 0: JSX_IDENT@609..612 "div" [] [] + 3: R_ANGLE@612..613 ">" [] [] + 2: SEMICOLON@613..614 ";" [] [] + 3: R_CURLY@614..616 "}" [Newline("\n")] [] + 4: EOF@616..617 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap new file mode 100644 index 000000000000..7f7131d6fe36 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap @@ -0,0 +1,103 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + + {/* comment */} + some + text + + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@6..11 "\n " [] [], + }, + JsxExpressionChild { + l_curly_token: L_CURLY@11..25 "{" [] [Comments("/* comment */")], + expression: missing (optional), + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@26..47 "\n some\n text\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@47..48 "<" [] [], + slash_token: SLASH@48..49 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@49..53 "test" [] [], + }, + r_angle_token: R_ANGLE@53..54 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_EXPRESSION_STATEMENT@0..54 + 0: JSX_TAG_EXPRESSION@0..54 + 0: JSX_ELEMENT@0..54 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..47 + 0: JSX_TEXT@6..11 + 0: JSX_TEXT_LITERAL@6..11 "\n " [] [] + 1: JSX_EXPRESSION_CHILD@11..26 + 0: L_CURLY@11..25 "{" [] [Comments("/* comment */")] + 1: (empty) + 2: R_CURLY@25..26 "}" [] [] + 2: JSX_TEXT@26..47 + 0: JSX_TEXT_LITERAL@26..47 "\n some\n text\n" [] [] + 2: JSX_CLOSING_ELEMENT@47..54 + 0: L_ANGLE@47..48 "<" [] [] + 1: SLASH@48..49 "/" [] [] + 2: JSX_NAME@49..53 + 0: JSX_IDENT@49..53 "test" [] [] + 3: R_ANGLE@53..54 ">" [] [] + 1: (empty) + 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx.snap new file mode 100644 index 000000000000..c02bc62481a6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx.snap @@ -0,0 +1,164 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
{...a}
; +
{...a}After
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..4 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@4..5 ">" [] [], + }, + children: JsxChildList [ + JsxSpreadChild { + l_curly_token: L_CURLY@5..6 "{" [] [], + dotdotdot_token: DOT3@6..9 "..." [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..10 "a" [] [], + }, + }, + r_curly_token: R_CURLY@10..11 "}" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@11..12 "<" [] [], + slash_token: SLASH@12..13 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@13..16 "div" [] [], + }, + r_angle_token: R_ANGLE@16..17 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@18..20 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@20..23 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@23..24 ">" [] [], + }, + children: JsxChildList [ + JsxSpreadChild { + l_curly_token: L_CURLY@24..25 "{" [] [], + dotdotdot_token: DOT3@25..28 "..." [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..29 "a" [] [], + }, + }, + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + JsxText { + value_token: JSX_TEXT_LITERAL@30..35 "After" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@35..36 "<" [] [], + slash_token: SLASH@36..37 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@37..40 "div" [] [], + }, + r_angle_token: R_ANGLE@40..41 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + ], + eof_token: EOF@42..43 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..43 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..42 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JSX_TAG_EXPRESSION@0..17 + 0: JSX_ELEMENT@0..17 + 0: JSX_OPENING_ELEMENT@0..5 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..4 + 0: JSX_IDENT@1..4 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@4..4 + 4: R_ANGLE@4..5 ">" [] [] + 1: JSX_CHILD_LIST@5..11 + 0: JSX_SPREAD_CHILD@5..11 + 0: L_CURLY@5..6 "{" [] [] + 1: DOT3@6..9 "..." [] [] + 2: JS_IDENTIFIER_EXPRESSION@9..10 + 0: JS_REFERENCE_IDENTIFIER@9..10 + 0: IDENT@9..10 "a" [] [] + 3: R_CURLY@10..11 "}" [] [] + 2: JSX_CLOSING_ELEMENT@11..17 + 0: L_ANGLE@11..12 "<" [] [] + 1: SLASH@12..13 "/" [] [] + 2: JSX_NAME@13..16 + 0: JSX_IDENT@13..16 "div" [] [] + 3: R_ANGLE@16..17 ">" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@18..42 + 0: JSX_TAG_EXPRESSION@18..41 + 0: JSX_ELEMENT@18..41 + 0: JSX_OPENING_ELEMENT@18..24 + 0: L_ANGLE@18..20 "<" [Newline("\n")] [] + 1: JSX_NAME@20..23 + 0: JSX_IDENT@20..23 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@23..23 + 4: R_ANGLE@23..24 ">" [] [] + 1: JSX_CHILD_LIST@24..35 + 0: JSX_SPREAD_CHILD@24..30 + 0: L_CURLY@24..25 "{" [] [] + 1: DOT3@25..28 "..." [] [] + 2: JS_IDENTIFIER_EXPRESSION@28..29 + 0: JS_REFERENCE_IDENTIFIER@28..29 + 0: IDENT@28..29 "a" [] [] + 3: R_CURLY@29..30 "}" [] [] + 1: JSX_TEXT@30..35 + 0: JSX_TEXT_LITERAL@30..35 "After" [] [] + 2: JSX_CLOSING_ELEMENT@35..41 + 0: L_ANGLE@35..36 "<" [] [] + 1: SLASH@36..37 "/" [] [] + 2: JSX_NAME@37..40 + 0: JSX_IDENT@37..40 "div" [] [] + 3: R_ANGLE@40..41 ">" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 4: EOF@42..43 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap new file mode 100644 index 000000000000..13641c8d94f7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap @@ -0,0 +1,107 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +< +/* some comment */ / open>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..9 "closing" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@9..30 "/" [] [Whitespace(" "), Comments("/* some comment */"), Whitespace(" ")], + r_angle_token: R_ANGLE@30..31 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@32..34 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@34..38 "open" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@38..39 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@39..40 "<" [] [], + slash_token: SLASH@40..62 "/" [Newline("\n"), Comments("/* some comment */"), Whitespace(" ")] [Whitespace(" ")], + name: JsxName { + value_token: JSX_IDENT@62..66 "open" [] [], + }, + r_angle_token: R_ANGLE@66..67 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@67..68 ";" [] [], + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..68 + 0: JS_EXPRESSION_STATEMENT@0..32 + 0: JSX_TAG_EXPRESSION@0..31 + 0: JSX_SELF_CLOSING_ELEMENT@0..31 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..9 + 0: JSX_IDENT@1..9 "closing" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@9..9 + 4: SLASH@9..30 "/" [] [Whitespace(" "), Comments("/* some comment */"), Whitespace(" ")] + 5: R_ANGLE@30..31 ">" [] [] + 1: SEMICOLON@31..32 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@32..68 + 0: JSX_TAG_EXPRESSION@32..67 + 0: JSX_ELEMENT@32..67 + 0: JSX_OPENING_ELEMENT@32..39 + 0: L_ANGLE@32..34 "<" [Newline("\n")] [] + 1: JSX_NAME@34..38 + 0: JSX_IDENT@34..38 "open" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@38..38 + 4: R_ANGLE@38..39 ">" [] [] + 1: JSX_CHILD_LIST@39..39 + 2: JSX_CLOSING_ELEMENT@39..67 + 0: L_ANGLE@39..40 "<" [] [] + 1: SLASH@40..62 "/" [Newline("\n"), Comments("/* some comment */"), Whitespace(" ")] [Whitespace(" ")] + 2: JSX_NAME@62..66 + 0: JSX_IDENT@62..66 "open" [] [] + 3: R_ANGLE@66..67 ">" [] [] + 1: SEMICOLON@67..68 ";" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap new file mode 100644 index 000000000000..cbac11c01793 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap @@ -0,0 +1,62 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
+ +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@5..6 "/" [] [], + r_angle_token: R_ANGLE@6..7 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@7..8 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..8 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..7 + 0: JS_EXPRESSION_STATEMENT@0..7 + 0: JSX_TAG_EXPRESSION@0..7 + 0: JSX_SELF_CLOSING_ELEMENT@0..7 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: SLASH@5..6 "/" [] [] + 5: R_ANGLE@6..7 ">" [] [] + 1: (empty) + 4: EOF@7..8 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap new file mode 100644 index 000000000000..30bbb183949e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap @@ -0,0 +1,94 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
/>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@5..7 "id" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@7..8 "=" [] [], + value: JsxSelfClosingElement { + l_angle_token: L_ANGLE@8..9 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@9..10 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@10..11 "/" [] [], + r_angle_token: R_ANGLE@11..13 ">" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@13..14 "/" [] [], + r_angle_token: R_ANGLE@14..15 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + ], + eof_token: EOF@16..17 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..17 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..16 + 0: JS_EXPRESSION_STATEMENT@0..16 + 0: JSX_TAG_EXPRESSION@0..15 + 0: JSX_SELF_CLOSING_ELEMENT@0..15 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..13 + 0: JSX_ATTRIBUTE@5..13 + 0: JSX_NAME@5..7 + 0: JSX_IDENT@5..7 "id" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@7..13 + 0: EQ@7..8 "=" [] [] + 1: JSX_SELF_CLOSING_ELEMENT@8..13 + 0: L_ANGLE@8..9 "<" [] [] + 1: JSX_NAME@9..10 + 0: JSX_IDENT@9..10 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@10..10 + 4: SLASH@10..11 "/" [] [] + 5: R_ANGLE@11..13 ">" [] [Whitespace(" ")] + 4: SLASH@13..14 "/" [] [] + 5: R_ANGLE@14..15 ">" [] [] + 1: SEMICOLON@15..16 ";" [] [] + 4: EOF@16..17 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap new file mode 100644 index 000000000000..fd9493139164 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap @@ -0,0 +1,161 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
; +
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@5..7 "id" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@7..8 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@8..9 "{" [] [], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@9..10 "1" [] [], + }, + r_curly_token: R_CURLY@10..12 "}" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@12..13 "/" [] [], + r_angle_token: R_ANGLE@13..14 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@15..17 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@17..21 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@21..30 "className" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@30..31 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@31..32 "{" [] [], + expression: JsTemplateExpression { + tag: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..38 "prefix" [] [], + }, + }, + type_arguments: missing (optional), + l_tick_token: BACKTICK@38..39 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@39..43 "none" [] [], + }, + ], + r_tick_token: BACKTICK@43..44 "`" [] [], + }, + r_curly_token: R_CURLY@44..46 "}" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@46..47 "/" [] [], + r_angle_token: R_ANGLE@47..48 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@48..49 ";" [] [], + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JSX_TAG_EXPRESSION@0..14 + 0: JSX_SELF_CLOSING_ELEMENT@0..14 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..12 + 0: JSX_ATTRIBUTE@5..12 + 0: JSX_NAME@5..7 + 0: JSX_IDENT@5..7 "id" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@7..12 + 0: EQ@7..8 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@8..12 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@9..10 + 0: JS_NUMBER_LITERAL@9..10 "1" [] [] + 2: R_CURLY@10..12 "}" [] [Whitespace(" ")] + 4: SLASH@12..13 "/" [] [] + 5: R_ANGLE@13..14 ">" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@15..49 + 0: JSX_TAG_EXPRESSION@15..48 + 0: JSX_SELF_CLOSING_ELEMENT@15..48 + 0: L_ANGLE@15..17 "<" [Newline("\n")] [] + 1: JSX_NAME@17..21 + 0: JSX_IDENT@17..21 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@21..46 + 0: JSX_ATTRIBUTE@21..46 + 0: JSX_NAME@21..30 + 0: JSX_IDENT@21..30 "className" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@30..46 + 0: EQ@30..31 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@31..46 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_TEMPLATE_EXPRESSION@32..44 + 0: JS_IDENTIFIER_EXPRESSION@32..38 + 0: JS_REFERENCE_IDENTIFIER@32..38 + 0: IDENT@32..38 "prefix" [] [] + 1: (empty) + 2: BACKTICK@38..39 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@39..43 + 0: JS_TEMPLATE_CHUNK_ELEMENT@39..43 + 0: TEMPLATE_CHUNK@39..43 "none" [] [] + 4: BACKTICK@43..44 "`" [] [] + 2: R_CURLY@44..46 "}" [] [Whitespace(" ")] + 4: SLASH@46..47 "/" [] [] + 5: R_ANGLE@47..48 ">" [] [] + 1: SEMICOLON@48..49 ";" [] [] + 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap new file mode 100644 index 000000000000..12cba165505d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap @@ -0,0 +1,81 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@5..7 "id" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@7..8 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@8..12 "\"a\"" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@12..13 "/" [] [], + r_angle_token: R_ANGLE@13..14 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + ], + eof_token: EOF@15..16 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..16 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..15 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JSX_TAG_EXPRESSION@0..14 + 0: JSX_SELF_CLOSING_ELEMENT@0..14 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..12 + 0: JSX_ATTRIBUTE@5..12 + 0: JSX_NAME@5..7 + 0: JSX_IDENT@5..7 "id" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@7..12 + 0: EQ@7..8 "=" [] [] + 1: JSX_STRING@8..12 + 0: JSX_STRING_LITERAL@8..12 "\"a\"" [] [Whitespace(" ")] + 4: SLASH@12..13 "/" [] [] + 5: R_ANGLE@13..14 ">" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 4: EOF@15..16 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx.snap new file mode 100644 index 000000000000..4225ee9699b2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx.snap @@ -0,0 +1,430 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
>
; +} +
; +
; +
; +
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@26..27 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@27..31 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@31..45 "string_literal" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@45..46 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@46..50 "\"a\"" [] [Whitespace(" ")], + }, + }, + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@50..60 "expression" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@60..61 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@61..62 "{" [] [], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@62..63 "1" [] [], + }, + r_curly_token: R_CURLY@63..65 "}" [] [Whitespace(" ")], + }, + }, + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@65..73 "novalue" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@73..75 "el" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@75..76 "=" [] [], + value: JsxSelfClosingElement { + l_angle_token: L_ANGLE@76..77 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@77..78 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@78..79 "/" [] [], + r_angle_token: R_ANGLE@79..80 ">" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@80..81 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@81..82 "<" [] [], + slash_token: SLASH@82..83 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@83..86 "div" [] [], + }, + r_angle_token: R_ANGLE@86..87 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@87..88 ";" [] [], + }, + ], + r_curly_token: R_CURLY@88..90 "}" [Newline("\n")] [], + }, + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@90..92 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@92..96 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@96..107 "dashed-name" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@107..108 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@108..115 "'test'" [] [Whitespace(" ")], + }, + }, + }, + JsxAttribute { + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@115..118 "use" [] [], + }, + colon_token: COLON@118..119 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@119..127 "validate" [] [], + }, + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@127..128 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@128..135 "\"abcd\"" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@135..136 "/" [] [], + r_angle_token: R_ANGLE@136..137 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@137..138 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@138..140 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@140..144 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxNamespaceName { + namespace: JsxName { + value_token: JSX_IDENT@144..165 "use-dashed_underscore" [] [], + }, + colon_token: COLON@165..166 ":" [] [], + name: JsxName { + value_token: JSX_IDENT@166..174 "validate" [] [], + }, + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@174..175 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@175..183 "\"ahaha\"" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@183..184 "/" [] [], + r_angle_token: R_ANGLE@184..185 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@185..186 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@186..188 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@188..192 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@192..208 "multiline-string" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@208..209 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@209..233 "'test\n continues here'" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@233..234 "/" [] [], + r_angle_token: R_ANGLE@234..235 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@235..236 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@236..238 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@238..242 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@242..264 "invalid-unicode-escape" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@264..265 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@265..282 "\"\\u10000\\u20000\"" [] [Whitespace(" ")], + }, + }, + }, + ], + slash_token: SLASH@282..283 "/" [] [], + r_angle_token: R_ANGLE@283..284 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@284..285 ";" [] [], + }, + ], + eof_token: EOF@285..286 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..286 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..285 + 0: JS_FUNCTION_DECLARATION@0..90 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@13..90 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..88 + 0: JS_RETURN_STATEMENT@14..88 + 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@26..87 + 0: JSX_ELEMENT@26..87 + 0: JSX_OPENING_ELEMENT@26..81 + 0: L_ANGLE@26..27 "<" [] [] + 1: JSX_NAME@27..31 + 0: JSX_IDENT@27..31 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@31..80 + 0: JSX_ATTRIBUTE@31..50 + 0: JSX_NAME@31..45 + 0: JSX_IDENT@31..45 "string_literal" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@45..50 + 0: EQ@45..46 "=" [] [] + 1: JSX_STRING@46..50 + 0: JSX_STRING_LITERAL@46..50 "\"a\"" [] [Whitespace(" ")] + 1: JSX_ATTRIBUTE@50..65 + 0: JSX_NAME@50..60 + 0: JSX_IDENT@50..60 "expression" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@60..65 + 0: EQ@60..61 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@61..65 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@62..63 + 0: JS_NUMBER_LITERAL@62..63 "1" [] [] + 2: R_CURLY@63..65 "}" [] [Whitespace(" ")] + 2: JSX_ATTRIBUTE@65..73 + 0: JSX_NAME@65..73 + 0: JSX_IDENT@65..73 "novalue" [] [Whitespace(" ")] + 1: (empty) + 3: JSX_ATTRIBUTE@73..80 + 0: JSX_NAME@73..75 + 0: JSX_IDENT@73..75 "el" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@75..80 + 0: EQ@75..76 "=" [] [] + 1: JSX_SELF_CLOSING_ELEMENT@76..80 + 0: L_ANGLE@76..77 "<" [] [] + 1: JSX_NAME@77..78 + 0: JSX_IDENT@77..78 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@78..78 + 4: SLASH@78..79 "/" [] [] + 5: R_ANGLE@79..80 ">" [] [] + 4: R_ANGLE@80..81 ">" [] [] + 1: JSX_CHILD_LIST@81..81 + 2: JSX_CLOSING_ELEMENT@81..87 + 0: L_ANGLE@81..82 "<" [] [] + 1: SLASH@82..83 "/" [] [] + 2: JSX_NAME@83..86 + 0: JSX_IDENT@83..86 "div" [] [] + 3: R_ANGLE@86..87 ">" [] [] + 2: SEMICOLON@87..88 ";" [] [] + 3: R_CURLY@88..90 "}" [Newline("\n")] [] + 1: JS_EXPRESSION_STATEMENT@90..138 + 0: JSX_TAG_EXPRESSION@90..137 + 0: JSX_SELF_CLOSING_ELEMENT@90..137 + 0: L_ANGLE@90..92 "<" [Newline("\n")] [] + 1: JSX_NAME@92..96 + 0: JSX_IDENT@92..96 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@96..135 + 0: JSX_ATTRIBUTE@96..115 + 0: JSX_NAME@96..107 + 0: JSX_IDENT@96..107 "dashed-name" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@107..115 + 0: EQ@107..108 "=" [] [] + 1: JSX_STRING@108..115 + 0: JSX_STRING_LITERAL@108..115 "'test'" [] [Whitespace(" ")] + 1: JSX_ATTRIBUTE@115..135 + 0: JSX_NAMESPACE_NAME@115..127 + 0: JSX_NAME@115..118 + 0: JSX_IDENT@115..118 "use" [] [] + 1: COLON@118..119 ":" [] [] + 2: JSX_NAME@119..127 + 0: JSX_IDENT@119..127 "validate" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@127..135 + 0: EQ@127..128 "=" [] [] + 1: JSX_STRING@128..135 + 0: JSX_STRING_LITERAL@128..135 "\"abcd\"" [] [Whitespace(" ")] + 4: SLASH@135..136 "/" [] [] + 5: R_ANGLE@136..137 ">" [] [] + 1: SEMICOLON@137..138 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@138..186 + 0: JSX_TAG_EXPRESSION@138..185 + 0: JSX_SELF_CLOSING_ELEMENT@138..185 + 0: L_ANGLE@138..140 "<" [Newline("\n")] [] + 1: JSX_NAME@140..144 + 0: JSX_IDENT@140..144 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@144..183 + 0: JSX_ATTRIBUTE@144..183 + 0: JSX_NAMESPACE_NAME@144..174 + 0: JSX_NAME@144..165 + 0: JSX_IDENT@144..165 "use-dashed_underscore" [] [] + 1: COLON@165..166 ":" [] [] + 2: JSX_NAME@166..174 + 0: JSX_IDENT@166..174 "validate" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@174..183 + 0: EQ@174..175 "=" [] [] + 1: JSX_STRING@175..183 + 0: JSX_STRING_LITERAL@175..183 "\"ahaha\"" [] [Whitespace(" ")] + 4: SLASH@183..184 "/" [] [] + 5: R_ANGLE@184..185 ">" [] [] + 1: SEMICOLON@185..186 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@186..236 + 0: JSX_TAG_EXPRESSION@186..235 + 0: JSX_SELF_CLOSING_ELEMENT@186..235 + 0: L_ANGLE@186..188 "<" [Newline("\n")] [] + 1: JSX_NAME@188..192 + 0: JSX_IDENT@188..192 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@192..233 + 0: JSX_ATTRIBUTE@192..233 + 0: JSX_NAME@192..208 + 0: JSX_IDENT@192..208 "multiline-string" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@208..233 + 0: EQ@208..209 "=" [] [] + 1: JSX_STRING@209..233 + 0: JSX_STRING_LITERAL@209..233 "'test\n continues here'" [] [Whitespace(" ")] + 4: SLASH@233..234 "/" [] [] + 5: R_ANGLE@234..235 ">" [] [] + 1: SEMICOLON@235..236 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@236..285 + 0: JSX_TAG_EXPRESSION@236..284 + 0: JSX_SELF_CLOSING_ELEMENT@236..284 + 0: L_ANGLE@236..238 "<" [Newline("\n")] [] + 1: JSX_NAME@238..242 + 0: JSX_IDENT@238..242 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@242..282 + 0: JSX_ATTRIBUTE@242..282 + 0: JSX_NAME@242..264 + 0: JSX_IDENT@242..264 "invalid-unicode-escape" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@264..282 + 0: EQ@264..265 "=" [] [] + 1: JSX_STRING@265..282 + 0: JSX_STRING_LITERAL@265..282 "\"\\u10000\\u20000\"" [] [Whitespace(" ")] + 4: SLASH@282..283 "/" [] [] + 5: R_ANGLE@283..284 ">" [] [] + 1: SEMICOLON@284..285 ";" [] [] + 4: EOF@285..286 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_children.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx.snap new file mode 100644 index 000000000000..0f1bc8e08c12 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx.snap @@ -0,0 +1,257 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + + + + + + + + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..2 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@2..3 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@3..8 "\n " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@8..9 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@9..10 "b" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@11..19 "\n " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@19..20 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@20..21 "d" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@21..22 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@22..23 "<" [] [], + slash_token: SLASH@23..24 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@24..25 "d" [] [], + }, + r_angle_token: R_ANGLE@25..26 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@26..34 "\n " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@34..35 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@35..36 "e" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@37..38 "<" [] [], + slash_token: SLASH@38..39 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@39..40 "e" [] [], + }, + r_angle_token: R_ANGLE@40..41 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@41..46 "\n " [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@46..47 "<" [] [], + slash_token: SLASH@47..48 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@48..49 "b" [] [], + }, + r_angle_token: R_ANGLE@49..50 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@50..55 "\n " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@55..56 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@56..57 "c" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@57..58 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@58..59 "<" [] [], + slash_token: SLASH@59..60 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@60..61 "c" [] [], + }, + r_angle_token: R_ANGLE@61..62 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@62..63 "\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@63..64 "<" [] [], + slash_token: SLASH@64..65 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@65..66 "a" [] [], + }, + r_angle_token: R_ANGLE@66..67 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: JS_EXPRESSION_STATEMENT@0..67 + 0: JSX_TAG_EXPRESSION@0..67 + 0: JSX_ELEMENT@0..67 + 0: JSX_OPENING_ELEMENT@0..3 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..2 + 0: JSX_IDENT@1..2 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@2..2 + 4: R_ANGLE@2..3 ">" [] [] + 1: JSX_CHILD_LIST@3..63 + 0: JSX_TEXT@3..8 + 0: JSX_TEXT_LITERAL@3..8 "\n " [] [] + 1: JSX_ELEMENT@8..50 + 0: JSX_OPENING_ELEMENT@8..11 + 0: L_ANGLE@8..9 "<" [] [] + 1: JSX_NAME@9..10 + 0: JSX_IDENT@9..10 "b" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@10..10 + 4: R_ANGLE@10..11 ">" [] [] + 1: JSX_CHILD_LIST@11..46 + 0: JSX_TEXT@11..19 + 0: JSX_TEXT_LITERAL@11..19 "\n " [] [] + 1: JSX_ELEMENT@19..26 + 0: JSX_OPENING_ELEMENT@19..22 + 0: L_ANGLE@19..20 "<" [] [] + 1: JSX_NAME@20..21 + 0: JSX_IDENT@20..21 "d" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@21..21 + 4: R_ANGLE@21..22 ">" [] [] + 1: JSX_CHILD_LIST@22..22 + 2: JSX_CLOSING_ELEMENT@22..26 + 0: L_ANGLE@22..23 "<" [] [] + 1: SLASH@23..24 "/" [] [] + 2: JSX_NAME@24..25 + 0: JSX_IDENT@24..25 "d" [] [] + 3: R_ANGLE@25..26 ">" [] [] + 2: JSX_TEXT@26..34 + 0: JSX_TEXT_LITERAL@26..34 "\n " [] [] + 3: JSX_ELEMENT@34..41 + 0: JSX_OPENING_ELEMENT@34..37 + 0: L_ANGLE@34..35 "<" [] [] + 1: JSX_NAME@35..36 + 0: JSX_IDENT@35..36 "e" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@36..36 + 4: R_ANGLE@36..37 ">" [] [] + 1: JSX_CHILD_LIST@37..37 + 2: JSX_CLOSING_ELEMENT@37..41 + 0: L_ANGLE@37..38 "<" [] [] + 1: SLASH@38..39 "/" [] [] + 2: JSX_NAME@39..40 + 0: JSX_IDENT@39..40 "e" [] [] + 3: R_ANGLE@40..41 ">" [] [] + 4: JSX_TEXT@41..46 + 0: JSX_TEXT_LITERAL@41..46 "\n " [] [] + 2: JSX_CLOSING_ELEMENT@46..50 + 0: L_ANGLE@46..47 "<" [] [] + 1: SLASH@47..48 "/" [] [] + 2: JSX_NAME@48..49 + 0: JSX_IDENT@48..49 "b" [] [] + 3: R_ANGLE@49..50 ">" [] [] + 2: JSX_TEXT@50..55 + 0: JSX_TEXT_LITERAL@50..55 "\n " [] [] + 3: JSX_ELEMENT@55..62 + 0: JSX_OPENING_ELEMENT@55..58 + 0: L_ANGLE@55..56 "<" [] [] + 1: JSX_NAME@56..57 + 0: JSX_IDENT@56..57 "c" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@57..57 + 4: R_ANGLE@57..58 ">" [] [] + 1: JSX_CHILD_LIST@58..58 + 2: JSX_CLOSING_ELEMENT@58..62 + 0: L_ANGLE@58..59 "<" [] [] + 1: SLASH@59..60 "/" [] [] + 2: JSX_NAME@60..61 + 0: JSX_IDENT@60..61 "c" [] [] + 3: R_ANGLE@61..62 ">" [] [] + 4: JSX_TEXT@62..63 + 0: JSX_TEXT_LITERAL@62..63 "\n" [] [] + 2: JSX_CLOSING_ELEMENT@63..67 + 0: L_ANGLE@63..64 "<" [] [] + 1: SLASH@64..65 "/" [] [] + 2: JSX_NAME@65..66 + 0: JSX_IDENT@65..66 "a" [] [] + 3: R_ANGLE@66..67 ">" [] [] + 1: (empty) + 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap new file mode 100644 index 000000000000..15fc1bd113d4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap @@ -0,0 +1,220 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const f = () =>
; +const f = () => (
); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..8 "f" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], + body: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@16..17 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@17..20 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@20..21 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@21..22 "<" [] [], + slash_token: SLASH@22..23 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@23..26 "div" [] [], + }, + r_angle_token: R_ANGLE@26..27 ">" [] [], + }, + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@35..37 "f" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@37..39 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@39..40 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")], + body: JsParenthesizedExpression { + l_paren_token: L_PAREN@45..46 "(" [] [], + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@46..47 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@47..50 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@50..51 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@51..52 "<" [] [], + slash_token: SLASH@52..53 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@53..56 "div" [] [], + }, + r_angle_token: R_ANGLE@56..57 ">" [] [], + }, + }, + }, + r_paren_token: R_PAREN@57..58 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + ], + eof_token: EOF@59..60 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..60 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..59 + 0: JS_VARIABLE_STATEMENT@0..28 + 0: JS_VARIABLE_DECLARATION@0..27 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..27 + 0: JS_VARIABLE_DECLARATOR@6..27 + 0: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "f" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..27 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@10..27 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] + 5: JSX_TAG_EXPRESSION@16..27 + 0: JSX_ELEMENT@16..27 + 0: JSX_OPENING_ELEMENT@16..21 + 0: L_ANGLE@16..17 "<" [] [] + 1: JSX_NAME@17..20 + 0: JSX_IDENT@17..20 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@20..20 + 4: R_ANGLE@20..21 ">" [] [] + 1: JSX_CHILD_LIST@21..21 + 2: JSX_CLOSING_ELEMENT@21..27 + 0: L_ANGLE@21..22 "<" [] [] + 1: SLASH@22..23 "/" [] [] + 2: JSX_NAME@23..26 + 0: JSX_IDENT@23..26 "div" [] [] + 3: R_ANGLE@26..27 ">" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 1: JS_VARIABLE_STATEMENT@28..59 + 0: JS_VARIABLE_DECLARATION@28..58 + 0: (empty) + 1: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@35..58 + 0: JS_VARIABLE_DECLARATOR@35..58 + 0: JS_IDENTIFIER_BINDING@35..37 + 0: IDENT@35..37 "f" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@37..58 + 0: EQ@37..39 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@39..58 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@39..42 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_PARAMETER_LIST@40..40 + 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")] + 5: JS_PARENTHESIZED_EXPRESSION@45..58 + 0: L_PAREN@45..46 "(" [] [] + 1: JSX_TAG_EXPRESSION@46..57 + 0: JSX_ELEMENT@46..57 + 0: JSX_OPENING_ELEMENT@46..51 + 0: L_ANGLE@46..47 "<" [] [] + 1: JSX_NAME@47..50 + 0: JSX_IDENT@47..50 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@50..50 + 4: R_ANGLE@50..51 ">" [] [] + 1: JSX_CHILD_LIST@51..51 + 2: JSX_CLOSING_ELEMENT@51..57 + 0: L_ANGLE@51..52 "<" [] [] + 1: SLASH@52..53 "/" [] [] + 2: JSX_NAME@53..56 + 0: JSX_IDENT@53..56 "div" [] [] + 3: R_ANGLE@56..57 ">" [] [] + 2: R_PAREN@57..58 ")" [] [] + 1: SEMICOLON@58..59 ";" [] [] + 4: EOF@59..60 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx.snap new file mode 100644 index 000000000000..666b11cafec9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx.snap @@ -0,0 +1,122 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
+} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@26..27 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@27..30 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@30..31 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@31..32 "<" [] [], + slash_token: SLASH@32..33 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@33..36 "div" [] [], + }, + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@37..39 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_FUNCTION_DECLARATION@0..39 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@13..39 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..37 + 0: JS_RETURN_STATEMENT@14..37 + 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@26..37 + 0: JSX_ELEMENT@26..37 + 0: JSX_OPENING_ELEMENT@26..31 + 0: L_ANGLE@26..27 "<" [] [] + 1: JSX_NAME@27..30 + 0: JSX_IDENT@27..30 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@30..30 + 4: R_ANGLE@30..31 ">" [] [] + 1: JSX_CHILD_LIST@31..31 + 2: JSX_CLOSING_ELEMENT@31..37 + 0: L_ANGLE@31..32 "<" [] [] + 1: SLASH@32..33 "/" [] [] + 2: JSX_NAME@33..36 + 0: JSX_IDENT@33..36 "div" [] [] + 3: R_ANGLE@36..37 ">" [] [] + 2: (empty) + 3: R_CURLY@37..39 "}" [Newline("\n")] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx.snap new file mode 100644 index 000000000000..666b11cafec9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx.snap @@ -0,0 +1,122 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
+} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@26..27 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@27..30 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@30..31 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@31..32 "<" [] [], + slash_token: SLASH@32..33 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@33..36 "div" [] [], + }, + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@37..39 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@39..40 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..40 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..39 + 0: JS_FUNCTION_DECLARATION@0..39 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@13..39 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..37 + 0: JS_RETURN_STATEMENT@14..37 + 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@26..37 + 0: JSX_ELEMENT@26..37 + 0: JSX_OPENING_ELEMENT@26..31 + 0: L_ANGLE@26..27 "<" [] [] + 1: JSX_NAME@27..30 + 0: JSX_IDENT@27..30 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@30..30 + 4: R_ANGLE@30..31 ">" [] [] + 1: JSX_CHILD_LIST@31..31 + 2: JSX_CLOSING_ELEMENT@31..37 + 0: L_ANGLE@31..32 "<" [] [] + 1: SLASH@32..33 "/" [] [] + 2: JSX_NAME@33..36 + 0: JSX_IDENT@33..36 "div" [] [] + 3: R_ANGLE@36..37 ">" [] [] + 2: (empty) + 3: R_CURLY@37..39 "}" [Newline("\n")] [] + 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx.snap new file mode 100644 index 000000000000..dbfc66827b79 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx.snap @@ -0,0 +1,105 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
+} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@26..27 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@27..31 "div" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@31..32 "/" [] [], + r_angle_token: R_ANGLE@32..33 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@33..35 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_FUNCTION_DECLARATION@0..35 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..13 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..11 + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@13..35 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..33 + 0: JS_RETURN_STATEMENT@14..33 + 0: RETURN_KW@14..26 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@26..33 + 0: JSX_SELF_CLOSING_ELEMENT@26..33 + 0: L_ANGLE@26..27 "<" [] [] + 1: JSX_NAME@27..31 + 0: JSX_IDENT@27..31 "div" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@31..31 + 4: SLASH@31..32 "/" [] [] + 5: R_ANGLE@32..33 ">" [] [] + 2: (empty) + 3: R_CURLY@33..35 "}" [Newline("\n")] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx.snap new file mode 100644 index 000000000000..8cbd013738e9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx.snap @@ -0,0 +1,129 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +=; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..5 "span" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@6..7 "<" [] [], + slash_token: SLASH@7..8 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@8..12 "span" [] [], + }, + r_angle_token: R_ANGLE@12..13 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@14..16 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@16..20 "span" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@20..21 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@21..22 "=" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@22..23 "<" [] [], + slash_token: SLASH@23..24 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@24..28 "span" [] [], + }, + r_angle_token: R_ANGLE@28..29 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@29..30 ";" [] [], + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_EXPRESSION_STATEMENT@0..14 + 0: JSX_TAG_EXPRESSION@0..13 + 0: JSX_ELEMENT@0..13 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..5 + 0: JSX_IDENT@1..5 "span" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@5..5 + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..6 + 2: JSX_CLOSING_ELEMENT@6..13 + 0: L_ANGLE@6..7 "<" [] [] + 1: SLASH@7..8 "/" [] [] + 2: JSX_NAME@8..12 + 0: JSX_IDENT@8..12 "span" [] [] + 3: R_ANGLE@12..13 ">" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@14..30 + 0: JSX_TAG_EXPRESSION@14..29 + 0: JSX_ELEMENT@14..29 + 0: JSX_OPENING_ELEMENT@14..21 + 0: L_ANGLE@14..16 "<" [Newline("\n")] [] + 1: JSX_NAME@16..20 + 0: JSX_IDENT@16..20 "span" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@20..20 + 4: R_ANGLE@20..21 ">" [] [] + 1: JSX_CHILD_LIST@21..22 + 0: JSX_TEXT@21..22 + 0: JSX_TEXT_LITERAL@21..22 "=" [] [] + 2: JSX_CLOSING_ELEMENT@22..29 + 0: L_ANGLE@22..23 "<" [] [] + 1: SLASH@23..24 "/" [] [] + 2: JSX_NAME@24..28 + 0: JSX_IDENT@24..28 "span" [] [] + 3: R_ANGLE@28..29 ">" [] [] + 1: SEMICOLON@29..30 ";" [] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_fragments.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx.snap new file mode 100644 index 000000000000..1f6a34e17f03 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx.snap @@ -0,0 +1,179 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>; +<>abcd; +<> whitespace +; +< + /*comment */ + > + < + / +>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@0..1 "<" [] [], + r_angle_token: R_ANGLE@1..2 ">" [] [], + }, + children: JsxChildList [], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@2..3 "<" [] [], + slash_token: SLASH@3..4 "/" [] [], + r_angle_token: R_ANGLE@4..5 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@5..6 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@6..8 "<" [Newline("\n")] [], + r_angle_token: R_ANGLE@8..9 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@9..13 "abcd" [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@13..14 "<" [] [], + slash_token: SLASH@14..15 "/" [] [], + r_angle_token: R_ANGLE@15..16 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@17..19 "<" [Newline("\n")] [], + r_angle_token: R_ANGLE@19..20 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@20..34 " whitespace\n" [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@34..35 "<" [] [], + slash_token: SLASH@35..36 "/" [] [], + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxFragment { + opening_fragment: JsxOpeningFragment { + l_angle_token: L_ANGLE@38..40 "<" [Newline("\n")] [], + r_angle_token: R_ANGLE@40..59 ">" [Newline("\n"), Whitespace(" "), Comments("/*comment */"), Newline("\n"), Whitespace(" ")] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@59..62 "\n " [] [], + }, + ], + closing_fragment: JsxClosingFragment { + l_angle_token: L_ANGLE@62..63 "<" [] [], + slash_token: SLASH@63..67 "/" [Newline("\n"), Whitespace(" ")] [], + r_angle_token: R_ANGLE@67..69 ">" [Newline("\n")] [], + }, + }, + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..70 + 0: JS_EXPRESSION_STATEMENT@0..6 + 0: JSX_TAG_EXPRESSION@0..5 + 0: JSX_FRAGMENT@0..5 + 0: JSX_OPENING_FRAGMENT@0..2 + 0: L_ANGLE@0..1 "<" [] [] + 1: R_ANGLE@1..2 ">" [] [] + 1: JSX_CHILD_LIST@2..2 + 2: JSX_CLOSING_FRAGMENT@2..5 + 0: L_ANGLE@2..3 "<" [] [] + 1: SLASH@3..4 "/" [] [] + 2: R_ANGLE@4..5 ">" [] [] + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@6..17 + 0: JSX_TAG_EXPRESSION@6..16 + 0: JSX_FRAGMENT@6..16 + 0: JSX_OPENING_FRAGMENT@6..9 + 0: L_ANGLE@6..8 "<" [Newline("\n")] [] + 1: R_ANGLE@8..9 ">" [] [] + 1: JSX_CHILD_LIST@9..13 + 0: JSX_TEXT@9..13 + 0: JSX_TEXT_LITERAL@9..13 "abcd" [] [] + 2: JSX_CLOSING_FRAGMENT@13..16 + 0: L_ANGLE@13..14 "<" [] [] + 1: SLASH@14..15 "/" [] [] + 2: R_ANGLE@15..16 ">" [] [] + 1: SEMICOLON@16..17 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@17..38 + 0: JSX_TAG_EXPRESSION@17..37 + 0: JSX_FRAGMENT@17..37 + 0: JSX_OPENING_FRAGMENT@17..20 + 0: L_ANGLE@17..19 "<" [Newline("\n")] [] + 1: R_ANGLE@19..20 ">" [] [] + 1: JSX_CHILD_LIST@20..34 + 0: JSX_TEXT@20..34 + 0: JSX_TEXT_LITERAL@20..34 " whitespace\n" [] [] + 2: JSX_CLOSING_FRAGMENT@34..37 + 0: L_ANGLE@34..35 "<" [] [] + 1: SLASH@35..36 "/" [] [] + 2: R_ANGLE@36..37 ">" [] [] + 1: SEMICOLON@37..38 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@38..70 + 0: JSX_TAG_EXPRESSION@38..69 + 0: JSX_FRAGMENT@38..69 + 0: JSX_OPENING_FRAGMENT@38..59 + 0: L_ANGLE@38..40 "<" [Newline("\n")] [] + 1: R_ANGLE@40..59 ">" [Newline("\n"), Whitespace(" "), Comments("/*comment */"), Newline("\n"), Whitespace(" ")] [] + 1: JSX_CHILD_LIST@59..62 + 0: JSX_TEXT@59..62 + 0: JSX_TEXT_LITERAL@59..62 "\n " [] [] + 2: JSX_CLOSING_FRAGMENT@62..69 + 0: L_ANGLE@62..63 "<" [] [] + 1: SLASH@63..67 "/" [Newline("\n"), Whitespace(" ")] [] + 2: R_ANGLE@67..69 ">" [Newline("\n")] [] + 1: SEMICOLON@69..70 ";" [] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx.snap new file mode 100644 index 000000000000..47c72d0ba1b5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx.snap @@ -0,0 +1,247 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxMemberName { + object: JsxMemberName { + object: JsxMemberName { + object: JsxReferenceIdentifier { + value_token: JSX_IDENT@1..2 "a" [] [], + }, + dot_token: DOT@2..3 "." [] [], + member: JsName { + value_token: IDENT@3..4 "b" [] [], + }, + }, + dot_token: DOT@4..5 "." [] [], + member: JsName { + value_token: IDENT@5..6 "c" [] [], + }, + }, + dot_token: DOT@6..7 "." [] [], + member: JsName { + value_token: IDENT@7..8 "d" [] [], + }, + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@8..9 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@9..10 "<" [] [], + slash_token: SLASH@10..11 "/" [] [], + name: JsxMemberName { + object: JsxMemberName { + object: JsxMemberName { + object: JsxReferenceIdentifier { + value_token: JSX_IDENT@11..12 "a" [] [], + }, + dot_token: DOT@12..13 "." [] [], + member: JsName { + value_token: IDENT@13..14 "b" [] [], + }, + }, + dot_token: DOT@14..15 "." [] [], + member: JsName { + value_token: IDENT@15..16 "c" [] [], + }, + }, + dot_token: DOT@16..17 "." [] [], + member: JsName { + value_token: IDENT@17..18 "d" [] [], + }, + }, + r_angle_token: R_ANGLE@18..19 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@20..22 "<" [Newline("\n")] [], + name: JsxMemberName { + object: JsxReferenceIdentifier { + value_token: JSX_IDENT@22..25 "a-b" [] [], + }, + dot_token: DOT@25..26 "." [] [], + member: JsName { + value_token: IDENT@26..27 "c" [] [], + }, + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@27..28 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@28..29 "<" [] [], + slash_token: SLASH@29..30 "/" [] [], + name: JsxMemberName { + object: JsxReferenceIdentifier { + value_token: JSX_IDENT@30..33 "a-b" [] [], + }, + dot_token: DOT@33..34 "." [] [], + member: JsName { + value_token: IDENT@34..35 "c" [] [], + }, + }, + r_angle_token: R_ANGLE@35..36 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@37..39 "<" [Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@39..43 "Abcd" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@43..44 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@44..45 "<" [] [], + slash_token: SLASH@45..46 "/" [] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@46..50 "Abcd" [] [], + }, + r_angle_token: R_ANGLE@50..51 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@51..52 ";" [] [], + }, + ], + eof_token: EOF@52..53 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..53 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..52 + 0: JS_EXPRESSION_STATEMENT@0..20 + 0: JSX_TAG_EXPRESSION@0..19 + 0: JSX_ELEMENT@0..19 + 0: JSX_OPENING_ELEMENT@0..9 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_MEMBER_NAME@1..8 + 0: JSX_MEMBER_NAME@1..6 + 0: JSX_MEMBER_NAME@1..4 + 0: JSX_REFERENCE_IDENTIFIER@1..2 + 0: JSX_IDENT@1..2 "a" [] [] + 1: DOT@2..3 "." [] [] + 2: JS_NAME@3..4 + 0: IDENT@3..4 "b" [] [] + 1: DOT@4..5 "." [] [] + 2: JS_NAME@5..6 + 0: IDENT@5..6 "c" [] [] + 1: DOT@6..7 "." [] [] + 2: JS_NAME@7..8 + 0: IDENT@7..8 "d" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@8..8 + 4: R_ANGLE@8..9 ">" [] [] + 1: JSX_CHILD_LIST@9..9 + 2: JSX_CLOSING_ELEMENT@9..19 + 0: L_ANGLE@9..10 "<" [] [] + 1: SLASH@10..11 "/" [] [] + 2: JSX_MEMBER_NAME@11..18 + 0: JSX_MEMBER_NAME@11..16 + 0: JSX_MEMBER_NAME@11..14 + 0: JSX_REFERENCE_IDENTIFIER@11..12 + 0: JSX_IDENT@11..12 "a" [] [] + 1: DOT@12..13 "." [] [] + 2: JS_NAME@13..14 + 0: IDENT@13..14 "b" [] [] + 1: DOT@14..15 "." [] [] + 2: JS_NAME@15..16 + 0: IDENT@15..16 "c" [] [] + 1: DOT@16..17 "." [] [] + 2: JS_NAME@17..18 + 0: IDENT@17..18 "d" [] [] + 3: R_ANGLE@18..19 ">" [] [] + 1: SEMICOLON@19..20 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@20..37 + 0: JSX_TAG_EXPRESSION@20..36 + 0: JSX_ELEMENT@20..36 + 0: JSX_OPENING_ELEMENT@20..28 + 0: L_ANGLE@20..22 "<" [Newline("\n")] [] + 1: JSX_MEMBER_NAME@22..27 + 0: JSX_REFERENCE_IDENTIFIER@22..25 + 0: JSX_IDENT@22..25 "a-b" [] [] + 1: DOT@25..26 "." [] [] + 2: JS_NAME@26..27 + 0: IDENT@26..27 "c" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@27..27 + 4: R_ANGLE@27..28 ">" [] [] + 1: JSX_CHILD_LIST@28..28 + 2: JSX_CLOSING_ELEMENT@28..36 + 0: L_ANGLE@28..29 "<" [] [] + 1: SLASH@29..30 "/" [] [] + 2: JSX_MEMBER_NAME@30..35 + 0: JSX_REFERENCE_IDENTIFIER@30..33 + 0: JSX_IDENT@30..33 "a-b" [] [] + 1: DOT@33..34 "." [] [] + 2: JS_NAME@34..35 + 0: IDENT@34..35 "c" [] [] + 3: R_ANGLE@35..36 ">" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@37..52 + 0: JSX_TAG_EXPRESSION@37..51 + 0: JSX_ELEMENT@37..51 + 0: JSX_OPENING_ELEMENT@37..44 + 0: L_ANGLE@37..39 "<" [Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@39..43 + 0: JSX_IDENT@39..43 "Abcd" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@43..43 + 4: R_ANGLE@43..44 ">" [] [] + 1: JSX_CHILD_LIST@44..44 + 2: JSX_CLOSING_ELEMENT@44..51 + 0: L_ANGLE@44..45 "<" [] [] + 1: SLASH@45..46 "/" [] [] + 2: JSX_REFERENCE_IDENTIFIER@46..50 + 0: JSX_IDENT@46..50 "Abcd" [] [] + 3: R_ANGLE@50..51 ">" [] [] + 1: SEMICOLON@51..52 ";" [] [] + 4: EOF@52..53 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx.snap new file mode 100644 index 000000000000..066c082cc274 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx.snap @@ -0,0 +1,120 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = abcd.c; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsStaticMemberExpression { + object: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@8..9 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@9..13 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@13..14 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@14..18 "abcd" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@18..19 "<" [] [], + slash_token: SLASH@19..20 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@20..24 "test" [] [], + }, + r_angle_token: R_ANGLE@24..25 ">" [] [], + }, + }, + }, + operator_token: DOT@25..26 "." [] [], + member: JsName { + value_token: IDENT@26..27 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_VARIABLE_STATEMENT@0..28 + 0: JS_VARIABLE_DECLARATION@0..27 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..27 + 0: JS_VARIABLE_DECLARATOR@4..27 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..27 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@8..27 + 0: JSX_TAG_EXPRESSION@8..25 + 0: JSX_ELEMENT@8..25 + 0: JSX_OPENING_ELEMENT@8..14 + 0: L_ANGLE@8..9 "<" [] [] + 1: JSX_NAME@9..13 + 0: JSX_IDENT@9..13 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@13..13 + 4: R_ANGLE@13..14 ">" [] [] + 1: JSX_CHILD_LIST@14..18 + 0: JSX_TEXT@14..18 + 0: JSX_TEXT_LITERAL@14..18 "abcd" [] [] + 2: JSX_CLOSING_ELEMENT@18..25 + 0: L_ANGLE@18..19 "<" [] [] + 1: SLASH@19..20 "/" [] [] + 2: JSX_NAME@20..24 + 0: JSX_IDENT@20..24 "test" [] [] + 3: R_ANGLE@24..25 ">" [] [] + 1: DOT@25..26 "." [] [] + 2: JS_NAME@26..27 + 0: IDENT@26..27 "c" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap new file mode 100644 index 000000000000..0eb68e937bd0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap @@ -0,0 +1,120 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let obj = {}; +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..8 "obj" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@11..12 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@13..15 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@15..17 "a" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxSpreadAttribute { + l_curly_token: L_CURLY@17..18 "{" [] [], + dotdotdot_token: DOT3@18..21 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..24 "obj" [] [], + }, + }, + r_curly_token: R_CURLY@24..26 "}" [] [Whitespace(" ")], + }, + ], + slash_token: SLASH@26..27 "/" [] [], + r_angle_token: R_ANGLE@27..28 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_VARIABLE_STATEMENT@0..13 + 0: JS_VARIABLE_DECLARATION@0..12 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..12 + 0: JS_VARIABLE_DECLARATOR@4..12 + 0: JS_IDENTIFIER_BINDING@4..8 + 0: IDENT@4..8 "obj" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..12 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@10..12 + 0: L_CURLY@10..11 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@11..11 + 2: R_CURLY@11..12 "}" [] [] + 1: SEMICOLON@12..13 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@13..29 + 0: JSX_TAG_EXPRESSION@13..28 + 0: JSX_SELF_CLOSING_ELEMENT@13..28 + 0: L_ANGLE@13..15 "<" [Newline("\n")] [] + 1: JSX_NAME@15..17 + 0: JSX_IDENT@15..17 "a" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@17..26 + 0: JSX_SPREAD_ATTRIBUTE@17..26 + 0: L_CURLY@17..18 "{" [] [] + 1: DOT3@18..21 "..." [] [] + 2: JS_IDENTIFIER_EXPRESSION@21..24 + 0: JS_REFERENCE_IDENTIFIER@21..24 + 0: IDENT@21..24 "obj" [] [] + 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] + 4: SLASH@26..27 "/" [] [] + 5: R_ANGLE@27..28 ">" [] [] + 1: SEMICOLON@28..29 ";" [] [] + 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_text.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_text.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx.snap new file mode 100644 index 000000000000..b711378f3e45 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx.snap @@ -0,0 +1,238 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +test; + whitespace handling ; + multi + line + node +; +\u3333 // no error for invalid unicode escape + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..2 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@2..3 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@3..7 "test" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@7..8 "<" [] [], + slash_token: SLASH@8..9 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@9..10 "a" [] [], + }, + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@12..14 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@14..15 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@15..16 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@16..39 " whitespace handling " [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@39..40 "<" [] [], + slash_token: SLASH@40..41 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@41..42 "a" [] [], + }, + r_angle_token: R_ANGLE@42..43 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@44..46 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@46..47 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@47..48 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@48..77 " multi\n line\n node\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@77..78 "<" [] [], + slash_token: SLASH@78..79 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@79..80 "a" [] [], + }, + r_angle_token: R_ANGLE@80..81 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@81..82 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@82..84 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@84..88 "test" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@88..89 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@89..95 "\\u3333" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@95..96 "<" [] [], + slash_token: SLASH@96..97 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@97..101 "test" [] [], + }, + r_angle_token: R_ANGLE@101..141 ">" [] [Whitespace(" "), Comments("// no error for inval ...")], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@141..142 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..142 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..141 + 0: JS_EXPRESSION_STATEMENT@0..12 + 0: JSX_TAG_EXPRESSION@0..11 + 0: JSX_ELEMENT@0..11 + 0: JSX_OPENING_ELEMENT@0..3 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..2 + 0: JSX_IDENT@1..2 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@2..2 + 4: R_ANGLE@2..3 ">" [] [] + 1: JSX_CHILD_LIST@3..7 + 0: JSX_TEXT@3..7 + 0: JSX_TEXT_LITERAL@3..7 "test" [] [] + 2: JSX_CLOSING_ELEMENT@7..11 + 0: L_ANGLE@7..8 "<" [] [] + 1: SLASH@8..9 "/" [] [] + 2: JSX_NAME@9..10 + 0: JSX_IDENT@9..10 "a" [] [] + 3: R_ANGLE@10..11 ">" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@12..44 + 0: JSX_TAG_EXPRESSION@12..43 + 0: JSX_ELEMENT@12..43 + 0: JSX_OPENING_ELEMENT@12..16 + 0: L_ANGLE@12..14 "<" [Newline("\n")] [] + 1: JSX_NAME@14..15 + 0: JSX_IDENT@14..15 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@15..15 + 4: R_ANGLE@15..16 ">" [] [] + 1: JSX_CHILD_LIST@16..39 + 0: JSX_TEXT@16..39 + 0: JSX_TEXT_LITERAL@16..39 " whitespace handling " [] [] + 2: JSX_CLOSING_ELEMENT@39..43 + 0: L_ANGLE@39..40 "<" [] [] + 1: SLASH@40..41 "/" [] [] + 2: JSX_NAME@41..42 + 0: JSX_IDENT@41..42 "a" [] [] + 3: R_ANGLE@42..43 ">" [] [] + 1: SEMICOLON@43..44 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@44..82 + 0: JSX_TAG_EXPRESSION@44..81 + 0: JSX_ELEMENT@44..81 + 0: JSX_OPENING_ELEMENT@44..48 + 0: L_ANGLE@44..46 "<" [Newline("\n")] [] + 1: JSX_NAME@46..47 + 0: JSX_IDENT@46..47 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@47..47 + 4: R_ANGLE@47..48 ">" [] [] + 1: JSX_CHILD_LIST@48..77 + 0: JSX_TEXT@48..77 + 0: JSX_TEXT_LITERAL@48..77 " multi\n line\n node\n" [] [] + 2: JSX_CLOSING_ELEMENT@77..81 + 0: L_ANGLE@77..78 "<" [] [] + 1: SLASH@78..79 "/" [] [] + 2: JSX_NAME@79..80 + 0: JSX_IDENT@79..80 "a" [] [] + 3: R_ANGLE@80..81 ">" [] [] + 1: SEMICOLON@81..82 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@82..141 + 0: JSX_TAG_EXPRESSION@82..141 + 0: JSX_ELEMENT@82..141 + 0: JSX_OPENING_ELEMENT@82..89 + 0: L_ANGLE@82..84 "<" [Newline("\n")] [] + 1: JSX_NAME@84..88 + 0: JSX_IDENT@84..88 "test" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@88..88 + 4: R_ANGLE@88..89 ">" [] [] + 1: JSX_CHILD_LIST@89..95 + 0: JSX_TEXT@89..95 + 0: JSX_TEXT_LITERAL@89..95 "\\u3333" [] [] + 2: JSX_CLOSING_ELEMENT@95..141 + 0: L_ANGLE@95..96 "<" [] [] + 1: SLASH@96..97 "/" [] [] + 2: JSX_NAME@97..101 + 0: JSX_IDENT@97..101 "test" [] [] + 3: R_ANGLE@101..141 ">" [] [Whitespace(" "), Comments("// no error for inval ...")] + 1: (empty) + 4: EOF@141..142 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx.snap new file mode 100644 index 000000000000..1436528c988e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx.snap @@ -0,0 +1,384 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// These may look like a valid arrows but are JSX +() =; +() =; +() =; +() =; +; +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..51 "<" [Comments("// These may look lik ..."), Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@51..53 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@53..60 "extends" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@60..61 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@61..65 "() =" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@65..66 "<" [] [], + slash_token: SLASH@66..67 "/" [] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@67..68 "A" [] [], + }, + r_angle_token: R_ANGLE@68..69 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@70..72 "<" [Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@72..74 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@74..81 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@81..82 "=" [] [], + value: JsxString { + value_token: JSX_STRING_LITERAL@82..85 "\"B\"" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@85..86 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@86..90 "() =" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@90..91 "<" [] [], + slash_token: SLASH@91..92 "/" [] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@92..93 "A" [] [], + }, + r_angle_token: R_ANGLE@93..94 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@94..95 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@95..97 "<" [Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@97..99 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@99..107 "extends" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@107..109 "ok" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@109..110 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@110..114 "() =" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@114..115 "<" [] [], + slash_token: SLASH@115..116 "/" [] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@116..117 "A" [] [], + }, + r_angle_token: R_ANGLE@117..118 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@118..119 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@119..121 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@121..127 "const" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@127..128 "A" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@128..129 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@129..133 "() =" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@133..134 "<" [] [], + slash_token: SLASH@134..135 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@135..140 "const" [] [], + }, + r_angle_token: R_ANGLE@140..141 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@141..142 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@142..144 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@144..150 "const" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@150..152 "A" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@152..159 "extends" [] [], + }, + initializer: missing (optional), + }, + ], + slash_token: SLASH@159..160 "/" [] [], + r_angle_token: R_ANGLE@160..161 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@161..162 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@162..164 "<" [Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@164..166 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@166..173 "extends" [] [], + }, + initializer: missing (optional), + }, + ], + slash_token: SLASH@173..174 "/" [] [], + r_angle_token: R_ANGLE@174..175 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@175..176 ";" [] [], + }, + ], + eof_token: EOF@176..177 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..177 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..176 + 0: JS_EXPRESSION_STATEMENT@0..70 + 0: JSX_TAG_EXPRESSION@0..69 + 0: JSX_ELEMENT@0..69 + 0: JSX_OPENING_ELEMENT@0..61 + 0: L_ANGLE@0..51 "<" [Comments("// These may look lik ..."), Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@51..53 + 0: JSX_IDENT@51..53 "A" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@53..60 + 0: JSX_ATTRIBUTE@53..60 + 0: JSX_NAME@53..60 + 0: JSX_IDENT@53..60 "extends" [] [] + 1: (empty) + 4: R_ANGLE@60..61 ">" [] [] + 1: JSX_CHILD_LIST@61..65 + 0: JSX_TEXT@61..65 + 0: JSX_TEXT_LITERAL@61..65 "() =" [] [] + 2: JSX_CLOSING_ELEMENT@65..69 + 0: L_ANGLE@65..66 "<" [] [] + 1: SLASH@66..67 "/" [] [] + 2: JSX_REFERENCE_IDENTIFIER@67..68 + 0: JSX_IDENT@67..68 "A" [] [] + 3: R_ANGLE@68..69 ">" [] [] + 1: SEMICOLON@69..70 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@70..95 + 0: JSX_TAG_EXPRESSION@70..94 + 0: JSX_ELEMENT@70..94 + 0: JSX_OPENING_ELEMENT@70..86 + 0: L_ANGLE@70..72 "<" [Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@72..74 + 0: JSX_IDENT@72..74 "A" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@74..85 + 0: JSX_ATTRIBUTE@74..85 + 0: JSX_NAME@74..81 + 0: JSX_IDENT@74..81 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@81..85 + 0: EQ@81..82 "=" [] [] + 1: JSX_STRING@82..85 + 0: JSX_STRING_LITERAL@82..85 "\"B\"" [] [] + 4: R_ANGLE@85..86 ">" [] [] + 1: JSX_CHILD_LIST@86..90 + 0: JSX_TEXT@86..90 + 0: JSX_TEXT_LITERAL@86..90 "() =" [] [] + 2: JSX_CLOSING_ELEMENT@90..94 + 0: L_ANGLE@90..91 "<" [] [] + 1: SLASH@91..92 "/" [] [] + 2: JSX_REFERENCE_IDENTIFIER@92..93 + 0: JSX_IDENT@92..93 "A" [] [] + 3: R_ANGLE@93..94 ">" [] [] + 1: SEMICOLON@94..95 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@95..119 + 0: JSX_TAG_EXPRESSION@95..118 + 0: JSX_ELEMENT@95..118 + 0: JSX_OPENING_ELEMENT@95..110 + 0: L_ANGLE@95..97 "<" [Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@97..99 + 0: JSX_IDENT@97..99 "A" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@99..109 + 0: JSX_ATTRIBUTE@99..107 + 0: JSX_NAME@99..107 + 0: JSX_IDENT@99..107 "extends" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@107..109 + 0: JSX_NAME@107..109 + 0: JSX_IDENT@107..109 "ok" [] [] + 1: (empty) + 4: R_ANGLE@109..110 ">" [] [] + 1: JSX_CHILD_LIST@110..114 + 0: JSX_TEXT@110..114 + 0: JSX_TEXT_LITERAL@110..114 "() =" [] [] + 2: JSX_CLOSING_ELEMENT@114..118 + 0: L_ANGLE@114..115 "<" [] [] + 1: SLASH@115..116 "/" [] [] + 2: JSX_REFERENCE_IDENTIFIER@116..117 + 0: JSX_IDENT@116..117 "A" [] [] + 3: R_ANGLE@117..118 ">" [] [] + 1: SEMICOLON@118..119 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@119..142 + 0: JSX_TAG_EXPRESSION@119..141 + 0: JSX_ELEMENT@119..141 + 0: JSX_OPENING_ELEMENT@119..129 + 0: L_ANGLE@119..121 "<" [Newline("\n")] [] + 1: JSX_NAME@121..127 + 0: JSX_IDENT@121..127 "const" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@127..128 + 0: JSX_ATTRIBUTE@127..128 + 0: JSX_NAME@127..128 + 0: JSX_IDENT@127..128 "A" [] [] + 1: (empty) + 4: R_ANGLE@128..129 ">" [] [] + 1: JSX_CHILD_LIST@129..133 + 0: JSX_TEXT@129..133 + 0: JSX_TEXT_LITERAL@129..133 "() =" [] [] + 2: JSX_CLOSING_ELEMENT@133..141 + 0: L_ANGLE@133..134 "<" [] [] + 1: SLASH@134..135 "/" [] [] + 2: JSX_NAME@135..140 + 0: JSX_IDENT@135..140 "const" [] [] + 3: R_ANGLE@140..141 ">" [] [] + 1: SEMICOLON@141..142 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@142..162 + 0: JSX_TAG_EXPRESSION@142..161 + 0: JSX_SELF_CLOSING_ELEMENT@142..161 + 0: L_ANGLE@142..144 "<" [Newline("\n")] [] + 1: JSX_NAME@144..150 + 0: JSX_IDENT@144..150 "const" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@150..159 + 0: JSX_ATTRIBUTE@150..152 + 0: JSX_NAME@150..152 + 0: JSX_IDENT@150..152 "A" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@152..159 + 0: JSX_NAME@152..159 + 0: JSX_IDENT@152..159 "extends" [] [] + 1: (empty) + 4: SLASH@159..160 "/" [] [] + 5: R_ANGLE@160..161 ">" [] [] + 1: SEMICOLON@161..162 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@162..176 + 0: JSX_TAG_EXPRESSION@162..175 + 0: JSX_SELF_CLOSING_ELEMENT@162..175 + 0: L_ANGLE@162..164 "<" [Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@164..166 + 0: JSX_IDENT@164..166 "A" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@166..173 + 0: JSX_ATTRIBUTE@166..173 + 0: JSX_NAME@166..173 + 0: JSX_IDENT@166..173 "extends" [] [] + 1: (empty) + 4: SLASH@173..174 "/" [] [] + 5: R_ANGLE@174..175 ">" [] [] + 1: SEMICOLON@175..176 ";" [] [] + 4: EOF@176..177 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/labeled_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/labeled_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js.snap new file mode 100644 index 000000000000..b2410ba3e314 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +label1: 1 +label1: 1 +label2: 2 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..6 "label1" [] [], + }, + colon_token: COLON@6..8 ":" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@8..9 "1" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@9..16 "label1" [Newline("\n")] [], + }, + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@18..19 "1" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@19..26 "label2" [Newline("\n")] [], + }, + colon_token: COLON@26..28 ":" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@28..29 "2" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_LABELED_STATEMENT@0..9 + 0: JS_LABEL@0..6 + 0: IDENT@0..6 "label1" [] [] + 1: COLON@6..8 ":" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@8..9 + 0: JS_NUMBER_LITERAL_EXPRESSION@8..9 + 0: JS_NUMBER_LITERAL@8..9 "1" [] [] + 1: (empty) + 1: JS_LABELED_STATEMENT@9..19 + 0: JS_LABEL@9..16 + 0: IDENT@9..16 "label1" [Newline("\n")] [] + 1: COLON@16..18 ":" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@18..19 + 0: JS_NUMBER_LITERAL_EXPRESSION@18..19 + 0: JS_NUMBER_LITERAL@18..19 "1" [] [] + 1: (empty) + 2: JS_LABELED_STATEMENT@19..29 + 0: JS_LABEL@19..26 + 0: IDENT@19..26 "label2" [Newline("\n")] [] + 1: COLON@26..28 ":" [] [Whitespace(" ")] + 2: JS_EXPRESSION_STATEMENT@28..29 + 0: JS_NUMBER_LITERAL_EXPRESSION@28..29 + 0: JS_NUMBER_LITERAL@28..29 "2" [] [] + 1: (empty) + 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.js b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs.snap new file mode 100644 index 000000000000..7a346696baff --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs.snap @@ -0,0 +1,85 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +label1: function a() {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [], + }, + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + body: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@27..28 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@29..31 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@31..32 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@33..34 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..34 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..33 + 0: JS_LABELED_STATEMENT@0..33 + 0: JS_LABEL@0..16 + 0: IDENT@0..16 "label1" [Comments("// SCRIPT"), Newline("\n")] [] + 1: COLON@16..18 ":" [] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@18..33 + 0: (empty) + 1: FUNCTION_KW@18..27 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@27..28 + 0: IDENT@27..28 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@28..31 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..29 + 2: R_PAREN@29..31 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@31..33 + 0: L_CURLY@31..32 "{" [] [] + 1: JS_DIRECTIVE_LIST@32..32 + 2: JS_STATEMENT_LIST@32..32 + 3: R_CURLY@32..33 "}" [] [] + 4: EOF@33..34 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap new file mode 100644 index 000000000000..c49332f67643 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap @@ -0,0 +1,97 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) label1: var a = 10; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsIfStatement { + if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], + l_paren_token: L_PAREN@3..4 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@4..8 "true" [] [], + }, + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + consequent: JsLabeledStatement { + label: JsLabel { + value_token: IDENT@10..16 "label1" [] [], + }, + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + body: JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@18..22 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@22..24 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@26..28 "10" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + }, + else_clause: missing (optional), + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: JS_IF_STATEMENT@0..29 + 0: IF_KW@0..3 "if" [] [Whitespace(" ")] + 1: L_PAREN@3..4 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 + 0: TRUE_KW@4..8 "true" [] [] + 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 4: JS_LABELED_STATEMENT@10..29 + 0: JS_LABEL@10..16 + 0: IDENT@10..16 "label1" [] [] + 1: COLON@16..18 ":" [] [Whitespace(" ")] + 2: JS_VARIABLE_STATEMENT@18..29 + 0: JS_VARIABLE_DECLARATION@18..28 + 0: (empty) + 1: VAR_KW@18..22 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@22..28 + 0: JS_VARIABLE_DECLARATOR@22..28 + 0: JS_IDENTIFIER_BINDING@22..24 + 0: IDENT@22..24 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@24..28 + 0: EQ@24..26 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@26..28 + 0: JS_NUMBER_LITERAL@26..28 "10" [] [] + 1: SEMICOLON@28..29 ";" [] [] + 5: (empty) + 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.js b/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/let_asi_rule.js rename to crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs.snap new file mode 100644 index 000000000000..beab2e5780a4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs.snap @@ -0,0 +1,149 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +let // NO ASI +x = 1; +for await (var x of []) let // ASI +x = 1; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..23 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" "), Comments("// NO ASI")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@23..26 "x" [Newline("\n")] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@26..28 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@28..29 "1" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@29..30 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@30..35 "for" [Newline("\n")] [Whitespace(" ")], + await_token: AWAIT_KW@35..41 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@41..42 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@42..46 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@46..48 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@48..51 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@51..52 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@52..53 "]" [] [], + }, + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + body: JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..65 "let" [] [Whitespace(" "), Comments("// ASI")], + }, + }, + semicolon_token: missing (optional), + }, + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@65..68 "x" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@68..70 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@70..71 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@71..72 ";" [] [], + }, + ], + eof_token: EOF@72..73 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..73 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..72 + 0: JS_VARIABLE_STATEMENT@0..30 + 0: JS_VARIABLE_DECLARATION@0..29 + 0: (empty) + 1: LET_KW@0..23 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" "), Comments("// NO ASI")] + 2: JS_VARIABLE_DECLARATOR_LIST@23..29 + 0: JS_VARIABLE_DECLARATOR@23..29 + 0: JS_IDENTIFIER_BINDING@23..26 + 0: IDENT@23..26 "x" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@26..29 + 0: EQ@26..28 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@28..29 + 0: JS_NUMBER_LITERAL@28..29 "1" [] [] + 1: SEMICOLON@29..30 ";" [] [] + 1: JS_FOR_OF_STATEMENT@30..65 + 0: FOR_KW@30..35 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@35..41 "await" [] [Whitespace(" ")] + 2: L_PAREN@41..42 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@42..48 + 0: (empty) + 1: VAR_KW@42..46 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@46..48 + 0: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@48..51 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@51..53 + 0: L_BRACK@51..52 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@52..52 + 2: R_BRACK@52..53 "]" [] [] + 6: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 7: JS_EXPRESSION_STATEMENT@55..65 + 0: JS_IDENTIFIER_EXPRESSION@55..65 + 0: JS_REFERENCE_IDENTIFIER@55..65 + 0: IDENT@55..65 "let" [] [Whitespace(" "), Comments("// ASI")] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@65..72 + 0: JS_ASSIGNMENT_EXPRESSION@65..71 + 0: JS_IDENTIFIER_ASSIGNMENT@65..68 + 0: IDENT@65..68 "x" [Newline("\n")] [Whitespace(" ")] + 1: EQ@68..70 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@70..71 + 0: JS_NUMBER_LITERAL@70..71 "1" [] [] + 1: SEMICOLON@71..72 ";" [] [] + 4: EOF@72..73 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/literals.js b/crates/biome_js_parser/tests/js_test_suite/ok/literals.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/literals.js rename to crates/biome_js_parser/tests/js_test_suite/ok/literals.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/literals.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/literals.js.snap new file mode 100644 index 000000000000..dbc370e132b3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/literals.js.snap @@ -0,0 +1,198 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +5 +true +false +5n +"foo" +'bar' +null +0, 0.0, 0n, 0e00 +"test\ +new-line"; +/^[يفمئامئ‍ئاسۆند]/i; //regex with unicode +/[\p{Control}--[\t\n]]/v; +/\’/; // regex with escaped non-ascii chars (issue #1941) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..1 "5" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@1..6 "true" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: FALSE_KW@6..12 "false" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@12..15 "5n" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@15..21 "\"foo\"" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@21..27 "'bar'" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNullLiteralExpression { + value_token: NULL_KW@27..32 "null" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@32..34 "0" [Newline("\n")] [], + }, + comma_token: COMMA@34..36 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@36..39 "0.0" [] [], + }, + }, + comma_token: COMMA@39..41 "," [] [Whitespace(" ")], + right: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@41..43 "0n" [] [], + }, + }, + comma_token: COMMA@43..45 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@45..49 "0e00" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@49..66 "\"test\\\nnew-line\"" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@66..67 ";" [] [], + }, + JsExpressionStatement { + expression: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@67..103 "/^[يفمئامئ\u{200d}ئاسۆند]/i" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@103..125 ";" [] [Whitespace(" "), Comments("//regex with unicode")], + }, + JsExpressionStatement { + expression: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@125..150 "/[\\p{Control}--[\\t\\n]]/v" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@150..151 ";" [] [], + }, + JsExpressionStatement { + expression: JsRegexLiteralExpression { + value_token: JS_REGEX_LITERAL@151..158 "/\\’/" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@158..211 ";" [] [Whitespace(" "), Comments("// regex with escaped ...")], + }, + ], + eof_token: EOF@211..212 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..212 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..211 + 0: JS_EXPRESSION_STATEMENT@0..1 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..1 + 0: JS_NUMBER_LITERAL@0..1 "5" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@1..6 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@1..6 + 0: TRUE_KW@1..6 "true" [Newline("\n")] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@6..12 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@6..12 + 0: FALSE_KW@6..12 "false" [Newline("\n")] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@12..15 + 0: JS_BIGINT_LITERAL_EXPRESSION@12..15 + 0: JS_BIGINT_LITERAL@12..15 "5n" [Newline("\n")] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@15..21 + 0: JS_STRING_LITERAL_EXPRESSION@15..21 + 0: JS_STRING_LITERAL@15..21 "\"foo\"" [Newline("\n")] [] + 1: (empty) + 5: JS_EXPRESSION_STATEMENT@21..27 + 0: JS_STRING_LITERAL_EXPRESSION@21..27 + 0: JS_STRING_LITERAL@21..27 "'bar'" [Newline("\n")] [] + 1: (empty) + 6: JS_EXPRESSION_STATEMENT@27..32 + 0: JS_NULL_LITERAL_EXPRESSION@27..32 + 0: NULL_KW@27..32 "null" [Newline("\n")] [] + 1: (empty) + 7: JS_EXPRESSION_STATEMENT@32..49 + 0: JS_SEQUENCE_EXPRESSION@32..49 + 0: JS_SEQUENCE_EXPRESSION@32..43 + 0: JS_SEQUENCE_EXPRESSION@32..39 + 0: JS_NUMBER_LITERAL_EXPRESSION@32..34 + 0: JS_NUMBER_LITERAL@32..34 "0" [Newline("\n")] [] + 1: COMMA@34..36 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@36..39 + 0: JS_NUMBER_LITERAL@36..39 "0.0" [] [] + 1: COMMA@39..41 "," [] [Whitespace(" ")] + 2: JS_BIGINT_LITERAL_EXPRESSION@41..43 + 0: JS_BIGINT_LITERAL@41..43 "0n" [] [] + 1: COMMA@43..45 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@45..49 + 0: JS_NUMBER_LITERAL@45..49 "0e00" [] [] + 1: (empty) + 8: JS_EXPRESSION_STATEMENT@49..67 + 0: JS_STRING_LITERAL_EXPRESSION@49..66 + 0: JS_STRING_LITERAL@49..66 "\"test\\\nnew-line\"" [Newline("\n")] [] + 1: SEMICOLON@66..67 ";" [] [] + 9: JS_EXPRESSION_STATEMENT@67..125 + 0: JS_REGEX_LITERAL_EXPRESSION@67..103 + 0: JS_REGEX_LITERAL@67..103 "/^[يفمئامئ\u{200d}ئاسۆند]/i" [Newline("\n")] [] + 1: SEMICOLON@103..125 ";" [] [Whitespace(" "), Comments("//regex with unicode")] + 10: JS_EXPRESSION_STATEMENT@125..151 + 0: JS_REGEX_LITERAL_EXPRESSION@125..150 + 0: JS_REGEX_LITERAL@125..150 "/[\\p{Control}--[\\t\\n]]/v" [Newline("\n")] [] + 1: SEMICOLON@150..151 ";" [] [] + 11: JS_EXPRESSION_STATEMENT@151..211 + 0: JS_REGEX_LITERAL_EXPRESSION@151..158 + 0: JS_REGEX_LITERAL@151..158 "/\\’/" [Newline("\n")] [] + 1: SEMICOLON@158..211 ";" [] [Whitespace(" "), Comments("// regex with escaped ...")] + 4: EOF@211..212 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/logical_expressions.js b/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/logical_expressions.js rename to crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js.snap new file mode 100644 index 000000000000..54bc7c1468bc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js.snap @@ -0,0 +1,116 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ?? bar +a || b +a && b + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "foo" [] [Whitespace(" ")], + }, + }, + operator_token: QUESTION2@4..7 "??" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..10 "bar" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..13 "a" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: PIPE2@13..16 "||" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "b" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..20 "a" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: AMP2@20..23 "&&" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..24 "b" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_EXPRESSION_STATEMENT@0..10 + 0: JS_LOGICAL_EXPRESSION@0..10 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "foo" [] [Whitespace(" ")] + 1: QUESTION2@4..7 "??" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@7..10 + 0: JS_REFERENCE_IDENTIFIER@7..10 + 0: IDENT@7..10 "bar" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@10..17 + 0: JS_LOGICAL_EXPRESSION@10..17 + 0: JS_IDENTIFIER_EXPRESSION@10..13 + 0: JS_REFERENCE_IDENTIFIER@10..13 + 0: IDENT@10..13 "a" [Newline("\n")] [Whitespace(" ")] + 1: PIPE2@13..16 "||" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "b" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@17..24 + 0: JS_LOGICAL_EXPRESSION@17..24 + 0: JS_IDENTIFIER_EXPRESSION@17..20 + 0: JS_REFERENCE_IDENTIFIER@17..20 + 0: IDENT@17..20 "a" [Newline("\n")] [Whitespace(" ")] + 1: AMP2@20..23 "&&" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@23..24 + 0: JS_REFERENCE_IDENTIFIER@23..24 + 0: IDENT@23..24 "b" [] [] + 1: (empty) + 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json new file mode 100644 index 000000000000..494df296546f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "gritMetavariables": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/metavar.ts b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/metavar.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts.snap new file mode 100644 index 000000000000..7bdd883cb99e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts.snap @@ -0,0 +1,403 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import µdefaultImport from µsource; +import { µnamedImport, type µnamedType } from µsource; + +µstatement; + +function foo() { + µstatement; + const bar = µexpression; +} + +class Foo { + µclassMember; +} + +const { µkey: key } = { µkey: µvalue }; + +function µfunctionName() {} + +type µType = µOtherType; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsMetavariable { + value_token: GRIT_METAVARIABLE@7..23 "µdefaultImport" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@23..28 "from" [] [Whitespace(" ")], + source: JsMetavariable { + value_token: GRIT_METAVARIABLE@28..36 "µsource" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsMetavariable { + value_token: GRIT_METAVARIABLE@47..60 "µnamedImport" [] [], + }, + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: TYPE_KW@62..67 "type" [] [Whitespace(" ")], + local_name: JsMetavariable { + value_token: GRIT_METAVARIABLE@67..79 "µnamedType" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@79..81 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@81..86 "from" [] [Whitespace(" ")], + source: JsMetavariable { + value_token: GRIT_METAVARIABLE@86..94 "µsource" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@94..95 ";" [] [], + }, + JsExpressionStatement { + expression: JsMetavariable { + value_token: GRIT_METAVARIABLE@95..108 "µstatement" [Newline("\n"), Newline("\n")] [], + }, + semicolon_token: SEMICOLON@108..109 ";" [] [], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@109..120 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@120..123 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@123..124 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@124..126 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@126..127 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsMetavariable { + value_token: GRIT_METAVARIABLE@127..143 "µstatement" [Newline("\n"), Whitespace(" ")] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@143..144 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@144..155 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@155..159 "bar" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@159..161 "=" [] [Whitespace(" ")], + expression: JsMetavariable { + value_token: GRIT_METAVARIABLE@161..173 "µexpression" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@173..174 ";" [] [], + }, + ], + r_curly_token: R_CURLY@174..176 "}" [Newline("\n")] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@176..184 "class" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@184..188 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@188..189 "{" [] [], + members: JsClassMemberList [ + JsMetavariable { + value_token: GRIT_METAVARIABLE@189..207 "µclassMember" [Newline("\n"), Whitespace(" ")] [], + }, + JsEmptyClassMember { + semicolon_token: SEMICOLON@207..208 ";" [] [], + }, + ], + r_curly_token: R_CURLY@208..210 "}" [Newline("\n")] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@210..218 "const" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@218..220 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsMetavariable { + value_token: GRIT_METAVARIABLE@220..225 "µkey" [] [], + }, + colon_token: COLON@225..227 ":" [] [Whitespace(" ")], + pattern: JsIdentifierBinding { + name_token: IDENT@227..231 "key" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@231..233 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@233..235 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@235..237 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsMetavariable { + value_token: GRIT_METAVARIABLE@237..242 "µkey" [] [], + }, + colon_token: COLON@242..244 ":" [] [Whitespace(" ")], + value: JsMetavariable { + value_token: GRIT_METAVARIABLE@244..252 "µvalue" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@252..253 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@253..254 ";" [] [], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@254..265 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsMetavariable { + value_token: GRIT_METAVARIABLE@265..279 "µfunctionName" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@279..280 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@280..282 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@282..283 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@283..284 "}" [] [], + }, + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@284..291 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")], + binding_identifier: JsMetavariable { + value_token: GRIT_METAVARIABLE@291..298 "µType" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@298..300 "=" [] [Whitespace(" ")], + ty: JsMetavariable { + value_token: GRIT_METAVARIABLE@300..311 "µOtherType" [] [], + }, + semicolon_token: SEMICOLON@311..312 ";" [] [], + }, + ], + eof_token: EOF@312..313 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..313 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..312 + 0: JS_IMPORT@0..37 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@7..36 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@7..23 + 0: JS_METAVARIABLE@7..23 + 0: GRIT_METAVARIABLE@7..23 "µdefaultImport" [] [Whitespace(" ")] + 2: FROM_KW@23..28 "from" [] [Whitespace(" ")] + 3: JS_METAVARIABLE@28..36 + 0: GRIT_METAVARIABLE@28..36 "µsource" [] [] + 4: (empty) + 2: SEMICOLON@36..37 ";" [] [] + 1: JS_IMPORT@37..95 + 0: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@45..94 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@45..81 + 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@47..79 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@47..60 + 0: (empty) + 1: JS_METAVARIABLE@47..60 + 0: GRIT_METAVARIABLE@47..60 "µnamedImport" [] [] + 1: COMMA@60..62 "," [] [Whitespace(" ")] + 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@62..79 + 0: TYPE_KW@62..67 "type" [] [Whitespace(" ")] + 1: JS_METAVARIABLE@67..79 + 0: GRIT_METAVARIABLE@67..79 "µnamedType" [] [Whitespace(" ")] + 2: R_CURLY@79..81 "}" [] [Whitespace(" ")] + 2: FROM_KW@81..86 "from" [] [Whitespace(" ")] + 3: JS_METAVARIABLE@86..94 + 0: GRIT_METAVARIABLE@86..94 "µsource" [] [] + 4: (empty) + 2: SEMICOLON@94..95 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@95..109 + 0: JS_METAVARIABLE@95..108 + 0: GRIT_METAVARIABLE@95..108 "µstatement" [Newline("\n"), Newline("\n")] [] + 1: SEMICOLON@108..109 ";" [] [] + 3: JS_FUNCTION_DECLARATION@109..176 + 0: (empty) + 1: FUNCTION_KW@109..120 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@120..123 + 0: IDENT@120..123 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@123..126 + 0: L_PAREN@123..124 "(" [] [] + 1: JS_PARAMETER_LIST@124..124 + 2: R_PAREN@124..126 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@126..176 + 0: L_CURLY@126..127 "{" [] [] + 1: JS_DIRECTIVE_LIST@127..127 + 2: JS_STATEMENT_LIST@127..174 + 0: JS_METAVARIABLE@127..143 + 0: GRIT_METAVARIABLE@127..143 "µstatement" [Newline("\n"), Whitespace(" ")] [] + 1: JS_EMPTY_STATEMENT@143..144 + 0: SEMICOLON@143..144 ";" [] [] + 2: JS_VARIABLE_STATEMENT@144..174 + 0: JS_VARIABLE_DECLARATION@144..173 + 0: (empty) + 1: CONST_KW@144..155 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@155..173 + 0: JS_VARIABLE_DECLARATOR@155..173 + 0: JS_IDENTIFIER_BINDING@155..159 + 0: IDENT@155..159 "bar" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@159..173 + 0: EQ@159..161 "=" [] [Whitespace(" ")] + 1: JS_METAVARIABLE@161..173 + 0: GRIT_METAVARIABLE@161..173 "µexpression" [] [] + 1: SEMICOLON@173..174 ";" [] [] + 3: R_CURLY@174..176 "}" [Newline("\n")] [] + 4: JS_CLASS_DECLARATION@176..210 + 0: JS_DECORATOR_LIST@176..176 + 1: (empty) + 2: CLASS_KW@176..184 "class" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@184..188 + 0: IDENT@184..188 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@188..189 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@189..208 + 0: JS_METAVARIABLE@189..207 + 0: GRIT_METAVARIABLE@189..207 "µclassMember" [Newline("\n"), Whitespace(" ")] [] + 1: JS_EMPTY_CLASS_MEMBER@207..208 + 0: SEMICOLON@207..208 ";" [] [] + 9: R_CURLY@208..210 "}" [Newline("\n")] [] + 5: JS_VARIABLE_STATEMENT@210..254 + 0: JS_VARIABLE_DECLARATION@210..253 + 0: (empty) + 1: CONST_KW@210..218 "const" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@218..253 + 0: JS_VARIABLE_DECLARATOR@218..253 + 0: JS_OBJECT_BINDING_PATTERN@218..233 + 0: L_CURLY@218..220 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@220..231 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@220..231 + 0: JS_METAVARIABLE@220..225 + 0: GRIT_METAVARIABLE@220..225 "µkey" [] [] + 1: COLON@225..227 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@227..231 + 0: IDENT@227..231 "key" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@231..233 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@233..253 + 0: EQ@233..235 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@235..253 + 0: L_CURLY@235..237 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@237..252 + 0: JS_PROPERTY_OBJECT_MEMBER@237..252 + 0: JS_METAVARIABLE@237..242 + 0: GRIT_METAVARIABLE@237..242 "µkey" [] [] + 1: COLON@242..244 ":" [] [Whitespace(" ")] + 2: JS_METAVARIABLE@244..252 + 0: GRIT_METAVARIABLE@244..252 "µvalue" [] [Whitespace(" ")] + 2: R_CURLY@252..253 "}" [] [] + 1: SEMICOLON@253..254 ";" [] [] + 6: JS_FUNCTION_DECLARATION@254..284 + 0: (empty) + 1: FUNCTION_KW@254..265 "function" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_METAVARIABLE@265..279 + 0: GRIT_METAVARIABLE@265..279 "µfunctionName" [] [] + 4: (empty) + 5: JS_PARAMETERS@279..282 + 0: L_PAREN@279..280 "(" [] [] + 1: JS_PARAMETER_LIST@280..280 + 2: R_PAREN@280..282 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@282..284 + 0: L_CURLY@282..283 "{" [] [] + 1: JS_DIRECTIVE_LIST@283..283 + 2: JS_STATEMENT_LIST@283..283 + 3: R_CURLY@283..284 "}" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@284..312 + 0: TYPE_KW@284..291 "type" [Newline("\n"), Newline("\n")] [Whitespace(" ")] + 1: JS_METAVARIABLE@291..298 + 0: GRIT_METAVARIABLE@291..298 "µType" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@298..300 "=" [] [Whitespace(" ")] + 4: JS_METAVARIABLE@300..311 + 0: GRIT_METAVARIABLE@300..311 "µOtherType" [] [] + 5: SEMICOLON@311..312 ";" [] [] + 4: EOF@312..313 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/method_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/method_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js.snap new file mode 100644 index 000000000000..6e3fa112d683 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js.snap @@ -0,0 +1,1133 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test { + method() {} + async asyncMethod() {} + async* asyncGeneratorMethod() {} + * generatorMethod() {} + "foo"() {} + ["foo" + "bar"]() {} + 5() {} + #private() {} +} +class ContextualKeywords { + // Methods called static + static() {} + async static() {} + * static() {} + async* static() {} + declare() {} + get() {} // Method called get + set() {} // Method called set +} +class Static { + static method() {} + static async asyncMethod() {} + static async* asyncGeneratorMethod() {} + static * generatorMethod() {} + static static() {} + static async static() {} + static async* static() {} + static * static() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@12..21 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@24..25 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@26..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@35..46 "asyncMethod" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@46..47 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@49..50 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@51..59 "async" [Newline("\n"), Whitespace(" ")] [], + star_token: STAR@59..61 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@61..81 "asyncGeneratorMethod" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@81..82 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@84..85 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: STAR@86..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@91..106 "generatorMethod" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@106..107 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@109..110 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@111..119 "\"foo\"" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@119..120 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@120..122 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@122..123 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@123..124 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsComputedMemberName { + l_brack_token: L_BRACK@124..128 "[" [Newline("\n"), Whitespace(" ")] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@128..134 "\"foo\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@134..136 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@136..141 "\"bar\"" [] [], + }, + }, + r_brack_token: R_BRACK@141..142 "]" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@142..143 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@143..145 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@145..146 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@146..147 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@147..151 "5" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@151..152 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@152..154 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@154..155 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@155..156 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsPrivateClassMemberName { + hash_token: HASH@156..160 "#" [Newline("\n"), Whitespace(" ")] [], + id_token: IDENT@160..167 "private" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@167..168 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@168..170 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@170..171 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@171..172 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@172..174 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@174..181 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@181..200 "ContextualKeywords" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@200..201 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@201..238 "static" [Newline("\n"), Whitespace(" "), Comments("// Methods called static"), Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@238..239 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@239..241 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@241..242 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@242..243 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@243..252 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@252..258 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@258..259 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@259..261 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@261..262 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@262..263 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: STAR@263..268 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@268..274 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@274..275 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@275..277 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@277..278 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@278..279 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@279..287 "async" [Newline("\n"), Whitespace(" ")] [], + star_token: STAR@287..289 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@289..295 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@295..296 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@296..298 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@298..299 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@299..300 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@300..310 "declare" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@310..311 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@311..313 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@313..314 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@314..315 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@315..321 "get" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@321..322 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@322..324 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@324..325 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@325..347 "}" [] [Whitespace(" "), Comments("// Method called get")], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@347..353 "set" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@353..354 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@354..356 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@356..357 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@357..379 "}" [] [Whitespace(" "), Comments("// Method called set")], + }, + }, + ], + r_curly_token: R_CURLY@379..381 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@381..388 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@388..395 "Static" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@395..396 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@396..406 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@406..412 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@412..413 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@413..415 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@415..416 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@416..417 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@417..427 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@427..433 "async" [] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@433..444 "asyncMethod" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@444..445 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@445..447 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@447..448 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@448..449 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@449..459 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@459..464 "async" [] [], + star_token: STAR@464..466 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@466..486 "asyncGeneratorMethod" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@486..487 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@487..489 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@489..490 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@490..491 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@491..501 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: STAR@501..503 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@503..518 "generatorMethod" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@518..519 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@519..521 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@521..522 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@522..523 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@523..533 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@533..539 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@539..540 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@540..542 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@542..543 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@543..544 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@544..554 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@554..560 "async" [] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@560..566 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@566..567 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@567..569 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@569..570 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@570..571 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@571..581 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@581..586 "async" [] [], + star_token: STAR@586..588 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@588..594 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@594..595 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@595..597 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@597..598 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@598..599 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@599..609 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: STAR@609..611 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@611..617 "static" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@617..618 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@618..620 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@620..621 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@621..622 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@622..624 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@624..625 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..625 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..624 + 0: JS_CLASS_DECLARATION@0..174 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..172 + 0: JS_METHOD_CLASS_MEMBER@12..26 + 0: JS_METHOD_MODIFIER_LIST@12..12 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@12..21 + 0: IDENT@12..21 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@21..24 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_PARAMETER_LIST@22..22 + 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@24..26 + 0: L_CURLY@24..25 "{" [] [] + 1: JS_DIRECTIVE_LIST@25..25 + 2: JS_STATEMENT_LIST@25..25 + 3: R_CURLY@25..26 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@26..51 + 0: JS_METHOD_MODIFIER_LIST@26..26 + 1: ASYNC_KW@26..35 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@35..46 + 0: IDENT@35..46 "asyncMethod" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@46..49 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_PARAMETER_LIST@47..47 + 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@49..51 + 0: L_CURLY@49..50 "{" [] [] + 1: JS_DIRECTIVE_LIST@50..50 + 2: JS_STATEMENT_LIST@50..50 + 3: R_CURLY@50..51 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@51..86 + 0: JS_METHOD_MODIFIER_LIST@51..51 + 1: ASYNC_KW@51..59 "async" [Newline("\n"), Whitespace(" ")] [] + 2: STAR@59..61 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@61..81 + 0: IDENT@61..81 "asyncGeneratorMethod" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@81..84 + 0: L_PAREN@81..82 "(" [] [] + 1: JS_PARAMETER_LIST@82..82 + 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@84..86 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_DIRECTIVE_LIST@85..85 + 2: JS_STATEMENT_LIST@85..85 + 3: R_CURLY@85..86 "}" [] [] + 3: JS_METHOD_CLASS_MEMBER@86..111 + 0: JS_METHOD_MODIFIER_LIST@86..86 + 1: (empty) + 2: STAR@86..91 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@91..106 + 0: IDENT@91..106 "generatorMethod" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@106..109 + 0: L_PAREN@106..107 "(" [] [] + 1: JS_PARAMETER_LIST@107..107 + 2: R_PAREN@107..109 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@109..111 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_DIRECTIVE_LIST@110..110 + 2: JS_STATEMENT_LIST@110..110 + 3: R_CURLY@110..111 "}" [] [] + 4: JS_METHOD_CLASS_MEMBER@111..124 + 0: JS_METHOD_MODIFIER_LIST@111..111 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@111..119 + 0: JS_STRING_LITERAL@111..119 "\"foo\"" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@119..122 + 0: L_PAREN@119..120 "(" [] [] + 1: JS_PARAMETER_LIST@120..120 + 2: R_PAREN@120..122 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@122..124 + 0: L_CURLY@122..123 "{" [] [] + 1: JS_DIRECTIVE_LIST@123..123 + 2: JS_STATEMENT_LIST@123..123 + 3: R_CURLY@123..124 "}" [] [] + 5: JS_METHOD_CLASS_MEMBER@124..147 + 0: JS_METHOD_MODIFIER_LIST@124..124 + 1: (empty) + 2: (empty) + 3: JS_COMPUTED_MEMBER_NAME@124..142 + 0: L_BRACK@124..128 "[" [Newline("\n"), Whitespace(" ")] [] + 1: JS_BINARY_EXPRESSION@128..141 + 0: JS_STRING_LITERAL_EXPRESSION@128..134 + 0: JS_STRING_LITERAL@128..134 "\"foo\"" [] [Whitespace(" ")] + 1: PLUS@134..136 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@136..141 + 0: JS_STRING_LITERAL@136..141 "\"bar\"" [] [] + 2: R_BRACK@141..142 "]" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@142..145 + 0: L_PAREN@142..143 "(" [] [] + 1: JS_PARAMETER_LIST@143..143 + 2: R_PAREN@143..145 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@145..147 + 0: L_CURLY@145..146 "{" [] [] + 1: JS_DIRECTIVE_LIST@146..146 + 2: JS_STATEMENT_LIST@146..146 + 3: R_CURLY@146..147 "}" [] [] + 6: JS_METHOD_CLASS_MEMBER@147..156 + 0: JS_METHOD_MODIFIER_LIST@147..147 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@147..151 + 0: JS_NUMBER_LITERAL@147..151 "5" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@151..154 + 0: L_PAREN@151..152 "(" [] [] + 1: JS_PARAMETER_LIST@152..152 + 2: R_PAREN@152..154 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@154..156 + 0: L_CURLY@154..155 "{" [] [] + 1: JS_DIRECTIVE_LIST@155..155 + 2: JS_STATEMENT_LIST@155..155 + 3: R_CURLY@155..156 "}" [] [] + 7: JS_METHOD_CLASS_MEMBER@156..172 + 0: JS_METHOD_MODIFIER_LIST@156..156 + 1: (empty) + 2: (empty) + 3: JS_PRIVATE_CLASS_MEMBER_NAME@156..167 + 0: HASH@156..160 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@160..167 "private" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@167..170 + 0: L_PAREN@167..168 "(" [] [] + 1: JS_PARAMETER_LIST@168..168 + 2: R_PAREN@168..170 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@170..172 + 0: L_CURLY@170..171 "{" [] [] + 1: JS_DIRECTIVE_LIST@171..171 + 2: JS_STATEMENT_LIST@171..171 + 3: R_CURLY@171..172 "}" [] [] + 9: R_CURLY@172..174 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@174..381 + 0: JS_DECORATOR_LIST@174..174 + 1: (empty) + 2: CLASS_KW@174..181 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@181..200 + 0: IDENT@181..200 "ContextualKeywords" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@200..201 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@201..379 + 0: JS_METHOD_CLASS_MEMBER@201..243 + 0: JS_METHOD_MODIFIER_LIST@201..201 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@201..238 + 0: IDENT@201..238 "static" [Newline("\n"), Whitespace(" "), Comments("// Methods called static"), Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@238..241 + 0: L_PAREN@238..239 "(" [] [] + 1: JS_PARAMETER_LIST@239..239 + 2: R_PAREN@239..241 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@241..243 + 0: L_CURLY@241..242 "{" [] [] + 1: JS_DIRECTIVE_LIST@242..242 + 2: JS_STATEMENT_LIST@242..242 + 3: R_CURLY@242..243 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@243..263 + 0: JS_METHOD_MODIFIER_LIST@243..243 + 1: ASYNC_KW@243..252 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@252..258 + 0: IDENT@252..258 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@258..261 + 0: L_PAREN@258..259 "(" [] [] + 1: JS_PARAMETER_LIST@259..259 + 2: R_PAREN@259..261 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@261..263 + 0: L_CURLY@261..262 "{" [] [] + 1: JS_DIRECTIVE_LIST@262..262 + 2: JS_STATEMENT_LIST@262..262 + 3: R_CURLY@262..263 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@263..279 + 0: JS_METHOD_MODIFIER_LIST@263..263 + 1: (empty) + 2: STAR@263..268 "*" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@268..274 + 0: IDENT@268..274 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@274..277 + 0: L_PAREN@274..275 "(" [] [] + 1: JS_PARAMETER_LIST@275..275 + 2: R_PAREN@275..277 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@277..279 + 0: L_CURLY@277..278 "{" [] [] + 1: JS_DIRECTIVE_LIST@278..278 + 2: JS_STATEMENT_LIST@278..278 + 3: R_CURLY@278..279 "}" [] [] + 3: JS_METHOD_CLASS_MEMBER@279..300 + 0: JS_METHOD_MODIFIER_LIST@279..279 + 1: ASYNC_KW@279..287 "async" [Newline("\n"), Whitespace(" ")] [] + 2: STAR@287..289 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@289..295 + 0: IDENT@289..295 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@295..298 + 0: L_PAREN@295..296 "(" [] [] + 1: JS_PARAMETER_LIST@296..296 + 2: R_PAREN@296..298 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@298..300 + 0: L_CURLY@298..299 "{" [] [] + 1: JS_DIRECTIVE_LIST@299..299 + 2: JS_STATEMENT_LIST@299..299 + 3: R_CURLY@299..300 "}" [] [] + 4: JS_METHOD_CLASS_MEMBER@300..315 + 0: JS_METHOD_MODIFIER_LIST@300..300 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@300..310 + 0: IDENT@300..310 "declare" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@310..313 + 0: L_PAREN@310..311 "(" [] [] + 1: JS_PARAMETER_LIST@311..311 + 2: R_PAREN@311..313 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@313..315 + 0: L_CURLY@313..314 "{" [] [] + 1: JS_DIRECTIVE_LIST@314..314 + 2: JS_STATEMENT_LIST@314..314 + 3: R_CURLY@314..315 "}" [] [] + 5: JS_METHOD_CLASS_MEMBER@315..347 + 0: JS_METHOD_MODIFIER_LIST@315..315 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@315..321 + 0: IDENT@315..321 "get" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@321..324 + 0: L_PAREN@321..322 "(" [] [] + 1: JS_PARAMETER_LIST@322..322 + 2: R_PAREN@322..324 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@324..347 + 0: L_CURLY@324..325 "{" [] [] + 1: JS_DIRECTIVE_LIST@325..325 + 2: JS_STATEMENT_LIST@325..325 + 3: R_CURLY@325..347 "}" [] [Whitespace(" "), Comments("// Method called get")] + 6: JS_METHOD_CLASS_MEMBER@347..379 + 0: JS_METHOD_MODIFIER_LIST@347..347 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@347..353 + 0: IDENT@347..353 "set" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@353..356 + 0: L_PAREN@353..354 "(" [] [] + 1: JS_PARAMETER_LIST@354..354 + 2: R_PAREN@354..356 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@356..379 + 0: L_CURLY@356..357 "{" [] [] + 1: JS_DIRECTIVE_LIST@357..357 + 2: JS_STATEMENT_LIST@357..357 + 3: R_CURLY@357..379 "}" [] [Whitespace(" "), Comments("// Method called set")] + 9: R_CURLY@379..381 "}" [Newline("\n")] [] + 2: JS_CLASS_DECLARATION@381..624 + 0: JS_DECORATOR_LIST@381..381 + 1: (empty) + 2: CLASS_KW@381..388 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@388..395 + 0: IDENT@388..395 "Static" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@395..396 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@396..622 + 0: JS_METHOD_CLASS_MEMBER@396..417 + 0: JS_METHOD_MODIFIER_LIST@396..406 + 0: JS_STATIC_MODIFIER@396..406 + 0: STATIC_KW@396..406 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@406..412 + 0: IDENT@406..412 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@412..415 + 0: L_PAREN@412..413 "(" [] [] + 1: JS_PARAMETER_LIST@413..413 + 2: R_PAREN@413..415 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@415..417 + 0: L_CURLY@415..416 "{" [] [] + 1: JS_DIRECTIVE_LIST@416..416 + 2: JS_STATEMENT_LIST@416..416 + 3: R_CURLY@416..417 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@417..449 + 0: JS_METHOD_MODIFIER_LIST@417..427 + 0: JS_STATIC_MODIFIER@417..427 + 0: STATIC_KW@417..427 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@427..433 "async" [] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@433..444 + 0: IDENT@433..444 "asyncMethod" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@444..447 + 0: L_PAREN@444..445 "(" [] [] + 1: JS_PARAMETER_LIST@445..445 + 2: R_PAREN@445..447 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@447..449 + 0: L_CURLY@447..448 "{" [] [] + 1: JS_DIRECTIVE_LIST@448..448 + 2: JS_STATEMENT_LIST@448..448 + 3: R_CURLY@448..449 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@449..491 + 0: JS_METHOD_MODIFIER_LIST@449..459 + 0: JS_STATIC_MODIFIER@449..459 + 0: STATIC_KW@449..459 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@459..464 "async" [] [] + 2: STAR@464..466 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@466..486 + 0: IDENT@466..486 "asyncGeneratorMethod" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@486..489 + 0: L_PAREN@486..487 "(" [] [] + 1: JS_PARAMETER_LIST@487..487 + 2: R_PAREN@487..489 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@489..491 + 0: L_CURLY@489..490 "{" [] [] + 1: JS_DIRECTIVE_LIST@490..490 + 2: JS_STATEMENT_LIST@490..490 + 3: R_CURLY@490..491 "}" [] [] + 3: JS_METHOD_CLASS_MEMBER@491..523 + 0: JS_METHOD_MODIFIER_LIST@491..501 + 0: JS_STATIC_MODIFIER@491..501 + 0: STATIC_KW@491..501 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: STAR@501..503 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@503..518 + 0: IDENT@503..518 "generatorMethod" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@518..521 + 0: L_PAREN@518..519 "(" [] [] + 1: JS_PARAMETER_LIST@519..519 + 2: R_PAREN@519..521 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@521..523 + 0: L_CURLY@521..522 "{" [] [] + 1: JS_DIRECTIVE_LIST@522..522 + 2: JS_STATEMENT_LIST@522..522 + 3: R_CURLY@522..523 "}" [] [] + 4: JS_METHOD_CLASS_MEMBER@523..544 + 0: JS_METHOD_MODIFIER_LIST@523..533 + 0: JS_STATIC_MODIFIER@523..533 + 0: STATIC_KW@523..533 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@533..539 + 0: IDENT@533..539 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@539..542 + 0: L_PAREN@539..540 "(" [] [] + 1: JS_PARAMETER_LIST@540..540 + 2: R_PAREN@540..542 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@542..544 + 0: L_CURLY@542..543 "{" [] [] + 1: JS_DIRECTIVE_LIST@543..543 + 2: JS_STATEMENT_LIST@543..543 + 3: R_CURLY@543..544 "}" [] [] + 5: JS_METHOD_CLASS_MEMBER@544..571 + 0: JS_METHOD_MODIFIER_LIST@544..554 + 0: JS_STATIC_MODIFIER@544..554 + 0: STATIC_KW@544..554 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@554..560 "async" [] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@560..566 + 0: IDENT@560..566 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@566..569 + 0: L_PAREN@566..567 "(" [] [] + 1: JS_PARAMETER_LIST@567..567 + 2: R_PAREN@567..569 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@569..571 + 0: L_CURLY@569..570 "{" [] [] + 1: JS_DIRECTIVE_LIST@570..570 + 2: JS_STATEMENT_LIST@570..570 + 3: R_CURLY@570..571 "}" [] [] + 6: JS_METHOD_CLASS_MEMBER@571..599 + 0: JS_METHOD_MODIFIER_LIST@571..581 + 0: JS_STATIC_MODIFIER@571..581 + 0: STATIC_KW@571..581 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@581..586 "async" [] [] + 2: STAR@586..588 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@588..594 + 0: IDENT@588..594 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@594..597 + 0: L_PAREN@594..595 "(" [] [] + 1: JS_PARAMETER_LIST@595..595 + 2: R_PAREN@595..597 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@597..599 + 0: L_CURLY@597..598 "{" [] [] + 1: JS_DIRECTIVE_LIST@598..598 + 2: JS_STATEMENT_LIST@598..598 + 3: R_CURLY@598..599 "}" [] [] + 7: JS_METHOD_CLASS_MEMBER@599..622 + 0: JS_METHOD_MODIFIER_LIST@599..609 + 0: JS_STATIC_MODIFIER@599..609 + 0: STATIC_KW@599..609 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: STAR@609..611 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@611..617 + 0: IDENT@611..617 "static" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@617..620 + 0: L_PAREN@617..618 "(" [] [] + 1: JS_PARAMETER_LIST@618..618 + 2: R_PAREN@618..620 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@620..622 + 0: L_CURLY@620..621 "{" [] [] + 1: JS_DIRECTIVE_LIST@621..621 + 2: JS_STATEMENT_LIST@621..621 + 3: R_CURLY@621..622 "}" [] [] + 9: R_CURLY@622..624 "}" [Newline("\n")] [] + 4: EOF@624..625 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/module.js b/crates/biome_js_parser/tests/js_test_suite/ok/module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/module.js rename to crates/biome_js_parser/tests/js_test_suite/ok/module.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/module.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/module.js.snap new file mode 100644 index 000000000000..bc5fce9ab72c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/module.js.snap @@ -0,0 +1,169 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import a from "b"; +export { a }; +c(); +import { c } from "c"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@7..9 "a" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@9..14 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@14..17 "\"b\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@18..26 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@26..28 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@28..30 "a" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@30..31 "}" [] [], + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..34 "c" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@34..35 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@35..36 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@47..49 "c" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@51..56 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@56..59 "\"c\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + ], + eof_token: EOF@60..61 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..61 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..60 + 0: JS_IMPORT@0..18 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@7..17 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@7..9 + 0: JS_IDENTIFIER_BINDING@7..9 + 0: IDENT@7..9 "a" [] [Whitespace(" ")] + 2: FROM_KW@9..14 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@14..17 + 0: JS_STRING_LITERAL@14..17 "\"b\"" [] [] + 4: (empty) + 2: SEMICOLON@17..18 ";" [] [] + 1: JS_EXPORT@18..32 + 0: JS_DECORATOR_LIST@18..18 + 1: EXPORT_KW@18..26 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@26..32 + 0: (empty) + 1: L_CURLY@26..28 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@28..30 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@28..30 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@28..30 + 0: IDENT@28..30 "a" [] [Whitespace(" ")] + 3: R_CURLY@30..31 "}" [] [] + 4: SEMICOLON@31..32 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@32..37 + 0: JS_CALL_EXPRESSION@32..36 + 0: JS_IDENTIFIER_EXPRESSION@32..34 + 0: JS_REFERENCE_IDENTIFIER@32..34 + 0: IDENT@32..34 "c" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@34..36 + 0: L_PAREN@34..35 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@35..35 + 2: R_PAREN@35..36 ")" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 3: JS_IMPORT@37..60 + 0: IMPORT_KW@37..45 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@45..59 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@45..51 + 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@47..49 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@47..49 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@47..49 + 0: IDENT@47..49 "c" [] [Whitespace(" ")] + 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] + 2: FROM_KW@51..56 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@56..59 + 0: JS_STRING_LITERAL@56..59 "\"c\"" [] [] + 4: (empty) + 2: SEMICOLON@59..60 ";" [] [] + 4: EOF@60..61 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/new_exprs.js b/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/new_exprs.js rename to crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js.snap new file mode 100644 index 000000000000..97f9a1e18f5d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js.snap @@ -0,0 +1,336 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +new Foo() +new foo; +new.target +new new new new Foo(); +new Foo(bar, baz, 6 + 6, foo[bar] + ((foo) => {}) * foo?.bar) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..7 "Foo" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@7..8 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@8..9 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@9..14 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..17 "foo" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsNewTargetExpression { + new_token: NEW_KW@18..22 "new" [Newline("\n")] [], + dot_token: DOT@22..23 "." [] [], + target_token: TARGET@23..29 "target" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@29..34 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsNewExpression { + new_token: NEW_KW@34..38 "new" [] [Whitespace(" ")], + callee: JsNewExpression { + new_token: NEW_KW@38..42 "new" [] [Whitespace(" ")], + callee: JsNewExpression { + new_token: NEW_KW@42..46 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..49 "Foo" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@49..50 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@50..51 ")" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + semicolon_token: SEMICOLON@51..52 ";" [] [], + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@52..57 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..60 "Foo" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@60..61 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@61..64 "bar" [] [], + }, + }, + COMMA@64..66 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@66..69 "baz" [] [], + }, + }, + COMMA@69..71 "," [] [Whitespace(" ")], + JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@71..73 "6" [] [Whitespace(" ")], + }, + operator_token: PLUS@73..75 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@75..76 "6" [] [], + }, + }, + COMMA@76..78 "," [] [Whitespace(" ")], + JsBinaryExpression { + left: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@78..81 "foo" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@81..82 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@82..85 "bar" [] [], + }, + }, + r_brack_token: R_BRACK@85..87 "]" [] [Whitespace(" ")], + }, + operator_token: PLUS@87..89 "+" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@89..90 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@90..91 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@91..94 "foo" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@94..96 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@96..99 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@99..100 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@100..101 "}" [] [], + }, + }, + r_paren_token: R_PAREN@101..103 ")" [] [Whitespace(" ")], + }, + operator_token: STAR@103..105 "*" [] [Whitespace(" ")], + right: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@105..108 "foo" [] [], + }, + }, + operator_token: QUESTIONDOT@108..110 "?." [] [], + member: JsName { + value_token: IDENT@110..113 "bar" [] [], + }, + }, + }, + }, + ], + r_paren_token: R_PAREN@113..114 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@114..115 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..115 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..114 + 0: JS_EXPRESSION_STATEMENT@0..9 + 0: JS_NEW_EXPRESSION@0..9 + 0: NEW_KW@0..4 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@4..7 + 0: JS_REFERENCE_IDENTIFIER@4..7 + 0: IDENT@4..7 "Foo" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@7..9 + 0: L_PAREN@7..8 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@8..8 + 2: R_PAREN@8..9 ")" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@9..18 + 0: JS_NEW_EXPRESSION@9..17 + 0: NEW_KW@9..14 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@14..17 + 0: JS_REFERENCE_IDENTIFIER@14..17 + 0: IDENT@14..17 "foo" [] [] + 2: (empty) + 3: (empty) + 1: SEMICOLON@17..18 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@18..29 + 0: JS_NEW_TARGET_EXPRESSION@18..29 + 0: NEW_KW@18..22 "new" [Newline("\n")] [] + 1: DOT@22..23 "." [] [] + 2: TARGET@23..29 "target" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@29..52 + 0: JS_NEW_EXPRESSION@29..51 + 0: NEW_KW@29..34 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@34..51 + 0: NEW_KW@34..38 "new" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@38..51 + 0: NEW_KW@38..42 "new" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@42..51 + 0: NEW_KW@42..46 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@46..49 + 0: JS_REFERENCE_IDENTIFIER@46..49 + 0: IDENT@46..49 "Foo" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@49..51 + 0: L_PAREN@49..50 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@50..50 + 2: R_PAREN@50..51 ")" [] [] + 2: (empty) + 3: (empty) + 2: (empty) + 3: (empty) + 2: (empty) + 3: (empty) + 1: SEMICOLON@51..52 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@52..114 + 0: JS_NEW_EXPRESSION@52..114 + 0: NEW_KW@52..57 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@57..60 + 0: JS_REFERENCE_IDENTIFIER@57..60 + 0: IDENT@57..60 "Foo" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@60..114 + 0: L_PAREN@60..61 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@61..113 + 0: JS_IDENTIFIER_EXPRESSION@61..64 + 0: JS_REFERENCE_IDENTIFIER@61..64 + 0: IDENT@61..64 "bar" [] [] + 1: COMMA@64..66 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@66..69 + 0: JS_REFERENCE_IDENTIFIER@66..69 + 0: IDENT@66..69 "baz" [] [] + 3: COMMA@69..71 "," [] [Whitespace(" ")] + 4: JS_BINARY_EXPRESSION@71..76 + 0: JS_NUMBER_LITERAL_EXPRESSION@71..73 + 0: JS_NUMBER_LITERAL@71..73 "6" [] [Whitespace(" ")] + 1: PLUS@73..75 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@75..76 + 0: JS_NUMBER_LITERAL@75..76 "6" [] [] + 5: COMMA@76..78 "," [] [Whitespace(" ")] + 6: JS_BINARY_EXPRESSION@78..113 + 0: JS_COMPUTED_MEMBER_EXPRESSION@78..87 + 0: JS_IDENTIFIER_EXPRESSION@78..81 + 0: JS_REFERENCE_IDENTIFIER@78..81 + 0: IDENT@78..81 "foo" [] [] + 1: (empty) + 2: L_BRACK@81..82 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@82..85 + 0: JS_REFERENCE_IDENTIFIER@82..85 + 0: IDENT@82..85 "bar" [] [] + 4: R_BRACK@85..87 "]" [] [Whitespace(" ")] + 1: PLUS@87..89 "+" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@89..113 + 0: JS_PARENTHESIZED_EXPRESSION@89..103 + 0: L_PAREN@89..90 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@90..101 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@90..96 + 0: L_PAREN@90..91 "(" [] [] + 1: JS_PARAMETER_LIST@91..94 + 0: JS_FORMAL_PARAMETER@91..94 + 0: JS_DECORATOR_LIST@91..91 + 1: JS_IDENTIFIER_BINDING@91..94 + 0: IDENT@91..94 "foo" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@94..96 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@96..99 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@99..101 + 0: L_CURLY@99..100 "{" [] [] + 1: JS_DIRECTIVE_LIST@100..100 + 2: JS_STATEMENT_LIST@100..100 + 3: R_CURLY@100..101 "}" [] [] + 2: R_PAREN@101..103 ")" [] [Whitespace(" ")] + 1: STAR@103..105 "*" [] [Whitespace(" ")] + 2: JS_STATIC_MEMBER_EXPRESSION@105..113 + 0: JS_IDENTIFIER_EXPRESSION@105..108 + 0: JS_REFERENCE_IDENTIFIER@105..108 + 0: IDENT@105..108 "foo" [] [] + 1: QUESTIONDOT@108..110 "?." [] [] + 2: JS_NAME@110..113 + 0: IDENT@110..113 "bar" [] [] + 2: R_PAREN@113..114 ")" [] [] + 1: (empty) + 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js.snap new file mode 100644 index 000000000000..5ac0706dd305 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js.snap @@ -0,0 +1,239 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({} = {}); +({ bar, baz } = {}); +({ bar: [baz = "baz"], foo = "foo", ...rest } = {}); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@1..2 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [], + r_curly_token: R_CURLY@2..4 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@4..6 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@6..7 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@7..8 "}" [] [], + }, + }, + r_paren_token: R_PAREN@8..9 ")" [] [], + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@10..12 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@12..14 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@14..17 "bar" [] [], + }, + init: missing (optional), + }, + COMMA@17..19 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@19..23 "baz" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@23..25 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@25..27 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@27..28 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + r_paren_token: R_PAREN@29..30 ")" [] [], + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@31..33 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@33..35 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@35..38 "bar" [] [], + }, + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + pattern: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@40..41 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@41..45 "baz" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@45..47 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@47..52 "\"baz\"" [] [], + }, + }, + }, + ], + r_brack_token: R_BRACK@52..53 "]" [] [], + }, + init: missing (optional), + }, + COMMA@53..55 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@55..59 "foo" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@59..61 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@61..66 "\"foo\"" [] [], + }, + }, + }, + COMMA@66..68 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@68..71 "..." [] [], + target: JsIdentifierAssignment { + name_token: IDENT@71..76 "rest" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@76..78 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@78..80 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@80..81 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@81..82 "}" [] [], + }, + }, + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: JS_EXPRESSION_STATEMENT@0..10 + 0: JS_PARENTHESIZED_EXPRESSION@0..9 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..8 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..4 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@2..2 + 2: R_CURLY@2..4 "}" [] [Whitespace(" ")] + 1: EQ@4..6 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@6..8 + 0: L_CURLY@6..7 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@7..7 + 2: R_CURLY@7..8 "}" [] [] + 2: R_PAREN@8..9 ")" [] [] + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@10..31 + 0: JS_PARENTHESIZED_EXPRESSION@10..30 + 0: L_PAREN@10..12 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@12..29 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@12..25 + 0: L_CURLY@12..14 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@14..23 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@14..17 + 0: JS_IDENTIFIER_ASSIGNMENT@14..17 + 0: IDENT@14..17 "bar" [] [] + 1: (empty) + 1: COMMA@17..19 "," [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@19..23 + 0: JS_IDENTIFIER_ASSIGNMENT@19..23 + 0: IDENT@19..23 "baz" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@23..25 "}" [] [Whitespace(" ")] + 1: EQ@25..27 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@27..29 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@28..28 + 2: R_CURLY@28..29 "}" [] [] + 2: R_PAREN@29..30 ")" [] [] + 1: SEMICOLON@30..31 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@31..84 + 0: JS_PARENTHESIZED_EXPRESSION@31..83 + 0: L_PAREN@31..33 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@33..82 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@33..78 + 0: L_CURLY@33..35 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@35..76 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@35..53 + 0: JS_LITERAL_MEMBER_NAME@35..38 + 0: IDENT@35..38 "bar" [] [] + 1: COLON@38..40 ":" [] [Whitespace(" ")] + 2: JS_ARRAY_ASSIGNMENT_PATTERN@40..53 + 0: L_BRACK@40..41 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@41..52 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@41..52 + 0: JS_IDENTIFIER_ASSIGNMENT@41..45 + 0: IDENT@41..45 "baz" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@45..52 + 0: EQ@45..47 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@47..52 + 0: JS_STRING_LITERAL@47..52 "\"baz\"" [] [] + 2: R_BRACK@52..53 "]" [] [] + 3: (empty) + 1: COMMA@53..55 "," [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@55..66 + 0: JS_IDENTIFIER_ASSIGNMENT@55..59 + 0: IDENT@55..59 "foo" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@59..66 + 0: EQ@59..61 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@61..66 + 0: JS_STRING_LITERAL@61..66 "\"foo\"" [] [] + 3: COMMA@66..68 "," [] [Whitespace(" ")] + 4: JS_OBJECT_ASSIGNMENT_PATTERN_REST@68..76 + 0: DOT3@68..71 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@71..76 + 0: IDENT@71..76 "rest" [] [Whitespace(" ")] + 2: R_CURLY@76..78 "}" [] [Whitespace(" ")] + 1: EQ@78..80 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@80..82 + 0: L_CURLY@80..81 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@81..81 + 2: R_CURLY@81..82 "}" [] [] + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js.snap new file mode 100644 index 000000000000..2e327afde979 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js.snap @@ -0,0 +1,126 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {}; +let b = {foo,} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@9..10 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@11..16 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@16..18 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@20..21 "{" [] [], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@21..24 "foo" [] [], + }, + }, + COMMA@24..25 "," [] [], + ], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@26..27 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..27 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..26 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..10 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..10 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..9 + 2: R_CURLY@9..10 "}" [] [] + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_VARIABLE_STATEMENT@11..26 + 0: JS_VARIABLE_DECLARATION@11..26 + 0: (empty) + 1: LET_KW@11..16 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@16..26 + 0: JS_VARIABLE_DECLARATOR@16..26 + 0: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@18..26 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@20..26 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@21..25 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@21..24 + 0: JS_REFERENCE_IDENTIFIER@21..24 + 0: IDENT@21..24 "foo" [] [] + 1: COMMA@24..25 "," [] [] + 2: R_CURLY@25..26 "}" [] [] + 1: (empty) + 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js.snap new file mode 100644 index 000000000000..7521e5bec0c7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js.snap @@ -0,0 +1,153 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + async foo() {}, + async *foo() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: ASYNC_KW@9..18 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@18..21 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@22..24 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@24..25 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + }, + COMMA@26..27 "," [] [], + JsMethodObjectMember { + async_token: ASYNC_KW@27..36 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: STAR@36..37 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@37..40 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@40..41 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@43..44 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@44..45 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@45..47 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_VARIABLE_STATEMENT@0..47 + 0: JS_VARIABLE_DECLARATION@0..47 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..47 + 0: JS_VARIABLE_DECLARATOR@4..47 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..47 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..47 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..45 + 0: JS_METHOD_OBJECT_MEMBER@9..26 + 0: ASYNC_KW@9..18 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@18..21 + 0: IDENT@18..21 "foo" [] [] + 3: (empty) + 4: JS_PARAMETERS@21..24 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_PARAMETER_LIST@22..22 + 2: R_PAREN@22..24 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@24..26 + 0: L_CURLY@24..25 "{" [] [] + 1: JS_DIRECTIVE_LIST@25..25 + 2: JS_STATEMENT_LIST@25..25 + 3: R_CURLY@25..26 "}" [] [] + 1: COMMA@26..27 "," [] [] + 2: JS_METHOD_OBJECT_MEMBER@27..45 + 0: ASYNC_KW@27..36 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: STAR@36..37 "*" [] [] + 2: JS_LITERAL_MEMBER_NAME@37..40 + 0: IDENT@37..40 "foo" [] [] + 3: (empty) + 4: JS_PARAMETERS@40..43 + 0: L_PAREN@40..41 "(" [] [] + 1: JS_PARAMETER_LIST@41..41 + 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@43..45 + 0: L_CURLY@43..44 "{" [] [] + 1: JS_DIRECTIVE_LIST@44..44 + 2: JS_STATEMENT_LIST@44..44 + 3: R_CURLY@44..45 "}" [] [] + 2: R_CURLY@45..47 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js.snap new file mode 100644 index 000000000000..9f4e1abb57d0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js.snap @@ -0,0 +1,112 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { *foo() {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: STAR@10..11 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@11..14 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@14..15 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_VARIABLE_STATEMENT@0..21 + 0: JS_VARIABLE_DECLARATION@0..21 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..21 + 0: JS_VARIABLE_DECLARATOR@4..21 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..21 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..21 + 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@10..20 + 0: JS_METHOD_OBJECT_MEMBER@10..20 + 0: (empty) + 1: STAR@10..11 "*" [] [] + 2: JS_LITERAL_MEMBER_NAME@11..14 + 0: IDENT@11..14 "foo" [] [] + 3: (empty) + 4: JS_PARAMETERS@14..17 + 0: L_PAREN@14..15 "(" [] [] + 1: JS_PARAMETER_LIST@15..15 + 2: R_PAREN@15..17 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@17..20 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..18 + 3: R_CURLY@18..20 "}" [] [Whitespace(" ")] + 2: R_CURLY@20..21 "}" [] [] + 1: (empty) + 4: EOF@21..22 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap new file mode 100644 index 000000000000..24c4ab43a9ad --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { a: true } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@10..11 "a" [] [], + }, + colon_token: COLON@11..13 ":" [] [Whitespace(" ")], + value: JsBooleanLiteralExpression { + value_token: TRUE_KW@13..18 "true" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..19 + 0: JS_VARIABLE_STATEMENT@0..19 + 0: JS_VARIABLE_DECLARATION@0..19 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..19 + 0: JS_VARIABLE_DECLARATOR@4..19 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..19 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..19 + 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@10..18 + 0: JS_PROPERTY_OBJECT_MEMBER@10..18 + 0: JS_LITERAL_MEMBER_NAME@10..11 + 0: IDENT@10..11 "a" [] [] + 1: COLON@11..13 ":" [] [Whitespace(" ")] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@13..18 + 0: TRUE_KW@13..18 "true" [] [Whitespace(" ")] + 2: R_CURLY@18..19 "}" [] [] + 1: (empty) + 4: EOF@19..20 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js.snap new file mode 100644 index 000000000000..0ed7cca6064f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js.snap @@ -0,0 +1,66 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({foo}) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..2 "{" [] [], + members: JsObjectMemberList [ + JsShorthandPropertyObjectMember { + name: JsReferenceIdentifier { + value_token: IDENT@2..5 "foo" [] [], + }, + }, + ], + r_curly_token: R_CURLY@5..6 "}" [] [], + }, + r_paren_token: R_PAREN@6..7 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@7..8 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..8 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..7 + 0: JS_EXPRESSION_STATEMENT@0..7 + 0: JS_PARENTHESIZED_EXPRESSION@0..7 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..6 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@2..5 + 0: JS_SHORTHAND_PROPERTY_OBJECT_MEMBER@2..5 + 0: JS_REFERENCE_IDENTIFIER@2..5 + 0: IDENT@2..5 "foo" [] [] + 2: R_CURLY@5..6 "}" [] [] + 2: R_PAREN@6..7 ")" [] [] + 1: (empty) + 4: EOF@7..8 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js.snap new file mode 100644 index 000000000000..81c48ff13642 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js.snap @@ -0,0 +1,333 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { + foo() {}, + "bar"(a, b, c) {}, + ["foo" + "bar"](a) {}, + 5(...rest) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@9..15 "foo" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@15..16 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@18..19 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@19..20 "}" [] [], + }, + }, + COMMA@20..21 "," [] [], + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@21..29 "\"bar\"" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@29..30 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@30..31 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@31..33 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@33..34 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@34..36 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@36..37 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@39..40 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + }, + COMMA@41..42 "," [] [], + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsComputedMemberName { + l_brack_token: L_BRACK@42..46 "[" [Newline("\n"), Whitespace(" ")] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@46..52 "\"foo\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@52..54 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@54..59 "\"bar\"" [] [], + }, + }, + r_brack_token: R_BRACK@59..60 "]" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@60..61 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@61..62 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@62..64 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@64..65 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@65..66 "}" [] [], + }, + }, + COMMA@66..67 "," [] [], + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@67..71 "5" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@71..72 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@72..75 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@75..79 "rest" [] [], + }, + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@79..81 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@81..82 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@82..83 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@83..85 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@85..86 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..86 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..85 + 0: JS_VARIABLE_STATEMENT@0..85 + 0: JS_VARIABLE_DECLARATION@0..85 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..85 + 0: JS_VARIABLE_DECLARATOR@4..85 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..85 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..85 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..83 + 0: JS_METHOD_OBJECT_MEMBER@9..20 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@9..15 + 0: IDENT@9..15 "foo" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@15..18 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_PARAMETER_LIST@16..16 + 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@18..20 + 0: L_CURLY@18..19 "{" [] [] + 1: JS_DIRECTIVE_LIST@19..19 + 2: JS_STATEMENT_LIST@19..19 + 3: R_CURLY@19..20 "}" [] [] + 1: COMMA@20..21 "," [] [] + 2: JS_METHOD_OBJECT_MEMBER@21..41 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@21..29 + 0: JS_STRING_LITERAL@21..29 "\"bar\"" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@29..39 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_PARAMETER_LIST@30..37 + 0: JS_FORMAL_PARAMETER@30..31 + 0: JS_DECORATOR_LIST@30..30 + 1: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@31..33 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@33..34 + 0: JS_DECORATOR_LIST@33..33 + 1: JS_IDENTIFIER_BINDING@33..34 + 0: IDENT@33..34 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@34..36 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@36..37 + 0: JS_DECORATOR_LIST@36..36 + 1: JS_IDENTIFIER_BINDING@36..37 + 0: IDENT@36..37 "c" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@39..41 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..40 + 3: R_CURLY@40..41 "}" [] [] + 3: COMMA@41..42 "," [] [] + 4: JS_METHOD_OBJECT_MEMBER@42..66 + 0: (empty) + 1: (empty) + 2: JS_COMPUTED_MEMBER_NAME@42..60 + 0: L_BRACK@42..46 "[" [Newline("\n"), Whitespace(" ")] [] + 1: JS_BINARY_EXPRESSION@46..59 + 0: JS_STRING_LITERAL_EXPRESSION@46..52 + 0: JS_STRING_LITERAL@46..52 "\"foo\"" [] [Whitespace(" ")] + 1: PLUS@52..54 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@54..59 + 0: JS_STRING_LITERAL@54..59 "\"bar\"" [] [] + 2: R_BRACK@59..60 "]" [] [] + 3: (empty) + 4: JS_PARAMETERS@60..64 + 0: L_PAREN@60..61 "(" [] [] + 1: JS_PARAMETER_LIST@61..62 + 0: JS_FORMAL_PARAMETER@61..62 + 0: JS_DECORATOR_LIST@61..61 + 1: JS_IDENTIFIER_BINDING@61..62 + 0: IDENT@61..62 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@62..64 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@64..66 + 0: L_CURLY@64..65 "{" [] [] + 1: JS_DIRECTIVE_LIST@65..65 + 2: JS_STATEMENT_LIST@65..65 + 3: R_CURLY@65..66 "}" [] [] + 5: COMMA@66..67 "," [] [] + 6: JS_METHOD_OBJECT_MEMBER@67..83 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@67..71 + 0: JS_NUMBER_LITERAL@67..71 "5" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@71..81 + 0: L_PAREN@71..72 "(" [] [] + 1: JS_PARAMETER_LIST@72..79 + 0: JS_REST_PARAMETER@72..79 + 0: JS_DECORATOR_LIST@72..72 + 1: DOT3@72..75 "..." [] [] + 2: JS_IDENTIFIER_BINDING@75..79 + 0: IDENT@75..79 "rest" [] [] + 3: (empty) + 2: R_PAREN@79..81 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@81..83 + 0: L_CURLY@81..82 "{" [] [] + 1: JS_DIRECTIVE_LIST@82..82 + 2: JS_STATEMENT_LIST@82..82 + 3: R_CURLY@82..83 "}" [] [] + 2: R_CURLY@83..85 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js.snap new file mode 100644 index 000000000000..62eb956f7806 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {...foo} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsSpread { + dotdotdot_token: DOT3@9..12 "..." [] [], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..15 "foo" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@15..16 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@16..17 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..17 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..16 + 0: JS_VARIABLE_STATEMENT@0..16 + 0: JS_VARIABLE_DECLARATION@0..16 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..16 + 0: JS_VARIABLE_DECLARATOR@4..16 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..16 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..16 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..15 + 0: JS_SPREAD@9..15 + 0: DOT3@9..12 "..." [] [] + 1: JS_IDENTIFIER_EXPRESSION@12..15 + 0: JS_REFERENCE_IDENTIFIER@12..15 + 0: IDENT@12..15 "foo" [] [] + 2: R_CURLY@15..16 "}" [] [] + 1: (empty) + 4: EOF@16..17 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_member_name.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_member_name.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js.snap new file mode 100644 index 000000000000..0fea340a876d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js.snap @@ -0,0 +1,171 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {"foo": foo, [6 + 6]: foo, bar: foo, 7: foo} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@9..14 "\"foo\"" [] [], + }, + colon_token: COLON@14..16 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..19 "foo" [] [], + }, + }, + }, + COMMA@19..21 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsComputedMemberName { + l_brack_token: L_BRACK@21..22 "[" [] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")], + }, + operator_token: PLUS@24..26 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@26..27 "6" [] [], + }, + }, + r_brack_token: R_BRACK@27..28 "]" [] [], + }, + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..33 "foo" [] [], + }, + }, + }, + COMMA@33..35 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@35..38 "bar" [] [], + }, + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..43 "foo" [] [], + }, + }, + }, + COMMA@43..45 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@45..46 "7" [] [], + }, + colon_token: COLON@46..48 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@48..51 "foo" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@52..53 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..53 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..52 + 0: JS_VARIABLE_STATEMENT@0..52 + 0: JS_VARIABLE_DECLARATION@0..52 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..52 + 0: JS_VARIABLE_DECLARATOR@4..52 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..52 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..52 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..51 + 0: JS_PROPERTY_OBJECT_MEMBER@9..19 + 0: JS_LITERAL_MEMBER_NAME@9..14 + 0: JS_STRING_LITERAL@9..14 "\"foo\"" [] [] + 1: COLON@14..16 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@16..19 + 0: JS_REFERENCE_IDENTIFIER@16..19 + 0: IDENT@16..19 "foo" [] [] + 1: COMMA@19..21 "," [] [Whitespace(" ")] + 2: JS_PROPERTY_OBJECT_MEMBER@21..33 + 0: JS_COMPUTED_MEMBER_NAME@21..28 + 0: L_BRACK@21..22 "[" [] [] + 1: JS_BINARY_EXPRESSION@22..27 + 0: JS_NUMBER_LITERAL_EXPRESSION@22..24 + 0: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")] + 1: PLUS@24..26 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@26..27 + 0: JS_NUMBER_LITERAL@26..27 "6" [] [] + 2: R_BRACK@27..28 "]" [] [] + 1: COLON@28..30 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@30..33 + 0: JS_REFERENCE_IDENTIFIER@30..33 + 0: IDENT@30..33 "foo" [] [] + 3: COMMA@33..35 "," [] [Whitespace(" ")] + 4: JS_PROPERTY_OBJECT_MEMBER@35..43 + 0: JS_LITERAL_MEMBER_NAME@35..38 + 0: IDENT@35..38 "bar" [] [] + 1: COLON@38..40 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@40..43 + 0: JS_REFERENCE_IDENTIFIER@40..43 + 0: IDENT@40..43 "foo" [] [] + 5: COMMA@43..45 "," [] [Whitespace(" ")] + 6: JS_PROPERTY_OBJECT_MEMBER@45..51 + 0: JS_LITERAL_MEMBER_NAME@45..46 + 0: JS_NUMBER_LITERAL@45..46 "7" [] [] + 1: COLON@46..48 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@48..51 + 0: JS_REFERENCE_IDENTIFIER@48..51 + 0: IDENT@48..51 "foo" [] [] + 2: R_CURLY@51..52 "}" [] [] + 1: (empty) + 4: EOF@52..53 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js.snap new file mode 100644 index 000000000000..1670ce03f670 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js.snap @@ -0,0 +1,101 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({ a: "x" in {} };;) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsObjectExpression { + l_curly_token: L_CURLY@5..7 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@7..8 "a" [] [], + }, + colon_token: COLON@8..10 ":" [] [Whitespace(" ")], + value: JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@10..14 "\"x\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@14..17 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@18..20 "}" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + first_semi_token: SEMICOLON@21..22 ";" [] [], + test: missing (optional), + second_semi_token: SEMICOLON@22..23 ";" [] [], + update: missing (optional), + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@25..26 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@26..27 "}" [] [], + }, + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: JS_FOR_STATEMENT@0..27 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_OBJECT_EXPRESSION@5..21 + 0: L_CURLY@5..7 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@7..20 + 0: JS_PROPERTY_OBJECT_MEMBER@7..20 + 0: JS_LITERAL_MEMBER_NAME@7..8 + 0: IDENT@7..8 "a" [] [] + 1: COLON@8..10 ":" [] [Whitespace(" ")] + 2: JS_IN_EXPRESSION@10..20 + 0: JS_STRING_LITERAL_EXPRESSION@10..14 + 0: JS_STRING_LITERAL@10..14 "\"x\"" [] [Whitespace(" ")] + 1: IN_KW@14..17 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@17..20 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@18..18 + 2: R_CURLY@18..20 "}" [] [Whitespace(" ")] + 2: R_CURLY@20..21 "}" [] [] + 3: SEMICOLON@21..22 ";" [] [] + 4: (empty) + 5: SEMICOLON@22..23 ";" [] [] + 6: (empty) + 7: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@25..27 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_STATEMENT_LIST@26..26 + 2: R_CURLY@26..27 "}" [] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_name.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_prop_name.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js.snap new file mode 100644 index 000000000000..0fea340a876d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js.snap @@ -0,0 +1,171 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {"foo": foo, [6 + 6]: foo, bar: foo, 7: foo} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@9..14 "\"foo\"" [] [], + }, + colon_token: COLON@14..16 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..19 "foo" [] [], + }, + }, + }, + COMMA@19..21 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsComputedMemberName { + l_brack_token: L_BRACK@21..22 "[" [] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")], + }, + operator_token: PLUS@24..26 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@26..27 "6" [] [], + }, + }, + r_brack_token: R_BRACK@27..28 "]" [] [], + }, + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..33 "foo" [] [], + }, + }, + }, + COMMA@33..35 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@35..38 "bar" [] [], + }, + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..43 "foo" [] [], + }, + }, + }, + COMMA@43..45 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@45..46 "7" [] [], + }, + colon_token: COLON@46..48 ":" [] [Whitespace(" ")], + value: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@48..51 "foo" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@52..53 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..53 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..52 + 0: JS_VARIABLE_STATEMENT@0..52 + 0: JS_VARIABLE_DECLARATION@0..52 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..52 + 0: JS_VARIABLE_DECLARATOR@4..52 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..52 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..52 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..51 + 0: JS_PROPERTY_OBJECT_MEMBER@9..19 + 0: JS_LITERAL_MEMBER_NAME@9..14 + 0: JS_STRING_LITERAL@9..14 "\"foo\"" [] [] + 1: COLON@14..16 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@16..19 + 0: JS_REFERENCE_IDENTIFIER@16..19 + 0: IDENT@16..19 "foo" [] [] + 1: COMMA@19..21 "," [] [Whitespace(" ")] + 2: JS_PROPERTY_OBJECT_MEMBER@21..33 + 0: JS_COMPUTED_MEMBER_NAME@21..28 + 0: L_BRACK@21..22 "[" [] [] + 1: JS_BINARY_EXPRESSION@22..27 + 0: JS_NUMBER_LITERAL_EXPRESSION@22..24 + 0: JS_NUMBER_LITERAL@22..24 "6" [] [Whitespace(" ")] + 1: PLUS@24..26 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@26..27 + 0: JS_NUMBER_LITERAL@26..27 "6" [] [] + 2: R_BRACK@27..28 "]" [] [] + 1: COLON@28..30 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@30..33 + 0: JS_REFERENCE_IDENTIFIER@30..33 + 0: IDENT@30..33 "foo" [] [] + 3: COMMA@33..35 "," [] [Whitespace(" ")] + 4: JS_PROPERTY_OBJECT_MEMBER@35..43 + 0: JS_LITERAL_MEMBER_NAME@35..38 + 0: IDENT@35..38 "bar" [] [] + 1: COLON@38..40 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@40..43 + 0: JS_REFERENCE_IDENTIFIER@40..43 + 0: IDENT@40..43 "foo" [] [] + 5: COMMA@43..45 "," [] [Whitespace(" ")] + 6: JS_PROPERTY_OBJECT_MEMBER@45..51 + 0: JS_LITERAL_MEMBER_NAME@45..46 + 0: JS_NUMBER_LITERAL@45..46 "7" [] [] + 1: COLON@46..48 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@48..51 + 0: JS_REFERENCE_IDENTIFIER@48..51 + 0: IDENT@48..51 "foo" [] [] + 2: R_CURLY@51..52 "}" [] [] + 1: (empty) + 4: EOF@52..53 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_property_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_property_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js.snap new file mode 100644 index 000000000000..088af8dc91a4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js.snap @@ -0,0 +1,170 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { foo: bar } = {} +let { foo: bar_bar = baz } = {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@6..9 "foo" [] [], + }, + colon_token: COLON@9..11 ":" [] [Whitespace(" ")], + pattern: JsIdentifierBinding { + name_token: IDENT@11..16 "bar" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@16..18 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@20..21 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@29..32 "foo" [] [], + }, + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + pattern: JsIdentifierBinding { + name_token: IDENT@34..42 "bar_bar" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..48 "baz" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + r_curly_token: R_CURLY@48..50 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@50..52 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@52..53 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@53..54 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_VARIABLE_STATEMENT@0..22 + 0: JS_VARIABLE_DECLARATION@0..22 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..22 + 0: JS_VARIABLE_DECLARATOR@4..22 + 0: JS_OBJECT_BINDING_PATTERN@4..18 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..16 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@6..16 + 0: JS_LITERAL_MEMBER_NAME@6..9 + 0: IDENT@6..9 "foo" [] [] + 1: COLON@9..11 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@11..16 + 0: IDENT@11..16 "bar" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@16..18 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@18..22 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@20..22 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@21..21 + 2: R_CURLY@21..22 "}" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@22..54 + 0: JS_VARIABLE_DECLARATION@22..54 + 0: (empty) + 1: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@27..54 + 0: JS_VARIABLE_DECLARATOR@27..54 + 0: JS_OBJECT_BINDING_PATTERN@27..50 + 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@29..48 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@29..48 + 0: JS_LITERAL_MEMBER_NAME@29..32 + 0: IDENT@29..32 "foo" [] [] + 1: COLON@32..34 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@34..42 + 0: IDENT@34..42 "bar_bar" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@42..48 + 0: EQ@42..44 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@44..48 + 0: JS_REFERENCE_IDENTIFIER@44..48 + 0: IDENT@44..48 "baz" [] [Whitespace(" ")] + 2: R_CURLY@48..50 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@50..54 + 0: EQ@50..52 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@52..54 + 0: L_CURLY@52..53 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@53..53 + 2: R_CURLY@53..54 "}" [] [] + 1: (empty) + 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js.snap new file mode 100644 index 000000000000..74d194e498f3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js.snap @@ -0,0 +1,202 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { a, b } = c +let { d = "default", e = call() } = c + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@6..7 "a" [] [], + }, + init: missing (optional), + }, + COMMA@7..9 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@9..11 "b" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@13..15 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@21..23 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@23..25 "d" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@25..27 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@27..36 "\"default\"" [] [], + }, + }, + }, + COMMA@36..38 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@38..40 "e" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..46 "call" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@46..47 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], + }, + }, + }, + }, + ], + r_curly_token: R_CURLY@49..51 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@51..53 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@53..54 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@54..55 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..55 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..54 + 0: JS_VARIABLE_STATEMENT@0..16 + 0: JS_VARIABLE_DECLARATION@0..16 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..16 + 0: JS_VARIABLE_DECLARATOR@4..16 + 0: JS_OBJECT_BINDING_PATTERN@4..13 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..11 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@6..7 + 0: JS_IDENTIFIER_BINDING@6..7 + 0: IDENT@6..7 "a" [] [] + 1: (empty) + 1: COMMA@7..9 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@9..11 + 0: JS_IDENTIFIER_BINDING@9..11 + 0: IDENT@9..11 "b" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@13..16 + 0: EQ@13..15 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "c" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@16..54 + 0: JS_VARIABLE_DECLARATION@16..54 + 0: (empty) + 1: LET_KW@16..21 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@21..54 + 0: JS_VARIABLE_DECLARATOR@21..54 + 0: JS_OBJECT_BINDING_PATTERN@21..51 + 0: L_CURLY@21..23 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@23..49 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@23..36 + 0: JS_IDENTIFIER_BINDING@23..25 + 0: IDENT@23..25 "d" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@25..36 + 0: EQ@25..27 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@27..36 + 0: JS_STRING_LITERAL@27..36 "\"default\"" [] [] + 1: COMMA@36..38 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@38..49 + 0: JS_IDENTIFIER_BINDING@38..40 + 0: IDENT@38..40 "e" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@40..49 + 0: EQ@40..42 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@42..49 + 0: JS_IDENTIFIER_EXPRESSION@42..46 + 0: JS_REFERENCE_IDENTIFIER@42..46 + 0: IDENT@42..46 "call" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@46..49 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@47..47 + 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] + 2: R_CURLY@49..51 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@51..54 + 0: EQ@51..53 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@53..54 + 0: JS_REFERENCE_IDENTIFIER@53..54 + 0: IDENT@53..54 "c" [] [] + 1: (empty) + 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.ts b/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap new file mode 100644 index 000000000000..aa4a5004f917 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap @@ -0,0 +1,156 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +String(item)?.b < 0; +String(item)?.b {}; +(5 + 5); +({foo, bar, b: [f, ...baz]}) => {}; +(foo, ...bar) => {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..4 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@4..5 ")" [] [], + }, + semicolon_token: SEMICOLON@5..6 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@6..8 "(" [Newline("\n")] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@8..11 "foo" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@16..17 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@17..18 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@19..21 "(" [Newline("\n")] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@21..23 "5" [] [Whitespace(" ")], + }, + operator_token: PLUS@23..25 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@25..26 "5" [] [], + }, + }, + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..30 "(" [Newline("\n")] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@30..31 "{" [] [], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@31..34 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@34..36 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@36..39 "bar" [] [], + }, + init: missing (optional), + }, + COMMA@39..41 "," [] [Whitespace(" ")], + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@41..42 "b" [] [], + }, + colon_token: COLON@42..44 ":" [] [Whitespace(" ")], + pattern: JsArrayBindingPattern { + l_brack_token: L_BRACK@44..45 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@45..46 "f" [] [], + }, + init: missing (optional), + }, + COMMA@46..48 "," [] [Whitespace(" ")], + JsArrayBindingPatternRestElement { + dotdotdot_token: DOT3@48..51 "..." [] [], + pattern: JsIdentifierBinding { + name_token: IDENT@51..54 "baz" [] [], + }, + }, + ], + r_brack_token: R_BRACK@54..55 "]" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@55..56 "}" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@61..62 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@64..66 "(" [Newline("\n")] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@66..69 "foo" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@69..71 "," [] [Whitespace(" ")], + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@71..74 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@74..77 "bar" [] [], + }, + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@77..79 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@82..83 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@83..84 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: JS_EXPRESSION_STATEMENT@0..6 + 0: JS_PARENTHESIZED_EXPRESSION@0..5 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@1..4 + 0: JS_REFERENCE_IDENTIFIER@1..4 + 0: IDENT@1..4 "foo" [] [] + 2: R_PAREN@4..5 ")" [] [] + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@6..19 + 0: JS_ARROW_FUNCTION_EXPRESSION@6..18 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@6..13 + 0: L_PAREN@6..8 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@8..11 + 0: JS_FORMAL_PARAMETER@8..11 + 0: JS_DECORATOR_LIST@8..8 + 1: JS_IDENTIFIER_BINDING@8..11 + 0: IDENT@8..11 "foo" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@16..18 + 0: L_CURLY@16..17 "{" [] [] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..17 + 3: R_CURLY@17..18 "}" [] [] + 1: SEMICOLON@18..19 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@19..28 + 0: JS_PARENTHESIZED_EXPRESSION@19..27 + 0: L_PAREN@19..21 "(" [Newline("\n")] [] + 1: JS_BINARY_EXPRESSION@21..26 + 0: JS_NUMBER_LITERAL_EXPRESSION@21..23 + 0: JS_NUMBER_LITERAL@21..23 "5" [] [Whitespace(" ")] + 1: PLUS@23..25 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@25..26 + 0: JS_NUMBER_LITERAL@25..26 "5" [] [] + 2: R_PAREN@26..27 ")" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@28..64 + 0: JS_ARROW_FUNCTION_EXPRESSION@28..63 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@28..58 + 0: L_PAREN@28..30 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@30..56 + 0: JS_FORMAL_PARAMETER@30..56 + 0: JS_DECORATOR_LIST@30..30 + 1: JS_OBJECT_BINDING_PATTERN@30..56 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@31..55 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@31..34 + 0: JS_IDENTIFIER_BINDING@31..34 + 0: IDENT@31..34 "foo" [] [] + 1: (empty) + 1: COMMA@34..36 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@36..39 + 0: JS_IDENTIFIER_BINDING@36..39 + 0: IDENT@36..39 "bar" [] [] + 1: (empty) + 3: COMMA@39..41 "," [] [Whitespace(" ")] + 4: JS_OBJECT_BINDING_PATTERN_PROPERTY@41..55 + 0: JS_LITERAL_MEMBER_NAME@41..42 + 0: IDENT@41..42 "b" [] [] + 1: COLON@42..44 ":" [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN@44..55 + 0: L_BRACK@44..45 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@45..54 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@45..46 + 0: JS_IDENTIFIER_BINDING@45..46 + 0: IDENT@45..46 "f" [] [] + 1: (empty) + 1: COMMA@46..48 "," [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN_REST_ELEMENT@48..54 + 0: DOT3@48..51 "..." [] [] + 1: JS_IDENTIFIER_BINDING@51..54 + 0: IDENT@51..54 "baz" [] [] + 2: R_BRACK@54..55 "]" [] [] + 3: (empty) + 2: R_CURLY@55..56 "}" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@58..61 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@61..63 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_DIRECTIVE_LIST@62..62 + 2: JS_STATEMENT_LIST@62..62 + 3: R_CURLY@62..63 "}" [] [] + 1: SEMICOLON@63..64 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@64..84 + 0: JS_ARROW_FUNCTION_EXPRESSION@64..84 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@64..79 + 0: L_PAREN@64..66 "(" [Newline("\n")] [] + 1: JS_PARAMETER_LIST@66..77 + 0: JS_FORMAL_PARAMETER@66..69 + 0: JS_DECORATOR_LIST@66..66 + 1: JS_IDENTIFIER_BINDING@66..69 + 0: IDENT@66..69 "foo" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@69..71 "," [] [Whitespace(" ")] + 2: JS_REST_PARAMETER@71..77 + 0: JS_DECORATOR_LIST@71..71 + 1: DOT3@71..74 "..." [] [] + 2: JS_IDENTIFIER_BINDING@74..77 + 0: IDENT@74..77 "bar" [] [] + 3: (empty) + 2: R_PAREN@77..79 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@82..84 + 0: L_CURLY@82..83 "{" [] [] + 1: JS_DIRECTIVE_LIST@83..83 + 2: JS_STATEMENT_LIST@83..83 + 3: R_CURLY@83..84 "}" [] [] + 1: (empty) + 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap new file mode 100644 index 000000000000..4956f3edd713 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap @@ -0,0 +1,334 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(a, b); +(a, b, c); +(a, b, c, d, e, f); +(a, b, c, d, e, f) +(a, b, c) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..2 "a" [] [], + }, + }, + comma_token: COMMA@2..4 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@4..5 "b" [] [], + }, + }, + }, + r_paren_token: R_PAREN@5..6 ")" [] [], + }, + semicolon_token: SEMICOLON@6..7 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@7..9 "(" [Newline("\n")] [], + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..10 "a" [] [], + }, + }, + comma_token: COMMA@10..12 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@12..13 "b" [] [], + }, + }, + }, + comma_token: COMMA@13..15 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@16..17 ")" [] [], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@20..21 "a" [] [], + }, + }, + comma_token: COMMA@21..23 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..24 "b" [] [], + }, + }, + }, + comma_token: COMMA@24..26 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..27 "c" [] [], + }, + }, + }, + comma_token: COMMA@27..29 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@29..30 "d" [] [], + }, + }, + }, + comma_token: COMMA@30..32 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..33 "e" [] [], + }, + }, + }, + comma_token: COMMA@33..35 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "f" [] [], + }, + }, + }, + r_paren_token: R_PAREN@36..37 ")" [] [], + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@38..40 "(" [Newline("\n")] [], + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..41 "a" [] [], + }, + }, + comma_token: COMMA@41..43 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@43..44 "b" [] [], + }, + }, + }, + comma_token: COMMA@44..46 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..47 "c" [] [], + }, + }, + }, + comma_token: COMMA@47..49 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..50 "d" [] [], + }, + }, + }, + comma_token: COMMA@50..52 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@52..53 "e" [] [], + }, + }, + }, + comma_token: COMMA@53..55 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..56 "f" [] [], + }, + }, + }, + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@57..59 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..60 "a" [] [], + }, + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@62..63 "b" [] [], + }, + }, + COMMA@63..65 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@65..66 "c" [] [], + }, + }, + ], + r_paren_token: R_PAREN@66..67 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: JS_EXPRESSION_STATEMENT@0..7 + 0: JS_PARENTHESIZED_EXPRESSION@0..6 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@1..5 + 0: JS_IDENTIFIER_EXPRESSION@1..2 + 0: JS_REFERENCE_IDENTIFIER@1..2 + 0: IDENT@1..2 "a" [] [] + 1: COMMA@2..4 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@4..5 + 0: JS_REFERENCE_IDENTIFIER@4..5 + 0: IDENT@4..5 "b" [] [] + 2: R_PAREN@5..6 ")" [] [] + 1: SEMICOLON@6..7 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@7..18 + 0: JS_PARENTHESIZED_EXPRESSION@7..17 + 0: L_PAREN@7..9 "(" [Newline("\n")] [] + 1: JS_SEQUENCE_EXPRESSION@9..16 + 0: JS_SEQUENCE_EXPRESSION@9..13 + 0: JS_IDENTIFIER_EXPRESSION@9..10 + 0: JS_REFERENCE_IDENTIFIER@9..10 + 0: IDENT@9..10 "a" [] [] + 1: COMMA@10..12 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@12..13 + 0: JS_REFERENCE_IDENTIFIER@12..13 + 0: IDENT@12..13 "b" [] [] + 1: COMMA@13..15 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "c" [] [] + 2: R_PAREN@16..17 ")" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@18..38 + 0: JS_PARENTHESIZED_EXPRESSION@18..37 + 0: L_PAREN@18..20 "(" [Newline("\n")] [] + 1: JS_SEQUENCE_EXPRESSION@20..36 + 0: JS_SEQUENCE_EXPRESSION@20..33 + 0: JS_SEQUENCE_EXPRESSION@20..30 + 0: JS_SEQUENCE_EXPRESSION@20..27 + 0: JS_SEQUENCE_EXPRESSION@20..24 + 0: JS_IDENTIFIER_EXPRESSION@20..21 + 0: JS_REFERENCE_IDENTIFIER@20..21 + 0: IDENT@20..21 "a" [] [] + 1: COMMA@21..23 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@23..24 + 0: JS_REFERENCE_IDENTIFIER@23..24 + 0: IDENT@23..24 "b" [] [] + 1: COMMA@24..26 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@26..27 + 0: JS_REFERENCE_IDENTIFIER@26..27 + 0: IDENT@26..27 "c" [] [] + 1: COMMA@27..29 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@29..30 + 0: JS_REFERENCE_IDENTIFIER@29..30 + 0: IDENT@29..30 "d" [] [] + 1: COMMA@30..32 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@32..33 + 0: JS_REFERENCE_IDENTIFIER@32..33 + 0: IDENT@32..33 "e" [] [] + 1: COMMA@33..35 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "f" [] [] + 2: R_PAREN@36..37 ")" [] [] + 1: SEMICOLON@37..38 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@38..67 + 0: JS_CALL_EXPRESSION@38..67 + 0: JS_PARENTHESIZED_EXPRESSION@38..57 + 0: L_PAREN@38..40 "(" [Newline("\n")] [] + 1: JS_SEQUENCE_EXPRESSION@40..56 + 0: JS_SEQUENCE_EXPRESSION@40..53 + 0: JS_SEQUENCE_EXPRESSION@40..50 + 0: JS_SEQUENCE_EXPRESSION@40..47 + 0: JS_SEQUENCE_EXPRESSION@40..44 + 0: JS_IDENTIFIER_EXPRESSION@40..41 + 0: JS_REFERENCE_IDENTIFIER@40..41 + 0: IDENT@40..41 "a" [] [] + 1: COMMA@41..43 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@43..44 + 0: JS_REFERENCE_IDENTIFIER@43..44 + 0: IDENT@43..44 "b" [] [] + 1: COMMA@44..46 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@46..47 + 0: JS_REFERENCE_IDENTIFIER@46..47 + 0: IDENT@46..47 "c" [] [] + 1: COMMA@47..49 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@49..50 + 0: JS_REFERENCE_IDENTIFIER@49..50 + 0: IDENT@49..50 "d" [] [] + 1: COMMA@50..52 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@52..53 + 0: JS_REFERENCE_IDENTIFIER@52..53 + 0: IDENT@52..53 "e" [] [] + 1: COMMA@53..55 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@55..56 + 0: JS_REFERENCE_IDENTIFIER@55..56 + 0: IDENT@55..56 "f" [] [] + 2: R_PAREN@56..57 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@57..67 + 0: L_PAREN@57..59 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@59..66 + 0: JS_IDENTIFIER_EXPRESSION@59..60 + 0: JS_REFERENCE_IDENTIFIER@59..60 + 0: IDENT@59..60 "a" [] [] + 1: COMMA@60..62 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@62..63 + 0: JS_REFERENCE_IDENTIFIER@62..63 + 0: IDENT@62..63 "b" [] [] + 3: COMMA@63..65 "," [] [Whitespace(" ")] + 4: JS_IDENTIFIER_EXPRESSION@65..66 + 0: JS_REFERENCE_IDENTIFIER@65..66 + 0: IDENT@65..66 "c" [] [] + 2: R_PAREN@66..67 ")" [] [] + 1: (empty) + 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.js b/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.js rename to crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap new file mode 100644 index 000000000000..e51b148724fc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap @@ -0,0 +1,107 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ([a = "a" in {}] in []) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForInStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@5..6 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@6..8 "a" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsInExpression { + property: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@10..14 "\"a\"" [] [Whitespace(" ")], + }, + in_token: IN_KW@14..17 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + }, + }, + }, + ], + r_brack_token: R_BRACK@19..21 "]" [] [Whitespace(" ")], + }, + in_token: IN_KW@21..24 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@24..25 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@25..26 "]" [] [], + }, + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@28..29 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_FOR_IN_STATEMENT@0..30 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_ARRAY_ASSIGNMENT_PATTERN@5..21 + 0: L_BRACK@5..6 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@6..19 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@6..19 + 0: JS_IDENTIFIER_ASSIGNMENT@6..8 + 0: IDENT@6..8 "a" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@8..19 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_IN_EXPRESSION@10..19 + 0: JS_STRING_LITERAL_EXPRESSION@10..14 + 0: JS_STRING_LITERAL@10..14 "\"a\"" [] [Whitespace(" ")] + 1: IN_KW@14..17 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@18..18 + 2: R_CURLY@18..19 "}" [] [] + 2: R_BRACK@19..21 "]" [] [Whitespace(" ")] + 3: IN_KW@21..24 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@24..26 + 0: L_BRACK@24..25 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@25..25 + 2: R_BRACK@25..26 "]" [] [] + 5: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@28..30 + 0: L_CURLY@28..29 "{" [] [] + 1: JS_STATEMENT_LIST@29..29 + 2: R_CURLY@29..30 "}" [] [] + 4: EOF@30..31 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/post_update_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/post_update_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js.snap new file mode 100644 index 000000000000..8a80c03b8d9f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js.snap @@ -0,0 +1,67 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo++ +foo-- + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@0..3 "foo" [] [], + }, + operator_token: PLUS2@3..5 "++" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@5..9 "foo" [Newline("\n")] [], + }, + operator_token: MINUS2@9..11 "--" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_EXPRESSION_STATEMENT@0..5 + 0: JS_POST_UPDATE_EXPRESSION@0..5 + 0: JS_IDENTIFIER_ASSIGNMENT@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: PLUS2@3..5 "++" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@5..11 + 0: JS_POST_UPDATE_EXPRESSION@5..11 + 0: JS_IDENTIFIER_ASSIGNMENT@5..9 + 0: IDENT@5..9 "foo" [Newline("\n")] [] + 1: MINUS2@9..11 "--" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/postfix_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/postfix_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js.snap new file mode 100644 index 000000000000..8a80c03b8d9f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js.snap @@ -0,0 +1,67 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo++ +foo-- + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@0..3 "foo" [] [], + }, + operator_token: PLUS2@3..5 "++" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsPostUpdateExpression { + operand: JsIdentifierAssignment { + name_token: IDENT@5..9 "foo" [Newline("\n")] [], + }, + operator_token: MINUS2@9..11 "--" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_EXPRESSION_STATEMENT@0..5 + 0: JS_POST_UPDATE_EXPRESSION@0..5 + 0: JS_IDENTIFIER_ASSIGNMENT@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: PLUS2@3..5 "++" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@5..11 + 0: JS_POST_UPDATE_EXPRESSION@5..11 + 0: JS_IDENTIFIER_ASSIGNMENT@5..9 + 0: IDENT@5..9 "foo" [Newline("\n")] [] + 1: MINUS2@9..11 "--" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/pre_update_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js.snap new file mode 100644 index 000000000000..6130e85e8deb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js.snap @@ -0,0 +1,67 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +++foo +--foo + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsPreUpdateExpression { + operator_token: PLUS2@0..2 "++" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@2..5 "foo" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsPreUpdateExpression { + operator_token: MINUS2@5..8 "--" [Newline("\n")] [], + operand: JsIdentifierAssignment { + name_token: IDENT@8..11 "foo" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_EXPRESSION_STATEMENT@0..5 + 0: JS_PRE_UPDATE_EXPRESSION@0..5 + 0: PLUS2@0..2 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@2..5 + 0: IDENT@2..5 "foo" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@5..11 + 0: JS_PRE_UPDATE_EXPRESSION@5..11 + 0: MINUS2@5..8 "--" [Newline("\n")] [] + 1: JS_IDENTIFIER_ASSIGNMENT@8..11 + 0: IDENT@8..11 "foo" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.js b/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.js rename to crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js.snap new file mode 100644 index 000000000000..15f2a2c8bb58 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js.snap @@ -0,0 +1,149 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + #prop; + test() { + #prop in this + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [], + id_token: IDENT@12..16 "prop" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsInExpression { + property: JsPrivateName { + hash_token: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [], + value_token: IDENT@32..37 "prop" [] [Whitespace(" ")], + }, + in_token: IN_KW@37..40 "in" [] [Whitespace(" ")], + object: JsThisExpression { + this_token: THIS_KW@40..44 "this" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@44..47 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@47..49 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_CLASS_DECLARATION@0..49 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..47 + 0: JS_PROPERTY_CLASS_MEMBER@9..17 + 0: JS_PROPERTY_MODIFIER_LIST@9..9 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@9..16 + 0: HASH@9..12 "#" [Newline("\n"), Whitespace("\t")] [] + 1: IDENT@12..16 "prop" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@16..17 ";" [] [] + 1: JS_METHOD_CLASS_MEMBER@17..47 + 0: JS_METHOD_MODIFIER_LIST@17..17 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@17..23 + 0: IDENT@17..23 "test" [Newline("\n"), Whitespace("\t")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@26..47 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..44 + 0: JS_EXPRESSION_STATEMENT@27..44 + 0: JS_IN_EXPRESSION@27..44 + 0: JS_PRIVATE_NAME@27..37 + 0: HASH@27..32 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@32..37 "prop" [] [Whitespace(" ")] + 1: IN_KW@37..40 "in" [] [Whitespace(" ")] + 2: JS_THIS_EXPRESSION@40..44 + 0: THIS_KW@40..44 "this" [] [] + 1: (empty) + 3: R_CURLY@44..47 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@47..49 "}" [Newline("\n")] [] + 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/property_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js.snap new file mode 100644 index 000000000000..a37f8ada6851 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js.snap @@ -0,0 +1,566 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({x}= {}); +({x: y}= {}); +({x: y.test().z}= {}); +({x: ((z))}= {}); +({x: z["computed"]}= {}); +({x = "default"}= {}); +({x: y = "default"}= {}); +({0: y, [computed]: z} = {}); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@1..2 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@2..3 "x" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@3..4 "}" [] [], + }, + operator_token: EQ@4..6 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@6..7 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@7..8 "}" [] [], + }, + }, + r_paren_token: R_PAREN@8..9 ")" [] [], + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@10..12 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@12..13 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@13..14 "x" [] [], + }, + colon_token: COLON@14..16 ":" [] [Whitespace(" ")], + pattern: JsIdentifierAssignment { + name_token: IDENT@16..17 "y" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@17..18 "}" [] [], + }, + operator_token: EQ@18..20 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@20..21 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + r_paren_token: R_PAREN@22..23 ")" [] [], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@24..26 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@26..27 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@27..28 "x" [] [], + }, + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + pattern: JsStaticMemberAssignment { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..31 "y" [] [], + }, + }, + operator_token: DOT@31..32 "." [] [], + member: JsName { + value_token: IDENT@32..36 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@36..37 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@37..38 ")" [] [], + }, + }, + dot_token: DOT@38..39 "." [] [], + member: JsName { + value_token: IDENT@39..40 "z" [] [], + }, + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + operator_token: EQ@41..43 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@43..44 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@44..45 "}" [] [], + }, + }, + r_paren_token: R_PAREN@45..46 ")" [] [], + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@47..49 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@49..50 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@50..51 "x" [] [], + }, + colon_token: COLON@51..53 ":" [] [Whitespace(" ")], + pattern: JsParenthesizedAssignment { + l_paren_token: L_PAREN@53..54 "(" [] [], + assignment: JsParenthesizedAssignment { + l_paren_token: L_PAREN@54..55 "(" [] [], + assignment: JsIdentifierAssignment { + name_token: IDENT@55..56 "z" [] [], + }, + r_paren_token: R_PAREN@56..57 ")" [] [], + }, + r_paren_token: R_PAREN@57..58 ")" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@58..59 "}" [] [], + }, + operator_token: EQ@59..61 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@61..62 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + }, + r_paren_token: R_PAREN@63..64 ")" [] [], + }, + semicolon_token: SEMICOLON@64..65 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@65..67 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@67..68 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@68..69 "x" [] [], + }, + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + pattern: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@71..72 "z" [] [], + }, + }, + l_brack_token: L_BRACK@72..73 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@73..83 "\"computed\"" [] [], + }, + r_brack_token: R_BRACK@83..84 "]" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@84..85 "}" [] [], + }, + operator_token: EQ@85..87 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@87..88 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@88..89 "}" [] [], + }, + }, + r_paren_token: R_PAREN@89..90 ")" [] [], + }, + semicolon_token: SEMICOLON@90..91 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@91..93 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@93..94 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternShorthandProperty { + identifier: JsIdentifierAssignment { + name_token: IDENT@94..96 "x" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@96..98 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@98..107 "\"default\"" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@107..108 "}" [] [], + }, + operator_token: EQ@108..110 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@110..111 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@111..112 "}" [] [], + }, + }, + r_paren_token: R_PAREN@112..113 ")" [] [], + }, + semicolon_token: SEMICOLON@113..114 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@114..116 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@116..117 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@117..118 "x" [] [], + }, + colon_token: COLON@118..120 ":" [] [Whitespace(" ")], + pattern: JsIdentifierAssignment { + name_token: IDENT@120..122 "y" [] [Whitespace(" ")], + }, + init: JsInitializerClause { + eq_token: EQ@122..124 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@124..133 "\"default\"" [] [], + }, + }, + }, + ], + r_curly_token: R_CURLY@133..134 "}" [] [], + }, + operator_token: EQ@134..136 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@136..137 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@137..138 "}" [] [], + }, + }, + r_paren_token: R_PAREN@138..139 ")" [] [], + }, + semicolon_token: SEMICOLON@139..140 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@140..142 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@142..143 "{" [] [], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@143..144 "0" [] [], + }, + colon_token: COLON@144..146 ":" [] [Whitespace(" ")], + pattern: JsIdentifierAssignment { + name_token: IDENT@146..147 "y" [] [], + }, + init: missing (optional), + }, + COMMA@147..149 "," [] [Whitespace(" ")], + JsObjectAssignmentPatternProperty { + member: JsComputedMemberName { + l_brack_token: L_BRACK@149..150 "[" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@150..158 "computed" [] [], + }, + }, + r_brack_token: R_BRACK@158..159 "]" [] [], + }, + colon_token: COLON@159..161 ":" [] [Whitespace(" ")], + pattern: JsIdentifierAssignment { + name_token: IDENT@161..162 "z" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@162..164 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@164..166 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@166..167 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@167..168 "}" [] [], + }, + }, + r_paren_token: R_PAREN@168..169 ")" [] [], + }, + semicolon_token: SEMICOLON@169..170 ";" [] [], + }, + ], + eof_token: EOF@170..171 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..171 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..170 + 0: JS_EXPRESSION_STATEMENT@0..10 + 0: JS_PARENTHESIZED_EXPRESSION@0..9 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..8 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..4 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@2..3 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@2..3 + 0: JS_IDENTIFIER_ASSIGNMENT@2..3 + 0: IDENT@2..3 "x" [] [] + 1: (empty) + 2: R_CURLY@3..4 "}" [] [] + 1: EQ@4..6 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@6..8 + 0: L_CURLY@6..7 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@7..7 + 2: R_CURLY@7..8 "}" [] [] + 2: R_PAREN@8..9 ")" [] [] + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@10..24 + 0: JS_PARENTHESIZED_EXPRESSION@10..23 + 0: L_PAREN@10..12 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@12..22 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@12..18 + 0: L_CURLY@12..13 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@13..17 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@13..17 + 0: JS_LITERAL_MEMBER_NAME@13..14 + 0: IDENT@13..14 "x" [] [] + 1: COLON@14..16 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_ASSIGNMENT@16..17 + 0: IDENT@16..17 "y" [] [] + 3: (empty) + 2: R_CURLY@17..18 "}" [] [] + 1: EQ@18..20 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@20..22 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@21..21 + 2: R_CURLY@21..22 "}" [] [] + 2: R_PAREN@22..23 ")" [] [] + 1: SEMICOLON@23..24 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@24..47 + 0: JS_PARENTHESIZED_EXPRESSION@24..46 + 0: L_PAREN@24..26 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@26..45 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@26..41 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@27..40 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@27..40 + 0: JS_LITERAL_MEMBER_NAME@27..28 + 0: IDENT@27..28 "x" [] [] + 1: COLON@28..30 ":" [] [Whitespace(" ")] + 2: JS_STATIC_MEMBER_ASSIGNMENT@30..40 + 0: JS_CALL_EXPRESSION@30..38 + 0: JS_STATIC_MEMBER_EXPRESSION@30..36 + 0: JS_IDENTIFIER_EXPRESSION@30..31 + 0: JS_REFERENCE_IDENTIFIER@30..31 + 0: IDENT@30..31 "y" [] [] + 1: DOT@31..32 "." [] [] + 2: JS_NAME@32..36 + 0: IDENT@32..36 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@36..38 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@37..37 + 2: R_PAREN@37..38 ")" [] [] + 1: DOT@38..39 "." [] [] + 2: JS_NAME@39..40 + 0: IDENT@39..40 "z" [] [] + 3: (empty) + 2: R_CURLY@40..41 "}" [] [] + 1: EQ@41..43 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@43..45 + 0: L_CURLY@43..44 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@44..44 + 2: R_CURLY@44..45 "}" [] [] + 2: R_PAREN@45..46 ")" [] [] + 1: SEMICOLON@46..47 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@47..65 + 0: JS_PARENTHESIZED_EXPRESSION@47..64 + 0: L_PAREN@47..49 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@49..63 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@49..59 + 0: L_CURLY@49..50 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@50..58 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@50..58 + 0: JS_LITERAL_MEMBER_NAME@50..51 + 0: IDENT@50..51 "x" [] [] + 1: COLON@51..53 ":" [] [Whitespace(" ")] + 2: JS_PARENTHESIZED_ASSIGNMENT@53..58 + 0: L_PAREN@53..54 "(" [] [] + 1: JS_PARENTHESIZED_ASSIGNMENT@54..57 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@55..56 + 0: IDENT@55..56 "z" [] [] + 2: R_PAREN@56..57 ")" [] [] + 2: R_PAREN@57..58 ")" [] [] + 3: (empty) + 2: R_CURLY@58..59 "}" [] [] + 1: EQ@59..61 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@61..63 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@62..62 + 2: R_CURLY@62..63 "}" [] [] + 2: R_PAREN@63..64 ")" [] [] + 1: SEMICOLON@64..65 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@65..91 + 0: JS_PARENTHESIZED_EXPRESSION@65..90 + 0: L_PAREN@65..67 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@67..89 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@67..85 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@68..84 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@68..84 + 0: JS_LITERAL_MEMBER_NAME@68..69 + 0: IDENT@68..69 "x" [] [] + 1: COLON@69..71 ":" [] [Whitespace(" ")] + 2: JS_COMPUTED_MEMBER_ASSIGNMENT@71..84 + 0: JS_IDENTIFIER_EXPRESSION@71..72 + 0: JS_REFERENCE_IDENTIFIER@71..72 + 0: IDENT@71..72 "z" [] [] + 1: L_BRACK@72..73 "[" [] [] + 2: JS_STRING_LITERAL_EXPRESSION@73..83 + 0: JS_STRING_LITERAL@73..83 "\"computed\"" [] [] + 3: R_BRACK@83..84 "]" [] [] + 3: (empty) + 2: R_CURLY@84..85 "}" [] [] + 1: EQ@85..87 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@87..89 + 0: L_CURLY@87..88 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@88..88 + 2: R_CURLY@88..89 "}" [] [] + 2: R_PAREN@89..90 ")" [] [] + 1: SEMICOLON@90..91 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@91..114 + 0: JS_PARENTHESIZED_EXPRESSION@91..113 + 0: L_PAREN@91..93 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@93..112 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@93..108 + 0: L_CURLY@93..94 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@94..107 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_SHORTHAND_PROPERTY@94..107 + 0: JS_IDENTIFIER_ASSIGNMENT@94..96 + 0: IDENT@94..96 "x" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@96..107 + 0: EQ@96..98 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@98..107 + 0: JS_STRING_LITERAL@98..107 "\"default\"" [] [] + 2: R_CURLY@107..108 "}" [] [] + 1: EQ@108..110 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@110..112 + 0: L_CURLY@110..111 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@111..111 + 2: R_CURLY@111..112 "}" [] [] + 2: R_PAREN@112..113 ")" [] [] + 1: SEMICOLON@113..114 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@114..140 + 0: JS_PARENTHESIZED_EXPRESSION@114..139 + 0: L_PAREN@114..116 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@116..138 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@116..134 + 0: L_CURLY@116..117 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@117..133 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@117..133 + 0: JS_LITERAL_MEMBER_NAME@117..118 + 0: IDENT@117..118 "x" [] [] + 1: COLON@118..120 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_ASSIGNMENT@120..122 + 0: IDENT@120..122 "y" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@122..133 + 0: EQ@122..124 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@124..133 + 0: JS_STRING_LITERAL@124..133 "\"default\"" [] [] + 2: R_CURLY@133..134 "}" [] [] + 1: EQ@134..136 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@136..138 + 0: L_CURLY@136..137 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@137..137 + 2: R_CURLY@137..138 "}" [] [] + 2: R_PAREN@138..139 ")" [] [] + 1: SEMICOLON@139..140 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@140..170 + 0: JS_PARENTHESIZED_EXPRESSION@140..169 + 0: L_PAREN@140..142 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@142..168 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@142..164 + 0: L_CURLY@142..143 "{" [] [] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@143..162 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@143..147 + 0: JS_LITERAL_MEMBER_NAME@143..144 + 0: JS_NUMBER_LITERAL@143..144 "0" [] [] + 1: COLON@144..146 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_ASSIGNMENT@146..147 + 0: IDENT@146..147 "y" [] [] + 3: (empty) + 1: COMMA@147..149 "," [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@149..162 + 0: JS_COMPUTED_MEMBER_NAME@149..159 + 0: L_BRACK@149..150 "[" [] [] + 1: JS_IDENTIFIER_EXPRESSION@150..158 + 0: JS_REFERENCE_IDENTIFIER@150..158 + 0: IDENT@150..158 "computed" [] [] + 2: R_BRACK@158..159 "]" [] [] + 1: COLON@159..161 ":" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_ASSIGNMENT@161..162 + 0: IDENT@161..162 "z" [] [] + 3: (empty) + 2: R_CURLY@162..164 "}" [] [Whitespace(" ")] + 1: EQ@164..166 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@166..168 + 0: L_CURLY@166..167 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@167..167 + 2: R_CURLY@167..168 "}" [] [] + 2: R_PAREN@168..169 ")" [] [] + 1: SEMICOLON@169..170 ";" [] [] + 4: EOF@170..171 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/property_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/property_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js.snap new file mode 100644 index 000000000000..9801e7afdb93 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js.snap @@ -0,0 +1,349 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + property + declare; + initializedProperty = "a" + "a"; + 5 + ["a" + "b"] + static staticProperty + static staticInitializedProperty = 1 + #private + #privateInitialized = "a" + static #staticPrivate + static #staticPrivateInitializedProperty = 1 +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@11..22 "property" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@22..32 "declare" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@33..56 "initializedProperty" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@58..61 "\"a\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@61..67 "\"a\"" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@67..68 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@68..72 "5" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsComputedMemberName { + l_brack_token: L_BRACK@72..76 "[" [Newline("\n"), Whitespace(" ")] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@76..80 "\"a\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@80..82 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@82..85 "\"b\"" [] [], + }, + }, + r_brack_token: R_BRACK@85..86 "]" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@86..96 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@96..110 "staticProperty" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@110..120 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@120..146 "staticInitializedProperty" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@146..148 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@148..149 "1" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@149..153 "#" [Newline("\n"), Whitespace(" ")] [], + id_token: IDENT@153..160 "private" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@160..164 "#" [Newline("\n"), Whitespace(" ")] [], + id_token: IDENT@164..183 "privateInitialized" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@183..185 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@185..188 "\"a\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@188..198 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsPrivateClassMemberName { + hash_token: HASH@198..199 "#" [] [], + id_token: IDENT@199..212 "staticPrivate" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@212..222 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsPrivateClassMemberName { + hash_token: HASH@222..223 "#" [] [], + id_token: IDENT@223..256 "staticPrivateInitializedProperty" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@256..258 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@258..259 "1" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@259..261 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@261..262 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..262 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..261 + 0: JS_CLASS_DECLARATION@0..261 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..259 + 0: JS_PROPERTY_CLASS_MEMBER@11..22 + 0: JS_PROPERTY_MODIFIER_LIST@11..11 + 1: JS_LITERAL_MEMBER_NAME@11..22 + 0: IDENT@11..22 "property" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@22..33 + 0: JS_PROPERTY_MODIFIER_LIST@22..22 + 1: JS_LITERAL_MEMBER_NAME@22..32 + 0: IDENT@22..32 "declare" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@32..33 ";" [] [] + 2: JS_PROPERTY_CLASS_MEMBER@33..61 + 0: JS_PROPERTY_MODIFIER_LIST@33..33 + 1: JS_LITERAL_MEMBER_NAME@33..56 + 0: IDENT@33..56 "initializedProperty" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@56..61 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@58..61 + 0: JS_STRING_LITERAL@58..61 "\"a\"" [] [] + 4: (empty) + 3: JS_PROPERTY_CLASS_MEMBER@61..68 + 0: JS_PROPERTY_MODIFIER_LIST@61..61 + 1: JS_LITERAL_MEMBER_NAME@61..67 + 0: JS_STRING_LITERAL@61..67 "\"a\"" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@67..68 ";" [] [] + 4: JS_PROPERTY_CLASS_MEMBER@68..72 + 0: JS_PROPERTY_MODIFIER_LIST@68..68 + 1: JS_LITERAL_MEMBER_NAME@68..72 + 0: JS_NUMBER_LITERAL@68..72 "5" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PROPERTY_CLASS_MEMBER@72..86 + 0: JS_PROPERTY_MODIFIER_LIST@72..72 + 1: JS_COMPUTED_MEMBER_NAME@72..86 + 0: L_BRACK@72..76 "[" [Newline("\n"), Whitespace(" ")] [] + 1: JS_BINARY_EXPRESSION@76..85 + 0: JS_STRING_LITERAL_EXPRESSION@76..80 + 0: JS_STRING_LITERAL@76..80 "\"a\"" [] [Whitespace(" ")] + 1: PLUS@80..82 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@82..85 + 0: JS_STRING_LITERAL@82..85 "\"b\"" [] [] + 2: R_BRACK@85..86 "]" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 6: JS_PROPERTY_CLASS_MEMBER@86..110 + 0: JS_PROPERTY_MODIFIER_LIST@86..96 + 0: JS_STATIC_MODIFIER@86..96 + 0: STATIC_KW@86..96 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@96..110 + 0: IDENT@96..110 "staticProperty" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 7: JS_PROPERTY_CLASS_MEMBER@110..149 + 0: JS_PROPERTY_MODIFIER_LIST@110..120 + 0: JS_STATIC_MODIFIER@110..120 + 0: STATIC_KW@110..120 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@120..146 + 0: IDENT@120..146 "staticInitializedProperty" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@146..149 + 0: EQ@146..148 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@148..149 + 0: JS_NUMBER_LITERAL@148..149 "1" [] [] + 4: (empty) + 8: JS_PROPERTY_CLASS_MEMBER@149..160 + 0: JS_PROPERTY_MODIFIER_LIST@149..149 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@149..160 + 0: HASH@149..153 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@153..160 "private" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 9: JS_PROPERTY_CLASS_MEMBER@160..188 + 0: JS_PROPERTY_MODIFIER_LIST@160..160 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@160..183 + 0: HASH@160..164 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@164..183 "privateInitialized" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@183..188 + 0: EQ@183..185 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@185..188 + 0: JS_STRING_LITERAL@185..188 "\"a\"" [] [] + 4: (empty) + 10: JS_PROPERTY_CLASS_MEMBER@188..212 + 0: JS_PROPERTY_MODIFIER_LIST@188..198 + 0: JS_STATIC_MODIFIER@188..198 + 0: STATIC_KW@188..198 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@198..212 + 0: HASH@198..199 "#" [] [] + 1: IDENT@199..212 "staticPrivate" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 11: JS_PROPERTY_CLASS_MEMBER@212..259 + 0: JS_PROPERTY_MODIFIER_LIST@212..222 + 0: JS_STATIC_MODIFIER@212..222 + 0: STATIC_KW@212..222 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_PRIVATE_CLASS_MEMBER_NAME@222..256 + 0: HASH@222..223 "#" [] [] + 1: IDENT@223..256 "staticPrivateInitializedProperty" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@256..259 + 0: EQ@256..258 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@258..259 + 0: JS_NUMBER_LITERAL@258..259 "1" [] [] + 4: (empty) + 9: R_CURLY@259..261 "}" [Newline("\n")] [] + 4: EOF@261..262 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap new file mode 100644 index 000000000000..778257bde5e4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap @@ -0,0 +1,154 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test() { a = await; } +function test2() { return await; } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..23 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@26..28 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@28..30 "a" [] [Whitespace(" ")], + }, + operator_token: EQ@30..32 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..37 "await" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@37..39 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@50..55 "test2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@55..56 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@58..60 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@60..67 "return" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@67..72 "await" [] [], + }, + }, + semicolon_token: SEMICOLON@72..74 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@74..75 "}" [] [], + }, + }, + ], + eof_token: EOF@75..76 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..76 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..75 + 0: JS_FUNCTION_DECLARATION@0..40 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..23 + 0: IDENT@19..23 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@23..26 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..24 + 2: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@26..40 + 0: L_CURLY@26..28 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..39 + 0: JS_EXPRESSION_STATEMENT@28..39 + 0: JS_ASSIGNMENT_EXPRESSION@28..37 + 0: JS_IDENTIFIER_ASSIGNMENT@28..30 + 0: IDENT@28..30 "a" [] [Whitespace(" ")] + 1: EQ@30..32 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@32..37 + 0: JS_REFERENCE_IDENTIFIER@32..37 + 0: IDENT@32..37 "await" [] [] + 1: SEMICOLON@37..39 ";" [] [Whitespace(" ")] + 3: R_CURLY@39..40 "}" [] [] + 1: JS_FUNCTION_DECLARATION@40..75 + 0: (empty) + 1: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@50..55 + 0: IDENT@50..55 "test2" [] [] + 4: (empty) + 5: JS_PARAMETERS@55..58 + 0: L_PAREN@55..56 "(" [] [] + 1: JS_PARAMETER_LIST@56..56 + 2: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@58..75 + 0: L_CURLY@58..60 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@60..60 + 2: JS_STATEMENT_LIST@60..74 + 0: JS_RETURN_STATEMENT@60..74 + 0: RETURN_KW@60..67 "return" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@67..72 + 0: JS_REFERENCE_IDENTIFIER@67..72 + 0: IDENT@67..72 "await" [] [] + 2: SEMICOLON@72..74 ";" [] [Whitespace(" ")] + 3: R_CURLY@74..75 "}" [] [] + 4: EOF@75..76 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap new file mode 100644 index 000000000000..3e20f5302e1f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap @@ -0,0 +1,208 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function foo() { yield *bar; } +function bar() { yield; } +function baz() { yield } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..22 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..33 "yield" [] [Whitespace(" ")], + }, + }, + operator_token: STAR@33..34 "*" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@34..37 "bar" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@37..39 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@39..40 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@50..53 "bar" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@53..54 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@56..58 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@58..63 "yield" [] [], + }, + }, + semicolon_token: SEMICOLON@63..65 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@65..66 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@66..76 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@76..79 "baz" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@79..80 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@82..84 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..90 "yield" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@90..91 "}" [] [], + }, + }, + ], + eof_token: EOF@91..92 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..92 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..91 + 0: JS_FUNCTION_DECLARATION@0..40 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..22 + 0: IDENT@19..22 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@25..40 + 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..39 + 0: JS_EXPRESSION_STATEMENT@27..39 + 0: JS_BINARY_EXPRESSION@27..37 + 0: JS_IDENTIFIER_EXPRESSION@27..33 + 0: JS_REFERENCE_IDENTIFIER@27..33 + 0: IDENT@27..33 "yield" [] [Whitespace(" ")] + 1: STAR@33..34 "*" [] [] + 2: JS_IDENTIFIER_EXPRESSION@34..37 + 0: JS_REFERENCE_IDENTIFIER@34..37 + 0: IDENT@34..37 "bar" [] [] + 1: SEMICOLON@37..39 ";" [] [Whitespace(" ")] + 3: R_CURLY@39..40 "}" [] [] + 1: JS_FUNCTION_DECLARATION@40..66 + 0: (empty) + 1: FUNCTION_KW@40..50 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@50..53 + 0: IDENT@50..53 "bar" [] [] + 4: (empty) + 5: JS_PARAMETERS@53..56 + 0: L_PAREN@53..54 "(" [] [] + 1: JS_PARAMETER_LIST@54..54 + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@56..66 + 0: L_CURLY@56..58 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@58..58 + 2: JS_STATEMENT_LIST@58..65 + 0: JS_EXPRESSION_STATEMENT@58..65 + 0: JS_IDENTIFIER_EXPRESSION@58..63 + 0: JS_REFERENCE_IDENTIFIER@58..63 + 0: IDENT@58..63 "yield" [] [] + 1: SEMICOLON@63..65 ";" [] [Whitespace(" ")] + 3: R_CURLY@65..66 "}" [] [] + 2: JS_FUNCTION_DECLARATION@66..91 + 0: (empty) + 1: FUNCTION_KW@66..76 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@76..79 + 0: IDENT@76..79 "baz" [] [] + 4: (empty) + 5: JS_PARAMETERS@79..82 + 0: L_PAREN@79..80 "(" [] [] + 1: JS_PARAMETER_LIST@80..80 + 2: R_PAREN@80..82 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@82..91 + 0: L_CURLY@82..84 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@84..84 + 2: JS_STATEMENT_LIST@84..90 + 0: JS_EXPRESSION_STATEMENT@84..90 + 0: JS_IDENTIFIER_EXPRESSION@84..90 + 0: JS_REFERENCE_IDENTIFIER@84..90 + 0: IDENT@84..90 "yield" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@90..91 "}" [] [] + 4: EOF@91..92 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js.snap new file mode 100644 index 000000000000..60255fb690b7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js.snap @@ -0,0 +1,426 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({ ...abcd } = a); +({ ...(abcd) } = a); +({ ...m.test } = c); +({ ...m[call()] } = c); +({ ...any.expression().b } = c); +({ b: { ...a } } = c); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@1..3 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@3..6 "..." [] [], + target: JsIdentifierAssignment { + name_token: IDENT@6..11 "abcd" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@11..13 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@13..15 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..16 "a" [] [], + }, + }, + }, + r_paren_token: R_PAREN@16..17 ")" [] [], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@18..20 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@22..25 "..." [] [], + target: JsParenthesizedAssignment { + l_paren_token: L_PAREN@25..26 "(" [] [], + assignment: JsIdentifierAssignment { + name_token: IDENT@26..30 "abcd" [] [], + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@32..34 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@34..36 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@36..37 "a" [] [], + }, + }, + }, + r_paren_token: R_PAREN@37..38 ")" [] [], + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@39..41 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@41..43 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@43..46 "..." [] [], + target: JsStaticMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..47 "m" [] [], + }, + }, + dot_token: DOT@47..48 "." [] [], + member: JsName { + value_token: IDENT@48..53 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@53..55 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@55..57 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@57..58 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@58..59 ")" [] [], + }, + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@60..62 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@62..64 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@64..67 "..." [] [], + target: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@67..68 "m" [] [], + }, + }, + l_brack_token: L_BRACK@68..69 "[" [] [], + member: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@69..73 "call" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@73..74 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@74..75 ")" [] [], + }, + }, + r_brack_token: R_BRACK@75..77 "]" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@77..79 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@79..81 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@81..82 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@84..86 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@86..88 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@88..91 "..." [] [], + target: JsStaticMemberAssignment { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@91..94 "any" [] [], + }, + }, + operator_token: DOT@94..95 "." [] [], + member: JsName { + value_token: IDENT@95..105 "expression" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@105..106 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@106..107 ")" [] [], + }, + }, + dot_token: DOT@107..108 "." [] [], + member: JsName { + value_token: IDENT@108..110 "b" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@110..112 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@112..114 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@114..115 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@115..116 ")" [] [], + }, + semicolon_token: SEMICOLON@116..117 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@117..119 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@119..121 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@121..122 "b" [] [], + }, + colon_token: COLON@122..124 ":" [] [Whitespace(" ")], + pattern: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@124..126 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternRest { + dotdotdot_token: DOT3@126..129 "..." [] [], + target: JsIdentifierAssignment { + name_token: IDENT@129..131 "a" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@131..133 "}" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@133..135 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@135..137 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..138 "c" [] [], + }, + }, + }, + r_paren_token: R_PAREN@138..139 ")" [] [], + }, + semicolon_token: SEMICOLON@139..140 ";" [] [], + }, + ], + eof_token: EOF@140..141 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..141 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..140 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JS_PARENTHESIZED_EXPRESSION@0..17 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@1..16 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@1..13 + 0: L_CURLY@1..3 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@3..11 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@3..11 + 0: DOT3@3..6 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@6..11 + 0: IDENT@6..11 "abcd" [] [Whitespace(" ")] + 2: R_CURLY@11..13 "}" [] [Whitespace(" ")] + 1: EQ@13..15 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@15..16 + 0: JS_REFERENCE_IDENTIFIER@15..16 + 0: IDENT@15..16 "a" [] [] + 2: R_PAREN@16..17 ")" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@18..39 + 0: JS_PARENTHESIZED_EXPRESSION@18..38 + 0: L_PAREN@18..20 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@20..37 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@20..34 + 0: L_CURLY@20..22 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@22..32 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@22..32 + 0: DOT3@22..25 "..." [] [] + 1: JS_PARENTHESIZED_ASSIGNMENT@25..32 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@26..30 + 0: IDENT@26..30 "abcd" [] [] + 2: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 2: R_CURLY@32..34 "}" [] [Whitespace(" ")] + 1: EQ@34..36 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@36..37 + 0: JS_REFERENCE_IDENTIFIER@36..37 + 0: IDENT@36..37 "a" [] [] + 2: R_PAREN@37..38 ")" [] [] + 1: SEMICOLON@38..39 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@39..60 + 0: JS_PARENTHESIZED_EXPRESSION@39..59 + 0: L_PAREN@39..41 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@41..58 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@41..55 + 0: L_CURLY@41..43 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@43..53 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@43..53 + 0: DOT3@43..46 "..." [] [] + 1: JS_STATIC_MEMBER_ASSIGNMENT@46..53 + 0: JS_IDENTIFIER_EXPRESSION@46..47 + 0: JS_REFERENCE_IDENTIFIER@46..47 + 0: IDENT@46..47 "m" [] [] + 1: DOT@47..48 "." [] [] + 2: JS_NAME@48..53 + 0: IDENT@48..53 "test" [] [Whitespace(" ")] + 2: R_CURLY@53..55 "}" [] [Whitespace(" ")] + 1: EQ@55..57 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@57..58 + 0: JS_REFERENCE_IDENTIFIER@57..58 + 0: IDENT@57..58 "c" [] [] + 2: R_PAREN@58..59 ")" [] [] + 1: SEMICOLON@59..60 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@60..84 + 0: JS_PARENTHESIZED_EXPRESSION@60..83 + 0: L_PAREN@60..62 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@62..82 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@62..79 + 0: L_CURLY@62..64 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@64..77 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@64..77 + 0: DOT3@64..67 "..." [] [] + 1: JS_COMPUTED_MEMBER_ASSIGNMENT@67..77 + 0: JS_IDENTIFIER_EXPRESSION@67..68 + 0: JS_REFERENCE_IDENTIFIER@67..68 + 0: IDENT@67..68 "m" [] [] + 1: L_BRACK@68..69 "[" [] [] + 2: JS_CALL_EXPRESSION@69..75 + 0: JS_IDENTIFIER_EXPRESSION@69..73 + 0: JS_REFERENCE_IDENTIFIER@69..73 + 0: IDENT@69..73 "call" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@73..75 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@74..74 + 2: R_PAREN@74..75 ")" [] [] + 3: R_BRACK@75..77 "]" [] [Whitespace(" ")] + 2: R_CURLY@77..79 "}" [] [Whitespace(" ")] + 1: EQ@79..81 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@81..82 + 0: JS_REFERENCE_IDENTIFIER@81..82 + 0: IDENT@81..82 "c" [] [] + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@84..117 + 0: JS_PARENTHESIZED_EXPRESSION@84..116 + 0: L_PAREN@84..86 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@86..115 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@86..112 + 0: L_CURLY@86..88 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@88..110 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@88..110 + 0: DOT3@88..91 "..." [] [] + 1: JS_STATIC_MEMBER_ASSIGNMENT@91..110 + 0: JS_CALL_EXPRESSION@91..107 + 0: JS_STATIC_MEMBER_EXPRESSION@91..105 + 0: JS_IDENTIFIER_EXPRESSION@91..94 + 0: JS_REFERENCE_IDENTIFIER@91..94 + 0: IDENT@91..94 "any" [] [] + 1: DOT@94..95 "." [] [] + 2: JS_NAME@95..105 + 0: IDENT@95..105 "expression" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@105..107 + 0: L_PAREN@105..106 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@106..106 + 2: R_PAREN@106..107 ")" [] [] + 1: DOT@107..108 "." [] [] + 2: JS_NAME@108..110 + 0: IDENT@108..110 "b" [] [Whitespace(" ")] + 2: R_CURLY@110..112 "}" [] [Whitespace(" ")] + 1: EQ@112..114 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@114..115 + 0: JS_REFERENCE_IDENTIFIER@114..115 + 0: IDENT@114..115 "c" [] [] + 2: R_PAREN@115..116 ")" [] [] + 1: SEMICOLON@116..117 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@117..140 + 0: JS_PARENTHESIZED_EXPRESSION@117..139 + 0: L_PAREN@117..119 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@119..138 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@119..135 + 0: L_CURLY@119..121 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@121..133 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@121..133 + 0: JS_LITERAL_MEMBER_NAME@121..122 + 0: IDENT@121..122 "b" [] [] + 1: COLON@122..124 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_ASSIGNMENT_PATTERN@124..133 + 0: L_CURLY@124..126 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@126..131 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_REST@126..131 + 0: DOT3@126..129 "..." [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@129..131 + 0: IDENT@129..131 "a" [] [Whitespace(" ")] + 2: R_CURLY@131..133 "}" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@133..135 "}" [] [Whitespace(" ")] + 1: EQ@135..137 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@137..138 + 0: JS_REFERENCE_IDENTIFIER@137..138 + 0: IDENT@137..138 "c" [] [] + 2: R_PAREN@138..139 ")" [] [] + 1: SEMICOLON@139..140 ";" [] [] + 4: EOF@140..141 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/rest_property_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js.snap new file mode 100644 index 000000000000..7a569d9f8233 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js.snap @@ -0,0 +1,165 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { ...abcd } = a; +let { b: { ...a } } = c; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@4..6 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternRest { + dotdotdot_token: DOT3@6..9 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@9..14 "abcd" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@16..18 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..19 "a" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@27..28 "b" [] [], + }, + colon_token: COLON@28..30 ":" [] [Whitespace(" ")], + pattern: JsObjectBindingPattern { + l_curly_token: L_CURLY@30..32 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternRest { + dotdotdot_token: DOT3@32..35 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@35..37 "a" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@37..39 "}" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@39..41 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@41..43 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@43..44 "c" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + ], + eof_token: EOF@45..46 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..46 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..45 + 0: JS_VARIABLE_STATEMENT@0..20 + 0: JS_VARIABLE_DECLARATION@0..19 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..19 + 0: JS_VARIABLE_DECLARATOR@4..19 + 0: JS_OBJECT_BINDING_PATTERN@4..16 + 0: L_CURLY@4..6 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@6..14 + 0: JS_OBJECT_BINDING_PATTERN_REST@6..14 + 0: DOT3@6..9 "..." [] [] + 1: JS_IDENTIFIER_BINDING@9..14 + 0: IDENT@9..14 "abcd" [] [Whitespace(" ")] + 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@16..19 + 0: EQ@16..18 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@18..19 + 0: JS_REFERENCE_IDENTIFIER@18..19 + 0: IDENT@18..19 "a" [] [] + 1: SEMICOLON@19..20 ";" [] [] + 1: JS_VARIABLE_STATEMENT@20..45 + 0: JS_VARIABLE_DECLARATION@20..44 + 0: (empty) + 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@25..44 + 0: JS_VARIABLE_DECLARATOR@25..44 + 0: JS_OBJECT_BINDING_PATTERN@25..41 + 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@27..39 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@27..39 + 0: JS_LITERAL_MEMBER_NAME@27..28 + 0: IDENT@27..28 "b" [] [] + 1: COLON@28..30 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN@30..39 + 0: L_CURLY@30..32 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@32..37 + 0: JS_OBJECT_BINDING_PATTERN_REST@32..37 + 0: DOT3@32..35 "..." [] [] + 1: JS_IDENTIFIER_BINDING@35..37 + 0: IDENT@35..37 "a" [] [Whitespace(" ")] + 2: R_CURLY@37..39 "}" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@39..41 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@41..44 + 0: EQ@41..43 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@43..44 + 0: JS_REFERENCE_IDENTIFIER@43..44 + 0: IDENT@43..44 "c" [] [] + 1: SEMICOLON@44..45 ";" [] [] + 4: EOF@45..46 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/return_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/return_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js.snap new file mode 100644 index 000000000000..80382a52b405 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +() => { + return; + return foo; + return +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@0..1 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1..3 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@3..6 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@6..7 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@7..16 "return" [Newline("\n"), Whitespace(" ")] [], + argument: missing (optional), + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsReturnStatement { + return_token: RETURN_KW@17..27 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..30 "foo" [] [], + }, + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + JsReturnStatement { + return_token: RETURN_KW@31..40 "return" [Newline("\n"), Whitespace(" ")] [], + argument: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@40..42 "}" [Newline("\n")] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@42..43 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..43 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..42 + 0: JS_EXPRESSION_STATEMENT@0..42 + 0: JS_ARROW_FUNCTION_EXPRESSION@0..42 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@0..3 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_PARAMETER_LIST@1..1 + 2: R_PAREN@1..3 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@3..6 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@6..42 + 0: L_CURLY@6..7 "{" [] [] + 1: JS_DIRECTIVE_LIST@7..7 + 2: JS_STATEMENT_LIST@7..40 + 0: JS_RETURN_STATEMENT@7..17 + 0: RETURN_KW@7..16 "return" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: SEMICOLON@16..17 ";" [] [] + 1: JS_RETURN_STATEMENT@17..31 + 0: RETURN_KW@17..27 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@27..30 + 0: JS_REFERENCE_IDENTIFIER@27..30 + 0: IDENT@27..30 "foo" [] [] + 2: SEMICOLON@30..31 ";" [] [] + 2: JS_RETURN_STATEMENT@31..40 + 0: RETURN_KW@31..40 "return" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: R_CURLY@40..42 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@42..43 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.js b/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/scoped_declarations.js rename to crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js.snap new file mode 100644 index 000000000000..60bf3757cf94 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js.snap @@ -0,0 +1,152 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + test() { + let a = "inner"; + } +}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@9..16 "test" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@16..17 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@19..20 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@20..29 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@29..31 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@31..33 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@33..40 "\"inner\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@40..41 ";" [] [], + }, + ], + r_curly_token: R_CURLY@41..45 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@45..47 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + ], + eof_token: EOF@48..49 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..49 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..48 + 0: JS_VARIABLE_STATEMENT@0..48 + 0: JS_VARIABLE_DECLARATION@0..47 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..47 + 0: JS_VARIABLE_DECLARATOR@4..47 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..47 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..47 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..45 + 0: JS_METHOD_OBJECT_MEMBER@9..45 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@9..16 + 0: IDENT@9..16 "test" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@16..19 + 0: L_PAREN@16..17 "(" [] [] + 1: JS_PARAMETER_LIST@17..17 + 2: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@19..45 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_DIRECTIVE_LIST@20..20 + 2: JS_STATEMENT_LIST@20..41 + 0: JS_VARIABLE_STATEMENT@20..41 + 0: JS_VARIABLE_DECLARATION@20..40 + 0: (empty) + 1: LET_KW@20..29 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..40 + 0: JS_VARIABLE_DECLARATOR@29..40 + 0: JS_IDENTIFIER_BINDING@29..31 + 0: IDENT@29..31 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@31..40 + 0: EQ@31..33 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@33..40 + 0: JS_STRING_LITERAL@33..40 "\"inner\"" [] [] + 1: SEMICOLON@40..41 ";" [] [] + 3: R_CURLY@41..45 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@45..47 "}" [Newline("\n")] [] + 1: SEMICOLON@47..48 ";" [] [] + 4: EOF@48..49 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/semicolons.js b/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/semicolons.js rename to crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js.snap new file mode 100644 index 000000000000..a29da59f7d41 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js.snap @@ -0,0 +1,249 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let foo = bar; +let foo2 = b; +let foo3; +let foo4 +let foo5 +function foo6() { return true } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..8 "foo" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..13 "bar" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@14..19 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@19..24 "foo2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..27 "b" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..37 "foo3" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@38..43 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@43..47 "foo4" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@47..52 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@52..56 "foo5" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@56..66 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@66..70 "foo6" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@70..71 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@71..73 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@75..82 "return" [] [Whitespace(" ")], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@82..87 "true" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@87..88 "}" [] [], + }, + }, + ], + eof_token: EOF@88..89 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..89 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..88 + 0: JS_VARIABLE_STATEMENT@0..14 + 0: JS_VARIABLE_DECLARATION@0..13 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..13 + 0: JS_VARIABLE_DECLARATOR@4..13 + 0: JS_IDENTIFIER_BINDING@4..8 + 0: IDENT@4..8 "foo" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..13 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@10..13 + 0: JS_REFERENCE_IDENTIFIER@10..13 + 0: IDENT@10..13 "bar" [] [] + 1: SEMICOLON@13..14 ";" [] [] + 1: JS_VARIABLE_STATEMENT@14..28 + 0: JS_VARIABLE_DECLARATION@14..27 + 0: (empty) + 1: LET_KW@14..19 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@19..27 + 0: JS_VARIABLE_DECLARATOR@19..27 + 0: JS_IDENTIFIER_BINDING@19..24 + 0: IDENT@19..24 "foo2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@24..27 + 0: EQ@24..26 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@26..27 + 0: JS_REFERENCE_IDENTIFIER@26..27 + 0: IDENT@26..27 "b" [] [] + 1: SEMICOLON@27..28 ";" [] [] + 2: JS_VARIABLE_STATEMENT@28..38 + 0: JS_VARIABLE_DECLARATION@28..37 + 0: (empty) + 1: LET_KW@28..33 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@33..37 + 0: JS_VARIABLE_DECLARATOR@33..37 + 0: JS_IDENTIFIER_BINDING@33..37 + 0: IDENT@33..37 "foo3" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@37..38 ";" [] [] + 3: JS_VARIABLE_STATEMENT@38..47 + 0: JS_VARIABLE_DECLARATION@38..47 + 0: (empty) + 1: LET_KW@38..43 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@43..47 + 0: JS_VARIABLE_DECLARATOR@43..47 + 0: JS_IDENTIFIER_BINDING@43..47 + 0: IDENT@43..47 "foo4" [] [] + 1: (empty) + 2: (empty) + 1: (empty) + 4: JS_VARIABLE_STATEMENT@47..56 + 0: JS_VARIABLE_DECLARATION@47..56 + 0: (empty) + 1: LET_KW@47..52 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@52..56 + 0: JS_VARIABLE_DECLARATOR@52..56 + 0: JS_IDENTIFIER_BINDING@52..56 + 0: IDENT@52..56 "foo5" [] [] + 1: (empty) + 2: (empty) + 1: (empty) + 5: JS_FUNCTION_DECLARATION@56..88 + 0: (empty) + 1: FUNCTION_KW@56..66 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@66..70 + 0: IDENT@66..70 "foo6" [] [] + 4: (empty) + 5: JS_PARAMETERS@70..73 + 0: L_PAREN@70..71 "(" [] [] + 1: JS_PARAMETER_LIST@71..71 + 2: R_PAREN@71..73 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@73..88 + 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@75..75 + 2: JS_STATEMENT_LIST@75..87 + 0: JS_RETURN_STATEMENT@75..87 + 0: RETURN_KW@75..82 "return" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@82..87 + 0: TRUE_KW@82..87 "true" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@87..88 "}" [] [] + 4: EOF@88..89 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/sequence_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/sequence_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js.snap new file mode 100644 index 000000000000..559beb7c6c44 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js.snap @@ -0,0 +1,86 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +1, 2, 3, 4, 5 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsSequenceExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..1 "1" [] [], + }, + comma_token: COMMA@1..3 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@3..4 "2" [] [], + }, + }, + comma_token: COMMA@4..6 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@6..7 "3" [] [], + }, + }, + comma_token: COMMA@7..9 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@9..10 "4" [] [], + }, + }, + comma_token: COMMA@10..12 "," [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@12..13 "5" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_SEQUENCE_EXPRESSION@0..13 + 0: JS_SEQUENCE_EXPRESSION@0..10 + 0: JS_SEQUENCE_EXPRESSION@0..7 + 0: JS_SEQUENCE_EXPRESSION@0..4 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..1 + 0: JS_NUMBER_LITERAL@0..1 "1" [] [] + 1: COMMA@1..3 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@3..4 + 0: JS_NUMBER_LITERAL@3..4 "2" [] [] + 1: COMMA@4..6 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@6..7 + 0: JS_NUMBER_LITERAL@6..7 "3" [] [] + 1: COMMA@7..9 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@9..10 + 0: JS_NUMBER_LITERAL@9..10 "4" [] [] + 1: COMMA@10..12 "," [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@12..13 + 0: JS_NUMBER_LITERAL@12..13 "5" [] [] + 1: (empty) + 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/setter_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js.snap new file mode 100644 index 000000000000..56dde3bfa6a9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js.snap @@ -0,0 +1,764 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Setters { + set foo(a) {} + set bax(a,) {} + set static(a) {} + static set bar(a) {} + static set baz(a,) {} + set "baz"(a) {} + set ["a" + "b"](a) {} + set 5(a) {} + set 6(a,) {} + set #private(a) {} +} +class NotSetters { + set(a) {} + async set(a) {} + static set(a) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..14 "Setters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@14..15 "{" [] [], + members: JsClassMemberList [ + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@22..25 "foo" [] [], + }, + l_paren_token: L_PAREN@25..26 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@26..27 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@29..30 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@31..38 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@38..41 "bax" [] [], + }, + l_paren_token: L_PAREN@41..42 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@42..43 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: COMMA@43..44 "," [] [], + r_paren_token: R_PAREN@44..46 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@46..47 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@47..48 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@48..55 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@55..61 "static" [] [], + }, + l_paren_token: L_PAREN@61..62 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@62..63 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@63..65 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@65..66 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@66..67 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@67..77 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + set_token: SET_KW@77..81 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@81..84 "bar" [] [], + }, + l_paren_token: L_PAREN@84..85 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@85..86 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@88..89 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@89..90 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@90..100 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + set_token: SET_KW@100..104 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@104..107 "baz" [] [], + }, + l_paren_token: L_PAREN@107..108 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@108..109 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: COMMA@109..110 "," [] [], + r_paren_token: R_PAREN@110..112 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@112..113 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@113..114 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@114..121 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@121..126 "\"baz\"" [] [], + }, + l_paren_token: L_PAREN@126..127 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@127..128 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@128..130 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@130..131 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@131..132 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@132..139 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsComputedMemberName { + l_brack_token: L_BRACK@139..140 "[" [] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@140..144 "\"a\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@144..146 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@146..149 "\"b\"" [] [], + }, + }, + r_brack_token: R_BRACK@149..150 "]" [] [], + }, + l_paren_token: L_PAREN@150..151 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@151..152 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@152..154 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@154..155 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@155..156 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@156..163 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@163..164 "5" [] [], + }, + l_paren_token: L_PAREN@164..165 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@165..166 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@166..168 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@168..169 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@169..170 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@170..177 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@177..178 "6" [] [], + }, + l_paren_token: L_PAREN@178..179 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@179..180 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: COMMA@180..181 "," [] [], + r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@183..184 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@184..185 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@185..192 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsPrivateClassMemberName { + hash_token: HASH@192..193 "#" [] [], + id_token: IDENT@193..200 "private" [] [], + }, + l_paren_token: L_PAREN@200..201 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@201..202 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@202..204 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@204..205 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@205..206 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@206..208 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@208..215 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@215..226 "NotSetters" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@226..227 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@227..233 "set" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@233..234 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@234..235 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@235..237 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@237..238 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@238..239 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@239..248 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@248..251 "set" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@251..252 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@252..253 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@253..255 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@255..256 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@256..257 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@257..267 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@267..270 "set" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@270..271 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@271..272 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@272..274 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@274..275 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@275..276 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@276..278 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@278..279 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..279 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..278 + 0: JS_CLASS_DECLARATION@0..208 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..14 + 0: IDENT@6..14 "Setters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@14..15 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@15..206 + 0: JS_SETTER_CLASS_MEMBER@15..31 + 0: JS_METHOD_MODIFIER_LIST@15..15 + 1: SET_KW@15..22 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@22..25 + 0: IDENT@22..25 "foo" [] [] + 3: L_PAREN@25..26 "(" [] [] + 4: JS_FORMAL_PARAMETER@26..27 + 0: JS_DECORATOR_LIST@26..26 + 1: JS_IDENTIFIER_BINDING@26..27 + 0: IDENT@26..27 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@27..29 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@29..31 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_DIRECTIVE_LIST@30..30 + 2: JS_STATEMENT_LIST@30..30 + 3: R_CURLY@30..31 "}" [] [] + 1: JS_SETTER_CLASS_MEMBER@31..48 + 0: JS_METHOD_MODIFIER_LIST@31..31 + 1: SET_KW@31..38 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@38..41 + 0: IDENT@38..41 "bax" [] [] + 3: L_PAREN@41..42 "(" [] [] + 4: JS_FORMAL_PARAMETER@42..43 + 0: JS_DECORATOR_LIST@42..42 + 1: JS_IDENTIFIER_BINDING@42..43 + 0: IDENT@42..43 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@43..44 "," [] [] + 6: R_PAREN@44..46 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@46..48 + 0: L_CURLY@46..47 "{" [] [] + 1: JS_DIRECTIVE_LIST@47..47 + 2: JS_STATEMENT_LIST@47..47 + 3: R_CURLY@47..48 "}" [] [] + 2: JS_SETTER_CLASS_MEMBER@48..67 + 0: JS_METHOD_MODIFIER_LIST@48..48 + 1: SET_KW@48..55 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@55..61 + 0: IDENT@55..61 "static" [] [] + 3: L_PAREN@61..62 "(" [] [] + 4: JS_FORMAL_PARAMETER@62..63 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_IDENTIFIER_BINDING@62..63 + 0: IDENT@62..63 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@63..65 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@65..67 + 0: L_CURLY@65..66 "{" [] [] + 1: JS_DIRECTIVE_LIST@66..66 + 2: JS_STATEMENT_LIST@66..66 + 3: R_CURLY@66..67 "}" [] [] + 3: JS_SETTER_CLASS_MEMBER@67..90 + 0: JS_METHOD_MODIFIER_LIST@67..77 + 0: JS_STATIC_MODIFIER@67..77 + 0: STATIC_KW@67..77 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@77..81 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@81..84 + 0: IDENT@81..84 "bar" [] [] + 3: L_PAREN@84..85 "(" [] [] + 4: JS_FORMAL_PARAMETER@85..86 + 0: JS_DECORATOR_LIST@85..85 + 1: JS_IDENTIFIER_BINDING@85..86 + 0: IDENT@85..86 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@86..88 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@88..90 + 0: L_CURLY@88..89 "{" [] [] + 1: JS_DIRECTIVE_LIST@89..89 + 2: JS_STATEMENT_LIST@89..89 + 3: R_CURLY@89..90 "}" [] [] + 4: JS_SETTER_CLASS_MEMBER@90..114 + 0: JS_METHOD_MODIFIER_LIST@90..100 + 0: JS_STATIC_MODIFIER@90..100 + 0: STATIC_KW@90..100 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@100..104 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@104..107 + 0: IDENT@104..107 "baz" [] [] + 3: L_PAREN@107..108 "(" [] [] + 4: JS_FORMAL_PARAMETER@108..109 + 0: JS_DECORATOR_LIST@108..108 + 1: JS_IDENTIFIER_BINDING@108..109 + 0: IDENT@108..109 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@109..110 "," [] [] + 6: R_PAREN@110..112 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@112..114 + 0: L_CURLY@112..113 "{" [] [] + 1: JS_DIRECTIVE_LIST@113..113 + 2: JS_STATEMENT_LIST@113..113 + 3: R_CURLY@113..114 "}" [] [] + 5: JS_SETTER_CLASS_MEMBER@114..132 + 0: JS_METHOD_MODIFIER_LIST@114..114 + 1: SET_KW@114..121 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@121..126 + 0: JS_STRING_LITERAL@121..126 "\"baz\"" [] [] + 3: L_PAREN@126..127 "(" [] [] + 4: JS_FORMAL_PARAMETER@127..128 + 0: JS_DECORATOR_LIST@127..127 + 1: JS_IDENTIFIER_BINDING@127..128 + 0: IDENT@127..128 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@128..130 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@130..132 + 0: L_CURLY@130..131 "{" [] [] + 1: JS_DIRECTIVE_LIST@131..131 + 2: JS_STATEMENT_LIST@131..131 + 3: R_CURLY@131..132 "}" [] [] + 6: JS_SETTER_CLASS_MEMBER@132..156 + 0: JS_METHOD_MODIFIER_LIST@132..132 + 1: SET_KW@132..139 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_COMPUTED_MEMBER_NAME@139..150 + 0: L_BRACK@139..140 "[" [] [] + 1: JS_BINARY_EXPRESSION@140..149 + 0: JS_STRING_LITERAL_EXPRESSION@140..144 + 0: JS_STRING_LITERAL@140..144 "\"a\"" [] [Whitespace(" ")] + 1: PLUS@144..146 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@146..149 + 0: JS_STRING_LITERAL@146..149 "\"b\"" [] [] + 2: R_BRACK@149..150 "]" [] [] + 3: L_PAREN@150..151 "(" [] [] + 4: JS_FORMAL_PARAMETER@151..152 + 0: JS_DECORATOR_LIST@151..151 + 1: JS_IDENTIFIER_BINDING@151..152 + 0: IDENT@151..152 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@152..154 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@154..156 + 0: L_CURLY@154..155 "{" [] [] + 1: JS_DIRECTIVE_LIST@155..155 + 2: JS_STATEMENT_LIST@155..155 + 3: R_CURLY@155..156 "}" [] [] + 7: JS_SETTER_CLASS_MEMBER@156..170 + 0: JS_METHOD_MODIFIER_LIST@156..156 + 1: SET_KW@156..163 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@163..164 + 0: JS_NUMBER_LITERAL@163..164 "5" [] [] + 3: L_PAREN@164..165 "(" [] [] + 4: JS_FORMAL_PARAMETER@165..166 + 0: JS_DECORATOR_LIST@165..165 + 1: JS_IDENTIFIER_BINDING@165..166 + 0: IDENT@165..166 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@166..168 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@168..170 + 0: L_CURLY@168..169 "{" [] [] + 1: JS_DIRECTIVE_LIST@169..169 + 2: JS_STATEMENT_LIST@169..169 + 3: R_CURLY@169..170 "}" [] [] + 8: JS_SETTER_CLASS_MEMBER@170..185 + 0: JS_METHOD_MODIFIER_LIST@170..170 + 1: SET_KW@170..177 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@177..178 + 0: JS_NUMBER_LITERAL@177..178 "6" [] [] + 3: L_PAREN@178..179 "(" [] [] + 4: JS_FORMAL_PARAMETER@179..180 + 0: JS_DECORATOR_LIST@179..179 + 1: JS_IDENTIFIER_BINDING@179..180 + 0: IDENT@179..180 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@180..181 "," [] [] + 6: R_PAREN@181..183 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@183..185 + 0: L_CURLY@183..184 "{" [] [] + 1: JS_DIRECTIVE_LIST@184..184 + 2: JS_STATEMENT_LIST@184..184 + 3: R_CURLY@184..185 "}" [] [] + 9: JS_SETTER_CLASS_MEMBER@185..206 + 0: JS_METHOD_MODIFIER_LIST@185..185 + 1: SET_KW@185..192 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_PRIVATE_CLASS_MEMBER_NAME@192..200 + 0: HASH@192..193 "#" [] [] + 1: IDENT@193..200 "private" [] [] + 3: L_PAREN@200..201 "(" [] [] + 4: JS_FORMAL_PARAMETER@201..202 + 0: JS_DECORATOR_LIST@201..201 + 1: JS_IDENTIFIER_BINDING@201..202 + 0: IDENT@201..202 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@202..204 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@204..206 + 0: L_CURLY@204..205 "{" [] [] + 1: JS_DIRECTIVE_LIST@205..205 + 2: JS_STATEMENT_LIST@205..205 + 3: R_CURLY@205..206 "}" [] [] + 9: R_CURLY@206..208 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@208..278 + 0: JS_DECORATOR_LIST@208..208 + 1: (empty) + 2: CLASS_KW@208..215 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@215..226 + 0: IDENT@215..226 "NotSetters" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@226..227 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@227..276 + 0: JS_METHOD_CLASS_MEMBER@227..239 + 0: JS_METHOD_MODIFIER_LIST@227..227 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@227..233 + 0: IDENT@227..233 "set" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@233..237 + 0: L_PAREN@233..234 "(" [] [] + 1: JS_PARAMETER_LIST@234..235 + 0: JS_FORMAL_PARAMETER@234..235 + 0: JS_DECORATOR_LIST@234..234 + 1: JS_IDENTIFIER_BINDING@234..235 + 0: IDENT@234..235 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@235..237 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@237..239 + 0: L_CURLY@237..238 "{" [] [] + 1: JS_DIRECTIVE_LIST@238..238 + 2: JS_STATEMENT_LIST@238..238 + 3: R_CURLY@238..239 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@239..257 + 0: JS_METHOD_MODIFIER_LIST@239..239 + 1: ASYNC_KW@239..248 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@248..251 + 0: IDENT@248..251 "set" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@251..255 + 0: L_PAREN@251..252 "(" [] [] + 1: JS_PARAMETER_LIST@252..253 + 0: JS_FORMAL_PARAMETER@252..253 + 0: JS_DECORATOR_LIST@252..252 + 1: JS_IDENTIFIER_BINDING@252..253 + 0: IDENT@252..253 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@253..255 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@255..257 + 0: L_CURLY@255..256 "{" [] [] + 1: JS_DIRECTIVE_LIST@256..256 + 2: JS_STATEMENT_LIST@256..256 + 3: R_CURLY@256..257 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@257..276 + 0: JS_METHOD_MODIFIER_LIST@257..267 + 0: JS_STATIC_MODIFIER@257..267 + 0: STATIC_KW@257..267 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@267..270 + 0: IDENT@267..270 "set" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@270..274 + 0: L_PAREN@270..271 "(" [] [] + 1: JS_PARAMETER_LIST@271..272 + 0: JS_FORMAL_PARAMETER@271..272 + 0: JS_DECORATOR_LIST@271..271 + 1: JS_IDENTIFIER_BINDING@271..272 + 0: IDENT@271..272 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@272..274 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@274..276 + 0: L_CURLY@274..275 "{" [] [] + 1: JS_DIRECTIVE_LIST@275..275 + 2: JS_STATEMENT_LIST@275..275 + 3: R_CURLY@275..276 "}" [] [] + 9: R_CURLY@276..278 "}" [Newline("\n")] [] + 4: EOF@278..279 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_object_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/setter_object_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js.snap new file mode 100644 index 000000000000..d57470d27756 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js.snap @@ -0,0 +1,381 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + set foo(value) { + }, + set a(value,) { + }, + set "bar"(value) { + }, + set ["a" + "b"](value) { + }, + set 5(value) { + }, + set() { + return "This is a method and not a setter"; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsObjectMemberList [ + JsSetterObjectMember { + set_token: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@15..18 "foo" [] [], + }, + l_paren_token: L_PAREN@18..19 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@19..24 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@26..27 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@27..30 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@30..31 "," [] [], + JsSetterObjectMember { + set_token: SET_KW@31..37 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@37..38 "a" [] [], + }, + l_paren_token: L_PAREN@38..39 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@39..44 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: COMMA@44..45 "," [] [], + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@47..48 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@51..52 "," [] [], + JsSetterObjectMember { + set_token: SET_KW@52..58 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@58..63 "\"bar\"" [] [], + }, + l_paren_token: L_PAREN@63..64 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@64..69 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@71..72 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@72..75 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@75..76 "," [] [], + JsSetterObjectMember { + set_token: SET_KW@76..82 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsComputedMemberName { + l_brack_token: L_BRACK@82..83 "[" [] [], + expression: JsBinaryExpression { + left: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@83..87 "\"a\"" [] [Whitespace(" ")], + }, + operator_token: PLUS@87..89 "+" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@89..92 "\"b\"" [] [], + }, + }, + r_brack_token: R_BRACK@92..93 "]" [] [], + }, + l_paren_token: L_PAREN@93..94 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@94..99 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@101..102 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@102..105 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@105..106 "," [] [], + JsSetterObjectMember { + set_token: SET_KW@106..112 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@112..113 "5" [] [], + }, + l_paren_token: L_PAREN@113..114 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@114..119 "value" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@119..121 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@121..122 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@122..125 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + COMMA@125..126 "," [] [], + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@126..131 "set" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@131..132 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@132..134 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@134..135 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@135..145 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@145..180 "\"This is a method and not a setter\"" [] [], + }, + semicolon_token: SEMICOLON@180..181 ";" [] [], + }, + ], + r_curly_token: R_CURLY@181..184 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@184..186 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@186..187 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..187 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..186 + 0: JS_VARIABLE_STATEMENT@0..186 + 0: JS_VARIABLE_DECLARATION@0..186 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..186 + 0: JS_VARIABLE_DECLARATOR@4..186 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..186 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..186 + 0: L_CURLY@8..9 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@9..184 + 0: JS_SETTER_OBJECT_MEMBER@9..30 + 0: SET_KW@9..15 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@15..18 + 0: IDENT@15..18 "foo" [] [] + 2: L_PAREN@18..19 "(" [] [] + 3: JS_FORMAL_PARAMETER@19..24 + 0: JS_DECORATOR_LIST@19..19 + 1: JS_IDENTIFIER_BINDING@19..24 + 0: IDENT@19..24 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@26..30 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..27 + 3: R_CURLY@27..30 "}" [Newline("\n"), Whitespace(" ")] [] + 1: COMMA@30..31 "," [] [] + 2: JS_SETTER_OBJECT_MEMBER@31..51 + 0: SET_KW@31..37 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@37..38 + 0: IDENT@37..38 "a" [] [] + 2: L_PAREN@38..39 "(" [] [] + 3: JS_FORMAL_PARAMETER@39..44 + 0: JS_DECORATOR_LIST@39..39 + 1: JS_IDENTIFIER_BINDING@39..44 + 0: IDENT@39..44 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: COMMA@44..45 "," [] [] + 5: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@47..51 + 0: L_CURLY@47..48 "{" [] [] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..48 + 3: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [] + 3: COMMA@51..52 "," [] [] + 4: JS_SETTER_OBJECT_MEMBER@52..75 + 0: SET_KW@52..58 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@58..63 + 0: JS_STRING_LITERAL@58..63 "\"bar\"" [] [] + 2: L_PAREN@63..64 "(" [] [] + 3: JS_FORMAL_PARAMETER@64..69 + 0: JS_DECORATOR_LIST@64..64 + 1: JS_IDENTIFIER_BINDING@64..69 + 0: IDENT@64..69 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@69..71 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@71..75 + 0: L_CURLY@71..72 "{" [] [] + 1: JS_DIRECTIVE_LIST@72..72 + 2: JS_STATEMENT_LIST@72..72 + 3: R_CURLY@72..75 "}" [Newline("\n"), Whitespace(" ")] [] + 5: COMMA@75..76 "," [] [] + 6: JS_SETTER_OBJECT_MEMBER@76..105 + 0: SET_KW@76..82 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_NAME@82..93 + 0: L_BRACK@82..83 "[" [] [] + 1: JS_BINARY_EXPRESSION@83..92 + 0: JS_STRING_LITERAL_EXPRESSION@83..87 + 0: JS_STRING_LITERAL@83..87 "\"a\"" [] [Whitespace(" ")] + 1: PLUS@87..89 "+" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@89..92 + 0: JS_STRING_LITERAL@89..92 "\"b\"" [] [] + 2: R_BRACK@92..93 "]" [] [] + 2: L_PAREN@93..94 "(" [] [] + 3: JS_FORMAL_PARAMETER@94..99 + 0: JS_DECORATOR_LIST@94..94 + 1: JS_IDENTIFIER_BINDING@94..99 + 0: IDENT@94..99 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@99..101 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@101..105 + 0: L_CURLY@101..102 "{" [] [] + 1: JS_DIRECTIVE_LIST@102..102 + 2: JS_STATEMENT_LIST@102..102 + 3: R_CURLY@102..105 "}" [Newline("\n"), Whitespace(" ")] [] + 7: COMMA@105..106 "," [] [] + 8: JS_SETTER_OBJECT_MEMBER@106..125 + 0: SET_KW@106..112 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@112..113 + 0: JS_NUMBER_LITERAL@112..113 "5" [] [] + 2: L_PAREN@113..114 "(" [] [] + 3: JS_FORMAL_PARAMETER@114..119 + 0: JS_DECORATOR_LIST@114..114 + 1: JS_IDENTIFIER_BINDING@114..119 + 0: IDENT@114..119 "value" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@119..121 ")" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@121..125 + 0: L_CURLY@121..122 "{" [] [] + 1: JS_DIRECTIVE_LIST@122..122 + 2: JS_STATEMENT_LIST@122..122 + 3: R_CURLY@122..125 "}" [Newline("\n"), Whitespace(" ")] [] + 9: COMMA@125..126 "," [] [] + 10: JS_METHOD_OBJECT_MEMBER@126..184 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@126..131 + 0: IDENT@126..131 "set" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@131..134 + 0: L_PAREN@131..132 "(" [] [] + 1: JS_PARAMETER_LIST@132..132 + 2: R_PAREN@132..134 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@134..184 + 0: L_CURLY@134..135 "{" [] [] + 1: JS_DIRECTIVE_LIST@135..135 + 2: JS_STATEMENT_LIST@135..181 + 0: JS_RETURN_STATEMENT@135..181 + 0: RETURN_KW@135..145 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@145..180 + 0: JS_STRING_LITERAL@145..180 "\"This is a method and not a setter\"" [] [] + 2: SEMICOLON@180..181 ";" [] [] + 3: R_CURLY@181..184 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@184..186 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@186..187 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.js b/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.js rename to crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap new file mode 100644 index 000000000000..17a1e1bde44d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap @@ -0,0 +1,90 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let id = async => async; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..7 "id" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@9..15 "async" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@15..18 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..23 "async" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_VARIABLE_STATEMENT@0..24 + 0: JS_VARIABLE_DECLARATION@0..23 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..23 + 0: JS_VARIABLE_DECLARATOR@4..23 + 0: JS_IDENTIFIER_BINDING@4..7 + 0: IDENT@4..7 "id" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@7..23 + 0: EQ@7..9 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@9..23 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@9..15 + 0: IDENT@9..15 "async" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@15..18 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@18..23 + 0: JS_REFERENCE_IDENTIFIER@18..23 + 0: IDENT@18..23 "async" [] [] + 1: SEMICOLON@23..24 ";" [] [] + 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js.snap new file mode 100644 index 000000000000..0267853f46bb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js.snap @@ -0,0 +1,158 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + static async * constructor() {} + static * constructor() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@18..24 "async" [] [Whitespace(" ")], + star_token: STAR@24..26 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@26..37 "constructor" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@37..38 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@38..40 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@40..41 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@41..42 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@42..51 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: STAR@51..53 "*" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@53..64 "constructor" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@64..65 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@67..68 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@68..69 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@69..71 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@71..72 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..72 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..71 + 0: JS_CLASS_DECLARATION@0..71 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..69 + 0: JS_METHOD_CLASS_MEMBER@9..42 + 0: JS_METHOD_MODIFIER_LIST@9..18 + 0: JS_STATIC_MODIFIER@9..18 + 0: STATIC_KW@9..18 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 1: ASYNC_KW@18..24 "async" [] [Whitespace(" ")] + 2: STAR@24..26 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@26..37 + 0: IDENT@26..37 "constructor" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@37..40 + 0: L_PAREN@37..38 "(" [] [] + 1: JS_PARAMETER_LIST@38..38 + 2: R_PAREN@38..40 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@40..42 + 0: L_CURLY@40..41 "{" [] [] + 1: JS_DIRECTIVE_LIST@41..41 + 2: JS_STATEMENT_LIST@41..41 + 3: R_CURLY@41..42 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@42..69 + 0: JS_METHOD_MODIFIER_LIST@42..51 + 0: JS_STATIC_MODIFIER@42..51 + 0: STATIC_KW@42..51 "static" [Newline("\n"), Whitespace("\t")] [Whitespace(" ")] + 1: (empty) + 2: STAR@51..53 "*" [] [Whitespace(" ")] + 3: JS_LITERAL_MEMBER_NAME@53..64 + 0: IDENT@53..64 "constructor" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@64..67 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_PARAMETER_LIST@65..65 + 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@67..69 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_DIRECTIVE_LIST@68..68 + 2: JS_STATEMENT_LIST@68..68 + 3: R_CURLY@68..69 "}" [] [] + 9: R_CURLY@69..71 "}" [Newline("\n")] [] + 4: EOF@71..72 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js.snap new file mode 100644 index 000000000000..1f5e6cdac074 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js.snap @@ -0,0 +1,132 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + static a; + static { + this.a = "test"; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@9..19 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@19..20 "a" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@21..31 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + l_curly_token: L_CURLY@31..32 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsThisExpression { + this_token: THIS_KW@32..41 "this" [Newline("\n"), Whitespace(" ")] [], + }, + dot_token: DOT@41..42 "." [] [], + member: JsName { + value_token: IDENT@42..44 "a" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@44..46 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@46..52 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@52..53 ";" [] [], + }, + ], + r_curly_token: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@57..59 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@59..60 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..60 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..59 + 0: JS_CLASS_DECLARATION@0..59 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..57 + 0: JS_PROPERTY_CLASS_MEMBER@9..21 + 0: JS_PROPERTY_MODIFIER_LIST@9..19 + 0: JS_STATIC_MODIFIER@9..19 + 0: STATIC_KW@9..19 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@19..20 + 0: IDENT@19..20 "a" [] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@20..21 ";" [] [] + 1: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@21..57 + 0: STATIC_KW@21..31 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_CURLY@31..32 "{" [] [] + 2: JS_STATEMENT_LIST@32..53 + 0: JS_EXPRESSION_STATEMENT@32..53 + 0: JS_ASSIGNMENT_EXPRESSION@32..52 + 0: JS_STATIC_MEMBER_ASSIGNMENT@32..44 + 0: JS_THIS_EXPRESSION@32..41 + 0: THIS_KW@32..41 "this" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@41..42 "." [] [] + 2: JS_NAME@42..44 + 0: IDENT@42..44 "a" [] [Whitespace(" ")] + 1: EQ@44..46 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@46..52 + 0: JS_STRING_LITERAL@46..52 "\"test\"" [] [] + 1: SEMICOLON@52..53 ";" [] [] + 3: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@57..59 "}" [Newline("\n")] [] + 4: EOF@59..60 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_member_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_member_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js.snap new file mode 100644 index 000000000000..8d81bb82967e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js.snap @@ -0,0 +1,385 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo.bar +foo.await +foo.yield +foo.for +foo?.for +foo?.bar +class Test { + #bar + test(other) { + this.#bar; + this?.#bar; + other.#bar; + other?.#bar; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + operator_token: DOT@3..4 "." [] [], + member: JsName { + value_token: IDENT@4..7 "bar" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..11 "foo" [Newline("\n")] [], + }, + }, + operator_token: DOT@11..12 "." [] [], + member: JsName { + value_token: IDENT@12..17 "await" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..21 "foo" [Newline("\n")] [], + }, + }, + operator_token: DOT@21..22 "." [] [], + member: JsName { + value_token: IDENT@22..27 "yield" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..31 "foo" [Newline("\n")] [], + }, + }, + operator_token: DOT@31..32 "." [] [], + member: JsName { + value_token: IDENT@32..35 "for" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@35..39 "foo" [Newline("\n")] [], + }, + }, + operator_token: QUESTIONDOT@39..41 "?." [] [], + member: JsName { + value_token: IDENT@41..44 "for" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..48 "foo" [Newline("\n")] [], + }, + }, + operator_token: QUESTIONDOT@48..50 "?." [] [], + member: JsName { + value_token: IDENT@50..53 "bar" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@53..60 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@60..65 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@65..66 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@66..70 "#" [Newline("\n"), Whitespace(" ")] [], + id_token: IDENT@70..73 "bar" [] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: missing (optional), + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@73..80 "test" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@80..81 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@81..86 "other" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@86..88 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@88..89 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@89..98 "this" [Newline("\n"), Whitespace(" ")] [], + }, + operator_token: DOT@98..99 "." [] [], + member: JsPrivateName { + hash_token: HASH@99..100 "#" [] [], + value_token: IDENT@100..103 "bar" [] [], + }, + }, + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@104..113 "this" [Newline("\n"), Whitespace(" ")] [], + }, + operator_token: QUESTIONDOT@113..115 "?." [] [], + member: JsPrivateName { + hash_token: HASH@115..116 "#" [] [], + value_token: IDENT@116..119 "bar" [] [], + }, + }, + semicolon_token: SEMICOLON@119..120 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@120..130 "other" [Newline("\n"), Whitespace(" ")] [], + }, + }, + operator_token: DOT@130..131 "." [] [], + member: JsPrivateName { + hash_token: HASH@131..132 "#" [] [], + value_token: IDENT@132..135 "bar" [] [], + }, + }, + semicolon_token: SEMICOLON@135..136 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@136..146 "other" [Newline("\n"), Whitespace(" ")] [], + }, + }, + operator_token: QUESTIONDOT@146..148 "?." [] [], + member: JsPrivateName { + hash_token: HASH@148..149 "#" [] [], + value_token: IDENT@149..152 "bar" [] [], + }, + }, + semicolon_token: SEMICOLON@152..153 ";" [] [], + }, + ], + r_curly_token: R_CURLY@153..157 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@157..159 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@159..160 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..160 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..159 + 0: JS_EXPRESSION_STATEMENT@0..7 + 0: JS_STATIC_MEMBER_EXPRESSION@0..7 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: DOT@3..4 "." [] [] + 2: JS_NAME@4..7 + 0: IDENT@4..7 "bar" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@7..17 + 0: JS_STATIC_MEMBER_EXPRESSION@7..17 + 0: JS_IDENTIFIER_EXPRESSION@7..11 + 0: JS_REFERENCE_IDENTIFIER@7..11 + 0: IDENT@7..11 "foo" [Newline("\n")] [] + 1: DOT@11..12 "." [] [] + 2: JS_NAME@12..17 + 0: IDENT@12..17 "await" [] [] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@17..27 + 0: JS_STATIC_MEMBER_EXPRESSION@17..27 + 0: JS_IDENTIFIER_EXPRESSION@17..21 + 0: JS_REFERENCE_IDENTIFIER@17..21 + 0: IDENT@17..21 "foo" [Newline("\n")] [] + 1: DOT@21..22 "." [] [] + 2: JS_NAME@22..27 + 0: IDENT@22..27 "yield" [] [] + 1: (empty) + 3: JS_EXPRESSION_STATEMENT@27..35 + 0: JS_STATIC_MEMBER_EXPRESSION@27..35 + 0: JS_IDENTIFIER_EXPRESSION@27..31 + 0: JS_REFERENCE_IDENTIFIER@27..31 + 0: IDENT@27..31 "foo" [Newline("\n")] [] + 1: DOT@31..32 "." [] [] + 2: JS_NAME@32..35 + 0: IDENT@32..35 "for" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@35..44 + 0: JS_STATIC_MEMBER_EXPRESSION@35..44 + 0: JS_IDENTIFIER_EXPRESSION@35..39 + 0: JS_REFERENCE_IDENTIFIER@35..39 + 0: IDENT@35..39 "foo" [Newline("\n")] [] + 1: QUESTIONDOT@39..41 "?." [] [] + 2: JS_NAME@41..44 + 0: IDENT@41..44 "for" [] [] + 1: (empty) + 5: JS_EXPRESSION_STATEMENT@44..53 + 0: JS_STATIC_MEMBER_EXPRESSION@44..53 + 0: JS_IDENTIFIER_EXPRESSION@44..48 + 0: JS_REFERENCE_IDENTIFIER@44..48 + 0: IDENT@44..48 "foo" [Newline("\n")] [] + 1: QUESTIONDOT@48..50 "?." [] [] + 2: JS_NAME@50..53 + 0: IDENT@50..53 "bar" [] [] + 1: (empty) + 6: JS_CLASS_DECLARATION@53..159 + 0: JS_DECORATOR_LIST@53..53 + 1: (empty) + 2: CLASS_KW@53..60 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@60..65 + 0: IDENT@60..65 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@65..66 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@66..157 + 0: JS_PROPERTY_CLASS_MEMBER@66..73 + 0: JS_PROPERTY_MODIFIER_LIST@66..66 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@66..73 + 0: HASH@66..70 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@70..73 "bar" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: JS_METHOD_CLASS_MEMBER@73..157 + 0: JS_METHOD_MODIFIER_LIST@73..73 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@73..80 + 0: IDENT@73..80 "test" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@80..88 + 0: L_PAREN@80..81 "(" [] [] + 1: JS_PARAMETER_LIST@81..86 + 0: JS_FORMAL_PARAMETER@81..86 + 0: JS_DECORATOR_LIST@81..81 + 1: JS_IDENTIFIER_BINDING@81..86 + 0: IDENT@81..86 "other" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@86..88 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@88..157 + 0: L_CURLY@88..89 "{" [] [] + 1: JS_DIRECTIVE_LIST@89..89 + 2: JS_STATEMENT_LIST@89..153 + 0: JS_EXPRESSION_STATEMENT@89..104 + 0: JS_STATIC_MEMBER_EXPRESSION@89..103 + 0: JS_THIS_EXPRESSION@89..98 + 0: THIS_KW@89..98 "this" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@98..99 "." [] [] + 2: JS_PRIVATE_NAME@99..103 + 0: HASH@99..100 "#" [] [] + 1: IDENT@100..103 "bar" [] [] + 1: SEMICOLON@103..104 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@104..120 + 0: JS_STATIC_MEMBER_EXPRESSION@104..119 + 0: JS_THIS_EXPRESSION@104..113 + 0: THIS_KW@104..113 "this" [Newline("\n"), Whitespace(" ")] [] + 1: QUESTIONDOT@113..115 "?." [] [] + 2: JS_PRIVATE_NAME@115..119 + 0: HASH@115..116 "#" [] [] + 1: IDENT@116..119 "bar" [] [] + 1: SEMICOLON@119..120 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@120..136 + 0: JS_STATIC_MEMBER_EXPRESSION@120..135 + 0: JS_IDENTIFIER_EXPRESSION@120..130 + 0: JS_REFERENCE_IDENTIFIER@120..130 + 0: IDENT@120..130 "other" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@130..131 "." [] [] + 2: JS_PRIVATE_NAME@131..135 + 0: HASH@131..132 "#" [] [] + 1: IDENT@132..135 "bar" [] [] + 1: SEMICOLON@135..136 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@136..153 + 0: JS_STATIC_MEMBER_EXPRESSION@136..152 + 0: JS_IDENTIFIER_EXPRESSION@136..146 + 0: JS_REFERENCE_IDENTIFIER@136..146 + 0: IDENT@136..146 "other" [Newline("\n"), Whitespace(" ")] [] + 1: QUESTIONDOT@146..148 "?." [] [] + 2: JS_PRIVATE_NAME@148..152 + 0: HASH@148..149 "#" [] [] + 1: IDENT@149..152 "bar" [] [] + 1: SEMICOLON@152..153 ";" [] [] + 3: R_CURLY@153..157 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@157..159 "}" [Newline("\n")] [] + 4: EOF@159..160 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_method.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js.snap new file mode 100644 index 000000000000..ada077620cd0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js.snap @@ -0,0 +1,269 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + static foo(bar) {} + static *foo() {} + static async foo() {} + static async *foo() {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@11..20 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@20..23 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..27 "bar" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@29..30 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@31..40 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: STAR@40..41 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@41..44 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@45..47 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@47..48 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@49..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@58..64 "async" [] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@64..67 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@67..68 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@70..71 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@71..72 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@72..81 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: ASYNC_KW@81..87 "async" [] [Whitespace(" ")], + star_token: STAR@87..88 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@88..91 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@91..92 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@92..94 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@94..95 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@95..96 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@96..98 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@98..99 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..99 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..98 + 0: JS_CLASS_DECLARATION@0..98 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..96 + 0: JS_METHOD_CLASS_MEMBER@11..31 + 0: JS_METHOD_MODIFIER_LIST@11..20 + 0: JS_STATIC_MODIFIER@11..20 + 0: STATIC_KW@11..20 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@20..23 + 0: IDENT@20..23 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@23..29 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..27 + 0: JS_FORMAL_PARAMETER@24..27 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..27 + 0: IDENT@24..27 "bar" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@27..29 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@29..31 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_DIRECTIVE_LIST@30..30 + 2: JS_STATEMENT_LIST@30..30 + 3: R_CURLY@30..31 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@31..49 + 0: JS_METHOD_MODIFIER_LIST@31..40 + 0: JS_STATIC_MODIFIER@31..40 + 0: STATIC_KW@31..40 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: STAR@40..41 "*" [] [] + 3: JS_LITERAL_MEMBER_NAME@41..44 + 0: IDENT@41..44 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..45 + 2: R_PAREN@45..47 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@47..49 + 0: L_CURLY@47..48 "{" [] [] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..48 + 3: R_CURLY@48..49 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@49..72 + 0: JS_METHOD_MODIFIER_LIST@49..58 + 0: JS_STATIC_MODIFIER@49..58 + 0: STATIC_KW@49..58 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@58..64 "async" [] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@64..67 + 0: IDENT@64..67 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@67..70 + 0: L_PAREN@67..68 "(" [] [] + 1: JS_PARAMETER_LIST@68..68 + 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@70..72 + 0: L_CURLY@70..71 "{" [] [] + 1: JS_DIRECTIVE_LIST@71..71 + 2: JS_STATEMENT_LIST@71..71 + 3: R_CURLY@71..72 "}" [] [] + 3: JS_METHOD_CLASS_MEMBER@72..96 + 0: JS_METHOD_MODIFIER_LIST@72..81 + 0: JS_STATIC_MODIFIER@72..81 + 0: STATIC_KW@72..81 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: ASYNC_KW@81..87 "async" [] [Whitespace(" ")] + 2: STAR@87..88 "*" [] [] + 3: JS_LITERAL_MEMBER_NAME@88..91 + 0: IDENT@88..91 "foo" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@91..94 + 0: L_PAREN@91..92 "(" [] [] + 1: JS_PARAMETER_LIST@92..92 + 2: R_PAREN@92..94 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@94..96 + 0: L_CURLY@94..95 "{" [] [] + 1: JS_DIRECTIVE_LIST@95..95 + 2: JS_STATEMENT_LIST@95..95 + 3: R_CURLY@95..96 "}" [] [] + 9: R_CURLY@96..98 "}" [Newline("\n")] [] + 4: EOF@98..99 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/subscripts.js b/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/subscripts.js rename to crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js.snap new file mode 100644 index 000000000000..92ee2273d23b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js.snap @@ -0,0 +1,172 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo`bar` +foo(bar)(baz)(baz)[bar] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsTemplateExpression { + tag: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..3 "foo" [] [], + }, + }, + type_arguments: missing (optional), + l_tick_token: BACKTICK@3..4 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@4..7 "bar" [] [], + }, + ], + r_tick_token: BACKTICK@7..8 "`" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsCallExpression { + callee: JsCallExpression { + callee: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..12 "foo" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@12..13 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..16 "bar" [] [], + }, + }, + ], + r_paren_token: R_PAREN@16..17 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@17..18 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..21 "baz" [] [], + }, + }, + ], + r_paren_token: R_PAREN@21..22 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@22..23 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..26 "baz" [] [], + }, + }, + ], + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@27..28 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..31 "bar" [] [], + }, + }, + r_brack_token: R_BRACK@31..32 "]" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@32..33 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..33 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..32 + 0: JS_EXPRESSION_STATEMENT@0..8 + 0: JS_TEMPLATE_EXPRESSION@0..8 + 0: JS_IDENTIFIER_EXPRESSION@0..3 + 0: JS_REFERENCE_IDENTIFIER@0..3 + 0: IDENT@0..3 "foo" [] [] + 1: (empty) + 2: BACKTICK@3..4 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@4..7 + 0: JS_TEMPLATE_CHUNK_ELEMENT@4..7 + 0: TEMPLATE_CHUNK@4..7 "bar" [] [] + 4: BACKTICK@7..8 "`" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@8..32 + 0: JS_COMPUTED_MEMBER_EXPRESSION@8..32 + 0: JS_CALL_EXPRESSION@8..27 + 0: JS_CALL_EXPRESSION@8..22 + 0: JS_CALL_EXPRESSION@8..17 + 0: JS_IDENTIFIER_EXPRESSION@8..12 + 0: JS_REFERENCE_IDENTIFIER@8..12 + 0: IDENT@8..12 "foo" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@12..17 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@13..16 + 0: JS_IDENTIFIER_EXPRESSION@13..16 + 0: JS_REFERENCE_IDENTIFIER@13..16 + 0: IDENT@13..16 "bar" [] [] + 2: R_PAREN@16..17 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@17..22 + 0: L_PAREN@17..18 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@18..21 + 0: JS_IDENTIFIER_EXPRESSION@18..21 + 0: JS_REFERENCE_IDENTIFIER@18..21 + 0: IDENT@18..21 "baz" [] [] + 2: R_PAREN@21..22 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@22..27 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@23..26 + 0: JS_IDENTIFIER_EXPRESSION@23..26 + 0: JS_REFERENCE_IDENTIFIER@23..26 + 0: IDENT@23..26 "baz" [] [] + 2: R_PAREN@26..27 ")" [] [] + 1: (empty) + 2: L_BRACK@27..28 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@28..31 + 0: JS_REFERENCE_IDENTIFIER@28..31 + 0: IDENT@28..31 "bar" [] [] + 4: R_BRACK@31..32 "]" [] [] + 1: (empty) + 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/super_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js.snap new file mode 100644 index 000000000000..9a4ade8d6bb6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js.snap @@ -0,0 +1,261 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test extends B { + constructor() { + super(); + } + test() { + super.test(a, b); + super[1]; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@19..21 "B" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@21..22 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@22..36 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@39..40 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@40..50 "super" [Newline("\n"), Whitespace(" ")] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@50..51 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@51..52 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@52..53 ";" [] [], + }, + ], + r_curly_token: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@57..64 "test" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@64..65 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@67..68 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsSuperExpression { + super_token: SUPER_KW@68..78 "super" [Newline("\n"), Whitespace(" ")] [], + }, + operator_token: DOT@78..79 "." [] [], + member: JsName { + value_token: IDENT@79..83 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@83..84 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..85 "a" [] [], + }, + }, + COMMA@85..87 "," [] [Whitespace(" ")], + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@87..88 "b" [] [], + }, + }, + ], + r_paren_token: R_PAREN@88..89 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@89..90 ";" [] [], + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsSuperExpression { + super_token: SUPER_KW@90..100 "super" [Newline("\n"), Whitespace(" ")] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@100..101 "[" [] [], + member: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@101..102 "1" [] [], + }, + r_brack_token: R_BRACK@102..103 "]" [] [], + }, + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + ], + r_curly_token: R_CURLY@104..108 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@108..110 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@110..111 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..111 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..110 + 0: JS_CLASS_DECLARATION@0..110 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@11..21 + 0: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@19..21 + 0: JS_REFERENCE_IDENTIFIER@19..21 + 0: IDENT@19..21 "B" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@21..22 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@22..108 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@22..57 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@22..22 + 1: JS_LITERAL_MEMBER_NAME@22..36 + 0: IDENT@22..36 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@36..39 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@37..37 + 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@39..57 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..53 + 0: JS_EXPRESSION_STATEMENT@40..53 + 0: JS_CALL_EXPRESSION@40..52 + 0: JS_SUPER_EXPRESSION@40..50 + 0: SUPER_KW@40..50 "super" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@50..52 + 0: L_PAREN@50..51 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@51..51 + 2: R_PAREN@51..52 ")" [] [] + 1: SEMICOLON@52..53 ";" [] [] + 3: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [] + 1: JS_METHOD_CLASS_MEMBER@57..108 + 0: JS_METHOD_MODIFIER_LIST@57..57 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@57..64 + 0: IDENT@57..64 "test" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@64..67 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_PARAMETER_LIST@65..65 + 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@67..108 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_DIRECTIVE_LIST@68..68 + 2: JS_STATEMENT_LIST@68..104 + 0: JS_EXPRESSION_STATEMENT@68..90 + 0: JS_CALL_EXPRESSION@68..89 + 0: JS_STATIC_MEMBER_EXPRESSION@68..83 + 0: JS_SUPER_EXPRESSION@68..78 + 0: SUPER_KW@68..78 "super" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@78..79 "." [] [] + 2: JS_NAME@79..83 + 0: IDENT@79..83 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@83..89 + 0: L_PAREN@83..84 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@84..88 + 0: JS_IDENTIFIER_EXPRESSION@84..85 + 0: JS_REFERENCE_IDENTIFIER@84..85 + 0: IDENT@84..85 "a" [] [] + 1: COMMA@85..87 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@87..88 + 0: JS_REFERENCE_IDENTIFIER@87..88 + 0: IDENT@87..88 "b" [] [] + 2: R_PAREN@88..89 ")" [] [] + 1: SEMICOLON@89..90 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@90..104 + 0: JS_COMPUTED_MEMBER_EXPRESSION@90..103 + 0: JS_SUPER_EXPRESSION@90..100 + 0: SUPER_KW@90..100 "super" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: L_BRACK@100..101 "[" [] [] + 3: JS_NUMBER_LITERAL_EXPRESSION@101..102 + 0: JS_NUMBER_LITERAL@101..102 "1" [] [] + 4: R_BRACK@102..103 "]" [] [] + 1: SEMICOLON@103..104 ";" [] [] + 3: R_CURLY@104..108 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@108..110 "}" [Newline("\n")] [] + 4: EOF@110..111 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.js b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.js rename to crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap new file mode 100644 index 000000000000..535651c30280 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap @@ -0,0 +1,147 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A extends B { constructor(c = super()) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..18 "B" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..31 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..34 "c" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@34..36 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@36..41 "super" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@41..42 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@42..43 ")" [] [], + }, + }, + }, + }, + ], + r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@45..46 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@46..48 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_CLASS_DECLARATION@0..49 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@8..18 + 0: EXTENDS_KW@8..16 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@16..18 + 0: JS_REFERENCE_IDENTIFIER@16..18 + 0: IDENT@16..18 "B" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..48 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..48 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..31 + 0: IDENT@20..31 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@31..45 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..43 + 0: JS_FORMAL_PARAMETER@32..43 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..34 + 0: IDENT@32..34 "c" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@34..43 + 0: EQ@34..36 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@36..43 + 0: JS_SUPER_EXPRESSION@36..41 + 0: SUPER_KW@36..41 "super" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@41..43 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@42..42 + 2: R_PAREN@42..43 ")" [] [] + 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@45..48 + 0: L_CURLY@45..46 "{" [] [] + 1: JS_DIRECTIVE_LIST@46..46 + 2: JS_STATEMENT_LIST@46..46 + 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] + 9: R_CURLY@48..49 "}" [] [] + 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/switch_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/switch_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js.snap new file mode 100644 index 000000000000..53f860e11514 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +switch (foo) { + case bar: + default: +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsSwitchStatement { + switch_token: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")], + l_paren_token: L_PAREN@7..8 "(" [] [], + discriminant: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@8..11 "foo" [] [], + }, + }, + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + l_curly_token: L_CURLY@13..14 "{" [] [], + cases: JsSwitchCaseList [ + JsCaseClause { + case_token: CASE_KW@14..21 "case" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..24 "bar" [] [], + }, + }, + colon_token: COLON@24..25 ":" [] [], + consequent: JsStatementList [], + }, + JsDefaultClause { + default_token: DEFAULT_KW@25..34 "default" [Newline("\n"), Whitespace(" ")] [], + colon_token: COLON@34..35 ":" [] [], + consequent: JsStatementList [], + }, + ], + r_curly_token: R_CURLY@35..37 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@37..38 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..38 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..37 + 0: JS_SWITCH_STATEMENT@0..37 + 0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")] + 1: L_PAREN@7..8 "(" [] [] + 2: JS_IDENTIFIER_EXPRESSION@8..11 + 0: JS_REFERENCE_IDENTIFIER@8..11 + 0: IDENT@8..11 "foo" [] [] + 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 4: L_CURLY@13..14 "{" [] [] + 5: JS_SWITCH_CASE_LIST@14..35 + 0: JS_CASE_CLAUSE@14..25 + 0: CASE_KW@14..21 "case" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@21..24 + 0: JS_REFERENCE_IDENTIFIER@21..24 + 0: IDENT@21..24 "bar" [] [] + 2: COLON@24..25 ":" [] [] + 3: JS_STATEMENT_LIST@25..25 + 1: JS_DEFAULT_CLAUSE@25..35 + 0: DEFAULT_KW@25..34 "default" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@34..35 ":" [] [] + 2: JS_STATEMENT_LIST@35..35 + 6: R_CURLY@35..37 "}" [Newline("\n")] [] + 4: EOF@37..38 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/template_literal.js b/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/template_literal.js rename to crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js.snap new file mode 100644 index 000000000000..2901ee427c25 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js.snap @@ -0,0 +1,331 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = `foo ${bar}`; +let b = ``; +let c = `${foo}`; +let d = `foo`; +let e = `${{ a: "string" }}`; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@8..9 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@9..13 "foo " [] [], + }, + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@13..15 "${" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@15..18 "bar" [] [], + }, + }, + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + ], + r_tick_token: BACKTICK@19..20 "`" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@26..28 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@30..31 "`" [] [], + elements: JsTemplateElementList [], + r_tick_token: BACKTICK@31..32 "`" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@38..40 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@42..43 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@43..45 "${" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..48 "foo" [] [], + }, + }, + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + ], + r_tick_token: BACKTICK@49..50 "`" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@51..56 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@56..58 "d" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@58..60 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@60..61 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@61..64 "foo" [] [], + }, + ], + r_tick_token: BACKTICK@64..65 "`" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..66 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@71..73 "e" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@75..76 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@76..78 "${" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@80..81 "a" [] [], + }, + colon_token: COLON@81..83 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + r_curly_token: R_CURLY@93..94 "}" [] [], + }, + ], + r_tick_token: BACKTICK@94..95 "`" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@95..96 ";" [] [], + }, + ], + eof_token: EOF@96..97 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..97 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..96 + 0: JS_VARIABLE_STATEMENT@0..21 + 0: JS_VARIABLE_DECLARATION@0..20 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..20 + 0: JS_VARIABLE_DECLARATOR@4..20 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..20 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@8..20 + 0: (empty) + 1: (empty) + 2: BACKTICK@8..9 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@9..19 + 0: JS_TEMPLATE_CHUNK_ELEMENT@9..13 + 0: TEMPLATE_CHUNK@9..13 "foo " [] [] + 1: JS_TEMPLATE_ELEMENT@13..19 + 0: DOLLAR_CURLY@13..15 "${" [] [] + 1: JS_IDENTIFIER_EXPRESSION@15..18 + 0: JS_REFERENCE_IDENTIFIER@15..18 + 0: IDENT@15..18 "bar" [] [] + 2: R_CURLY@18..19 "}" [] [] + 4: BACKTICK@19..20 "`" [] [] + 1: SEMICOLON@20..21 ";" [] [] + 1: JS_VARIABLE_STATEMENT@21..33 + 0: JS_VARIABLE_DECLARATION@21..32 + 0: (empty) + 1: LET_KW@21..26 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@26..32 + 0: JS_VARIABLE_DECLARATOR@26..32 + 0: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@28..32 + 0: EQ@28..30 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@30..32 + 0: (empty) + 1: (empty) + 2: BACKTICK@30..31 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@31..31 + 4: BACKTICK@31..32 "`" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_VARIABLE_STATEMENT@33..51 + 0: JS_VARIABLE_DECLARATION@33..50 + 0: (empty) + 1: LET_KW@33..38 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@38..50 + 0: JS_VARIABLE_DECLARATOR@38..50 + 0: JS_IDENTIFIER_BINDING@38..40 + 0: IDENT@38..40 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@40..50 + 0: EQ@40..42 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@42..50 + 0: (empty) + 1: (empty) + 2: BACKTICK@42..43 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@43..49 + 0: JS_TEMPLATE_ELEMENT@43..49 + 0: DOLLAR_CURLY@43..45 "${" [] [] + 1: JS_IDENTIFIER_EXPRESSION@45..48 + 0: JS_REFERENCE_IDENTIFIER@45..48 + 0: IDENT@45..48 "foo" [] [] + 2: R_CURLY@48..49 "}" [] [] + 4: BACKTICK@49..50 "`" [] [] + 1: SEMICOLON@50..51 ";" [] [] + 3: JS_VARIABLE_STATEMENT@51..66 + 0: JS_VARIABLE_DECLARATION@51..65 + 0: (empty) + 1: LET_KW@51..56 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@56..65 + 0: JS_VARIABLE_DECLARATOR@56..65 + 0: JS_IDENTIFIER_BINDING@56..58 + 0: IDENT@56..58 "d" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@58..65 + 0: EQ@58..60 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@60..65 + 0: (empty) + 1: (empty) + 2: BACKTICK@60..61 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@61..64 + 0: JS_TEMPLATE_CHUNK_ELEMENT@61..64 + 0: TEMPLATE_CHUNK@61..64 "foo" [] [] + 4: BACKTICK@64..65 "`" [] [] + 1: SEMICOLON@65..66 ";" [] [] + 4: JS_VARIABLE_STATEMENT@66..96 + 0: JS_VARIABLE_DECLARATION@66..95 + 0: (empty) + 1: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@71..95 + 0: JS_VARIABLE_DECLARATOR@71..95 + 0: JS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "e" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@73..95 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: JS_TEMPLATE_EXPRESSION@75..95 + 0: (empty) + 1: (empty) + 2: BACKTICK@75..76 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@76..94 + 0: JS_TEMPLATE_ELEMENT@76..94 + 0: DOLLAR_CURLY@76..78 "${" [] [] + 1: JS_OBJECT_EXPRESSION@78..93 + 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@80..92 + 0: JS_PROPERTY_OBJECT_MEMBER@80..92 + 0: JS_LITERAL_MEMBER_NAME@80..81 + 0: IDENT@80..81 "a" [] [] + 1: COLON@81..83 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@83..92 + 0: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")] + 2: R_CURLY@92..93 "}" [] [] + 2: R_CURLY@93..94 "}" [] [] + 4: BACKTICK@94..95 "`" [] [] + 1: SEMICOLON@95..96 ";" [] [] + 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/this_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/this_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js.snap new file mode 100644 index 000000000000..1641344a0ebb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js.snap @@ -0,0 +1,67 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +this +this.foo + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsThisExpression { + this_token: THIS_KW@0..4 "this" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@4..9 "this" [Newline("\n")] [], + }, + operator_token: DOT@9..10 "." [] [], + member: JsName { + value_token: IDENT@10..13 "foo" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: JS_EXPRESSION_STATEMENT@0..4 + 0: JS_THIS_EXPRESSION@0..4 + 0: THIS_KW@0..4 "this" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@4..13 + 0: JS_STATIC_MEMBER_EXPRESSION@4..13 + 0: JS_THIS_EXPRESSION@4..9 + 0: THIS_KW@4..9 "this" [Newline("\n")] [] + 1: DOT@9..10 "." [] [] + 2: JS_NAME@10..13 + 0: IDENT@10..13 "foo" [] [] + 1: (empty) + 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/throw_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/throw_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js.snap new file mode 100644 index 000000000000..047bf5a4b4f9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js.snap @@ -0,0 +1,86 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +throw new Error("foo"); +throw "foo" + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsThrowStatement { + throw_token: THROW_KW@0..6 "throw" [] [Whitespace(" ")], + argument: JsNewExpression { + new_token: NEW_KW@6..10 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..15 "Error" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@15..16 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@16..21 "\"foo\"" [] [], + }, + ], + r_paren_token: R_PAREN@21..22 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@22..23 ";" [] [], + }, + JsThrowStatement { + throw_token: THROW_KW@23..30 "throw" [Newline("\n")] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@30..35 "\"foo\"" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_THROW_STATEMENT@0..23 + 0: THROW_KW@0..6 "throw" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@6..22 + 0: NEW_KW@6..10 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@10..15 + 0: JS_REFERENCE_IDENTIFIER@10..15 + 0: IDENT@10..15 "Error" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@15..22 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@16..21 + 0: JS_STRING_LITERAL_EXPRESSION@16..21 + 0: JS_STRING_LITERAL@16..21 "\"foo\"" [] [] + 2: R_PAREN@21..22 ")" [] [] + 2: SEMICOLON@22..23 ";" [] [] + 1: JS_THROW_STATEMENT@23..35 + 0: THROW_KW@23..30 "throw" [Newline("\n")] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@30..35 + 0: JS_STRING_LITERAL@30..35 "\"foo\"" [] [] + 2: (empty) + 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/try_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/try_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js.snap new file mode 100644 index 000000000000..c2b8a19b95f5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js.snap @@ -0,0 +1,242 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +try {} catch {} +try {} catch (e) {} +try {} catch {} finally {} +try {} catch (e) {} finally {} +try {} finally {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsTryStatement { + try_token: TRY_KW@0..4 "try" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@4..5 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@7..13 "catch" [] [Whitespace(" ")], + declaration: missing (optional), + body: JsBlockStatement { + l_curly_token: L_CURLY@13..14 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@14..15 "}" [] [], + }, + }, + }, + JsTryStatement { + try_token: TRY_KW@15..20 "try" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@20..21 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@21..23 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@23..29 "catch" [] [Whitespace(" ")], + declaration: JsCatchDeclaration { + l_paren_token: L_PAREN@29..30 "(" [] [], + binding: JsIdentifierBinding { + name_token: IDENT@30..31 "e" [] [], + }, + type_annotation: missing (optional), + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + }, + body: JsBlockStatement { + l_curly_token: L_CURLY@33..34 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + }, + JsTryFinallyStatement { + try_token: TRY_KW@35..40 "try" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@40..41 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@41..43 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@43..49 "catch" [] [Whitespace(" ")], + declaration: missing (optional), + body: JsBlockStatement { + l_curly_token: L_CURLY@49..50 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@50..52 "}" [] [Whitespace(" ")], + }, + }, + finally_clause: JsFinallyClause { + finally_token: FINALLY_KW@52..60 "finally" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@60..61 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@61..62 "}" [] [], + }, + }, + }, + JsTryFinallyStatement { + try_token: TRY_KW@62..67 "try" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@67..68 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@68..70 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@70..76 "catch" [] [Whitespace(" ")], + declaration: JsCatchDeclaration { + l_paren_token: L_PAREN@76..77 "(" [] [], + binding: JsIdentifierBinding { + name_token: IDENT@77..78 "e" [] [], + }, + type_annotation: missing (optional), + r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], + }, + body: JsBlockStatement { + l_curly_token: L_CURLY@80..81 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@81..83 "}" [] [Whitespace(" ")], + }, + }, + finally_clause: JsFinallyClause { + finally_token: FINALLY_KW@83..91 "finally" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@91..92 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + }, + }, + JsTryFinallyStatement { + try_token: TRY_KW@93..98 "try" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@98..99 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@99..101 "}" [] [Whitespace(" ")], + }, + catch_clause: missing (optional), + finally_clause: JsFinallyClause { + finally_token: FINALLY_KW@101..109 "finally" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@109..110 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@111..112 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..112 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..111 + 0: JS_TRY_STATEMENT@0..15 + 0: TRY_KW@0..4 "try" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@4..7 + 0: L_CURLY@4..5 "{" [] [] + 1: JS_STATEMENT_LIST@5..5 + 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@7..15 + 0: CATCH_KW@7..13 "catch" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BLOCK_STATEMENT@13..15 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_STATEMENT_LIST@14..14 + 2: R_CURLY@14..15 "}" [] [] + 1: JS_TRY_STATEMENT@15..35 + 0: TRY_KW@15..20 "try" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@20..23 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_STATEMENT_LIST@21..21 + 2: R_CURLY@21..23 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@23..35 + 0: CATCH_KW@23..29 "catch" [] [Whitespace(" ")] + 1: JS_CATCH_DECLARATION@29..33 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "e" [] [] + 2: (empty) + 3: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@33..35 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_STATEMENT_LIST@34..34 + 2: R_CURLY@34..35 "}" [] [] + 2: JS_TRY_FINALLY_STATEMENT@35..62 + 0: TRY_KW@35..40 "try" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@40..43 + 0: L_CURLY@40..41 "{" [] [] + 1: JS_STATEMENT_LIST@41..41 + 2: R_CURLY@41..43 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@43..52 + 0: CATCH_KW@43..49 "catch" [] [Whitespace(" ")] + 1: (empty) + 2: JS_BLOCK_STATEMENT@49..52 + 0: L_CURLY@49..50 "{" [] [] + 1: JS_STATEMENT_LIST@50..50 + 2: R_CURLY@50..52 "}" [] [Whitespace(" ")] + 3: JS_FINALLY_CLAUSE@52..62 + 0: FINALLY_KW@52..60 "finally" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@60..62 + 0: L_CURLY@60..61 "{" [] [] + 1: JS_STATEMENT_LIST@61..61 + 2: R_CURLY@61..62 "}" [] [] + 3: JS_TRY_FINALLY_STATEMENT@62..93 + 0: TRY_KW@62..67 "try" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@67..70 + 0: L_CURLY@67..68 "{" [] [] + 1: JS_STATEMENT_LIST@68..68 + 2: R_CURLY@68..70 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@70..83 + 0: CATCH_KW@70..76 "catch" [] [Whitespace(" ")] + 1: JS_CATCH_DECLARATION@76..80 + 0: L_PAREN@76..77 "(" [] [] + 1: JS_IDENTIFIER_BINDING@77..78 + 0: IDENT@77..78 "e" [] [] + 2: (empty) + 3: R_PAREN@78..80 ")" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@80..83 + 0: L_CURLY@80..81 "{" [] [] + 1: JS_STATEMENT_LIST@81..81 + 2: R_CURLY@81..83 "}" [] [Whitespace(" ")] + 3: JS_FINALLY_CLAUSE@83..93 + 0: FINALLY_KW@83..91 "finally" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@91..93 + 0: L_CURLY@91..92 "{" [] [] + 1: JS_STATEMENT_LIST@92..92 + 2: R_CURLY@92..93 "}" [] [] + 4: JS_TRY_FINALLY_STATEMENT@93..111 + 0: TRY_KW@93..98 "try" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@98..101 + 0: L_CURLY@98..99 "{" [] [] + 1: JS_STATEMENT_LIST@99..99 + 2: R_CURLY@99..101 "}" [] [Whitespace(" ")] + 2: (empty) + 3: JS_FINALLY_CLAUSE@101..111 + 0: FINALLY_KW@101..109 "finally" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@109..111 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_STATEMENT_LIST@110..110 + 2: R_CURLY@110..111 "}" [] [] + 4: EOF@111..112 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts.snap new file mode 100644 index 000000000000..06db47c148c3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts.snap @@ -0,0 +1,706 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A {} +abstract class ConcreteMembers { + name: string; + constructor(name: string) { this.name = name; } + display(): void { console.log(this.name); } + public get my_name() { return this.name; } + public set my_name(name) { this.name = name; } + #private_method() { } +} +abstract class AbstractMembers { + abstract name: string; + abstract display(); + abstract get my_name(); + abstract set my_name(val); + abstract set my_age(age,); +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@19..29 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@29..35 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@35..51 "ConcreteMembers" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@51..52 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@52..61 "name" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@61..63 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@63..69 "string" [] [], + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@69..70 ";" [] [], + }, + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@70..86 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@86..87 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@87..91 "name" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@91..93 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@93..99 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@101..103 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsThisExpression { + this_token: THIS_KW@103..107 "this" [] [], + }, + dot_token: DOT@107..108 "." [] [], + member: JsName { + value_token: IDENT@108..113 "name" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@113..115 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@115..119 "name" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@119..121 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@121..122 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@122..134 "display" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@134..135 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@135..136 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@136..138 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@138..143 "void" [] [Whitespace(" ")], + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@143..145 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@145..152 "console" [] [], + }, + }, + operator_token: DOT@152..153 "." [] [], + member: JsName { + value_token: IDENT@153..156 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@156..157 "(" [] [], + args: JsCallArgumentList [ + JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@157..161 "this" [] [], + }, + operator_token: DOT@161..162 "." [] [], + member: JsName { + value_token: IDENT@162..166 "name" [] [], + }, + }, + ], + r_paren_token: R_PAREN@166..167 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@167..169 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@169..170 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@170..182 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + get_token: GET_KW@182..186 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@186..193 "my_name" [] [], + }, + l_paren_token: L_PAREN@193..194 "(" [] [], + r_paren_token: R_PAREN@194..196 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@196..198 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@198..205 "return" [] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@205..209 "this" [] [], + }, + operator_token: DOT@209..210 "." [] [], + member: JsName { + value_token: IDENT@210..214 "name" [] [], + }, + }, + semicolon_token: SEMICOLON@214..216 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@216..217 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@217..229 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + set_token: SET_KW@229..233 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@233..240 "my_name" [] [], + }, + l_paren_token: L_PAREN@240..241 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@241..245 "name" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@247..249 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsStaticMemberAssignment { + object: JsThisExpression { + this_token: THIS_KW@249..253 "this" [] [], + }, + dot_token: DOT@253..254 "." [] [], + member: JsName { + value_token: IDENT@254..259 "name" [] [Whitespace(" ")], + }, + }, + operator_token: EQ@259..261 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@261..265 "name" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@265..267 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@267..268 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsPrivateClassMemberName { + hash_token: HASH@268..274 "#" [Newline("\n"), Whitespace(" ")] [], + id_token: IDENT@274..288 "private_method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@288..289 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@289..291 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@291..293 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@293..294 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@294..296 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@296..306 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@306..312 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@312..328 "AbstractMembers" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@328..329 "{" [] [], + members: JsClassMemberList [ + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@329..343 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@343..347 "name" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@347..349 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@349..355 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@355..356 ";" [] [], + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@356..370 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@370..377 "display" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@377..378 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@378..379 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: SEMICOLON@379..380 ";" [] [], + }, + TsGetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@380..394 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + get_token: GET_KW@394..398 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@398..405 "my_name" [] [], + }, + l_paren_token: L_PAREN@405..406 "(" [] [], + r_paren_token: R_PAREN@406..407 ")" [] [], + return_type: missing (optional), + semicolon_token: SEMICOLON@407..408 ";" [] [], + }, + TsSetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@408..422 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + set_token: SET_KW@422..426 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@426..433 "my_name" [] [], + }, + l_paren_token: L_PAREN@433..434 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@434..437 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@437..438 ")" [] [], + semicolon_token: SEMICOLON@438..439 ";" [] [], + }, + TsSetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@439..453 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + set_token: SET_KW@453..457 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@457..463 "my_age" [] [], + }, + l_paren_token: L_PAREN@463..464 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@464..467 "age" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: COMMA@467..468 "," [] [], + r_paren_token: R_PAREN@468..469 ")" [] [], + semicolon_token: SEMICOLON@469..470 ";" [] [], + }, + ], + r_curly_token: R_CURLY@470..472 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@472..473 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..473 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..472 + 0: JS_CLASS_DECLARATION@0..19 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..18 + 9: R_CURLY@18..19 "}" [] [] + 1: JS_CLASS_DECLARATION@19..296 + 0: JS_DECORATOR_LIST@19..19 + 1: ABSTRACT_KW@19..29 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@29..35 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@35..51 + 0: IDENT@35..51 "ConcreteMembers" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@51..52 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@52..294 + 0: JS_PROPERTY_CLASS_MEMBER@52..70 + 0: JS_PROPERTY_MODIFIER_LIST@52..52 + 1: JS_LITERAL_MEMBER_NAME@52..61 + 0: IDENT@52..61 "name" [Newline("\n"), Whitespace(" ")] [] + 2: TS_TYPE_ANNOTATION@61..69 + 0: COLON@61..63 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@63..69 + 0: STRING_KW@63..69 "string" [] [] + 3: (empty) + 4: SEMICOLON@69..70 ";" [] [] + 1: JS_CONSTRUCTOR_CLASS_MEMBER@70..122 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@70..70 + 1: JS_LITERAL_MEMBER_NAME@70..86 + 0: IDENT@70..86 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@86..101 + 0: L_PAREN@86..87 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@87..99 + 0: JS_FORMAL_PARAMETER@87..99 + 0: JS_DECORATOR_LIST@87..87 + 1: JS_IDENTIFIER_BINDING@87..91 + 0: IDENT@87..91 "name" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@91..99 + 0: COLON@91..93 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@93..99 + 0: STRING_KW@93..99 "string" [] [] + 4: (empty) + 2: R_PAREN@99..101 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@101..122 + 0: L_CURLY@101..103 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@103..103 + 2: JS_STATEMENT_LIST@103..121 + 0: JS_EXPRESSION_STATEMENT@103..121 + 0: JS_ASSIGNMENT_EXPRESSION@103..119 + 0: JS_STATIC_MEMBER_ASSIGNMENT@103..113 + 0: JS_THIS_EXPRESSION@103..107 + 0: THIS_KW@103..107 "this" [] [] + 1: DOT@107..108 "." [] [] + 2: JS_NAME@108..113 + 0: IDENT@108..113 "name" [] [Whitespace(" ")] + 1: EQ@113..115 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@115..119 + 0: JS_REFERENCE_IDENTIFIER@115..119 + 0: IDENT@115..119 "name" [] [] + 1: SEMICOLON@119..121 ";" [] [Whitespace(" ")] + 3: R_CURLY@121..122 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@122..170 + 0: JS_METHOD_MODIFIER_LIST@122..122 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@122..134 + 0: IDENT@122..134 "display" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@134..136 + 0: L_PAREN@134..135 "(" [] [] + 1: JS_PARAMETER_LIST@135..135 + 2: R_PAREN@135..136 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@136..143 + 0: COLON@136..138 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@138..143 + 0: VOID_KW@138..143 "void" [] [Whitespace(" ")] + 8: JS_FUNCTION_BODY@143..170 + 0: L_CURLY@143..145 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@145..145 + 2: JS_STATEMENT_LIST@145..169 + 0: JS_EXPRESSION_STATEMENT@145..169 + 0: JS_CALL_EXPRESSION@145..167 + 0: JS_STATIC_MEMBER_EXPRESSION@145..156 + 0: JS_IDENTIFIER_EXPRESSION@145..152 + 0: JS_REFERENCE_IDENTIFIER@145..152 + 0: IDENT@145..152 "console" [] [] + 1: DOT@152..153 "." [] [] + 2: JS_NAME@153..156 + 0: IDENT@153..156 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@156..167 + 0: L_PAREN@156..157 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@157..166 + 0: JS_STATIC_MEMBER_EXPRESSION@157..166 + 0: JS_THIS_EXPRESSION@157..161 + 0: THIS_KW@157..161 "this" [] [] + 1: DOT@161..162 "." [] [] + 2: JS_NAME@162..166 + 0: IDENT@162..166 "name" [] [] + 2: R_PAREN@166..167 ")" [] [] + 1: SEMICOLON@167..169 ";" [] [Whitespace(" ")] + 3: R_CURLY@169..170 "}" [] [] + 3: JS_GETTER_CLASS_MEMBER@170..217 + 0: JS_METHOD_MODIFIER_LIST@170..182 + 0: TS_ACCESSIBILITY_MODIFIER@170..182 + 0: PUBLIC_KW@170..182 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@182..186 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@186..193 + 0: IDENT@186..193 "my_name" [] [] + 3: L_PAREN@193..194 "(" [] [] + 4: R_PAREN@194..196 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@196..217 + 0: L_CURLY@196..198 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@198..198 + 2: JS_STATEMENT_LIST@198..216 + 0: JS_RETURN_STATEMENT@198..216 + 0: RETURN_KW@198..205 "return" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@205..214 + 0: JS_THIS_EXPRESSION@205..209 + 0: THIS_KW@205..209 "this" [] [] + 1: DOT@209..210 "." [] [] + 2: JS_NAME@210..214 + 0: IDENT@210..214 "name" [] [] + 2: SEMICOLON@214..216 ";" [] [Whitespace(" ")] + 3: R_CURLY@216..217 "}" [] [] + 4: JS_SETTER_CLASS_MEMBER@217..268 + 0: JS_METHOD_MODIFIER_LIST@217..229 + 0: TS_ACCESSIBILITY_MODIFIER@217..229 + 0: PUBLIC_KW@217..229 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@229..233 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@233..240 + 0: IDENT@233..240 "my_name" [] [] + 3: L_PAREN@240..241 "(" [] [] + 4: JS_FORMAL_PARAMETER@241..245 + 0: JS_DECORATOR_LIST@241..241 + 1: JS_IDENTIFIER_BINDING@241..245 + 0: IDENT@241..245 "name" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@245..247 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@247..268 + 0: L_CURLY@247..249 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@249..249 + 2: JS_STATEMENT_LIST@249..267 + 0: JS_EXPRESSION_STATEMENT@249..267 + 0: JS_ASSIGNMENT_EXPRESSION@249..265 + 0: JS_STATIC_MEMBER_ASSIGNMENT@249..259 + 0: JS_THIS_EXPRESSION@249..253 + 0: THIS_KW@249..253 "this" [] [] + 1: DOT@253..254 "." [] [] + 2: JS_NAME@254..259 + 0: IDENT@254..259 "name" [] [Whitespace(" ")] + 1: EQ@259..261 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@261..265 + 0: JS_REFERENCE_IDENTIFIER@261..265 + 0: IDENT@261..265 "name" [] [] + 1: SEMICOLON@265..267 ";" [] [Whitespace(" ")] + 3: R_CURLY@267..268 "}" [] [] + 5: JS_METHOD_CLASS_MEMBER@268..294 + 0: JS_METHOD_MODIFIER_LIST@268..268 + 1: (empty) + 2: (empty) + 3: JS_PRIVATE_CLASS_MEMBER_NAME@268..288 + 0: HASH@268..274 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@274..288 "private_method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@288..291 + 0: L_PAREN@288..289 "(" [] [] + 1: JS_PARAMETER_LIST@289..289 + 2: R_PAREN@289..291 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@291..294 + 0: L_CURLY@291..293 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@293..293 + 2: JS_STATEMENT_LIST@293..293 + 3: R_CURLY@293..294 "}" [] [] + 9: R_CURLY@294..296 "}" [Newline("\n")] [] + 2: JS_CLASS_DECLARATION@296..472 + 0: JS_DECORATOR_LIST@296..296 + 1: ABSTRACT_KW@296..306 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@306..312 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@312..328 + 0: IDENT@312..328 "AbstractMembers" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@328..329 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@329..470 + 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@329..356 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@329..343 + 0: TS_ABSTRACT_MODIFIER@329..343 + 0: ABSTRACT_KW@329..343 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@343..347 + 0: IDENT@343..347 "name" [] [] + 2: TS_TYPE_ANNOTATION@347..355 + 0: COLON@347..349 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@349..355 + 0: STRING_KW@349..355 "string" [] [] + 3: SEMICOLON@355..356 ";" [] [] + 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@356..380 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@356..370 + 0: TS_ABSTRACT_MODIFIER@356..370 + 0: ABSTRACT_KW@356..370 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@370..377 + 0: IDENT@370..377 "display" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@377..379 + 0: L_PAREN@377..378 "(" [] [] + 1: JS_PARAMETER_LIST@378..378 + 2: R_PAREN@378..379 ")" [] [] + 6: (empty) + 7: SEMICOLON@379..380 ";" [] [] + 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@380..408 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@380..394 + 0: TS_ABSTRACT_MODIFIER@380..394 + 0: ABSTRACT_KW@380..394 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: GET_KW@394..398 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@398..405 + 0: IDENT@398..405 "my_name" [] [] + 3: L_PAREN@405..406 "(" [] [] + 4: R_PAREN@406..407 ")" [] [] + 5: (empty) + 6: SEMICOLON@407..408 ";" [] [] + 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@408..439 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@408..422 + 0: TS_ABSTRACT_MODIFIER@408..422 + 0: ABSTRACT_KW@408..422 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@422..426 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@426..433 + 0: IDENT@426..433 "my_name" [] [] + 3: L_PAREN@433..434 "(" [] [] + 4: JS_FORMAL_PARAMETER@434..437 + 0: JS_DECORATOR_LIST@434..434 + 1: JS_IDENTIFIER_BINDING@434..437 + 0: IDENT@434..437 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@437..438 ")" [] [] + 7: SEMICOLON@438..439 ";" [] [] + 4: TS_SETTER_SIGNATURE_CLASS_MEMBER@439..470 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@439..453 + 0: TS_ABSTRACT_MODIFIER@439..453 + 0: ABSTRACT_KW@439..453 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: SET_KW@453..457 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@457..463 + 0: IDENT@457..463 "my_age" [] [] + 3: L_PAREN@463..464 "(" [] [] + 4: JS_FORMAL_PARAMETER@464..467 + 0: JS_DECORATOR_LIST@464..464 + 1: JS_IDENTIFIER_BINDING@464..467 + 0: IDENT@464..467 "age" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@467..468 "," [] [] + 6: R_PAREN@468..469 ")" [] [] + 7: SEMICOLON@469..470 ";" [] [] + 9: R_CURLY@470..472 "}" [Newline("\n")] [] + 4: EOF@472..473 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap new file mode 100644 index 000000000000..0c5aa0adcca8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract name?: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@9..15 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [ + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAbstractModifier { + modifier_token: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@33..37 "name" [] [], + }, + property_annotation: TsOptionalPropertyAnnotation { + question_mark_token: QUESTION@37..38 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@40..46 "string" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + ], + r_curly_token: R_CURLY@47..49 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@49..50 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..50 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..49 + 0: JS_CLASS_DECLARATION@0..49 + 0: JS_DECORATOR_LIST@0..0 + 1: ABSTRACT_KW@0..9 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@9..15 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..47 + 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@18..47 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..33 + 0: TS_ABSTRACT_MODIFIER@18..33 + 0: ABSTRACT_KW@18..33 "abstract" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@33..37 + 0: IDENT@33..37 "name" [] [] + 2: TS_OPTIONAL_PROPERTY_ANNOTATION@37..46 + 0: QUESTION@37..38 "?" [] [] + 1: TS_TYPE_ANNOTATION@38..46 + 0: COLON@38..40 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@40..46 + 0: STRING_KW@40..46 "string" [] [] + 3: SEMICOLON@46..47 ";" [] [] + 9: R_CURLY@47..49 "}" [Newline("\n")] [] + 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap new file mode 100644 index 000000000000..b158e68dd649 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const a, b, c, d = "test"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@15..17 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@17..18 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@18..20 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@20..21 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@21..23 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@23..25 "d" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@25..27 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@27..33 "\"test\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + }, + ], + eof_token: EOF@34..35 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..35 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..34 + 0: TS_DECLARE_STATEMENT@0..34 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@8..34 + 0: JS_VARIABLE_DECLARATION@8..33 + 0: (empty) + 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..33 + 0: JS_VARIABLE_DECLARATOR@14..15 + 0: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@15..17 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@17..18 + 0: JS_IDENTIFIER_BINDING@17..18 + 0: IDENT@17..18 "b" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@18..20 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@20..21 + 0: JS_IDENTIFIER_BINDING@20..21 + 0: IDENT@20..21 "c" [] [] + 1: (empty) + 2: (empty) + 5: COMMA@21..23 "," [] [Whitespace(" ")] + 6: JS_VARIABLE_DECLARATOR@23..33 + 0: JS_IDENTIFIER_BINDING@23..25 + 0: IDENT@23..25 "d" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@25..33 + 0: EQ@25..27 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@27..33 + 0: JS_STRING_LITERAL@27..33 "\"test\"" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap new file mode 100644 index 000000000000..bfe0c9bf1022 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap @@ -0,0 +1,153 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare enum A { X, Y, Z } +declare const enum B { X, Y, Z } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@8..13 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@13..15 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@17..18 "X" [] [], + }, + initializer: missing (optional), + }, + COMMA@18..20 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@20..21 "Y" [] [], + }, + initializer: missing (optional), + }, + COMMA@21..23 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@23..25 "Z" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@25..26 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@26..35 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsEnumDeclaration { + const_token: CONST_KW@35..41 "const" [] [Whitespace(" ")], + enum_token: ENUM_KW@41..46 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@46..48 "B" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@50..51 "X" [] [], + }, + initializer: missing (optional), + }, + COMMA@51..53 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@53..54 "Y" [] [], + }, + initializer: missing (optional), + }, + COMMA@54..56 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@56..58 "Z" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@58..59 "}" [] [], + }, + }, + ], + eof_token: EOF@59..60 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..60 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..59 + 0: TS_DECLARE_STATEMENT@0..26 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_ENUM_DECLARATION@8..26 + 0: (empty) + 1: ENUM_KW@8..13 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@13..15 + 0: IDENT@13..15 "A" [] [Whitespace(" ")] + 3: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@17..25 + 0: TS_ENUM_MEMBER@17..18 + 0: TS_LITERAL_ENUM_MEMBER_NAME@17..18 + 0: IDENT@17..18 "X" [] [] + 1: (empty) + 1: COMMA@18..20 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@20..21 + 0: TS_LITERAL_ENUM_MEMBER_NAME@20..21 + 0: IDENT@20..21 "Y" [] [] + 1: (empty) + 3: COMMA@21..23 "," [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER@23..25 + 0: TS_LITERAL_ENUM_MEMBER_NAME@23..25 + 0: IDENT@23..25 "Z" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@25..26 "}" [] [] + 1: TS_DECLARE_STATEMENT@26..59 + 0: DECLARE_KW@26..35 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_ENUM_DECLARATION@35..59 + 0: CONST_KW@35..41 "const" [] [Whitespace(" ")] + 1: ENUM_KW@41..46 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "B" [] [Whitespace(" ")] + 3: L_CURLY@48..50 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@50..58 + 0: TS_ENUM_MEMBER@50..51 + 0: TS_LITERAL_ENUM_MEMBER_NAME@50..51 + 0: IDENT@50..51 "X" [] [] + 1: (empty) + 1: COMMA@51..53 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@53..54 + 0: TS_LITERAL_ENUM_MEMBER_NAME@53..54 + 0: IDENT@53..54 "Y" [] [] + 1: (empty) + 3: COMMA@54..56 "," [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER@56..58 + 0: TS_LITERAL_ENUM_MEMBER_NAME@56..58 + 0: IDENT@56..58 "Z" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@58..59 "}" [] [] + 4: EOF@59..60 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts.snap new file mode 100644 index 000000000000..e2f625792c4c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a { + function test(): string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@15..17 "a" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@17..18 "{" [] [], + items: JsModuleItemList [ + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@30..34 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@34..35 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@35..36 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@36..38 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@38..44 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + ], + r_curly_token: R_CURLY@45..47 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: TS_DECLARE_STATEMENT@0..47 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..47 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "a" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@17..47 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_MODULE_ITEM_LIST@18..45 + 0: TS_DECLARE_FUNCTION_DECLARATION@18..45 + 0: (empty) + 1: FUNCTION_KW@18..30 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@30..34 + 0: IDENT@30..34 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@34..36 + 0: L_PAREN@34..35 "(" [] [] + 1: JS_PARAMETER_LIST@35..35 + 2: R_PAREN@35..36 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@36..44 + 0: COLON@36..38 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@38..44 + 0: STRING_KW@38..44 "string" [] [] + 6: SEMICOLON@44..45 ";" [] [] + 2: R_CURLY@45..47 "}" [Newline("\n")] [] + 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts.snap new file mode 100644 index 000000000000..b08dff5881a0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare interface A { b: string, c: number } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@8..18 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@18..20 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@22..23 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@25..31 "string" [] [], + }, + }, + separator_token: COMMA@31..33 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@33..34 "c" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@36..43 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@43..44 "}" [] [], + }, + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: TS_DECLARE_STATEMENT@0..44 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@8..44 + 0: INTERFACE_KW@8..18 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@18..20 + 0: IDENT@18..20 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@20..22 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@22..43 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@22..33 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@22..23 + 0: IDENT@22..23 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@23..31 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@25..31 + 0: STRING_KW@25..31 "string" [] [] + 4: COMMA@31..33 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@33..43 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@33..34 + 0: IDENT@33..34 "c" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@34..43 + 0: COLON@34..36 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@36..43 + 0: NUMBER_KW@36..43 "number" [] [Whitespace(" ")] + 4: (empty) + 6: R_CURLY@43..44 "}" [] [] + 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap new file mode 100644 index 000000000000..1a57c87f97b5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap @@ -0,0 +1,110 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare let a, b, c, d; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@8..12 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@12..13 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@15..16 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@16..18 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@18..19 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@19..21 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@21..22 "d" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@22..23 ";" [] [], + }, + }, + ], + eof_token: EOF@23..24 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..24 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..23 + 0: TS_DECLARE_STATEMENT@0..23 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@8..23 + 0: JS_VARIABLE_DECLARATION@8..22 + 0: (empty) + 1: LET_KW@8..12 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@12..22 + 0: JS_VARIABLE_DECLARATOR@12..13 + 0: JS_IDENTIFIER_BINDING@12..13 + 0: IDENT@12..13 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@13..15 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@15..16 + 0: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "b" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@16..18 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "c" [] [] + 1: (empty) + 2: (empty) + 5: COMMA@19..21 "," [] [Whitespace(" ")] + 6: JS_VARIABLE_DECLARATOR@21..22 + 0: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "d" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@22..23 ";" [] [] + 4: EOF@23..24 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap new file mode 100644 index 000000000000..9d0ac44ee1a8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap @@ -0,0 +1,96 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare var a, b, c; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@8..12 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@12..13 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@15..16 "b" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@16..18 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@18..19 "c" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + }, + ], + eof_token: EOF@20..21 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..21 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..20 + 0: TS_DECLARE_STATEMENT@0..20 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@8..20 + 0: JS_VARIABLE_DECLARATION@8..19 + 0: (empty) + 1: VAR_KW@8..12 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@12..19 + 0: JS_VARIABLE_DECLARATOR@12..13 + 0: JS_IDENTIFIER_BINDING@12..13 + 0: IDENT@12..13 "a" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@13..15 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@15..16 + 0: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "b" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@16..18 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "c" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@19..20 ";" [] [] + 4: EOF@20..21 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_array_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_array_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts.snap new file mode 100644 index 000000000000..6c6b8de31aaa --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts.snap @@ -0,0 +1,122 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string[]; +type B = { a: number } []; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsStringType { + string_token: STRING_KW@9..15 "string" [] [], + }, + l_brack_token: L_BRACK@15..16 "[" [] [], + r_brack_token: R_BRACK@16..17 "]" [] [], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@18..24 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@24..26 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@26..28 "=" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsObjectType { + l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@30..31 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@33..40 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@40..42 "}" [] [Whitespace(" ")], + }, + l_brack_token: L_BRACK@42..43 "[" [] [], + r_brack_token: R_BRACK@43..44 "]" [] [], + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + ], + eof_token: EOF@45..46 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..46 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..45 + 0: TS_TYPE_ALIAS_DECLARATION@0..18 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_ARRAY_TYPE@9..17 + 0: TS_STRING_TYPE@9..15 + 0: STRING_KW@9..15 "string" [] [] + 1: L_BRACK@15..16 "[" [] [] + 2: R_BRACK@16..17 "]" [] [] + 5: SEMICOLON@17..18 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@18..45 + 0: TYPE_KW@18..24 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@24..26 + 0: IDENT@24..26 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@26..28 "=" [] [Whitespace(" ")] + 4: TS_ARRAY_TYPE@28..44 + 0: TS_OBJECT_TYPE@28..42 + 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@30..40 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@30..40 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@30..31 + 0: IDENT@30..31 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@31..40 + 0: COLON@31..33 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@33..40 + 0: NUMBER_KW@33..40 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@40..42 "}" [] [Whitespace(" ")] + 1: L_BRACK@42..43 "[" [] [] + 2: R_BRACK@43..44 "]" [] [] + 5: SEMICOLON@44..45 ";" [] [] + 4: EOF@45..46 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap new file mode 100644 index 000000000000..69ca5bc6153d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +a ? (b) : a => {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsConditionalExpression { + test: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..2 "a" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2..4 "?" [] [Whitespace(" ")], + consequent: JsParenthesizedExpression { + l_paren_token: L_PAREN@4..5 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@5..6 "b" [] [], + }, + }, + r_paren_token: R_PAREN@6..8 ")" [] [Whitespace(" ")], + }, + colon_token: COLON@8..10 ":" [] [Whitespace(" ")], + alternate: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@10..12 "a" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@15..16 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + ], + eof_token: EOF@18..19 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..19 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..18 + 0: JS_EXPRESSION_STATEMENT@0..18 + 0: JS_CONDITIONAL_EXPRESSION@0..17 + 0: JS_IDENTIFIER_EXPRESSION@0..2 + 0: JS_REFERENCE_IDENTIFIER@0..2 + 0: IDENT@0..2 "a" [] [Whitespace(" ")] + 1: QUESTION@2..4 "?" [] [Whitespace(" ")] + 2: JS_PARENTHESIZED_EXPRESSION@4..8 + 0: L_PAREN@4..5 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@5..6 + 0: JS_REFERENCE_IDENTIFIER@5..6 + 0: IDENT@5..6 "b" [] [] + 2: R_PAREN@6..8 ")" [] [Whitespace(" ")] + 3: COLON@8..10 ":" [] [Whitespace(" ")] + 4: JS_ARROW_FUNCTION_EXPRESSION@10..17 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "a" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@15..17 + 0: L_CURLY@15..16 "{" [] [] + 1: JS_DIRECTIVE_LIST@16..16 + 2: JS_STATEMENT_LIST@16..16 + 3: R_CURLY@16..17 "}" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 4: EOF@18..19 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap new file mode 100644 index 000000000000..8f65b1779d97 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap @@ -0,0 +1,439 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = (a: A, b: B, c: C) => "hello"; +let b = async (a: A, b: B): Promise => "hello"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@9..10 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@10..12 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@12..14 "B" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@22..23 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@25..27 "C" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: TsDefaultTypeClause { + eq_token: EQ@27..29 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@29..35 "string" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@35..36 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@37..38 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@40..41 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@41..43 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@43..44 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@44..46 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@46..47 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@47..49 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@49..50 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@52..53 "C" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@55..58 "=>" [] [Whitespace(" ")], + body: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@58..65 "\"hello\"" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..66 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@71..73 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@75..81 "async" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@81..82 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@82..83 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@83..85 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@85..86 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@86..87 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@87..88 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@88..89 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@89..91 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@91..92 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@92..94 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@94..95 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@95..97 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@97..98 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@98..99 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@99..101 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@101..108 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@108..109 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@109..115 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@115..117 ">" [] [Whitespace(" ")], + }, + }, + }, + fat_arrow_token: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")], + body: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@120..127 "\"hello\"" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@127..128 ";" [] [], + }, + ], + eof_token: EOF@128..129 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..129 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..128 + 0: JS_VARIABLE_STATEMENT@0..66 + 0: JS_VARIABLE_DECLARATION@0..65 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..65 + 0: JS_VARIABLE_DECLARATOR@4..65 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..65 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@8..65 + 0: (empty) + 1: TS_TYPE_PARAMETERS@8..36 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..35 + 0: TS_TYPE_PARAMETER@9..10 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 + 1: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@10..12 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@12..23 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@12..12 + 1: TS_TYPE_PARAMETER_NAME@12..14 + 0: IDENT@12..14 "B" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@14..23 + 0: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@22..23 + 0: JS_REFERENCE_IDENTIFIER@22..23 + 0: IDENT@22..23 "A" [] [] + 1: (empty) + 3: (empty) + 3: COMMA@23..25 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@25..35 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@25..25 + 1: TS_TYPE_PARAMETER_NAME@25..27 + 0: IDENT@25..27 "C" [] [Whitespace(" ")] + 2: (empty) + 3: TS_DEFAULT_TYPE_CLAUSE@27..35 + 0: EQ@27..29 "=" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@29..35 + 0: STRING_KW@29..35 "string" [] [] + 2: R_ANGLE@35..36 ">" [] [] + 2: JS_PARAMETERS@36..55 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_PARAMETER_LIST@37..53 + 0: JS_FORMAL_PARAMETER@37..41 + 0: JS_DECORATOR_LIST@37..37 + 1: JS_IDENTIFIER_BINDING@37..38 + 0: IDENT@37..38 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@38..41 + 0: COLON@38..40 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@40..41 + 0: JS_REFERENCE_IDENTIFIER@40..41 + 0: IDENT@40..41 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@41..43 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@43..47 + 0: JS_DECORATOR_LIST@43..43 + 1: JS_IDENTIFIER_BINDING@43..44 + 0: IDENT@43..44 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@44..47 + 0: COLON@44..46 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@46..47 + 0: JS_REFERENCE_IDENTIFIER@46..47 + 0: IDENT@46..47 "B" [] [] + 1: (empty) + 4: (empty) + 3: COMMA@47..49 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@49..53 + 0: JS_DECORATOR_LIST@49..49 + 1: JS_IDENTIFIER_BINDING@49..50 + 0: IDENT@49..50 "c" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@50..53 + 0: COLON@50..52 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@52..53 + 0: JS_REFERENCE_IDENTIFIER@52..53 + 0: IDENT@52..53 "C" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@55..58 "=>" [] [Whitespace(" ")] + 5: JS_STRING_LITERAL_EXPRESSION@58..65 + 0: JS_STRING_LITERAL@58..65 "\"hello\"" [] [] + 1: SEMICOLON@65..66 ";" [] [] + 1: JS_VARIABLE_STATEMENT@66..128 + 0: JS_VARIABLE_DECLARATION@66..127 + 0: (empty) + 1: LET_KW@66..71 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@71..127 + 0: JS_VARIABLE_DECLARATOR@71..127 + 0: JS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@73..127 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: JS_ARROW_FUNCTION_EXPRESSION@75..127 + 0: ASYNC_KW@75..81 "async" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETERS@81..87 + 0: L_ANGLE@81..82 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@82..86 + 0: TS_TYPE_PARAMETER@82..83 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@82..82 + 1: TS_TYPE_PARAMETER_NAME@82..83 + 0: IDENT@82..83 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@83..85 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@85..86 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@85..85 + 1: TS_TYPE_PARAMETER_NAME@85..86 + 0: IDENT@85..86 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@86..87 ">" [] [] + 2: JS_PARAMETERS@87..99 + 0: L_PAREN@87..88 "(" [] [] + 1: JS_PARAMETER_LIST@88..98 + 0: JS_FORMAL_PARAMETER@88..92 + 0: JS_DECORATOR_LIST@88..88 + 1: JS_IDENTIFIER_BINDING@88..89 + 0: IDENT@88..89 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@89..92 + 0: COLON@89..91 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@91..92 + 0: JS_REFERENCE_IDENTIFIER@91..92 + 0: IDENT@91..92 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@92..94 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@94..98 + 0: JS_DECORATOR_LIST@94..94 + 1: JS_IDENTIFIER_BINDING@94..95 + 0: IDENT@94..95 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@95..98 + 0: COLON@95..97 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@97..98 + 0: JS_REFERENCE_IDENTIFIER@97..98 + 0: IDENT@97..98 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@98..99 ")" [] [] + 3: TS_RETURN_TYPE_ANNOTATION@99..117 + 0: COLON@99..101 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@101..117 + 0: JS_REFERENCE_IDENTIFIER@101..108 + 0: IDENT@101..108 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@108..117 + 0: L_ANGLE@108..109 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@109..115 + 0: TS_STRING_TYPE@109..115 + 0: STRING_KW@109..115 "string" [] [] + 2: R_ANGLE@115..117 ">" [] [Whitespace(" ")] + 4: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")] + 5: JS_STRING_LITERAL_EXPRESSION@120..127 + 0: JS_STRING_LITERAL@120..127 "\"hello\"" [] [] + 1: SEMICOLON@127..128 ";" [] [] + 4: EOF@128..129 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts.snap new file mode 100644 index 000000000000..e523971190a6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts.snap @@ -0,0 +1,546 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +type B = { a: A }; +(a as string) = "string"; +((a as any) as string) = null; +({ b: a as string } = { b: "test" }); +([ a as string ] = [ "test" ]); +for (a as string in []) {} +(a as B) = { a: "test" }; +( a) += 1 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@7..10 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@17..18 "B" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@18..19 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@19..20 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@26..27 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@27..29 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@29..31 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@33..35 "(" [Newline("\n")] [], + assignment: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@35..37 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@37..40 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@40..46 "string" [] [], + }, + }, + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@48..50 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@50..58 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@59..61 "(" [Newline("\n")] [], + assignment: TsAsAssignment { + assignment: JsParenthesizedAssignment { + l_paren_token: L_PAREN@61..62 "(" [] [], + assignment: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@62..64 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@64..67 "as" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@67..70 "any" [] [], + }, + }, + r_paren_token: R_PAREN@70..72 ")" [] [Whitespace(" ")], + }, + as_token: AS_KW@72..75 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@75..81 "string" [] [], + }, + }, + r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@83..85 "=" [] [Whitespace(" ")], + right: JsNullLiteralExpression { + value_token: NULL_KW@85..89 "null" [] [], + }, + }, + semicolon_token: SEMICOLON@89..90 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@90..92 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@92..94 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@94..95 "b" [] [], + }, + colon_token: COLON@95..97 ":" [] [Whitespace(" ")], + pattern: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@97..99 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@99..102 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@102..109 "string" [] [Whitespace(" ")], + }, + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@109..111 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@111..113 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@113..115 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@115..116 "b" [] [], + }, + colon_token: COLON@116..118 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@118..125 "\"test\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + }, + r_paren_token: R_PAREN@126..127 ")" [] [], + }, + semicolon_token: SEMICOLON@127..128 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@128..130 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@130..132 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@132..134 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@134..137 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@137..144 "string" [] [Whitespace(" ")], + }, + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@144..146 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@146..148 "=" [] [Whitespace(" ")], + right: JsArrayExpression { + l_brack_token: L_BRACK@148..150 "[" [] [Whitespace(" ")], + elements: JsArrayElementList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@150..157 "\"test\"" [] [Whitespace(" ")], + }, + ], + r_brack_token: R_BRACK@157..158 "]" [] [], + }, + }, + r_paren_token: R_PAREN@158..159 ")" [] [], + }, + semicolon_token: SEMICOLON@159..160 ";" [] [], + }, + JsForInStatement { + for_token: FOR_KW@160..165 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@165..166 "(" [] [], + initializer: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@166..168 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@168..171 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@171..178 "string" [] [Whitespace(" ")], + }, + }, + in_token: IN_KW@178..181 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@181..182 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@182..183 "]" [] [], + }, + r_paren_token: R_PAREN@183..185 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@185..186 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@186..187 "}" [] [], + }, + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@187..189 "(" [Newline("\n")] [], + assignment: TsAsAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@189..191 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@191..194 "as" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@194..195 "B" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@195..196 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@196..202 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@202..203 ">" [] [], + }, + }, + }, + r_paren_token: R_PAREN@203..205 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@205..207 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@207..209 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@209..210 "a" [] [], + }, + colon_token: COLON@210..212 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@212..219 "\"test\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@219..220 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@220..221 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@221..223 "(" [Newline("\n")] [], + assignment: TsTypeAssertionAssignment { + l_angle_token: L_ANGLE@223..224 "<" [] [], + ty: TsNumberType { + number_token: NUMBER_KW@224..230 "number" [] [], + }, + r_angle_token: R_ANGLE@230..232 ">" [] [Whitespace(" ")], + assignment: JsIdentifierAssignment { + name_token: IDENT@232..233 "a" [] [], + }, + }, + r_paren_token: R_PAREN@233..235 ")" [] [Whitespace(" ")], + }, + operator_token: PLUSEQ@235..238 "+=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@238..239 "1" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@239..240 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..240 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..239 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_TYPE_ANNOTATION@5..10 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@7..10 + 0: ANY_KW@7..10 "any" [] [] + 2: (empty) + 1: SEMICOLON@10..11 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@11..33 + 0: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@17..18 + 0: IDENT@17..18 "B" [] [] + 2: TS_TYPE_PARAMETERS@18..22 + 0: L_ANGLE@18..19 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@19..20 + 0: TS_TYPE_PARAMETER@19..20 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 + 1: TS_TYPE_PARAMETER_NAME@19..20 + 0: IDENT@19..20 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] + 3: EQ@22..24 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@24..32 + 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@26..31 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@26..31 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@26..27 + 0: IDENT@26..27 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@27..31 + 0: COLON@27..29 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@29..31 + 0: JS_REFERENCE_IDENTIFIER@29..31 + 0: IDENT@29..31 "A" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 2: R_CURLY@31..32 "}" [] [] + 5: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..59 + 0: JS_ASSIGNMENT_EXPRESSION@33..58 + 0: JS_PARENTHESIZED_ASSIGNMENT@33..48 + 0: L_PAREN@33..35 "(" [Newline("\n")] [] + 1: TS_AS_ASSIGNMENT@35..46 + 0: JS_IDENTIFIER_ASSIGNMENT@35..37 + 0: IDENT@35..37 "a" [] [Whitespace(" ")] + 1: AS_KW@37..40 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@40..46 + 0: STRING_KW@40..46 "string" [] [] + 2: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 1: EQ@48..50 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@50..58 + 0: JS_STRING_LITERAL@50..58 "\"string\"" [] [] + 1: SEMICOLON@58..59 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@59..90 + 0: JS_ASSIGNMENT_EXPRESSION@59..89 + 0: JS_PARENTHESIZED_ASSIGNMENT@59..83 + 0: L_PAREN@59..61 "(" [Newline("\n")] [] + 1: TS_AS_ASSIGNMENT@61..81 + 0: JS_PARENTHESIZED_ASSIGNMENT@61..72 + 0: L_PAREN@61..62 "(" [] [] + 1: TS_AS_ASSIGNMENT@62..70 + 0: JS_IDENTIFIER_ASSIGNMENT@62..64 + 0: IDENT@62..64 "a" [] [Whitespace(" ")] + 1: AS_KW@64..67 "as" [] [Whitespace(" ")] + 2: TS_ANY_TYPE@67..70 + 0: ANY_KW@67..70 "any" [] [] + 2: R_PAREN@70..72 ")" [] [Whitespace(" ")] + 1: AS_KW@72..75 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@75..81 + 0: STRING_KW@75..81 "string" [] [] + 2: R_PAREN@81..83 ")" [] [Whitespace(" ")] + 1: EQ@83..85 "=" [] [Whitespace(" ")] + 2: JS_NULL_LITERAL_EXPRESSION@85..89 + 0: NULL_KW@85..89 "null" [] [] + 1: SEMICOLON@89..90 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@90..128 + 0: JS_PARENTHESIZED_EXPRESSION@90..127 + 0: L_PAREN@90..92 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@92..126 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@92..111 + 0: L_CURLY@92..94 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@94..109 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@94..109 + 0: JS_LITERAL_MEMBER_NAME@94..95 + 0: IDENT@94..95 "b" [] [] + 1: COLON@95..97 ":" [] [Whitespace(" ")] + 2: TS_AS_ASSIGNMENT@97..109 + 0: JS_IDENTIFIER_ASSIGNMENT@97..99 + 0: IDENT@97..99 "a" [] [Whitespace(" ")] + 1: AS_KW@99..102 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@102..109 + 0: STRING_KW@102..109 "string" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@109..111 "}" [] [Whitespace(" ")] + 1: EQ@111..113 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@113..126 + 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@115..125 + 0: JS_PROPERTY_OBJECT_MEMBER@115..125 + 0: JS_LITERAL_MEMBER_NAME@115..116 + 0: IDENT@115..116 "b" [] [] + 1: COLON@116..118 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@118..125 + 0: JS_STRING_LITERAL@118..125 "\"test\"" [] [Whitespace(" ")] + 2: R_CURLY@125..126 "}" [] [] + 2: R_PAREN@126..127 ")" [] [] + 1: SEMICOLON@127..128 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@128..160 + 0: JS_PARENTHESIZED_EXPRESSION@128..159 + 0: L_PAREN@128..130 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@130..158 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@130..146 + 0: L_BRACK@130..132 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@132..144 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@132..144 + 0: TS_AS_ASSIGNMENT@132..144 + 0: JS_IDENTIFIER_ASSIGNMENT@132..134 + 0: IDENT@132..134 "a" [] [Whitespace(" ")] + 1: AS_KW@134..137 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@137..144 + 0: STRING_KW@137..144 "string" [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@144..146 "]" [] [Whitespace(" ")] + 1: EQ@146..148 "=" [] [Whitespace(" ")] + 2: JS_ARRAY_EXPRESSION@148..158 + 0: L_BRACK@148..150 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ELEMENT_LIST@150..157 + 0: JS_STRING_LITERAL_EXPRESSION@150..157 + 0: JS_STRING_LITERAL@150..157 "\"test\"" [] [Whitespace(" ")] + 2: R_BRACK@157..158 "]" [] [] + 2: R_PAREN@158..159 ")" [] [] + 1: SEMICOLON@159..160 ";" [] [] + 6: JS_FOR_IN_STATEMENT@160..187 + 0: FOR_KW@160..165 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@165..166 "(" [] [] + 2: TS_AS_ASSIGNMENT@166..178 + 0: JS_IDENTIFIER_ASSIGNMENT@166..168 + 0: IDENT@166..168 "a" [] [Whitespace(" ")] + 1: AS_KW@168..171 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@171..178 + 0: STRING_KW@171..178 "string" [] [Whitespace(" ")] + 3: IN_KW@178..181 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@181..183 + 0: L_BRACK@181..182 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@182..182 + 2: R_BRACK@182..183 "]" [] [] + 5: R_PAREN@183..185 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@185..187 + 0: L_CURLY@185..186 "{" [] [] + 1: JS_STATEMENT_LIST@186..186 + 2: R_CURLY@186..187 "}" [] [] + 7: JS_EXPRESSION_STATEMENT@187..221 + 0: JS_ASSIGNMENT_EXPRESSION@187..220 + 0: JS_PARENTHESIZED_ASSIGNMENT@187..205 + 0: L_PAREN@187..189 "(" [Newline("\n")] [] + 1: TS_AS_ASSIGNMENT@189..203 + 0: JS_IDENTIFIER_ASSIGNMENT@189..191 + 0: IDENT@189..191 "a" [] [Whitespace(" ")] + 1: AS_KW@191..194 "as" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@194..203 + 0: JS_REFERENCE_IDENTIFIER@194..195 + 0: IDENT@194..195 "B" [] [] + 1: TS_TYPE_ARGUMENTS@195..203 + 0: L_ANGLE@195..196 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@196..202 + 0: TS_STRING_TYPE@196..202 + 0: STRING_KW@196..202 "string" [] [] + 2: R_ANGLE@202..203 ">" [] [] + 2: R_PAREN@203..205 ")" [] [Whitespace(" ")] + 1: EQ@205..207 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@207..220 + 0: L_CURLY@207..209 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@209..219 + 0: JS_PROPERTY_OBJECT_MEMBER@209..219 + 0: JS_LITERAL_MEMBER_NAME@209..210 + 0: IDENT@209..210 "a" [] [] + 1: COLON@210..212 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@212..219 + 0: JS_STRING_LITERAL@212..219 "\"test\"" [] [Whitespace(" ")] + 2: R_CURLY@219..220 "}" [] [] + 1: SEMICOLON@220..221 ";" [] [] + 8: JS_EXPRESSION_STATEMENT@221..239 + 0: JS_ASSIGNMENT_EXPRESSION@221..239 + 0: JS_PARENTHESIZED_ASSIGNMENT@221..235 + 0: L_PAREN@221..223 "(" [Newline("\n")] [] + 1: TS_TYPE_ASSERTION_ASSIGNMENT@223..233 + 0: L_ANGLE@223..224 "<" [] [] + 1: TS_NUMBER_TYPE@224..230 + 0: NUMBER_KW@224..230 "number" [] [] + 2: R_ANGLE@230..232 ">" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_ASSIGNMENT@232..233 + 0: IDENT@232..233 "a" [] [] + 2: R_PAREN@233..235 ")" [] [Whitespace(" ")] + 1: PLUSEQ@235..238 "+=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@238..239 + 0: JS_NUMBER_LITERAL@238..239 "1" [] [] + 1: (empty) + 4: EOF@239..240 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_as_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts.snap new file mode 100644 index 000000000000..01658f259b37 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts.snap @@ -0,0 +1,316 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let x: any = "string"; +let y = x as string; +let z = x as const; +let not_an_as_expression = x +as; +let precedence = "hello" as const + 3 as number as number; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@7..11 "any" [] [Whitespace(" ")], + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@11..13 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@13..21 "\"string\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@27..29 "y" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@29..31 "=" [] [Whitespace(" ")], + expression: TsAsExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@31..33 "x" [] [Whitespace(" ")], + }, + }, + as_token: AS_KW@33..36 "as" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@36..42 "string" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@48..50 "z" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@50..52 "=" [] [Whitespace(" ")], + expression: TsAsExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@52..54 "x" [] [Whitespace(" ")], + }, + }, + as_token: AS_KW@54..57 "as" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@57..62 "const" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@62..63 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@63..68 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@68..89 "not_an_as_expression" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@89..91 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@91..92 "x" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@92..95 "as" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@95..96 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@96..101 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@101..112 "precedence" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@112..114 "=" [] [Whitespace(" ")], + expression: TsAsExpression { + expression: TsAsExpression { + expression: JsBinaryExpression { + left: TsAsExpression { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@114..122 "\"hello\"" [] [Whitespace(" ")], + }, + as_token: AS_KW@122..125 "as" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@125..131 "const" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + operator_token: PLUS@131..133 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@133..135 "3" [] [Whitespace(" ")], + }, + }, + as_token: AS_KW@135..138 "as" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@138..145 "number" [] [Whitespace(" ")], + }, + }, + as_token: AS_KW@145..148 "as" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@148..154 "number" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@154..155 ";" [] [], + }, + ], + eof_token: EOF@155..156 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..156 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..155 + 0: JS_VARIABLE_STATEMENT@0..22 + 0: JS_VARIABLE_DECLARATION@0..21 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..21 + 0: JS_VARIABLE_DECLARATOR@4..21 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "x" [] [] + 1: TS_TYPE_ANNOTATION@5..11 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@7..11 + 0: ANY_KW@7..11 "any" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@11..21 + 0: EQ@11..13 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@13..21 + 0: JS_STRING_LITERAL@13..21 "\"string\"" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 1: JS_VARIABLE_STATEMENT@22..43 + 0: JS_VARIABLE_DECLARATION@22..42 + 0: (empty) + 1: LET_KW@22..27 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@27..42 + 0: JS_VARIABLE_DECLARATOR@27..42 + 0: JS_IDENTIFIER_BINDING@27..29 + 0: IDENT@27..29 "y" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@29..42 + 0: EQ@29..31 "=" [] [Whitespace(" ")] + 1: TS_AS_EXPRESSION@31..42 + 0: JS_IDENTIFIER_EXPRESSION@31..33 + 0: JS_REFERENCE_IDENTIFIER@31..33 + 0: IDENT@31..33 "x" [] [Whitespace(" ")] + 1: AS_KW@33..36 "as" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@36..42 + 0: STRING_KW@36..42 "string" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 2: JS_VARIABLE_STATEMENT@43..63 + 0: JS_VARIABLE_DECLARATION@43..62 + 0: (empty) + 1: LET_KW@43..48 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@48..62 + 0: JS_VARIABLE_DECLARATOR@48..62 + 0: JS_IDENTIFIER_BINDING@48..50 + 0: IDENT@48..50 "z" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@50..62 + 0: EQ@50..52 "=" [] [Whitespace(" ")] + 1: TS_AS_EXPRESSION@52..62 + 0: JS_IDENTIFIER_EXPRESSION@52..54 + 0: JS_REFERENCE_IDENTIFIER@52..54 + 0: IDENT@52..54 "x" [] [Whitespace(" ")] + 1: AS_KW@54..57 "as" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@57..62 + 0: JS_REFERENCE_IDENTIFIER@57..62 + 0: IDENT@57..62 "const" [] [] + 1: (empty) + 1: SEMICOLON@62..63 ";" [] [] + 3: JS_VARIABLE_STATEMENT@63..92 + 0: JS_VARIABLE_DECLARATION@63..92 + 0: (empty) + 1: LET_KW@63..68 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@68..92 + 0: JS_VARIABLE_DECLARATOR@68..92 + 0: JS_IDENTIFIER_BINDING@68..89 + 0: IDENT@68..89 "not_an_as_expression" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@89..92 + 0: EQ@89..91 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@91..92 + 0: JS_REFERENCE_IDENTIFIER@91..92 + 0: IDENT@91..92 "x" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@92..96 + 0: JS_IDENTIFIER_EXPRESSION@92..95 + 0: JS_REFERENCE_IDENTIFIER@92..95 + 0: IDENT@92..95 "as" [Newline("\n")] [] + 1: SEMICOLON@95..96 ";" [] [] + 5: JS_VARIABLE_STATEMENT@96..155 + 0: JS_VARIABLE_DECLARATION@96..154 + 0: (empty) + 1: LET_KW@96..101 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@101..154 + 0: JS_VARIABLE_DECLARATOR@101..154 + 0: JS_IDENTIFIER_BINDING@101..112 + 0: IDENT@101..112 "precedence" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@112..154 + 0: EQ@112..114 "=" [] [Whitespace(" ")] + 1: TS_AS_EXPRESSION@114..154 + 0: TS_AS_EXPRESSION@114..145 + 0: JS_BINARY_EXPRESSION@114..135 + 0: TS_AS_EXPRESSION@114..131 + 0: JS_STRING_LITERAL_EXPRESSION@114..122 + 0: JS_STRING_LITERAL@114..122 "\"hello\"" [] [Whitespace(" ")] + 1: AS_KW@122..125 "as" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@125..131 + 0: JS_REFERENCE_IDENTIFIER@125..131 + 0: IDENT@125..131 "const" [] [Whitespace(" ")] + 1: (empty) + 1: PLUS@131..133 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@133..135 + 0: JS_NUMBER_LITERAL@133..135 "3" [] [Whitespace(" ")] + 1: AS_KW@135..138 "as" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@138..145 + 0: NUMBER_KW@138..145 "number" [] [Whitespace(" ")] + 1: AS_KW@145..148 "as" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@148..154 + 0: NUMBER_KW@148..154 "number" [] [] + 1: SEMICOLON@154..155 ";" [] [] + 4: EOF@155..156 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap new file mode 100644 index 000000000000..3203113ad228 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap @@ -0,0 +1,604 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a() {} +a(); +(() => { a }).a() +(() => a)(); +type A = T; +a<(arg: T) => number, number, string>(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@10..11 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@11..12 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@12..14 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@14..15 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@15..17 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@17..18 "C" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@18..19 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@19..20 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@20..22 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@22..23 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..26 "a" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@26..27 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@27..28 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@28..30 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@30..31 "B" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@31..33 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@33..34 "C" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@34..35 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@35..36 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@36..37 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsCallExpression { + callee: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@38..40 "(" [Newline("\n")] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@40..41 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@43..46 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@48..50 "a" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + }, + r_paren_token: R_PAREN@51..52 ")" [] [], + }, + operator_token: DOT@52..53 "." [] [], + member: JsName { + value_token: IDENT@53..54 "a" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@54..55 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@55..56 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@56..58 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@58..59 "B" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@59..61 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@61..62 "C" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@62..63 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@63..64 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@64..65 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@65..67 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@67..68 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@70..73 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@73..74 "a" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@74..75 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@75..76 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@76..77 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@77..79 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@79..80 "B" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@80..82 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@82..83 "C" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@83..84 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@84..85 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@85..86 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@86..87 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@93..94 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@94..95 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@95..96 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@96..98 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@98..100 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@100..101 "T" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@101..102 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@102..104 "a" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@104..105 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@105..106 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@106..107 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@107..108 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@108..109 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@109..112 "arg" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@112..114 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@114..115 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@115..117 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")], + return_type: TsNumberType { + number_token: NUMBER_KW@120..126 "number" [] [], + }, + }, + COMMA@126..128 "," [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@128..134 "number" [] [], + }, + COMMA@134..136 "," [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@136..142 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@142..143 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@143..144 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@144..145 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@145..146 ";" [] [], + }, + ], + eof_token: EOF@146..147 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..147 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..146 + 0: JS_FUNCTION_DECLARATION@0..24 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 4: TS_TYPE_PARAMETERS@10..19 + 0: L_ANGLE@10..11 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@11..18 + 0: TS_TYPE_PARAMETER@11..12 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@11..11 + 1: TS_TYPE_PARAMETER_NAME@11..12 + 0: IDENT@11..12 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@12..14 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@14..15 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@14..14 + 1: TS_TYPE_PARAMETER_NAME@14..15 + 0: IDENT@14..15 "B" [] [] + 2: (empty) + 3: (empty) + 3: COMMA@15..17 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@17..18 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@17..17 + 1: TS_TYPE_PARAMETER_NAME@17..18 + 0: IDENT@17..18 "C" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@18..19 ">" [] [] + 5: JS_PARAMETERS@19..22 + 0: L_PAREN@19..20 "(" [] [] + 1: JS_PARAMETER_LIST@20..20 + 2: R_PAREN@20..22 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@22..24 + 0: L_CURLY@22..23 "{" [] [] + 1: JS_DIRECTIVE_LIST@23..23 + 2: JS_STATEMENT_LIST@23..23 + 3: R_CURLY@23..24 "}" [] [] + 1: JS_EXPRESSION_STATEMENT@24..38 + 0: JS_CALL_EXPRESSION@24..37 + 0: JS_IDENTIFIER_EXPRESSION@24..26 + 0: JS_REFERENCE_IDENTIFIER@24..26 + 0: IDENT@24..26 "a" [Newline("\n")] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@26..35 + 0: L_ANGLE@26..27 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@27..34 + 0: TS_REFERENCE_TYPE@27..28 + 0: JS_REFERENCE_IDENTIFIER@27..28 + 0: IDENT@27..28 "A" [] [] + 1: (empty) + 1: COMMA@28..30 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@30..31 + 0: JS_REFERENCE_IDENTIFIER@30..31 + 0: IDENT@30..31 "B" [] [] + 1: (empty) + 3: COMMA@31..33 "," [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@33..34 + 0: JS_REFERENCE_IDENTIFIER@33..34 + 0: IDENT@33..34 "C" [] [] + 1: (empty) + 2: R_ANGLE@34..35 ">" [] [] + 3: JS_CALL_ARGUMENTS@35..37 + 0: L_PAREN@35..36 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@36..36 + 2: R_PAREN@36..37 ")" [] [] + 1: SEMICOLON@37..38 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@38..87 + 0: JS_CALL_EXPRESSION@38..86 + 0: JS_CALL_EXPRESSION@38..75 + 0: JS_CALL_EXPRESSION@38..65 + 0: JS_STATIC_MEMBER_EXPRESSION@38..54 + 0: JS_PARENTHESIZED_EXPRESSION@38..52 + 0: L_PAREN@38..40 "(" [Newline("\n")] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@40..51 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@40..43 + 0: L_PAREN@40..41 "(" [] [] + 1: JS_PARAMETER_LIST@41..41 + 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@43..46 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@46..51 + 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..50 + 0: JS_EXPRESSION_STATEMENT@48..50 + 0: JS_IDENTIFIER_EXPRESSION@48..50 + 0: JS_REFERENCE_IDENTIFIER@48..50 + 0: IDENT@48..50 "a" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@50..51 "}" [] [] + 2: R_PAREN@51..52 ")" [] [] + 1: DOT@52..53 "." [] [] + 2: JS_NAME@53..54 + 0: IDENT@53..54 "a" [] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@54..63 + 0: L_ANGLE@54..55 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@55..62 + 0: TS_REFERENCE_TYPE@55..56 + 0: JS_REFERENCE_IDENTIFIER@55..56 + 0: IDENT@55..56 "A" [] [] + 1: (empty) + 1: COMMA@56..58 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@58..59 + 0: JS_REFERENCE_IDENTIFIER@58..59 + 0: IDENT@58..59 "B" [] [] + 1: (empty) + 3: COMMA@59..61 "," [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@61..62 + 0: JS_REFERENCE_IDENTIFIER@61..62 + 0: IDENT@61..62 "C" [] [] + 1: (empty) + 2: R_ANGLE@62..63 ">" [] [] + 3: JS_CALL_ARGUMENTS@63..65 + 0: L_PAREN@63..64 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@64..64 + 2: R_PAREN@64..65 ")" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@65..75 + 0: L_PAREN@65..67 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@67..74 + 0: JS_ARROW_FUNCTION_EXPRESSION@67..74 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@67..70 + 0: L_PAREN@67..68 "(" [] [] + 1: JS_PARAMETER_LIST@68..68 + 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@70..73 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@73..74 + 0: JS_REFERENCE_IDENTIFIER@73..74 + 0: IDENT@73..74 "a" [] [] + 2: R_PAREN@74..75 ")" [] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@75..84 + 0: L_ANGLE@75..76 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@76..83 + 0: TS_REFERENCE_TYPE@76..77 + 0: JS_REFERENCE_IDENTIFIER@76..77 + 0: IDENT@76..77 "A" [] [] + 1: (empty) + 1: COMMA@77..79 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@79..80 + 0: JS_REFERENCE_IDENTIFIER@79..80 + 0: IDENT@79..80 "B" [] [] + 1: (empty) + 3: COMMA@80..82 "," [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@82..83 + 0: JS_REFERENCE_IDENTIFIER@82..83 + 0: IDENT@82..83 "C" [] [] + 1: (empty) + 2: R_ANGLE@83..84 ">" [] [] + 3: JS_CALL_ARGUMENTS@84..86 + 0: L_PAREN@84..85 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@85..85 + 2: R_PAREN@85..86 ")" [] [] + 1: SEMICOLON@86..87 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@87..102 + 0: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@93..94 + 0: IDENT@93..94 "A" [] [] + 2: TS_TYPE_PARAMETERS@94..98 + 0: L_ANGLE@94..95 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@95..96 + 0: TS_TYPE_PARAMETER@95..96 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@95..95 + 1: TS_TYPE_PARAMETER_NAME@95..96 + 0: IDENT@95..96 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@96..98 ">" [] [Whitespace(" ")] + 3: EQ@98..100 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@100..101 + 0: JS_REFERENCE_IDENTIFIER@100..101 + 0: IDENT@100..101 "T" [] [] + 1: (empty) + 5: SEMICOLON@101..102 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@102..146 + 0: JS_CALL_EXPRESSION@102..145 + 0: JS_IDENTIFIER_EXPRESSION@102..104 + 0: JS_REFERENCE_IDENTIFIER@102..104 + 0: IDENT@102..104 "a" [Newline("\n")] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@104..143 + 0: L_ANGLE@104..105 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@105..142 + 0: TS_FUNCTION_TYPE@105..126 + 0: TS_TYPE_PARAMETERS@105..108 + 0: L_ANGLE@105..106 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@106..107 + 0: TS_TYPE_PARAMETER@106..107 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@106..106 + 1: TS_TYPE_PARAMETER_NAME@106..107 + 0: IDENT@106..107 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@107..108 ">" [] [] + 1: JS_PARAMETERS@108..117 + 0: L_PAREN@108..109 "(" [] [] + 1: JS_PARAMETER_LIST@109..115 + 0: JS_FORMAL_PARAMETER@109..115 + 0: JS_DECORATOR_LIST@109..109 + 1: JS_IDENTIFIER_BINDING@109..112 + 0: IDENT@109..112 "arg" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@112..115 + 0: COLON@112..114 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@114..115 + 0: JS_REFERENCE_IDENTIFIER@114..115 + 0: IDENT@114..115 "T" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@115..117 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@117..120 "=>" [] [Whitespace(" ")] + 3: TS_NUMBER_TYPE@120..126 + 0: NUMBER_KW@120..126 "number" [] [] + 1: COMMA@126..128 "," [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@128..134 + 0: NUMBER_KW@128..134 "number" [] [] + 3: COMMA@134..136 "," [] [Whitespace(" ")] + 4: TS_STRING_TYPE@136..142 + 0: STRING_KW@136..142 "string" [] [] + 2: R_ANGLE@142..143 ">" [] [] + 3: JS_CALL_ARGUMENTS@143..145 + 0: L_PAREN@143..144 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@144..144 + 2: R_PAREN@144..145 ")" [] [] + 1: SEMICOLON@145..146 ";" [] [] + 4: EOF@146..147 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts.snap new file mode 100644 index 000000000000..3c48d0af2306 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts.snap @@ -0,0 +1,457 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { (): string; } +type B = { (a, b, c): number } +type C = { (a: A, b: B): number } +type D = { (a: A): number } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsCallSignatureTypeMember { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@11..12 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@12..13 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@15..21 "string" [] [], + }, + }, + separator_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@30..32 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@32..34 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsCallSignatureTypeMember { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@37..38 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@38..40 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@40..41 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@41..43 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@43..44 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@44..45 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@45..47 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@47..54 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@54..55 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@55..61 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@61..63 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@63..65 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@65..67 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsCallSignatureTypeMember { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@67..68 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@68..69 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@69..71 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@71..72 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@72..73 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@73..74 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@74..75 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@75..77 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@77..78 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@78..80 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@80..81 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@81..83 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@83..84 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@84..85 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@85..87 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@87..94 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@94..95 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@101..103 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@103..105 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@105..107 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsCallSignatureTypeMember { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@107..108 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@108..114 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@114..115 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@115..116 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@116..117 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@117..118 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@118..120 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@120..121 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@121..122 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@122..124 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@124..131 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@131..132 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@132..133 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..133 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..132 + 0: TS_TYPE_ALIAS_DECLARATION@0..24 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..24 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..23 + 0: TS_CALL_SIGNATURE_TYPE_MEMBER@11..23 + 0: (empty) + 1: JS_PARAMETERS@11..13 + 0: L_PAREN@11..12 "(" [] [] + 1: JS_PARAMETER_LIST@12..12 + 2: R_PAREN@12..13 ")" [] [] + 2: TS_RETURN_TYPE_ANNOTATION@13..21 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@15..21 + 0: STRING_KW@15..21 "string" [] [] + 3: SEMICOLON@21..23 ";" [] [Whitespace(" ")] + 2: R_CURLY@23..24 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@24..55 + 0: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@30..32 + 0: IDENT@30..32 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@32..34 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@34..55 + 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@36..54 + 0: TS_CALL_SIGNATURE_TYPE_MEMBER@36..54 + 0: (empty) + 1: JS_PARAMETERS@36..45 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_PARAMETER_LIST@37..44 + 0: JS_FORMAL_PARAMETER@37..38 + 0: JS_DECORATOR_LIST@37..37 + 1: JS_IDENTIFIER_BINDING@37..38 + 0: IDENT@37..38 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@38..40 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@40..41 + 0: JS_DECORATOR_LIST@40..40 + 1: JS_IDENTIFIER_BINDING@40..41 + 0: IDENT@40..41 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@41..43 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@43..44 + 0: JS_DECORATOR_LIST@43..43 + 1: JS_IDENTIFIER_BINDING@43..44 + 0: IDENT@43..44 "c" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@44..45 ")" [] [] + 2: TS_RETURN_TYPE_ANNOTATION@45..54 + 0: COLON@45..47 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@47..54 + 0: NUMBER_KW@47..54 "number" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@54..55 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@55..95 + 0: TYPE_KW@55..61 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@61..63 + 0: IDENT@61..63 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@63..65 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@65..95 + 0: L_CURLY@65..67 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@67..94 + 0: TS_CALL_SIGNATURE_TYPE_MEMBER@67..94 + 0: TS_TYPE_PARAMETERS@67..73 + 0: L_ANGLE@67..68 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@68..72 + 0: TS_TYPE_PARAMETER@68..69 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@68..68 + 1: TS_TYPE_PARAMETER_NAME@68..69 + 0: IDENT@68..69 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@69..71 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@71..72 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@71..71 + 1: TS_TYPE_PARAMETER_NAME@71..72 + 0: IDENT@71..72 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@72..73 ">" [] [] + 1: JS_PARAMETERS@73..85 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_PARAMETER_LIST@74..84 + 0: JS_FORMAL_PARAMETER@74..78 + 0: JS_DECORATOR_LIST@74..74 + 1: JS_IDENTIFIER_BINDING@74..75 + 0: IDENT@74..75 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@75..78 + 0: COLON@75..77 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@77..78 + 0: JS_REFERENCE_IDENTIFIER@77..78 + 0: IDENT@77..78 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@78..80 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@80..84 + 0: JS_DECORATOR_LIST@80..80 + 1: JS_IDENTIFIER_BINDING@80..81 + 0: IDENT@80..81 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@81..84 + 0: COLON@81..83 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@83..84 + 0: JS_REFERENCE_IDENTIFIER@83..84 + 0: IDENT@83..84 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@84..85 ")" [] [] + 2: TS_RETURN_TYPE_ANNOTATION@85..94 + 0: COLON@85..87 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@87..94 + 0: NUMBER_KW@87..94 "number" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@94..95 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@95..132 + 0: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@101..103 + 0: IDENT@101..103 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@103..105 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@105..132 + 0: L_CURLY@105..107 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@107..131 + 0: TS_CALL_SIGNATURE_TYPE_MEMBER@107..131 + 0: TS_TYPE_PARAMETERS@107..116 + 0: L_ANGLE@107..108 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@108..115 + 0: TS_TYPE_PARAMETER@108..115 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@108..114 + 0: TS_CONST_MODIFIER@108..114 + 0: CONST_KW@108..114 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@114..115 + 0: IDENT@114..115 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@115..116 ">" [] [] + 1: JS_PARAMETERS@116..122 + 0: L_PAREN@116..117 "(" [] [] + 1: JS_PARAMETER_LIST@117..121 + 0: JS_FORMAL_PARAMETER@117..121 + 0: JS_DECORATOR_LIST@117..117 + 1: JS_IDENTIFIER_BINDING@117..118 + 0: IDENT@117..118 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@118..121 + 0: COLON@118..120 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@120..121 + 0: JS_REFERENCE_IDENTIFIER@120..121 + 0: IDENT@120..121 "A" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@121..122 ")" [] [] + 2: TS_RETURN_TYPE_ANNOTATION@122..131 + 0: COLON@122..124 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@124..131 + 0: NUMBER_KW@124..131 "number" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@131..132 "}" [] [] + 5: (empty) + 4: EOF@132..133 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts.snap new file mode 100644 index 000000000000..85e0913409b5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts.snap @@ -0,0 +1,137 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +try {} catch (error: any) {} +try {} catch (error: unknown) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsTryStatement { + try_token: TRY_KW@0..4 "try" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@4..5 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@5..7 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@7..13 "catch" [] [Whitespace(" ")], + declaration: JsCatchDeclaration { + l_paren_token: L_PAREN@13..14 "(" [] [], + binding: JsIdentifierBinding { + name_token: IDENT@14..19 "error" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@19..21 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@21..24 "any" [] [], + }, + }, + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + }, + body: JsBlockStatement { + l_curly_token: L_CURLY@26..27 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + }, + }, + JsTryStatement { + try_token: TRY_KW@28..33 "try" [Newline("\n")] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@33..34 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@34..36 "}" [] [Whitespace(" ")], + }, + catch_clause: JsCatchClause { + catch_token: CATCH_KW@36..42 "catch" [] [Whitespace(" ")], + declaration: JsCatchDeclaration { + l_paren_token: L_PAREN@42..43 "(" [] [], + binding: JsIdentifierBinding { + name_token: IDENT@43..48 "error" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@48..50 ":" [] [Whitespace(" ")], + ty: TsUnknownType { + unknown_token: UNKNOWN_KW@50..57 "unknown" [] [], + }, + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + }, + body: JsBlockStatement { + l_curly_token: L_CURLY@59..60 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@61..62 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..62 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..61 + 0: JS_TRY_STATEMENT@0..28 + 0: TRY_KW@0..4 "try" [] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@4..7 + 0: L_CURLY@4..5 "{" [] [] + 1: JS_STATEMENT_LIST@5..5 + 2: R_CURLY@5..7 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@7..28 + 0: CATCH_KW@7..13 "catch" [] [Whitespace(" ")] + 1: JS_CATCH_DECLARATION@13..26 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_IDENTIFIER_BINDING@14..19 + 0: IDENT@14..19 "error" [] [] + 2: TS_TYPE_ANNOTATION@19..24 + 0: COLON@19..21 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@21..24 + 0: ANY_KW@21..24 "any" [] [] + 3: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@26..28 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_STATEMENT_LIST@27..27 + 2: R_CURLY@27..28 "}" [] [] + 1: JS_TRY_STATEMENT@28..61 + 0: TRY_KW@28..33 "try" [Newline("\n")] [Whitespace(" ")] + 1: JS_BLOCK_STATEMENT@33..36 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_STATEMENT_LIST@34..34 + 2: R_CURLY@34..36 "}" [] [Whitespace(" ")] + 2: JS_CATCH_CLAUSE@36..61 + 0: CATCH_KW@36..42 "catch" [] [Whitespace(" ")] + 1: JS_CATCH_DECLARATION@42..59 + 0: L_PAREN@42..43 "(" [] [] + 1: JS_IDENTIFIER_BINDING@43..48 + 0: IDENT@43..48 "error" [] [] + 2: TS_TYPE_ANNOTATION@48..57 + 0: COLON@48..50 ":" [] [Whitespace(" ")] + 1: TS_UNKNOWN_TYPE@50..57 + 0: UNKNOWN_KW@50..57 "unknown" [] [] + 3: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 2: JS_BLOCK_STATEMENT@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_STATEMENT_LIST@60..60 + 2: R_CURLY@60..61 "}" [] [] + 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap new file mode 100644 index 000000000000..572772025185 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap @@ -0,0 +1,62 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class abstract {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..15 "abstract" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@15..16 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: JS_CLASS_DECLARATION@0..17 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..15 + 0: IDENT@6..15 "abstract" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@15..16 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@16..16 + 9: R_CURLY@16..17 "}" [] [] + 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts.snap new file mode 100644 index 000000000000..57caec509bdc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts.snap @@ -0,0 +1,157 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + a: string; + b?: string = "test"; + c!: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@9..13 "a" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@15..21 "string" [] [], + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@22..26 "b" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: TsOptionalPropertyAnnotation { + question_mark_token: QUESTION@26..27 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@27..29 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@29..36 "string" [] [Whitespace(" ")], + }, + }, + }, + value: JsInitializerClause { + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@38..44 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@45..49 "c" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: TsDefinitePropertyAnnotation { + excl_token: BANG@49..50 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@52..58 "string" [] [], + }, + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + ], + r_curly_token: R_CURLY@59..61 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@61..62 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..62 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..61 + 0: JS_CLASS_DECLARATION@0..61 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..59 + 0: JS_PROPERTY_CLASS_MEMBER@9..22 + 0: JS_PROPERTY_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..13 + 0: IDENT@9..13 "a" [Newline("\n"), Whitespace(" ")] [] + 2: TS_TYPE_ANNOTATION@13..21 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@15..21 + 0: STRING_KW@15..21 "string" [] [] + 3: (empty) + 4: SEMICOLON@21..22 ";" [] [] + 1: JS_PROPERTY_CLASS_MEMBER@22..45 + 0: JS_PROPERTY_MODIFIER_LIST@22..22 + 1: JS_LITERAL_MEMBER_NAME@22..26 + 0: IDENT@22..26 "b" [Newline("\n"), Whitespace(" ")] [] + 2: TS_OPTIONAL_PROPERTY_ANNOTATION@26..36 + 0: QUESTION@26..27 "?" [] [] + 1: TS_TYPE_ANNOTATION@27..36 + 0: COLON@27..29 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@29..36 + 0: STRING_KW@29..36 "string" [] [Whitespace(" ")] + 3: JS_INITIALIZER_CLAUSE@36..44 + 0: EQ@36..38 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@38..44 + 0: JS_STRING_LITERAL@38..44 "\"test\"" [] [] + 4: SEMICOLON@44..45 ";" [] [] + 2: JS_PROPERTY_CLASS_MEMBER@45..59 + 0: JS_PROPERTY_MODIFIER_LIST@45..45 + 1: JS_LITERAL_MEMBER_NAME@45..49 + 0: IDENT@45..49 "c" [Newline("\n"), Whitespace(" ")] [] + 2: TS_DEFINITE_PROPERTY_ANNOTATION@49..58 + 0: BANG@49..50 "!" [] [] + 1: TS_TYPE_ANNOTATION@50..58 + 0: COLON@50..52 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@52..58 + 0: STRING_KW@52..58 "string" [] [] + 3: (empty) + 4: SEMICOLON@58..59 ";" [] [] + 9: R_CURLY@59..61 "}" [Newline("\n")] [] + 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap new file mode 100644 index 000000000000..71c55e0aad75 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap @@ -0,0 +1,595 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { + base1; +} +abstract class Test extends Base { + declare a: string; + private declare c: string; + declare private d: string; + declare private readonly e: string; + private readonly declare f: string; + declare private static readonly g: string; + private static readonly declare h: string; + protected readonly abstract i: string; + protected abstract readonly j: string; + protected override readonly base1: string; + private static accessor readonly k: string; + protected abstract accessor readonly l: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Base" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@12..20 "base1" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: missing (optional), + value: missing (optional), + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + ], + r_curly_token: R_CURLY@21..23 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@23..33 "abstract" [Newline("\n")] [Whitespace(" ")], + class_token: CLASS_KW@33..39 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@39..44 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@44..52 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@52..57 "Base" [] [Whitespace(" ")], + }, + }, + type_arguments: missing (optional), + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@57..58 "{" [] [], + members: JsClassMemberList [ + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@58..71 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@71..72 "a" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@72..74 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@74..80 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@80..81 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@81..94 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@102..103 "c" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@103..105 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@105..111 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@112..125 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@125..133 "private" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@133..134 "d" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@134..136 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@136..142 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@142..143 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@143..156 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@156..164 "private" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@164..173 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@173..174 "e" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@174..176 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@176..182 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@182..183 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@183..196 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@196..205 "readonly" [] [Whitespace(" ")], + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@205..213 "declare" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@213..214 "f" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@214..216 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@216..222 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@222..223 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@223..236 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@236..244 "private" [] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@244..251 "static" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@251..260 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@260..261 "g" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@261..263 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@263..269 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@269..270 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@270..283 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@283..290 "static" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@290..299 "readonly" [] [Whitespace(" ")], + }, + TsDeclareModifier { + modifier_token: DECLARE_KW@299..307 "declare" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@307..308 "h" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@308..310 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@310..316 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@316..317 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@317..332 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@332..341 "readonly" [] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@341..350 "abstract" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@350..351 "i" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@351..353 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@353..359 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@359..360 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@360..375 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@375..384 "abstract" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@384..393 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@393..394 "j" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@394..396 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@396..402 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@402..403 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@403..418 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsOverrideModifier { + modifier_token: OVERRIDE_KW@418..427 "override" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@427..436 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@436..441 "base1" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@441..443 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@443..449 "string" [] [], + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@449..450 ";" [] [], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@450..463 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@463..470 "static" [] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@470..479 "accessor" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@479..488 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@488..489 "k" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@489..491 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@491..497 "string" [] [], + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@497..498 ";" [] [], + }, + TsPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@498..513 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsAbstractModifier { + modifier_token: ABSTRACT_KW@513..522 "abstract" [] [Whitespace(" ")], + }, + JsAccessorModifier { + modifier_token: ACCESSOR_KW@522..531 "accessor" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@531..540 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@540..541 "l" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@541..543 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@543..549 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@549..550 ";" [] [], + }, + ], + r_curly_token: R_CURLY@550..552 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@552..553 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..553 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..552 + 0: JS_CLASS_DECLARATION@0..23 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Base" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..21 + 0: JS_PROPERTY_CLASS_MEMBER@12..21 + 0: JS_PROPERTY_MODIFIER_LIST@12..12 + 1: JS_LITERAL_MEMBER_NAME@12..20 + 0: IDENT@12..20 "base1" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: (empty) + 4: SEMICOLON@20..21 ";" [] [] + 9: R_CURLY@21..23 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@23..552 + 0: JS_DECORATOR_LIST@23..23 + 1: ABSTRACT_KW@23..33 "abstract" [Newline("\n")] [Whitespace(" ")] + 2: CLASS_KW@33..39 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@39..44 + 0: IDENT@39..44 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@44..57 + 0: EXTENDS_KW@44..52 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@52..57 + 0: JS_REFERENCE_IDENTIFIER@52..57 + 0: IDENT@52..57 "Base" [] [Whitespace(" ")] + 2: (empty) + 6: (empty) + 7: L_CURLY@57..58 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@58..550 + 0: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@58..81 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@58..71 + 0: TS_DECLARE_MODIFIER@58..71 + 0: DECLARE_KW@58..71 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@71..72 + 0: IDENT@71..72 "a" [] [] + 2: TS_TYPE_ANNOTATION@72..80 + 0: COLON@72..74 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@74..80 + 0: STRING_KW@74..80 "string" [] [] + 3: SEMICOLON@80..81 ";" [] [] + 1: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@81..112 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@81..102 + 0: TS_ACCESSIBILITY_MODIFIER@81..94 + 0: PRIVATE_KW@81..94 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_DECLARE_MODIFIER@94..102 + 0: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@102..103 + 0: IDENT@102..103 "c" [] [] + 2: TS_TYPE_ANNOTATION@103..111 + 0: COLON@103..105 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@105..111 + 0: STRING_KW@105..111 "string" [] [] + 3: SEMICOLON@111..112 ";" [] [] + 2: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@112..143 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@112..133 + 0: TS_DECLARE_MODIFIER@112..125 + 0: DECLARE_KW@112..125 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@125..133 + 0: PRIVATE_KW@125..133 "private" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@133..134 + 0: IDENT@133..134 "d" [] [] + 2: TS_TYPE_ANNOTATION@134..142 + 0: COLON@134..136 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@136..142 + 0: STRING_KW@136..142 "string" [] [] + 3: SEMICOLON@142..143 ";" [] [] + 3: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@143..183 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@143..173 + 0: TS_DECLARE_MODIFIER@143..156 + 0: DECLARE_KW@143..156 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@156..164 + 0: PRIVATE_KW@156..164 "private" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@164..173 + 0: READONLY_KW@164..173 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@173..174 + 0: IDENT@173..174 "e" [] [] + 2: TS_TYPE_ANNOTATION@174..182 + 0: COLON@174..176 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@176..182 + 0: STRING_KW@176..182 "string" [] [] + 3: SEMICOLON@182..183 ";" [] [] + 4: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@183..223 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@183..213 + 0: TS_ACCESSIBILITY_MODIFIER@183..196 + 0: PRIVATE_KW@183..196 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@196..205 + 0: READONLY_KW@196..205 "readonly" [] [Whitespace(" ")] + 2: TS_DECLARE_MODIFIER@205..213 + 0: DECLARE_KW@205..213 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@213..214 + 0: IDENT@213..214 "f" [] [] + 2: TS_TYPE_ANNOTATION@214..222 + 0: COLON@214..216 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@216..222 + 0: STRING_KW@216..222 "string" [] [] + 3: SEMICOLON@222..223 ";" [] [] + 5: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@223..270 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@223..260 + 0: TS_DECLARE_MODIFIER@223..236 + 0: DECLARE_KW@223..236 "declare" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@236..244 + 0: PRIVATE_KW@236..244 "private" [] [Whitespace(" ")] + 2: JS_STATIC_MODIFIER@244..251 + 0: STATIC_KW@244..251 "static" [] [Whitespace(" ")] + 3: TS_READONLY_MODIFIER@251..260 + 0: READONLY_KW@251..260 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@260..261 + 0: IDENT@260..261 "g" [] [] + 2: TS_TYPE_ANNOTATION@261..269 + 0: COLON@261..263 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@263..269 + 0: STRING_KW@263..269 "string" [] [] + 3: SEMICOLON@269..270 ";" [] [] + 6: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@270..317 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@270..307 + 0: TS_ACCESSIBILITY_MODIFIER@270..283 + 0: PRIVATE_KW@270..283 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@283..290 + 0: STATIC_KW@283..290 "static" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@290..299 + 0: READONLY_KW@290..299 "readonly" [] [Whitespace(" ")] + 3: TS_DECLARE_MODIFIER@299..307 + 0: DECLARE_KW@299..307 "declare" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@307..308 + 0: IDENT@307..308 "h" [] [] + 2: TS_TYPE_ANNOTATION@308..316 + 0: COLON@308..310 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@310..316 + 0: STRING_KW@310..316 "string" [] [] + 3: SEMICOLON@316..317 ";" [] [] + 7: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@317..360 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@317..350 + 0: TS_ACCESSIBILITY_MODIFIER@317..332 + 0: PROTECTED_KW@317..332 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@332..341 + 0: READONLY_KW@332..341 "readonly" [] [Whitespace(" ")] + 2: TS_ABSTRACT_MODIFIER@341..350 + 0: ABSTRACT_KW@341..350 "abstract" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@350..351 + 0: IDENT@350..351 "i" [] [] + 2: TS_TYPE_ANNOTATION@351..359 + 0: COLON@351..353 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@353..359 + 0: STRING_KW@353..359 "string" [] [] + 3: SEMICOLON@359..360 ";" [] [] + 8: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@360..403 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@360..393 + 0: TS_ACCESSIBILITY_MODIFIER@360..375 + 0: PROTECTED_KW@360..375 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@375..384 + 0: ABSTRACT_KW@375..384 "abstract" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@384..393 + 0: READONLY_KW@384..393 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@393..394 + 0: IDENT@393..394 "j" [] [] + 2: TS_TYPE_ANNOTATION@394..402 + 0: COLON@394..396 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@396..402 + 0: STRING_KW@396..402 "string" [] [] + 3: SEMICOLON@402..403 ";" [] [] + 9: JS_PROPERTY_CLASS_MEMBER@403..450 + 0: JS_PROPERTY_MODIFIER_LIST@403..436 + 0: TS_ACCESSIBILITY_MODIFIER@403..418 + 0: PROTECTED_KW@403..418 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_OVERRIDE_MODIFIER@418..427 + 0: OVERRIDE_KW@418..427 "override" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@427..436 + 0: READONLY_KW@427..436 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@436..441 + 0: IDENT@436..441 "base1" [] [] + 2: TS_TYPE_ANNOTATION@441..449 + 0: COLON@441..443 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@443..449 + 0: STRING_KW@443..449 "string" [] [] + 3: (empty) + 4: SEMICOLON@449..450 ";" [] [] + 10: JS_PROPERTY_CLASS_MEMBER@450..498 + 0: JS_PROPERTY_MODIFIER_LIST@450..488 + 0: TS_ACCESSIBILITY_MODIFIER@450..463 + 0: PRIVATE_KW@450..463 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@463..470 + 0: STATIC_KW@463..470 "static" [] [Whitespace(" ")] + 2: JS_ACCESSOR_MODIFIER@470..479 + 0: ACCESSOR_KW@470..479 "accessor" [] [Whitespace(" ")] + 3: TS_READONLY_MODIFIER@479..488 + 0: READONLY_KW@479..488 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@488..489 + 0: IDENT@488..489 "k" [] [] + 2: TS_TYPE_ANNOTATION@489..497 + 0: COLON@489..491 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@491..497 + 0: STRING_KW@491..497 "string" [] [] + 3: (empty) + 4: SEMICOLON@497..498 ";" [] [] + 11: TS_PROPERTY_SIGNATURE_CLASS_MEMBER@498..550 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@498..540 + 0: TS_ACCESSIBILITY_MODIFIER@498..513 + 0: PROTECTED_KW@498..513 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_ABSTRACT_MODIFIER@513..522 + 0: ABSTRACT_KW@513..522 "abstract" [] [Whitespace(" ")] + 2: JS_ACCESSOR_MODIFIER@522..531 + 0: ACCESSOR_KW@522..531 "accessor" [] [Whitespace(" ")] + 3: TS_READONLY_MODIFIER@531..540 + 0: READONLY_KW@531..540 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@540..541 + 0: IDENT@540..541 "l" [] [] + 2: TS_TYPE_ANNOTATION@541..549 + 0: COLON@541..543 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@543..549 + 0: STRING_KW@543..549 "string" [] [] + 3: SEMICOLON@549..550 ";" [] [] + 9: R_CURLY@550..552 "}" [Newline("\n")] [] + 4: EOF@552..553 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts.snap new file mode 100644 index 000000000000..1fef962e20da --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts.snap @@ -0,0 +1,116 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class BuildError {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..16 "BuildError" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@16..17 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@17..18 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@18..20 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@20..21 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@21..23 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@23..24 "C" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@24..26 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@26..27 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_CLASS_DECLARATION@0..28 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..16 + 0: IDENT@6..16 "BuildError" [] [] + 4: TS_TYPE_PARAMETERS@16..26 + 0: L_ANGLE@16..17 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@17..24 + 0: TS_TYPE_PARAMETER@17..18 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@17..17 + 1: TS_TYPE_PARAMETER_NAME@17..18 + 0: IDENT@17..18 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@18..20 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@20..21 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@20..20 + 1: TS_TYPE_PARAMETER_NAME@20..21 + 0: IDENT@20..21 "B" [] [] + 2: (empty) + 3: (empty) + 3: COMMA@21..23 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@23..24 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@23..23 + 1: TS_TYPE_PARAMETER_NAME@23..24 + 0: IDENT@23..24 "C" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@24..26 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@26..27 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@27..27 + 9: R_CURLY@27..28 "}" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts.snap new file mode 100644 index 000000000000..119dd047f956 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts.snap @@ -0,0 +1,2427 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = number; +type B = string extends number ? string : number; +type C = A extends (B extends A ? number : string) ? void : number; +type D = T extends [infer S extends string, ...unknown[]] ? S : never; +type E = T extends (infer U extends number ? U : T ) ? U : T +type F = T extends { [P in infer U extends keyof T ? 1 : 0]: 1; } ? 1 : 0; +type G = T extends [unknown, infer S extends string] ? S : never; +type H = A extends () => B extends C ? D : E ? F : G; +type J = T extends ((...a: any[]) => infer R extends string) ? R : never; +type Equals = A extends (x: B extends C ? D : E) => 0 ? F : G; +type Curry any)> = + (...args: Tools.Cast>>, any[]>) => + GapsOf> extends [any, ...any[]] + ? Curry<(...args: GapsOf> extends infer G ? Tools.Cast : never) => ReturnType> + : ReturnType; +interface GapsOfWorker { + 0: GapsOf extends infer G ? Tools.Cast : never, Tools.Next>; + 1: Tools.Concat, T2> extends infer D ? Tools.Cast : never>; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@9..15 "number" [] [], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@22..24 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsStringType { + string_token: STRING_KW@26..33 "string" [] [Whitespace(" ")], + }, + extends_token: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")], + extends_type: TsNumberType { + number_token: NUMBER_KW@41..48 "number" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@48..50 "?" [] [Whitespace(" ")], + true_type: TsStringType { + string_token: STRING_KW@50..57 "string" [] [Whitespace(" ")], + }, + colon_token: COLON@57..59 ":" [] [Whitespace(" ")], + false_type: TsNumberType { + number_token: NUMBER_KW@59..65 "number" [] [], + }, + }, + semicolon_token: SEMICOLON@65..66 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@72..74 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@74..76 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@76..78 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@86..87 "(" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@87..89 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@89..97 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@97..99 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + question_mark_token: QUESTION@99..101 "?" [] [Whitespace(" ")], + true_type: TsNumberType { + number_token: NUMBER_KW@101..108 "number" [] [Whitespace(" ")], + }, + colon_token: COLON@108..110 ":" [] [Whitespace(" ")], + false_type: TsStringType { + string_token: STRING_KW@110..116 "string" [] [], + }, + }, + r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@118..120 "?" [] [Whitespace(" ")], + true_type: TsVoidType { + void_token: VOID_KW@120..125 "void" [] [Whitespace(" ")], + }, + colon_token: COLON@125..127 ":" [] [Whitespace(" ")], + false_type: TsNumberType { + number_token: NUMBER_KW@127..133 "number" [] [], + }, + }, + semicolon_token: SEMICOLON@133..134 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@134..140 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@140..141 "D" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@141..142 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@142..143 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@143..145 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@145..147 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@147..149 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@149..157 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@157..158 "[" [] [], + elements: TsTupleTypeElementList [ + TsInferType { + infer_token: INFER_KW@158..164 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@164..166 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@166..174 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@174..180 "string" [] [], + }, + }, + }, + COMMA@180..182 "," [] [Whitespace(" ")], + TsRestTupleTypeElement { + dotdotdot_token: DOT3@182..185 "..." [] [], + ty: TsArrayType { + element_type: TsUnknownType { + unknown_token: UNKNOWN_KW@185..192 "unknown" [] [], + }, + l_brack_token: L_BRACK@192..193 "[" [] [], + r_brack_token: R_BRACK@193..194 "]" [] [], + }, + }, + ], + r_brack_token: R_BRACK@194..196 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@196..198 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@198..200 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@200..202 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@202..207 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@207..208 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@208..214 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@214..215 "E" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@215..216 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@216..217 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@217..219 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@219..220 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@220..222 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@222..224 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@224..226 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@226..234 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@234..235 "(" [] [], + ty: TsConditionalType { + check_type: TsInferType { + infer_token: INFER_KW@235..241 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@241..243 "U" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + extends_token: EXTENDS_KW@243..251 "extends" [] [Whitespace(" ")], + extends_type: TsNumberType { + number_token: NUMBER_KW@251..258 "number" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@258..260 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@260..262 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@262..264 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@264..266 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + r_paren_token: R_PAREN@266..268 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@268..270 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@270..272 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@272..274 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@274..275 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@275..281 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@281..282 "F" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@282..283 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@283..284 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@284..286 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@286..288 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@288..290 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@290..298 "extends" [] [Whitespace(" ")], + extends_type: TsMappedType { + l_curly_token: L_CURLY@298..300 "{" [] [Whitespace(" ")], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@300..301 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@301..303 "P" [] [Whitespace(" ")], + }, + in_token: IN_KW@303..306 "in" [] [Whitespace(" ")], + keys_type: TsConditionalType { + check_type: TsInferType { + infer_token: INFER_KW@306..312 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@312..314 "U" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + extends_token: EXTENDS_KW@314..322 "extends" [] [Whitespace(" ")], + extends_type: TsTypeOperatorType { + operator_token: KEYOF_KW@322..328 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@328..330 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + question_mark_token: QUESTION@330..332 "?" [] [Whitespace(" ")], + true_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@332..334 "1" [] [Whitespace(" ")], + }, + colon_token: COLON@334..336 ":" [] [Whitespace(" ")], + false_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@336..337 "0" [] [], + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@337..338 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@338..340 ":" [] [Whitespace(" ")], + ty: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@340..341 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@341..343 ";" [] [Whitespace(" ")], + r_curly_token: R_CURLY@343..345 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@345..347 "?" [] [Whitespace(" ")], + true_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@347..349 "1" [] [Whitespace(" ")], + }, + colon_token: COLON@349..351 ":" [] [Whitespace(" ")], + false_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@351..352 "0" [] [], + }, + }, + semicolon_token: SEMICOLON@352..353 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@353..359 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@359..360 "G" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@360..361 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@361..362 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@362..364 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@364..366 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@366..368 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@376..377 "[" [] [], + elements: TsTupleTypeElementList [ + TsUnknownType { + unknown_token: UNKNOWN_KW@377..384 "unknown" [] [], + }, + COMMA@384..386 "," [] [Whitespace(" ")], + TsInferType { + infer_token: INFER_KW@386..392 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@392..394 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@394..402 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@402..408 "string" [] [], + }, + }, + }, + ], + r_brack_token: R_BRACK@408..410 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@410..412 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@412..414 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@414..416 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@416..421 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@421..422 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@422..428 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@428..430 "H" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@430..432 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@432..434 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@434..442 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@442..443 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@443..445 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@445..448 "=>" [] [Whitespace(" ")], + return_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@448..450 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@450..458 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@458..460 "C" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + question_mark_token: QUESTION@460..462 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@462..464 "D" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@464..466 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@466..468 "E" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + }, + question_mark_token: QUESTION@468..470 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@470..472 "F" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@472..474 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@474..475 "G" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@475..476 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@476..482 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@482..483 "J" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@483..484 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@484..485 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@485..487 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@487..489 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@489..491 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@491..499 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@499..500 "(" [] [], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@500..501 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@501..504 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@504..505 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@505..507 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@507..510 "any" [] [], + }, + l_brack_token: L_BRACK@510..511 "[" [] [], + r_brack_token: R_BRACK@511..512 "]" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@512..514 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@514..517 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@517..523 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@523..525 "R" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@525..533 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@533..539 "string" [] [], + }, + }, + }, + }, + r_paren_token: R_PAREN@539..541 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@541..543 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@543..545 "R" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@545..547 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@547..552 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@552..553 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@553..559 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@559..566 "Equals" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@566..568 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@568..570 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@570..578 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@578..579 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@579..580 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@580..582 ":" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@582..584 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@584..592 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@592..594 "C" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + question_mark_token: QUESTION@594..596 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@596..598 "D" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@598..600 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@600..601 "E" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@601..603 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@603..606 "=>" [] [Whitespace(" ")], + return_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@606..608 "0" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@608..610 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@610..612 "F" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@612..614 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@614..615 "G" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@615..616 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@616..622 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@622..627 "Curry" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@627..628 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@628..630 "F" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@630..638 "extends" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@638..639 "(" [] [], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@639..640 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@640..643 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@643..647 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@647..649 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@649..652 "any" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@652..654 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@654..657 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@657..660 "any" [] [], + }, + }, + r_paren_token: R_PAREN@660..661 ")" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@661..663 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@663..664 "=" [] [], + ty: TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@664..670 "<" [Newline("\n"), Whitespace(" ")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@670..672 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@672..680 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@680..683 "any" [] [], + }, + l_brack_token: L_BRACK@683..684 "[" [] [], + r_brack_token: R_BRACK@684..685 "]" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@685..686 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@686..687 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@687..690 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@690..694 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@694..696 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@696..701 "Tools" [] [], + }, + dot_token: DOT@701..702 "." [] [], + right: JsName { + value_token: IDENT@702..706 "Cast" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@706..707 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@707..712 "Tools" [] [], + }, + dot_token: DOT@712..713 "." [] [], + right: JsName { + value_token: IDENT@713..717 "Cast" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@717..718 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@718..719 "T" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@719..721 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@721..725 "Gaps" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@725..726 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@726..736 "Parameters" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@736..737 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@737..738 "F" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@738..739 ">" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@739..740 ">" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@740..741 ">" [] [], + }, + }, + COMMA@741..743 "," [] [Whitespace(" ")], + TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@743..746 "any" [] [], + }, + l_brack_token: L_BRACK@746..747 "[" [] [], + r_brack_token: R_BRACK@747..748 "]" [] [], + }, + ], + r_angle_token: R_ANGLE@748..749 ">" [] [], + }, + }, + }, + }, + ], + r_paren_token: R_PAREN@749..751 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@751..753 "=>" [] [], + return_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@753..769 "GapsOf" [Newline("\n"), Whitespace(" ")] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@769..770 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@770..771 "T" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@771..773 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@773..783 "Parameters" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@783..784 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@784..785 "F" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@785..786 ">" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@786..788 ">" [] [Whitespace(" ")], + }, + }, + extends_token: EXTENDS_KW@788..796 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@796..797 "[" [] [], + elements: TsTupleTypeElementList [ + TsAnyType { + any_token: ANY_KW@797..800 "any" [] [], + }, + COMMA@800..802 "," [] [Whitespace(" ")], + TsRestTupleTypeElement { + dotdotdot_token: DOT3@802..805 "..." [] [], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@805..808 "any" [] [], + }, + l_brack_token: L_BRACK@808..809 "[" [] [], + r_brack_token: R_BRACK@809..810 "]" [] [], + }, + }, + ], + r_brack_token: R_BRACK@810..811 "]" [] [], + }, + question_mark_token: QUESTION@811..823 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@823..828 "Curry" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@828..829 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@829..830 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@830..833 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@833..837 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@837..839 ":" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@839..845 "GapsOf" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@845..846 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@846..847 "T" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@847..849 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@849..859 "Parameters" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@859..860 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@860..861 "F" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@861..862 ">" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@862..864 ">" [] [Whitespace(" ")], + }, + }, + extends_token: EXTENDS_KW@864..872 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@872..878 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@878..880 "G" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@880..882 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@882..887 "Tools" [] [], + }, + dot_token: DOT@887..888 "." [] [], + right: JsName { + value_token: IDENT@888..892 "Cast" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@892..893 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@893..894 "G" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@894..896 "," [] [Whitespace(" ")], + TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@896..899 "any" [] [], + }, + l_brack_token: L_BRACK@899..900 "[" [] [], + r_brack_token: R_BRACK@900..901 "]" [] [], + }, + ], + r_angle_token: R_ANGLE@901..903 ">" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@903..905 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@905..910 "never" [] [], + }, + }, + }, + }, + ], + r_paren_token: R_PAREN@910..912 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@912..915 "=>" [] [Whitespace(" ")], + return_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@915..925 "ReturnType" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@925..926 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@926..927 "F" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@927..928 ">" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@928..929 ">" [] [], + }, + }, + colon_token: COLON@929..941 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@941..951 "ReturnType" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@951..952 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@952..953 "F" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@953..954 ">" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@954..955 ";" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@955..966 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@966..978 "GapsOfWorker" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@978..979 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@979..982 "T1" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@982..990 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@990..993 "any" [] [], + }, + l_brack_token: L_BRACK@993..994 "[" [] [], + r_brack_token: R_BRACK@994..995 "]" [] [], + }, + }, + default: missing (optional), + }, + COMMA@995..997 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@997..1000 "T2" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1000..1008 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1008..1011 "any" [] [], + }, + l_brack_token: L_BRACK@1011..1012 "[" [] [], + r_brack_token: R_BRACK@1012..1013 "]" [] [], + }, + }, + default: missing (optional), + }, + COMMA@1013..1015 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1015..1018 "TN" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1018..1026 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1026..1029 "any" [] [], + }, + l_brack_token: L_BRACK@1029..1030 "[" [] [], + r_brack_token: R_BRACK@1030..1032 "]" [] [Whitespace(" ")], + }, + }, + default: TsDefaultTypeClause { + eq_token: EQ@1032..1034 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@1034..1035 "[" [] [], + elements: TsTupleTypeElementList [], + r_brack_token: R_BRACK@1035..1036 "]" [] [], + }, + }, + }, + COMMA@1036..1038 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1038..1040 "I" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1040..1048 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1048..1051 "any" [] [], + }, + l_brack_token: L_BRACK@1051..1052 "[" [] [], + r_brack_token: R_BRACK@1052..1054 "]" [] [Whitespace(" ")], + }, + }, + default: TsDefaultTypeClause { + eq_token: EQ@1054..1056 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@1056..1057 "[" [] [], + elements: TsTupleTypeElementList [], + r_brack_token: R_BRACK@1057..1058 "]" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@1058..1060 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@1060..1061 "{" [] [], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@1061..1067 "0" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1067..1069 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1069..1075 "GapsOf" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1075..1076 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1076..1078 "T1" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1078..1080 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1080..1082 "T2" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1082..1084 "," [] [Whitespace(" ")], + TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1084..1089 "GapOf" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1089..1090 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1090..1092 "T1" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1092..1094 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1094..1096 "T2" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1096..1098 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1098..1100 "TN" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1100..1102 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1102..1103 "I" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1103..1105 ">" [] [Whitespace(" ")], + }, + }, + extends_token: EXTENDS_KW@1105..1113 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1119..1121 "G" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@1121..1123 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@1123..1128 "Tools" [] [], + }, + dot_token: DOT@1128..1129 "." [] [], + right: JsName { + value_token: IDENT@1129..1133 "Cast" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1133..1134 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1134..1135 "G" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1135..1137 "," [] [Whitespace(" ")], + TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1137..1140 "any" [] [], + }, + l_brack_token: L_BRACK@1140..1141 "[" [] [], + r_brack_token: R_BRACK@1141..1142 "]" [] [], + }, + ], + r_angle_token: R_ANGLE@1142..1144 ">" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@1144..1146 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1146..1151 "never" [] [], + }, + }, + COMMA@1151..1153 "," [] [Whitespace(" ")], + TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@1153..1158 "Tools" [] [], + }, + dot_token: DOT@1158..1159 "." [] [], + right: JsName { + value_token: IDENT@1159..1163 "Next" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1163..1164 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1164..1165 "I" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1165..1166 ">" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@1166..1167 ">" [] [], + }, + }, + }, + separator_token: SEMICOLON@1167..1168 ";" [] [], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: JS_NUMBER_LITERAL@1168..1174 "1" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1174..1176 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@1176..1181 "Tools" [] [], + }, + dot_token: DOT@1181..1182 "." [] [], + right: JsName { + value_token: IDENT@1182..1188 "Concat" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1188..1189 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1189..1191 "TN" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1191..1193 "," [] [Whitespace(" ")], + TsConditionalType { + check_type: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@1193..1198 "Tools" [] [], + }, + dot_token: DOT@1198..1199 "." [] [], + right: JsName { + value_token: IDENT@1199..1203 "Drop" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1203..1204 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@1204..1209 "Tools" [] [], + }, + dot_token: DOT@1209..1210 "." [] [], + right: JsName { + value_token: IDENT@1210..1213 "Pos" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1213..1214 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1214..1215 "I" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1215..1216 ">" [] [], + }, + }, + COMMA@1216..1218 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1218..1220 "T2" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1220..1222 ">" [] [Whitespace(" ")], + }, + }, + extends_token: EXTENDS_KW@1222..1230 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@1230..1236 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1236..1238 "D" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@1238..1240 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@1240..1245 "Tools" [] [], + }, + dot_token: DOT@1245..1246 "." [] [], + right: JsName { + value_token: IDENT@1246..1250 "Cast" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1250..1251 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1251..1252 "D" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1252..1254 "," [] [Whitespace(" ")], + TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1254..1257 "any" [] [], + }, + l_brack_token: L_BRACK@1257..1258 "[" [] [], + r_brack_token: R_BRACK@1258..1259 "]" [] [], + }, + ], + r_angle_token: R_ANGLE@1259..1261 ">" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@1261..1263 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1263..1268 "never" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@1268..1269 ">" [] [], + }, + }, + }, + separator_token: SEMICOLON@1269..1270 ";" [] [], + }, + ], + r_curly_token: R_CURLY@1270..1272 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@1272..1273 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..1273 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..1272 + 0: TS_TYPE_ALIAS_DECLARATION@0..16 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_NUMBER_TYPE@9..15 + 0: NUMBER_KW@9..15 "number" [] [] + 5: SEMICOLON@15..16 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@16..66 + 0: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@22..24 + 0: IDENT@22..24 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@24..26 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@26..65 + 0: TS_STRING_TYPE@26..33 + 0: STRING_KW@26..33 "string" [] [Whitespace(" ")] + 1: EXTENDS_KW@33..41 "extends" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@41..48 + 0: NUMBER_KW@41..48 "number" [] [Whitespace(" ")] + 3: QUESTION@48..50 "?" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@50..57 + 0: STRING_KW@50..57 "string" [] [Whitespace(" ")] + 5: COLON@57..59 ":" [] [Whitespace(" ")] + 6: TS_NUMBER_TYPE@59..65 + 0: NUMBER_KW@59..65 "number" [] [] + 5: SEMICOLON@65..66 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@66..134 + 0: TYPE_KW@66..72 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@72..74 + 0: IDENT@72..74 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@74..76 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@76..133 + 0: TS_REFERENCE_TYPE@76..78 + 0: JS_REFERENCE_IDENTIFIER@76..78 + 0: IDENT@76..78 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@86..118 + 0: L_PAREN@86..87 "(" [] [] + 1: TS_CONDITIONAL_TYPE@87..116 + 0: TS_REFERENCE_TYPE@87..89 + 0: JS_REFERENCE_IDENTIFIER@87..89 + 0: IDENT@87..89 "B" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@89..97 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@97..99 + 0: JS_REFERENCE_IDENTIFIER@97..99 + 0: IDENT@97..99 "A" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@99..101 "?" [] [Whitespace(" ")] + 4: TS_NUMBER_TYPE@101..108 + 0: NUMBER_KW@101..108 "number" [] [Whitespace(" ")] + 5: COLON@108..110 ":" [] [Whitespace(" ")] + 6: TS_STRING_TYPE@110..116 + 0: STRING_KW@110..116 "string" [] [] + 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] + 3: QUESTION@118..120 "?" [] [Whitespace(" ")] + 4: TS_VOID_TYPE@120..125 + 0: VOID_KW@120..125 "void" [] [Whitespace(" ")] + 5: COLON@125..127 ":" [] [Whitespace(" ")] + 6: TS_NUMBER_TYPE@127..133 + 0: NUMBER_KW@127..133 "number" [] [] + 5: SEMICOLON@133..134 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@134..208 + 0: TYPE_KW@134..140 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@140..141 + 0: IDENT@140..141 "D" [] [] + 2: TS_TYPE_PARAMETERS@141..145 + 0: L_ANGLE@141..142 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@142..143 + 0: TS_TYPE_PARAMETER@142..143 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@142..142 + 1: TS_TYPE_PARAMETER_NAME@142..143 + 0: IDENT@142..143 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@143..145 ">" [] [Whitespace(" ")] + 3: EQ@145..147 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@147..207 + 0: TS_REFERENCE_TYPE@147..149 + 0: JS_REFERENCE_IDENTIFIER@147..149 + 0: IDENT@147..149 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@149..157 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@157..196 + 0: L_BRACK@157..158 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@158..194 + 0: TS_INFER_TYPE@158..180 + 0: INFER_KW@158..164 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@164..166 + 0: IDENT@164..166 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@166..180 + 0: EXTENDS_KW@166..174 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@174..180 + 0: STRING_KW@174..180 "string" [] [] + 1: COMMA@180..182 "," [] [Whitespace(" ")] + 2: TS_REST_TUPLE_TYPE_ELEMENT@182..194 + 0: DOT3@182..185 "..." [] [] + 1: TS_ARRAY_TYPE@185..194 + 0: TS_UNKNOWN_TYPE@185..192 + 0: UNKNOWN_KW@185..192 "unknown" [] [] + 1: L_BRACK@192..193 "[" [] [] + 2: R_BRACK@193..194 "]" [] [] + 2: R_BRACK@194..196 "]" [] [Whitespace(" ")] + 3: QUESTION@196..198 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@198..200 + 0: JS_REFERENCE_IDENTIFIER@198..200 + 0: IDENT@198..200 "S" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@200..202 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@202..207 + 0: NEVER_KW@202..207 "never" [] [] + 5: SEMICOLON@207..208 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@208..275 + 0: TYPE_KW@208..214 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@214..215 + 0: IDENT@214..215 "E" [] [] + 2: TS_TYPE_PARAMETERS@215..222 + 0: L_ANGLE@215..216 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@216..220 + 0: TS_TYPE_PARAMETER@216..217 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@216..216 + 1: TS_TYPE_PARAMETER_NAME@216..217 + 0: IDENT@216..217 "U" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@217..219 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@219..220 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@219..219 + 1: TS_TYPE_PARAMETER_NAME@219..220 + 0: IDENT@219..220 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@220..222 ">" [] [Whitespace(" ")] + 3: EQ@222..224 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@224..275 + 0: TS_REFERENCE_TYPE@224..226 + 0: JS_REFERENCE_IDENTIFIER@224..226 + 0: IDENT@224..226 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@226..234 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@234..268 + 0: L_PAREN@234..235 "(" [] [] + 1: TS_CONDITIONAL_TYPE@235..266 + 0: TS_INFER_TYPE@235..243 + 0: INFER_KW@235..241 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@241..243 + 0: IDENT@241..243 "U" [] [Whitespace(" ")] + 2: (empty) + 1: EXTENDS_KW@243..251 "extends" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@251..258 + 0: NUMBER_KW@251..258 "number" [] [Whitespace(" ")] + 3: QUESTION@258..260 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@260..262 + 0: JS_REFERENCE_IDENTIFIER@260..262 + 0: IDENT@260..262 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@262..264 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@264..266 + 0: JS_REFERENCE_IDENTIFIER@264..266 + 0: IDENT@264..266 "T" [] [Whitespace(" ")] + 1: (empty) + 2: R_PAREN@266..268 ")" [] [Whitespace(" ")] + 3: QUESTION@268..270 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@270..272 + 0: JS_REFERENCE_IDENTIFIER@270..272 + 0: IDENT@270..272 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@272..274 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@274..275 + 0: JS_REFERENCE_IDENTIFIER@274..275 + 0: IDENT@274..275 "T" [] [] + 1: (empty) + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@275..353 + 0: TYPE_KW@275..281 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@281..282 + 0: IDENT@281..282 "F" [] [] + 2: TS_TYPE_PARAMETERS@282..286 + 0: L_ANGLE@282..283 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@283..284 + 0: TS_TYPE_PARAMETER@283..284 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@283..283 + 1: TS_TYPE_PARAMETER_NAME@283..284 + 0: IDENT@283..284 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@284..286 ">" [] [Whitespace(" ")] + 3: EQ@286..288 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@288..352 + 0: TS_REFERENCE_TYPE@288..290 + 0: JS_REFERENCE_IDENTIFIER@288..290 + 0: IDENT@288..290 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@290..298 "extends" [] [Whitespace(" ")] + 2: TS_MAPPED_TYPE@298..345 + 0: L_CURLY@298..300 "{" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@300..301 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@301..303 + 0: IDENT@301..303 "P" [] [Whitespace(" ")] + 4: IN_KW@303..306 "in" [] [Whitespace(" ")] + 5: TS_CONDITIONAL_TYPE@306..337 + 0: TS_INFER_TYPE@306..314 + 0: INFER_KW@306..312 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@312..314 + 0: IDENT@312..314 "U" [] [Whitespace(" ")] + 2: (empty) + 1: EXTENDS_KW@314..322 "extends" [] [Whitespace(" ")] + 2: TS_TYPE_OPERATOR_TYPE@322..330 + 0: KEYOF_KW@322..328 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@328..330 + 0: JS_REFERENCE_IDENTIFIER@328..330 + 0: IDENT@328..330 "T" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@330..332 "?" [] [Whitespace(" ")] + 4: TS_NUMBER_LITERAL_TYPE@332..334 + 0: (empty) + 1: JS_NUMBER_LITERAL@332..334 "1" [] [Whitespace(" ")] + 5: COLON@334..336 ":" [] [Whitespace(" ")] + 6: TS_NUMBER_LITERAL_TYPE@336..337 + 0: (empty) + 1: JS_NUMBER_LITERAL@336..337 "0" [] [] + 6: (empty) + 7: R_BRACK@337..338 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@338..341 + 0: COLON@338..340 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_LITERAL_TYPE@340..341 + 0: (empty) + 1: JS_NUMBER_LITERAL@340..341 "1" [] [] + 10: SEMICOLON@341..343 ";" [] [Whitespace(" ")] + 11: R_CURLY@343..345 "}" [] [Whitespace(" ")] + 3: QUESTION@345..347 "?" [] [Whitespace(" ")] + 4: TS_NUMBER_LITERAL_TYPE@347..349 + 0: (empty) + 1: JS_NUMBER_LITERAL@347..349 "1" [] [Whitespace(" ")] + 5: COLON@349..351 ":" [] [Whitespace(" ")] + 6: TS_NUMBER_LITERAL_TYPE@351..352 + 0: (empty) + 1: JS_NUMBER_LITERAL@351..352 "0" [] [] + 5: SEMICOLON@352..353 ";" [] [] + 6: TS_TYPE_ALIAS_DECLARATION@353..422 + 0: TYPE_KW@353..359 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@359..360 + 0: IDENT@359..360 "G" [] [] + 2: TS_TYPE_PARAMETERS@360..364 + 0: L_ANGLE@360..361 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@361..362 + 0: TS_TYPE_PARAMETER@361..362 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@361..361 + 1: TS_TYPE_PARAMETER_NAME@361..362 + 0: IDENT@361..362 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@362..364 ">" [] [Whitespace(" ")] + 3: EQ@364..366 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@366..421 + 0: TS_REFERENCE_TYPE@366..368 + 0: JS_REFERENCE_IDENTIFIER@366..368 + 0: IDENT@366..368 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@376..410 + 0: L_BRACK@376..377 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@377..408 + 0: TS_UNKNOWN_TYPE@377..384 + 0: UNKNOWN_KW@377..384 "unknown" [] [] + 1: COMMA@384..386 "," [] [Whitespace(" ")] + 2: TS_INFER_TYPE@386..408 + 0: INFER_KW@386..392 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@392..394 + 0: IDENT@392..394 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@394..408 + 0: EXTENDS_KW@394..402 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@402..408 + 0: STRING_KW@402..408 "string" [] [] + 2: R_BRACK@408..410 "]" [] [Whitespace(" ")] + 3: QUESTION@410..412 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@412..414 + 0: JS_REFERENCE_IDENTIFIER@412..414 + 0: IDENT@412..414 "S" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@414..416 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@416..421 + 0: NEVER_KW@416..421 "never" [] [] + 5: SEMICOLON@421..422 ";" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@422..476 + 0: TYPE_KW@422..428 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@428..430 + 0: IDENT@428..430 "H" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@430..432 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@432..475 + 0: TS_REFERENCE_TYPE@432..434 + 0: JS_REFERENCE_IDENTIFIER@432..434 + 0: IDENT@432..434 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@434..442 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@442..468 + 0: (empty) + 1: JS_PARAMETERS@442..445 + 0: L_PAREN@442..443 "(" [] [] + 1: JS_PARAMETER_LIST@443..443 + 2: R_PAREN@443..445 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@445..448 "=>" [] [Whitespace(" ")] + 3: TS_CONDITIONAL_TYPE@448..468 + 0: TS_REFERENCE_TYPE@448..450 + 0: JS_REFERENCE_IDENTIFIER@448..450 + 0: IDENT@448..450 "B" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@450..458 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@458..460 + 0: JS_REFERENCE_IDENTIFIER@458..460 + 0: IDENT@458..460 "C" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@460..462 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@462..464 + 0: JS_REFERENCE_IDENTIFIER@462..464 + 0: IDENT@462..464 "D" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@464..466 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@466..468 + 0: JS_REFERENCE_IDENTIFIER@466..468 + 0: IDENT@466..468 "E" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@468..470 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@470..472 + 0: JS_REFERENCE_IDENTIFIER@470..472 + 0: IDENT@470..472 "F" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@472..474 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@474..475 + 0: JS_REFERENCE_IDENTIFIER@474..475 + 0: IDENT@474..475 "G" [] [] + 1: (empty) + 5: SEMICOLON@475..476 ";" [] [] + 8: TS_TYPE_ALIAS_DECLARATION@476..553 + 0: TYPE_KW@476..482 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@482..483 + 0: IDENT@482..483 "J" [] [] + 2: TS_TYPE_PARAMETERS@483..487 + 0: L_ANGLE@483..484 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@484..485 + 0: TS_TYPE_PARAMETER@484..485 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@484..484 + 1: TS_TYPE_PARAMETER_NAME@484..485 + 0: IDENT@484..485 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@485..487 ">" [] [Whitespace(" ")] + 3: EQ@487..489 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@489..552 + 0: TS_REFERENCE_TYPE@489..491 + 0: JS_REFERENCE_IDENTIFIER@489..491 + 0: IDENT@489..491 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@491..499 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@499..541 + 0: L_PAREN@499..500 "(" [] [] + 1: TS_FUNCTION_TYPE@500..539 + 0: (empty) + 1: JS_PARAMETERS@500..514 + 0: L_PAREN@500..501 "(" [] [] + 1: JS_PARAMETER_LIST@501..512 + 0: JS_REST_PARAMETER@501..512 + 0: JS_DECORATOR_LIST@501..501 + 1: DOT3@501..504 "..." [] [] + 2: JS_IDENTIFIER_BINDING@504..505 + 0: IDENT@504..505 "a" [] [] + 3: TS_TYPE_ANNOTATION@505..512 + 0: COLON@505..507 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@507..512 + 0: TS_ANY_TYPE@507..510 + 0: ANY_KW@507..510 "any" [] [] + 1: L_BRACK@510..511 "[" [] [] + 2: R_BRACK@511..512 "]" [] [] + 2: R_PAREN@512..514 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@514..517 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@517..539 + 0: INFER_KW@517..523 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@523..525 + 0: IDENT@523..525 "R" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@525..539 + 0: EXTENDS_KW@525..533 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@533..539 + 0: STRING_KW@533..539 "string" [] [] + 2: R_PAREN@539..541 ")" [] [Whitespace(" ")] + 3: QUESTION@541..543 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@543..545 + 0: JS_REFERENCE_IDENTIFIER@543..545 + 0: IDENT@543..545 "R" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@545..547 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@547..552 + 0: NEVER_KW@547..552 "never" [] [] + 5: SEMICOLON@552..553 ";" [] [] + 9: TS_TYPE_ALIAS_DECLARATION@553..616 + 0: TYPE_KW@553..559 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@559..566 + 0: IDENT@559..566 "Equals" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@566..568 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@568..615 + 0: TS_REFERENCE_TYPE@568..570 + 0: JS_REFERENCE_IDENTIFIER@568..570 + 0: IDENT@568..570 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@570..578 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@578..608 + 0: (empty) + 1: JS_PARAMETERS@578..603 + 0: L_PAREN@578..579 "(" [] [] + 1: JS_PARAMETER_LIST@579..601 + 0: JS_FORMAL_PARAMETER@579..601 + 0: JS_DECORATOR_LIST@579..579 + 1: JS_IDENTIFIER_BINDING@579..580 + 0: IDENT@579..580 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@580..601 + 0: COLON@580..582 ":" [] [Whitespace(" ")] + 1: TS_CONDITIONAL_TYPE@582..601 + 0: TS_REFERENCE_TYPE@582..584 + 0: JS_REFERENCE_IDENTIFIER@582..584 + 0: IDENT@582..584 "B" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@584..592 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@592..594 + 0: JS_REFERENCE_IDENTIFIER@592..594 + 0: IDENT@592..594 "C" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@594..596 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@596..598 + 0: JS_REFERENCE_IDENTIFIER@596..598 + 0: IDENT@596..598 "D" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@598..600 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@600..601 + 0: JS_REFERENCE_IDENTIFIER@600..601 + 0: IDENT@600..601 "E" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@601..603 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@603..606 "=>" [] [Whitespace(" ")] + 3: TS_NUMBER_LITERAL_TYPE@606..608 + 0: (empty) + 1: JS_NUMBER_LITERAL@606..608 "0" [] [Whitespace(" ")] + 3: QUESTION@608..610 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@610..612 + 0: JS_REFERENCE_IDENTIFIER@610..612 + 0: IDENT@610..612 "F" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@612..614 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@614..615 + 0: JS_REFERENCE_IDENTIFIER@614..615 + 0: IDENT@614..615 "G" [] [] + 1: (empty) + 5: SEMICOLON@615..616 ";" [] [] + 10: TS_TYPE_ALIAS_DECLARATION@616..955 + 0: TYPE_KW@616..622 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@622..627 + 0: IDENT@622..627 "Curry" [] [] + 2: TS_TYPE_PARAMETERS@627..663 + 0: L_ANGLE@627..628 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@628..661 + 0: TS_TYPE_PARAMETER@628..661 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@628..628 + 1: TS_TYPE_PARAMETER_NAME@628..630 + 0: IDENT@628..630 "F" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@630..661 + 0: EXTENDS_KW@630..638 "extends" [] [Whitespace(" ")] + 1: TS_PARENTHESIZED_TYPE@638..661 + 0: L_PAREN@638..639 "(" [] [] + 1: TS_FUNCTION_TYPE@639..660 + 0: (empty) + 1: JS_PARAMETERS@639..654 + 0: L_PAREN@639..640 "(" [] [] + 1: JS_PARAMETER_LIST@640..652 + 0: JS_REST_PARAMETER@640..652 + 0: JS_DECORATOR_LIST@640..640 + 1: DOT3@640..643 "..." [] [] + 2: JS_IDENTIFIER_BINDING@643..647 + 0: IDENT@643..647 "args" [] [] + 3: TS_TYPE_ANNOTATION@647..652 + 0: COLON@647..649 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@649..652 + 0: ANY_KW@649..652 "any" [] [] + 2: R_PAREN@652..654 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@654..657 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@657..660 + 0: ANY_KW@657..660 "any" [] [] + 2: R_PAREN@660..661 ")" [] [] + 3: (empty) + 2: R_ANGLE@661..663 ">" [] [Whitespace(" ")] + 3: EQ@663..664 "=" [] [] + 4: TS_FUNCTION_TYPE@664..954 + 0: TS_TYPE_PARAMETERS@664..686 + 0: L_ANGLE@664..670 "<" [Newline("\n"), Whitespace(" ")] [] + 1: TS_TYPE_PARAMETER_LIST@670..685 + 0: TS_TYPE_PARAMETER@670..685 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@670..670 + 1: TS_TYPE_PARAMETER_NAME@670..672 + 0: IDENT@670..672 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@672..685 + 0: EXTENDS_KW@672..680 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@680..685 + 0: TS_ANY_TYPE@680..683 + 0: ANY_KW@680..683 "any" [] [] + 1: L_BRACK@683..684 "[" [] [] + 2: R_BRACK@684..685 "]" [] [] + 3: (empty) + 2: R_ANGLE@685..686 ">" [] [] + 1: JS_PARAMETERS@686..751 + 0: L_PAREN@686..687 "(" [] [] + 1: JS_PARAMETER_LIST@687..749 + 0: JS_REST_PARAMETER@687..749 + 0: JS_DECORATOR_LIST@687..687 + 1: DOT3@687..690 "..." [] [] + 2: JS_IDENTIFIER_BINDING@690..694 + 0: IDENT@690..694 "args" [] [] + 3: TS_TYPE_ANNOTATION@694..749 + 0: COLON@694..696 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@696..749 + 0: TS_QUALIFIED_NAME@696..706 + 0: JS_REFERENCE_IDENTIFIER@696..701 + 0: IDENT@696..701 "Tools" [] [] + 1: DOT@701..702 "." [] [] + 2: JS_NAME@702..706 + 0: IDENT@702..706 "Cast" [] [] + 1: TS_TYPE_ARGUMENTS@706..749 + 0: L_ANGLE@706..707 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@707..748 + 0: TS_REFERENCE_TYPE@707..741 + 0: TS_QUALIFIED_NAME@707..717 + 0: JS_REFERENCE_IDENTIFIER@707..712 + 0: IDENT@707..712 "Tools" [] [] + 1: DOT@712..713 "." [] [] + 2: JS_NAME@713..717 + 0: IDENT@713..717 "Cast" [] [] + 1: TS_TYPE_ARGUMENTS@717..741 + 0: L_ANGLE@717..718 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@718..740 + 0: TS_REFERENCE_TYPE@718..719 + 0: JS_REFERENCE_IDENTIFIER@718..719 + 0: IDENT@718..719 "T" [] [] + 1: (empty) + 1: COMMA@719..721 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@721..740 + 0: JS_REFERENCE_IDENTIFIER@721..725 + 0: IDENT@721..725 "Gaps" [] [] + 1: TS_TYPE_ARGUMENTS@725..740 + 0: L_ANGLE@725..726 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@726..739 + 0: TS_REFERENCE_TYPE@726..739 + 0: JS_REFERENCE_IDENTIFIER@726..736 + 0: IDENT@726..736 "Parameters" [] [] + 1: TS_TYPE_ARGUMENTS@736..739 + 0: L_ANGLE@736..737 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@737..738 + 0: TS_REFERENCE_TYPE@737..738 + 0: JS_REFERENCE_IDENTIFIER@737..738 + 0: IDENT@737..738 "F" [] [] + 1: (empty) + 2: R_ANGLE@738..739 ">" [] [] + 2: R_ANGLE@739..740 ">" [] [] + 2: R_ANGLE@740..741 ">" [] [] + 1: COMMA@741..743 "," [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@743..748 + 0: TS_ANY_TYPE@743..746 + 0: ANY_KW@743..746 "any" [] [] + 1: L_BRACK@746..747 "[" [] [] + 2: R_BRACK@747..748 "]" [] [] + 2: R_ANGLE@748..749 ">" [] [] + 2: R_PAREN@749..751 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@751..753 "=>" [] [] + 3: TS_CONDITIONAL_TYPE@753..954 + 0: TS_REFERENCE_TYPE@753..788 + 0: JS_REFERENCE_IDENTIFIER@753..769 + 0: IDENT@753..769 "GapsOf" [Newline("\n"), Whitespace(" ")] [] + 1: TS_TYPE_ARGUMENTS@769..788 + 0: L_ANGLE@769..770 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@770..786 + 0: TS_REFERENCE_TYPE@770..771 + 0: JS_REFERENCE_IDENTIFIER@770..771 + 0: IDENT@770..771 "T" [] [] + 1: (empty) + 1: COMMA@771..773 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@773..786 + 0: JS_REFERENCE_IDENTIFIER@773..783 + 0: IDENT@773..783 "Parameters" [] [] + 1: TS_TYPE_ARGUMENTS@783..786 + 0: L_ANGLE@783..784 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@784..785 + 0: TS_REFERENCE_TYPE@784..785 + 0: JS_REFERENCE_IDENTIFIER@784..785 + 0: IDENT@784..785 "F" [] [] + 1: (empty) + 2: R_ANGLE@785..786 ">" [] [] + 2: R_ANGLE@786..788 ">" [] [Whitespace(" ")] + 1: EXTENDS_KW@788..796 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@796..811 + 0: L_BRACK@796..797 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@797..810 + 0: TS_ANY_TYPE@797..800 + 0: ANY_KW@797..800 "any" [] [] + 1: COMMA@800..802 "," [] [Whitespace(" ")] + 2: TS_REST_TUPLE_TYPE_ELEMENT@802..810 + 0: DOT3@802..805 "..." [] [] + 1: TS_ARRAY_TYPE@805..810 + 0: TS_ANY_TYPE@805..808 + 0: ANY_KW@805..808 "any" [] [] + 1: L_BRACK@808..809 "[" [] [] + 2: R_BRACK@809..810 "]" [] [] + 2: R_BRACK@810..811 "]" [] [] + 3: QUESTION@811..823 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@823..929 + 0: JS_REFERENCE_IDENTIFIER@823..828 + 0: IDENT@823..828 "Curry" [] [] + 1: TS_TYPE_ARGUMENTS@828..929 + 0: L_ANGLE@828..829 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@829..928 + 0: TS_FUNCTION_TYPE@829..928 + 0: (empty) + 1: JS_PARAMETERS@829..912 + 0: L_PAREN@829..830 "(" [] [] + 1: JS_PARAMETER_LIST@830..910 + 0: JS_REST_PARAMETER@830..910 + 0: JS_DECORATOR_LIST@830..830 + 1: DOT3@830..833 "..." [] [] + 2: JS_IDENTIFIER_BINDING@833..837 + 0: IDENT@833..837 "args" [] [] + 3: TS_TYPE_ANNOTATION@837..910 + 0: COLON@837..839 ":" [] [Whitespace(" ")] + 1: TS_CONDITIONAL_TYPE@839..910 + 0: TS_REFERENCE_TYPE@839..864 + 0: JS_REFERENCE_IDENTIFIER@839..845 + 0: IDENT@839..845 "GapsOf" [] [] + 1: TS_TYPE_ARGUMENTS@845..864 + 0: L_ANGLE@845..846 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@846..862 + 0: TS_REFERENCE_TYPE@846..847 + 0: JS_REFERENCE_IDENTIFIER@846..847 + 0: IDENT@846..847 "T" [] [] + 1: (empty) + 1: COMMA@847..849 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@849..862 + 0: JS_REFERENCE_IDENTIFIER@849..859 + 0: IDENT@849..859 "Parameters" [] [] + 1: TS_TYPE_ARGUMENTS@859..862 + 0: L_ANGLE@859..860 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@860..861 + 0: TS_REFERENCE_TYPE@860..861 + 0: JS_REFERENCE_IDENTIFIER@860..861 + 0: IDENT@860..861 "F" [] [] + 1: (empty) + 2: R_ANGLE@861..862 ">" [] [] + 2: R_ANGLE@862..864 ">" [] [Whitespace(" ")] + 1: EXTENDS_KW@864..872 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@872..880 + 0: INFER_KW@872..878 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@878..880 + 0: IDENT@878..880 "G" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@880..882 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@882..903 + 0: TS_QUALIFIED_NAME@882..892 + 0: JS_REFERENCE_IDENTIFIER@882..887 + 0: IDENT@882..887 "Tools" [] [] + 1: DOT@887..888 "." [] [] + 2: JS_NAME@888..892 + 0: IDENT@888..892 "Cast" [] [] + 1: TS_TYPE_ARGUMENTS@892..903 + 0: L_ANGLE@892..893 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@893..901 + 0: TS_REFERENCE_TYPE@893..894 + 0: JS_REFERENCE_IDENTIFIER@893..894 + 0: IDENT@893..894 "G" [] [] + 1: (empty) + 1: COMMA@894..896 "," [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@896..901 + 0: TS_ANY_TYPE@896..899 + 0: ANY_KW@896..899 "any" [] [] + 1: L_BRACK@899..900 "[" [] [] + 2: R_BRACK@900..901 "]" [] [] + 2: R_ANGLE@901..903 ">" [] [Whitespace(" ")] + 5: COLON@903..905 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@905..910 + 0: NEVER_KW@905..910 "never" [] [] + 2: R_PAREN@910..912 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@912..915 "=>" [] [Whitespace(" ")] + 3: TS_REFERENCE_TYPE@915..928 + 0: JS_REFERENCE_IDENTIFIER@915..925 + 0: IDENT@915..925 "ReturnType" [] [] + 1: TS_TYPE_ARGUMENTS@925..928 + 0: L_ANGLE@925..926 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@926..927 + 0: TS_REFERENCE_TYPE@926..927 + 0: JS_REFERENCE_IDENTIFIER@926..927 + 0: IDENT@926..927 "F" [] [] + 1: (empty) + 2: R_ANGLE@927..928 ">" [] [] + 2: R_ANGLE@928..929 ">" [] [] + 5: COLON@929..941 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@941..954 + 0: JS_REFERENCE_IDENTIFIER@941..951 + 0: IDENT@941..951 "ReturnType" [] [] + 1: TS_TYPE_ARGUMENTS@951..954 + 0: L_ANGLE@951..952 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@952..953 + 0: TS_REFERENCE_TYPE@952..953 + 0: JS_REFERENCE_IDENTIFIER@952..953 + 0: IDENT@952..953 "F" [] [] + 1: (empty) + 2: R_ANGLE@953..954 ">" [] [] + 5: SEMICOLON@954..955 ";" [] [] + 11: TS_INTERFACE_DECLARATION@955..1272 + 0: INTERFACE_KW@955..966 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@966..978 + 0: IDENT@966..978 "GapsOfWorker" [] [] + 2: TS_TYPE_PARAMETERS@978..1060 + 0: L_ANGLE@978..979 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@979..1058 + 0: TS_TYPE_PARAMETER@979..995 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@979..979 + 1: TS_TYPE_PARAMETER_NAME@979..982 + 0: IDENT@979..982 "T1" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@982..995 + 0: EXTENDS_KW@982..990 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@990..995 + 0: TS_ANY_TYPE@990..993 + 0: ANY_KW@990..993 "any" [] [] + 1: L_BRACK@993..994 "[" [] [] + 2: R_BRACK@994..995 "]" [] [] + 3: (empty) + 1: COMMA@995..997 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@997..1013 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@997..997 + 1: TS_TYPE_PARAMETER_NAME@997..1000 + 0: IDENT@997..1000 "T2" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1000..1013 + 0: EXTENDS_KW@1000..1008 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@1008..1013 + 0: TS_ANY_TYPE@1008..1011 + 0: ANY_KW@1008..1011 "any" [] [] + 1: L_BRACK@1011..1012 "[" [] [] + 2: R_BRACK@1012..1013 "]" [] [] + 3: (empty) + 3: COMMA@1013..1015 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@1015..1036 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1015..1015 + 1: TS_TYPE_PARAMETER_NAME@1015..1018 + 0: IDENT@1015..1018 "TN" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1018..1032 + 0: EXTENDS_KW@1018..1026 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@1026..1032 + 0: TS_ANY_TYPE@1026..1029 + 0: ANY_KW@1026..1029 "any" [] [] + 1: L_BRACK@1029..1030 "[" [] [] + 2: R_BRACK@1030..1032 "]" [] [Whitespace(" ")] + 3: TS_DEFAULT_TYPE_CLAUSE@1032..1036 + 0: EQ@1032..1034 "=" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@1034..1036 + 0: L_BRACK@1034..1035 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1035..1035 + 2: R_BRACK@1035..1036 "]" [] [] + 5: COMMA@1036..1038 "," [] [Whitespace(" ")] + 6: TS_TYPE_PARAMETER@1038..1058 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1038..1038 + 1: TS_TYPE_PARAMETER_NAME@1038..1040 + 0: IDENT@1038..1040 "I" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1040..1054 + 0: EXTENDS_KW@1040..1048 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@1048..1054 + 0: TS_ANY_TYPE@1048..1051 + 0: ANY_KW@1048..1051 "any" [] [] + 1: L_BRACK@1051..1052 "[" [] [] + 2: R_BRACK@1052..1054 "]" [] [Whitespace(" ")] + 3: TS_DEFAULT_TYPE_CLAUSE@1054..1058 + 0: EQ@1054..1056 "=" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@1056..1058 + 0: L_BRACK@1056..1057 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1057..1057 + 2: R_BRACK@1057..1058 "]" [] [] + 2: R_ANGLE@1058..1060 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@1060..1061 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@1061..1270 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1061..1168 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1061..1067 + 0: JS_NUMBER_LITERAL@1061..1067 "0" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1067..1167 + 0: COLON@1067..1069 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@1069..1167 + 0: JS_REFERENCE_IDENTIFIER@1069..1075 + 0: IDENT@1069..1075 "GapsOf" [] [] + 1: TS_TYPE_ARGUMENTS@1075..1167 + 0: L_ANGLE@1075..1076 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1076..1166 + 0: TS_REFERENCE_TYPE@1076..1078 + 0: JS_REFERENCE_IDENTIFIER@1076..1078 + 0: IDENT@1076..1078 "T1" [] [] + 1: (empty) + 1: COMMA@1078..1080 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1080..1082 + 0: JS_REFERENCE_IDENTIFIER@1080..1082 + 0: IDENT@1080..1082 "T2" [] [] + 1: (empty) + 3: COMMA@1082..1084 "," [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1084..1151 + 0: TS_REFERENCE_TYPE@1084..1105 + 0: JS_REFERENCE_IDENTIFIER@1084..1089 + 0: IDENT@1084..1089 "GapOf" [] [] + 1: TS_TYPE_ARGUMENTS@1089..1105 + 0: L_ANGLE@1089..1090 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1090..1103 + 0: TS_REFERENCE_TYPE@1090..1092 + 0: JS_REFERENCE_IDENTIFIER@1090..1092 + 0: IDENT@1090..1092 "T1" [] [] + 1: (empty) + 1: COMMA@1092..1094 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1094..1096 + 0: JS_REFERENCE_IDENTIFIER@1094..1096 + 0: IDENT@1094..1096 "T2" [] [] + 1: (empty) + 3: COMMA@1096..1098 "," [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1098..1100 + 0: JS_REFERENCE_IDENTIFIER@1098..1100 + 0: IDENT@1098..1100 "TN" [] [] + 1: (empty) + 5: COMMA@1100..1102 "," [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@1102..1103 + 0: JS_REFERENCE_IDENTIFIER@1102..1103 + 0: IDENT@1102..1103 "I" [] [] + 1: (empty) + 2: R_ANGLE@1103..1105 ">" [] [Whitespace(" ")] + 1: EXTENDS_KW@1105..1113 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@1113..1121 + 0: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1119..1121 + 0: IDENT@1119..1121 "G" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@1121..1123 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1123..1144 + 0: TS_QUALIFIED_NAME@1123..1133 + 0: JS_REFERENCE_IDENTIFIER@1123..1128 + 0: IDENT@1123..1128 "Tools" [] [] + 1: DOT@1128..1129 "." [] [] + 2: JS_NAME@1129..1133 + 0: IDENT@1129..1133 "Cast" [] [] + 1: TS_TYPE_ARGUMENTS@1133..1144 + 0: L_ANGLE@1133..1134 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1134..1142 + 0: TS_REFERENCE_TYPE@1134..1135 + 0: JS_REFERENCE_IDENTIFIER@1134..1135 + 0: IDENT@1134..1135 "G" [] [] + 1: (empty) + 1: COMMA@1135..1137 "," [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@1137..1142 + 0: TS_ANY_TYPE@1137..1140 + 0: ANY_KW@1137..1140 "any" [] [] + 1: L_BRACK@1140..1141 "[" [] [] + 2: R_BRACK@1141..1142 "]" [] [] + 2: R_ANGLE@1142..1144 ">" [] [Whitespace(" ")] + 5: COLON@1144..1146 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1146..1151 + 0: NEVER_KW@1146..1151 "never" [] [] + 5: COMMA@1151..1153 "," [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@1153..1166 + 0: TS_QUALIFIED_NAME@1153..1163 + 0: JS_REFERENCE_IDENTIFIER@1153..1158 + 0: IDENT@1153..1158 "Tools" [] [] + 1: DOT@1158..1159 "." [] [] + 2: JS_NAME@1159..1163 + 0: IDENT@1159..1163 "Next" [] [] + 1: TS_TYPE_ARGUMENTS@1163..1166 + 0: L_ANGLE@1163..1164 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1164..1165 + 0: TS_REFERENCE_TYPE@1164..1165 + 0: JS_REFERENCE_IDENTIFIER@1164..1165 + 0: IDENT@1164..1165 "I" [] [] + 1: (empty) + 2: R_ANGLE@1165..1166 ">" [] [] + 2: R_ANGLE@1166..1167 ">" [] [] + 4: SEMICOLON@1167..1168 ";" [] [] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1168..1270 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1168..1174 + 0: JS_NUMBER_LITERAL@1168..1174 "1" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1174..1269 + 0: COLON@1174..1176 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@1176..1269 + 0: TS_QUALIFIED_NAME@1176..1188 + 0: JS_REFERENCE_IDENTIFIER@1176..1181 + 0: IDENT@1176..1181 "Tools" [] [] + 1: DOT@1181..1182 "." [] [] + 2: JS_NAME@1182..1188 + 0: IDENT@1182..1188 "Concat" [] [] + 1: TS_TYPE_ARGUMENTS@1188..1269 + 0: L_ANGLE@1188..1189 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1189..1268 + 0: TS_REFERENCE_TYPE@1189..1191 + 0: JS_REFERENCE_IDENTIFIER@1189..1191 + 0: IDENT@1189..1191 "TN" [] [] + 1: (empty) + 1: COMMA@1191..1193 "," [] [Whitespace(" ")] + 2: TS_CONDITIONAL_TYPE@1193..1268 + 0: TS_REFERENCE_TYPE@1193..1222 + 0: TS_QUALIFIED_NAME@1193..1203 + 0: JS_REFERENCE_IDENTIFIER@1193..1198 + 0: IDENT@1193..1198 "Tools" [] [] + 1: DOT@1198..1199 "." [] [] + 2: JS_NAME@1199..1203 + 0: IDENT@1199..1203 "Drop" [] [] + 1: TS_TYPE_ARGUMENTS@1203..1222 + 0: L_ANGLE@1203..1204 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1204..1220 + 0: TS_REFERENCE_TYPE@1204..1216 + 0: TS_QUALIFIED_NAME@1204..1213 + 0: JS_REFERENCE_IDENTIFIER@1204..1209 + 0: IDENT@1204..1209 "Tools" [] [] + 1: DOT@1209..1210 "." [] [] + 2: JS_NAME@1210..1213 + 0: IDENT@1210..1213 "Pos" [] [] + 1: TS_TYPE_ARGUMENTS@1213..1216 + 0: L_ANGLE@1213..1214 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1214..1215 + 0: TS_REFERENCE_TYPE@1214..1215 + 0: JS_REFERENCE_IDENTIFIER@1214..1215 + 0: IDENT@1214..1215 "I" [] [] + 1: (empty) + 2: R_ANGLE@1215..1216 ">" [] [] + 1: COMMA@1216..1218 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1218..1220 + 0: JS_REFERENCE_IDENTIFIER@1218..1220 + 0: IDENT@1218..1220 "T2" [] [] + 1: (empty) + 2: R_ANGLE@1220..1222 ">" [] [Whitespace(" ")] + 1: EXTENDS_KW@1222..1230 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@1230..1238 + 0: INFER_KW@1230..1236 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1236..1238 + 0: IDENT@1236..1238 "D" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@1238..1240 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1240..1261 + 0: TS_QUALIFIED_NAME@1240..1250 + 0: JS_REFERENCE_IDENTIFIER@1240..1245 + 0: IDENT@1240..1245 "Tools" [] [] + 1: DOT@1245..1246 "." [] [] + 2: JS_NAME@1246..1250 + 0: IDENT@1246..1250 "Cast" [] [] + 1: TS_TYPE_ARGUMENTS@1250..1261 + 0: L_ANGLE@1250..1251 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1251..1259 + 0: TS_REFERENCE_TYPE@1251..1252 + 0: JS_REFERENCE_IDENTIFIER@1251..1252 + 0: IDENT@1251..1252 "D" [] [] + 1: (empty) + 1: COMMA@1252..1254 "," [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@1254..1259 + 0: TS_ANY_TYPE@1254..1257 + 0: ANY_KW@1254..1257 "any" [] [] + 1: L_BRACK@1257..1258 "[" [] [] + 2: R_BRACK@1258..1259 "]" [] [] + 2: R_ANGLE@1259..1261 ">" [] [Whitespace(" ")] + 5: COLON@1261..1263 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1263..1268 + 0: NEVER_KW@1263..1268 "never" [] [] + 2: R_ANGLE@1268..1269 ">" [] [] + 4: SEMICOLON@1269..1270 ";" [] [] + 6: R_CURLY@1270..1272 "}" [Newline("\n")] [] + 4: EOF@1272..1273 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap new file mode 100644 index 000000000000..7ce03a3c706d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap @@ -0,0 +1,221 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type X = V extends (...args: any[]) => any ? (...args: Parameters) => void : Function; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..6 "X" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@6..7 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@7..8 "V" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@8..10 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@10..12 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@12..14 "V" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@23..26 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@26..30 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@30..32 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@32..35 "any" [] [], + }, + l_brack_token: L_BRACK@35..36 "[" [] [], + r_brack_token: R_BRACK@36..37 "]" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@39..42 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@42..46 "any" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@46..48 "?" [] [Whitespace(" ")], + true_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@48..49 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@49..52 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@52..56 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@56..58 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@58..68 "Parameters" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@68..69 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@69..70 "V" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@70..71 ">" [] [], + }, + }, + }, + }, + ], + r_paren_token: R_PAREN@71..73 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@73..76 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@76..81 "void" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@81..83 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@83..91 "Function" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@91..92 ";" [] [], + }, + ], + eof_token: EOF@92..93 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..93 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..92 + 0: TS_TYPE_ALIAS_DECLARATION@0..92 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..6 + 0: IDENT@5..6 "X" [] [] + 2: TS_TYPE_PARAMETERS@6..10 + 0: L_ANGLE@6..7 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@7..8 + 0: TS_TYPE_PARAMETER@7..8 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 + 1: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "V" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@8..10 ">" [] [Whitespace(" ")] + 3: EQ@10..12 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@12..91 + 0: TS_REFERENCE_TYPE@12..14 + 0: JS_REFERENCE_IDENTIFIER@12..14 + 0: IDENT@12..14 "V" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@22..46 + 0: (empty) + 1: JS_PARAMETERS@22..39 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..37 + 0: JS_REST_PARAMETER@23..37 + 0: JS_DECORATOR_LIST@23..23 + 1: DOT3@23..26 "..." [] [] + 2: JS_IDENTIFIER_BINDING@26..30 + 0: IDENT@26..30 "args" [] [] + 3: TS_TYPE_ANNOTATION@30..37 + 0: COLON@30..32 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@32..37 + 0: TS_ANY_TYPE@32..35 + 0: ANY_KW@32..35 "any" [] [] + 1: L_BRACK@35..36 "[" [] [] + 2: R_BRACK@36..37 "]" [] [] + 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@39..42 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@42..46 + 0: ANY_KW@42..46 "any" [] [Whitespace(" ")] + 3: QUESTION@46..48 "?" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@48..81 + 0: (empty) + 1: JS_PARAMETERS@48..73 + 0: L_PAREN@48..49 "(" [] [] + 1: JS_PARAMETER_LIST@49..71 + 0: JS_REST_PARAMETER@49..71 + 0: JS_DECORATOR_LIST@49..49 + 1: DOT3@49..52 "..." [] [] + 2: JS_IDENTIFIER_BINDING@52..56 + 0: IDENT@52..56 "args" [] [] + 3: TS_TYPE_ANNOTATION@56..71 + 0: COLON@56..58 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@58..71 + 0: JS_REFERENCE_IDENTIFIER@58..68 + 0: IDENT@58..68 "Parameters" [] [] + 1: TS_TYPE_ARGUMENTS@68..71 + 0: L_ANGLE@68..69 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@69..70 + 0: TS_REFERENCE_TYPE@69..70 + 0: JS_REFERENCE_IDENTIFIER@69..70 + 0: IDENT@69..70 "V" [] [] + 1: (empty) + 2: R_ANGLE@70..71 ">" [] [] + 2: R_PAREN@71..73 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@73..76 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@76..81 + 0: VOID_KW@76..81 "void" [] [Whitespace(" ")] + 5: COLON@81..83 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@83..91 + 0: JS_REFERENCE_IDENTIFIER@83..91 + 0: IDENT@83..91 "Function" [] [] + 1: (empty) + 5: SEMICOLON@91..92 ";" [] [] + 4: EOF@92..93 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts.snap new file mode 100644 index 000000000000..7ae06f83f432 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts.snap @@ -0,0 +1,486 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { new (): string; } +type B = { new (a: string, b: number) } +type C = { new (a: A, b: B): string } +type D = { new (a: T, b: B): string } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@11..15 "new" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@15..16 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@16..17 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@17..19 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@19..25 "string" [] [], + }, + }, + separator_token: SEMICOLON@25..27 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@34..36 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@40..44 "new" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@45..46 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@46..48 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@48..54 "string" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@54..56 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@56..57 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@57..59 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@59..65 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@65..67 ")" [] [Whitespace(" ")], + }, + type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@68..74 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@74..76 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@80..84 "new" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@84..85 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@85..86 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@86..88 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@88..89 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@89..90 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@90..91 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@91..92 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@92..94 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@94..95 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@95..97 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@97..98 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@98..100 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@100..101 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@101..102 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@102..104 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@104..111 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@111..112 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@112..118 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@118..120 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@120..122 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@122..124 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsConstructSignatureTypeMember { + new_token: NEW_KW@124..128 "new" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@128..129 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@129..135 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@135..136 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@136..137 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@137..138 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@138..139 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@139..141 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@141..142 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@142..144 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@144..145 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@145..147 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@147..148 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@148..149 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@149..151 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@151..158 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@158..159 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@159..160 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..160 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..159 + 0: TS_TYPE_ALIAS_DECLARATION@0..28 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..28 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..27 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@11..27 + 0: NEW_KW@11..15 "new" [] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@15..17 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_PARAMETER_LIST@16..16 + 2: R_PAREN@16..17 ")" [] [] + 3: TS_TYPE_ANNOTATION@17..25 + 0: COLON@17..19 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@19..25 + 0: STRING_KW@19..25 "string" [] [] + 4: SEMICOLON@25..27 ";" [] [Whitespace(" ")] + 2: R_CURLY@27..28 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@28..68 + 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@36..38 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@38..68 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@40..67 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@40..67 + 0: NEW_KW@40..44 "new" [] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@44..67 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..65 + 0: JS_FORMAL_PARAMETER@45..54 + 0: JS_DECORATOR_LIST@45..45 + 1: JS_IDENTIFIER_BINDING@45..46 + 0: IDENT@45..46 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@46..54 + 0: COLON@46..48 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@48..54 + 0: STRING_KW@48..54 "string" [] [] + 4: (empty) + 1: COMMA@54..56 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@56..65 + 0: JS_DECORATOR_LIST@56..56 + 1: JS_IDENTIFIER_BINDING@56..57 + 0: IDENT@56..57 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@57..65 + 0: COLON@57..59 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@59..65 + 0: NUMBER_KW@59..65 "number" [] [] + 4: (empty) + 2: R_PAREN@65..67 ")" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 2: R_CURLY@67..68 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@68..112 + 0: TYPE_KW@68..74 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@74..76 + 0: IDENT@74..76 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@76..78 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@78..112 + 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@80..111 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@80..111 + 0: NEW_KW@80..84 "new" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETERS@84..90 + 0: L_ANGLE@84..85 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@85..89 + 0: TS_TYPE_PARAMETER@85..86 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@85..85 + 1: TS_TYPE_PARAMETER_NAME@85..86 + 0: IDENT@85..86 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@86..88 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@88..89 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@88..88 + 1: TS_TYPE_PARAMETER_NAME@88..89 + 0: IDENT@88..89 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@89..90 ">" [] [] + 2: JS_PARAMETERS@90..102 + 0: L_PAREN@90..91 "(" [] [] + 1: JS_PARAMETER_LIST@91..101 + 0: JS_FORMAL_PARAMETER@91..95 + 0: JS_DECORATOR_LIST@91..91 + 1: JS_IDENTIFIER_BINDING@91..92 + 0: IDENT@91..92 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@92..95 + 0: COLON@92..94 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@94..95 + 0: JS_REFERENCE_IDENTIFIER@94..95 + 0: IDENT@94..95 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@95..97 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@97..101 + 0: JS_DECORATOR_LIST@97..97 + 1: JS_IDENTIFIER_BINDING@97..98 + 0: IDENT@97..98 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@98..101 + 0: COLON@98..100 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@100..101 + 0: JS_REFERENCE_IDENTIFIER@100..101 + 0: IDENT@100..101 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@101..102 ")" [] [] + 3: TS_TYPE_ANNOTATION@102..111 + 0: COLON@102..104 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@104..111 + 0: STRING_KW@104..111 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@111..112 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@112..159 + 0: TYPE_KW@112..118 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@118..120 + 0: IDENT@118..120 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@120..122 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@122..159 + 0: L_CURLY@122..124 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@124..158 + 0: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@124..158 + 0: NEW_KW@124..128 "new" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETERS@128..137 + 0: L_ANGLE@128..129 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@129..136 + 0: TS_TYPE_PARAMETER@129..136 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@129..135 + 0: TS_CONST_MODIFIER@129..135 + 0: CONST_KW@129..135 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@135..136 + 0: IDENT@135..136 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@136..137 ">" [] [] + 2: JS_PARAMETERS@137..149 + 0: L_PAREN@137..138 "(" [] [] + 1: JS_PARAMETER_LIST@138..148 + 0: JS_FORMAL_PARAMETER@138..142 + 0: JS_DECORATOR_LIST@138..138 + 1: JS_IDENTIFIER_BINDING@138..139 + 0: IDENT@138..139 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@139..142 + 0: COLON@139..141 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@141..142 + 0: JS_REFERENCE_IDENTIFIER@141..142 + 0: IDENT@141..142 "T" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@142..144 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@144..148 + 0: JS_DECORATOR_LIST@144..144 + 1: JS_IDENTIFIER_BINDING@144..145 + 0: IDENT@144..145 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@145..148 + 0: COLON@145..147 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@147..148 + 0: JS_REFERENCE_IDENTIFIER@147..148 + 0: IDENT@147..148 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@148..149 ")" [] [] + 3: TS_TYPE_ANNOTATION@149..158 + 0: COLON@149..151 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@151..158 + 0: STRING_KW@151..158 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@158..159 "}" [] [] + 5: (empty) + 4: EOF@159..160 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts.snap new file mode 100644 index 000000000000..f2865627f95c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts.snap @@ -0,0 +1,503 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = new(a: string, b: number) => string; +type B = abstract new(a: string, b: number) => string; +type C = new(a: A, b: B) => string; +type D = abstract new(a: A, b: B) => string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@9..12 "new" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@12..13 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@13..14 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@14..16 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@16..22 "string" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..25 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@27..33 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@38..44 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@51..53 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@53..55 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: ABSTRACT_KW@55..64 "abstract" [] [Whitespace(" ")], + new_token: NEW_KW@64..67 "new" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@67..68 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@68..69 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@71..77 "string" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@77..79 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@79..80 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@80..82 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@82..88 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@88..90 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@93..99 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@99..100 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@106..108 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@108..110 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@110..113 "new" [] [], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@113..114 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@114..115 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@115..117 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@117..118 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@118..119 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@119..120 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@120..121 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@121..123 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@123..124 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@124..126 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@126..127 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@127..129 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@129..130 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@130..132 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@132..135 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@135..141 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@141..142 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@142..148 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@148..150 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@150..152 "=" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: ABSTRACT_KW@152..161 "abstract" [] [Whitespace(" ")], + new_token: NEW_KW@161..164 "new" [] [], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@164..165 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@165..166 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@166..168 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@168..169 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@169..170 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@170..171 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@171..172 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@172..174 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@174..175 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@175..177 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@177..178 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@178..180 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@180..181 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@183..186 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@186..192 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@192..193 ";" [] [], + }, + ], + eof_token: EOF@193..194 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..194 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..193 + 0: TS_TYPE_ALIAS_DECLARATION@0..45 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@9..44 + 0: (empty) + 1: NEW_KW@9..12 "new" [] [] + 2: (empty) + 3: JS_PARAMETERS@12..35 + 0: L_PAREN@12..13 "(" [] [] + 1: JS_PARAMETER_LIST@13..33 + 0: JS_FORMAL_PARAMETER@13..22 + 0: JS_DECORATOR_LIST@13..13 + 1: JS_IDENTIFIER_BINDING@13..14 + 0: IDENT@13..14 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@14..22 + 0: COLON@14..16 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@16..22 + 0: STRING_KW@16..22 "string" [] [] + 4: (empty) + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@24..33 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@25..33 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@27..33 + 0: NUMBER_KW@27..33 "number" [] [] + 4: (empty) + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@35..38 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@38..44 + 0: STRING_KW@38..44 "string" [] [] + 5: SEMICOLON@44..45 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@45..100 + 0: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@51..53 + 0: IDENT@51..53 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@53..55 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@55..99 + 0: ABSTRACT_KW@55..64 "abstract" [] [Whitespace(" ")] + 1: NEW_KW@64..67 "new" [] [] + 2: (empty) + 3: JS_PARAMETERS@67..90 + 0: L_PAREN@67..68 "(" [] [] + 1: JS_PARAMETER_LIST@68..88 + 0: JS_FORMAL_PARAMETER@68..77 + 0: JS_DECORATOR_LIST@68..68 + 1: JS_IDENTIFIER_BINDING@68..69 + 0: IDENT@68..69 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@69..77 + 0: COLON@69..71 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@71..77 + 0: STRING_KW@71..77 "string" [] [] + 4: (empty) + 1: COMMA@77..79 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@79..88 + 0: JS_DECORATOR_LIST@79..79 + 1: JS_IDENTIFIER_BINDING@79..80 + 0: IDENT@79..80 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@80..88 + 0: COLON@80..82 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@82..88 + 0: NUMBER_KW@82..88 "number" [] [] + 4: (empty) + 2: R_PAREN@88..90 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@90..93 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@93..99 + 0: STRING_KW@93..99 "string" [] [] + 5: SEMICOLON@99..100 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@100..142 + 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@106..108 + 0: IDENT@106..108 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@108..110 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@110..141 + 0: (empty) + 1: NEW_KW@110..113 "new" [] [] + 2: TS_TYPE_PARAMETERS@113..119 + 0: L_ANGLE@113..114 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@114..118 + 0: TS_TYPE_PARAMETER@114..115 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@114..114 + 1: TS_TYPE_PARAMETER_NAME@114..115 + 0: IDENT@114..115 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@115..117 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@117..118 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@117..117 + 1: TS_TYPE_PARAMETER_NAME@117..118 + 0: IDENT@117..118 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@118..119 ">" [] [] + 3: JS_PARAMETERS@119..132 + 0: L_PAREN@119..120 "(" [] [] + 1: JS_PARAMETER_LIST@120..130 + 0: JS_FORMAL_PARAMETER@120..124 + 0: JS_DECORATOR_LIST@120..120 + 1: JS_IDENTIFIER_BINDING@120..121 + 0: IDENT@120..121 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@121..124 + 0: COLON@121..123 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@123..124 + 0: JS_REFERENCE_IDENTIFIER@123..124 + 0: IDENT@123..124 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@124..126 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@126..130 + 0: JS_DECORATOR_LIST@126..126 + 1: JS_IDENTIFIER_BINDING@126..127 + 0: IDENT@126..127 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@127..130 + 0: COLON@127..129 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@129..130 + 0: JS_REFERENCE_IDENTIFIER@129..130 + 0: IDENT@129..130 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@130..132 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@132..135 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@135..141 + 0: STRING_KW@135..141 "string" [] [] + 5: SEMICOLON@141..142 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@142..193 + 0: TYPE_KW@142..148 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@148..150 + 0: IDENT@148..150 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@150..152 "=" [] [Whitespace(" ")] + 4: TS_CONSTRUCTOR_TYPE@152..192 + 0: ABSTRACT_KW@152..161 "abstract" [] [Whitespace(" ")] + 1: NEW_KW@161..164 "new" [] [] + 2: TS_TYPE_PARAMETERS@164..170 + 0: L_ANGLE@164..165 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@165..169 + 0: TS_TYPE_PARAMETER@165..166 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@165..165 + 1: TS_TYPE_PARAMETER_NAME@165..166 + 0: IDENT@165..166 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@166..168 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@168..169 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@168..168 + 1: TS_TYPE_PARAMETER_NAME@168..169 + 0: IDENT@168..169 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@169..170 ">" [] [] + 3: JS_PARAMETERS@170..183 + 0: L_PAREN@170..171 "(" [] [] + 1: JS_PARAMETER_LIST@171..181 + 0: JS_FORMAL_PARAMETER@171..175 + 0: JS_DECORATOR_LIST@171..171 + 1: JS_IDENTIFIER_BINDING@171..172 + 0: IDENT@171..172 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@172..175 + 0: COLON@172..174 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@174..175 + 0: JS_REFERENCE_IDENTIFIER@174..175 + 0: IDENT@174..175 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@175..177 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@177..181 + 0: JS_DECORATOR_LIST@177..177 + 1: JS_IDENTIFIER_BINDING@177..178 + 0: IDENT@177..178 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@178..181 + 0: COLON@178..180 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@180..181 + 0: JS_REFERENCE_IDENTIFIER@180..181 + 0: IDENT@180..181 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@181..183 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@183..186 "=>" [] [Whitespace(" ")] + 5: TS_STRING_TYPE@186..192 + 0: STRING_KW@186..192 "string" [] [] + 5: SEMICOLON@192..193 ";" [] [] + 4: EOF@193..194 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap new file mode 100644 index 000000000000..d3df742e8b2e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap @@ -0,0 +1,88 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module test { const X; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@15..20 "test" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@20..22 "{" [] [Whitespace(" ")], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@22..28 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@28..29 "X" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@29..31 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@32..33 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..33 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..32 + 0: TS_DECLARE_STATEMENT@0..32 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..32 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@15..20 + 0: IDENT@15..20 "test" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@20..32 + 0: L_CURLY@20..22 "{" [] [Whitespace(" ")] + 1: JS_MODULE_ITEM_LIST@22..31 + 0: JS_VARIABLE_STATEMENT@22..31 + 0: JS_VARIABLE_DECLARATION@22..29 + 0: (empty) + 1: CONST_KW@22..28 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@28..29 + 0: JS_VARIABLE_DECLARATOR@28..29 + 0: JS_IDENTIFIER_BINDING@28..29 + 0: IDENT@28..29 "X" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@29..31 ";" [] [Whitespace(" ")] + 2: R_CURLY@31..32 "}" [] [] + 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts.snap new file mode 100644 index 000000000000..d27281789855 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts.snap @@ -0,0 +1,351 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare function test(a: A, b: B): R; +declare function test2({ a }?: { a: "string" }) +declare +function not_a_declaration() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@17..21 "test" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@21..22 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@22..23 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@25..26 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@26..28 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@28..29 "R" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@29..30 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@31..32 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@34..35 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@35..37 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@37..38 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@38..40 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@40..41 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@41..42 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@42..44 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "R" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@46..55 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@55..64 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@64..69 "test2" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@69..70 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@70..72 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@72..74 "a" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@74..75 "}" [] [], + }, + question_mark_token: QUESTION@75..76 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@76..78 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@80..81 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@81..83 ":" [] [Whitespace(" ")], + ty: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@92..93 "}" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@93..94 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@94..102 "declare" [Newline("\n")] [], + }, + }, + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@102..112 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@112..129 "not_a_declaration" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@129..130 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@130..132 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@132..133 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@133..134 "}" [] [], + }, + }, + ], + eof_token: EOF@134..135 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..135 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..134 + 0: TS_DECLARE_STATEMENT@0..46 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@8..46 + 0: (empty) + 1: FUNCTION_KW@8..17 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@17..21 + 0: IDENT@17..21 "test" [] [] + 3: TS_TYPE_PARAMETERS@21..30 + 0: L_ANGLE@21..22 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@22..29 + 0: TS_TYPE_PARAMETER@22..23 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@22..22 + 1: TS_TYPE_PARAMETER_NAME@22..23 + 0: IDENT@22..23 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@23..25 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@25..26 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@25..25 + 1: TS_TYPE_PARAMETER_NAME@25..26 + 0: IDENT@25..26 "B" [] [] + 2: (empty) + 3: (empty) + 3: COMMA@26..28 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@28..29 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@28..28 + 1: TS_TYPE_PARAMETER_NAME@28..29 + 0: IDENT@28..29 "R" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@29..30 ">" [] [] + 4: JS_PARAMETERS@30..42 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..41 + 0: JS_FORMAL_PARAMETER@31..35 + 0: JS_DECORATOR_LIST@31..31 + 1: JS_IDENTIFIER_BINDING@31..32 + 0: IDENT@31..32 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@32..35 + 0: COLON@32..34 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@34..35 + 0: JS_REFERENCE_IDENTIFIER@34..35 + 0: IDENT@34..35 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@35..37 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@37..41 + 0: JS_DECORATOR_LIST@37..37 + 1: JS_IDENTIFIER_BINDING@37..38 + 0: IDENT@37..38 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@38..41 + 0: COLON@38..40 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@40..41 + 0: JS_REFERENCE_IDENTIFIER@40..41 + 0: IDENT@40..41 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@41..42 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@42..45 + 0: COLON@42..44 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "R" [] [] + 1: (empty) + 6: SEMICOLON@45..46 ";" [] [] + 1: TS_DECLARE_STATEMENT@46..94 + 0: DECLARE_KW@46..55 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@55..94 + 0: (empty) + 1: FUNCTION_KW@55..64 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@64..69 + 0: IDENT@64..69 "test2" [] [] + 3: (empty) + 4: JS_PARAMETERS@69..94 + 0: L_PAREN@69..70 "(" [] [] + 1: JS_PARAMETER_LIST@70..93 + 0: JS_FORMAL_PARAMETER@70..93 + 0: JS_DECORATOR_LIST@70..70 + 1: JS_OBJECT_BINDING_PATTERN@70..75 + 0: L_CURLY@70..72 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@72..74 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@72..74 + 0: JS_IDENTIFIER_BINDING@72..74 + 0: IDENT@72..74 "a" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@74..75 "}" [] [] + 2: QUESTION@75..76 "?" [] [] + 3: TS_TYPE_ANNOTATION@76..93 + 0: COLON@76..78 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@78..93 + 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@80..92 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@80..92 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@80..81 + 0: IDENT@80..81 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@81..92 + 0: COLON@81..83 ":" [] [Whitespace(" ")] + 1: TS_STRING_LITERAL_TYPE@83..92 + 0: JS_STRING_LITERAL@83..92 "\"string\"" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@92..93 "}" [] [] + 4: (empty) + 2: R_PAREN@93..94 ")" [] [] + 5: (empty) + 6: (empty) + 2: JS_EXPRESSION_STATEMENT@94..102 + 0: JS_IDENTIFIER_EXPRESSION@94..102 + 0: JS_REFERENCE_IDENTIFIER@94..102 + 0: IDENT@94..102 "declare" [Newline("\n")] [] + 1: (empty) + 3: JS_FUNCTION_DECLARATION@102..134 + 0: (empty) + 1: FUNCTION_KW@102..112 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@112..129 + 0: IDENT@112..129 "not_a_declaration" [] [] + 4: (empty) + 5: JS_PARAMETERS@129..132 + 0: L_PAREN@129..130 "(" [] [] + 1: JS_PARAMETER_LIST@130..130 + 2: R_PAREN@130..132 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@132..134 + 0: L_CURLY@132..133 "{" [] [] + 1: JS_DIRECTIVE_LIST@133..133 + 2: JS_STATEMENT_LIST@133..133 + 3: R_CURLY@133..134 "}" [] [] + 4: EOF@134..135 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap new file mode 100644 index 000000000000..6f22bb660697 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap @@ -0,0 +1,130 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module 'x' { + export function test(option: any): void +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@19..20 "{" [] [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@39..43 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@43..44 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@44..50 "option" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@52..55 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@55..56 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@56..58 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@58..62 "void" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@62..64 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: TS_DECLARE_STATEMENT@0..64 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@8..64 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@15..19 + 0: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@19..64 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_MODULE_ITEM_LIST@20..62 + 0: JS_EXPORT@20..62 + 0: JS_DECORATOR_LIST@20..20 + 1: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: TS_DECLARE_FUNCTION_DECLARATION@30..62 + 0: (empty) + 1: FUNCTION_KW@30..39 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@39..43 + 0: IDENT@39..43 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@43..56 + 0: L_PAREN@43..44 "(" [] [] + 1: JS_PARAMETER_LIST@44..55 + 0: JS_FORMAL_PARAMETER@44..55 + 0: JS_DECORATOR_LIST@44..44 + 1: JS_IDENTIFIER_BINDING@44..50 + 0: IDENT@44..50 "option" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@50..55 + 0: COLON@50..52 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@52..55 + 0: ANY_KW@52..55 "any" [] [] + 4: (empty) + 2: R_PAREN@55..56 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@56..62 + 0: COLON@56..58 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@58..62 + 0: VOID_KW@58..62 "void" [] [] + 6: (empty) + 2: R_CURLY@62..64 "}" [Newline("\n")] [] + 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap new file mode 100644 index 000000000000..4887cab7ceae --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap @@ -0,0 +1,236 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module 'x' { + export default function(option: any): void +} +declare module 'y' { + export default function test(option: any): void +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@19..20 "{" [] [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@30..38 "default" [] [Whitespace(" ")], + declaration: TsDeclareFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@38..46 "function" [] [], + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@46..47 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@47..53 "option" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@53..55 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@55..58 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@58..59 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@59..61 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@61..65 "void" [] [], + }, + }, + semicolon_token: missing (optional), + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@65..67 "}" [Newline("\n")] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@67..76 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@76..83 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@83..87 "'y'" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@87..88 "{" [] [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@88..98 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")], + declaration: TsDeclareFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@106..115 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@115..119 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@119..120 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@120..126 "option" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@126..128 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@128..131 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@131..132 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@132..134 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@134..138 "void" [] [], + }, + }, + semicolon_token: missing (optional), + }, + semicolon_token: missing (optional), + }, + }, + ], + r_curly_token: R_CURLY@138..140 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@140..141 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..141 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..140 + 0: TS_DECLARE_STATEMENT@0..67 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@8..67 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@15..19 + 0: JS_STRING_LITERAL@15..19 "'x'" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@19..67 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_MODULE_ITEM_LIST@20..65 + 0: JS_EXPORT@20..65 + 0: JS_DECORATOR_LIST@20..20 + 1: EXPORT_KW@20..30 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@30..65 + 0: DEFAULT_KW@30..38 "default" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@38..65 + 0: (empty) + 1: FUNCTION_KW@38..46 "function" [] [] + 2: (empty) + 3: (empty) + 4: JS_PARAMETERS@46..59 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_PARAMETER_LIST@47..58 + 0: JS_FORMAL_PARAMETER@47..58 + 0: JS_DECORATOR_LIST@47..47 + 1: JS_IDENTIFIER_BINDING@47..53 + 0: IDENT@47..53 "option" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@53..58 + 0: COLON@53..55 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@55..58 + 0: ANY_KW@55..58 "any" [] [] + 4: (empty) + 2: R_PAREN@58..59 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@59..65 + 0: COLON@59..61 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@61..65 + 0: VOID_KW@61..65 "void" [] [] + 6: (empty) + 2: (empty) + 2: R_CURLY@65..67 "}" [Newline("\n")] [] + 1: TS_DECLARE_STATEMENT@67..140 + 0: DECLARE_KW@67..76 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@76..140 + 0: MODULE_KW@76..83 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@83..87 + 0: JS_STRING_LITERAL@83..87 "'y'" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@87..140 + 0: L_CURLY@87..88 "{" [] [] + 1: JS_MODULE_ITEM_LIST@88..138 + 0: JS_EXPORT@88..138 + 0: JS_DECORATOR_LIST@88..88 + 1: EXPORT_KW@88..98 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@98..138 + 0: DEFAULT_KW@98..106 "default" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@106..138 + 0: (empty) + 1: FUNCTION_KW@106..115 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@115..119 + 0: IDENT@115..119 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@119..132 + 0: L_PAREN@119..120 "(" [] [] + 1: JS_PARAMETER_LIST@120..131 + 0: JS_FORMAL_PARAMETER@120..131 + 0: JS_DECORATOR_LIST@120..120 + 1: JS_IDENTIFIER_BINDING@120..126 + 0: IDENT@120..126 "option" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@126..131 + 0: COLON@126..128 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@128..131 + 0: ANY_KW@128..131 "any" [] [] + 4: (empty) + 2: R_PAREN@131..132 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@132..138 + 0: COLON@132..134 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@134..138 + 0: VOID_KW@134..138 "void" [] [] + 6: (empty) + 2: (empty) + 2: R_CURLY@138..140 "}" [Newline("\n")] [] + 4: EOF@140..141 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts.snap new file mode 100644 index 000000000000..32a4076e4a54 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts.snap @@ -0,0 +1,172 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare type A = string; +declare type B = string | number & { a: string, b: number } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsTypeAliasDeclaration { + type_token: TYPE_KW@8..13 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@13..15 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@15..17 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@17..23 "string" [] [], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@24..33 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsTypeAliasDeclaration { + type_token: TYPE_KW@33..38 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@38..40 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@42..49 "string" [] [Whitespace(" ")], + }, + PIPE@49..51 "|" [] [Whitespace(" ")], + TsIntersectionType { + leading_separator_token: missing (optional), + types: TsIntersectionTypeElementList [ + TsNumberType { + number_token: NUMBER_KW@51..58 "number" [] [Whitespace(" ")], + }, + AMP@58..60 "&" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@60..62 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@62..63 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@63..65 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@65..71 "string" [] [], + }, + }, + separator_token: COMMA@71..73 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@73..74 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@74..76 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@76..83 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@83..84 "}" [] [], + }, + ], + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: TS_DECLARE_STATEMENT@0..24 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_TYPE_ALIAS_DECLARATION@8..24 + 0: TYPE_KW@8..13 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@13..15 + 0: IDENT@13..15 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@15..17 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@17..23 + 0: STRING_KW@17..23 "string" [] [] + 5: SEMICOLON@23..24 ";" [] [] + 1: TS_DECLARE_STATEMENT@24..84 + 0: DECLARE_KW@24..33 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ALIAS_DECLARATION@33..84 + 0: TYPE_KW@33..38 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@38..40 + 0: IDENT@38..40 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@40..42 "=" [] [Whitespace(" ")] + 4: TS_UNION_TYPE@42..84 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@42..84 + 0: TS_STRING_TYPE@42..49 + 0: STRING_KW@42..49 "string" [] [Whitespace(" ")] + 1: PIPE@49..51 "|" [] [Whitespace(" ")] + 2: TS_INTERSECTION_TYPE@51..84 + 0: (empty) + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@51..84 + 0: TS_NUMBER_TYPE@51..58 + 0: NUMBER_KW@51..58 "number" [] [Whitespace(" ")] + 1: AMP@58..60 "&" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@60..84 + 0: L_CURLY@60..62 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@62..83 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@62..73 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@62..63 + 0: IDENT@62..63 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@63..71 + 0: COLON@63..65 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@65..71 + 0: STRING_KW@65..71 "string" [] [] + 4: COMMA@71..73 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@73..83 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@73..74 + 0: IDENT@73..74 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@74..83 + 0: COLON@74..76 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@76..83 + 0: NUMBER_KW@76..83 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@83..84 "}" [] [] + 5: (empty) + 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap new file mode 100644 index 000000000000..0b5f38c17f9c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap @@ -0,0 +1,111 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { +@test +['a']: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@12..14 "@" [Newline("\n")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@14..18 "test" [] [], + }, + }, + }, + ], + name: JsComputedMemberName { + l_brack_token: L_BRACK@18..20 "[" [Newline("\n")] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@20..23 "'a'" [] [], + }, + r_brack_token: R_BRACK@23..24 "]" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@26..32 "string" [] [], + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + ], + r_curly_token: R_CURLY@33..35 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: JS_CLASS_DECLARATION@0..35 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..33 + 0: JS_PROPERTY_CLASS_MEMBER@12..33 + 0: JS_PROPERTY_MODIFIER_LIST@12..18 + 0: JS_DECORATOR@12..18 + 0: AT@12..14 "@" [Newline("\n")] [] + 1: JS_IDENTIFIER_EXPRESSION@14..18 + 0: JS_REFERENCE_IDENTIFIER@14..18 + 0: IDENT@14..18 "test" [] [] + 1: JS_COMPUTED_MEMBER_NAME@18..24 + 0: L_BRACK@18..20 "[" [Newline("\n")] [] + 1: JS_STRING_LITERAL_EXPRESSION@20..23 + 0: JS_STRING_LITERAL@20..23 "'a'" [] [] + 2: R_BRACK@23..24 "]" [] [] + 2: TS_TYPE_ANNOTATION@24..32 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@26..32 + 0: STRING_KW@26..32 "string" [] [] + 3: (empty) + 4: SEMICOLON@32..33 ";" [] [] + 9: R_CURLY@33..35 "}" [Newline("\n")] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts.snap new file mode 100644 index 000000000000..43f2829fa450 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts.snap @@ -0,0 +1,262 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + @test prop: string; + @test method() {} + @test get getter() {} + @test set setter(a) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@12..16 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..21 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + name: JsLiteralMemberName { + value: IDENT@21..25 "prop" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@27..33 "string" [] [], + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@34..38 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..43 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@43..49 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@49..50 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@50..52 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@52..53 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@53..54 "}" [] [], + }, + }, + JsGetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@54..58 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@58..63 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + get_token: GET_KW@63..67 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@67..73 "getter" [] [], + }, + l_paren_token: L_PAREN@73..74 "(" [] [], + r_paren_token: R_PAREN@74..76 ")" [] [Whitespace(" ")], + return_type: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@76..77 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@77..78 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [ + JsDecorator { + at_token: AT@78..82 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@82..87 "test" [] [Whitespace(" ")], + }, + }, + }, + ], + set_token: SET_KW@87..91 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@91..97 "setter" [] [], + }, + l_paren_token: L_PAREN@97..98 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@98..99 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@99..101 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@101..102 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@102..103 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@103..105 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@105..106 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..106 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..105 + 0: JS_CLASS_DECLARATION@0..105 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..103 + 0: JS_PROPERTY_CLASS_MEMBER@12..34 + 0: JS_PROPERTY_MODIFIER_LIST@12..21 + 0: JS_DECORATOR@12..21 + 0: AT@12..16 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@16..21 + 0: JS_REFERENCE_IDENTIFIER@16..21 + 0: IDENT@16..21 "test" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@21..25 + 0: IDENT@21..25 "prop" [] [] + 2: TS_TYPE_ANNOTATION@25..33 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@27..33 + 0: STRING_KW@27..33 "string" [] [] + 3: (empty) + 4: SEMICOLON@33..34 ";" [] [] + 1: JS_METHOD_CLASS_MEMBER@34..54 + 0: JS_METHOD_MODIFIER_LIST@34..43 + 0: JS_DECORATOR@34..43 + 0: AT@34..38 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@38..43 + 0: JS_REFERENCE_IDENTIFIER@38..43 + 0: IDENT@38..43 "test" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@43..49 + 0: IDENT@43..49 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@49..52 + 0: L_PAREN@49..50 "(" [] [] + 1: JS_PARAMETER_LIST@50..50 + 2: R_PAREN@50..52 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@52..54 + 0: L_CURLY@52..53 "{" [] [] + 1: JS_DIRECTIVE_LIST@53..53 + 2: JS_STATEMENT_LIST@53..53 + 3: R_CURLY@53..54 "}" [] [] + 2: JS_GETTER_CLASS_MEMBER@54..78 + 0: JS_METHOD_MODIFIER_LIST@54..63 + 0: JS_DECORATOR@54..63 + 0: AT@54..58 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@58..63 + 0: JS_REFERENCE_IDENTIFIER@58..63 + 0: IDENT@58..63 "test" [] [Whitespace(" ")] + 1: GET_KW@63..67 "get" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@67..73 + 0: IDENT@67..73 "getter" [] [] + 3: L_PAREN@73..74 "(" [] [] + 4: R_PAREN@74..76 ")" [] [Whitespace(" ")] + 5: (empty) + 6: JS_FUNCTION_BODY@76..78 + 0: L_CURLY@76..77 "{" [] [] + 1: JS_DIRECTIVE_LIST@77..77 + 2: JS_STATEMENT_LIST@77..77 + 3: R_CURLY@77..78 "}" [] [] + 3: JS_SETTER_CLASS_MEMBER@78..103 + 0: JS_METHOD_MODIFIER_LIST@78..87 + 0: JS_DECORATOR@78..87 + 0: AT@78..82 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_IDENTIFIER_EXPRESSION@82..87 + 0: JS_REFERENCE_IDENTIFIER@82..87 + 0: IDENT@82..87 "test" [] [Whitespace(" ")] + 1: SET_KW@87..91 "set" [] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@91..97 + 0: IDENT@91..97 "setter" [] [] + 3: L_PAREN@97..98 "(" [] [] + 4: JS_FORMAL_PARAMETER@98..99 + 0: JS_DECORATOR_LIST@98..98 + 1: JS_IDENTIFIER_BINDING@98..99 + 0: IDENT@98..99 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@99..101 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@101..103 + 0: L_CURLY@101..102 "{" [] [] + 1: JS_DIRECTIVE_LIST@102..102 + 2: JS_STATEMENT_LIST@102..102 + 3: R_CURLY@102..103 "}" [] [] + 9: R_CURLY@103..105 "}" [Newline("\n")] [] + 4: EOF@105..106 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts.snap new file mode 100644 index 000000000000..4f7f1f9a3a1a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts.snap @@ -0,0 +1,104 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@test(--a) +class Test {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@0..1 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@1..5 "test" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@5..6 "(" [] [], + args: JsCallArgumentList [ + JsPreUpdateExpression { + operator_token: MINUS2@6..8 "--" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@8..9 "a" [] [], + }, + }, + ], + r_paren_token: R_PAREN@9..10 ")" [] [], + }, + }, + }, + ], + abstract_token: missing (optional), + class_token: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@17..22 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@22..23 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@23..24 "}" [] [], + }, + ], + eof_token: EOF@24..25 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..25 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..24 + 0: JS_CLASS_DECLARATION@0..24 + 0: JS_DECORATOR_LIST@0..10 + 0: JS_DECORATOR@0..10 + 0: AT@0..1 "@" [] [] + 1: JS_CALL_EXPRESSION@1..10 + 0: JS_IDENTIFIER_EXPRESSION@1..5 + 0: JS_REFERENCE_IDENTIFIER@1..5 + 0: IDENT@1..5 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@5..10 + 0: L_PAREN@5..6 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@6..9 + 0: JS_PRE_UPDATE_EXPRESSION@6..9 + 0: MINUS2@6..8 "--" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@8..9 + 0: IDENT@8..9 "a" [] [] + 2: R_PAREN@9..10 ")" [] [] + 1: (empty) + 2: CLASS_KW@10..17 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@17..22 + 0: IDENT@17..22 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@22..23 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@23..23 + 9: R_CURLY@23..24 "}" [] [] + 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap new file mode 100644 index 000000000000..4bc3bbd9b366 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap @@ -0,0 +1,178 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export class Foo { + @Decorator((val) => val) + badField!: number +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@7..13 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@13..17 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@17..18 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsDecorator { + at_token: AT@18..21 "@" [Newline("\n"), Whitespace(" ")] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@21..30 "Decorator" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@30..31 "(" [] [], + args: JsCallArgumentList [ + JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..35 "val" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@35..37 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@37..40 "=>" [] [Whitespace(" ")], + body: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..43 "val" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@43..44 ")" [] [], + }, + }, + }, + ], + name: JsLiteralMemberName { + value: IDENT@44..54 "badField" [Newline("\n"), Whitespace(" ")] [], + }, + property_annotation: TsDefinitePropertyAnnotation { + excl_token: BANG@54..55 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@55..57 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@57..63 "number" [] [], + }, + }, + }, + value: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@63..65 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@65..66 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..66 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..65 + 0: JS_EXPORT@0..65 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@7..65 + 0: JS_DECORATOR_LIST@7..7 + 1: (empty) + 2: CLASS_KW@7..13 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@13..17 + 0: IDENT@13..17 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@17..18 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@18..63 + 0: JS_PROPERTY_CLASS_MEMBER@18..63 + 0: JS_PROPERTY_MODIFIER_LIST@18..44 + 0: JS_DECORATOR@18..44 + 0: AT@18..21 "@" [Newline("\n"), Whitespace(" ")] [] + 1: JS_CALL_EXPRESSION@21..44 + 0: JS_IDENTIFIER_EXPRESSION@21..30 + 0: JS_REFERENCE_IDENTIFIER@21..30 + 0: IDENT@21..30 "Decorator" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@30..44 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@31..43 + 0: JS_ARROW_FUNCTION_EXPRESSION@31..43 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@31..37 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_PARAMETER_LIST@32..35 + 0: JS_FORMAL_PARAMETER@32..35 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..35 + 0: IDENT@32..35 "val" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@35..37 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@37..40 "=>" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@40..43 + 0: JS_REFERENCE_IDENTIFIER@40..43 + 0: IDENT@40..43 "val" [] [] + 2: R_PAREN@43..44 ")" [] [] + 1: JS_LITERAL_MEMBER_NAME@44..54 + 0: IDENT@44..54 "badField" [Newline("\n"), Whitespace(" ")] [] + 2: TS_DEFINITE_PROPERTY_ANNOTATION@54..63 + 0: BANG@54..55 "!" [] [] + 1: TS_TYPE_ANNOTATION@55..63 + 0: COLON@55..57 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@57..63 + 0: NUMBER_KW@57..63 "number" [] [] + 3: (empty) + 4: (empty) + 9: R_CURLY@63..65 "}" [Newline("\n")] [] + 4: EOF@65..66 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts.snap new file mode 100644 index 000000000000..b3a67bada7d0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts.snap @@ -0,0 +1,622 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { + constructor(@foo readonly x: number) {} +} +class CC { + constructor(@foo @dec(arg) readonly x: number) {} +} +class CC { + constructor(@foo @dec.method(arg) readonly x: number) {} +} +class CCC { + constructor(@foo @dec.method(arg) private readonly x: number) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@25..26 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@26..27 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..31 "foo" [] [Whitespace(" ")], + }, + }, + }, + ], + modifiers: TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@40..41 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@41..43 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@43..49 "number" [] [], + }, + }, + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@49..51 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@51..52 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@53..55 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@62..65 "CC" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@65..66 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@82..83 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@83..84 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..88 "foo" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@88..89 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@89..92 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@92..93 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@93..96 "arg" [] [], + }, + }, + ], + r_paren_token: R_PAREN@96..98 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + modifiers: TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@107..108 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@108..110 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@110..116 "number" [] [], + }, + }, + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@118..119 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@119..120 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@120..122 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@129..132 "CC" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@132..133 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@149..150 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@150..151 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@151..155 "foo" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@155..156 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@156..159 "dec" [] [], + }, + }, + operator_token: DOT@159..160 "." [] [], + member: JsName { + value_token: IDENT@160..166 "method" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@166..167 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@167..170 "arg" [] [], + }, + }, + ], + r_paren_token: R_PAREN@170..172 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + modifiers: TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@181..182 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@182..184 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@184..190 "number" [] [], + }, + }, + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@190..192 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@192..193 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@193..194 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@194..196 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@203..207 "CCC" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@207..208 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@224..225 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@225..226 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@226..230 "foo" [] [Whitespace(" ")], + }, + }, + }, + JsDecorator { + at_token: AT@230..231 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@231..234 "dec" [] [], + }, + }, + operator_token: DOT@234..235 "." [] [], + member: JsName { + value_token: IDENT@235..241 "method" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@241..242 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@242..245 "arg" [] [], + }, + }, + ], + r_paren_token: R_PAREN@245..247 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@264..265 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@265..267 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@267..273 "number" [] [], + }, + }, + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@273..275 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@275..276 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@276..277 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@277..279 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@279..280 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..280 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..279 + 0: JS_CLASS_DECLARATION@0..55 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..53 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..53 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..25 + 0: IDENT@9..25 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@25..51 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@26..49 + 0: TS_PROPERTY_PARAMETER@26..49 + 0: JS_DECORATOR_LIST@26..31 + 0: JS_DECORATOR@26..31 + 0: AT@26..27 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@27..31 + 0: JS_REFERENCE_IDENTIFIER@27..31 + 0: IDENT@27..31 "foo" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@31..40 + 0: TS_READONLY_MODIFIER@31..40 + 0: READONLY_KW@31..40 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@40..49 + 0: JS_DECORATOR_LIST@40..40 + 1: JS_IDENTIFIER_BINDING@40..41 + 0: IDENT@40..41 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@41..49 + 0: COLON@41..43 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@43..49 + 0: NUMBER_KW@43..49 "number" [] [] + 4: (empty) + 2: R_PAREN@49..51 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@51..53 + 0: L_CURLY@51..52 "{" [] [] + 1: JS_DIRECTIVE_LIST@52..52 + 2: JS_STATEMENT_LIST@52..52 + 3: R_CURLY@52..53 "}" [] [] + 9: R_CURLY@53..55 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@55..122 + 0: JS_DECORATOR_LIST@55..55 + 1: (empty) + 2: CLASS_KW@55..62 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@62..65 + 0: IDENT@62..65 "CC" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@65..66 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@66..120 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@66..120 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@66..66 + 1: JS_LITERAL_MEMBER_NAME@66..82 + 0: IDENT@66..82 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@82..118 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@83..116 + 0: TS_PROPERTY_PARAMETER@83..116 + 0: JS_DECORATOR_LIST@83..98 + 0: JS_DECORATOR@83..88 + 0: AT@83..84 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@84..88 + 0: JS_REFERENCE_IDENTIFIER@84..88 + 0: IDENT@84..88 "foo" [] [Whitespace(" ")] + 1: JS_DECORATOR@88..98 + 0: AT@88..89 "@" [] [] + 1: JS_CALL_EXPRESSION@89..98 + 0: JS_IDENTIFIER_EXPRESSION@89..92 + 0: JS_REFERENCE_IDENTIFIER@89..92 + 0: IDENT@89..92 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@92..98 + 0: L_PAREN@92..93 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@93..96 + 0: JS_IDENTIFIER_EXPRESSION@93..96 + 0: JS_REFERENCE_IDENTIFIER@93..96 + 0: IDENT@93..96 "arg" [] [] + 2: R_PAREN@96..98 ")" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@98..107 + 0: TS_READONLY_MODIFIER@98..107 + 0: READONLY_KW@98..107 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@107..116 + 0: JS_DECORATOR_LIST@107..107 + 1: JS_IDENTIFIER_BINDING@107..108 + 0: IDENT@107..108 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@108..116 + 0: COLON@108..110 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@110..116 + 0: NUMBER_KW@110..116 "number" [] [] + 4: (empty) + 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@118..120 + 0: L_CURLY@118..119 "{" [] [] + 1: JS_DIRECTIVE_LIST@119..119 + 2: JS_STATEMENT_LIST@119..119 + 3: R_CURLY@119..120 "}" [] [] + 9: R_CURLY@120..122 "}" [Newline("\n")] [] + 2: JS_CLASS_DECLARATION@122..196 + 0: JS_DECORATOR_LIST@122..122 + 1: (empty) + 2: CLASS_KW@122..129 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@129..132 + 0: IDENT@129..132 "CC" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@132..133 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@133..194 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@133..194 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@133..133 + 1: JS_LITERAL_MEMBER_NAME@133..149 + 0: IDENT@133..149 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@149..192 + 0: L_PAREN@149..150 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@150..190 + 0: TS_PROPERTY_PARAMETER@150..190 + 0: JS_DECORATOR_LIST@150..172 + 0: JS_DECORATOR@150..155 + 0: AT@150..151 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@151..155 + 0: JS_REFERENCE_IDENTIFIER@151..155 + 0: IDENT@151..155 "foo" [] [Whitespace(" ")] + 1: JS_DECORATOR@155..172 + 0: AT@155..156 "@" [] [] + 1: JS_CALL_EXPRESSION@156..172 + 0: JS_STATIC_MEMBER_EXPRESSION@156..166 + 0: JS_IDENTIFIER_EXPRESSION@156..159 + 0: JS_REFERENCE_IDENTIFIER@156..159 + 0: IDENT@156..159 "dec" [] [] + 1: DOT@159..160 "." [] [] + 2: JS_NAME@160..166 + 0: IDENT@160..166 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@166..172 + 0: L_PAREN@166..167 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@167..170 + 0: JS_IDENTIFIER_EXPRESSION@167..170 + 0: JS_REFERENCE_IDENTIFIER@167..170 + 0: IDENT@167..170 "arg" [] [] + 2: R_PAREN@170..172 ")" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@172..181 + 0: TS_READONLY_MODIFIER@172..181 + 0: READONLY_KW@172..181 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@181..190 + 0: JS_DECORATOR_LIST@181..181 + 1: JS_IDENTIFIER_BINDING@181..182 + 0: IDENT@181..182 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@182..190 + 0: COLON@182..184 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@184..190 + 0: NUMBER_KW@184..190 "number" [] [] + 4: (empty) + 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@192..194 + 0: L_CURLY@192..193 "{" [] [] + 1: JS_DIRECTIVE_LIST@193..193 + 2: JS_STATEMENT_LIST@193..193 + 3: R_CURLY@193..194 "}" [] [] + 9: R_CURLY@194..196 "}" [Newline("\n")] [] + 3: JS_CLASS_DECLARATION@196..279 + 0: JS_DECORATOR_LIST@196..196 + 1: (empty) + 2: CLASS_KW@196..203 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@203..207 + 0: IDENT@203..207 "CCC" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@207..208 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@208..277 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@208..277 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@208..208 + 1: JS_LITERAL_MEMBER_NAME@208..224 + 0: IDENT@208..224 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@224..275 + 0: L_PAREN@224..225 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@225..273 + 0: TS_PROPERTY_PARAMETER@225..273 + 0: JS_DECORATOR_LIST@225..247 + 0: JS_DECORATOR@225..230 + 0: AT@225..226 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@226..230 + 0: JS_REFERENCE_IDENTIFIER@226..230 + 0: IDENT@226..230 "foo" [] [Whitespace(" ")] + 1: JS_DECORATOR@230..247 + 0: AT@230..231 "@" [] [] + 1: JS_CALL_EXPRESSION@231..247 + 0: JS_STATIC_MEMBER_EXPRESSION@231..241 + 0: JS_IDENTIFIER_EXPRESSION@231..234 + 0: JS_REFERENCE_IDENTIFIER@231..234 + 0: IDENT@231..234 "dec" [] [] + 1: DOT@234..235 "." [] [] + 2: JS_NAME@235..241 + 0: IDENT@235..241 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@241..247 + 0: L_PAREN@241..242 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@242..245 + 0: JS_IDENTIFIER_EXPRESSION@242..245 + 0: JS_REFERENCE_IDENTIFIER@242..245 + 0: IDENT@242..245 "arg" [] [] + 2: R_PAREN@245..247 ")" [] [Whitespace(" ")] + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@247..264 + 0: TS_ACCESSIBILITY_MODIFIER@247..255 + 0: PRIVATE_KW@247..255 "private" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@255..264 + 0: READONLY_KW@255..264 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@264..273 + 0: JS_DECORATOR_LIST@264..264 + 1: JS_IDENTIFIER_BINDING@264..265 + 0: IDENT@264..265 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@265..273 + 0: COLON@265..267 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@267..273 + 0: NUMBER_KW@267..273 "number" [] [] + 4: (empty) + 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@275..277 + 0: L_CURLY@275..276 "{" [] [] + 1: JS_DIRECTIVE_LIST@276..276 + 2: JS_STATEMENT_LIST@276..276 + 3: R_CURLY@276..277 "}" [] [] + 9: R_CURLY@277..279 "}" [Newline("\n")] [] + 4: EOF@279..280 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap new file mode 100644 index 000000000000..8864cc68cc4d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap @@ -0,0 +1,1030 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec x, second, @dec third = 'default') {} + method(@dec.fn() x, second, @dec.fn() third = 'default') {} + method(@dec() x, second, @dec() third = 'default') {} + static method(@dec x, second, @dec third = 'default') {} + static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + static method(@dec() x, second, @dec() third = 'default') {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@21..22 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@22..26 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@26..27 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@27..29 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@29..35 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@35..37 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@37..38 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..42 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@42..48 "third" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@48..50 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@50..59 "'default'" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@61..62 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@62..63 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@74..75 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@75..76 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@76..79 "dec" [] [], + }, + }, + operator_token: DOT@79..80 "." [] [], + member: JsName { + value_token: IDENT@80..82 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@82..83 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@83..85 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@85..86 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@86..88 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@88..94 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@94..96 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@96..97 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@97..100 "dec" [] [], + }, + }, + operator_token: DOT@100..101 "." [] [], + member: JsName { + value_token: IDENT@101..103 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@103..104 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@104..106 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@106..112 "third" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@112..114 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@114..123 "'default'" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@123..125 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@125..126 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@126..127 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@138..139 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@139..140 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@140..143 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@143..144 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@144..146 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@146..147 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@147..149 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@149..155 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@155..157 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@157..158 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@158..161 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@161..162 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@162..164 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@164..170 "third" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@170..172 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@172..181 "'default'" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@181..183 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@183..184 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@184..185 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@197..203 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@203..204 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@204..205 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@205..209 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@209..210 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@210..212 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@212..218 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@218..220 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@220..221 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@221..225 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@225..231 "third" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@231..233 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@233..242 "'default'" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@242..244 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@244..245 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@245..246 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@258..264 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@264..265 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@265..266 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@266..269 "dec" [] [], + }, + }, + operator_token: DOT@269..270 "." [] [], + member: JsName { + value_token: IDENT@270..272 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@272..273 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@273..275 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@275..276 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@276..278 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@278..284 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@284..286 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@286..287 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@287..290 "dec" [] [], + }, + }, + operator_token: DOT@290..291 "." [] [], + member: JsName { + value_token: IDENT@291..293 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@293..294 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@294..296 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@296..302 "third" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@302..304 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@304..313 "'default'" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@313..315 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@315..316 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@316..317 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@329..335 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@335..336 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@336..337 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@337..340 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@340..341 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@341..343 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@343..344 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@344..346 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@346..352 "second" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@352..354 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@354..355 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@355..358 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@358..359 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@359..361 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@361..367 "third" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@367..369 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@369..378 "'default'" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@378..380 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@380..381 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@381..382 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@382..384 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@384..385 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..385 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..384 + 0: JS_CLASS_DECLARATION@0..384 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..382 + 0: JS_METHOD_CLASS_MEMBER@9..63 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@9..20 + 0: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@20..61 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..59 + 0: JS_FORMAL_PARAMETER@21..27 + 0: JS_DECORATOR_LIST@21..26 + 0: JS_DECORATOR@21..26 + 0: AT@21..22 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@22..26 + 0: JS_REFERENCE_IDENTIFIER@22..26 + 0: IDENT@22..26 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@26..27 + 0: IDENT@26..27 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@27..29 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@29..35 + 0: JS_DECORATOR_LIST@29..29 + 1: JS_IDENTIFIER_BINDING@29..35 + 0: IDENT@29..35 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@35..37 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@37..59 + 0: JS_DECORATOR_LIST@37..42 + 0: JS_DECORATOR@37..42 + 0: AT@37..38 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@38..42 + 0: JS_REFERENCE_IDENTIFIER@38..42 + 0: IDENT@38..42 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@42..48 + 0: IDENT@42..48 "third" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@48..59 + 0: EQ@48..50 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@50..59 + 0: JS_STRING_LITERAL@50..59 "'default'" [] [] + 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@61..63 + 0: L_CURLY@61..62 "{" [] [] + 1: JS_DIRECTIVE_LIST@62..62 + 2: JS_STATEMENT_LIST@62..62 + 3: R_CURLY@62..63 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@63..127 + 0: JS_METHOD_MODIFIER_LIST@63..63 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@63..74 + 0: IDENT@63..74 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@74..125 + 0: L_PAREN@74..75 "(" [] [] + 1: JS_PARAMETER_LIST@75..123 + 0: JS_FORMAL_PARAMETER@75..86 + 0: JS_DECORATOR_LIST@75..85 + 0: JS_DECORATOR@75..85 + 0: AT@75..76 "@" [] [] + 1: JS_CALL_EXPRESSION@76..85 + 0: JS_STATIC_MEMBER_EXPRESSION@76..82 + 0: JS_IDENTIFIER_EXPRESSION@76..79 + 0: JS_REFERENCE_IDENTIFIER@76..79 + 0: IDENT@76..79 "dec" [] [] + 1: DOT@79..80 "." [] [] + 2: JS_NAME@80..82 + 0: IDENT@80..82 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@82..85 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@83..83 + 2: R_PAREN@83..85 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@85..86 + 0: IDENT@85..86 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@86..88 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@88..94 + 0: JS_DECORATOR_LIST@88..88 + 1: JS_IDENTIFIER_BINDING@88..94 + 0: IDENT@88..94 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@94..96 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@96..123 + 0: JS_DECORATOR_LIST@96..106 + 0: JS_DECORATOR@96..106 + 0: AT@96..97 "@" [] [] + 1: JS_CALL_EXPRESSION@97..106 + 0: JS_STATIC_MEMBER_EXPRESSION@97..103 + 0: JS_IDENTIFIER_EXPRESSION@97..100 + 0: JS_REFERENCE_IDENTIFIER@97..100 + 0: IDENT@97..100 "dec" [] [] + 1: DOT@100..101 "." [] [] + 2: JS_NAME@101..103 + 0: IDENT@101..103 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@103..106 + 0: L_PAREN@103..104 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@104..104 + 2: R_PAREN@104..106 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@106..112 + 0: IDENT@106..112 "third" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@112..123 + 0: EQ@112..114 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@114..123 + 0: JS_STRING_LITERAL@114..123 "'default'" [] [] + 2: R_PAREN@123..125 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@125..127 + 0: L_CURLY@125..126 "{" [] [] + 1: JS_DIRECTIVE_LIST@126..126 + 2: JS_STATEMENT_LIST@126..126 + 3: R_CURLY@126..127 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@127..185 + 0: JS_METHOD_MODIFIER_LIST@127..127 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@127..138 + 0: IDENT@127..138 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@138..183 + 0: L_PAREN@138..139 "(" [] [] + 1: JS_PARAMETER_LIST@139..181 + 0: JS_FORMAL_PARAMETER@139..147 + 0: JS_DECORATOR_LIST@139..146 + 0: JS_DECORATOR@139..146 + 0: AT@139..140 "@" [] [] + 1: JS_CALL_EXPRESSION@140..146 + 0: JS_IDENTIFIER_EXPRESSION@140..143 + 0: JS_REFERENCE_IDENTIFIER@140..143 + 0: IDENT@140..143 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@143..146 + 0: L_PAREN@143..144 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@144..144 + 2: R_PAREN@144..146 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@146..147 + 0: IDENT@146..147 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@147..149 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@149..155 + 0: JS_DECORATOR_LIST@149..149 + 1: JS_IDENTIFIER_BINDING@149..155 + 0: IDENT@149..155 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@155..157 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@157..181 + 0: JS_DECORATOR_LIST@157..164 + 0: JS_DECORATOR@157..164 + 0: AT@157..158 "@" [] [] + 1: JS_CALL_EXPRESSION@158..164 + 0: JS_IDENTIFIER_EXPRESSION@158..161 + 0: JS_REFERENCE_IDENTIFIER@158..161 + 0: IDENT@158..161 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@161..164 + 0: L_PAREN@161..162 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@162..162 + 2: R_PAREN@162..164 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@164..170 + 0: IDENT@164..170 "third" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@170..181 + 0: EQ@170..172 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@172..181 + 0: JS_STRING_LITERAL@172..181 "'default'" [] [] + 2: R_PAREN@181..183 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@183..185 + 0: L_CURLY@183..184 "{" [] [] + 1: JS_DIRECTIVE_LIST@184..184 + 2: JS_STATEMENT_LIST@184..184 + 3: R_CURLY@184..185 "}" [] [] + 3: JS_METHOD_CLASS_MEMBER@185..246 + 0: JS_METHOD_MODIFIER_LIST@185..197 + 0: JS_STATIC_MODIFIER@185..197 + 0: STATIC_KW@185..197 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@197..203 + 0: IDENT@197..203 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@203..244 + 0: L_PAREN@203..204 "(" [] [] + 1: JS_PARAMETER_LIST@204..242 + 0: JS_FORMAL_PARAMETER@204..210 + 0: JS_DECORATOR_LIST@204..209 + 0: JS_DECORATOR@204..209 + 0: AT@204..205 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@205..209 + 0: JS_REFERENCE_IDENTIFIER@205..209 + 0: IDENT@205..209 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@209..210 + 0: IDENT@209..210 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@210..212 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@212..218 + 0: JS_DECORATOR_LIST@212..212 + 1: JS_IDENTIFIER_BINDING@212..218 + 0: IDENT@212..218 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@218..220 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@220..242 + 0: JS_DECORATOR_LIST@220..225 + 0: JS_DECORATOR@220..225 + 0: AT@220..221 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@221..225 + 0: JS_REFERENCE_IDENTIFIER@221..225 + 0: IDENT@221..225 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@225..231 + 0: IDENT@225..231 "third" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@231..242 + 0: EQ@231..233 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@233..242 + 0: JS_STRING_LITERAL@233..242 "'default'" [] [] + 2: R_PAREN@242..244 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@244..246 + 0: L_CURLY@244..245 "{" [] [] + 1: JS_DIRECTIVE_LIST@245..245 + 2: JS_STATEMENT_LIST@245..245 + 3: R_CURLY@245..246 "}" [] [] + 4: JS_METHOD_CLASS_MEMBER@246..317 + 0: JS_METHOD_MODIFIER_LIST@246..258 + 0: JS_STATIC_MODIFIER@246..258 + 0: STATIC_KW@246..258 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@258..264 + 0: IDENT@258..264 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@264..315 + 0: L_PAREN@264..265 "(" [] [] + 1: JS_PARAMETER_LIST@265..313 + 0: JS_FORMAL_PARAMETER@265..276 + 0: JS_DECORATOR_LIST@265..275 + 0: JS_DECORATOR@265..275 + 0: AT@265..266 "@" [] [] + 1: JS_CALL_EXPRESSION@266..275 + 0: JS_STATIC_MEMBER_EXPRESSION@266..272 + 0: JS_IDENTIFIER_EXPRESSION@266..269 + 0: JS_REFERENCE_IDENTIFIER@266..269 + 0: IDENT@266..269 "dec" [] [] + 1: DOT@269..270 "." [] [] + 2: JS_NAME@270..272 + 0: IDENT@270..272 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@272..275 + 0: L_PAREN@272..273 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@273..273 + 2: R_PAREN@273..275 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@275..276 + 0: IDENT@275..276 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@276..278 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@278..284 + 0: JS_DECORATOR_LIST@278..278 + 1: JS_IDENTIFIER_BINDING@278..284 + 0: IDENT@278..284 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@284..286 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@286..313 + 0: JS_DECORATOR_LIST@286..296 + 0: JS_DECORATOR@286..296 + 0: AT@286..287 "@" [] [] + 1: JS_CALL_EXPRESSION@287..296 + 0: JS_STATIC_MEMBER_EXPRESSION@287..293 + 0: JS_IDENTIFIER_EXPRESSION@287..290 + 0: JS_REFERENCE_IDENTIFIER@287..290 + 0: IDENT@287..290 "dec" [] [] + 1: DOT@290..291 "." [] [] + 2: JS_NAME@291..293 + 0: IDENT@291..293 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@293..296 + 0: L_PAREN@293..294 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@294..294 + 2: R_PAREN@294..296 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@296..302 + 0: IDENT@296..302 "third" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@302..313 + 0: EQ@302..304 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@304..313 + 0: JS_STRING_LITERAL@304..313 "'default'" [] [] + 2: R_PAREN@313..315 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@315..317 + 0: L_CURLY@315..316 "{" [] [] + 1: JS_DIRECTIVE_LIST@316..316 + 2: JS_STATEMENT_LIST@316..316 + 3: R_CURLY@316..317 "}" [] [] + 5: JS_METHOD_CLASS_MEMBER@317..382 + 0: JS_METHOD_MODIFIER_LIST@317..329 + 0: JS_STATIC_MODIFIER@317..329 + 0: STATIC_KW@317..329 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@329..335 + 0: IDENT@329..335 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@335..380 + 0: L_PAREN@335..336 "(" [] [] + 1: JS_PARAMETER_LIST@336..378 + 0: JS_FORMAL_PARAMETER@336..344 + 0: JS_DECORATOR_LIST@336..343 + 0: JS_DECORATOR@336..343 + 0: AT@336..337 "@" [] [] + 1: JS_CALL_EXPRESSION@337..343 + 0: JS_IDENTIFIER_EXPRESSION@337..340 + 0: JS_REFERENCE_IDENTIFIER@337..340 + 0: IDENT@337..340 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@340..343 + 0: L_PAREN@340..341 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@341..341 + 2: R_PAREN@341..343 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@343..344 + 0: IDENT@343..344 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@344..346 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@346..352 + 0: JS_DECORATOR_LIST@346..346 + 1: JS_IDENTIFIER_BINDING@346..352 + 0: IDENT@346..352 "second" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@352..354 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@354..378 + 0: JS_DECORATOR_LIST@354..361 + 0: JS_DECORATOR@354..361 + 0: AT@354..355 "@" [] [] + 1: JS_CALL_EXPRESSION@355..361 + 0: JS_IDENTIFIER_EXPRESSION@355..358 + 0: JS_REFERENCE_IDENTIFIER@355..358 + 0: IDENT@355..358 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@358..361 + 0: L_PAREN@358..359 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@359..359 + 2: R_PAREN@359..361 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@361..367 + 0: IDENT@361..367 "third" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@367..378 + 0: EQ@367..369 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@369..378 + 0: JS_STRING_LITERAL@369..378 "'default'" [] [] + 2: R_PAREN@378..380 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@380..382 + 0: L_CURLY@380..381 "{" [] [] + 1: JS_DIRECTIVE_LIST@381..381 + 2: JS_STATEMENT_LIST@381..381 + 3: R_CURLY@381..382 "}" [] [] + 9: R_CURLY@382..384 "}" [Newline("\n")] [] + 4: EOF@384..385 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap new file mode 100644 index 000000000000..5b11519094a7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap @@ -0,0 +1,286 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + set val(@dec x) {} + set val(@dec.fn() x) {} + set val(@dec() x) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@18..21 "val" [] [], + }, + l_paren_token: L_PAREN@21..22 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@22..23 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..27 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@27..28 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@28..30 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@30..31 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@41..44 "val" [] [], + }, + l_paren_token: L_PAREN@44..45 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@45..46 "@" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..49 "dec" [] [], + }, + }, + operator_token: DOT@49..50 "." [] [], + member: JsName { + value_token: IDENT@50..52 "fn" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@52..53 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@55..56 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@56..58 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@58..59 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + }, + JsSetterClassMember { + modifiers: JsMethodModifierList [], + set_token: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@69..72 "val" [] [], + }, + l_paren_token: L_PAREN@72..73 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@73..74 "@" [] [], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..77 "dec" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@77..78 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@78..80 ")" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@80..81 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@81..83 ")" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@83..84 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@84..85 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@85..87 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@87..88 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..88 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..87 + 0: JS_CLASS_DECLARATION@0..87 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..85 + 0: JS_SETTER_CLASS_MEMBER@9..32 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: SET_KW@9..18 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@18..21 + 0: IDENT@18..21 "val" [] [] + 3: L_PAREN@21..22 "(" [] [] + 4: JS_FORMAL_PARAMETER@22..28 + 0: JS_DECORATOR_LIST@22..27 + 0: JS_DECORATOR@22..27 + 0: AT@22..23 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@23..27 + 0: JS_REFERENCE_IDENTIFIER@23..27 + 0: IDENT@23..27 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@27..28 + 0: IDENT@27..28 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@28..30 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@30..32 + 0: L_CURLY@30..31 "{" [] [] + 1: JS_DIRECTIVE_LIST@31..31 + 2: JS_STATEMENT_LIST@31..31 + 3: R_CURLY@31..32 "}" [] [] + 1: JS_SETTER_CLASS_MEMBER@32..60 + 0: JS_METHOD_MODIFIER_LIST@32..32 + 1: SET_KW@32..41 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@41..44 + 0: IDENT@41..44 "val" [] [] + 3: L_PAREN@44..45 "(" [] [] + 4: JS_FORMAL_PARAMETER@45..56 + 0: JS_DECORATOR_LIST@45..55 + 0: JS_DECORATOR@45..55 + 0: AT@45..46 "@" [] [] + 1: JS_CALL_EXPRESSION@46..55 + 0: JS_STATIC_MEMBER_EXPRESSION@46..52 + 0: JS_IDENTIFIER_EXPRESSION@46..49 + 0: JS_REFERENCE_IDENTIFIER@46..49 + 0: IDENT@46..49 "dec" [] [] + 1: DOT@49..50 "." [] [] + 2: JS_NAME@50..52 + 0: IDENT@50..52 "fn" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@55..56 + 0: IDENT@55..56 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@56..58 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@58..60 + 0: L_CURLY@58..59 "{" [] [] + 1: JS_DIRECTIVE_LIST@59..59 + 2: JS_STATEMENT_LIST@59..59 + 3: R_CURLY@59..60 "}" [] [] + 2: JS_SETTER_CLASS_MEMBER@60..85 + 0: JS_METHOD_MODIFIER_LIST@60..60 + 1: SET_KW@60..69 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@69..72 + 0: IDENT@69..72 "val" [] [] + 3: L_PAREN@72..73 "(" [] [] + 4: JS_FORMAL_PARAMETER@73..81 + 0: JS_DECORATOR_LIST@73..80 + 0: JS_DECORATOR@73..80 + 0: AT@73..74 "@" [] [] + 1: JS_CALL_EXPRESSION@74..80 + 0: JS_IDENTIFIER_EXPRESSION@74..77 + 0: JS_REFERENCE_IDENTIFIER@74..77 + 0: IDENT@74..77 "dec" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@77..80 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@78..78 + 2: R_PAREN@78..80 ")" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@80..81 + 0: IDENT@80..81 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@81..83 ")" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@83..85 + 0: L_CURLY@83..84 "{" [] [] + 1: JS_DIRECTIVE_LIST@84..84 + 2: JS_STATEMENT_LIST@84..84 + 3: R_CURLY@84..85 "}" [] [] + 9: R_CURLY@85..87 "}" [Newline("\n")] [] + 4: EOF@87..88 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts.snap new file mode 100644 index 000000000000..e8b84a095809 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts.snap @@ -0,0 +1,201 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = X; +type B = { a: X } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..6 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@6..7 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@7..8 "X" [] [], + }, + constraint: missing (optional), + default: TsDefaultTypeClause { + eq_token: EQ@8..9 "=" [] [], + ty: TsStringType { + string_token: STRING_KW@9..15 "string" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@15..17 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@17..19 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@19..20 "X" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@27..28 "B" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@28..29 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@29..31 "X" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@31..39 "extends" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsNumberType { + number_token: NUMBER_KW@39..46 "number" [] [Whitespace(" ")], + }, + PIPE@46..48 "|" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@48..55 "string" [] [Whitespace(" ")], + }, + ], + }, + }, + default: TsDefaultTypeClause { + eq_token: EQ@55..57 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@57..63 "string" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@63..65 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@65..67 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@67..69 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@69..70 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@70..72 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@72..74 "X" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@74..75 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@75..76 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..76 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..75 + 0: TS_TYPE_ALIAS_DECLARATION@0..21 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..6 + 0: IDENT@5..6 "A" [] [] + 2: TS_TYPE_PARAMETERS@6..17 + 0: L_ANGLE@6..7 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@7..15 + 0: TS_TYPE_PARAMETER@7..15 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 + 1: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "X" [] [] + 2: (empty) + 3: TS_DEFAULT_TYPE_CLAUSE@8..15 + 0: EQ@8..9 "=" [] [] + 1: TS_STRING_TYPE@9..15 + 0: STRING_KW@9..15 "string" [] [] + 2: R_ANGLE@15..17 ">" [] [Whitespace(" ")] + 3: EQ@17..19 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@19..20 + 0: JS_REFERENCE_IDENTIFIER@19..20 + 0: IDENT@19..20 "X" [] [] + 1: (empty) + 5: SEMICOLON@20..21 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@21..75 + 0: TYPE_KW@21..27 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@27..28 + 0: IDENT@27..28 "B" [] [] + 2: TS_TYPE_PARAMETERS@28..65 + 0: L_ANGLE@28..29 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@29..63 + 0: TS_TYPE_PARAMETER@29..63 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@29..29 + 1: TS_TYPE_PARAMETER_NAME@29..31 + 0: IDENT@29..31 "X" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@31..55 + 0: EXTENDS_KW@31..39 "extends" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@39..55 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@39..55 + 0: TS_NUMBER_TYPE@39..46 + 0: NUMBER_KW@39..46 "number" [] [Whitespace(" ")] + 1: PIPE@46..48 "|" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@48..55 + 0: STRING_KW@48..55 "string" [] [Whitespace(" ")] + 3: TS_DEFAULT_TYPE_CLAUSE@55..63 + 0: EQ@55..57 "=" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@57..63 + 0: STRING_KW@57..63 "string" [] [] + 2: R_ANGLE@63..65 ">" [] [Whitespace(" ")] + 3: EQ@65..67 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@67..75 + 0: L_CURLY@67..69 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@69..74 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@69..74 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@69..70 + 0: IDENT@69..70 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@70..74 + 0: COLON@70..72 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@72..74 + 0: JS_REFERENCE_IDENTIFIER@72..74 + 0: IDENT@72..74 "X" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 2: R_CURLY@74..75 "}" [] [] + 5: (empty) + 4: EOF@75..76 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap new file mode 100644 index 000000000000..feb1d0d53408 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap @@ -0,0 +1,257 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const a: { b: string } +export = a; +export = class {} +export = function () {} +export = 4 + 3 + a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@15..17 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@19..20 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@20..22 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@22..29 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportAssignmentClause { + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..41 "a" [] [], + }, + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportAssignmentClause { + eq_token: EQ@50..52 "=" [] [Whitespace(" ")], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@52..58 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@58..59 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@60..68 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportAssignmentClause { + eq_token: EQ@68..70 "=" [] [Whitespace(" ")], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@70..79 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@79..80 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@80..82 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@82..83 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@83..84 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportAssignmentClause { + eq_token: EQ@92..94 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@94..96 "4" [] [Whitespace(" ")], + }, + operator_token: PLUS@96..98 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@98..100 "3" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@100..102 "+" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@102..103 "a" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@103..104 ";" [] [], + }, + }, + ], + eof_token: EOF@104..105 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..105 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..104 + 0: TS_DECLARE_STATEMENT@0..30 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@8..30 + 0: JS_VARIABLE_DECLARATION@8..30 + 0: (empty) + 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..30 + 0: JS_VARIABLE_DECLARATOR@14..30 + 0: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 1: TS_TYPE_ANNOTATION@15..30 + 0: COLON@15..17 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@17..30 + 0: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@19..29 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@19..29 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@19..20 + 0: IDENT@19..20 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@20..29 + 0: COLON@20..22 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@22..29 + 0: STRING_KW@22..29 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@29..30 "}" [] [] + 2: (empty) + 1: (empty) + 1: JS_EXPORT@30..42 + 0: JS_DECORATOR_LIST@30..30 + 1: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_ASSIGNMENT_CLAUSE@38..42 + 0: EQ@38..40 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@40..41 + 0: JS_REFERENCE_IDENTIFIER@40..41 + 0: IDENT@40..41 "a" [] [] + 2: SEMICOLON@41..42 ";" [] [] + 2: JS_EXPORT@42..60 + 0: JS_DECORATOR_LIST@42..42 + 1: EXPORT_KW@42..50 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_ASSIGNMENT_CLAUSE@50..60 + 0: EQ@50..52 "=" [] [Whitespace(" ")] + 1: JS_CLASS_EXPRESSION@52..60 + 0: JS_DECORATOR_LIST@52..52 + 1: CLASS_KW@52..58 "class" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@58..59 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@59..59 + 8: R_CURLY@59..60 "}" [] [] + 2: (empty) + 3: JS_EXPORT@60..84 + 0: JS_DECORATOR_LIST@60..60 + 1: EXPORT_KW@60..68 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_ASSIGNMENT_CLAUSE@68..84 + 0: EQ@68..70 "=" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPRESSION@70..84 + 0: (empty) + 1: FUNCTION_KW@70..79 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@79..82 + 0: L_PAREN@79..80 "(" [] [] + 1: JS_PARAMETER_LIST@80..80 + 2: R_PAREN@80..82 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@82..84 + 0: L_CURLY@82..83 "{" [] [] + 1: JS_DIRECTIVE_LIST@83..83 + 2: JS_STATEMENT_LIST@83..83 + 3: R_CURLY@83..84 "}" [] [] + 2: (empty) + 4: JS_EXPORT@84..104 + 0: JS_DECORATOR_LIST@84..84 + 1: EXPORT_KW@84..92 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_ASSIGNMENT_CLAUSE@92..104 + 0: EQ@92..94 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@94..103 + 0: JS_BINARY_EXPRESSION@94..100 + 0: JS_NUMBER_LITERAL_EXPRESSION@94..96 + 0: JS_NUMBER_LITERAL@94..96 "4" [] [Whitespace(" ")] + 1: PLUS@96..98 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@98..100 + 0: JS_NUMBER_LITERAL@98..100 "3" [] [Whitespace(" ")] + 1: PLUS@100..102 "+" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@102..103 + 0: JS_REFERENCE_IDENTIFIER@102..103 + 0: IDENT@102..103 "a" [] [] + 2: SEMICOLON@103..104 ";" [] [] + 4: EOF@104..105 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap new file mode 100644 index 000000000000..3ae151df4289 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap @@ -0,0 +1,138 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const a: { b: string } +export = a.b; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@8..14 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@15..17 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@19..20 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@20..22 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@22..29 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportAssignmentClause { + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..41 "a" [] [], + }, + }, + operator_token: DOT@41..42 "." [] [], + member: JsName { + value_token: IDENT@42..43 "b" [] [], + }, + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + }, + ], + eof_token: EOF@44..45 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..45 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..44 + 0: TS_DECLARE_STATEMENT@0..30 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@8..30 + 0: JS_VARIABLE_DECLARATION@8..30 + 0: (empty) + 1: CONST_KW@8..14 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..30 + 0: JS_VARIABLE_DECLARATOR@14..30 + 0: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 1: TS_TYPE_ANNOTATION@15..30 + 0: COLON@15..17 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@17..30 + 0: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@19..29 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@19..29 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@19..20 + 0: IDENT@19..20 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@20..29 + 0: COLON@20..22 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@22..29 + 0: STRING_KW@22..29 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@29..30 "}" [] [] + 2: (empty) + 1: (empty) + 1: JS_EXPORT@30..44 + 0: JS_DECORATOR_LIST@30..30 + 1: EXPORT_KW@30..38 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_ASSIGNMENT_CLAUSE@38..44 + 0: EQ@38..40 "=" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@40..43 + 0: JS_IDENTIFIER_EXPRESSION@40..41 + 0: JS_REFERENCE_IDENTIFIER@40..41 + 0: IDENT@40..41 "a" [] [] + 1: DOT@41..42 "." [] [] + 2: JS_NAME@42..43 + 0: IDENT@42..43 "b" [] [] + 2: SEMICOLON@43..44 ";" [] [] + 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_declare.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts.snap new file mode 100644 index 000000000000..bea12e8a50f4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts.snap @@ -0,0 +1,260 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export declare const a: string; +export declare interface A {} +export declare enum B {} +export declare type C = string; +export declare class D {} +export declare function e() + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: TsExportDeclareClause { + declare_token: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@15..21 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@21..22 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@22..24 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@24..30 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportDeclareClause { + declare_token: DECLARE_KW@39..47 "declare" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@47..57 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@57..59 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@59..60 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportDeclareClause { + declare_token: DECLARE_KW@69..77 "declare" [] [Whitespace(" ")], + declaration: TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@77..82 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@82..84 "B" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@84..85 "{" [] [], + members: TsEnumMemberList [], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportDeclareClause { + declare_token: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")], + declaration: TsTypeAliasDeclaration { + type_token: TYPE_KW@102..107 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@107..109 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@109..111 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@111..117 "string" [] [], + }, + semicolon_token: SEMICOLON@117..118 ";" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@118..126 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportDeclareClause { + declare_token: DECLARE_KW@126..134 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@134..140 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@140..142 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@142..143 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@143..144 "}" [] [], + }, + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@144..152 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportDeclareClause { + declare_token: DECLARE_KW@152..160 "declare" [] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@160..169 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@169..170 "e" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@170..171 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@171..172 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + }, + ], + eof_token: EOF@172..173 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..173 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..172 + 0: JS_EXPORT@0..31 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: TS_EXPORT_DECLARE_CLAUSE@7..31 + 0: DECLARE_KW@7..15 "declare" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@15..31 + 0: JS_VARIABLE_DECLARATION@15..30 + 0: (empty) + 1: CONST_KW@15..21 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@21..30 + 0: JS_VARIABLE_DECLARATOR@21..30 + 0: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "a" [] [] + 1: TS_TYPE_ANNOTATION@22..30 + 0: COLON@22..24 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@24..30 + 0: STRING_KW@24..30 "string" [] [] + 2: (empty) + 1: SEMICOLON@30..31 ";" [] [] + 1: JS_EXPORT@31..61 + 0: JS_DECORATOR_LIST@31..31 + 1: EXPORT_KW@31..39 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_DECLARE_CLAUSE@39..61 + 0: DECLARE_KW@39..47 "declare" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@47..61 + 0: INTERFACE_KW@47..57 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@57..59 + 0: IDENT@57..59 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@59..60 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@60..60 + 6: R_CURLY@60..61 "}" [] [] + 2: JS_EXPORT@61..86 + 0: JS_DECORATOR_LIST@61..61 + 1: EXPORT_KW@61..69 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_DECLARE_CLAUSE@69..86 + 0: DECLARE_KW@69..77 "declare" [] [Whitespace(" ")] + 1: TS_ENUM_DECLARATION@77..86 + 0: (empty) + 1: ENUM_KW@77..82 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@82..84 + 0: IDENT@82..84 "B" [] [Whitespace(" ")] + 3: L_CURLY@84..85 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@85..85 + 5: R_CURLY@85..86 "}" [] [] + 3: JS_EXPORT@86..118 + 0: JS_DECORATOR_LIST@86..86 + 1: EXPORT_KW@86..94 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_DECLARE_CLAUSE@94..118 + 0: DECLARE_KW@94..102 "declare" [] [Whitespace(" ")] + 1: TS_TYPE_ALIAS_DECLARATION@102..118 + 0: TYPE_KW@102..107 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@107..109 + 0: IDENT@107..109 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@109..111 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@111..117 + 0: STRING_KW@111..117 "string" [] [] + 5: SEMICOLON@117..118 ";" [] [] + 4: JS_EXPORT@118..144 + 0: JS_DECORATOR_LIST@118..118 + 1: EXPORT_KW@118..126 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_DECLARE_CLAUSE@126..144 + 0: DECLARE_KW@126..134 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@134..144 + 0: JS_DECORATOR_LIST@134..134 + 1: (empty) + 2: CLASS_KW@134..140 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@140..142 + 0: IDENT@140..142 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@142..143 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@143..143 + 9: R_CURLY@143..144 "}" [] [] + 5: JS_EXPORT@144..172 + 0: JS_DECORATOR_LIST@144..144 + 1: EXPORT_KW@144..152 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_DECLARE_CLAUSE@152..172 + 0: DECLARE_KW@152..160 "declare" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@160..172 + 0: (empty) + 1: FUNCTION_KW@160..169 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@169..170 + 0: IDENT@169..170 "e" [] [] + 3: (empty) + 4: JS_PARAMETERS@170..172 + 0: L_PAREN@170..171 "(" [] [] + 1: JS_PARAMETER_LIST@171..171 + 2: R_PAREN@171..172 ")" [] [] + 5: (empty) + 6: (empty) + 4: EOF@172..173 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap new file mode 100644 index 000000000000..93dfead0b59f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap @@ -0,0 +1,224 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default function test(a: string): string; +export default function test(a: string | undefined): string { return "hello" } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: TsDeclareFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@24..28 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@28..29 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@29..30 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@30..32 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@32..38 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@38..39 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@39..41 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@41..47 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@56..64 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@73..77 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@77..78 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@78..79 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@79..81 ":" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@81..88 "string" [] [Whitespace(" ")], + }, + PIPE@88..90 "|" [] [Whitespace(" ")], + TsUndefinedType { + undefined_token: UNDEFINED_KW@90..99 "undefined" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@99..100 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@100..102 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@102..109 "string" [] [Whitespace(" ")], + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@109..111 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@111..118 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@118..126 "\"hello\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@126..127 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@127..128 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..128 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..127 + 0: JS_EXPORT@0..48 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..48 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..48 + 0: (empty) + 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@24..28 + 0: IDENT@24..28 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@28..39 + 0: L_PAREN@28..29 "(" [] [] + 1: JS_PARAMETER_LIST@29..38 + 0: JS_FORMAL_PARAMETER@29..38 + 0: JS_DECORATOR_LIST@29..29 + 1: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@30..38 + 0: COLON@30..32 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@32..38 + 0: STRING_KW@32..38 "string" [] [] + 4: (empty) + 2: R_PAREN@38..39 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@39..47 + 0: COLON@39..41 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@41..47 + 0: STRING_KW@41..47 "string" [] [] + 6: SEMICOLON@47..48 ";" [] [] + 2: (empty) + 1: JS_EXPORT@48..127 + 0: JS_DECORATOR_LIST@48..48 + 1: EXPORT_KW@48..56 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@56..127 + 0: DEFAULT_KW@56..64 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@64..127 + 0: (empty) + 1: FUNCTION_KW@64..73 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@73..77 + 0: IDENT@73..77 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@77..100 + 0: L_PAREN@77..78 "(" [] [] + 1: JS_PARAMETER_LIST@78..99 + 0: JS_FORMAL_PARAMETER@78..99 + 0: JS_DECORATOR_LIST@78..78 + 1: JS_IDENTIFIER_BINDING@78..79 + 0: IDENT@78..79 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@79..99 + 0: COLON@79..81 ":" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@81..99 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@81..99 + 0: TS_STRING_TYPE@81..88 + 0: STRING_KW@81..88 "string" [] [Whitespace(" ")] + 1: PIPE@88..90 "|" [] [Whitespace(" ")] + 2: TS_UNDEFINED_TYPE@90..99 + 0: UNDEFINED_KW@90..99 "undefined" [] [] + 4: (empty) + 2: R_PAREN@99..100 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@100..109 + 0: COLON@100..102 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@102..109 + 0: STRING_KW@102..109 "string" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@109..127 + 0: L_CURLY@109..111 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@111..111 + 2: JS_STATEMENT_LIST@111..126 + 0: JS_RETURN_STATEMENT@111..126 + 0: RETURN_KW@111..118 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@118..126 + 0: JS_STRING_LITERAL@118..126 "\"hello\"" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@126..127 "}" [] [] + 2: (empty) + 4: EOF@127..128 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts.snap new file mode 100644 index 000000000000..6520430aa7dd --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts.snap @@ -0,0 +1,70 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@25..27 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@29..30 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@30..31 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..31 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..30 + 0: JS_EXPORT@0..30 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..30 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@15..30 + 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@29..29 + 6: R_CURLY@29..30 "}" [] [] + 2: (empty) + 4: EOF@30..31 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap new file mode 100644 index 000000000000..182b65c7ca29 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap @@ -0,0 +1,208 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A { a: string; } +export default interface B { a: string } +export default function test() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@25..27 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@29..30 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@30..32 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@32..38 "string" [] [], + }, + }, + separator_token: SEMICOLON@38..40 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@57..67 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@67..69 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@69..71 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@71..72 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@72..74 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@74..81 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@81..82 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@82..90 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@90..98 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@98..107 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@107..111 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@111..112 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@112..114 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@114..115 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@115..116 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@116..117 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..117 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..116 + 0: JS_EXPORT@0..41 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..41 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@15..41 + 0: INTERFACE_KW@15..25 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@29..40 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@29..40 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@29..30 + 0: IDENT@29..30 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@30..38 + 0: COLON@30..32 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@32..38 + 0: STRING_KW@32..38 "string" [] [] + 4: SEMICOLON@38..40 ";" [] [Whitespace(" ")] + 6: R_CURLY@40..41 "}" [] [] + 2: (empty) + 1: JS_EXPORT@41..82 + 0: JS_DECORATOR_LIST@41..41 + 1: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@49..82 + 0: DEFAULT_KW@49..57 "default" [] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@57..82 + 0: INTERFACE_KW@57..67 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@67..69 + 0: IDENT@67..69 "B" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@69..71 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@71..81 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@71..81 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@71..72 + 0: IDENT@71..72 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@72..81 + 0: COLON@72..74 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@74..81 + 0: STRING_KW@74..81 "string" [] [Whitespace(" ")] + 4: (empty) + 6: R_CURLY@81..82 "}" [] [] + 2: (empty) + 2: JS_EXPORT@82..116 + 0: JS_DECORATOR_LIST@82..82 + 1: EXPORT_KW@82..90 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@90..116 + 0: DEFAULT_KW@90..98 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@98..116 + 0: (empty) + 1: FUNCTION_KW@98..107 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@107..111 + 0: IDENT@107..111 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@111..114 + 0: L_PAREN@111..112 "(" [] [] + 1: JS_PARAMETER_LIST@112..112 + 2: R_PAREN@112..114 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@114..116 + 0: L_CURLY@114..115 "{" [] [] + 1: JS_DIRECTIVE_LIST@115..115 + 2: JS_STATEMENT_LIST@115..115 + 3: R_CURLY@115..116 "}" [] [] + 2: (empty) + 4: EOF@116..117 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap new file mode 100644 index 000000000000..6478a43b4302 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap @@ -0,0 +1,133 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export enum A { X, Y } +export const enum B { X, Y } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@7..12 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@12..14 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@14..16 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@16..17 "X" [] [], + }, + initializer: missing (optional), + }, + COMMA@17..19 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@19..21 "Y" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@22..30 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsEnumDeclaration { + const_token: CONST_KW@30..36 "const" [] [Whitespace(" ")], + enum_token: ENUM_KW@36..41 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@41..43 "B" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@45..46 "X" [] [], + }, + initializer: missing (optional), + }, + COMMA@46..48 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@48..50 "Y" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + }, + ], + eof_token: EOF@51..52 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..52 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..51 + 0: JS_EXPORT@0..22 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: TS_ENUM_DECLARATION@7..22 + 0: (empty) + 1: ENUM_KW@7..12 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@12..14 + 0: IDENT@12..14 "A" [] [Whitespace(" ")] + 3: L_CURLY@14..16 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@16..21 + 0: TS_ENUM_MEMBER@16..17 + 0: TS_LITERAL_ENUM_MEMBER_NAME@16..17 + 0: IDENT@16..17 "X" [] [] + 1: (empty) + 1: COMMA@17..19 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@19..21 + 0: TS_LITERAL_ENUM_MEMBER_NAME@19..21 + 0: IDENT@19..21 "Y" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@21..22 "}" [] [] + 1: JS_EXPORT@22..51 + 0: JS_DECORATOR_LIST@22..22 + 1: EXPORT_KW@22..30 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_ENUM_DECLARATION@30..51 + 0: CONST_KW@30..36 "const" [] [Whitespace(" ")] + 1: ENUM_KW@36..41 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@41..43 + 0: IDENT@41..43 "B" [] [Whitespace(" ")] + 3: L_CURLY@43..45 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@45..50 + 0: TS_ENUM_MEMBER@45..46 + 0: TS_LITERAL_ENUM_MEMBER_NAME@45..46 + 0: IDENT@45..46 "X" [] [] + 1: (empty) + 1: COMMA@46..48 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@48..50 + 0: TS_LITERAL_ENUM_MEMBER_NAME@48..50 + 0: IDENT@48..50 "Y" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@50..51 "}" [] [] + 4: EOF@51..52 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts.snap new file mode 100644 index 000000000000..2758391c5826 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts.snap @@ -0,0 +1,210 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export function test(a: string): string; +export function test(a: string | undefined): string { return "hello" } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..20 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@21..22 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@22..24 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@24..30 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@30..31 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@33..39 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@39..40 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@40..48 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@48..57 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@57..61 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@61..62 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@62..63 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@63..65 ":" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@65..72 "string" [] [Whitespace(" ")], + }, + PIPE@72..74 "|" [] [Whitespace(" ")], + TsUndefinedType { + undefined_token: UNDEFINED_KW@74..83 "undefined" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@83..84 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@84..86 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@86..93 "string" [] [Whitespace(" ")], + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@95..102 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@102..110 "\"hello\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@111..112 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..112 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..111 + 0: JS_EXPORT@0..40 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: TS_DECLARE_FUNCTION_DECLARATION@7..40 + 0: (empty) + 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@16..20 + 0: IDENT@16..20 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@20..31 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..30 + 0: JS_FORMAL_PARAMETER@21..30 + 0: JS_DECORATOR_LIST@21..21 + 1: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@22..30 + 0: COLON@22..24 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@24..30 + 0: STRING_KW@24..30 "string" [] [] + 4: (empty) + 2: R_PAREN@30..31 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@31..39 + 0: COLON@31..33 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@33..39 + 0: STRING_KW@33..39 "string" [] [] + 6: SEMICOLON@39..40 ";" [] [] + 1: JS_EXPORT@40..111 + 0: JS_DECORATOR_LIST@40..40 + 1: EXPORT_KW@40..48 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_FUNCTION_DECLARATION@48..111 + 0: (empty) + 1: FUNCTION_KW@48..57 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@57..61 + 0: IDENT@57..61 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@61..84 + 0: L_PAREN@61..62 "(" [] [] + 1: JS_PARAMETER_LIST@62..83 + 0: JS_FORMAL_PARAMETER@62..83 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_IDENTIFIER_BINDING@62..63 + 0: IDENT@62..63 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@63..83 + 0: COLON@63..65 ":" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@65..83 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@65..83 + 0: TS_STRING_TYPE@65..72 + 0: STRING_KW@65..72 "string" [] [Whitespace(" ")] + 1: PIPE@72..74 "|" [] [Whitespace(" ")] + 2: TS_UNDEFINED_TYPE@74..83 + 0: UNDEFINED_KW@74..83 "undefined" [] [] + 4: (empty) + 2: R_PAREN@83..84 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@84..93 + 0: COLON@84..86 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@86..93 + 0: STRING_KW@86..93 "string" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@93..111 + 0: L_CURLY@93..95 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@95..95 + 2: JS_STATEMENT_LIST@95..110 + 0: JS_RETURN_STATEMENT@95..110 + 0: RETURN_KW@95..102 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@102..110 + 0: JS_STRING_LITERAL@102..110 "\"hello\"" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@110..111 "}" [] [] + 4: EOF@111..112 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap new file mode 100644 index 000000000000..c2ac31311be7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap @@ -0,0 +1,63 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export interface A {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@7..17 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@17..19 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@19..20 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + ], + eof_token: EOF@21..22 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..22 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..21 + 0: JS_EXPORT@0..21 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: TS_INTERFACE_DECLARATION@7..21 + 0: INTERFACE_KW@7..17 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@17..19 + 0: IDENT@17..19 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@19..20 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@20..20 + 6: R_CURLY@20..21 "}" [] [] + 4: EOF@21..22 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap new file mode 100644 index 000000000000..f02e511d996e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap @@ -0,0 +1,121 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export { type A } from "a" +export { type } from "./type"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: TYPE_KW@9..14 "type" [] [Whitespace(" ")], + source_name: JsLiteralExportName { + value: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@16..18 "}" [] [Whitespace(" ")], + from_token: FROM_KW@18..23 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@23..26 "\"a\"" [] [], + }, + assertion: missing (optional), + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: missing (optional), + l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@36..41 "type" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@41..43 "}" [] [Whitespace(" ")], + from_token: FROM_KW@43..48 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@48..56 "\"./type\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@56..57 ";" [] [], + }, + }, + ], + eof_token: EOF@57..58 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..58 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..57 + 0: JS_EXPORT@0..26 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..26 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@9..16 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@9..16 + 0: TYPE_KW@9..14 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@16..18 "}" [] [Whitespace(" ")] + 4: FROM_KW@18..23 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@23..26 + 0: JS_STRING_LITERAL@23..26 "\"a\"" [] [] + 6: (empty) + 7: (empty) + 1: JS_EXPORT@26..57 + 0: JS_DECORATOR_LIST@26..26 + 1: EXPORT_KW@26..34 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@34..57 + 0: (empty) + 1: L_CURLY@34..36 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@36..41 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@36..41 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@36..41 + 0: IDENT@36..41 "type" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@41..43 "}" [] [Whitespace(" ")] + 4: FROM_KW@43..48 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@48..56 + 0: JS_STRING_LITERAL@48..56 "\"./type\"" [] [] + 6: (empty) + 7: SEMICOLON@56..57 ";" [] [] + 4: EOF@57..58 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap new file mode 100644 index 000000000000..d8022abc85be --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap @@ -0,0 +1,138 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export { type } +export { type type } +export { type as somethingElse } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@9..14 "type" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@14..15 "}" [] [], + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@15..23 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@23..25 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: TYPE_KW@25..30 "type" [] [Whitespace(" ")], + name: JsReferenceIdentifier { + value_token: IDENT@30..35 "type" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@35..36 "}" [] [], + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@46..51 "type" [] [Whitespace(" ")], + }, + as_token: AS_KW@51..54 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@54..68 "somethingElse" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@68..69 "}" [] [], + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@69..70 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..70 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..69 + 0: JS_EXPORT@0..15 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@7..15 + 0: (empty) + 1: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@9..14 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@9..14 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@9..14 + 0: IDENT@9..14 "type" [] [Whitespace(" ")] + 3: R_CURLY@14..15 "}" [] [] + 4: (empty) + 1: JS_EXPORT@15..36 + 0: JS_DECORATOR_LIST@15..15 + 1: EXPORT_KW@15..23 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@23..36 + 0: (empty) + 1: L_CURLY@23..25 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@25..35 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@25..35 + 0: TYPE_KW@25..30 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@30..35 + 0: IDENT@30..35 "type" [] [Whitespace(" ")] + 3: R_CURLY@35..36 "}" [] [] + 4: (empty) + 2: JS_EXPORT@36..69 + 0: JS_DECORATOR_LIST@36..36 + 1: EXPORT_KW@36..44 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@44..69 + 0: (empty) + 1: L_CURLY@44..46 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@46..68 + 0: JS_EXPORT_NAMED_SPECIFIER@46..68 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@46..51 + 0: IDENT@46..51 "type" [] [Whitespace(" ")] + 2: AS_KW@51..54 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@54..68 + 0: IDENT@54..68 "somethingElse" [] [Whitespace(" ")] + 3: R_CURLY@68..69 "}" [] [] + 4: (empty) + 4: EOF@69..70 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap new file mode 100644 index 000000000000..17359a321538 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap @@ -0,0 +1,125 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export function isPrime(x: number): boolean; +export as namespace mathLib; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..23 "isPrime" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@23..24 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..25 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@27..33 "number" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@33..34 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: TsBooleanType { + boolean_token: BOOLEAN_KW@36..43 "boolean" [] [], + }, + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@44..52 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsExportAsNamespaceClause { + as_token: AS_KW@52..55 "as" [] [Whitespace(" ")], + namespace_token: NAMESPACE_KW@55..65 "namespace" [] [Whitespace(" ")], + name: JsName { + value_token: IDENT@65..72 "mathLib" [] [], + }, + semicolon_token: SEMICOLON@72..73 ";" [] [], + }, + }, + ], + eof_token: EOF@73..74 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..74 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..73 + 0: JS_EXPORT@0..44 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: TS_DECLARE_FUNCTION_DECLARATION@7..44 + 0: (empty) + 1: FUNCTION_KW@7..16 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@16..23 + 0: IDENT@16..23 "isPrime" [] [] + 3: (empty) + 4: JS_PARAMETERS@23..34 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_PARAMETER_LIST@24..33 + 0: JS_FORMAL_PARAMETER@24..33 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@25..33 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@27..33 + 0: NUMBER_KW@27..33 "number" [] [] + 4: (empty) + 2: R_PAREN@33..34 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@34..43 + 0: COLON@34..36 ":" [] [Whitespace(" ")] + 1: TS_BOOLEAN_TYPE@36..43 + 0: BOOLEAN_KW@36..43 "boolean" [] [] + 6: SEMICOLON@43..44 ";" [] [] + 1: JS_EXPORT@44..73 + 0: JS_DECORATOR_LIST@44..44 + 1: EXPORT_KW@44..52 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_EXPORT_AS_NAMESPACE_CLAUSE@52..73 + 0: AS_KW@52..55 "as" [] [Whitespace(" ")] + 1: NAMESPACE_KW@55..65 "namespace" [] [Whitespace(" ")] + 2: JS_NAME@65..72 + 0: IDENT@65..72 "mathLib" [] [] + 3: SEMICOLON@72..73 ";" [] [] + 4: EOF@73..74 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts.snap new file mode 100644 index 000000000000..b6d3396f6df2 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string; +export type { A }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@9..15 "string" [] [], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: TYPE_KW@24..29 "type" [] [Whitespace(" ")], + l_curly_token: L_CURLY@29..31 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@31..33 "A" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@33..34 "}" [] [], + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: TS_TYPE_ALIAS_DECLARATION@0..16 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@9..15 + 0: STRING_KW@9..15 "string" [] [] + 5: SEMICOLON@15..16 ";" [] [] + 1: JS_EXPORT@16..35 + 0: JS_DECORATOR_LIST@16..16 + 1: EXPORT_KW@16..24 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@24..35 + 0: TYPE_KW@24..29 "type" [] [Whitespace(" ")] + 1: L_CURLY@29..31 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@31..33 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@31..33 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@31..33 + 0: IDENT@31..33 "A" [] [Whitespace(" ")] + 3: R_CURLY@33..34 "}" [] [] + 4: SEMICOLON@34..35 ";" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts.snap new file mode 100644 index 000000000000..77fc1323949d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts.snap @@ -0,0 +1,78 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export type { A } from "a"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportNamedFromClause { + type_token: TYPE_KW@7..12 "type" [] [Whitespace(" ")], + l_curly_token: L_CURLY@12..14 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedFromSpecifierList [ + JsExportNamedFromSpecifier { + type_token: missing (optional), + source_name: JsLiteralExportName { + value: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + export_as: missing (optional), + }, + ], + r_curly_token: R_CURLY@16..18 "}" [] [Whitespace(" ")], + from_token: FROM_KW@18..23 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@23..26 "\"a\"" [] [], + }, + assertion: missing (optional), + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: JS_EXPORT@0..27 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_CLAUSE@7..27 + 0: TYPE_KW@7..12 "type" [] [Whitespace(" ")] + 1: L_CURLY@12..14 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_FROM_SPECIFIER_LIST@14..16 + 0: JS_EXPORT_NAMED_FROM_SPECIFIER@14..16 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@16..18 "}" [] [Whitespace(" ")] + 4: FROM_KW@18..23 "from" [] [Whitespace(" ")] + 5: JS_MODULE_SOURCE@23..26 + 0: JS_STRING_LITERAL@23..26 "\"a\"" [] [] + 6: (empty) + 7: SEMICOLON@26..27 ";" [] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts.snap new file mode 100644 index 000000000000..c630dc67a1f1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts.snap @@ -0,0 +1,371 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let as; +let type; +let a; +export { type }; +export { type as as }; +export { as as as }; +export { type as as as } +export { type type }; +export { type as }; +export { type a as aa }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "as" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@6..7 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@7..12 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@12..16 "type" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@16..17 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@22..23 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@24..32 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@32..34 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: missing (optional), + name: JsReferenceIdentifier { + value_token: IDENT@34..39 "type" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@39..40 "}" [] [], + semicolon_token: SEMICOLON@40..41 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@49..51 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@51..56 "type" [] [Whitespace(" ")], + }, + as_token: AS_KW@56..59 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@59..62 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@62..63 "}" [] [], + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@72..74 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: missing (optional), + local_name: JsReferenceIdentifier { + value_token: IDENT@74..77 "as" [] [Whitespace(" ")], + }, + as_token: AS_KW@77..80 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@80..83 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@83..84 "}" [] [], + semicolon_token: SEMICOLON@84..85 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@93..95 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: TYPE_KW@95..100 "type" [] [Whitespace(" ")], + local_name: JsReferenceIdentifier { + value_token: IDENT@100..103 "as" [] [Whitespace(" ")], + }, + as_token: AS_KW@103..106 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@106..109 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@109..110 "}" [] [], + semicolon_token: missing (optional), + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@110..118 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: TYPE_KW@120..125 "type" [] [Whitespace(" ")], + name: JsReferenceIdentifier { + value_token: IDENT@125..130 "type" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@130..131 "}" [] [], + semicolon_token: SEMICOLON@131..132 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@132..140 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@140..142 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedShorthandSpecifier { + type_token: TYPE_KW@142..147 "type" [] [Whitespace(" ")], + name: JsReferenceIdentifier { + value_token: IDENT@147..150 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@150..151 "}" [] [], + semicolon_token: SEMICOLON@151..152 ";" [] [], + }, + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@152..160 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportNamedClause { + type_token: missing (optional), + l_curly_token: L_CURLY@160..162 "{" [] [Whitespace(" ")], + specifiers: JsExportNamedSpecifierList [ + JsExportNamedSpecifier { + type_token: TYPE_KW@162..167 "type" [] [Whitespace(" ")], + local_name: JsReferenceIdentifier { + value_token: IDENT@167..169 "a" [] [Whitespace(" ")], + }, + as_token: AS_KW@169..172 "as" [] [Whitespace(" ")], + exported_name: JsLiteralExportName { + value: IDENT@172..175 "aa" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@175..176 "}" [] [], + semicolon_token: SEMICOLON@176..177 ";" [] [], + }, + }, + ], + eof_token: EOF@177..178 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..178 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..177 + 0: JS_VARIABLE_STATEMENT@0..7 + 0: JS_VARIABLE_DECLARATION@0..6 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..6 + 0: JS_VARIABLE_DECLARATOR@4..6 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "as" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@6..7 ";" [] [] + 1: JS_VARIABLE_STATEMENT@7..17 + 0: JS_VARIABLE_DECLARATION@7..16 + 0: (empty) + 1: LET_KW@7..12 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@12..16 + 0: JS_VARIABLE_DECLARATOR@12..16 + 0: JS_IDENTIFIER_BINDING@12..16 + 0: IDENT@12..16 "type" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@16..17 ";" [] [] + 2: JS_VARIABLE_STATEMENT@17..24 + 0: JS_VARIABLE_DECLARATION@17..23 + 0: (empty) + 1: LET_KW@17..22 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@22..23 + 0: JS_VARIABLE_DECLARATOR@22..23 + 0: JS_IDENTIFIER_BINDING@22..23 + 0: IDENT@22..23 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@23..24 ";" [] [] + 3: JS_EXPORT@24..41 + 0: JS_DECORATOR_LIST@24..24 + 1: EXPORT_KW@24..32 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@32..41 + 0: (empty) + 1: L_CURLY@32..34 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@34..39 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@34..39 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@34..39 + 0: IDENT@34..39 "type" [] [Whitespace(" ")] + 3: R_CURLY@39..40 "}" [] [] + 4: SEMICOLON@40..41 ";" [] [] + 4: JS_EXPORT@41..64 + 0: JS_DECORATOR_LIST@41..41 + 1: EXPORT_KW@41..49 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@49..64 + 0: (empty) + 1: L_CURLY@49..51 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@51..62 + 0: JS_EXPORT_NAMED_SPECIFIER@51..62 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@51..56 + 0: IDENT@51..56 "type" [] [Whitespace(" ")] + 2: AS_KW@56..59 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@59..62 + 0: IDENT@59..62 "as" [] [Whitespace(" ")] + 3: R_CURLY@62..63 "}" [] [] + 4: SEMICOLON@63..64 ";" [] [] + 5: JS_EXPORT@64..85 + 0: JS_DECORATOR_LIST@64..64 + 1: EXPORT_KW@64..72 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@72..85 + 0: (empty) + 1: L_CURLY@72..74 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@74..83 + 0: JS_EXPORT_NAMED_SPECIFIER@74..83 + 0: (empty) + 1: JS_REFERENCE_IDENTIFIER@74..77 + 0: IDENT@74..77 "as" [] [Whitespace(" ")] + 2: AS_KW@77..80 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@80..83 + 0: IDENT@80..83 "as" [] [Whitespace(" ")] + 3: R_CURLY@83..84 "}" [] [] + 4: SEMICOLON@84..85 ";" [] [] + 6: JS_EXPORT@85..110 + 0: JS_DECORATOR_LIST@85..85 + 1: EXPORT_KW@85..93 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@93..110 + 0: (empty) + 1: L_CURLY@93..95 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@95..109 + 0: JS_EXPORT_NAMED_SPECIFIER@95..109 + 0: TYPE_KW@95..100 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@100..103 + 0: IDENT@100..103 "as" [] [Whitespace(" ")] + 2: AS_KW@103..106 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@106..109 + 0: IDENT@106..109 "as" [] [Whitespace(" ")] + 3: R_CURLY@109..110 "}" [] [] + 4: (empty) + 7: JS_EXPORT@110..132 + 0: JS_DECORATOR_LIST@110..110 + 1: EXPORT_KW@110..118 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@118..132 + 0: (empty) + 1: L_CURLY@118..120 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@120..130 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@120..130 + 0: TYPE_KW@120..125 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@125..130 + 0: IDENT@125..130 "type" [] [Whitespace(" ")] + 3: R_CURLY@130..131 "}" [] [] + 4: SEMICOLON@131..132 ";" [] [] + 8: JS_EXPORT@132..152 + 0: JS_DECORATOR_LIST@132..132 + 1: EXPORT_KW@132..140 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@140..152 + 0: (empty) + 1: L_CURLY@140..142 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@142..150 + 0: JS_EXPORT_NAMED_SHORTHAND_SPECIFIER@142..150 + 0: TYPE_KW@142..147 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@147..150 + 0: IDENT@147..150 "as" [] [Whitespace(" ")] + 3: R_CURLY@150..151 "}" [] [] + 4: SEMICOLON@151..152 ";" [] [] + 9: JS_EXPORT@152..177 + 0: JS_DECORATOR_LIST@152..152 + 1: EXPORT_KW@152..160 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_CLAUSE@160..177 + 0: (empty) + 1: L_CURLY@160..162 "{" [] [Whitespace(" ")] + 2: JS_EXPORT_NAMED_SPECIFIER_LIST@162..175 + 0: JS_EXPORT_NAMED_SPECIFIER@162..175 + 0: TYPE_KW@162..167 "type" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@167..169 + 0: IDENT@167..169 "a" [] [Whitespace(" ")] + 2: AS_KW@169..172 "as" [] [Whitespace(" ")] + 3: JS_LITERAL_EXPORT_NAME@172..175 + 0: IDENT@172..175 "aa" [] [Whitespace(" ")] + 3: R_CURLY@175..176 "}" [] [] + 4: SEMICOLON@176..177 ";" [] [] + 4: EOF@177..178 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts.snap new file mode 100644 index 000000000000..c813b0a17511 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts.snap @@ -0,0 +1,142 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type IHasVisualizationModel = string; +class D extends C { + x = "string"; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..28 "IHasVisualizationModel" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@30..36 "string" [] [], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@44..46 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: JsExtendsClause { + extends_token: EXTENDS_KW@46..54 "extends" [] [Whitespace(" ")], + super_class: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@54..55 "C" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@55..56 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@56..78 "IHasVisualizationModel" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@78..80 ">" [] [Whitespace(" ")], + }, + }, + implements_clause: missing (optional), + l_curly_token: L_CURLY@80..81 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@81..88 "x" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@88..90 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@90..98 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@98..99 ";" [] [], + }, + ], + r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@101..102 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..102 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..101 + 0: TS_TYPE_ALIAS_DECLARATION@0..37 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..28 + 0: IDENT@5..28 "IHasVisualizationModel" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@28..30 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@30..36 + 0: STRING_KW@30..36 "string" [] [] + 5: SEMICOLON@36..37 ";" [] [] + 1: JS_CLASS_DECLARATION@37..101 + 0: JS_DECORATOR_LIST@37..37 + 1: (empty) + 2: CLASS_KW@37..44 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@44..46 + 0: IDENT@44..46 "D" [] [Whitespace(" ")] + 4: (empty) + 5: JS_EXTENDS_CLAUSE@46..80 + 0: EXTENDS_KW@46..54 "extends" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@54..55 + 0: JS_REFERENCE_IDENTIFIER@54..55 + 0: IDENT@54..55 "C" [] [] + 2: TS_TYPE_ARGUMENTS@55..80 + 0: L_ANGLE@55..56 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@56..78 + 0: TS_REFERENCE_TYPE@56..78 + 0: JS_REFERENCE_IDENTIFIER@56..78 + 0: IDENT@56..78 "IHasVisualizationModel" [] [] + 1: (empty) + 2: R_ANGLE@78..80 ">" [] [Whitespace(" ")] + 6: (empty) + 7: L_CURLY@80..81 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@81..99 + 0: JS_PROPERTY_CLASS_MEMBER@81..99 + 0: JS_PROPERTY_MODIFIER_LIST@81..81 + 1: JS_LITERAL_MEMBER_NAME@81..88 + 0: IDENT@81..88 "x" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@88..98 + 0: EQ@88..90 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@90..98 + 0: JS_STRING_LITERAL@90..98 "\"string\"" [] [] + 4: SEMICOLON@98..99 ";" [] [] + 9: R_CURLY@99..101 "}" [Newline("\n")] [] + 4: EOF@101..102 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts.snap new file mode 100644 index 000000000000..34a1c989b60b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts.snap @@ -0,0 +1,99 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module "a"; +declare module "b" +declare module "import" {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@15..18 "\"a\"" [] [], + }, + body: TsEmptyExternalModuleDeclarationBody { + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@28..35 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@35..38 "\"b\"" [] [], + }, + body: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@38..47 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@47..54 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@54..63 "\"import\"" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@63..64 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@64..65 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@65..66 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..66 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..65 + 0: TS_DECLARE_STATEMENT@0..19 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@8..19 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@15..18 + 0: JS_STRING_LITERAL@15..18 "\"a\"" [] [] + 2: TS_EMPTY_EXTERNAL_MODULE_DECLARATION_BODY@18..19 + 0: SEMICOLON@18..19 ";" [] [] + 1: TS_DECLARE_STATEMENT@19..38 + 0: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@28..38 + 0: MODULE_KW@28..35 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@35..38 + 0: JS_STRING_LITERAL@35..38 "\"b\"" [] [] + 2: (empty) + 2: TS_DECLARE_STATEMENT@38..65 + 0: DECLARE_KW@38..47 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@47..65 + 0: MODULE_KW@47..54 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@54..63 + 0: JS_STRING_LITERAL@54..63 "\"import\"" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@63..65 + 0: L_CURLY@63..64 "{" [] [] + 1: JS_MODULE_ITEM_LIST@64..64 + 2: R_CURLY@64..65 "}" [] [] + 4: EOF@65..66 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts.snap new file mode 100644 index 000000000000..b5278dd8a258 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts.snap @@ -0,0 +1,310 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(x) {} +function b({ x, y } = {}) {} +function c(x: string, y?: number, z: string = "test") {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@11..12 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@12..14 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@14..15 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@15..16 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@16..26 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@26..27 "b" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@27..28 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@28..30 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@30..31 "x" [] [], + }, + init: missing (optional), + }, + COMMA@31..33 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@33..35 "y" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@35..37 "}" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@37..39 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@39..40 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@43..44 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@44..45 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@45..55 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@55..56 "c" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@56..57 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@57..58 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@58..60 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@60..66 "string" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@66..68 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@68..69 "y" [] [], + }, + question_mark_token: QUESTION@69..70 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@70..72 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@72..78 "number" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@78..80 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@80..81 "z" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@81..83 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@83..90 "string" [] [Whitespace(" ")], + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@90..92 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@92..98 "\"test\"" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@100..101 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + }, + ], + eof_token: EOF@102..103 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..103 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..102 + 0: JS_FUNCTION_DECLARATION@0..16 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..14 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..12 + 0: JS_FORMAL_PARAMETER@11..12 + 0: JS_DECORATOR_LIST@11..11 + 1: JS_IDENTIFIER_BINDING@11..12 + 0: IDENT@11..12 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@12..14 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@14..16 + 0: L_CURLY@14..15 "{" [] [] + 1: JS_DIRECTIVE_LIST@15..15 + 2: JS_STATEMENT_LIST@15..15 + 3: R_CURLY@15..16 "}" [] [] + 1: JS_FUNCTION_DECLARATION@16..45 + 0: (empty) + 1: FUNCTION_KW@16..26 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@26..27 + 0: IDENT@26..27 "b" [] [] + 4: (empty) + 5: JS_PARAMETERS@27..43 + 0: L_PAREN@27..28 "(" [] [] + 1: JS_PARAMETER_LIST@28..41 + 0: JS_FORMAL_PARAMETER@28..41 + 0: JS_DECORATOR_LIST@28..28 + 1: JS_OBJECT_BINDING_PATTERN@28..37 + 0: L_CURLY@28..30 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@30..35 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@30..31 + 0: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "x" [] [] + 1: (empty) + 1: COMMA@31..33 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@33..35 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "y" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@35..37 "}" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@37..41 + 0: EQ@37..39 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@39..41 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@40..40 + 2: R_CURLY@40..41 "}" [] [] + 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@43..45 + 0: L_CURLY@43..44 "{" [] [] + 1: JS_DIRECTIVE_LIST@44..44 + 2: JS_STATEMENT_LIST@44..44 + 3: R_CURLY@44..45 "}" [] [] + 2: JS_FUNCTION_DECLARATION@45..102 + 0: (empty) + 1: FUNCTION_KW@45..55 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@55..56 + 0: IDENT@55..56 "c" [] [] + 4: (empty) + 5: JS_PARAMETERS@56..100 + 0: L_PAREN@56..57 "(" [] [] + 1: JS_PARAMETER_LIST@57..98 + 0: JS_FORMAL_PARAMETER@57..66 + 0: JS_DECORATOR_LIST@57..57 + 1: JS_IDENTIFIER_BINDING@57..58 + 0: IDENT@57..58 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@58..66 + 0: COLON@58..60 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@60..66 + 0: STRING_KW@60..66 "string" [] [] + 4: (empty) + 1: COMMA@66..68 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@68..78 + 0: JS_DECORATOR_LIST@68..68 + 1: JS_IDENTIFIER_BINDING@68..69 + 0: IDENT@68..69 "y" [] [] + 2: QUESTION@69..70 "?" [] [] + 3: TS_TYPE_ANNOTATION@70..78 + 0: COLON@70..72 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@72..78 + 0: NUMBER_KW@72..78 "number" [] [] + 4: (empty) + 3: COMMA@78..80 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@80..98 + 0: JS_DECORATOR_LIST@80..80 + 1: JS_IDENTIFIER_BINDING@80..81 + 0: IDENT@80..81 "z" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@81..90 + 0: COLON@81..83 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@83..90 + 0: STRING_KW@83..90 "string" [] [Whitespace(" ")] + 4: JS_INITIALIZER_CLAUSE@90..98 + 0: EQ@90..92 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@92..98 + 0: JS_STRING_LITERAL@92..98 "\"test\"" [] [] + 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@100..102 + 0: L_CURLY@100..101 "{" [] [] + 1: JS_DIRECTIVE_LIST@101..101 + 2: JS_STATEMENT_LIST@101..101 + 3: R_CURLY@101..102 "}" [] [] + 4: EOF@102..103 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap new file mode 100644 index 000000000000..785ec1fb8c9f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap @@ -0,0 +1,198 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + constructor(@dec x) {} + method(@dec x) {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@10..11 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@26..27 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@27..28 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@28..32 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@32..33 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@33..35 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@35..36 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@47..48 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [ + JsDecorator { + at_token: AT@48..49 "@" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..53 "dec" [] [Whitespace(" ")], + }, + }, + }, + ], + binding: JsIdentifierBinding { + name_token: IDENT@53..54 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@56..57 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@57..58 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@58..60 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@60..61 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..61 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..60 + 0: JS_CLASS_DECLARATION@0..60 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Foo" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@10..11 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@11..58 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@11..37 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@11..11 + 1: JS_LITERAL_MEMBER_NAME@11..26 + 0: IDENT@11..26 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@26..35 + 0: L_PAREN@26..27 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@27..33 + 0: JS_FORMAL_PARAMETER@27..33 + 0: JS_DECORATOR_LIST@27..32 + 0: JS_DECORATOR@27..32 + 0: AT@27..28 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@28..32 + 0: JS_REFERENCE_IDENTIFIER@28..32 + 0: IDENT@28..32 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@32..33 + 0: IDENT@32..33 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@33..35 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@35..37 + 0: L_CURLY@35..36 "{" [] [] + 1: JS_DIRECTIVE_LIST@36..36 + 2: JS_STATEMENT_LIST@36..36 + 3: R_CURLY@36..37 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@37..58 + 0: JS_METHOD_MODIFIER_LIST@37..37 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@37..47 + 0: IDENT@37..47 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@47..56 + 0: L_PAREN@47..48 "(" [] [] + 1: JS_PARAMETER_LIST@48..54 + 0: JS_FORMAL_PARAMETER@48..54 + 0: JS_DECORATOR_LIST@48..53 + 0: JS_DECORATOR@48..53 + 0: AT@48..49 "@" [] [] + 1: JS_IDENTIFIER_EXPRESSION@49..53 + 0: JS_REFERENCE_IDENTIFIER@49..53 + 0: IDENT@49..53 "dec" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@53..54 + 0: IDENT@53..54 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@56..58 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..57 + 3: R_CURLY@57..58 "}" [] [] + 9: R_CURLY@58..60 "}" [Newline("\n")] [] + 4: EOF@60..61 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts.snap new file mode 100644 index 000000000000..4aa44c7874b5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts.snap @@ -0,0 +1,417 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function test(a: string): void; +function test(a: string | undefined): void {} +function no_semi(a: string) +function no_semi(a: string) {} +async function async_overload(a: string) +async function async_overload(a: string) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@9..13 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@15..17 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@17..23 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@23..24 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@26..30 "void" [] [], + }, + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@31..41 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@41..45 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@45..46 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@46..47 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@47..49 ":" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@49..56 "string" [] [Whitespace(" ")], + }, + PIPE@56..58 "|" [] [Whitespace(" ")], + TsUndefinedType { + undefined_token: UNDEFINED_KW@58..67 "undefined" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@67..68 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@68..70 ":" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@70..75 "void" [] [Whitespace(" ")], + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@75..76 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@76..77 "}" [] [], + }, + }, + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@77..87 "function" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@87..94 "no_semi" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@94..95 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@95..96 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@96..98 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@98..104 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@104..105 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@105..115 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@115..122 "no_semi" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@122..123 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@123..124 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@124..126 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@126..132 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@132..134 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@134..135 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@135..136 "}" [] [], + }, + }, + TsDeclareFunctionDeclaration { + async_token: ASYNC_KW@136..143 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@143..152 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@152..166 "async_overload" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@166..167 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@167..168 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@168..170 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@170..176 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@176..177 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: ASYNC_KW@177..184 "async" [Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@184..193 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@193..207 "async_overload" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@207..208 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@208..209 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@209..211 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@211..217 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@217..219 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@219..220 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@220..221 "}" [] [], + }, + }, + ], + eof_token: EOF@221..222 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..222 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..221 + 0: TS_DECLARE_FUNCTION_DECLARATION@0..31 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@9..13 + 0: IDENT@9..13 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@13..24 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..23 + 0: JS_FORMAL_PARAMETER@14..23 + 0: JS_DECORATOR_LIST@14..14 + 1: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@15..23 + 0: COLON@15..17 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@17..23 + 0: STRING_KW@17..23 "string" [] [] + 4: (empty) + 2: R_PAREN@23..24 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@24..30 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@26..30 + 0: VOID_KW@26..30 "void" [] [] + 6: SEMICOLON@30..31 ";" [] [] + 1: JS_FUNCTION_DECLARATION@31..77 + 0: (empty) + 1: FUNCTION_KW@31..41 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@41..45 + 0: IDENT@41..45 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@45..68 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_PARAMETER_LIST@46..67 + 0: JS_FORMAL_PARAMETER@46..67 + 0: JS_DECORATOR_LIST@46..46 + 1: JS_IDENTIFIER_BINDING@46..47 + 0: IDENT@46..47 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@47..67 + 0: COLON@47..49 ":" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@49..67 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@49..67 + 0: TS_STRING_TYPE@49..56 + 0: STRING_KW@49..56 "string" [] [Whitespace(" ")] + 1: PIPE@56..58 "|" [] [Whitespace(" ")] + 2: TS_UNDEFINED_TYPE@58..67 + 0: UNDEFINED_KW@58..67 "undefined" [] [] + 4: (empty) + 2: R_PAREN@67..68 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@68..75 + 0: COLON@68..70 ":" [] [Whitespace(" ")] + 1: TS_VOID_TYPE@70..75 + 0: VOID_KW@70..75 "void" [] [Whitespace(" ")] + 7: JS_FUNCTION_BODY@75..77 + 0: L_CURLY@75..76 "{" [] [] + 1: JS_DIRECTIVE_LIST@76..76 + 2: JS_STATEMENT_LIST@76..76 + 3: R_CURLY@76..77 "}" [] [] + 2: TS_DECLARE_FUNCTION_DECLARATION@77..105 + 0: (empty) + 1: FUNCTION_KW@77..87 "function" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@87..94 + 0: IDENT@87..94 "no_semi" [] [] + 3: (empty) + 4: JS_PARAMETERS@94..105 + 0: L_PAREN@94..95 "(" [] [] + 1: JS_PARAMETER_LIST@95..104 + 0: JS_FORMAL_PARAMETER@95..104 + 0: JS_DECORATOR_LIST@95..95 + 1: JS_IDENTIFIER_BINDING@95..96 + 0: IDENT@95..96 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@96..104 + 0: COLON@96..98 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@98..104 + 0: STRING_KW@98..104 "string" [] [] + 4: (empty) + 2: R_PAREN@104..105 ")" [] [] + 5: (empty) + 6: (empty) + 3: JS_FUNCTION_DECLARATION@105..136 + 0: (empty) + 1: FUNCTION_KW@105..115 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@115..122 + 0: IDENT@115..122 "no_semi" [] [] + 4: (empty) + 5: JS_PARAMETERS@122..134 + 0: L_PAREN@122..123 "(" [] [] + 1: JS_PARAMETER_LIST@123..132 + 0: JS_FORMAL_PARAMETER@123..132 + 0: JS_DECORATOR_LIST@123..123 + 1: JS_IDENTIFIER_BINDING@123..124 + 0: IDENT@123..124 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@124..132 + 0: COLON@124..126 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@126..132 + 0: STRING_KW@126..132 "string" [] [] + 4: (empty) + 2: R_PAREN@132..134 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@134..136 + 0: L_CURLY@134..135 "{" [] [] + 1: JS_DIRECTIVE_LIST@135..135 + 2: JS_STATEMENT_LIST@135..135 + 3: R_CURLY@135..136 "}" [] [] + 4: TS_DECLARE_FUNCTION_DECLARATION@136..177 + 0: ASYNC_KW@136..143 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@143..152 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@152..166 + 0: IDENT@152..166 "async_overload" [] [] + 3: (empty) + 4: JS_PARAMETERS@166..177 + 0: L_PAREN@166..167 "(" [] [] + 1: JS_PARAMETER_LIST@167..176 + 0: JS_FORMAL_PARAMETER@167..176 + 0: JS_DECORATOR_LIST@167..167 + 1: JS_IDENTIFIER_BINDING@167..168 + 0: IDENT@167..168 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@168..176 + 0: COLON@168..170 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@170..176 + 0: STRING_KW@170..176 "string" [] [] + 4: (empty) + 2: R_PAREN@176..177 ")" [] [] + 5: (empty) + 6: (empty) + 5: JS_FUNCTION_DECLARATION@177..221 + 0: ASYNC_KW@177..184 "async" [Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@184..193 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@193..207 + 0: IDENT@193..207 "async_overload" [] [] + 4: (empty) + 5: JS_PARAMETERS@207..219 + 0: L_PAREN@207..208 "(" [] [] + 1: JS_PARAMETER_LIST@208..217 + 0: JS_FORMAL_PARAMETER@208..217 + 0: JS_DECORATOR_LIST@208..208 + 1: JS_IDENTIFIER_BINDING@208..209 + 0: IDENT@208..209 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@209..217 + 0: COLON@209..211 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@211..217 + 0: STRING_KW@211..217 "string" [] [] + 4: (empty) + 2: R_PAREN@217..219 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@219..221 + 0: L_CURLY@219..220 "{" [] [] + 1: JS_DIRECTIVE_LIST@220..220 + 2: JS_STATEMENT_LIST@220..220 + 3: R_CURLY@220..221 "}" [] [] + 4: EOF@221..222 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts.snap new file mode 100644 index 000000000000..33e7c042c899 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts.snap @@ -0,0 +1,362 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function test(a: string, b?: number, c="default") {} +function test2(a: A, b: B, c: C) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..13 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@14..15 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@15..17 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@17..23 "string" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@25..26 "b" [] [], + }, + question_mark_token: QUESTION@26..27 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@27..29 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@29..35 "number" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@35..37 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@37..38 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@38..39 "=" [] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@39..48 "\"default\"" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@50..51 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@52..62 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@62..67 "test2" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@67..68 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@68..69 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@69..71 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@71..73 "B" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@73..81 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@81..82 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + COMMA@82..84 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@84..86 "C" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: TsDefaultTypeClause { + eq_token: EQ@86..88 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@88..89 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + ], + r_angle_token: R_ANGLE@89..90 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@90..91 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@91..92 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@92..94 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@94..95 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@95..97 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@97..98 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@98..100 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@100..101 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@101..103 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@103..104 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@104..106 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@106..107 "C" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@109..110 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + ], + eof_token: EOF@111..112 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..112 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..111 + 0: JS_FUNCTION_DECLARATION@0..52 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..13 + 0: IDENT@9..13 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@13..50 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..48 + 0: JS_FORMAL_PARAMETER@14..23 + 0: JS_DECORATOR_LIST@14..14 + 1: JS_IDENTIFIER_BINDING@14..15 + 0: IDENT@14..15 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@15..23 + 0: COLON@15..17 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@17..23 + 0: STRING_KW@17..23 "string" [] [] + 4: (empty) + 1: COMMA@23..25 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@25..35 + 0: JS_DECORATOR_LIST@25..25 + 1: JS_IDENTIFIER_BINDING@25..26 + 0: IDENT@25..26 "b" [] [] + 2: QUESTION@26..27 "?" [] [] + 3: TS_TYPE_ANNOTATION@27..35 + 0: COLON@27..29 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@29..35 + 0: NUMBER_KW@29..35 "number" [] [] + 4: (empty) + 3: COMMA@35..37 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@37..48 + 0: JS_DECORATOR_LIST@37..37 + 1: JS_IDENTIFIER_BINDING@37..38 + 0: IDENT@37..38 "c" [] [] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@38..48 + 0: EQ@38..39 "=" [] [] + 1: JS_STRING_LITERAL_EXPRESSION@39..48 + 0: JS_STRING_LITERAL@39..48 "\"default\"" [] [] + 2: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@50..52 + 0: L_CURLY@50..51 "{" [] [] + 1: JS_DIRECTIVE_LIST@51..51 + 2: JS_STATEMENT_LIST@51..51 + 3: R_CURLY@51..52 "}" [] [] + 1: JS_FUNCTION_DECLARATION@52..111 + 0: (empty) + 1: FUNCTION_KW@52..62 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@62..67 + 0: IDENT@62..67 "test2" [] [] + 4: TS_TYPE_PARAMETERS@67..90 + 0: L_ANGLE@67..68 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@68..89 + 0: TS_TYPE_PARAMETER@68..69 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@68..68 + 1: TS_TYPE_PARAMETER_NAME@68..69 + 0: IDENT@68..69 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@69..71 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@71..82 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@71..71 + 1: TS_TYPE_PARAMETER_NAME@71..73 + 0: IDENT@71..73 "B" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@73..82 + 0: EXTENDS_KW@73..81 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@81..82 + 0: JS_REFERENCE_IDENTIFIER@81..82 + 0: IDENT@81..82 "A" [] [] + 1: (empty) + 3: (empty) + 3: COMMA@82..84 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@84..89 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@84..84 + 1: TS_TYPE_PARAMETER_NAME@84..86 + 0: IDENT@84..86 "C" [] [Whitespace(" ")] + 2: (empty) + 3: TS_DEFAULT_TYPE_CLAUSE@86..89 + 0: EQ@86..88 "=" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@88..89 + 0: JS_REFERENCE_IDENTIFIER@88..89 + 0: IDENT@88..89 "A" [] [] + 1: (empty) + 2: R_ANGLE@89..90 ">" [] [] + 5: JS_PARAMETERS@90..109 + 0: L_PAREN@90..91 "(" [] [] + 1: JS_PARAMETER_LIST@91..107 + 0: JS_FORMAL_PARAMETER@91..95 + 0: JS_DECORATOR_LIST@91..91 + 1: JS_IDENTIFIER_BINDING@91..92 + 0: IDENT@91..92 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@92..95 + 0: COLON@92..94 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@94..95 + 0: JS_REFERENCE_IDENTIFIER@94..95 + 0: IDENT@94..95 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@95..97 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@97..101 + 0: JS_DECORATOR_LIST@97..97 + 1: JS_IDENTIFIER_BINDING@97..98 + 0: IDENT@97..98 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@98..101 + 0: COLON@98..100 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@100..101 + 0: JS_REFERENCE_IDENTIFIER@100..101 + 0: IDENT@100..101 "B" [] [] + 1: (empty) + 4: (empty) + 3: COMMA@101..103 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@103..107 + 0: JS_DECORATOR_LIST@103..103 + 1: JS_IDENTIFIER_BINDING@103..104 + 0: IDENT@103..104 "c" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@104..107 + 0: COLON@104..106 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@106..107 + 0: JS_REFERENCE_IDENTIFIER@106..107 + 0: IDENT@106..107 "C" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@107..109 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@109..111 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_DIRECTIVE_LIST@110..110 + 2: JS_STATEMENT_LIST@110..110 + 3: R_CURLY@110..111 "}" [] [] + 4: EOF@111..112 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts.snap new file mode 100644 index 000000000000..80ceabc1c6e6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts.snap @@ -0,0 +1,704 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = () => string; +type B = (a: string) => string; +type C = (b = "test") => string; +type D = (c, d) => string +type E = ([a]) => string +type F = ({a}) => string +type G = (a: A, b: B) => string +type H = (a: any) => a is string; +type I = ({ a, b }?) => string; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@9..10 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@10..12 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@15..21 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@22..28 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@28..30 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@30..32 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@32..33 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@33..34 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@34..36 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@36..42 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@47..53 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@53..54 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@54..60 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@60..62 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@62..64 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@64..65 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@65..67 "b" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@67..69 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@69..75 "\"test\"" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@77..80 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@80..86 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@86..87 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@93..95 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@95..97 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@97..98 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@98..99 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@99..101 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@101..102 "d" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@107..113 "string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@113..119 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@119..121 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@121..123 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@123..124 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsArrayBindingPattern { + l_brack_token: L_BRACK@124..125 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@125..126 "a" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@126..127 "]" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@127..129 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@132..138 "string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@138..144 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@144..146 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@146..148 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@148..149 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@149..150 "{" [] [], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@150..151 "a" [] [], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@151..152 "}" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@152..154 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@154..157 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@157..163 "string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@163..169 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@169..171 "G" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@171..173 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@173..174 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@174..175 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@175..177 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@177..178 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@178..179 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@179..180 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@180..181 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@181..183 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@183..184 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@184..186 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@186..187 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@187..189 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@189..190 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@190..192 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@192..195 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@195..201 "string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@201..207 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@207..209 "H" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@209..211 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@211..212 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@212..213 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@213..215 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@215..218 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@218..220 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@220..223 "=>" [] [Whitespace(" ")], + return_type: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@223..225 "a" [] [Whitespace(" ")], + }, + is_token: IS_KW@225..228 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@228..234 "string" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@234..235 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@235..241 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@241..243 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@243..245 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@245..246 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@246..248 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@248..249 "a" [] [], + }, + init: missing (optional), + }, + COMMA@249..251 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@251..253 "b" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@253..254 "}" [] [], + }, + question_mark_token: QUESTION@254..255 "?" [] [], + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@255..257 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@257..260 "=>" [] [Whitespace(" ")], + return_type: TsStringType { + string_token: STRING_KW@260..266 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@266..267 ";" [] [], + }, + ], + eof_token: EOF@267..268 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..268 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..267 + 0: TS_TYPE_ALIAS_DECLARATION@0..22 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@9..21 + 0: (empty) + 1: JS_PARAMETERS@9..12 + 0: L_PAREN@9..10 "(" [] [] + 1: JS_PARAMETER_LIST@10..10 + 2: R_PAREN@10..12 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@12..15 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@15..21 + 0: STRING_KW@15..21 "string" [] [] + 5: SEMICOLON@21..22 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@22..54 + 0: TYPE_KW@22..28 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@28..30 + 0: IDENT@28..30 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@30..32 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@32..53 + 0: (empty) + 1: JS_PARAMETERS@32..44 + 0: L_PAREN@32..33 "(" [] [] + 1: JS_PARAMETER_LIST@33..42 + 0: JS_FORMAL_PARAMETER@33..42 + 0: JS_DECORATOR_LIST@33..33 + 1: JS_IDENTIFIER_BINDING@33..34 + 0: IDENT@33..34 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@34..42 + 0: COLON@34..36 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@36..42 + 0: STRING_KW@36..42 "string" [] [] + 4: (empty) + 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@47..53 + 0: STRING_KW@47..53 "string" [] [] + 5: SEMICOLON@53..54 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@54..87 + 0: TYPE_KW@54..60 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@60..62 + 0: IDENT@60..62 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@62..64 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@64..86 + 0: (empty) + 1: JS_PARAMETERS@64..77 + 0: L_PAREN@64..65 "(" [] [] + 1: JS_PARAMETER_LIST@65..75 + 0: JS_FORMAL_PARAMETER@65..75 + 0: JS_DECORATOR_LIST@65..65 + 1: JS_IDENTIFIER_BINDING@65..67 + 0: IDENT@65..67 "b" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@67..75 + 0: EQ@67..69 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@69..75 + 0: JS_STRING_LITERAL@69..75 "\"test\"" [] [] + 2: R_PAREN@75..77 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@77..80 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@80..86 + 0: STRING_KW@80..86 "string" [] [] + 5: SEMICOLON@86..87 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@87..113 + 0: TYPE_KW@87..93 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@93..95 + 0: IDENT@93..95 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@95..97 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@97..113 + 0: (empty) + 1: JS_PARAMETERS@97..104 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_PARAMETER_LIST@98..102 + 0: JS_FORMAL_PARAMETER@98..99 + 0: JS_DECORATOR_LIST@98..98 + 1: JS_IDENTIFIER_BINDING@98..99 + 0: IDENT@98..99 "c" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@99..101 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@101..102 + 0: JS_DECORATOR_LIST@101..101 + 1: JS_IDENTIFIER_BINDING@101..102 + 0: IDENT@101..102 "d" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@107..113 + 0: STRING_KW@107..113 "string" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@113..138 + 0: TYPE_KW@113..119 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@119..121 + 0: IDENT@119..121 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@121..123 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@123..138 + 0: (empty) + 1: JS_PARAMETERS@123..129 + 0: L_PAREN@123..124 "(" [] [] + 1: JS_PARAMETER_LIST@124..127 + 0: JS_FORMAL_PARAMETER@124..127 + 0: JS_DECORATOR_LIST@124..124 + 1: JS_ARRAY_BINDING_PATTERN@124..127 + 0: L_BRACK@124..125 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@125..126 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@125..126 + 0: JS_IDENTIFIER_BINDING@125..126 + 0: IDENT@125..126 "a" [] [] + 1: (empty) + 2: R_BRACK@126..127 "]" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@127..129 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@129..132 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@132..138 + 0: STRING_KW@132..138 "string" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@138..163 + 0: TYPE_KW@138..144 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@144..146 + 0: IDENT@144..146 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@146..148 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@148..163 + 0: (empty) + 1: JS_PARAMETERS@148..154 + 0: L_PAREN@148..149 "(" [] [] + 1: JS_PARAMETER_LIST@149..152 + 0: JS_FORMAL_PARAMETER@149..152 + 0: JS_DECORATOR_LIST@149..149 + 1: JS_OBJECT_BINDING_PATTERN@149..152 + 0: L_CURLY@149..150 "{" [] [] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@150..151 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@150..151 + 0: JS_IDENTIFIER_BINDING@150..151 + 0: IDENT@150..151 "a" [] [] + 1: (empty) + 2: R_CURLY@151..152 "}" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@152..154 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@154..157 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@157..163 + 0: STRING_KW@157..163 "string" [] [] + 5: (empty) + 6: TS_TYPE_ALIAS_DECLARATION@163..201 + 0: TYPE_KW@163..169 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@169..171 + 0: IDENT@169..171 "G" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@171..173 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@173..201 + 0: TS_TYPE_PARAMETERS@173..179 + 0: L_ANGLE@173..174 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@174..178 + 0: TS_TYPE_PARAMETER@174..175 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@174..174 + 1: TS_TYPE_PARAMETER_NAME@174..175 + 0: IDENT@174..175 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@175..177 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@177..178 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@177..177 + 1: TS_TYPE_PARAMETER_NAME@177..178 + 0: IDENT@177..178 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@178..179 ">" [] [] + 1: JS_PARAMETERS@179..192 + 0: L_PAREN@179..180 "(" [] [] + 1: JS_PARAMETER_LIST@180..190 + 0: JS_FORMAL_PARAMETER@180..184 + 0: JS_DECORATOR_LIST@180..180 + 1: JS_IDENTIFIER_BINDING@180..181 + 0: IDENT@180..181 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@181..184 + 0: COLON@181..183 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@183..184 + 0: JS_REFERENCE_IDENTIFIER@183..184 + 0: IDENT@183..184 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@184..186 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@186..190 + 0: JS_DECORATOR_LIST@186..186 + 1: JS_IDENTIFIER_BINDING@186..187 + 0: IDENT@186..187 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@187..190 + 0: COLON@187..189 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@189..190 + 0: JS_REFERENCE_IDENTIFIER@189..190 + 0: IDENT@189..190 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@190..192 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@192..195 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@195..201 + 0: STRING_KW@195..201 "string" [] [] + 5: (empty) + 7: TS_TYPE_ALIAS_DECLARATION@201..235 + 0: TYPE_KW@201..207 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@207..209 + 0: IDENT@207..209 "H" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@209..211 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@211..234 + 0: (empty) + 1: JS_PARAMETERS@211..220 + 0: L_PAREN@211..212 "(" [] [] + 1: JS_PARAMETER_LIST@212..218 + 0: JS_FORMAL_PARAMETER@212..218 + 0: JS_DECORATOR_LIST@212..212 + 1: JS_IDENTIFIER_BINDING@212..213 + 0: IDENT@212..213 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@213..218 + 0: COLON@213..215 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@215..218 + 0: ANY_KW@215..218 "any" [] [] + 4: (empty) + 2: R_PAREN@218..220 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@220..223 "=>" [] [Whitespace(" ")] + 3: TS_PREDICATE_RETURN_TYPE@223..234 + 0: JS_REFERENCE_IDENTIFIER@223..225 + 0: IDENT@223..225 "a" [] [Whitespace(" ")] + 1: IS_KW@225..228 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@228..234 + 0: STRING_KW@228..234 "string" [] [] + 5: SEMICOLON@234..235 ";" [] [] + 8: TS_TYPE_ALIAS_DECLARATION@235..267 + 0: TYPE_KW@235..241 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@241..243 + 0: IDENT@241..243 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@243..245 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@245..266 + 0: (empty) + 1: JS_PARAMETERS@245..257 + 0: L_PAREN@245..246 "(" [] [] + 1: JS_PARAMETER_LIST@246..255 + 0: JS_FORMAL_PARAMETER@246..255 + 0: JS_DECORATOR_LIST@246..246 + 1: JS_OBJECT_BINDING_PATTERN@246..254 + 0: L_CURLY@246..248 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@248..253 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@248..249 + 0: JS_IDENTIFIER_BINDING@248..249 + 0: IDENT@248..249 "a" [] [] + 1: (empty) + 1: COMMA@249..251 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@251..253 + 0: JS_IDENTIFIER_BINDING@251..253 + 0: IDENT@251..253 "b" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@253..254 "}" [] [] + 2: QUESTION@254..255 "?" [] [] + 3: (empty) + 4: (empty) + 2: R_PAREN@255..257 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@257..260 "=>" [] [Whitespace(" ")] + 3: TS_STRING_TYPE@260..266 + 0: STRING_KW@260..266 "string" [] [] + 5: SEMICOLON@266..267 ";" [] [] + 4: EOF@267..268 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts.snap new file mode 100644 index 000000000000..4488cddb15c3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts.snap @@ -0,0 +1,288 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { get a(): number } +type B = { get a() } +// members that look like getters but aren't getters +type C = { get(): number } +type D = { get: number } +type E = { get } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsGetterSignatureTypeMember { + get_token: GET_KW@11..15 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@15..16 "a" [] [], + }, + l_paren_token: L_PAREN@16..17 "(" [] [], + r_paren_token: R_PAREN@17..18 ")" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@20..27 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@34..36 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsGetterSignatureTypeMember { + get_token: GET_KW@40..44 "get" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@44..45 "a" [] [], + }, + l_paren_token: L_PAREN@45..46 "(" [] [], + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@48..49 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@49..108 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@108..110 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@110..112 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@112..114 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@114..117 "get" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@117..118 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@118..119 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@121..128 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@128..129 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@129..135 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@135..137 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@137..139 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@139..141 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@141..144 "get" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@144..146 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@146..153 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@153..154 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@154..160 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@160..162 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@162..164 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@164..166 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@166..170 "get" [] [Whitespace(" ")], + }, + optional_token: missing (optional), + type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@170..171 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@171..172 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..172 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..171 + 0: TS_TYPE_ALIAS_DECLARATION@0..28 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..28 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..27 + 0: TS_GETTER_SIGNATURE_TYPE_MEMBER@11..27 + 0: GET_KW@11..15 "get" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@15..16 + 0: IDENT@15..16 "a" [] [] + 2: L_PAREN@16..17 "(" [] [] + 3: R_PAREN@17..18 ")" [] [] + 4: TS_TYPE_ANNOTATION@18..27 + 0: COLON@18..20 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@20..27 + 0: NUMBER_KW@20..27 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@27..28 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@28..49 + 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@36..38 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@38..49 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@40..48 + 0: TS_GETTER_SIGNATURE_TYPE_MEMBER@40..48 + 0: GET_KW@40..44 "get" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@44..45 + 0: IDENT@44..45 "a" [] [] + 2: L_PAREN@45..46 "(" [] [] + 3: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 2: R_CURLY@48..49 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@49..129 + 0: TYPE_KW@49..108 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@108..110 + 0: IDENT@108..110 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@110..112 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@112..129 + 0: L_CURLY@112..114 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@114..128 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@114..128 + 0: JS_LITERAL_MEMBER_NAME@114..117 + 0: IDENT@114..117 "get" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@117..119 + 0: L_PAREN@117..118 "(" [] [] + 1: JS_PARAMETER_LIST@118..118 + 2: R_PAREN@118..119 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@119..128 + 0: COLON@119..121 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@121..128 + 0: NUMBER_KW@121..128 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@128..129 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@129..154 + 0: TYPE_KW@129..135 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@135..137 + 0: IDENT@135..137 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@137..139 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@139..154 + 0: L_CURLY@139..141 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@141..153 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@141..153 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@141..144 + 0: IDENT@141..144 "get" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@144..153 + 0: COLON@144..146 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@146..153 + 0: NUMBER_KW@146..153 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@153..154 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@154..171 + 0: TYPE_KW@154..160 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@160..162 + 0: IDENT@160..162 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@162..164 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@164..171 + 0: L_CURLY@164..166 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@166..170 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@166..170 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@166..170 + 0: IDENT@166..170 "get" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_CURLY@170..171 "}" [] [] + 5: (empty) + 4: EOF@171..172 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts.snap new file mode 100644 index 000000000000..920fabb50ad0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts.snap @@ -0,0 +1,199 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module "./test" { + global { + let VERSION: string; + } +} +declare module "foo" { + global + { } +} +declare global {} +declare global +{ } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@15..24 "\"./test\"" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@24..25 "{" [] [], + items: JsModuleItemList [ + TsGlobalDeclaration { + global_token: GLOBAL_KW@25..34 "global" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + body: TsModuleBlock { + l_curly_token: L_CURLY@34..35 "{" [] [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@35..45 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@45..52 "VERSION" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@52..54 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@54..60 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + ], + r_curly_token: R_CURLY@61..64 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@64..66 "}" [Newline("\n")] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@66..75 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsExternalModuleDeclaration { + module_token: MODULE_KW@75..82 "module" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@82..88 "\"foo\"" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@88..89 "{" [] [], + items: JsModuleItemList [ + TsGlobalDeclaration { + global_token: GLOBAL_KW@89..97 "global" [Newline("\n"), Whitespace(" ")] [], + body: TsModuleBlock { + l_curly_token: L_CURLY@97..101 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + items: JsModuleItemList [], + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@102..104 "}" [Newline("\n")] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@104..113 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsGlobalDeclaration { + global_token: GLOBAL_KW@113..120 "global" [] [Whitespace(" ")], + body: TsModuleBlock { + l_curly_token: L_CURLY@120..121 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@121..122 "}" [] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@122..131 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsGlobalDeclaration { + global_token: GLOBAL_KW@131..137 "global" [] [], + body: TsModuleBlock { + l_curly_token: L_CURLY@137..140 "{" [Newline("\n")] [Whitespace(" ")], + items: JsModuleItemList [], + r_curly_token: R_CURLY@140..141 "}" [] [], + }, + }, + }, + ], + eof_token: EOF@141..142 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..142 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..141 + 0: TS_DECLARE_STATEMENT@0..66 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@8..66 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@15..24 + 0: JS_STRING_LITERAL@15..24 "\"./test\"" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@24..66 + 0: L_CURLY@24..25 "{" [] [] + 1: JS_MODULE_ITEM_LIST@25..64 + 0: TS_GLOBAL_DECLARATION@25..64 + 0: GLOBAL_KW@25..34 "global" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_MODULE_BLOCK@34..64 + 0: L_CURLY@34..35 "{" [] [] + 1: JS_MODULE_ITEM_LIST@35..61 + 0: JS_VARIABLE_STATEMENT@35..61 + 0: JS_VARIABLE_DECLARATION@35..60 + 0: (empty) + 1: LET_KW@35..45 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@45..60 + 0: JS_VARIABLE_DECLARATOR@45..60 + 0: JS_IDENTIFIER_BINDING@45..52 + 0: IDENT@45..52 "VERSION" [] [] + 1: TS_TYPE_ANNOTATION@52..60 + 0: COLON@52..54 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@54..60 + 0: STRING_KW@54..60 "string" [] [] + 2: (empty) + 1: SEMICOLON@60..61 ";" [] [] + 2: R_CURLY@61..64 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@64..66 "}" [Newline("\n")] [] + 1: TS_DECLARE_STATEMENT@66..104 + 0: DECLARE_KW@66..75 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_EXTERNAL_MODULE_DECLARATION@75..104 + 0: MODULE_KW@75..82 "module" [] [Whitespace(" ")] + 1: JS_MODULE_SOURCE@82..88 + 0: JS_STRING_LITERAL@82..88 "\"foo\"" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@88..104 + 0: L_CURLY@88..89 "{" [] [] + 1: JS_MODULE_ITEM_LIST@89..102 + 0: TS_GLOBAL_DECLARATION@89..102 + 0: GLOBAL_KW@89..97 "global" [Newline("\n"), Whitespace(" ")] [] + 1: TS_MODULE_BLOCK@97..102 + 0: L_CURLY@97..101 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_MODULE_ITEM_LIST@101..101 + 2: R_CURLY@101..102 "}" [] [] + 2: R_CURLY@102..104 "}" [Newline("\n")] [] + 2: TS_DECLARE_STATEMENT@104..122 + 0: DECLARE_KW@104..113 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_GLOBAL_DECLARATION@113..122 + 0: GLOBAL_KW@113..120 "global" [] [Whitespace(" ")] + 1: TS_MODULE_BLOCK@120..122 + 0: L_CURLY@120..121 "{" [] [] + 1: JS_MODULE_ITEM_LIST@121..121 + 2: R_CURLY@121..122 "}" [] [] + 3: TS_DECLARE_STATEMENT@122..141 + 0: DECLARE_KW@122..131 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_GLOBAL_DECLARATION@131..141 + 0: GLOBAL_KW@131..137 "global" [] [] + 1: TS_MODULE_BLOCK@137..141 + 0: L_CURLY@137..140 "{" [Newline("\n")] [Whitespace(" ")] + 1: JS_MODULE_ITEM_LIST@140..140 + 2: R_CURLY@140..141 "}" [] [] + 4: EOF@141..142 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_global_variable.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts.snap new file mode 100644 index 000000000000..98a139cbe1c6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts.snap @@ -0,0 +1,123 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let global; +global // not a global declaration +console.log("a"); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..10 "global" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..46 "global" [Newline("\n")] [Whitespace(" "), Comments("// not a global decla ...")], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@46..54 "console" [Newline("\n")] [], + }, + }, + operator_token: DOT@54..55 "." [] [], + member: JsName { + value_token: IDENT@55..58 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@58..59 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@59..62 "\"a\"" [] [], + }, + ], + r_paren_token: R_PAREN@62..63 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + ], + eof_token: EOF@64..65 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..65 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..64 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_IDENTIFIER_BINDING@4..10 + 0: IDENT@4..10 "global" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@10..11 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@11..46 + 0: JS_IDENTIFIER_EXPRESSION@11..46 + 0: JS_REFERENCE_IDENTIFIER@11..46 + 0: IDENT@11..46 "global" [Newline("\n")] [Whitespace(" "), Comments("// not a global decla ...")] + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@46..64 + 0: JS_CALL_EXPRESSION@46..63 + 0: JS_STATIC_MEMBER_EXPRESSION@46..58 + 0: JS_IDENTIFIER_EXPRESSION@46..54 + 0: JS_REFERENCE_IDENTIFIER@46..54 + 0: IDENT@46..54 "console" [Newline("\n")] [] + 1: DOT@54..55 "." [] [] + 2: JS_NAME@55..58 + 0: IDENT@55..58 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@58..63 + 0: L_PAREN@58..59 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@59..62 + 0: JS_STRING_LITERAL_EXPRESSION@59..62 + 0: JS_STRING_LITERAL@59..62 "\"a\"" [] [] + 2: R_PAREN@62..63 ")" [] [] + 1: SEMICOLON@63..64 ";" [] [] + 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts.snap new file mode 100644 index 000000000000..b30db8ac1a5b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts.snap @@ -0,0 +1,201 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import type from "./mod"; // not a type +import type foo from "./mod"; +import type * as foo2 from "./mod"; +import type { foo3 } from "mod"; +import type from from "./mod"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: missing (optional), + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@7..12 "type" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@12..17 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@17..24 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@24..39 ";" [] [Whitespace(" "), Comments("// not a type")], + }, + JsImport { + import_token: IMPORT_KW@39..47 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: TYPE_KW@47..52 "type" [] [Whitespace(" ")], + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@52..56 "foo" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@56..61 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@61..68 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@68..69 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@69..77 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamespaceClause { + type_token: TYPE_KW@77..82 "type" [] [Whitespace(" ")], + namespace_specifier: JsNamespaceImportSpecifier { + star_token: STAR@82..84 "*" [] [Whitespace(" ")], + as_token: AS_KW@84..87 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@87..92 "foo2" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@92..97 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@97..104 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@104..105 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@105..113 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: TYPE_KW@113..118 "type" [] [Whitespace(" ")], + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@120..125 "foo3" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@125..127 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@127..132 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@132..137 "\"mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@137..138 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@138..146 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportDefaultClause { + type_token: TYPE_KW@146..151 "type" [] [Whitespace(" ")], + default_specifier: JsDefaultImportSpecifier { + local_name: JsIdentifierBinding { + name_token: IDENT@151..156 "from" [] [Whitespace(" ")], + }, + }, + from_token: FROM_KW@156..161 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@161..168 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@168..169 ";" [] [], + }, + ], + eof_token: EOF@169..170 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..170 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..169 + 0: JS_IMPORT@0..39 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@7..24 + 0: (empty) + 1: JS_DEFAULT_IMPORT_SPECIFIER@7..12 + 0: JS_IDENTIFIER_BINDING@7..12 + 0: IDENT@7..12 "type" [] [Whitespace(" ")] + 2: FROM_KW@12..17 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@17..24 + 0: JS_STRING_LITERAL@17..24 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@24..39 ";" [] [Whitespace(" "), Comments("// not a type")] + 1: JS_IMPORT@39..69 + 0: IMPORT_KW@39..47 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@47..68 + 0: TYPE_KW@47..52 "type" [] [Whitespace(" ")] + 1: JS_DEFAULT_IMPORT_SPECIFIER@52..56 + 0: JS_IDENTIFIER_BINDING@52..56 + 0: IDENT@52..56 "foo" [] [Whitespace(" ")] + 2: FROM_KW@56..61 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@61..68 + 0: JS_STRING_LITERAL@61..68 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@68..69 ";" [] [] + 2: JS_IMPORT@69..105 + 0: IMPORT_KW@69..77 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMESPACE_CLAUSE@77..104 + 0: TYPE_KW@77..82 "type" [] [Whitespace(" ")] + 1: JS_NAMESPACE_IMPORT_SPECIFIER@82..92 + 0: STAR@82..84 "*" [] [Whitespace(" ")] + 1: AS_KW@84..87 "as" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@87..92 + 0: IDENT@87..92 "foo2" [] [Whitespace(" ")] + 2: FROM_KW@92..97 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@97..104 + 0: JS_STRING_LITERAL@97..104 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@104..105 ";" [] [] + 3: JS_IMPORT@105..138 + 0: IMPORT_KW@105..113 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@113..137 + 0: TYPE_KW@113..118 "type" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIERS@118..127 + 0: L_CURLY@118..120 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@120..125 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@120..125 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@120..125 + 0: IDENT@120..125 "foo3" [] [Whitespace(" ")] + 2: R_CURLY@125..127 "}" [] [Whitespace(" ")] + 2: FROM_KW@127..132 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@132..137 + 0: JS_STRING_LITERAL@132..137 "\"mod\"" [] [] + 4: (empty) + 2: SEMICOLON@137..138 ";" [] [] + 4: JS_IMPORT@138..169 + 0: IMPORT_KW@138..146 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_DEFAULT_CLAUSE@146..168 + 0: TYPE_KW@146..151 "type" [] [Whitespace(" ")] + 1: JS_DEFAULT_IMPORT_SPECIFIER@151..156 + 0: JS_IDENTIFIER_BINDING@151..156 + 0: IDENT@151..156 "from" [] [Whitespace(" ")] + 2: FROM_KW@156..161 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@161..168 + 0: JS_STRING_LITERAL@161..168 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@168..169 ";" [] [] + 4: EOF@169..170 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap new file mode 100644 index 000000000000..b91cca131945 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap @@ -0,0 +1,210 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import x = require("./test"); +namespace a.b {} +import y = a; +import z = a.b; +import type A = require("./a"); +export import n = a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsImportEqualsDeclaration { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + type_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@7..9 "x" [] [Whitespace(" ")], + }, + eq_token: EQ@9..11 "=" [] [Whitespace(" ")], + module_reference: TsExternalModuleReference { + require_token: REQUIRE_KW@11..18 "require" [] [], + l_paren_token: L_PAREN@18..19 "(" [] [], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@19..27 "\"./test\"" [] [], + }, + r_paren_token: R_PAREN@27..28 ")" [] [], + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@29..40 "namespace" [Newline("\n")] [Whitespace(" ")], + name: TsQualifiedModuleName { + left: TsIdentifierBinding { + name_token: IDENT@40..41 "a" [] [], + }, + dot_token: DOT@41..42 "." [] [], + right: JsName { + value_token: IDENT@42..44 "b" [] [Whitespace(" ")], + }, + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@44..45 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@45..46 "}" [] [], + }, + }, + TsImportEqualsDeclaration { + import_token: IMPORT_KW@46..54 "import" [Newline("\n")] [Whitespace(" ")], + type_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@54..56 "y" [] [Whitespace(" ")], + }, + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + module_reference: JsReferenceIdentifier { + value_token: IDENT@58..59 "a" [] [], + }, + semicolon_token: SEMICOLON@59..60 ";" [] [], + }, + TsImportEqualsDeclaration { + import_token: IMPORT_KW@60..68 "import" [Newline("\n")] [Whitespace(" ")], + type_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@68..70 "z" [] [Whitespace(" ")], + }, + eq_token: EQ@70..72 "=" [] [Whitespace(" ")], + module_reference: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@72..73 "a" [] [], + }, + dot_token: DOT@73..74 "." [] [], + right: JsName { + value_token: IDENT@74..75 "b" [] [], + }, + }, + semicolon_token: SEMICOLON@75..76 ";" [] [], + }, + TsImportEqualsDeclaration { + import_token: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")], + type_token: TYPE_KW@84..89 "type" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@89..91 "A" [] [Whitespace(" ")], + }, + eq_token: EQ@91..93 "=" [] [Whitespace(" ")], + module_reference: TsExternalModuleReference { + require_token: REQUIRE_KW@93..100 "require" [] [], + l_paren_token: L_PAREN@100..101 "(" [] [], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@101..106 "\"./a\"" [] [], + }, + r_paren_token: R_PAREN@106..107 ")" [] [], + }, + semicolon_token: SEMICOLON@107..108 ";" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@108..116 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: TsImportEqualsDeclaration { + import_token: IMPORT_KW@116..123 "import" [] [Whitespace(" ")], + type_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@123..125 "n" [] [Whitespace(" ")], + }, + eq_token: EQ@125..127 "=" [] [Whitespace(" ")], + module_reference: JsReferenceIdentifier { + value_token: IDENT@127..128 "a" [] [], + }, + semicolon_token: SEMICOLON@128..129 ";" [] [], + }, + }, + ], + eof_token: EOF@129..130 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..130 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..129 + 0: TS_IMPORT_EQUALS_DECLARATION@0..29 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_BINDING@7..9 + 0: IDENT@7..9 "x" [] [Whitespace(" ")] + 3: EQ@9..11 "=" [] [Whitespace(" ")] + 4: TS_EXTERNAL_MODULE_REFERENCE@11..28 + 0: REQUIRE_KW@11..18 "require" [] [] + 1: L_PAREN@18..19 "(" [] [] + 2: JS_MODULE_SOURCE@19..27 + 0: JS_STRING_LITERAL@19..27 "\"./test\"" [] [] + 3: R_PAREN@27..28 ")" [] [] + 5: SEMICOLON@28..29 ";" [] [] + 1: TS_MODULE_DECLARATION@29..46 + 0: NAMESPACE_KW@29..40 "namespace" [Newline("\n")] [Whitespace(" ")] + 1: TS_QUALIFIED_MODULE_NAME@40..44 + 0: TS_IDENTIFIER_BINDING@40..41 + 0: IDENT@40..41 "a" [] [] + 1: DOT@41..42 "." [] [] + 2: JS_NAME@42..44 + 0: IDENT@42..44 "b" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@44..46 + 0: L_CURLY@44..45 "{" [] [] + 1: JS_MODULE_ITEM_LIST@45..45 + 2: R_CURLY@45..46 "}" [] [] + 2: TS_IMPORT_EQUALS_DECLARATION@46..60 + 0: IMPORT_KW@46..54 "import" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_BINDING@54..56 + 0: IDENT@54..56 "y" [] [Whitespace(" ")] + 3: EQ@56..58 "=" [] [Whitespace(" ")] + 4: JS_REFERENCE_IDENTIFIER@58..59 + 0: IDENT@58..59 "a" [] [] + 5: SEMICOLON@59..60 ";" [] [] + 3: TS_IMPORT_EQUALS_DECLARATION@60..76 + 0: IMPORT_KW@60..68 "import" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_BINDING@68..70 + 0: IDENT@68..70 "z" [] [Whitespace(" ")] + 3: EQ@70..72 "=" [] [Whitespace(" ")] + 4: TS_QUALIFIED_NAME@72..75 + 0: JS_REFERENCE_IDENTIFIER@72..73 + 0: IDENT@72..73 "a" [] [] + 1: DOT@73..74 "." [] [] + 2: JS_NAME@74..75 + 0: IDENT@74..75 "b" [] [] + 5: SEMICOLON@75..76 ";" [] [] + 4: TS_IMPORT_EQUALS_DECLARATION@76..108 + 0: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")] + 1: TYPE_KW@84..89 "type" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@89..91 + 0: IDENT@89..91 "A" [] [Whitespace(" ")] + 3: EQ@91..93 "=" [] [Whitespace(" ")] + 4: TS_EXTERNAL_MODULE_REFERENCE@93..107 + 0: REQUIRE_KW@93..100 "require" [] [] + 1: L_PAREN@100..101 "(" [] [] + 2: JS_MODULE_SOURCE@101..106 + 0: JS_STRING_LITERAL@101..106 "\"./a\"" [] [] + 3: R_PAREN@106..107 ")" [] [] + 5: SEMICOLON@107..108 ";" [] [] + 5: JS_EXPORT@108..129 + 0: JS_DECORATOR_LIST@108..108 + 1: EXPORT_KW@108..116 "export" [Newline("\n")] [Whitespace(" ")] + 2: TS_IMPORT_EQUALS_DECLARATION@116..129 + 0: IMPORT_KW@116..123 "import" [] [Whitespace(" ")] + 1: (empty) + 2: JS_IDENTIFIER_BINDING@123..125 + 0: IDENT@123..125 "n" [] [Whitespace(" ")] + 3: EQ@125..127 "=" [] [Whitespace(" ")] + 4: JS_REFERENCE_IDENTIFIER@127..128 + 0: IDENT@127..128 "a" [] [] + 5: SEMICOLON@128..129 ";" [] [] + 4: EOF@129..130 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts.snap new file mode 100644 index 000000000000..ded15a17a9b1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts.snap @@ -0,0 +1,892 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = typeof import("test"); +type B = import("test"); +type C = typeof import("test").a.b.c.d.e.f; +type D = import("test"); +type E = import("test").C; +type F = typeof import("test", { with: { "resolution-mode": "import" } }); +type G = import("test", { with: { "resolution-mode": "import" } }).TypeFromImport; +type H = import("test", { with: { "resolution-mode": "import" } }); +type I = import("test", { with: { "resolution-mode": "require" } }).C; +type J = typeof import("test", { with: { "resolution-mode": "require" } }).a.b.c.d.e.f; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")], + import_token: IMPORT_KW@16..22 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@22..23 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@23..29 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@29..30 ")" [] [], + }, + qualifier_clause: missing (optional), + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@31..37 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@37..39 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@39..41 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@41..47 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@47..48 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@48..54 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@54..55 ")" [] [], + }, + qualifier_clause: missing (optional), + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@55..56 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@56..62 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@62..64 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@64..66 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: TYPEOF_KW@66..73 "typeof" [] [Whitespace(" ")], + import_token: IMPORT_KW@73..79 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@79..80 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@80..86 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@86..87 ")" [] [], + }, + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@87..88 "." [] [], + right: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@88..89 "a" [] [], + }, + dot_token: DOT@89..90 "." [] [], + right: JsName { + value_token: IDENT@90..91 "b" [] [], + }, + }, + dot_token: DOT@91..92 "." [] [], + right: JsName { + value_token: IDENT@92..93 "c" [] [], + }, + }, + dot_token: DOT@93..94 "." [] [], + right: JsName { + value_token: IDENT@94..95 "d" [] [], + }, + }, + dot_token: DOT@95..96 "." [] [], + right: JsName { + value_token: IDENT@96..97 "e" [] [], + }, + }, + dot_token: DOT@97..98 "." [] [], + right: JsName { + value_token: IDENT@98..99 "f" [] [], + }, + }, + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@99..100 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@106..108 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@108..110 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@110..116 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@116..117 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@117..123 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@123..124 ")" [] [], + }, + qualifier_clause: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@124..125 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@125..131 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@131..132 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@132..133 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@133..139 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@139..141 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@141..143 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@143..149 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@149..150 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@150..156 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@156..157 ")" [] [], + }, + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@157..158 "." [] [], + right: JsReferenceIdentifier { + value_token: IDENT@158..159 "C" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@159..160 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@160..166 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@166..167 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@167..168 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@168..174 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@174..176 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@176..178 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: TYPEOF_KW@178..185 "typeof" [] [Whitespace(" ")], + import_token: IMPORT_KW@185..191 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@191..192 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@192..198 "\"test\"" [] [], + }, + COMMA@198..200 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@200..202 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@202..206 "with" [] [], + }, + colon_token: COLON@206..208 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@208..210 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@210..227 "\"resolution-mode\"" [] [], + }, + colon_token: COLON@227..229 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@229..238 "\"import\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@238..240 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@240..241 "}" [] [], + }, + ], + r_paren_token: R_PAREN@241..242 ")" [] [], + }, + qualifier_clause: missing (optional), + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@242..243 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@243..249 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@249..251 "G" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@251..253 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@253..259 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@259..260 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@260..266 "\"test\"" [] [], + }, + COMMA@266..268 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@268..270 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@270..274 "with" [] [], + }, + colon_token: COLON@274..276 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@276..278 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@278..295 "\"resolution-mode\"" [] [], + }, + colon_token: COLON@295..297 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@297..306 "\"import\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@306..308 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@308..309 "}" [] [], + }, + ], + r_paren_token: R_PAREN@309..310 ")" [] [], + }, + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@310..311 "." [] [], + right: JsReferenceIdentifier { + value_token: IDENT@311..325 "TypeFromImport" [] [], + }, + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@325..326 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@326..332 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@332..334 "H" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@334..336 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@336..342 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@342..343 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@343..349 "\"test\"" [] [], + }, + COMMA@349..351 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@351..353 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@353..357 "with" [] [], + }, + colon_token: COLON@357..359 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@359..361 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@361..378 "\"resolution-mode\"" [] [], + }, + colon_token: COLON@378..380 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@380..389 "\"import\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@389..391 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@391..392 "}" [] [], + }, + ], + r_paren_token: R_PAREN@392..393 ")" [] [], + }, + qualifier_clause: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@393..394 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@394..400 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@400..401 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@401..402 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@402..408 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@408..410 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@410..412 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@412..418 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@418..419 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@419..425 "\"test\"" [] [], + }, + COMMA@425..427 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@427..429 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@429..433 "with" [] [], + }, + colon_token: COLON@433..435 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@435..437 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@437..454 "\"resolution-mode\"" [] [], + }, + colon_token: COLON@454..456 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@456..466 "\"require\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@466..468 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@468..469 "}" [] [], + }, + ], + r_paren_token: R_PAREN@469..470 ")" [] [], + }, + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@470..471 "." [] [], + right: JsReferenceIdentifier { + value_token: IDENT@471..472 "C" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@472..473 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@473..479 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@479..480 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@480..481 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@481..487 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@487..489 "J" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@489..491 "=" [] [Whitespace(" ")], + ty: TsImportType { + typeof_token: TYPEOF_KW@491..498 "typeof" [] [Whitespace(" ")], + import_token: IMPORT_KW@498..504 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@504..505 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@505..511 "\"test\"" [] [], + }, + COMMA@511..513 "," [] [Whitespace(" ")], + JsObjectExpression { + l_curly_token: L_CURLY@513..515 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@515..519 "with" [] [], + }, + colon_token: COLON@519..521 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@521..523 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: JS_STRING_LITERAL@523..540 "\"resolution-mode\"" [] [], + }, + colon_token: COLON@540..542 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@542..552 "\"require\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@552..554 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@554..555 "}" [] [], + }, + ], + r_paren_token: R_PAREN@555..556 ")" [] [], + }, + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@556..557 "." [] [], + right: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@557..558 "a" [] [], + }, + dot_token: DOT@558..559 "." [] [], + right: JsName { + value_token: IDENT@559..560 "b" [] [], + }, + }, + dot_token: DOT@560..561 "." [] [], + right: JsName { + value_token: IDENT@561..562 "c" [] [], + }, + }, + dot_token: DOT@562..563 "." [] [], + right: JsName { + value_token: IDENT@563..564 "d" [] [], + }, + }, + dot_token: DOT@564..565 "." [] [], + right: JsName { + value_token: IDENT@565..566 "e" [] [], + }, + }, + dot_token: DOT@566..567 "." [] [], + right: JsName { + value_token: IDENT@567..568 "f" [] [], + }, + }, + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@568..569 ";" [] [], + }, + ], + eof_token: EOF@569..570 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..570 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..569 + 0: TS_TYPE_ALIAS_DECLARATION@0..31 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@9..30 + 0: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")] + 1: IMPORT_KW@16..22 "import" [] [] + 2: JS_CALL_ARGUMENTS@22..30 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@23..29 + 0: JS_STRING_LITERAL_EXPRESSION@23..29 + 0: JS_STRING_LITERAL@23..29 "\"test\"" [] [] + 2: R_PAREN@29..30 ")" [] [] + 3: (empty) + 4: (empty) + 5: SEMICOLON@30..31 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@31..56 + 0: TYPE_KW@31..37 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@37..39 + 0: IDENT@37..39 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@39..41 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@41..55 + 0: (empty) + 1: IMPORT_KW@41..47 "import" [] [] + 2: JS_CALL_ARGUMENTS@47..55 + 0: L_PAREN@47..48 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@48..54 + 0: JS_STRING_LITERAL_EXPRESSION@48..54 + 0: JS_STRING_LITERAL@48..54 "\"test\"" [] [] + 2: R_PAREN@54..55 ")" [] [] + 3: (empty) + 4: (empty) + 5: SEMICOLON@55..56 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@56..100 + 0: TYPE_KW@56..62 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@62..64 + 0: IDENT@62..64 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@64..66 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@66..99 + 0: TYPEOF_KW@66..73 "typeof" [] [Whitespace(" ")] + 1: IMPORT_KW@73..79 "import" [] [] + 2: JS_CALL_ARGUMENTS@79..87 + 0: L_PAREN@79..80 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@80..86 + 0: JS_STRING_LITERAL_EXPRESSION@80..86 + 0: JS_STRING_LITERAL@80..86 "\"test\"" [] [] + 2: R_PAREN@86..87 ")" [] [] + 3: TS_IMPORT_TYPE_QUALIFIER@87..99 + 0: DOT@87..88 "." [] [] + 1: TS_QUALIFIED_NAME@88..99 + 0: TS_QUALIFIED_NAME@88..97 + 0: TS_QUALIFIED_NAME@88..95 + 0: TS_QUALIFIED_NAME@88..93 + 0: TS_QUALIFIED_NAME@88..91 + 0: JS_REFERENCE_IDENTIFIER@88..89 + 0: IDENT@88..89 "a" [] [] + 1: DOT@89..90 "." [] [] + 2: JS_NAME@90..91 + 0: IDENT@90..91 "b" [] [] + 1: DOT@91..92 "." [] [] + 2: JS_NAME@92..93 + 0: IDENT@92..93 "c" [] [] + 1: DOT@93..94 "." [] [] + 2: JS_NAME@94..95 + 0: IDENT@94..95 "d" [] [] + 1: DOT@95..96 "." [] [] + 2: JS_NAME@96..97 + 0: IDENT@96..97 "e" [] [] + 1: DOT@97..98 "." [] [] + 2: JS_NAME@98..99 + 0: IDENT@98..99 "f" [] [] + 4: (empty) + 5: SEMICOLON@99..100 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@100..133 + 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@106..108 + 0: IDENT@106..108 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@108..110 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@110..132 + 0: (empty) + 1: IMPORT_KW@110..116 "import" [] [] + 2: JS_CALL_ARGUMENTS@116..124 + 0: L_PAREN@116..117 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@117..123 + 0: JS_STRING_LITERAL_EXPRESSION@117..123 + 0: JS_STRING_LITERAL@117..123 "\"test\"" [] [] + 2: R_PAREN@123..124 ")" [] [] + 3: (empty) + 4: TS_TYPE_ARGUMENTS@124..132 + 0: L_ANGLE@124..125 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@125..131 + 0: TS_STRING_TYPE@125..131 + 0: STRING_KW@125..131 "string" [] [] + 2: R_ANGLE@131..132 ">" [] [] + 5: SEMICOLON@132..133 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@133..168 + 0: TYPE_KW@133..139 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@139..141 + 0: IDENT@139..141 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@141..143 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@143..167 + 0: (empty) + 1: IMPORT_KW@143..149 "import" [] [] + 2: JS_CALL_ARGUMENTS@149..157 + 0: L_PAREN@149..150 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@150..156 + 0: JS_STRING_LITERAL_EXPRESSION@150..156 + 0: JS_STRING_LITERAL@150..156 "\"test\"" [] [] + 2: R_PAREN@156..157 ")" [] [] + 3: TS_IMPORT_TYPE_QUALIFIER@157..159 + 0: DOT@157..158 "." [] [] + 1: JS_REFERENCE_IDENTIFIER@158..159 + 0: IDENT@158..159 "C" [] [] + 4: TS_TYPE_ARGUMENTS@159..167 + 0: L_ANGLE@159..160 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@160..166 + 0: TS_STRING_TYPE@160..166 + 0: STRING_KW@160..166 "string" [] [] + 2: R_ANGLE@166..167 ">" [] [] + 5: SEMICOLON@167..168 ";" [] [] + 5: TS_TYPE_ALIAS_DECLARATION@168..243 + 0: TYPE_KW@168..174 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@174..176 + 0: IDENT@174..176 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@176..178 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@178..242 + 0: TYPEOF_KW@178..185 "typeof" [] [Whitespace(" ")] + 1: IMPORT_KW@185..191 "import" [] [] + 2: JS_CALL_ARGUMENTS@191..242 + 0: L_PAREN@191..192 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@192..241 + 0: JS_STRING_LITERAL_EXPRESSION@192..198 + 0: JS_STRING_LITERAL@192..198 "\"test\"" [] [] + 1: COMMA@198..200 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@200..241 + 0: L_CURLY@200..202 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@202..240 + 0: JS_PROPERTY_OBJECT_MEMBER@202..240 + 0: JS_LITERAL_MEMBER_NAME@202..206 + 0: IDENT@202..206 "with" [] [] + 1: COLON@206..208 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@208..240 + 0: L_CURLY@208..210 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@210..238 + 0: JS_PROPERTY_OBJECT_MEMBER@210..238 + 0: JS_LITERAL_MEMBER_NAME@210..227 + 0: JS_STRING_LITERAL@210..227 "\"resolution-mode\"" [] [] + 1: COLON@227..229 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@229..238 + 0: JS_STRING_LITERAL@229..238 "\"import\"" [] [Whitespace(" ")] + 2: R_CURLY@238..240 "}" [] [Whitespace(" ")] + 2: R_CURLY@240..241 "}" [] [] + 2: R_PAREN@241..242 ")" [] [] + 3: (empty) + 4: (empty) + 5: SEMICOLON@242..243 ";" [] [] + 6: TS_TYPE_ALIAS_DECLARATION@243..326 + 0: TYPE_KW@243..249 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@249..251 + 0: IDENT@249..251 "G" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@251..253 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@253..325 + 0: (empty) + 1: IMPORT_KW@253..259 "import" [] [] + 2: JS_CALL_ARGUMENTS@259..310 + 0: L_PAREN@259..260 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@260..309 + 0: JS_STRING_LITERAL_EXPRESSION@260..266 + 0: JS_STRING_LITERAL@260..266 "\"test\"" [] [] + 1: COMMA@266..268 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@268..309 + 0: L_CURLY@268..270 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@270..308 + 0: JS_PROPERTY_OBJECT_MEMBER@270..308 + 0: JS_LITERAL_MEMBER_NAME@270..274 + 0: IDENT@270..274 "with" [] [] + 1: COLON@274..276 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@276..308 + 0: L_CURLY@276..278 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@278..306 + 0: JS_PROPERTY_OBJECT_MEMBER@278..306 + 0: JS_LITERAL_MEMBER_NAME@278..295 + 0: JS_STRING_LITERAL@278..295 "\"resolution-mode\"" [] [] + 1: COLON@295..297 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@297..306 + 0: JS_STRING_LITERAL@297..306 "\"import\"" [] [Whitespace(" ")] + 2: R_CURLY@306..308 "}" [] [Whitespace(" ")] + 2: R_CURLY@308..309 "}" [] [] + 2: R_PAREN@309..310 ")" [] [] + 3: TS_IMPORT_TYPE_QUALIFIER@310..325 + 0: DOT@310..311 "." [] [] + 1: JS_REFERENCE_IDENTIFIER@311..325 + 0: IDENT@311..325 "TypeFromImport" [] [] + 4: (empty) + 5: SEMICOLON@325..326 ";" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@326..402 + 0: TYPE_KW@326..332 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@332..334 + 0: IDENT@332..334 "H" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@334..336 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@336..401 + 0: (empty) + 1: IMPORT_KW@336..342 "import" [] [] + 2: JS_CALL_ARGUMENTS@342..393 + 0: L_PAREN@342..343 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@343..392 + 0: JS_STRING_LITERAL_EXPRESSION@343..349 + 0: JS_STRING_LITERAL@343..349 "\"test\"" [] [] + 1: COMMA@349..351 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@351..392 + 0: L_CURLY@351..353 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@353..391 + 0: JS_PROPERTY_OBJECT_MEMBER@353..391 + 0: JS_LITERAL_MEMBER_NAME@353..357 + 0: IDENT@353..357 "with" [] [] + 1: COLON@357..359 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@359..391 + 0: L_CURLY@359..361 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@361..389 + 0: JS_PROPERTY_OBJECT_MEMBER@361..389 + 0: JS_LITERAL_MEMBER_NAME@361..378 + 0: JS_STRING_LITERAL@361..378 "\"resolution-mode\"" [] [] + 1: COLON@378..380 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@380..389 + 0: JS_STRING_LITERAL@380..389 "\"import\"" [] [Whitespace(" ")] + 2: R_CURLY@389..391 "}" [] [Whitespace(" ")] + 2: R_CURLY@391..392 "}" [] [] + 2: R_PAREN@392..393 ")" [] [] + 3: (empty) + 4: TS_TYPE_ARGUMENTS@393..401 + 0: L_ANGLE@393..394 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@394..400 + 0: TS_STRING_TYPE@394..400 + 0: STRING_KW@394..400 "string" [] [] + 2: R_ANGLE@400..401 ">" [] [] + 5: SEMICOLON@401..402 ";" [] [] + 8: TS_TYPE_ALIAS_DECLARATION@402..481 + 0: TYPE_KW@402..408 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@408..410 + 0: IDENT@408..410 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@410..412 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@412..480 + 0: (empty) + 1: IMPORT_KW@412..418 "import" [] [] + 2: JS_CALL_ARGUMENTS@418..470 + 0: L_PAREN@418..419 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@419..469 + 0: JS_STRING_LITERAL_EXPRESSION@419..425 + 0: JS_STRING_LITERAL@419..425 "\"test\"" [] [] + 1: COMMA@425..427 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@427..469 + 0: L_CURLY@427..429 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@429..468 + 0: JS_PROPERTY_OBJECT_MEMBER@429..468 + 0: JS_LITERAL_MEMBER_NAME@429..433 + 0: IDENT@429..433 "with" [] [] + 1: COLON@433..435 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@435..468 + 0: L_CURLY@435..437 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@437..466 + 0: JS_PROPERTY_OBJECT_MEMBER@437..466 + 0: JS_LITERAL_MEMBER_NAME@437..454 + 0: JS_STRING_LITERAL@437..454 "\"resolution-mode\"" [] [] + 1: COLON@454..456 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@456..466 + 0: JS_STRING_LITERAL@456..466 "\"require\"" [] [Whitespace(" ")] + 2: R_CURLY@466..468 "}" [] [Whitespace(" ")] + 2: R_CURLY@468..469 "}" [] [] + 2: R_PAREN@469..470 ")" [] [] + 3: TS_IMPORT_TYPE_QUALIFIER@470..472 + 0: DOT@470..471 "." [] [] + 1: JS_REFERENCE_IDENTIFIER@471..472 + 0: IDENT@471..472 "C" [] [] + 4: TS_TYPE_ARGUMENTS@472..480 + 0: L_ANGLE@472..473 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@473..479 + 0: TS_STRING_TYPE@473..479 + 0: STRING_KW@473..479 "string" [] [] + 2: R_ANGLE@479..480 ">" [] [] + 5: SEMICOLON@480..481 ";" [] [] + 9: TS_TYPE_ALIAS_DECLARATION@481..569 + 0: TYPE_KW@481..487 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@487..489 + 0: IDENT@487..489 "J" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@489..491 "=" [] [Whitespace(" ")] + 4: TS_IMPORT_TYPE@491..568 + 0: TYPEOF_KW@491..498 "typeof" [] [Whitespace(" ")] + 1: IMPORT_KW@498..504 "import" [] [] + 2: JS_CALL_ARGUMENTS@504..556 + 0: L_PAREN@504..505 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@505..555 + 0: JS_STRING_LITERAL_EXPRESSION@505..511 + 0: JS_STRING_LITERAL@505..511 "\"test\"" [] [] + 1: COMMA@511..513 "," [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@513..555 + 0: L_CURLY@513..515 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@515..554 + 0: JS_PROPERTY_OBJECT_MEMBER@515..554 + 0: JS_LITERAL_MEMBER_NAME@515..519 + 0: IDENT@515..519 "with" [] [] + 1: COLON@519..521 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@521..554 + 0: L_CURLY@521..523 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@523..552 + 0: JS_PROPERTY_OBJECT_MEMBER@523..552 + 0: JS_LITERAL_MEMBER_NAME@523..540 + 0: JS_STRING_LITERAL@523..540 "\"resolution-mode\"" [] [] + 1: COLON@540..542 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@542..552 + 0: JS_STRING_LITERAL@542..552 "\"require\"" [] [Whitespace(" ")] + 2: R_CURLY@552..554 "}" [] [Whitespace(" ")] + 2: R_CURLY@554..555 "}" [] [] + 2: R_PAREN@555..556 ")" [] [] + 3: TS_IMPORT_TYPE_QUALIFIER@556..568 + 0: DOT@556..557 "." [] [] + 1: TS_QUALIFIED_NAME@557..568 + 0: TS_QUALIFIED_NAME@557..566 + 0: TS_QUALIFIED_NAME@557..564 + 0: TS_QUALIFIED_NAME@557..562 + 0: TS_QUALIFIED_NAME@557..560 + 0: JS_REFERENCE_IDENTIFIER@557..558 + 0: IDENT@557..558 "a" [] [] + 1: DOT@558..559 "." [] [] + 2: JS_NAME@559..560 + 0: IDENT@559..560 "b" [] [] + 1: DOT@560..561 "." [] [] + 2: JS_NAME@561..562 + 0: IDENT@561..562 "c" [] [] + 1: DOT@562..563 "." [] [] + 2: JS_NAME@563..564 + 0: IDENT@563..564 "d" [] [] + 1: DOT@564..565 "." [] [] + 2: JS_NAME@565..566 + 0: IDENT@565..566 "e" [] [] + 1: DOT@566..567 "." [] [] + 2: JS_NAME@567..568 + 0: IDENT@567..568 "f" [] [] + 4: (empty) + 5: SEMICOLON@568..569 ";" [] [] + 4: EOF@569..570 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap new file mode 100644 index 000000000000..3364533d81d6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap @@ -0,0 +1,194 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + [a: number]: string; +} +class B { + [index: string]: { prop } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + TsIndexSignatureClassMember { + modifiers: TsIndexSignatureModifierList [], + l_brack_token: L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@15..16 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@16..18 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@18..24 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@24..25 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@25..27 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@27..33 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + ], + r_curly_token: R_CURLY@34..36 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@36..43 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@43..45 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..46 "{" [] [], + members: JsClassMemberList [ + TsIndexSignatureClassMember { + modifiers: TsIndexSignatureModifierList [], + l_brack_token: L_BRACK@46..52 "[" [Newline("\n"), Whitespace(" ")] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@52..57 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@57..59 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@59..65 "string" [] [], + }, + }, + }, + r_brack_token: R_BRACK@65..66 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@66..68 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@68..70 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@70..75 "prop" [] [Whitespace(" ")], + }, + optional_token: missing (optional), + type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@75..76 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@76..78 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@78..79 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..79 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..78 + 0: JS_CLASS_DECLARATION@0..36 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..34 + 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@9..34 + 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@9..9 + 1: L_BRACK@9..15 "[" [Newline("\n"), Whitespace(" ")] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@15..24 + 0: JS_IDENTIFIER_BINDING@15..16 + 0: IDENT@15..16 "a" [] [] + 1: TS_TYPE_ANNOTATION@16..24 + 0: COLON@16..18 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@18..24 + 0: NUMBER_KW@18..24 "number" [] [] + 3: R_BRACK@24..25 "]" [] [] + 4: TS_TYPE_ANNOTATION@25..33 + 0: COLON@25..27 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@27..33 + 0: STRING_KW@27..33 "string" [] [] + 5: SEMICOLON@33..34 ";" [] [] + 9: R_CURLY@34..36 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@36..78 + 0: JS_DECORATOR_LIST@36..36 + 1: (empty) + 2: CLASS_KW@36..43 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..46 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@46..76 + 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@46..76 + 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@46..46 + 1: L_BRACK@46..52 "[" [Newline("\n"), Whitespace(" ")] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@52..65 + 0: JS_IDENTIFIER_BINDING@52..57 + 0: IDENT@52..57 "index" [] [] + 1: TS_TYPE_ANNOTATION@57..65 + 0: COLON@57..59 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@59..65 + 0: STRING_KW@59..65 "string" [] [] + 3: R_BRACK@65..66 "]" [] [] + 4: TS_TYPE_ANNOTATION@66..76 + 0: COLON@66..68 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@68..76 + 0: L_CURLY@68..70 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@70..75 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@70..75 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@70..75 + 0: IDENT@70..75 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_CURLY@75..76 "}" [] [] + 5: (empty) + 9: R_CURLY@76..78 "}" [Newline("\n")] [] + 4: EOF@78..79 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap new file mode 100644 index 000000000000..d1cf70e09eaf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap @@ -0,0 +1,190 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + static [a: number]: string; +} +class B { + static readonly [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + TsIndexSignatureClassMember { + modifiers: TsIndexSignatureModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@9..21 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + l_brack_token: L_BRACK@21..22 "[" [] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@22..23 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@25..31 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@31..32 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@34..40 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@40..41 ";" [] [], + }, + ], + r_curly_token: R_CURLY@41..43 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@50..52 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@52..53 "{" [] [], + members: JsClassMemberList [ + TsIndexSignatureClassMember { + modifiers: TsIndexSignatureModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@53..65 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@65..74 "readonly" [] [Whitespace(" ")], + }, + ], + l_brack_token: L_BRACK@74..75 "[" [] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@75..76 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@76..78 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@78..84 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@84..85 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@85..87 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@87..93 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@93..94 ";" [] [], + }, + ], + r_curly_token: R_CURLY@94..96 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@96..97 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..97 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..96 + 0: JS_CLASS_DECLARATION@0..43 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..41 + 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@9..41 + 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@9..21 + 0: JS_STATIC_MODIFIER@9..21 + 0: STATIC_KW@9..21 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@21..22 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@22..31 + 0: JS_IDENTIFIER_BINDING@22..23 + 0: IDENT@22..23 "a" [] [] + 1: TS_TYPE_ANNOTATION@23..31 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@25..31 + 0: NUMBER_KW@25..31 "number" [] [] + 3: R_BRACK@31..32 "]" [] [] + 4: TS_TYPE_ANNOTATION@32..40 + 0: COLON@32..34 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@34..40 + 0: STRING_KW@34..40 "string" [] [] + 5: SEMICOLON@40..41 ";" [] [] + 9: R_CURLY@41..43 "}" [Newline("\n")] [] + 1: JS_CLASS_DECLARATION@43..96 + 0: JS_DECORATOR_LIST@43..43 + 1: (empty) + 2: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@50..52 + 0: IDENT@50..52 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@52..53 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@53..94 + 0: TS_INDEX_SIGNATURE_CLASS_MEMBER@53..94 + 0: TS_INDEX_SIGNATURE_MODIFIER_LIST@53..74 + 0: JS_STATIC_MODIFIER@53..65 + 0: STATIC_KW@53..65 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@65..74 + 0: READONLY_KW@65..74 "readonly" [] [Whitespace(" ")] + 1: L_BRACK@74..75 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@75..84 + 0: JS_IDENTIFIER_BINDING@75..76 + 0: IDENT@75..76 "a" [] [] + 1: TS_TYPE_ANNOTATION@76..84 + 0: COLON@76..78 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@78..84 + 0: NUMBER_KW@78..84 "number" [] [] + 3: R_BRACK@84..85 "]" [] [] + 4: TS_TYPE_ANNOTATION@85..93 + 0: COLON@85..87 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@87..93 + 0: STRING_KW@87..93 "string" [] [] + 5: SEMICOLON@93..94 ";" [] [] + 9: R_CURLY@94..96 "}" [Newline("\n")] [] + 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap new file mode 100644 index 000000000000..1276e75f54b0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap @@ -0,0 +1,245 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + [a: number]: string; +} +interface B { + [index: string]: { prop } +} +interface C { + readonly [a: number]: string; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@12..13 "{" [] [], + members: TsTypeMemberList [ + TsIndexSignatureTypeMember { + readonly_token: missing (optional), + l_brack_token: L_BRACK@13..19 "[" [Newline("\n"), Whitespace(" ")] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@19..20 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@20..22 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@22..28 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@28..29 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@29..31 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@31..37 "string" [] [], + }, + }, + separator_token: SEMICOLON@37..38 ";" [] [], + }, + ], + r_curly_token: R_CURLY@38..40 "}" [Newline("\n")] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@40..51 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@51..53 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@53..54 "{" [] [], + members: TsTypeMemberList [ + TsIndexSignatureTypeMember { + readonly_token: missing (optional), + l_brack_token: L_BRACK@54..60 "[" [Newline("\n"), Whitespace(" ")] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@60..65 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@65..67 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@67..73 "string" [] [], + }, + }, + }, + r_brack_token: R_BRACK@73..74 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@74..76 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@76..78 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@78..83 "prop" [] [Whitespace(" ")], + }, + optional_token: missing (optional), + type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@83..84 "}" [] [], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@84..86 "}" [Newline("\n")] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@86..97 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@97..99 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@99..100 "{" [] [], + members: TsTypeMemberList [ + TsIndexSignatureTypeMember { + readonly_token: READONLY_KW@100..114 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + l_brack_token: L_BRACK@114..115 "[" [] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@115..116 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@116..118 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@118..124 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@124..125 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@125..127 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@127..133 "string" [] [], + }, + }, + separator_token: SEMICOLON@133..134 ";" [] [], + }, + ], + r_curly_token: R_CURLY@134..136 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@136..137 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..137 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..136 + 0: TS_INTERFACE_DECLARATION@0..40 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@12..13 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@13..38 + 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@13..38 + 0: (empty) + 1: L_BRACK@13..19 "[" [Newline("\n"), Whitespace(" ")] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@19..28 + 0: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "a" [] [] + 1: TS_TYPE_ANNOTATION@20..28 + 0: COLON@20..22 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@22..28 + 0: NUMBER_KW@22..28 "number" [] [] + 3: R_BRACK@28..29 "]" [] [] + 4: TS_TYPE_ANNOTATION@29..37 + 0: COLON@29..31 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@31..37 + 0: STRING_KW@31..37 "string" [] [] + 5: SEMICOLON@37..38 ";" [] [] + 6: R_CURLY@38..40 "}" [Newline("\n")] [] + 1: TS_INTERFACE_DECLARATION@40..86 + 0: INTERFACE_KW@40..51 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@51..53 + 0: IDENT@51..53 "B" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@53..54 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@54..84 + 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@54..84 + 0: (empty) + 1: L_BRACK@54..60 "[" [Newline("\n"), Whitespace(" ")] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@60..73 + 0: JS_IDENTIFIER_BINDING@60..65 + 0: IDENT@60..65 "index" [] [] + 1: TS_TYPE_ANNOTATION@65..73 + 0: COLON@65..67 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@67..73 + 0: STRING_KW@67..73 "string" [] [] + 3: R_BRACK@73..74 "]" [] [] + 4: TS_TYPE_ANNOTATION@74..84 + 0: COLON@74..76 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@76..84 + 0: L_CURLY@76..78 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@78..83 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@78..83 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@78..83 + 0: IDENT@78..83 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_CURLY@83..84 "}" [] [] + 5: (empty) + 6: R_CURLY@84..86 "}" [Newline("\n")] [] + 2: TS_INTERFACE_DECLARATION@86..136 + 0: INTERFACE_KW@86..97 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@97..99 + 0: IDENT@97..99 "C" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@99..100 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@100..134 + 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@100..134 + 0: READONLY_KW@100..114 "readonly" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_BRACK@114..115 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@115..124 + 0: JS_IDENTIFIER_BINDING@115..116 + 0: IDENT@115..116 "a" [] [] + 1: TS_TYPE_ANNOTATION@116..124 + 0: COLON@116..118 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@118..124 + 0: NUMBER_KW@118..124 "number" [] [] + 3: R_BRACK@124..125 "]" [] [] + 4: TS_TYPE_ANNOTATION@125..133 + 0: COLON@125..127 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@127..133 + 0: STRING_KW@127..133 "string" [] [] + 5: SEMICOLON@133..134 ";" [] [] + 6: R_CURLY@134..136 "}" [Newline("\n")] [] + 4: EOF@136..137 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts.snap new file mode 100644 index 000000000000..20619a145e38 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts.snap @@ -0,0 +1,290 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { [a: number]: string } +type B = { readonly [a: number]: string } +// not an index signature +type C = { [a]: string } +type D = { readonly [a]: string } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsIndexSignatureTypeMember { + readonly_token: missing (optional), + l_brack_token: L_BRACK@11..12 "[" [] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@12..13 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@15..21 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@21..22 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@22..24 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@24..31 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@38..40 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsIndexSignatureTypeMember { + readonly_token: READONLY_KW@44..53 "readonly" [] [Whitespace(" ")], + l_brack_token: L_BRACK@53..54 "[" [] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@54..55 "a" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@55..57 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@57..63 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@63..64 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@64..66 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@66..73 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@74..106 "type" [Newline("\n"), Comments("// not an index signa ..."), Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@106..108 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@108..110 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@110..112 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsComputedMemberName { + l_brack_token: L_BRACK@112..113 "[" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@113..114 "a" [] [], + }, + }, + r_brack_token: R_BRACK@114..115 "]" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@115..117 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@117..124 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@124..125 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@125..131 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@131..133 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@133..135 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@135..137 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: READONLY_KW@137..146 "readonly" [] [Whitespace(" ")], + name: JsComputedMemberName { + l_brack_token: L_BRACK@146..147 "[" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@147..148 "a" [] [], + }, + }, + r_brack_token: R_BRACK@148..149 "]" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@149..151 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@151..158 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@158..159 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@159..160 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..160 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..159 + 0: TS_TYPE_ALIAS_DECLARATION@0..32 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..32 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..31 + 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@11..31 + 0: (empty) + 1: L_BRACK@11..12 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@12..21 + 0: JS_IDENTIFIER_BINDING@12..13 + 0: IDENT@12..13 "a" [] [] + 1: TS_TYPE_ANNOTATION@13..21 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@15..21 + 0: NUMBER_KW@15..21 "number" [] [] + 3: R_BRACK@21..22 "]" [] [] + 4: TS_TYPE_ANNOTATION@22..31 + 0: COLON@22..24 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@24..31 + 0: STRING_KW@24..31 "string" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@31..32 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@32..74 + 0: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@38..40 + 0: IDENT@38..40 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@40..42 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@42..74 + 0: L_CURLY@42..44 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@44..73 + 0: TS_INDEX_SIGNATURE_TYPE_MEMBER@44..73 + 0: READONLY_KW@44..53 "readonly" [] [Whitespace(" ")] + 1: L_BRACK@53..54 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@54..63 + 0: JS_IDENTIFIER_BINDING@54..55 + 0: IDENT@54..55 "a" [] [] + 1: TS_TYPE_ANNOTATION@55..63 + 0: COLON@55..57 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@57..63 + 0: NUMBER_KW@57..63 "number" [] [] + 3: R_BRACK@63..64 "]" [] [] + 4: TS_TYPE_ANNOTATION@64..73 + 0: COLON@64..66 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@66..73 + 0: STRING_KW@66..73 "string" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@73..74 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@74..125 + 0: TYPE_KW@74..106 "type" [Newline("\n"), Comments("// not an index signa ..."), Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@106..108 + 0: IDENT@106..108 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@108..110 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@110..125 + 0: L_CURLY@110..112 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@112..124 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@112..124 + 0: (empty) + 1: JS_COMPUTED_MEMBER_NAME@112..115 + 0: L_BRACK@112..113 "[" [] [] + 1: JS_IDENTIFIER_EXPRESSION@113..114 + 0: JS_REFERENCE_IDENTIFIER@113..114 + 0: IDENT@113..114 "a" [] [] + 2: R_BRACK@114..115 "]" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@115..124 + 0: COLON@115..117 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@117..124 + 0: STRING_KW@117..124 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@124..125 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@125..159 + 0: TYPE_KW@125..131 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@131..133 + 0: IDENT@131..133 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@133..135 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@135..159 + 0: L_CURLY@135..137 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@137..158 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@137..158 + 0: READONLY_KW@137..146 "readonly" [] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_NAME@146..149 + 0: L_BRACK@146..147 "[" [] [] + 1: JS_IDENTIFIER_EXPRESSION@147..148 + 0: JS_REFERENCE_IDENTIFIER@147..148 + 0: IDENT@147..148 "a" [] [] + 2: R_BRACK@148..149 "]" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@149..158 + 0: COLON@149..151 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@151..158 + 0: STRING_KW@151..158 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@158..159 "}" [] [] + 5: (empty) + 4: EOF@159..160 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts.snap new file mode 100644 index 000000000000..0c41570d775b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts.snap @@ -0,0 +1,134 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string[number]; +type B = string[number][number][number][]; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsStringType { + string_token: STRING_KW@9..15 "string" [] [], + }, + l_brack_token: L_BRACK@15..16 "[" [] [], + index_type: TsNumberType { + number_token: NUMBER_KW@16..22 "number" [] [], + }, + r_brack_token: R_BRACK@22..23 "]" [] [], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@30..32 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@32..34 "=" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsIndexedAccessType { + object_type: TsIndexedAccessType { + object_type: TsIndexedAccessType { + object_type: TsStringType { + string_token: STRING_KW@34..40 "string" [] [], + }, + l_brack_token: L_BRACK@40..41 "[" [] [], + index_type: TsNumberType { + number_token: NUMBER_KW@41..47 "number" [] [], + }, + r_brack_token: R_BRACK@47..48 "]" [] [], + }, + l_brack_token: L_BRACK@48..49 "[" [] [], + index_type: TsNumberType { + number_token: NUMBER_KW@49..55 "number" [] [], + }, + r_brack_token: R_BRACK@55..56 "]" [] [], + }, + l_brack_token: L_BRACK@56..57 "[" [] [], + index_type: TsNumberType { + number_token: NUMBER_KW@57..63 "number" [] [], + }, + r_brack_token: R_BRACK@63..64 "]" [] [], + }, + l_brack_token: L_BRACK@64..65 "[" [] [], + r_brack_token: R_BRACK@65..66 "]" [] [], + }, + semicolon_token: SEMICOLON@66..67 ";" [] [], + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: TS_TYPE_ALIAS_DECLARATION@0..24 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_INDEXED_ACCESS_TYPE@9..23 + 0: TS_STRING_TYPE@9..15 + 0: STRING_KW@9..15 "string" [] [] + 1: L_BRACK@15..16 "[" [] [] + 2: TS_NUMBER_TYPE@16..22 + 0: NUMBER_KW@16..22 "number" [] [] + 3: R_BRACK@22..23 "]" [] [] + 5: SEMICOLON@23..24 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@24..67 + 0: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@30..32 + 0: IDENT@30..32 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@32..34 "=" [] [Whitespace(" ")] + 4: TS_ARRAY_TYPE@34..66 + 0: TS_INDEXED_ACCESS_TYPE@34..64 + 0: TS_INDEXED_ACCESS_TYPE@34..56 + 0: TS_INDEXED_ACCESS_TYPE@34..48 + 0: TS_STRING_TYPE@34..40 + 0: STRING_KW@34..40 "string" [] [] + 1: L_BRACK@40..41 "[" [] [] + 2: TS_NUMBER_TYPE@41..47 + 0: NUMBER_KW@41..47 "number" [] [] + 3: R_BRACK@47..48 "]" [] [] + 1: L_BRACK@48..49 "[" [] [] + 2: TS_NUMBER_TYPE@49..55 + 0: NUMBER_KW@49..55 "number" [] [] + 3: R_BRACK@55..56 "]" [] [] + 1: L_BRACK@56..57 "[" [] [] + 2: TS_NUMBER_TYPE@57..63 + 0: NUMBER_KW@57..63 "number" [] [] + 3: R_BRACK@63..64 "]" [] [] + 1: L_BRACK@64..65 "[" [] [] + 2: R_BRACK@65..66 "]" [] [] + 5: SEMICOLON@66..67 ";" [] [] + 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap new file mode 100644 index 000000000000..64b2bd234f49 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap @@ -0,0 +1,5298 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type Args = F extends (...args: infer A) => void ? A : never; +type A = T extends import("test").C ? P : never +type A = T extends typeof Array ? P : never +type A = T extends { set(a: infer P): number } ? P : never +type A = T extends { get(): infer P } ? P : never +type A = T extends { method(this: infer P): number } ? P : never +type valid9 = T extends Array ? R : any; +type ContentBetweenBrackets = S extends `[${infer T}]` ? T : never; +type WithSelectors = S extends { getState: () => infer T } + ? S & { use: { [K in keyof T]: () => T[K] } } + : never; +type A = MyType extends (OtherType extends infer T ? infer U : InnerFalse) ? OuterTrue : OuterFalse +type Join = + T extends [] ? '' : + T extends [string | number | boolean | bigint] ? `${T[0]}` : + T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : + string; +type MatchPair = S extends `[${infer A},${infer B}]` ? [A, B] : unknown; +type FirstTwoAndRest = S extends `${infer A}${infer B}${infer R}` ? [`${A}${B}`, R] : unknown; +type Trim = + S extends `${infer T} ` ? Trim : + S; +type Foo = T extends `*${infer S}*` ? S : never; +type Unpacked = T extends (infer U)[] ? U : + T extends (...args: any[]) => infer U ? U : + T extends Promise ? U : + T; +type ArgumentType any> = T extends (a: infer A) => any ? A : any; +type X3 = T extends { a: (x: infer U) => void, b: (x: infer U) => void } ? U : never; +type X1 = T extends { x: infer X, y: infer Y } ? [X, Y] : any; +type T62 = U extends (infer U)[] ? U : U; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; +type T75 = T extends T74 ? T70 | T72 | T74 : never; +type Jsonified = T extends string | number | boolean | null ? T + : T extends undefined | Function ? never + : T extends { toJSON(): infer R } ? R + : T extends object ? JsonifiedObject +: "what is this"; +type T1 = F1 extends (...args: (infer T)) => void ? T : never; +type T2 = F1 extends (args: [...(infer T)]) => void ? T : never; +type T3 = T extends IsNumber<(infer N)> ? true : false; +type T4 = F1 extends (...args: ((infer T))) => void ? T : never; +type T5 = F1 extends (args: [...((infer T))]) => void ? T : never; +type T6 = T extends IsNumber<((infer N))> ? true : false; +type T7 = F1 extends (...args: ((((infer T))))) => void ? T : never; +type T8 = F1 extends (args: [...((((infer T))))]) => void ? T : never; +type T9 = T extends IsNumber<((((infer N))))> ? true : false; +type Prepend = + ((head: E, ...args: T) => any) extends ((...args: infer U) => any) + ? U + : T; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..9 "Args" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@9..10 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@10..11 "F" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@11..13 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@13..15 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@15..17 "F" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@17..25 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@25..26 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@26..29 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@29..33 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@33..35 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@35..41 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@41..42 "A" [] [], + }, + constraint: missing (optional), + }, + }, + }, + ], + r_paren_token: R_PAREN@42..44 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@47..52 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@52..54 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@54..56 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@56..58 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@58..63 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@70..72 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@72..74 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@74..76 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@76..84 "extends" [] [Whitespace(" ")], + extends_type: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@84..90 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@90..91 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@91..97 "\"test\"" [] [], + }, + ], + r_paren_token: R_PAREN@97..98 ")" [] [], + }, + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@98..99 "." [] [], + right: JsReferenceIdentifier { + value_token: IDENT@99..100 "C" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@100..101 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@101..107 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@107..108 "P" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@108..110 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@110..112 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@112..114 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@114..116 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@116..121 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@121..127 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@127..129 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@129..131 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@131..133 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@133..141 "extends" [] [Whitespace(" ")], + extends_type: TsTypeofType { + typeof_token: TYPEOF_KW@141..148 "typeof" [] [Whitespace(" ")], + expression_name: JsReferenceIdentifier { + value_token: IDENT@148..153 "Array" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@153..154 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@154..160 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@160..161 "P" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@161..163 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@163..165 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@165..167 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@167..169 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@169..174 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@174..180 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@180..182 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@182..184 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@184..186 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@186..194 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@194..196 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@196..199 "set" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@199..200 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@200..201 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@201..203 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@203..209 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@209..210 "P" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@210..211 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@211..213 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@213..220 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@220..222 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@222..224 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@224..226 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@226..228 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@228..233 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@233..239 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@239..241 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@241..243 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@243..245 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@245..253 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@253..255 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@255..258 "get" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@258..259 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@259..260 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@260..262 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@262..268 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@268..270 "P" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@270..272 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@272..274 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@274..276 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@276..278 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@278..283 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@283..289 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@289..291 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@291..293 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@293..295 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@295..303 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@303..305 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@305..311 "method" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@311..312 "(" [] [], + items: JsParameterList [ + TsThisParameter { + this_token: THIS_KW@312..316 "this" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@316..318 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@318..324 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@324..325 "P" [] [], + }, + constraint: missing (optional), + }, + }, + }, + ], + r_paren_token: R_PAREN@325..326 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@326..328 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@328..335 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@335..337 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@337..339 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@339..341 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@341..343 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@343..348 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@348..354 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@354..360 "valid9" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@360..361 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@361..362 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@362..364 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@364..366 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@366..368 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@376..381 "Array" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@381..382 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@382..388 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@388..389 "R" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@389..391 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@391..393 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@393..395 "R" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@395..397 ":" [] [Whitespace(" ")], + false_type: TsAnyType { + any_token: ANY_KW@397..400 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@400..401 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@401..407 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@407..429 "ContentBetweenBrackets" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@429..430 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@430..431 "S" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@431..433 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@433..435 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@435..437 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@437..445 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@445..446 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@446..447 "[" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@447..449 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@449..455 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@455..456 "T" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@456..457 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@457..458 "]" [] [], + }, + ], + r_tick_token: BACKTICK@458..460 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@460..462 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@462..464 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@464..466 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@466..471 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@471..472 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@472..478 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@478..491 "WithSelectors" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@491..492 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@492..493 "S" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@493..495 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@495..497 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@497..499 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@499..507 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@507..509 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@509..517 "getState" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@517..519 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@519..520 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@520..522 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@525..531 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@531..533 "T" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@533..534 "}" [] [], + }, + question_mark_token: QUESTION@534..541 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + true_type: TsIntersectionType { + leading_separator_token: missing (optional), + types: TsIntersectionTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@541..543 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + AMP@543..545 "&" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@545..547 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@547..550 "use" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@550..552 ":" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@552..554 "{" [] [Whitespace(" ")], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@554..555 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@555..557 "K" [] [Whitespace(" ")], + }, + in_token: IN_KW@557..560 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@560..566 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@566..567 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@567..568 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@568..570 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@570..571 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@571..573 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@573..576 "=>" [] [Whitespace(" ")], + return_type: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@576..577 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@577..578 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@578..579 "K" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@579..581 "]" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + r_curly_token: R_CURLY@581..583 "}" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@583..584 "}" [] [], + }, + ], + }, + colon_token: COLON@584..591 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@591..596 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@596..597 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@597..603 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@603..605 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@605..607 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@607..614 "MyType" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@614..622 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@622..623 "(" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@623..633 "OtherType" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@633..641 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@641..647 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@647..649 "T" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@649..651 "?" [] [Whitespace(" ")], + true_type: TsInferType { + infer_token: INFER_KW@651..657 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@657..659 "U" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + colon_token: COLON@659..661 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@661..671 "InnerFalse" [] [], + }, + type_arguments: missing (optional), + }, + }, + r_paren_token: R_PAREN@671..673 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@673..675 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@675..685 "OuterTrue" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@685..687 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@687..697 "OuterFalse" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@697..703 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@703..707 "Join" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@707..708 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@708..710 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@710..718 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsUnknownType { + unknown_token: UNKNOWN_KW@718..725 "unknown" [] [], + }, + l_brack_token: L_BRACK@725..726 "[" [] [], + r_brack_token: R_BRACK@726..727 "]" [] [], + }, + }, + default: missing (optional), + }, + COMMA@727..729 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@729..731 "D" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@731..739 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@739..745 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@745..747 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@747..748 "=" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@748..756 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@756..764 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@764..765 "[" [] [], + elements: TsTupleTypeElementList [], + r_brack_token: R_BRACK@765..767 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@767..769 "?" [] [Whitespace(" ")], + true_type: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@769..772 "''" [] [Whitespace(" ")], + }, + colon_token: COLON@772..773 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@773..781 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@781..789 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@789..790 "[" [] [], + elements: TsTupleTypeElementList [ + TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@790..797 "string" [] [Whitespace(" ")], + }, + PIPE@797..799 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@799..806 "number" [] [Whitespace(" ")], + }, + PIPE@806..808 "|" [] [Whitespace(" ")], + TsBooleanType { + boolean_token: BOOLEAN_KW@808..816 "boolean" [] [Whitespace(" ")], + }, + PIPE@816..818 "|" [] [Whitespace(" ")], + TsBigintType { + bigint_token: BIGINT_KW@818..824 "bigint" [] [], + }, + ], + }, + ], + r_brack_token: R_BRACK@824..826 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@826..828 "?" [] [Whitespace(" ")], + true_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@828..829 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@829..831 "${" [] [], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@831..832 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@832..833 "[" [] [], + index_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@833..834 "0" [] [], + }, + r_brack_token: R_BRACK@834..835 "]" [] [], + }, + r_curly_token: R_CURLY@835..836 "}" [] [], + }, + ], + r_tick_token: BACKTICK@836..838 "`" [] [Whitespace(" ")], + }, + colon_token: COLON@838..839 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@839..847 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@847..855 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@855..856 "[" [] [], + elements: TsTupleTypeElementList [ + TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@856..863 "string" [] [Whitespace(" ")], + }, + PIPE@863..865 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@865..872 "number" [] [Whitespace(" ")], + }, + PIPE@872..874 "|" [] [Whitespace(" ")], + TsBooleanType { + boolean_token: BOOLEAN_KW@874..882 "boolean" [] [Whitespace(" ")], + }, + PIPE@882..884 "|" [] [Whitespace(" ")], + TsBigintType { + bigint_token: BIGINT_KW@884..890 "bigint" [] [], + }, + ], + }, + COMMA@890..892 "," [] [Whitespace(" ")], + TsRestTupleTypeElement { + dotdotdot_token: DOT3@892..895 "..." [] [], + ty: TsInferType { + infer_token: INFER_KW@895..901 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@901..902 "U" [] [], + }, + constraint: missing (optional), + }, + }, + ], + r_brack_token: R_BRACK@902..904 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@904..906 "?" [] [Whitespace(" ")], + true_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@906..907 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@907..909 "${" [] [], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@909..910 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@910..911 "[" [] [], + index_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@911..912 "0" [] [], + }, + r_brack_token: R_BRACK@912..913 "]" [] [], + }, + r_curly_token: R_CURLY@913..914 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@914..916 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@916..917 "D" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@917..918 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@918..920 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@920..924 "Join" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@924..925 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@925..926 "U" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@926..928 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@928..929 "D" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@929..930 ">" [] [], + }, + }, + r_curly_token: R_CURLY@930..931 "}" [] [], + }, + ], + r_tick_token: BACKTICK@931..933 "`" [] [Whitespace(" ")], + }, + colon_token: COLON@933..934 ":" [] [], + false_type: TsStringType { + string_token: STRING_KW@934..946 "string" [Newline("\n"), Whitespace(" ")] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@946..947 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@947..953 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@953..962 "MatchPair" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@962..963 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@963..965 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@965..973 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@973..979 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@979..981 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@981..983 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@983..985 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@985..993 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@993..994 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@994..995 "[" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@995..997 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@997..1003 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1003..1004 "A" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1004..1005 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1005..1006 "," [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1006..1008 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1008..1014 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1014..1015 "B" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1015..1016 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1016..1017 "]" [] [], + }, + ], + r_tick_token: BACKTICK@1017..1019 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1019..1021 "?" [] [Whitespace(" ")], + true_type: TsTupleType { + l_brack_token: L_BRACK@1021..1022 "[" [] [], + elements: TsTupleTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1022..1023 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1023..1025 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1025..1026 "B" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_brack_token: R_BRACK@1026..1028 "]" [] [Whitespace(" ")], + }, + colon_token: COLON@1028..1030 ":" [] [Whitespace(" ")], + false_type: TsUnknownType { + unknown_token: UNKNOWN_KW@1030..1037 "unknown" [] [], + }, + }, + semicolon_token: SEMICOLON@1037..1038 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1038..1044 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1044..1059 "FirstTwoAndRest" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1059..1060 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1060..1062 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1062..1070 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@1070..1076 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1076..1078 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1078..1080 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1080..1082 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1082..1090 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@1090..1091 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1091..1093 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1093..1099 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1099..1100 "A" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1100..1101 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1101..1103 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1103..1109 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1109..1110 "B" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1110..1111 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1111..1113 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1119..1120 "R" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1120..1121 "}" [] [], + }, + ], + r_tick_token: BACKTICK@1121..1123 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1123..1125 "?" [] [Whitespace(" ")], + true_type: TsTupleType { + l_brack_token: L_BRACK@1125..1126 "[" [] [], + elements: TsTupleTypeElementList [ + TsTemplateLiteralType { + l_tick_token: BACKTICK@1126..1127 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1127..1129 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1129..1130 "A" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@1130..1131 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1131..1133 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1133..1134 "B" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@1134..1135 "}" [] [], + }, + ], + r_tick_token: BACKTICK@1135..1136 "`" [] [], + }, + COMMA@1136..1138 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1138..1139 "R" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_brack_token: R_BRACK@1139..1141 "]" [] [Whitespace(" ")], + }, + colon_token: COLON@1141..1143 ":" [] [Whitespace(" ")], + false_type: TsUnknownType { + unknown_token: UNKNOWN_KW@1143..1150 "unknown" [] [], + }, + }, + semicolon_token: SEMICOLON@1150..1151 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1151..1157 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1157..1161 "Trim" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1161..1162 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1162..1164 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1164..1172 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@1172..1178 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1178..1180 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1180..1181 "=" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1181..1189 "S" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1189..1197 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@1197..1198 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1198..1200 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1200..1206 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1206..1207 "T" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1207..1208 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1208..1209 " " [] [], + }, + ], + r_tick_token: BACKTICK@1209..1211 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1211..1213 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1213..1217 "Trim" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1217..1218 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1218..1219 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1219..1221 ">" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@1221..1222 ":" [] [], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1222..1229 "S" [Newline("\n"), Whitespace(" ")] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@1229..1230 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1230..1236 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1236..1239 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1239..1240 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1240..1241 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1241..1243 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1243..1245 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1245..1247 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1247..1255 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@1255..1256 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1256..1257 "*" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1257..1259 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1259..1265 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1265..1266 "S" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1266..1267 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1267..1268 "*" [] [], + }, + ], + r_tick_token: BACKTICK@1268..1270 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1270..1272 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1272..1274 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1274..1276 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1276..1281 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@1281..1282 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1282..1288 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1288..1296 "Unpacked" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1296..1297 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1297..1298 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1298..1300 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1300..1302 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1302..1304 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1304..1312 "extends" [] [Whitespace(" ")], + extends_type: TsArrayType { + element_type: TsParenthesizedType { + l_paren_token: L_PAREN@1312..1313 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@1313..1319 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1319..1320 "U" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@1320..1321 ")" [] [], + }, + l_brack_token: L_BRACK@1321..1322 "[" [] [], + r_brack_token: R_BRACK@1322..1324 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1324..1326 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1326..1328 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1328..1329 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1329..1336 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1336..1344 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1344..1345 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@1345..1348 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@1348..1352 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@1352..1354 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1354..1357 "any" [] [], + }, + l_brack_token: L_BRACK@1357..1358 "[" [] [], + r_brack_token: R_BRACK@1358..1359 "]" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@1359..1361 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1361..1364 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@1364..1370 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1370..1372 "U" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + question_mark_token: QUESTION@1372..1374 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1374..1376 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1376..1377 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1377..1384 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1384..1392 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1392..1399 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1399..1400 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@1400..1406 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1406..1407 "U" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1407..1409 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@1409..1411 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1411..1413 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1413..1414 ":" [] [], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1414..1420 "T" [Newline("\n"), Whitespace(" ")] [], + }, + type_arguments: missing (optional), + }, + }, + }, + }, + semicolon_token: SEMICOLON@1420..1421 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1421..1427 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1427..1439 "ArgumentType" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1439..1440 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1440..1442 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1442..1450 "extends" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1450..1451 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1451..1452 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1452..1454 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1454..1457 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1457..1459 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1459..1462 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@1462..1465 "any" [] [], + }, + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1465..1467 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1467..1469 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1469..1471 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1471..1479 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1479..1480 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1480..1481 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1481..1483 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1483..1489 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1489..1490 "A" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1490..1492 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1492..1495 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@1495..1499 "any" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@1499..1501 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1501..1503 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1503..1505 ":" [] [Whitespace(" ")], + false_type: TsAnyType { + any_token: ANY_KW@1505..1508 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@1508..1509 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1509..1515 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1515..1517 "X3" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1517..1518 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1518..1519 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1519..1521 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1521..1523 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1523..1525 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1525..1533 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@1533..1535 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1535..1536 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1536..1538 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1538..1539 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1539..1540 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1540..1542 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1542..1548 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1548..1549 "U" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1549..1551 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1551..1554 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@1554..1558 "void" [] [], + }, + }, + }, + separator_token: COMMA@1558..1560 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1560..1561 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1561..1563 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1563..1564 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1564..1565 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1565..1567 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1567..1573 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1573..1574 "U" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1574..1576 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1576..1579 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@1579..1584 "void" [] [Whitespace(" ")], + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1584..1586 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1586..1588 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1588..1590 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1590..1592 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1592..1597 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@1597..1598 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1598..1604 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1604..1606 "X1" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1606..1607 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1607..1609 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1609..1617 "extends" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@1617..1619 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1619..1620 "x" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1620..1622 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1622..1625 "any" [] [], + }, + }, + separator_token: COMMA@1625..1627 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1627..1628 "y" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1628..1630 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1630..1634 "any" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1634..1635 "}" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1635..1637 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1637..1639 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1639..1641 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1641..1649 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@1649..1651 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1651..1652 "x" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1652..1654 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1654..1660 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1660..1661 "X" [] [], + }, + constraint: missing (optional), + }, + }, + separator_token: COMMA@1661..1663 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1663..1664 "y" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1664..1666 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1666..1672 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1672..1674 "Y" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1674..1676 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1676..1678 "?" [] [Whitespace(" ")], + true_type: TsTupleType { + l_brack_token: L_BRACK@1678..1679 "[" [] [], + elements: TsTupleTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1679..1680 "X" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1680..1682 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1682..1683 "Y" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_brack_token: R_BRACK@1683..1685 "]" [] [Whitespace(" ")], + }, + colon_token: COLON@1685..1687 ":" [] [Whitespace(" ")], + false_type: TsAnyType { + any_token: ANY_KW@1687..1690 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@1690..1691 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1691..1697 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1697..1700 "T62" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1700..1701 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1701..1702 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1702..1704 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1704..1706 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1706..1708 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1708..1716 "extends" [] [Whitespace(" ")], + extends_type: TsArrayType { + element_type: TsParenthesizedType { + l_paren_token: L_PAREN@1716..1717 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@1717..1723 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1723..1724 "U" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@1724..1725 ")" [] [], + }, + l_brack_token: L_BRACK@1725..1726 "[" [] [], + r_brack_token: R_BRACK@1726..1728 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1728..1730 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1730..1732 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1732..1734 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1734..1735 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@1735..1736 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1736..1742 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1742..1745 "T63" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1745..1746 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1746..1747 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1747..1749 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1749..1751 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1751..1753 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1753..1761 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@1761..1762 "(" [] [], + ty: TsConditionalType { + check_type: TsParenthesizedType { + l_paren_token: L_PAREN@1762..1763 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@1763..1769 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1769..1770 "A" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@1770..1772 ")" [] [Whitespace(" ")], + }, + extends_token: EXTENDS_KW@1772..1780 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@1780..1786 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1786..1788 "B" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@1788..1790 "?" [] [Whitespace(" ")], + true_type: TsInferType { + infer_token: INFER_KW@1790..1796 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1796..1798 "C" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + colon_token: COLON@1798..1800 ":" [] [Whitespace(" ")], + false_type: TsInferType { + infer_token: INFER_KW@1800..1806 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1806..1807 "D" [] [], + }, + constraint: missing (optional), + }, + }, + r_paren_token: R_PAREN@1807..1809 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1809..1811 "?" [] [Whitespace(" ")], + true_type: TsStringType { + string_token: STRING_KW@1811..1818 "string" [] [Whitespace(" ")], + }, + colon_token: COLON@1818..1820 ":" [] [Whitespace(" ")], + false_type: TsNumberType { + number_token: NUMBER_KW@1820..1826 "number" [] [], + }, + }, + semicolon_token: SEMICOLON@1826..1827 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1827..1833 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1833..1836 "T75" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1836..1837 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1837..1838 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1838..1840 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1840..1842 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1842..1844 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1844..1852 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1852..1855 "T74" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1855..1856 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@1856..1862 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1862..1863 "U" [] [], + }, + constraint: missing (optional), + }, + COMMA@1863..1865 "," [] [Whitespace(" ")], + TsInferType { + infer_token: INFER_KW@1865..1871 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1871..1872 "U" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1872..1874 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@1874..1876 "?" [] [Whitespace(" ")], + true_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1876..1879 "T70" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1879..1880 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1880..1881 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1881..1883 ">" [] [Whitespace(" ")], + }, + }, + PIPE@1883..1885 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1885..1888 "T72" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1888..1889 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1889..1890 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1890..1892 ">" [] [Whitespace(" ")], + }, + }, + PIPE@1892..1894 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1894..1897 "T74" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1897..1898 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1898..1899 "U" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1899..1901 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1901..1902 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1902..1904 ">" [] [Whitespace(" ")], + }, + }, + ], + }, + colon_token: COLON@1904..1906 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1906..1911 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@1911..1912 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1912..1918 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1918..1927 "Jsonified" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1927..1928 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1928..1929 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1929..1931 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1931..1933 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1933..1935 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1935..1943 "extends" [] [Whitespace(" ")], + extends_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@1943..1950 "string" [] [Whitespace(" ")], + }, + PIPE@1950..1952 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@1952..1959 "number" [] [Whitespace(" ")], + }, + PIPE@1959..1961 "|" [] [Whitespace(" ")], + TsBooleanType { + boolean_token: BOOLEAN_KW@1961..1969 "boolean" [] [Whitespace(" ")], + }, + PIPE@1969..1971 "|" [] [Whitespace(" ")], + TsNullLiteralType { + literal_token: NULL_KW@1971..1976 "null" [] [Whitespace(" ")], + }, + ], + }, + question_mark_token: QUESTION@1976..1978 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1978..1979 "T" [] [], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1979..1986 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1986..1988 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1988..1996 "extends" [] [Whitespace(" ")], + extends_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsUndefinedType { + undefined_token: UNDEFINED_KW@1996..2006 "undefined" [] [Whitespace(" ")], + }, + PIPE@2006..2008 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2008..2017 "Function" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + question_mark_token: QUESTION@2017..2019 "?" [] [Whitespace(" ")], + true_type: TsNeverType { + never_token: NEVER_KW@2019..2024 "never" [] [], + }, + colon_token: COLON@2024..2031 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2031..2033 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2033..2041 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@2041..2043 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@2043..2049 "toJSON" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2049..2050 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@2050..2051 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@2051..2053 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@2053..2059 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2059..2061 "R" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@2061..2063 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@2063..2065 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2065..2066 "R" [] [], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2066..2073 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2073..2075 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2075..2083 "extends" [] [Whitespace(" ")], + extends_type: TsNonPrimitiveType { + object_token: OBJECT_KW@2083..2090 "object" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@2090..2092 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2092..2107 "JsonifiedObject" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@2107..2108 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2108..2109 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@2109..2110 ">" [] [], + }, + }, + colon_token: COLON@2110..2113 ":" [Newline("\n")] [Whitespace(" ")], + false_type: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@2113..2127 "\"what is this\"" [] [], + }, + }, + }, + }, + }, + semicolon_token: SEMICOLON@2127..2128 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2128..2134 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2134..2137 "T1" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@2137..2139 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2139..2142 "F1" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2142..2150 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2150..2151 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@2151..2154 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@2154..2158 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@2158..2160 ":" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2160..2161 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2161..2167 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2167..2168 "T" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2168..2169 ")" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@2169..2171 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2171..2174 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@2174..2179 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2179..2181 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2181..2183 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2183..2185 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@2185..2190 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@2190..2191 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2191..2197 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2197..2200 "T2" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@2200..2202 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2202..2205 "F1" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2205..2213 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2213..2214 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@2214..2218 "args" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@2218..2220 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@2220..2221 "[" [] [], + elements: TsTupleTypeElementList [ + TsRestTupleTypeElement { + dotdotdot_token: DOT3@2221..2224 "..." [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2224..2225 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2225..2231 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2231..2232 "T" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2232..2233 ")" [] [], + }, + }, + ], + r_brack_token: R_BRACK@2233..2234 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@2234..2236 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2236..2239 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@2239..2244 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2244..2246 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2246..2248 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2248..2250 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@2250..2255 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@2255..2256 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2256..2262 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2262..2264 "T3" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@2264..2265 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@2265..2266 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@2266..2268 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@2268..2270 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2270..2272 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2272..2280 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2280..2288 "IsNumber" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@2288..2289 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsParenthesizedType { + l_paren_token: L_PAREN@2289..2290 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2290..2296 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2296..2297 "N" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2297..2298 ")" [] [], + }, + ], + r_angle_token: R_ANGLE@2298..2300 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2300..2302 "?" [] [Whitespace(" ")], + true_type: TsBooleanLiteralType { + literal: TRUE_KW@2302..2307 "true" [] [Whitespace(" ")], + }, + colon_token: COLON@2307..2309 ":" [] [Whitespace(" ")], + false_type: TsBooleanLiteralType { + literal: FALSE_KW@2309..2314 "false" [] [], + }, + }, + semicolon_token: SEMICOLON@2314..2315 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2315..2321 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2321..2324 "T4" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@2324..2326 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2326..2329 "F1" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2329..2337 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2337..2338 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@2338..2341 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@2341..2345 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@2345..2347 ":" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2347..2348 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2348..2349 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2349..2355 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2355..2356 "T" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2356..2357 ")" [] [], + }, + r_paren_token: R_PAREN@2357..2358 ")" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@2358..2360 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2360..2363 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@2363..2368 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2368..2370 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2370..2372 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2372..2374 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@2374..2379 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@2379..2380 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2380..2386 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2386..2389 "T5" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@2389..2391 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2391..2394 "F1" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2394..2402 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2402..2403 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@2403..2407 "args" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@2407..2409 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@2409..2410 "[" [] [], + elements: TsTupleTypeElementList [ + TsRestTupleTypeElement { + dotdotdot_token: DOT3@2410..2413 "..." [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2413..2414 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2414..2415 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2415..2421 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2421..2422 "T" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2422..2423 ")" [] [], + }, + r_paren_token: R_PAREN@2423..2424 ")" [] [], + }, + }, + ], + r_brack_token: R_BRACK@2424..2425 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@2425..2427 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2427..2430 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@2430..2435 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2435..2437 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2437..2439 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2439..2441 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@2441..2446 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@2446..2447 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2447..2453 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2453..2455 "T6" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@2455..2456 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@2456..2457 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@2457..2459 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@2459..2461 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2461..2463 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2463..2471 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2471..2479 "IsNumber" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@2479..2480 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsParenthesizedType { + l_paren_token: L_PAREN@2480..2481 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2481..2482 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2482..2488 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2488..2489 "N" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2489..2490 ")" [] [], + }, + r_paren_token: R_PAREN@2490..2491 ")" [] [], + }, + ], + r_angle_token: R_ANGLE@2491..2493 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2493..2495 "?" [] [Whitespace(" ")], + true_type: TsBooleanLiteralType { + literal: TRUE_KW@2495..2500 "true" [] [Whitespace(" ")], + }, + colon_token: COLON@2500..2502 ":" [] [Whitespace(" ")], + false_type: TsBooleanLiteralType { + literal: FALSE_KW@2502..2507 "false" [] [], + }, + }, + semicolon_token: SEMICOLON@2507..2508 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2508..2514 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2514..2517 "T7" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@2517..2519 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2519..2522 "F1" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2522..2530 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2530..2531 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@2531..2534 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@2534..2538 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@2538..2540 ":" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2540..2541 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2541..2542 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2542..2543 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2543..2544 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2544..2550 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2550..2551 "T" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2551..2552 ")" [] [], + }, + r_paren_token: R_PAREN@2552..2553 ")" [] [], + }, + r_paren_token: R_PAREN@2553..2554 ")" [] [], + }, + r_paren_token: R_PAREN@2554..2555 ")" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@2555..2557 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2557..2560 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@2560..2565 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2565..2567 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2567..2569 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2569..2571 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@2571..2576 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@2576..2577 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2577..2583 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2583..2586 "T8" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@2586..2588 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2588..2591 "F1" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2591..2599 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2599..2600 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@2600..2604 "args" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@2604..2606 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@2606..2607 "[" [] [], + elements: TsTupleTypeElementList [ + TsRestTupleTypeElement { + dotdotdot_token: DOT3@2607..2610 "..." [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2610..2611 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2611..2612 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2612..2613 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2613..2614 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2614..2620 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2620..2621 "T" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2621..2622 ")" [] [], + }, + r_paren_token: R_PAREN@2622..2623 ")" [] [], + }, + r_paren_token: R_PAREN@2623..2624 ")" [] [], + }, + r_paren_token: R_PAREN@2624..2625 ")" [] [], + }, + }, + ], + r_brack_token: R_BRACK@2625..2626 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@2626..2628 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2628..2631 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@2631..2636 "void" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2636..2638 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2638..2640 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2640..2642 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@2642..2647 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@2647..2648 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2648..2654 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2654..2656 "T9" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@2656..2657 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@2657..2658 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@2658..2660 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@2660..2662 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2662..2664 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2664..2672 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2672..2680 "IsNumber" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@2680..2681 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsParenthesizedType { + l_paren_token: L_PAREN@2681..2682 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2682..2683 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2683..2684 "(" [] [], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@2684..2685 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@2685..2691 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2691..2692 "N" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@2692..2693 ")" [] [], + }, + r_paren_token: R_PAREN@2693..2694 ")" [] [], + }, + r_paren_token: R_PAREN@2694..2695 ")" [] [], + }, + r_paren_token: R_PAREN@2695..2696 ")" [] [], + }, + ], + r_angle_token: R_ANGLE@2696..2698 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@2698..2700 "?" [] [Whitespace(" ")], + true_type: TsBooleanLiteralType { + literal: TRUE_KW@2700..2705 "true" [] [Whitespace(" ")], + }, + colon_token: COLON@2705..2707 ":" [] [Whitespace(" ")], + false_type: TsBooleanLiteralType { + literal: FALSE_KW@2707..2712 "false" [] [], + }, + }, + semicolon_token: SEMICOLON@2712..2713 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@2713..2719 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@2719..2726 "Prepend" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@2726..2727 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@2727..2728 "E" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@2728..2730 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@2730..2732 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@2732..2740 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@2740..2743 "any" [] [], + }, + l_brack_token: L_BRACK@2743..2744 "[" [] [], + r_brack_token: R_BRACK@2744..2745 "]" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@2745..2747 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@2747..2748 "=" [] [], + ty: TsConditionalType { + check_type: TsParenthesizedType { + l_paren_token: L_PAREN@2748..2754 "(" [Newline("\n"), Whitespace(" ")] [], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2754..2755 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@2755..2759 "head" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@2759..2761 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2761..2762 "E" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@2762..2764 "," [] [Whitespace(" ")], + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@2764..2767 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@2767..2771 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@2771..2773 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2773..2774 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + ], + r_paren_token: R_PAREN@2774..2776 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2776..2779 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@2779..2782 "any" [] [], + }, + }, + r_paren_token: R_PAREN@2782..2784 ")" [] [Whitespace(" ")], + }, + extends_token: EXTENDS_KW@2784..2792 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@2792..2793 "(" [] [], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@2793..2794 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@2794..2797 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@2797..2801 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@2801..2803 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@2803..2809 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@2809..2810 "U" [] [], + }, + constraint: missing (optional), + }, + }, + }, + ], + r_paren_token: R_PAREN@2810..2812 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@2812..2815 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@2815..2818 "any" [] [], + }, + }, + r_paren_token: R_PAREN@2818..2819 ")" [] [], + }, + question_mark_token: QUESTION@2819..2826 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2826..2827 "U" [] [], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2827..2834 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2834..2835 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@2835..2836 ";" [] [], + }, + ], + eof_token: EOF@2836..2837 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..2837 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..2836 + 0: TS_TYPE_ALIAS_DECLARATION@0..64 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..9 + 0: IDENT@5..9 "Args" [] [] + 2: TS_TYPE_PARAMETERS@9..13 + 0: L_ANGLE@9..10 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@10..11 + 0: TS_TYPE_PARAMETER@10..11 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@10..10 + 1: TS_TYPE_PARAMETER_NAME@10..11 + 0: IDENT@10..11 "F" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@11..13 ">" [] [Whitespace(" ")] + 3: EQ@13..15 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@15..63 + 0: TS_REFERENCE_TYPE@15..17 + 0: JS_REFERENCE_IDENTIFIER@15..17 + 0: IDENT@15..17 "F" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@17..25 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@25..52 + 0: (empty) + 1: JS_PARAMETERS@25..44 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_PARAMETER_LIST@26..42 + 0: JS_REST_PARAMETER@26..42 + 0: JS_DECORATOR_LIST@26..26 + 1: DOT3@26..29 "..." [] [] + 2: JS_IDENTIFIER_BINDING@29..33 + 0: IDENT@29..33 "args" [] [] + 3: TS_TYPE_ANNOTATION@33..42 + 0: COLON@33..35 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@35..42 + 0: INFER_KW@35..41 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@41..42 + 0: IDENT@41..42 "A" [] [] + 2: (empty) + 2: R_PAREN@42..44 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@44..47 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@47..52 + 0: VOID_KW@47..52 "void" [] [Whitespace(" ")] + 3: QUESTION@52..54 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@54..56 + 0: JS_REFERENCE_IDENTIFIER@54..56 + 0: IDENT@54..56 "A" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@56..58 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@58..63 + 0: NEVER_KW@58..63 "never" [] [] + 5: SEMICOLON@63..64 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@64..121 + 0: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@70..72 + 0: IDENT@70..72 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@72..74 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@74..121 + 0: TS_REFERENCE_TYPE@74..76 + 0: JS_REFERENCE_IDENTIFIER@74..76 + 0: IDENT@74..76 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@76..84 "extends" [] [Whitespace(" ")] + 2: TS_IMPORT_TYPE@84..110 + 0: (empty) + 1: IMPORT_KW@84..90 "import" [] [] + 2: JS_CALL_ARGUMENTS@90..98 + 0: L_PAREN@90..91 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@91..97 + 0: JS_STRING_LITERAL_EXPRESSION@91..97 + 0: JS_STRING_LITERAL@91..97 "\"test\"" [] [] + 2: R_PAREN@97..98 ")" [] [] + 3: TS_IMPORT_TYPE_QUALIFIER@98..100 + 0: DOT@98..99 "." [] [] + 1: JS_REFERENCE_IDENTIFIER@99..100 + 0: IDENT@99..100 "C" [] [] + 4: TS_TYPE_ARGUMENTS@100..110 + 0: L_ANGLE@100..101 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@101..108 + 0: TS_INFER_TYPE@101..108 + 0: INFER_KW@101..107 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@107..108 + 0: IDENT@107..108 "P" [] [] + 2: (empty) + 2: R_ANGLE@108..110 ">" [] [Whitespace(" ")] + 3: QUESTION@110..112 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@112..114 + 0: JS_REFERENCE_IDENTIFIER@112..114 + 0: IDENT@112..114 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@114..116 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@116..121 + 0: NEVER_KW@116..121 "never" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@121..174 + 0: TYPE_KW@121..127 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@127..129 + 0: IDENT@127..129 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@129..131 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@131..174 + 0: TS_REFERENCE_TYPE@131..133 + 0: JS_REFERENCE_IDENTIFIER@131..133 + 0: IDENT@131..133 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@133..141 "extends" [] [Whitespace(" ")] + 2: TS_TYPEOF_TYPE@141..163 + 0: TYPEOF_KW@141..148 "typeof" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@148..153 + 0: IDENT@148..153 "Array" [] [] + 2: TS_TYPE_ARGUMENTS@153..163 + 0: L_ANGLE@153..154 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@154..161 + 0: TS_INFER_TYPE@154..161 + 0: INFER_KW@154..160 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@160..161 + 0: IDENT@160..161 "P" [] [] + 2: (empty) + 2: R_ANGLE@161..163 ">" [] [Whitespace(" ")] + 3: QUESTION@163..165 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@165..167 + 0: JS_REFERENCE_IDENTIFIER@165..167 + 0: IDENT@165..167 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@167..169 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@169..174 + 0: NEVER_KW@169..174 "never" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@174..233 + 0: TYPE_KW@174..180 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@180..182 + 0: IDENT@180..182 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@182..184 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@184..233 + 0: TS_REFERENCE_TYPE@184..186 + 0: JS_REFERENCE_IDENTIFIER@184..186 + 0: IDENT@184..186 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@186..194 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@194..222 + 0: L_CURLY@194..196 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@196..220 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@196..220 + 0: JS_LITERAL_MEMBER_NAME@196..199 + 0: IDENT@196..199 "set" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@199..211 + 0: L_PAREN@199..200 "(" [] [] + 1: JS_PARAMETER_LIST@200..210 + 0: JS_FORMAL_PARAMETER@200..210 + 0: JS_DECORATOR_LIST@200..200 + 1: JS_IDENTIFIER_BINDING@200..201 + 0: IDENT@200..201 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@201..210 + 0: COLON@201..203 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@203..210 + 0: INFER_KW@203..209 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@209..210 + 0: IDENT@209..210 "P" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@210..211 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@211..220 + 0: COLON@211..213 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@213..220 + 0: NUMBER_KW@213..220 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@220..222 "}" [] [Whitespace(" ")] + 3: QUESTION@222..224 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@224..226 + 0: JS_REFERENCE_IDENTIFIER@224..226 + 0: IDENT@224..226 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@226..228 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@228..233 + 0: NEVER_KW@228..233 "never" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@233..283 + 0: TYPE_KW@233..239 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@239..241 + 0: IDENT@239..241 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@241..243 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@243..283 + 0: TS_REFERENCE_TYPE@243..245 + 0: JS_REFERENCE_IDENTIFIER@243..245 + 0: IDENT@243..245 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@245..253 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@253..272 + 0: L_CURLY@253..255 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@255..270 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@255..270 + 0: JS_LITERAL_MEMBER_NAME@255..258 + 0: IDENT@255..258 "get" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@258..260 + 0: L_PAREN@258..259 "(" [] [] + 1: JS_PARAMETER_LIST@259..259 + 2: R_PAREN@259..260 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@260..270 + 0: COLON@260..262 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@262..270 + 0: INFER_KW@262..268 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@268..270 + 0: IDENT@268..270 "P" [] [Whitespace(" ")] + 2: (empty) + 5: (empty) + 2: R_CURLY@270..272 "}" [] [Whitespace(" ")] + 3: QUESTION@272..274 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@274..276 + 0: JS_REFERENCE_IDENTIFIER@274..276 + 0: IDENT@274..276 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@276..278 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@278..283 + 0: NEVER_KW@278..283 "never" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@283..348 + 0: TYPE_KW@283..289 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@289..291 + 0: IDENT@289..291 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@291..293 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@293..348 + 0: TS_REFERENCE_TYPE@293..295 + 0: JS_REFERENCE_IDENTIFIER@293..295 + 0: IDENT@293..295 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@295..303 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@303..337 + 0: L_CURLY@303..305 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@305..335 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@305..335 + 0: JS_LITERAL_MEMBER_NAME@305..311 + 0: IDENT@305..311 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@311..326 + 0: L_PAREN@311..312 "(" [] [] + 1: JS_PARAMETER_LIST@312..325 + 0: TS_THIS_PARAMETER@312..325 + 0: THIS_KW@312..316 "this" [] [] + 1: TS_TYPE_ANNOTATION@316..325 + 0: COLON@316..318 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@318..325 + 0: INFER_KW@318..324 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@324..325 + 0: IDENT@324..325 "P" [] [] + 2: (empty) + 2: R_PAREN@325..326 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@326..335 + 0: COLON@326..328 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@328..335 + 0: NUMBER_KW@328..335 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@335..337 "}" [] [Whitespace(" ")] + 3: QUESTION@337..339 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@339..341 + 0: JS_REFERENCE_IDENTIFIER@339..341 + 0: IDENT@339..341 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@341..343 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@343..348 + 0: NEVER_KW@343..348 "never" [] [] + 5: (empty) + 6: TS_TYPE_ALIAS_DECLARATION@348..401 + 0: TYPE_KW@348..354 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@354..360 + 0: IDENT@354..360 "valid9" [] [] + 2: TS_TYPE_PARAMETERS@360..364 + 0: L_ANGLE@360..361 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@361..362 + 0: TS_TYPE_PARAMETER@361..362 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@361..361 + 1: TS_TYPE_PARAMETER_NAME@361..362 + 0: IDENT@361..362 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@362..364 ">" [] [Whitespace(" ")] + 3: EQ@364..366 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@366..400 + 0: TS_REFERENCE_TYPE@366..368 + 0: JS_REFERENCE_IDENTIFIER@366..368 + 0: IDENT@366..368 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@368..376 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@376..391 + 0: JS_REFERENCE_IDENTIFIER@376..381 + 0: IDENT@376..381 "Array" [] [] + 1: TS_TYPE_ARGUMENTS@381..391 + 0: L_ANGLE@381..382 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@382..389 + 0: TS_INFER_TYPE@382..389 + 0: INFER_KW@382..388 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@388..389 + 0: IDENT@388..389 "R" [] [] + 2: (empty) + 2: R_ANGLE@389..391 ">" [] [Whitespace(" ")] + 3: QUESTION@391..393 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@393..395 + 0: JS_REFERENCE_IDENTIFIER@393..395 + 0: IDENT@393..395 "R" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@395..397 ":" [] [Whitespace(" ")] + 6: TS_ANY_TYPE@397..400 + 0: ANY_KW@397..400 "any" [] [] + 5: SEMICOLON@400..401 ";" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@401..472 + 0: TYPE_KW@401..407 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@407..429 + 0: IDENT@407..429 "ContentBetweenBrackets" [] [] + 2: TS_TYPE_PARAMETERS@429..433 + 0: L_ANGLE@429..430 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@430..431 + 0: TS_TYPE_PARAMETER@430..431 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@430..430 + 1: TS_TYPE_PARAMETER_NAME@430..431 + 0: IDENT@430..431 "S" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@431..433 ">" [] [Whitespace(" ")] + 3: EQ@433..435 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@435..471 + 0: TS_REFERENCE_TYPE@435..437 + 0: JS_REFERENCE_IDENTIFIER@435..437 + 0: IDENT@435..437 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@437..445 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@445..460 + 0: BACKTICK@445..446 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@446..458 + 0: TS_TEMPLATE_CHUNK_ELEMENT@446..447 + 0: TEMPLATE_CHUNK@446..447 "[" [] [] + 1: TS_TEMPLATE_ELEMENT@447..457 + 0: DOLLAR_CURLY@447..449 "${" [] [] + 1: TS_INFER_TYPE@449..456 + 0: INFER_KW@449..455 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@455..456 + 0: IDENT@455..456 "T" [] [] + 2: (empty) + 2: R_CURLY@456..457 "}" [] [] + 2: TS_TEMPLATE_CHUNK_ELEMENT@457..458 + 0: TEMPLATE_CHUNK@457..458 "]" [] [] + 2: BACKTICK@458..460 "`" [] [Whitespace(" ")] + 3: QUESTION@460..462 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@462..464 + 0: JS_REFERENCE_IDENTIFIER@462..464 + 0: IDENT@462..464 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@464..466 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@466..471 + 0: NEVER_KW@466..471 "never" [] [] + 5: SEMICOLON@471..472 ";" [] [] + 8: TS_TYPE_ALIAS_DECLARATION@472..597 + 0: TYPE_KW@472..478 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@478..491 + 0: IDENT@478..491 "WithSelectors" [] [] + 2: TS_TYPE_PARAMETERS@491..495 + 0: L_ANGLE@491..492 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@492..493 + 0: TS_TYPE_PARAMETER@492..493 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@492..492 + 1: TS_TYPE_PARAMETER_NAME@492..493 + 0: IDENT@492..493 "S" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@493..495 ">" [] [Whitespace(" ")] + 3: EQ@495..497 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@497..596 + 0: TS_REFERENCE_TYPE@497..499 + 0: JS_REFERENCE_IDENTIFIER@497..499 + 0: IDENT@497..499 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@499..507 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@507..534 + 0: L_CURLY@507..509 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@509..533 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@509..533 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@509..517 + 0: IDENT@509..517 "getState" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@517..533 + 0: COLON@517..519 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@519..533 + 0: (empty) + 1: JS_PARAMETERS@519..522 + 0: L_PAREN@519..520 "(" [] [] + 1: JS_PARAMETER_LIST@520..520 + 2: R_PAREN@520..522 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@525..533 + 0: INFER_KW@525..531 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@531..533 + 0: IDENT@531..533 "T" [] [Whitespace(" ")] + 2: (empty) + 4: (empty) + 2: R_CURLY@533..534 "}" [] [] + 3: QUESTION@534..541 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: TS_INTERSECTION_TYPE@541..584 + 0: (empty) + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@541..584 + 0: TS_REFERENCE_TYPE@541..543 + 0: JS_REFERENCE_IDENTIFIER@541..543 + 0: IDENT@541..543 "S" [] [Whitespace(" ")] + 1: (empty) + 1: AMP@543..545 "&" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@545..584 + 0: L_CURLY@545..547 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@547..583 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@547..583 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@547..550 + 0: IDENT@547..550 "use" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@550..583 + 0: COLON@550..552 ":" [] [Whitespace(" ")] + 1: TS_MAPPED_TYPE@552..583 + 0: L_CURLY@552..554 "{" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@554..555 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@555..557 + 0: IDENT@555..557 "K" [] [Whitespace(" ")] + 4: IN_KW@557..560 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@560..567 + 0: KEYOF_KW@560..566 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@566..567 + 0: JS_REFERENCE_IDENTIFIER@566..567 + 0: IDENT@566..567 "T" [] [] + 1: (empty) + 6: (empty) + 7: R_BRACK@567..568 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@568..581 + 0: COLON@568..570 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@570..581 + 0: (empty) + 1: JS_PARAMETERS@570..573 + 0: L_PAREN@570..571 "(" [] [] + 1: JS_PARAMETER_LIST@571..571 + 2: R_PAREN@571..573 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@573..576 "=>" [] [Whitespace(" ")] + 3: TS_INDEXED_ACCESS_TYPE@576..581 + 0: TS_REFERENCE_TYPE@576..577 + 0: JS_REFERENCE_IDENTIFIER@576..577 + 0: IDENT@576..577 "T" [] [] + 1: (empty) + 1: L_BRACK@577..578 "[" [] [] + 2: TS_REFERENCE_TYPE@578..579 + 0: JS_REFERENCE_IDENTIFIER@578..579 + 0: IDENT@578..579 "K" [] [] + 1: (empty) + 3: R_BRACK@579..581 "]" [] [Whitespace(" ")] + 10: (empty) + 11: R_CURLY@581..583 "}" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@583..584 "}" [] [] + 5: COLON@584..591 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_NEVER_TYPE@591..596 + 0: NEVER_KW@591..596 "never" [] [] + 5: SEMICOLON@596..597 ";" [] [] + 9: TS_TYPE_ALIAS_DECLARATION@597..697 + 0: TYPE_KW@597..603 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@603..605 + 0: IDENT@603..605 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@605..607 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@607..697 + 0: TS_REFERENCE_TYPE@607..614 + 0: JS_REFERENCE_IDENTIFIER@607..614 + 0: IDENT@607..614 "MyType" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@614..622 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@622..673 + 0: L_PAREN@622..623 "(" [] [] + 1: TS_CONDITIONAL_TYPE@623..671 + 0: TS_REFERENCE_TYPE@623..633 + 0: JS_REFERENCE_IDENTIFIER@623..633 + 0: IDENT@623..633 "OtherType" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@633..641 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@641..649 + 0: INFER_KW@641..647 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@647..649 + 0: IDENT@647..649 "T" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@649..651 "?" [] [Whitespace(" ")] + 4: TS_INFER_TYPE@651..659 + 0: INFER_KW@651..657 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@657..659 + 0: IDENT@657..659 "U" [] [Whitespace(" ")] + 2: (empty) + 5: COLON@659..661 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@661..671 + 0: JS_REFERENCE_IDENTIFIER@661..671 + 0: IDENT@661..671 "InnerFalse" [] [] + 1: (empty) + 2: R_PAREN@671..673 ")" [] [Whitespace(" ")] + 3: QUESTION@673..675 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@675..685 + 0: JS_REFERENCE_IDENTIFIER@675..685 + 0: IDENT@675..685 "OuterTrue" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@685..687 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@687..697 + 0: JS_REFERENCE_IDENTIFIER@687..697 + 0: IDENT@687..697 "OuterFalse" [] [] + 1: (empty) + 5: (empty) + 10: TS_TYPE_ALIAS_DECLARATION@697..947 + 0: TYPE_KW@697..703 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@703..707 + 0: IDENT@703..707 "Join" [] [] + 2: TS_TYPE_PARAMETERS@707..747 + 0: L_ANGLE@707..708 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@708..745 + 0: TS_TYPE_PARAMETER@708..727 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@708..708 + 1: TS_TYPE_PARAMETER_NAME@708..710 + 0: IDENT@708..710 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@710..727 + 0: EXTENDS_KW@710..718 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@718..727 + 0: TS_UNKNOWN_TYPE@718..725 + 0: UNKNOWN_KW@718..725 "unknown" [] [] + 1: L_BRACK@725..726 "[" [] [] + 2: R_BRACK@726..727 "]" [] [] + 3: (empty) + 1: COMMA@727..729 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@729..745 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@729..729 + 1: TS_TYPE_PARAMETER_NAME@729..731 + 0: IDENT@729..731 "D" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@731..745 + 0: EXTENDS_KW@731..739 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@739..745 + 0: STRING_KW@739..745 "string" [] [] + 3: (empty) + 2: R_ANGLE@745..747 ">" [] [Whitespace(" ")] + 3: EQ@747..748 "=" [] [] + 4: TS_CONDITIONAL_TYPE@748..946 + 0: TS_REFERENCE_TYPE@748..756 + 0: JS_REFERENCE_IDENTIFIER@748..756 + 0: IDENT@748..756 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@756..764 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@764..767 + 0: L_BRACK@764..765 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@765..765 + 2: R_BRACK@765..767 "]" [] [Whitespace(" ")] + 3: QUESTION@767..769 "?" [] [Whitespace(" ")] + 4: TS_STRING_LITERAL_TYPE@769..772 + 0: JS_STRING_LITERAL@769..772 "''" [] [Whitespace(" ")] + 5: COLON@772..773 ":" [] [] + 6: TS_CONDITIONAL_TYPE@773..946 + 0: TS_REFERENCE_TYPE@773..781 + 0: JS_REFERENCE_IDENTIFIER@773..781 + 0: IDENT@773..781 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@781..789 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@789..826 + 0: L_BRACK@789..790 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@790..824 + 0: TS_UNION_TYPE@790..824 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@790..824 + 0: TS_STRING_TYPE@790..797 + 0: STRING_KW@790..797 "string" [] [Whitespace(" ")] + 1: PIPE@797..799 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@799..806 + 0: NUMBER_KW@799..806 "number" [] [Whitespace(" ")] + 3: PIPE@806..808 "|" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@808..816 + 0: BOOLEAN_KW@808..816 "boolean" [] [Whitespace(" ")] + 5: PIPE@816..818 "|" [] [Whitespace(" ")] + 6: TS_BIGINT_TYPE@818..824 + 0: BIGINT_KW@818..824 "bigint" [] [] + 2: R_BRACK@824..826 "]" [] [Whitespace(" ")] + 3: QUESTION@826..828 "?" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@828..838 + 0: BACKTICK@828..829 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@829..836 + 0: TS_TEMPLATE_ELEMENT@829..836 + 0: DOLLAR_CURLY@829..831 "${" [] [] + 1: TS_INDEXED_ACCESS_TYPE@831..835 + 0: TS_REFERENCE_TYPE@831..832 + 0: JS_REFERENCE_IDENTIFIER@831..832 + 0: IDENT@831..832 "T" [] [] + 1: (empty) + 1: L_BRACK@832..833 "[" [] [] + 2: TS_NUMBER_LITERAL_TYPE@833..834 + 0: (empty) + 1: JS_NUMBER_LITERAL@833..834 "0" [] [] + 3: R_BRACK@834..835 "]" [] [] + 2: R_CURLY@835..836 "}" [] [] + 2: BACKTICK@836..838 "`" [] [Whitespace(" ")] + 5: COLON@838..839 ":" [] [] + 6: TS_CONDITIONAL_TYPE@839..946 + 0: TS_REFERENCE_TYPE@839..847 + 0: JS_REFERENCE_IDENTIFIER@839..847 + 0: IDENT@839..847 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@847..855 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@855..904 + 0: L_BRACK@855..856 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@856..902 + 0: TS_UNION_TYPE@856..890 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@856..890 + 0: TS_STRING_TYPE@856..863 + 0: STRING_KW@856..863 "string" [] [Whitespace(" ")] + 1: PIPE@863..865 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@865..872 + 0: NUMBER_KW@865..872 "number" [] [Whitespace(" ")] + 3: PIPE@872..874 "|" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@874..882 + 0: BOOLEAN_KW@874..882 "boolean" [] [Whitespace(" ")] + 5: PIPE@882..884 "|" [] [Whitespace(" ")] + 6: TS_BIGINT_TYPE@884..890 + 0: BIGINT_KW@884..890 "bigint" [] [] + 1: COMMA@890..892 "," [] [Whitespace(" ")] + 2: TS_REST_TUPLE_TYPE_ELEMENT@892..902 + 0: DOT3@892..895 "..." [] [] + 1: TS_INFER_TYPE@895..902 + 0: INFER_KW@895..901 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@901..902 + 0: IDENT@901..902 "U" [] [] + 2: (empty) + 2: R_BRACK@902..904 "]" [] [Whitespace(" ")] + 3: QUESTION@904..906 "?" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@906..933 + 0: BACKTICK@906..907 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@907..931 + 0: TS_TEMPLATE_ELEMENT@907..914 + 0: DOLLAR_CURLY@907..909 "${" [] [] + 1: TS_INDEXED_ACCESS_TYPE@909..913 + 0: TS_REFERENCE_TYPE@909..910 + 0: JS_REFERENCE_IDENTIFIER@909..910 + 0: IDENT@909..910 "T" [] [] + 1: (empty) + 1: L_BRACK@910..911 "[" [] [] + 2: TS_NUMBER_LITERAL_TYPE@911..912 + 0: (empty) + 1: JS_NUMBER_LITERAL@911..912 "0" [] [] + 3: R_BRACK@912..913 "]" [] [] + 2: R_CURLY@913..914 "}" [] [] + 1: TS_TEMPLATE_ELEMENT@914..918 + 0: DOLLAR_CURLY@914..916 "${" [] [] + 1: TS_REFERENCE_TYPE@916..917 + 0: JS_REFERENCE_IDENTIFIER@916..917 + 0: IDENT@916..917 "D" [] [] + 1: (empty) + 2: R_CURLY@917..918 "}" [] [] + 2: TS_TEMPLATE_ELEMENT@918..931 + 0: DOLLAR_CURLY@918..920 "${" [] [] + 1: TS_REFERENCE_TYPE@920..930 + 0: JS_REFERENCE_IDENTIFIER@920..924 + 0: IDENT@920..924 "Join" [] [] + 1: TS_TYPE_ARGUMENTS@924..930 + 0: L_ANGLE@924..925 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@925..929 + 0: TS_REFERENCE_TYPE@925..926 + 0: JS_REFERENCE_IDENTIFIER@925..926 + 0: IDENT@925..926 "U" [] [] + 1: (empty) + 1: COMMA@926..928 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@928..929 + 0: JS_REFERENCE_IDENTIFIER@928..929 + 0: IDENT@928..929 "D" [] [] + 1: (empty) + 2: R_ANGLE@929..930 ">" [] [] + 2: R_CURLY@930..931 "}" [] [] + 2: BACKTICK@931..933 "`" [] [Whitespace(" ")] + 5: COLON@933..934 ":" [] [] + 6: TS_STRING_TYPE@934..946 + 0: STRING_KW@934..946 "string" [Newline("\n"), Whitespace(" ")] [] + 5: SEMICOLON@946..947 ";" [] [] + 11: TS_TYPE_ALIAS_DECLARATION@947..1038 + 0: TYPE_KW@947..953 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@953..962 + 0: IDENT@953..962 "MatchPair" [] [] + 2: TS_TYPE_PARAMETERS@962..981 + 0: L_ANGLE@962..963 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@963..979 + 0: TS_TYPE_PARAMETER@963..979 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@963..963 + 1: TS_TYPE_PARAMETER_NAME@963..965 + 0: IDENT@963..965 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@965..979 + 0: EXTENDS_KW@965..973 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@973..979 + 0: STRING_KW@973..979 "string" [] [] + 3: (empty) + 2: R_ANGLE@979..981 ">" [] [Whitespace(" ")] + 3: EQ@981..983 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@983..1037 + 0: TS_REFERENCE_TYPE@983..985 + 0: JS_REFERENCE_IDENTIFIER@983..985 + 0: IDENT@983..985 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@985..993 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@993..1019 + 0: BACKTICK@993..994 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@994..1017 + 0: TS_TEMPLATE_CHUNK_ELEMENT@994..995 + 0: TEMPLATE_CHUNK@994..995 "[" [] [] + 1: TS_TEMPLATE_ELEMENT@995..1005 + 0: DOLLAR_CURLY@995..997 "${" [] [] + 1: TS_INFER_TYPE@997..1004 + 0: INFER_KW@997..1003 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1003..1004 + 0: IDENT@1003..1004 "A" [] [] + 2: (empty) + 2: R_CURLY@1004..1005 "}" [] [] + 2: TS_TEMPLATE_CHUNK_ELEMENT@1005..1006 + 0: TEMPLATE_CHUNK@1005..1006 "," [] [] + 3: TS_TEMPLATE_ELEMENT@1006..1016 + 0: DOLLAR_CURLY@1006..1008 "${" [] [] + 1: TS_INFER_TYPE@1008..1015 + 0: INFER_KW@1008..1014 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1014..1015 + 0: IDENT@1014..1015 "B" [] [] + 2: (empty) + 2: R_CURLY@1015..1016 "}" [] [] + 4: TS_TEMPLATE_CHUNK_ELEMENT@1016..1017 + 0: TEMPLATE_CHUNK@1016..1017 "]" [] [] + 2: BACKTICK@1017..1019 "`" [] [Whitespace(" ")] + 3: QUESTION@1019..1021 "?" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@1021..1028 + 0: L_BRACK@1021..1022 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1022..1026 + 0: TS_REFERENCE_TYPE@1022..1023 + 0: JS_REFERENCE_IDENTIFIER@1022..1023 + 0: IDENT@1022..1023 "A" [] [] + 1: (empty) + 1: COMMA@1023..1025 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1025..1026 + 0: JS_REFERENCE_IDENTIFIER@1025..1026 + 0: IDENT@1025..1026 "B" [] [] + 1: (empty) + 2: R_BRACK@1026..1028 "]" [] [Whitespace(" ")] + 5: COLON@1028..1030 ":" [] [Whitespace(" ")] + 6: TS_UNKNOWN_TYPE@1030..1037 + 0: UNKNOWN_KW@1030..1037 "unknown" [] [] + 5: SEMICOLON@1037..1038 ";" [] [] + 12: TS_TYPE_ALIAS_DECLARATION@1038..1151 + 0: TYPE_KW@1038..1044 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1044..1059 + 0: IDENT@1044..1059 "FirstTwoAndRest" [] [] + 2: TS_TYPE_PARAMETERS@1059..1078 + 0: L_ANGLE@1059..1060 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1060..1076 + 0: TS_TYPE_PARAMETER@1060..1076 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1060..1060 + 1: TS_TYPE_PARAMETER_NAME@1060..1062 + 0: IDENT@1060..1062 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1062..1076 + 0: EXTENDS_KW@1062..1070 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@1070..1076 + 0: STRING_KW@1070..1076 "string" [] [] + 3: (empty) + 2: R_ANGLE@1076..1078 ">" [] [Whitespace(" ")] + 3: EQ@1078..1080 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1080..1150 + 0: TS_REFERENCE_TYPE@1080..1082 + 0: JS_REFERENCE_IDENTIFIER@1080..1082 + 0: IDENT@1080..1082 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1082..1090 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@1090..1123 + 0: BACKTICK@1090..1091 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1091..1121 + 0: TS_TEMPLATE_ELEMENT@1091..1101 + 0: DOLLAR_CURLY@1091..1093 "${" [] [] + 1: TS_INFER_TYPE@1093..1100 + 0: INFER_KW@1093..1099 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1099..1100 + 0: IDENT@1099..1100 "A" [] [] + 2: (empty) + 2: R_CURLY@1100..1101 "}" [] [] + 1: TS_TEMPLATE_ELEMENT@1101..1111 + 0: DOLLAR_CURLY@1101..1103 "${" [] [] + 1: TS_INFER_TYPE@1103..1110 + 0: INFER_KW@1103..1109 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1109..1110 + 0: IDENT@1109..1110 "B" [] [] + 2: (empty) + 2: R_CURLY@1110..1111 "}" [] [] + 2: TS_TEMPLATE_ELEMENT@1111..1121 + 0: DOLLAR_CURLY@1111..1113 "${" [] [] + 1: TS_INFER_TYPE@1113..1120 + 0: INFER_KW@1113..1119 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1119..1120 + 0: IDENT@1119..1120 "R" [] [] + 2: (empty) + 2: R_CURLY@1120..1121 "}" [] [] + 2: BACKTICK@1121..1123 "`" [] [Whitespace(" ")] + 3: QUESTION@1123..1125 "?" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@1125..1141 + 0: L_BRACK@1125..1126 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1126..1139 + 0: TS_TEMPLATE_LITERAL_TYPE@1126..1136 + 0: BACKTICK@1126..1127 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1127..1135 + 0: TS_TEMPLATE_ELEMENT@1127..1131 + 0: DOLLAR_CURLY@1127..1129 "${" [] [] + 1: TS_REFERENCE_TYPE@1129..1130 + 0: JS_REFERENCE_IDENTIFIER@1129..1130 + 0: IDENT@1129..1130 "A" [] [] + 1: (empty) + 2: R_CURLY@1130..1131 "}" [] [] + 1: TS_TEMPLATE_ELEMENT@1131..1135 + 0: DOLLAR_CURLY@1131..1133 "${" [] [] + 1: TS_REFERENCE_TYPE@1133..1134 + 0: JS_REFERENCE_IDENTIFIER@1133..1134 + 0: IDENT@1133..1134 "B" [] [] + 1: (empty) + 2: R_CURLY@1134..1135 "}" [] [] + 2: BACKTICK@1135..1136 "`" [] [] + 1: COMMA@1136..1138 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1138..1139 + 0: JS_REFERENCE_IDENTIFIER@1138..1139 + 0: IDENT@1138..1139 "R" [] [] + 1: (empty) + 2: R_BRACK@1139..1141 "]" [] [Whitespace(" ")] + 5: COLON@1141..1143 ":" [] [Whitespace(" ")] + 6: TS_UNKNOWN_TYPE@1143..1150 + 0: UNKNOWN_KW@1143..1150 "unknown" [] [] + 5: SEMICOLON@1150..1151 ";" [] [] + 13: TS_TYPE_ALIAS_DECLARATION@1151..1230 + 0: TYPE_KW@1151..1157 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1157..1161 + 0: IDENT@1157..1161 "Trim" [] [] + 2: TS_TYPE_PARAMETERS@1161..1180 + 0: L_ANGLE@1161..1162 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1162..1178 + 0: TS_TYPE_PARAMETER@1162..1178 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1162..1162 + 1: TS_TYPE_PARAMETER_NAME@1162..1164 + 0: IDENT@1162..1164 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1164..1178 + 0: EXTENDS_KW@1164..1172 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@1172..1178 + 0: STRING_KW@1172..1178 "string" [] [] + 3: (empty) + 2: R_ANGLE@1178..1180 ">" [] [Whitespace(" ")] + 3: EQ@1180..1181 "=" [] [] + 4: TS_CONDITIONAL_TYPE@1181..1229 + 0: TS_REFERENCE_TYPE@1181..1189 + 0: JS_REFERENCE_IDENTIFIER@1181..1189 + 0: IDENT@1181..1189 "S" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1189..1197 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@1197..1211 + 0: BACKTICK@1197..1198 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1198..1209 + 0: TS_TEMPLATE_ELEMENT@1198..1208 + 0: DOLLAR_CURLY@1198..1200 "${" [] [] + 1: TS_INFER_TYPE@1200..1207 + 0: INFER_KW@1200..1206 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1206..1207 + 0: IDENT@1206..1207 "T" [] [] + 2: (empty) + 2: R_CURLY@1207..1208 "}" [] [] + 1: TS_TEMPLATE_CHUNK_ELEMENT@1208..1209 + 0: TEMPLATE_CHUNK@1208..1209 " " [] [] + 2: BACKTICK@1209..1211 "`" [] [Whitespace(" ")] + 3: QUESTION@1211..1213 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1213..1221 + 0: JS_REFERENCE_IDENTIFIER@1213..1217 + 0: IDENT@1213..1217 "Trim" [] [] + 1: TS_TYPE_ARGUMENTS@1217..1221 + 0: L_ANGLE@1217..1218 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1218..1219 + 0: TS_REFERENCE_TYPE@1218..1219 + 0: JS_REFERENCE_IDENTIFIER@1218..1219 + 0: IDENT@1218..1219 "T" [] [] + 1: (empty) + 2: R_ANGLE@1219..1221 ">" [] [Whitespace(" ")] + 5: COLON@1221..1222 ":" [] [] + 6: TS_REFERENCE_TYPE@1222..1229 + 0: JS_REFERENCE_IDENTIFIER@1222..1229 + 0: IDENT@1222..1229 "S" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 5: SEMICOLON@1229..1230 ";" [] [] + 14: TS_TYPE_ALIAS_DECLARATION@1230..1282 + 0: TYPE_KW@1230..1236 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1236..1239 + 0: IDENT@1236..1239 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@1239..1243 + 0: L_ANGLE@1239..1240 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1240..1241 + 0: TS_TYPE_PARAMETER@1240..1241 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1240..1240 + 1: TS_TYPE_PARAMETER_NAME@1240..1241 + 0: IDENT@1240..1241 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1241..1243 ">" [] [Whitespace(" ")] + 3: EQ@1243..1245 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1245..1281 + 0: TS_REFERENCE_TYPE@1245..1247 + 0: JS_REFERENCE_IDENTIFIER@1245..1247 + 0: IDENT@1245..1247 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1247..1255 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@1255..1270 + 0: BACKTICK@1255..1256 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1256..1268 + 0: TS_TEMPLATE_CHUNK_ELEMENT@1256..1257 + 0: TEMPLATE_CHUNK@1256..1257 "*" [] [] + 1: TS_TEMPLATE_ELEMENT@1257..1267 + 0: DOLLAR_CURLY@1257..1259 "${" [] [] + 1: TS_INFER_TYPE@1259..1266 + 0: INFER_KW@1259..1265 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1265..1266 + 0: IDENT@1265..1266 "S" [] [] + 2: (empty) + 2: R_CURLY@1266..1267 "}" [] [] + 2: TS_TEMPLATE_CHUNK_ELEMENT@1267..1268 + 0: TEMPLATE_CHUNK@1267..1268 "*" [] [] + 2: BACKTICK@1268..1270 "`" [] [Whitespace(" ")] + 3: QUESTION@1270..1272 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1272..1274 + 0: JS_REFERENCE_IDENTIFIER@1272..1274 + 0: IDENT@1272..1274 "S" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1274..1276 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1276..1281 + 0: NEVER_KW@1276..1281 "never" [] [] + 5: SEMICOLON@1281..1282 ";" [] [] + 15: TS_TYPE_ALIAS_DECLARATION@1282..1421 + 0: TYPE_KW@1282..1288 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1288..1296 + 0: IDENT@1288..1296 "Unpacked" [] [] + 2: TS_TYPE_PARAMETERS@1296..1300 + 0: L_ANGLE@1296..1297 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1297..1298 + 0: TS_TYPE_PARAMETER@1297..1298 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1297..1297 + 1: TS_TYPE_PARAMETER_NAME@1297..1298 + 0: IDENT@1297..1298 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1298..1300 ">" [] [Whitespace(" ")] + 3: EQ@1300..1302 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1302..1420 + 0: TS_REFERENCE_TYPE@1302..1304 + 0: JS_REFERENCE_IDENTIFIER@1302..1304 + 0: IDENT@1302..1304 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1304..1312 "extends" [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@1312..1324 + 0: TS_PARENTHESIZED_TYPE@1312..1321 + 0: L_PAREN@1312..1313 "(" [] [] + 1: TS_INFER_TYPE@1313..1320 + 0: INFER_KW@1313..1319 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1319..1320 + 0: IDENT@1319..1320 "U" [] [] + 2: (empty) + 2: R_PAREN@1320..1321 ")" [] [] + 1: L_BRACK@1321..1322 "[" [] [] + 2: R_BRACK@1322..1324 "]" [] [Whitespace(" ")] + 3: QUESTION@1324..1326 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1326..1328 + 0: JS_REFERENCE_IDENTIFIER@1326..1328 + 0: IDENT@1326..1328 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1328..1329 ":" [] [] + 6: TS_CONDITIONAL_TYPE@1329..1420 + 0: TS_REFERENCE_TYPE@1329..1336 + 0: JS_REFERENCE_IDENTIFIER@1329..1336 + 0: IDENT@1329..1336 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1336..1344 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@1344..1372 + 0: (empty) + 1: JS_PARAMETERS@1344..1361 + 0: L_PAREN@1344..1345 "(" [] [] + 1: JS_PARAMETER_LIST@1345..1359 + 0: JS_REST_PARAMETER@1345..1359 + 0: JS_DECORATOR_LIST@1345..1345 + 1: DOT3@1345..1348 "..." [] [] + 2: JS_IDENTIFIER_BINDING@1348..1352 + 0: IDENT@1348..1352 "args" [] [] + 3: TS_TYPE_ANNOTATION@1352..1359 + 0: COLON@1352..1354 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@1354..1359 + 0: TS_ANY_TYPE@1354..1357 + 0: ANY_KW@1354..1357 "any" [] [] + 1: L_BRACK@1357..1358 "[" [] [] + 2: R_BRACK@1358..1359 "]" [] [] + 2: R_PAREN@1359..1361 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1361..1364 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@1364..1372 + 0: INFER_KW@1364..1370 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1370..1372 + 0: IDENT@1370..1372 "U" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@1372..1374 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1374..1376 + 0: JS_REFERENCE_IDENTIFIER@1374..1376 + 0: IDENT@1374..1376 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1376..1377 ":" [] [] + 6: TS_CONDITIONAL_TYPE@1377..1420 + 0: TS_REFERENCE_TYPE@1377..1384 + 0: JS_REFERENCE_IDENTIFIER@1377..1384 + 0: IDENT@1377..1384 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1384..1392 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1392..1409 + 0: JS_REFERENCE_IDENTIFIER@1392..1399 + 0: IDENT@1392..1399 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@1399..1409 + 0: L_ANGLE@1399..1400 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1400..1407 + 0: TS_INFER_TYPE@1400..1407 + 0: INFER_KW@1400..1406 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1406..1407 + 0: IDENT@1406..1407 "U" [] [] + 2: (empty) + 2: R_ANGLE@1407..1409 ">" [] [Whitespace(" ")] + 3: QUESTION@1409..1411 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1411..1413 + 0: JS_REFERENCE_IDENTIFIER@1411..1413 + 0: IDENT@1411..1413 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1413..1414 ":" [] [] + 6: TS_REFERENCE_TYPE@1414..1420 + 0: JS_REFERENCE_IDENTIFIER@1414..1420 + 0: IDENT@1414..1420 "T" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 5: SEMICOLON@1420..1421 ";" [] [] + 16: TS_TYPE_ALIAS_DECLARATION@1421..1509 + 0: TYPE_KW@1421..1427 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1427..1439 + 0: IDENT@1427..1439 "ArgumentType" [] [] + 2: TS_TYPE_PARAMETERS@1439..1467 + 0: L_ANGLE@1439..1440 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1440..1465 + 0: TS_TYPE_PARAMETER@1440..1465 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1440..1440 + 1: TS_TYPE_PARAMETER_NAME@1440..1442 + 0: IDENT@1440..1442 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1442..1465 + 0: EXTENDS_KW@1442..1450 "extends" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@1450..1465 + 0: (empty) + 1: JS_PARAMETERS@1450..1459 + 0: L_PAREN@1450..1451 "(" [] [] + 1: JS_PARAMETER_LIST@1451..1457 + 0: JS_FORMAL_PARAMETER@1451..1457 + 0: JS_DECORATOR_LIST@1451..1451 + 1: JS_IDENTIFIER_BINDING@1451..1452 + 0: IDENT@1451..1452 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1452..1457 + 0: COLON@1452..1454 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1454..1457 + 0: ANY_KW@1454..1457 "any" [] [] + 4: (empty) + 2: R_PAREN@1457..1459 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1459..1462 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@1462..1465 + 0: ANY_KW@1462..1465 "any" [] [] + 3: (empty) + 2: R_ANGLE@1465..1467 ">" [] [Whitespace(" ")] + 3: EQ@1467..1469 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1469..1508 + 0: TS_REFERENCE_TYPE@1469..1471 + 0: JS_REFERENCE_IDENTIFIER@1469..1471 + 0: IDENT@1469..1471 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1471..1479 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@1479..1499 + 0: (empty) + 1: JS_PARAMETERS@1479..1492 + 0: L_PAREN@1479..1480 "(" [] [] + 1: JS_PARAMETER_LIST@1480..1490 + 0: JS_FORMAL_PARAMETER@1480..1490 + 0: JS_DECORATOR_LIST@1480..1480 + 1: JS_IDENTIFIER_BINDING@1480..1481 + 0: IDENT@1480..1481 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1481..1490 + 0: COLON@1481..1483 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1483..1490 + 0: INFER_KW@1483..1489 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1489..1490 + 0: IDENT@1489..1490 "A" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@1490..1492 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1492..1495 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@1495..1499 + 0: ANY_KW@1495..1499 "any" [] [Whitespace(" ")] + 3: QUESTION@1499..1501 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1501..1503 + 0: JS_REFERENCE_IDENTIFIER@1501..1503 + 0: IDENT@1501..1503 "A" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1503..1505 ":" [] [Whitespace(" ")] + 6: TS_ANY_TYPE@1505..1508 + 0: ANY_KW@1505..1508 "any" [] [] + 5: SEMICOLON@1508..1509 ";" [] [] + 17: TS_TYPE_ALIAS_DECLARATION@1509..1598 + 0: TYPE_KW@1509..1515 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1515..1517 + 0: IDENT@1515..1517 "X3" [] [] + 2: TS_TYPE_PARAMETERS@1517..1521 + 0: L_ANGLE@1517..1518 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1518..1519 + 0: TS_TYPE_PARAMETER@1518..1519 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1518..1518 + 1: TS_TYPE_PARAMETER_NAME@1518..1519 + 0: IDENT@1518..1519 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1519..1521 ">" [] [Whitespace(" ")] + 3: EQ@1521..1523 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1523..1597 + 0: TS_REFERENCE_TYPE@1523..1525 + 0: JS_REFERENCE_IDENTIFIER@1523..1525 + 0: IDENT@1523..1525 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1525..1533 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@1533..1586 + 0: L_CURLY@1533..1535 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1535..1584 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1535..1560 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1535..1536 + 0: IDENT@1535..1536 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1536..1558 + 0: COLON@1536..1538 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@1538..1558 + 0: (empty) + 1: JS_PARAMETERS@1538..1551 + 0: L_PAREN@1538..1539 "(" [] [] + 1: JS_PARAMETER_LIST@1539..1549 + 0: JS_FORMAL_PARAMETER@1539..1549 + 0: JS_DECORATOR_LIST@1539..1539 + 1: JS_IDENTIFIER_BINDING@1539..1540 + 0: IDENT@1539..1540 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1540..1549 + 0: COLON@1540..1542 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1542..1549 + 0: INFER_KW@1542..1548 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1548..1549 + 0: IDENT@1548..1549 "U" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@1549..1551 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1551..1554 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@1554..1558 + 0: VOID_KW@1554..1558 "void" [] [] + 4: COMMA@1558..1560 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1560..1584 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1560..1561 + 0: IDENT@1560..1561 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1561..1584 + 0: COLON@1561..1563 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@1563..1584 + 0: (empty) + 1: JS_PARAMETERS@1563..1576 + 0: L_PAREN@1563..1564 "(" [] [] + 1: JS_PARAMETER_LIST@1564..1574 + 0: JS_FORMAL_PARAMETER@1564..1574 + 0: JS_DECORATOR_LIST@1564..1564 + 1: JS_IDENTIFIER_BINDING@1564..1565 + 0: IDENT@1564..1565 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1565..1574 + 0: COLON@1565..1567 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1567..1574 + 0: INFER_KW@1567..1573 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1573..1574 + 0: IDENT@1573..1574 "U" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@1574..1576 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1576..1579 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@1579..1584 + 0: VOID_KW@1579..1584 "void" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@1584..1586 "}" [] [Whitespace(" ")] + 3: QUESTION@1586..1588 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1588..1590 + 0: JS_REFERENCE_IDENTIFIER@1588..1590 + 0: IDENT@1588..1590 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1590..1592 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1592..1597 + 0: NEVER_KW@1592..1597 "never" [] [] + 5: SEMICOLON@1597..1598 ";" [] [] + 18: TS_TYPE_ALIAS_DECLARATION@1598..1691 + 0: TYPE_KW@1598..1604 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1604..1606 + 0: IDENT@1604..1606 "X1" [] [] + 2: TS_TYPE_PARAMETERS@1606..1637 + 0: L_ANGLE@1606..1607 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1607..1635 + 0: TS_TYPE_PARAMETER@1607..1635 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1607..1607 + 1: TS_TYPE_PARAMETER_NAME@1607..1609 + 0: IDENT@1607..1609 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1609..1635 + 0: EXTENDS_KW@1609..1617 "extends" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@1617..1635 + 0: L_CURLY@1617..1619 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1619..1634 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1619..1627 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1619..1620 + 0: IDENT@1619..1620 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1620..1625 + 0: COLON@1620..1622 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1622..1625 + 0: ANY_KW@1622..1625 "any" [] [] + 4: COMMA@1625..1627 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1627..1634 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1627..1628 + 0: IDENT@1627..1628 "y" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1628..1634 + 0: COLON@1628..1630 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1630..1634 + 0: ANY_KW@1630..1634 "any" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@1634..1635 "}" [] [] + 3: (empty) + 2: R_ANGLE@1635..1637 ">" [] [Whitespace(" ")] + 3: EQ@1637..1639 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1639..1690 + 0: TS_REFERENCE_TYPE@1639..1641 + 0: JS_REFERENCE_IDENTIFIER@1639..1641 + 0: IDENT@1639..1641 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1641..1649 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@1649..1676 + 0: L_CURLY@1649..1651 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1651..1674 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1651..1663 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1651..1652 + 0: IDENT@1651..1652 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1652..1661 + 0: COLON@1652..1654 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1654..1661 + 0: INFER_KW@1654..1660 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1660..1661 + 0: IDENT@1660..1661 "X" [] [] + 2: (empty) + 4: COMMA@1661..1663 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1663..1674 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1663..1664 + 0: IDENT@1663..1664 "y" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1664..1674 + 0: COLON@1664..1666 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1666..1674 + 0: INFER_KW@1666..1672 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1672..1674 + 0: IDENT@1672..1674 "Y" [] [Whitespace(" ")] + 2: (empty) + 4: (empty) + 2: R_CURLY@1674..1676 "}" [] [Whitespace(" ")] + 3: QUESTION@1676..1678 "?" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@1678..1685 + 0: L_BRACK@1678..1679 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1679..1683 + 0: TS_REFERENCE_TYPE@1679..1680 + 0: JS_REFERENCE_IDENTIFIER@1679..1680 + 0: IDENT@1679..1680 "X" [] [] + 1: (empty) + 1: COMMA@1680..1682 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1682..1683 + 0: JS_REFERENCE_IDENTIFIER@1682..1683 + 0: IDENT@1682..1683 "Y" [] [] + 1: (empty) + 2: R_BRACK@1683..1685 "]" [] [Whitespace(" ")] + 5: COLON@1685..1687 ":" [] [Whitespace(" ")] + 6: TS_ANY_TYPE@1687..1690 + 0: ANY_KW@1687..1690 "any" [] [] + 5: SEMICOLON@1690..1691 ";" [] [] + 19: TS_TYPE_ALIAS_DECLARATION@1691..1736 + 0: TYPE_KW@1691..1697 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1697..1700 + 0: IDENT@1697..1700 "T62" [] [] + 2: TS_TYPE_PARAMETERS@1700..1704 + 0: L_ANGLE@1700..1701 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1701..1702 + 0: TS_TYPE_PARAMETER@1701..1702 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1701..1701 + 1: TS_TYPE_PARAMETER_NAME@1701..1702 + 0: IDENT@1701..1702 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1702..1704 ">" [] [Whitespace(" ")] + 3: EQ@1704..1706 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1706..1735 + 0: TS_REFERENCE_TYPE@1706..1708 + 0: JS_REFERENCE_IDENTIFIER@1706..1708 + 0: IDENT@1706..1708 "U" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1708..1716 "extends" [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@1716..1728 + 0: TS_PARENTHESIZED_TYPE@1716..1725 + 0: L_PAREN@1716..1717 "(" [] [] + 1: TS_INFER_TYPE@1717..1724 + 0: INFER_KW@1717..1723 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1723..1724 + 0: IDENT@1723..1724 "U" [] [] + 2: (empty) + 2: R_PAREN@1724..1725 ")" [] [] + 1: L_BRACK@1725..1726 "[" [] [] + 2: R_BRACK@1726..1728 "]" [] [Whitespace(" ")] + 3: QUESTION@1728..1730 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1730..1732 + 0: JS_REFERENCE_IDENTIFIER@1730..1732 + 0: IDENT@1730..1732 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1732..1734 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@1734..1735 + 0: JS_REFERENCE_IDENTIFIER@1734..1735 + 0: IDENT@1734..1735 "U" [] [] + 1: (empty) + 5: SEMICOLON@1735..1736 ";" [] [] + 20: TS_TYPE_ALIAS_DECLARATION@1736..1827 + 0: TYPE_KW@1736..1742 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1742..1745 + 0: IDENT@1742..1745 "T63" [] [] + 2: TS_TYPE_PARAMETERS@1745..1749 + 0: L_ANGLE@1745..1746 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1746..1747 + 0: TS_TYPE_PARAMETER@1746..1747 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1746..1746 + 1: TS_TYPE_PARAMETER_NAME@1746..1747 + 0: IDENT@1746..1747 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1747..1749 ">" [] [Whitespace(" ")] + 3: EQ@1749..1751 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1751..1826 + 0: TS_REFERENCE_TYPE@1751..1753 + 0: JS_REFERENCE_IDENTIFIER@1751..1753 + 0: IDENT@1751..1753 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1753..1761 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@1761..1809 + 0: L_PAREN@1761..1762 "(" [] [] + 1: TS_CONDITIONAL_TYPE@1762..1807 + 0: TS_PARENTHESIZED_TYPE@1762..1772 + 0: L_PAREN@1762..1763 "(" [] [] + 1: TS_INFER_TYPE@1763..1770 + 0: INFER_KW@1763..1769 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1769..1770 + 0: IDENT@1769..1770 "A" [] [] + 2: (empty) + 2: R_PAREN@1770..1772 ")" [] [Whitespace(" ")] + 1: EXTENDS_KW@1772..1780 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@1780..1788 + 0: INFER_KW@1780..1786 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1786..1788 + 0: IDENT@1786..1788 "B" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@1788..1790 "?" [] [Whitespace(" ")] + 4: TS_INFER_TYPE@1790..1798 + 0: INFER_KW@1790..1796 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1796..1798 + 0: IDENT@1796..1798 "C" [] [Whitespace(" ")] + 2: (empty) + 5: COLON@1798..1800 ":" [] [Whitespace(" ")] + 6: TS_INFER_TYPE@1800..1807 + 0: INFER_KW@1800..1806 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1806..1807 + 0: IDENT@1806..1807 "D" [] [] + 2: (empty) + 2: R_PAREN@1807..1809 ")" [] [Whitespace(" ")] + 3: QUESTION@1809..1811 "?" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@1811..1818 + 0: STRING_KW@1811..1818 "string" [] [Whitespace(" ")] + 5: COLON@1818..1820 ":" [] [Whitespace(" ")] + 6: TS_NUMBER_TYPE@1820..1826 + 0: NUMBER_KW@1820..1826 "number" [] [] + 5: SEMICOLON@1826..1827 ";" [] [] + 21: TS_TYPE_ALIAS_DECLARATION@1827..1912 + 0: TYPE_KW@1827..1833 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1833..1836 + 0: IDENT@1833..1836 "T75" [] [] + 2: TS_TYPE_PARAMETERS@1836..1840 + 0: L_ANGLE@1836..1837 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1837..1838 + 0: TS_TYPE_PARAMETER@1837..1838 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1837..1837 + 1: TS_TYPE_PARAMETER_NAME@1837..1838 + 0: IDENT@1837..1838 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1838..1840 ">" [] [Whitespace(" ")] + 3: EQ@1840..1842 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1842..1911 + 0: TS_REFERENCE_TYPE@1842..1844 + 0: JS_REFERENCE_IDENTIFIER@1842..1844 + 0: IDENT@1842..1844 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1844..1852 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1852..1874 + 0: JS_REFERENCE_IDENTIFIER@1852..1855 + 0: IDENT@1852..1855 "T74" [] [] + 1: TS_TYPE_ARGUMENTS@1855..1874 + 0: L_ANGLE@1855..1856 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1856..1872 + 0: TS_INFER_TYPE@1856..1863 + 0: INFER_KW@1856..1862 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1862..1863 + 0: IDENT@1862..1863 "U" [] [] + 2: (empty) + 1: COMMA@1863..1865 "," [] [Whitespace(" ")] + 2: TS_INFER_TYPE@1865..1872 + 0: INFER_KW@1865..1871 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1871..1872 + 0: IDENT@1871..1872 "U" [] [] + 2: (empty) + 2: R_ANGLE@1872..1874 ">" [] [Whitespace(" ")] + 3: QUESTION@1874..1876 "?" [] [Whitespace(" ")] + 4: TS_UNION_TYPE@1876..1904 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@1876..1904 + 0: TS_REFERENCE_TYPE@1876..1883 + 0: JS_REFERENCE_IDENTIFIER@1876..1879 + 0: IDENT@1876..1879 "T70" [] [] + 1: TS_TYPE_ARGUMENTS@1879..1883 + 0: L_ANGLE@1879..1880 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1880..1881 + 0: TS_REFERENCE_TYPE@1880..1881 + 0: JS_REFERENCE_IDENTIFIER@1880..1881 + 0: IDENT@1880..1881 "U" [] [] + 1: (empty) + 2: R_ANGLE@1881..1883 ">" [] [Whitespace(" ")] + 1: PIPE@1883..1885 "|" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1885..1892 + 0: JS_REFERENCE_IDENTIFIER@1885..1888 + 0: IDENT@1885..1888 "T72" [] [] + 1: TS_TYPE_ARGUMENTS@1888..1892 + 0: L_ANGLE@1888..1889 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1889..1890 + 0: TS_REFERENCE_TYPE@1889..1890 + 0: JS_REFERENCE_IDENTIFIER@1889..1890 + 0: IDENT@1889..1890 "U" [] [] + 1: (empty) + 2: R_ANGLE@1890..1892 ">" [] [Whitespace(" ")] + 3: PIPE@1892..1894 "|" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1894..1904 + 0: JS_REFERENCE_IDENTIFIER@1894..1897 + 0: IDENT@1894..1897 "T74" [] [] + 1: TS_TYPE_ARGUMENTS@1897..1904 + 0: L_ANGLE@1897..1898 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1898..1902 + 0: TS_REFERENCE_TYPE@1898..1899 + 0: JS_REFERENCE_IDENTIFIER@1898..1899 + 0: IDENT@1898..1899 "U" [] [] + 1: (empty) + 1: COMMA@1899..1901 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1901..1902 + 0: JS_REFERENCE_IDENTIFIER@1901..1902 + 0: IDENT@1901..1902 "U" [] [] + 1: (empty) + 2: R_ANGLE@1902..1904 ">" [] [Whitespace(" ")] + 5: COLON@1904..1906 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1906..1911 + 0: NEVER_KW@1906..1911 "never" [] [] + 5: SEMICOLON@1911..1912 ";" [] [] + 22: TS_TYPE_ALIAS_DECLARATION@1912..2128 + 0: TYPE_KW@1912..1918 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1918..1927 + 0: IDENT@1918..1927 "Jsonified" [] [] + 2: TS_TYPE_PARAMETERS@1927..1931 + 0: L_ANGLE@1927..1928 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1928..1929 + 0: TS_TYPE_PARAMETER@1928..1929 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1928..1928 + 1: TS_TYPE_PARAMETER_NAME@1928..1929 + 0: IDENT@1928..1929 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1929..1931 ">" [] [Whitespace(" ")] + 3: EQ@1931..1933 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1933..2127 + 0: TS_REFERENCE_TYPE@1933..1935 + 0: JS_REFERENCE_IDENTIFIER@1933..1935 + 0: IDENT@1933..1935 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1935..1943 "extends" [] [Whitespace(" ")] + 2: TS_UNION_TYPE@1943..1976 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@1943..1976 + 0: TS_STRING_TYPE@1943..1950 + 0: STRING_KW@1943..1950 "string" [] [Whitespace(" ")] + 1: PIPE@1950..1952 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@1952..1959 + 0: NUMBER_KW@1952..1959 "number" [] [Whitespace(" ")] + 3: PIPE@1959..1961 "|" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@1961..1969 + 0: BOOLEAN_KW@1961..1969 "boolean" [] [Whitespace(" ")] + 5: PIPE@1969..1971 "|" [] [Whitespace(" ")] + 6: TS_NULL_LITERAL_TYPE@1971..1976 + 0: NULL_KW@1971..1976 "null" [] [Whitespace(" ")] + 3: QUESTION@1976..1978 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1978..1979 + 0: JS_REFERENCE_IDENTIFIER@1978..1979 + 0: IDENT@1978..1979 "T" [] [] + 1: (empty) + 5: COLON@1979..1986 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_CONDITIONAL_TYPE@1986..2127 + 0: TS_REFERENCE_TYPE@1986..1988 + 0: JS_REFERENCE_IDENTIFIER@1986..1988 + 0: IDENT@1986..1988 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1988..1996 "extends" [] [Whitespace(" ")] + 2: TS_UNION_TYPE@1996..2017 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@1996..2017 + 0: TS_UNDEFINED_TYPE@1996..2006 + 0: UNDEFINED_KW@1996..2006 "undefined" [] [Whitespace(" ")] + 1: PIPE@2006..2008 "|" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@2008..2017 + 0: JS_REFERENCE_IDENTIFIER@2008..2017 + 0: IDENT@2008..2017 "Function" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@2017..2019 "?" [] [Whitespace(" ")] + 4: TS_NEVER_TYPE@2019..2024 + 0: NEVER_KW@2019..2024 "never" [] [] + 5: COLON@2024..2031 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_CONDITIONAL_TYPE@2031..2127 + 0: TS_REFERENCE_TYPE@2031..2033 + 0: JS_REFERENCE_IDENTIFIER@2031..2033 + 0: IDENT@2031..2033 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2033..2041 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@2041..2063 + 0: L_CURLY@2041..2043 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@2043..2061 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@2043..2061 + 0: JS_LITERAL_MEMBER_NAME@2043..2049 + 0: IDENT@2043..2049 "toJSON" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@2049..2051 + 0: L_PAREN@2049..2050 "(" [] [] + 1: JS_PARAMETER_LIST@2050..2050 + 2: R_PAREN@2050..2051 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@2051..2061 + 0: COLON@2051..2053 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@2053..2061 + 0: INFER_KW@2053..2059 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2059..2061 + 0: IDENT@2059..2061 "R" [] [Whitespace(" ")] + 2: (empty) + 5: (empty) + 2: R_CURLY@2061..2063 "}" [] [Whitespace(" ")] + 3: QUESTION@2063..2065 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2065..2066 + 0: JS_REFERENCE_IDENTIFIER@2065..2066 + 0: IDENT@2065..2066 "R" [] [] + 1: (empty) + 5: COLON@2066..2073 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_CONDITIONAL_TYPE@2073..2127 + 0: TS_REFERENCE_TYPE@2073..2075 + 0: JS_REFERENCE_IDENTIFIER@2073..2075 + 0: IDENT@2073..2075 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2075..2083 "extends" [] [Whitespace(" ")] + 2: TS_NON_PRIMITIVE_TYPE@2083..2090 + 0: OBJECT_KW@2083..2090 "object" [] [Whitespace(" ")] + 3: QUESTION@2090..2092 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2092..2110 + 0: JS_REFERENCE_IDENTIFIER@2092..2107 + 0: IDENT@2092..2107 "JsonifiedObject" [] [] + 1: TS_TYPE_ARGUMENTS@2107..2110 + 0: L_ANGLE@2107..2108 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2108..2109 + 0: TS_REFERENCE_TYPE@2108..2109 + 0: JS_REFERENCE_IDENTIFIER@2108..2109 + 0: IDENT@2108..2109 "T" [] [] + 1: (empty) + 2: R_ANGLE@2109..2110 ">" [] [] + 5: COLON@2110..2113 ":" [Newline("\n")] [Whitespace(" ")] + 6: TS_STRING_LITERAL_TYPE@2113..2127 + 0: JS_STRING_LITERAL@2113..2127 "\"what is this\"" [] [] + 5: SEMICOLON@2127..2128 ";" [] [] + 23: TS_TYPE_ALIAS_DECLARATION@2128..2191 + 0: TYPE_KW@2128..2134 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2134..2137 + 0: IDENT@2134..2137 "T1" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@2137..2139 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2139..2190 + 0: TS_REFERENCE_TYPE@2139..2142 + 0: JS_REFERENCE_IDENTIFIER@2139..2142 + 0: IDENT@2139..2142 "F1" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2142..2150 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@2150..2179 + 0: (empty) + 1: JS_PARAMETERS@2150..2171 + 0: L_PAREN@2150..2151 "(" [] [] + 1: JS_PARAMETER_LIST@2151..2169 + 0: JS_REST_PARAMETER@2151..2169 + 0: JS_DECORATOR_LIST@2151..2151 + 1: DOT3@2151..2154 "..." [] [] + 2: JS_IDENTIFIER_BINDING@2154..2158 + 0: IDENT@2154..2158 "args" [] [] + 3: TS_TYPE_ANNOTATION@2158..2169 + 0: COLON@2158..2160 ":" [] [Whitespace(" ")] + 1: TS_PARENTHESIZED_TYPE@2160..2169 + 0: L_PAREN@2160..2161 "(" [] [] + 1: TS_INFER_TYPE@2161..2168 + 0: INFER_KW@2161..2167 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2167..2168 + 0: IDENT@2167..2168 "T" [] [] + 2: (empty) + 2: R_PAREN@2168..2169 ")" [] [] + 2: R_PAREN@2169..2171 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2171..2174 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@2174..2179 + 0: VOID_KW@2174..2179 "void" [] [Whitespace(" ")] + 3: QUESTION@2179..2181 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2181..2183 + 0: JS_REFERENCE_IDENTIFIER@2181..2183 + 0: IDENT@2181..2183 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@2183..2185 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@2185..2190 + 0: NEVER_KW@2185..2190 "never" [] [] + 5: SEMICOLON@2190..2191 ";" [] [] + 24: TS_TYPE_ALIAS_DECLARATION@2191..2256 + 0: TYPE_KW@2191..2197 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2197..2200 + 0: IDENT@2197..2200 "T2" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@2200..2202 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2202..2255 + 0: TS_REFERENCE_TYPE@2202..2205 + 0: JS_REFERENCE_IDENTIFIER@2202..2205 + 0: IDENT@2202..2205 "F1" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2205..2213 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@2213..2244 + 0: (empty) + 1: JS_PARAMETERS@2213..2236 + 0: L_PAREN@2213..2214 "(" [] [] + 1: JS_PARAMETER_LIST@2214..2234 + 0: JS_FORMAL_PARAMETER@2214..2234 + 0: JS_DECORATOR_LIST@2214..2214 + 1: JS_IDENTIFIER_BINDING@2214..2218 + 0: IDENT@2214..2218 "args" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@2218..2234 + 0: COLON@2218..2220 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@2220..2234 + 0: L_BRACK@2220..2221 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@2221..2233 + 0: TS_REST_TUPLE_TYPE_ELEMENT@2221..2233 + 0: DOT3@2221..2224 "..." [] [] + 1: TS_PARENTHESIZED_TYPE@2224..2233 + 0: L_PAREN@2224..2225 "(" [] [] + 1: TS_INFER_TYPE@2225..2232 + 0: INFER_KW@2225..2231 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2231..2232 + 0: IDENT@2231..2232 "T" [] [] + 2: (empty) + 2: R_PAREN@2232..2233 ")" [] [] + 2: R_BRACK@2233..2234 "]" [] [] + 4: (empty) + 2: R_PAREN@2234..2236 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2236..2239 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@2239..2244 + 0: VOID_KW@2239..2244 "void" [] [Whitespace(" ")] + 3: QUESTION@2244..2246 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2246..2248 + 0: JS_REFERENCE_IDENTIFIER@2246..2248 + 0: IDENT@2246..2248 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@2248..2250 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@2250..2255 + 0: NEVER_KW@2250..2255 "never" [] [] + 5: SEMICOLON@2255..2256 ";" [] [] + 25: TS_TYPE_ALIAS_DECLARATION@2256..2315 + 0: TYPE_KW@2256..2262 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2262..2264 + 0: IDENT@2262..2264 "T3" [] [] + 2: TS_TYPE_PARAMETERS@2264..2268 + 0: L_ANGLE@2264..2265 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@2265..2266 + 0: TS_TYPE_PARAMETER@2265..2266 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2265..2265 + 1: TS_TYPE_PARAMETER_NAME@2265..2266 + 0: IDENT@2265..2266 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@2266..2268 ">" [] [Whitespace(" ")] + 3: EQ@2268..2270 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2270..2314 + 0: TS_REFERENCE_TYPE@2270..2272 + 0: JS_REFERENCE_IDENTIFIER@2270..2272 + 0: IDENT@2270..2272 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2272..2280 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@2280..2300 + 0: JS_REFERENCE_IDENTIFIER@2280..2288 + 0: IDENT@2280..2288 "IsNumber" [] [] + 1: TS_TYPE_ARGUMENTS@2288..2300 + 0: L_ANGLE@2288..2289 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2289..2298 + 0: TS_PARENTHESIZED_TYPE@2289..2298 + 0: L_PAREN@2289..2290 "(" [] [] + 1: TS_INFER_TYPE@2290..2297 + 0: INFER_KW@2290..2296 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2296..2297 + 0: IDENT@2296..2297 "N" [] [] + 2: (empty) + 2: R_PAREN@2297..2298 ")" [] [] + 2: R_ANGLE@2298..2300 ">" [] [Whitespace(" ")] + 3: QUESTION@2300..2302 "?" [] [Whitespace(" ")] + 4: TS_BOOLEAN_LITERAL_TYPE@2302..2307 + 0: TRUE_KW@2302..2307 "true" [] [Whitespace(" ")] + 5: COLON@2307..2309 ":" [] [Whitespace(" ")] + 6: TS_BOOLEAN_LITERAL_TYPE@2309..2314 + 0: FALSE_KW@2309..2314 "false" [] [] + 5: SEMICOLON@2314..2315 ";" [] [] + 26: TS_TYPE_ALIAS_DECLARATION@2315..2380 + 0: TYPE_KW@2315..2321 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2321..2324 + 0: IDENT@2321..2324 "T4" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@2324..2326 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2326..2379 + 0: TS_REFERENCE_TYPE@2326..2329 + 0: JS_REFERENCE_IDENTIFIER@2326..2329 + 0: IDENT@2326..2329 "F1" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2329..2337 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@2337..2368 + 0: (empty) + 1: JS_PARAMETERS@2337..2360 + 0: L_PAREN@2337..2338 "(" [] [] + 1: JS_PARAMETER_LIST@2338..2358 + 0: JS_REST_PARAMETER@2338..2358 + 0: JS_DECORATOR_LIST@2338..2338 + 1: DOT3@2338..2341 "..." [] [] + 2: JS_IDENTIFIER_BINDING@2341..2345 + 0: IDENT@2341..2345 "args" [] [] + 3: TS_TYPE_ANNOTATION@2345..2358 + 0: COLON@2345..2347 ":" [] [Whitespace(" ")] + 1: TS_PARENTHESIZED_TYPE@2347..2358 + 0: L_PAREN@2347..2348 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2348..2357 + 0: L_PAREN@2348..2349 "(" [] [] + 1: TS_INFER_TYPE@2349..2356 + 0: INFER_KW@2349..2355 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2355..2356 + 0: IDENT@2355..2356 "T" [] [] + 2: (empty) + 2: R_PAREN@2356..2357 ")" [] [] + 2: R_PAREN@2357..2358 ")" [] [] + 2: R_PAREN@2358..2360 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2360..2363 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@2363..2368 + 0: VOID_KW@2363..2368 "void" [] [Whitespace(" ")] + 3: QUESTION@2368..2370 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2370..2372 + 0: JS_REFERENCE_IDENTIFIER@2370..2372 + 0: IDENT@2370..2372 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@2372..2374 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@2374..2379 + 0: NEVER_KW@2374..2379 "never" [] [] + 5: SEMICOLON@2379..2380 ";" [] [] + 27: TS_TYPE_ALIAS_DECLARATION@2380..2447 + 0: TYPE_KW@2380..2386 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2386..2389 + 0: IDENT@2386..2389 "T5" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@2389..2391 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2391..2446 + 0: TS_REFERENCE_TYPE@2391..2394 + 0: JS_REFERENCE_IDENTIFIER@2391..2394 + 0: IDENT@2391..2394 "F1" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2394..2402 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@2402..2435 + 0: (empty) + 1: JS_PARAMETERS@2402..2427 + 0: L_PAREN@2402..2403 "(" [] [] + 1: JS_PARAMETER_LIST@2403..2425 + 0: JS_FORMAL_PARAMETER@2403..2425 + 0: JS_DECORATOR_LIST@2403..2403 + 1: JS_IDENTIFIER_BINDING@2403..2407 + 0: IDENT@2403..2407 "args" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@2407..2425 + 0: COLON@2407..2409 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@2409..2425 + 0: L_BRACK@2409..2410 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@2410..2424 + 0: TS_REST_TUPLE_TYPE_ELEMENT@2410..2424 + 0: DOT3@2410..2413 "..." [] [] + 1: TS_PARENTHESIZED_TYPE@2413..2424 + 0: L_PAREN@2413..2414 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2414..2423 + 0: L_PAREN@2414..2415 "(" [] [] + 1: TS_INFER_TYPE@2415..2422 + 0: INFER_KW@2415..2421 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2421..2422 + 0: IDENT@2421..2422 "T" [] [] + 2: (empty) + 2: R_PAREN@2422..2423 ")" [] [] + 2: R_PAREN@2423..2424 ")" [] [] + 2: R_BRACK@2424..2425 "]" [] [] + 4: (empty) + 2: R_PAREN@2425..2427 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2427..2430 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@2430..2435 + 0: VOID_KW@2430..2435 "void" [] [Whitespace(" ")] + 3: QUESTION@2435..2437 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2437..2439 + 0: JS_REFERENCE_IDENTIFIER@2437..2439 + 0: IDENT@2437..2439 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@2439..2441 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@2441..2446 + 0: NEVER_KW@2441..2446 "never" [] [] + 5: SEMICOLON@2446..2447 ";" [] [] + 28: TS_TYPE_ALIAS_DECLARATION@2447..2508 + 0: TYPE_KW@2447..2453 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2453..2455 + 0: IDENT@2453..2455 "T6" [] [] + 2: TS_TYPE_PARAMETERS@2455..2459 + 0: L_ANGLE@2455..2456 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@2456..2457 + 0: TS_TYPE_PARAMETER@2456..2457 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2456..2456 + 1: TS_TYPE_PARAMETER_NAME@2456..2457 + 0: IDENT@2456..2457 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@2457..2459 ">" [] [Whitespace(" ")] + 3: EQ@2459..2461 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2461..2507 + 0: TS_REFERENCE_TYPE@2461..2463 + 0: JS_REFERENCE_IDENTIFIER@2461..2463 + 0: IDENT@2461..2463 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2463..2471 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@2471..2493 + 0: JS_REFERENCE_IDENTIFIER@2471..2479 + 0: IDENT@2471..2479 "IsNumber" [] [] + 1: TS_TYPE_ARGUMENTS@2479..2493 + 0: L_ANGLE@2479..2480 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2480..2491 + 0: TS_PARENTHESIZED_TYPE@2480..2491 + 0: L_PAREN@2480..2481 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2481..2490 + 0: L_PAREN@2481..2482 "(" [] [] + 1: TS_INFER_TYPE@2482..2489 + 0: INFER_KW@2482..2488 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2488..2489 + 0: IDENT@2488..2489 "N" [] [] + 2: (empty) + 2: R_PAREN@2489..2490 ")" [] [] + 2: R_PAREN@2490..2491 ")" [] [] + 2: R_ANGLE@2491..2493 ">" [] [Whitespace(" ")] + 3: QUESTION@2493..2495 "?" [] [Whitespace(" ")] + 4: TS_BOOLEAN_LITERAL_TYPE@2495..2500 + 0: TRUE_KW@2495..2500 "true" [] [Whitespace(" ")] + 5: COLON@2500..2502 ":" [] [Whitespace(" ")] + 6: TS_BOOLEAN_LITERAL_TYPE@2502..2507 + 0: FALSE_KW@2502..2507 "false" [] [] + 5: SEMICOLON@2507..2508 ";" [] [] + 29: TS_TYPE_ALIAS_DECLARATION@2508..2577 + 0: TYPE_KW@2508..2514 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2514..2517 + 0: IDENT@2514..2517 "T7" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@2517..2519 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2519..2576 + 0: TS_REFERENCE_TYPE@2519..2522 + 0: JS_REFERENCE_IDENTIFIER@2519..2522 + 0: IDENT@2519..2522 "F1" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2522..2530 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@2530..2565 + 0: (empty) + 1: JS_PARAMETERS@2530..2557 + 0: L_PAREN@2530..2531 "(" [] [] + 1: JS_PARAMETER_LIST@2531..2555 + 0: JS_REST_PARAMETER@2531..2555 + 0: JS_DECORATOR_LIST@2531..2531 + 1: DOT3@2531..2534 "..." [] [] + 2: JS_IDENTIFIER_BINDING@2534..2538 + 0: IDENT@2534..2538 "args" [] [] + 3: TS_TYPE_ANNOTATION@2538..2555 + 0: COLON@2538..2540 ":" [] [Whitespace(" ")] + 1: TS_PARENTHESIZED_TYPE@2540..2555 + 0: L_PAREN@2540..2541 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2541..2554 + 0: L_PAREN@2541..2542 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2542..2553 + 0: L_PAREN@2542..2543 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2543..2552 + 0: L_PAREN@2543..2544 "(" [] [] + 1: TS_INFER_TYPE@2544..2551 + 0: INFER_KW@2544..2550 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2550..2551 + 0: IDENT@2550..2551 "T" [] [] + 2: (empty) + 2: R_PAREN@2551..2552 ")" [] [] + 2: R_PAREN@2552..2553 ")" [] [] + 2: R_PAREN@2553..2554 ")" [] [] + 2: R_PAREN@2554..2555 ")" [] [] + 2: R_PAREN@2555..2557 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2557..2560 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@2560..2565 + 0: VOID_KW@2560..2565 "void" [] [Whitespace(" ")] + 3: QUESTION@2565..2567 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2567..2569 + 0: JS_REFERENCE_IDENTIFIER@2567..2569 + 0: IDENT@2567..2569 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@2569..2571 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@2571..2576 + 0: NEVER_KW@2571..2576 "never" [] [] + 5: SEMICOLON@2576..2577 ";" [] [] + 30: TS_TYPE_ALIAS_DECLARATION@2577..2648 + 0: TYPE_KW@2577..2583 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2583..2586 + 0: IDENT@2583..2586 "T8" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@2586..2588 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2588..2647 + 0: TS_REFERENCE_TYPE@2588..2591 + 0: JS_REFERENCE_IDENTIFIER@2588..2591 + 0: IDENT@2588..2591 "F1" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2591..2599 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@2599..2636 + 0: (empty) + 1: JS_PARAMETERS@2599..2628 + 0: L_PAREN@2599..2600 "(" [] [] + 1: JS_PARAMETER_LIST@2600..2626 + 0: JS_FORMAL_PARAMETER@2600..2626 + 0: JS_DECORATOR_LIST@2600..2600 + 1: JS_IDENTIFIER_BINDING@2600..2604 + 0: IDENT@2600..2604 "args" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@2604..2626 + 0: COLON@2604..2606 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@2606..2626 + 0: L_BRACK@2606..2607 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@2607..2625 + 0: TS_REST_TUPLE_TYPE_ELEMENT@2607..2625 + 0: DOT3@2607..2610 "..." [] [] + 1: TS_PARENTHESIZED_TYPE@2610..2625 + 0: L_PAREN@2610..2611 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2611..2624 + 0: L_PAREN@2611..2612 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2612..2623 + 0: L_PAREN@2612..2613 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2613..2622 + 0: L_PAREN@2613..2614 "(" [] [] + 1: TS_INFER_TYPE@2614..2621 + 0: INFER_KW@2614..2620 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2620..2621 + 0: IDENT@2620..2621 "T" [] [] + 2: (empty) + 2: R_PAREN@2621..2622 ")" [] [] + 2: R_PAREN@2622..2623 ")" [] [] + 2: R_PAREN@2623..2624 ")" [] [] + 2: R_PAREN@2624..2625 ")" [] [] + 2: R_BRACK@2625..2626 "]" [] [] + 4: (empty) + 2: R_PAREN@2626..2628 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2628..2631 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@2631..2636 + 0: VOID_KW@2631..2636 "void" [] [Whitespace(" ")] + 3: QUESTION@2636..2638 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2638..2640 + 0: JS_REFERENCE_IDENTIFIER@2638..2640 + 0: IDENT@2638..2640 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@2640..2642 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@2642..2647 + 0: NEVER_KW@2642..2647 "never" [] [] + 5: SEMICOLON@2647..2648 ";" [] [] + 31: TS_TYPE_ALIAS_DECLARATION@2648..2713 + 0: TYPE_KW@2648..2654 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2654..2656 + 0: IDENT@2654..2656 "T9" [] [] + 2: TS_TYPE_PARAMETERS@2656..2660 + 0: L_ANGLE@2656..2657 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@2657..2658 + 0: TS_TYPE_PARAMETER@2657..2658 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2657..2657 + 1: TS_TYPE_PARAMETER_NAME@2657..2658 + 0: IDENT@2657..2658 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@2658..2660 ">" [] [Whitespace(" ")] + 3: EQ@2660..2662 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@2662..2712 + 0: TS_REFERENCE_TYPE@2662..2664 + 0: JS_REFERENCE_IDENTIFIER@2662..2664 + 0: IDENT@2662..2664 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2664..2672 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@2672..2698 + 0: JS_REFERENCE_IDENTIFIER@2672..2680 + 0: IDENT@2672..2680 "IsNumber" [] [] + 1: TS_TYPE_ARGUMENTS@2680..2698 + 0: L_ANGLE@2680..2681 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2681..2696 + 0: TS_PARENTHESIZED_TYPE@2681..2696 + 0: L_PAREN@2681..2682 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2682..2695 + 0: L_PAREN@2682..2683 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2683..2694 + 0: L_PAREN@2683..2684 "(" [] [] + 1: TS_PARENTHESIZED_TYPE@2684..2693 + 0: L_PAREN@2684..2685 "(" [] [] + 1: TS_INFER_TYPE@2685..2692 + 0: INFER_KW@2685..2691 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2691..2692 + 0: IDENT@2691..2692 "N" [] [] + 2: (empty) + 2: R_PAREN@2692..2693 ")" [] [] + 2: R_PAREN@2693..2694 ")" [] [] + 2: R_PAREN@2694..2695 ")" [] [] + 2: R_PAREN@2695..2696 ")" [] [] + 2: R_ANGLE@2696..2698 ">" [] [Whitespace(" ")] + 3: QUESTION@2698..2700 "?" [] [Whitespace(" ")] + 4: TS_BOOLEAN_LITERAL_TYPE@2700..2705 + 0: TRUE_KW@2700..2705 "true" [] [Whitespace(" ")] + 5: COLON@2705..2707 ":" [] [Whitespace(" ")] + 6: TS_BOOLEAN_LITERAL_TYPE@2707..2712 + 0: FALSE_KW@2707..2712 "false" [] [] + 5: SEMICOLON@2712..2713 ";" [] [] + 32: TS_TYPE_ALIAS_DECLARATION@2713..2836 + 0: TYPE_KW@2713..2719 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@2719..2726 + 0: IDENT@2719..2726 "Prepend" [] [] + 2: TS_TYPE_PARAMETERS@2726..2747 + 0: L_ANGLE@2726..2727 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@2727..2745 + 0: TS_TYPE_PARAMETER@2727..2728 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2727..2727 + 1: TS_TYPE_PARAMETER_NAME@2727..2728 + 0: IDENT@2727..2728 "E" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@2728..2730 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@2730..2745 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2730..2730 + 1: TS_TYPE_PARAMETER_NAME@2730..2732 + 0: IDENT@2730..2732 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@2732..2745 + 0: EXTENDS_KW@2732..2740 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@2740..2745 + 0: TS_ANY_TYPE@2740..2743 + 0: ANY_KW@2740..2743 "any" [] [] + 1: L_BRACK@2743..2744 "[" [] [] + 2: R_BRACK@2744..2745 "]" [] [] + 3: (empty) + 2: R_ANGLE@2745..2747 ">" [] [Whitespace(" ")] + 3: EQ@2747..2748 "=" [] [] + 4: TS_CONDITIONAL_TYPE@2748..2835 + 0: TS_PARENTHESIZED_TYPE@2748..2784 + 0: L_PAREN@2748..2754 "(" [Newline("\n"), Whitespace(" ")] [] + 1: TS_FUNCTION_TYPE@2754..2782 + 0: (empty) + 1: JS_PARAMETERS@2754..2776 + 0: L_PAREN@2754..2755 "(" [] [] + 1: JS_PARAMETER_LIST@2755..2774 + 0: JS_FORMAL_PARAMETER@2755..2762 + 0: JS_DECORATOR_LIST@2755..2755 + 1: JS_IDENTIFIER_BINDING@2755..2759 + 0: IDENT@2755..2759 "head" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@2759..2762 + 0: COLON@2759..2761 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@2761..2762 + 0: JS_REFERENCE_IDENTIFIER@2761..2762 + 0: IDENT@2761..2762 "E" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@2762..2764 "," [] [Whitespace(" ")] + 2: JS_REST_PARAMETER@2764..2774 + 0: JS_DECORATOR_LIST@2764..2764 + 1: DOT3@2764..2767 "..." [] [] + 2: JS_IDENTIFIER_BINDING@2767..2771 + 0: IDENT@2767..2771 "args" [] [] + 3: TS_TYPE_ANNOTATION@2771..2774 + 0: COLON@2771..2773 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@2773..2774 + 0: JS_REFERENCE_IDENTIFIER@2773..2774 + 0: IDENT@2773..2774 "T" [] [] + 1: (empty) + 2: R_PAREN@2774..2776 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2776..2779 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@2779..2782 + 0: ANY_KW@2779..2782 "any" [] [] + 2: R_PAREN@2782..2784 ")" [] [Whitespace(" ")] + 1: EXTENDS_KW@2784..2792 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@2792..2819 + 0: L_PAREN@2792..2793 "(" [] [] + 1: TS_FUNCTION_TYPE@2793..2818 + 0: (empty) + 1: JS_PARAMETERS@2793..2812 + 0: L_PAREN@2793..2794 "(" [] [] + 1: JS_PARAMETER_LIST@2794..2810 + 0: JS_REST_PARAMETER@2794..2810 + 0: JS_DECORATOR_LIST@2794..2794 + 1: DOT3@2794..2797 "..." [] [] + 2: JS_IDENTIFIER_BINDING@2797..2801 + 0: IDENT@2797..2801 "args" [] [] + 3: TS_TYPE_ANNOTATION@2801..2810 + 0: COLON@2801..2803 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@2803..2810 + 0: INFER_KW@2803..2809 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@2809..2810 + 0: IDENT@2809..2810 "U" [] [] + 2: (empty) + 2: R_PAREN@2810..2812 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@2812..2815 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@2815..2818 + 0: ANY_KW@2815..2818 "any" [] [] + 2: R_PAREN@2818..2819 ")" [] [] + 3: QUESTION@2819..2826 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2826..2827 + 0: JS_REFERENCE_IDENTIFIER@2826..2827 + 0: IDENT@2826..2827 "U" [] [] + 1: (empty) + 5: COLON@2827..2834 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@2834..2835 + 0: JS_REFERENCE_IDENTIFIER@2834..2835 + 0: IDENT@2834..2835 "T" [] [] + 1: (empty) + 5: SEMICOLON@2835..2836 ";" [] [] + 4: EOF@2836..2837 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts.snap new file mode 100644 index 000000000000..1c8826a22909 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts.snap @@ -0,0 +1,221 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = A extends infer B ? B : never; +type B = A extends { a: infer U; b: infer U} ? U : never; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@9..11 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@19..25 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@25..27 "B" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@27..29 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@29..31 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@33..38 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@39..45 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@45..47 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@47..49 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@49..51 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@61..62 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@62..64 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@64..70 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@70..71 "U" [] [], + }, + constraint: missing (optional), + }, + }, + separator_token: SEMICOLON@71..73 ";" [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@73..74 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@74..76 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@76..82 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@82..83 "U" [] [], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@83..85 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@85..87 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@87..89 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@89..91 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@91..96 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@96..97 ";" [] [], + }, + ], + eof_token: EOF@97..98 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..98 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..97 + 0: TS_TYPE_ALIAS_DECLARATION@0..39 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@9..38 + 0: TS_REFERENCE_TYPE@9..11 + 0: JS_REFERENCE_IDENTIFIER@9..11 + 0: IDENT@9..11 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@19..27 + 0: INFER_KW@19..25 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@25..27 + 0: IDENT@25..27 "B" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@27..29 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@29..31 + 0: JS_REFERENCE_IDENTIFIER@29..31 + 0: IDENT@29..31 "B" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@31..33 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@33..38 + 0: NEVER_KW@33..38 "never" [] [] + 5: SEMICOLON@38..39 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@39..97 + 0: TYPE_KW@39..45 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@45..47 + 0: IDENT@45..47 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@47..49 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@49..96 + 0: TS_REFERENCE_TYPE@49..51 + 0: JS_REFERENCE_IDENTIFIER@49..51 + 0: IDENT@49..51 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@59..85 + 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@61..83 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@61..73 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@61..62 + 0: IDENT@61..62 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@62..71 + 0: COLON@62..64 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@64..71 + 0: INFER_KW@64..70 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@70..71 + 0: IDENT@70..71 "U" [] [] + 2: (empty) + 4: SEMICOLON@71..73 ";" [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@73..83 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@73..74 + 0: IDENT@73..74 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@74..83 + 0: COLON@74..76 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@76..83 + 0: INFER_KW@76..82 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@82..83 + 0: IDENT@82..83 "U" [] [] + 2: (empty) + 4: (empty) + 2: R_CURLY@83..85 "}" [] [Whitespace(" ")] + 3: QUESTION@85..87 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@87..89 + 0: JS_REFERENCE_IDENTIFIER@87..89 + 0: IDENT@87..89 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@89..91 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@91..96 + 0: NEVER_KW@91..96 "never" [] [] + 5: SEMICOLON@96..97 ";" [] [] + 4: EOF@97..98 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap new file mode 100644 index 000000000000..8406078c37c8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap @@ -0,0 +1,320 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +f?.(c); +f?.[c]; +(f).c; +(f)?.c; +(f)?.[c]; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..1 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1..2 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2..3 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@3..4 ">" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@4..6 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@6..7 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..8 "c" [] [], + }, + }, + ], + r_paren_token: R_PAREN@8..9 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..12 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@12..13 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@13..14 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@14..15 ">" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@15..17 "?." [] [], + l_brack_token: L_BRACK@17..18 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..19 "c" [] [], + }, + }, + r_brack_token: R_BRACK@19..20 "]" [] [], + }, + semicolon_token: SEMICOLON@20..21 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@21..23 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..24 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@24..25 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@25..26 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@26..27 ">" [] [], + }, + }, + r_paren_token: R_PAREN@27..28 ")" [] [], + }, + operator_token: DOT@28..29 "." [] [], + member: JsName { + value_token: IDENT@29..30 "c" [] [], + }, + }, + semicolon_token: SEMICOLON@30..31 ";" [] [], + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@31..33 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..34 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@34..35 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + }, + r_paren_token: R_PAREN@37..38 ")" [] [], + }, + operator_token: QUESTIONDOT@38..40 "?." [] [], + member: JsName { + value_token: IDENT@40..41 "c" [] [], + }, + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + JsExpressionStatement { + expression: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@42..44 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..45 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@45..46 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@46..47 "b" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@47..48 ">" [] [], + }, + }, + r_paren_token: R_PAREN@48..49 ")" [] [], + }, + optional_chain_token: QUESTIONDOT@49..51 "?." [] [], + l_brack_token: L_BRACK@51..52 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@52..53 "c" [] [], + }, + }, + r_brack_token: R_BRACK@53..54 "]" [] [], + }, + semicolon_token: SEMICOLON@54..55 ";" [] [], + }, + ], + eof_token: EOF@55..56 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..56 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..55 + 0: JS_EXPRESSION_STATEMENT@0..10 + 0: JS_CALL_EXPRESSION@0..9 + 0: TS_INSTANTIATION_EXPRESSION@0..4 + 0: JS_IDENTIFIER_EXPRESSION@0..1 + 0: JS_REFERENCE_IDENTIFIER@0..1 + 0: IDENT@0..1 "f" [] [] + 1: TS_TYPE_ARGUMENTS@1..4 + 0: L_ANGLE@1..2 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2..3 + 0: TS_REFERENCE_TYPE@2..3 + 0: JS_REFERENCE_IDENTIFIER@2..3 + 0: IDENT@2..3 "b" [] [] + 1: (empty) + 2: R_ANGLE@3..4 ">" [] [] + 1: QUESTIONDOT@4..6 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@6..9 + 0: L_PAREN@6..7 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@7..8 + 0: JS_IDENTIFIER_EXPRESSION@7..8 + 0: JS_REFERENCE_IDENTIFIER@7..8 + 0: IDENT@7..8 "c" [] [] + 2: R_PAREN@8..9 ")" [] [] + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@10..21 + 0: JS_COMPUTED_MEMBER_EXPRESSION@10..20 + 0: TS_INSTANTIATION_EXPRESSION@10..15 + 0: JS_IDENTIFIER_EXPRESSION@10..12 + 0: JS_REFERENCE_IDENTIFIER@10..12 + 0: IDENT@10..12 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@12..15 + 0: L_ANGLE@12..13 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@13..14 + 0: TS_REFERENCE_TYPE@13..14 + 0: JS_REFERENCE_IDENTIFIER@13..14 + 0: IDENT@13..14 "b" [] [] + 1: (empty) + 2: R_ANGLE@14..15 ">" [] [] + 1: QUESTIONDOT@15..17 "?." [] [] + 2: L_BRACK@17..18 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@18..19 + 0: JS_REFERENCE_IDENTIFIER@18..19 + 0: IDENT@18..19 "c" [] [] + 4: R_BRACK@19..20 "]" [] [] + 1: SEMICOLON@20..21 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@21..31 + 0: JS_STATIC_MEMBER_EXPRESSION@21..30 + 0: JS_PARENTHESIZED_EXPRESSION@21..28 + 0: L_PAREN@21..23 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@23..27 + 0: JS_IDENTIFIER_EXPRESSION@23..24 + 0: JS_REFERENCE_IDENTIFIER@23..24 + 0: IDENT@23..24 "f" [] [] + 1: TS_TYPE_ARGUMENTS@24..27 + 0: L_ANGLE@24..25 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@25..26 + 0: TS_REFERENCE_TYPE@25..26 + 0: JS_REFERENCE_IDENTIFIER@25..26 + 0: IDENT@25..26 "b" [] [] + 1: (empty) + 2: R_ANGLE@26..27 ">" [] [] + 2: R_PAREN@27..28 ")" [] [] + 1: DOT@28..29 "." [] [] + 2: JS_NAME@29..30 + 0: IDENT@29..30 "c" [] [] + 1: SEMICOLON@30..31 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@31..42 + 0: JS_STATIC_MEMBER_EXPRESSION@31..41 + 0: JS_PARENTHESIZED_EXPRESSION@31..38 + 0: L_PAREN@31..33 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@33..37 + 0: JS_IDENTIFIER_EXPRESSION@33..34 + 0: JS_REFERENCE_IDENTIFIER@33..34 + 0: IDENT@33..34 "f" [] [] + 1: TS_TYPE_ARGUMENTS@34..37 + 0: L_ANGLE@34..35 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@35..36 + 0: TS_REFERENCE_TYPE@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "b" [] [] + 1: (empty) + 2: R_ANGLE@36..37 ">" [] [] + 2: R_PAREN@37..38 ")" [] [] + 1: QUESTIONDOT@38..40 "?." [] [] + 2: JS_NAME@40..41 + 0: IDENT@40..41 "c" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@42..55 + 0: JS_COMPUTED_MEMBER_EXPRESSION@42..54 + 0: JS_PARENTHESIZED_EXPRESSION@42..49 + 0: L_PAREN@42..44 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@44..48 + 0: JS_IDENTIFIER_EXPRESSION@44..45 + 0: JS_REFERENCE_IDENTIFIER@44..45 + 0: IDENT@44..45 "f" [] [] + 1: TS_TYPE_ARGUMENTS@45..48 + 0: L_ANGLE@45..46 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@46..47 + 0: TS_REFERENCE_TYPE@46..47 + 0: JS_REFERENCE_IDENTIFIER@46..47 + 0: IDENT@46..47 "b" [] [] + 1: (empty) + 2: R_ANGLE@47..48 ">" [] [] + 2: R_PAREN@48..49 ")" [] [] + 1: QUESTIONDOT@49..51 "?." [] [] + 2: L_BRACK@51..52 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@52..53 + 0: JS_REFERENCE_IDENTIFIER@52..53 + 0: IDENT@52..53 "c" [] [] + 4: R_BRACK@53..54 "]" [] [] + 1: SEMICOLON@54..55 ";" [] [] + 4: EOF@55..56 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap new file mode 100644 index 000000000000..3d3cd773615e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap @@ -0,0 +1,1724 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let f1 = fx; +let f2 = fx; +let f3 = fx['test']; +const a2 = f.g; // () => number +const a5 = f['g']; // () => number +const a7 = (f)['g']; +const a6 = f['g']; // type Error +const b2 = f?.(); +const b3 = f?.(); +const b4 = f?.(); // Type Error, expected no type arguments +const x1 = f +(true); +const x2 = f +true; +const x3 = f; +true; +(f); +(f)(); +(f)?.(); +(a?.f)(); +new (a)(); +f<() => T>?.(); +f?.<() => T>(); +f ? g : h; +[f]; +{ f } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..7 "f1" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@9..11 "fx" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@11..12 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@12..18 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@18..19 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@19..20 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@25..28 "f2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..32 "fx" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@32..33 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@33..39 "string" [] [], + }, + COMMA@39..41 "," [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@41..47 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@47..48 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@48..49 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@54..57 "f3" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@57..59 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@59..61 "fx" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@61..62 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@62..68 "'test'" [] [], + }, + r_brack_token: R_BRACK@68..69 "]" [] [], + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@69..70 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@70..76 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@76..77 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@77..78 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@78..85 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@85..88 "a2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@88..90 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@90..91 "f" [] [], + }, + }, + operator_token: DOT@91..92 "." [] [], + member: JsName { + value_token: IDENT@92..93 "g" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@93..94 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@94..100 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@100..101 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@101..119 ";" [] [Whitespace(" "), Comments("// () => number")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@119..126 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@126..129 "a5" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@129..131 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@131..132 "f" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@132..133 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@133..136 "'g'" [] [], + }, + r_brack_token: R_BRACK@136..137 "]" [] [], + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@137..138 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@138..144 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@144..145 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@145..163 ";" [] [Whitespace(" "), Comments("// () => number")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@163..170 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@170..173 "a7" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@173..175 "=" [] [Whitespace(" ")], + expression: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@175..176 "(" [] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@176..177 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@177..178 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@178..184 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@184..185 ">" [] [], + }, + }, + r_paren_token: R_PAREN@185..186 ")" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@186..187 "[" [] [], + member: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@187..190 "'g'" [] [], + }, + r_brack_token: R_BRACK@190..191 "]" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@191..192 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@192..199 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@199..202 "a6" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@202..204 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@204..205 "f" [] [], + }, + }, + operator_token: L_ANGLE@205..206 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@206..212 "number" [] [], + }, + }, + }, + operator_token: R_ANGLE@212..213 ">" [] [], + right: JsArrayExpression { + l_brack_token: L_BRACK@213..214 "[" [] [], + elements: JsArrayElementList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@214..217 "'g'" [] [], + }, + ], + r_brack_token: R_BRACK@217..218 "]" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@218..234 ";" [] [Whitespace(" "), Comments("// type Error")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@234..241 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@241..244 "b2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@244..246 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@246..247 "f" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@247..249 "?." [] [], + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@249..250 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@250..256 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@256..257 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@257..258 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@258..259 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@259..260 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@260..267 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@267..270 "b3" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@270..272 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@272..273 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@273..274 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@274..280 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@280..281 ">" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@281..283 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@283..284 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@284..285 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@285..286 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@286..293 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@293..296 "b4" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@296..298 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@298..299 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@299..300 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@300..306 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@306..307 ">" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@307..309 "?." [] [], + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@309..310 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@310..316 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@316..317 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@317..318 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@318..319 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@319..363 ";" [] [Whitespace(" "), Comments("// Type Error, expect ...")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@363..370 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@370..373 "x1" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@373..375 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@375..376 "f" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@376..377 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@377..381 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@381..382 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@382..384 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsBooleanLiteralExpression { + value_token: TRUE_KW@384..388 "true" [] [], + }, + ], + r_paren_token: R_PAREN@388..389 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@389..390 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@390..397 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@397..400 "x2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@400..402 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@402..403 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@403..404 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@404..408 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@408..409 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@409..414 "true" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@414..415 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@415..422 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@422..425 "x3" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@425..427 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@427..428 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@428..429 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@429..433 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@433..434 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@434..435 ";" [] [], + }, + JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@435..440 "true" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@440..441 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@441..443 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@443..444 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@444..445 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@445..446 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@446..447 ">" [] [], + }, + }, + r_paren_token: R_PAREN@447..448 ")" [] [], + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@448..449 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@449..450 "K" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@450..451 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@451..452 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@452..454 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@454..455 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@455..456 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@456..457 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@457..458 ">" [] [], + }, + }, + r_paren_token: R_PAREN@458..459 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@459..460 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@460..461 "K" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@461..462 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@462..463 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@463..464 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@464..465 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: TsInstantiationExpression { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@465..467 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@467..468 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@468..469 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@469..470 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@470..471 ">" [] [], + }, + }, + r_paren_token: R_PAREN@471..472 ")" [] [], + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@472..473 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@473..474 "K" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@474..475 ">" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@475..477 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@477..478 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@478..479 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@479..480 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@480..482 "(" [Newline("\n")] [], + expression: TsInstantiationExpression { + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@482..483 "a" [] [], + }, + }, + operator_token: QUESTIONDOT@483..485 "?." [] [], + member: JsName { + value_token: IDENT@485..486 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@486..487 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@487..488 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@488..489 ">" [] [], + }, + }, + r_paren_token: R_PAREN@489..490 ")" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@490..491 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@491..492 "K" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@492..493 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@493..494 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@494..495 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@495..496 ";" [] [], + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@496..501 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@501..502 "(" [] [], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@502..503 "a" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@503..504 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@504..505 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@505..506 ">" [] [], + }, + }, + r_paren_token: R_PAREN@506..507 ")" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@507..508 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@508..509 "K" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@509..510 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@510..511 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@511..512 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@512..513 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@513..515 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@515..516 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@516..517 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@517..518 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@518..519 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@519..520 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@520..522 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")], + return_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@525..526 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + ], + r_angle_token: R_ANGLE@526..527 ">" [] [], + }, + }, + optional_chain_token: QUESTIONDOT@527..529 "?." [] [], + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@529..530 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@530..531 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@531..532 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@532..534 "f" [Newline("\n")] [], + }, + }, + optional_chain_token: QUESTIONDOT@534..536 "?." [] [], + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@536..537 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@537..538 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@538..539 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@539..540 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@540..541 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@541..543 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@543..546 "=>" [] [Whitespace(" ")], + return_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@546..547 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + ], + r_angle_token: R_ANGLE@547..548 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@548..549 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@549..550 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@550..551 ";" [] [], + }, + JsExpressionStatement { + expression: JsConditionalExpression { + test: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@551..553 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@553..554 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@554..555 "x" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@555..557 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@557..559 "?" [] [Whitespace(" ")], + consequent: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@559..560 "g" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@560..561 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@561..562 "y" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@562..564 ">" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@564..566 ":" [] [Whitespace(" ")], + alternate: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@566..567 "h" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@567..568 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@568..569 "z" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@569..570 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@570..571 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrayExpression { + l_brack_token: L_BRACK@571..573 "[" [Newline("\n")] [], + elements: JsArrayElementList [ + TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@573..574 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@574..575 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@575..576 "x" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@576..577 ">" [] [], + }, + }, + ], + r_brack_token: R_BRACK@577..578 "]" [] [], + }, + semicolon_token: SEMICOLON@578..579 ";" [] [], + }, + JsBlockStatement { + l_curly_token: L_CURLY@579..582 "{" [Newline("\n")] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@582..583 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@583..584 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@584..585 "x" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@585..587 ">" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@587..588 "}" [] [], + }, + ], + eof_token: EOF@588..589 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..589 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..588 + 0: JS_VARIABLE_STATEMENT@0..20 + 0: JS_VARIABLE_DECLARATION@0..19 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..19 + 0: JS_VARIABLE_DECLARATOR@4..19 + 0: JS_IDENTIFIER_BINDING@4..7 + 0: IDENT@4..7 "f1" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@7..19 + 0: EQ@7..9 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@9..19 + 0: JS_IDENTIFIER_EXPRESSION@9..11 + 0: JS_REFERENCE_IDENTIFIER@9..11 + 0: IDENT@9..11 "fx" [] [] + 1: TS_TYPE_ARGUMENTS@11..19 + 0: L_ANGLE@11..12 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@12..18 + 0: TS_STRING_TYPE@12..18 + 0: STRING_KW@12..18 "string" [] [] + 2: R_ANGLE@18..19 ">" [] [] + 1: SEMICOLON@19..20 ";" [] [] + 1: JS_VARIABLE_STATEMENT@20..49 + 0: JS_VARIABLE_DECLARATION@20..48 + 0: (empty) + 1: LET_KW@20..25 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@25..48 + 0: JS_VARIABLE_DECLARATOR@25..48 + 0: JS_IDENTIFIER_BINDING@25..28 + 0: IDENT@25..28 "f2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@28..48 + 0: EQ@28..30 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@30..48 + 0: JS_IDENTIFIER_EXPRESSION@30..32 + 0: JS_REFERENCE_IDENTIFIER@30..32 + 0: IDENT@30..32 "fx" [] [] + 1: TS_TYPE_ARGUMENTS@32..48 + 0: L_ANGLE@32..33 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@33..47 + 0: TS_STRING_TYPE@33..39 + 0: STRING_KW@33..39 "string" [] [] + 1: COMMA@39..41 "," [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@41..47 + 0: NUMBER_KW@41..47 "number" [] [] + 2: R_ANGLE@47..48 ">" [] [] + 1: SEMICOLON@48..49 ";" [] [] + 2: JS_VARIABLE_STATEMENT@49..78 + 0: JS_VARIABLE_DECLARATION@49..77 + 0: (empty) + 1: LET_KW@49..54 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@54..77 + 0: JS_VARIABLE_DECLARATOR@54..77 + 0: JS_IDENTIFIER_BINDING@54..57 + 0: IDENT@54..57 "f3" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@57..77 + 0: EQ@57..59 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@59..77 + 0: JS_COMPUTED_MEMBER_EXPRESSION@59..69 + 0: JS_IDENTIFIER_EXPRESSION@59..61 + 0: JS_REFERENCE_IDENTIFIER@59..61 + 0: IDENT@59..61 "fx" [] [] + 1: (empty) + 2: L_BRACK@61..62 "[" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@62..68 + 0: JS_STRING_LITERAL@62..68 "'test'" [] [] + 4: R_BRACK@68..69 "]" [] [] + 1: TS_TYPE_ARGUMENTS@69..77 + 0: L_ANGLE@69..70 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@70..76 + 0: TS_STRING_TYPE@70..76 + 0: STRING_KW@70..76 "string" [] [] + 2: R_ANGLE@76..77 ">" [] [] + 1: SEMICOLON@77..78 ";" [] [] + 3: JS_VARIABLE_STATEMENT@78..119 + 0: JS_VARIABLE_DECLARATION@78..101 + 0: (empty) + 1: CONST_KW@78..85 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@85..101 + 0: JS_VARIABLE_DECLARATOR@85..101 + 0: JS_IDENTIFIER_BINDING@85..88 + 0: IDENT@85..88 "a2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@88..101 + 0: EQ@88..90 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@90..101 + 0: JS_STATIC_MEMBER_EXPRESSION@90..93 + 0: JS_IDENTIFIER_EXPRESSION@90..91 + 0: JS_REFERENCE_IDENTIFIER@90..91 + 0: IDENT@90..91 "f" [] [] + 1: DOT@91..92 "." [] [] + 2: JS_NAME@92..93 + 0: IDENT@92..93 "g" [] [] + 1: TS_TYPE_ARGUMENTS@93..101 + 0: L_ANGLE@93..94 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@94..100 + 0: TS_NUMBER_TYPE@94..100 + 0: NUMBER_KW@94..100 "number" [] [] + 2: R_ANGLE@100..101 ">" [] [] + 1: SEMICOLON@101..119 ";" [] [Whitespace(" "), Comments("// () => number")] + 4: JS_VARIABLE_STATEMENT@119..163 + 0: JS_VARIABLE_DECLARATION@119..145 + 0: (empty) + 1: CONST_KW@119..126 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@126..145 + 0: JS_VARIABLE_DECLARATOR@126..145 + 0: JS_IDENTIFIER_BINDING@126..129 + 0: IDENT@126..129 "a5" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@129..145 + 0: EQ@129..131 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@131..145 + 0: JS_COMPUTED_MEMBER_EXPRESSION@131..137 + 0: JS_IDENTIFIER_EXPRESSION@131..132 + 0: JS_REFERENCE_IDENTIFIER@131..132 + 0: IDENT@131..132 "f" [] [] + 1: (empty) + 2: L_BRACK@132..133 "[" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@133..136 + 0: JS_STRING_LITERAL@133..136 "'g'" [] [] + 4: R_BRACK@136..137 "]" [] [] + 1: TS_TYPE_ARGUMENTS@137..145 + 0: L_ANGLE@137..138 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@138..144 + 0: TS_NUMBER_TYPE@138..144 + 0: NUMBER_KW@138..144 "number" [] [] + 2: R_ANGLE@144..145 ">" [] [] + 1: SEMICOLON@145..163 ";" [] [Whitespace(" "), Comments("// () => number")] + 5: JS_VARIABLE_STATEMENT@163..192 + 0: JS_VARIABLE_DECLARATION@163..191 + 0: (empty) + 1: CONST_KW@163..170 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@170..191 + 0: JS_VARIABLE_DECLARATOR@170..191 + 0: JS_IDENTIFIER_BINDING@170..173 + 0: IDENT@170..173 "a7" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@173..191 + 0: EQ@173..175 "=" [] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@175..191 + 0: JS_PARENTHESIZED_EXPRESSION@175..186 + 0: L_PAREN@175..176 "(" [] [] + 1: TS_INSTANTIATION_EXPRESSION@176..185 + 0: JS_IDENTIFIER_EXPRESSION@176..177 + 0: JS_REFERENCE_IDENTIFIER@176..177 + 0: IDENT@176..177 "f" [] [] + 1: TS_TYPE_ARGUMENTS@177..185 + 0: L_ANGLE@177..178 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@178..184 + 0: TS_NUMBER_TYPE@178..184 + 0: NUMBER_KW@178..184 "number" [] [] + 2: R_ANGLE@184..185 ">" [] [] + 2: R_PAREN@185..186 ")" [] [] + 1: (empty) + 2: L_BRACK@186..187 "[" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@187..190 + 0: JS_STRING_LITERAL@187..190 "'g'" [] [] + 4: R_BRACK@190..191 "]" [] [] + 1: SEMICOLON@191..192 ";" [] [] + 6: JS_VARIABLE_STATEMENT@192..234 + 0: JS_VARIABLE_DECLARATION@192..218 + 0: (empty) + 1: CONST_KW@192..199 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@199..218 + 0: JS_VARIABLE_DECLARATOR@199..218 + 0: JS_IDENTIFIER_BINDING@199..202 + 0: IDENT@199..202 "a6" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@202..218 + 0: EQ@202..204 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@204..218 + 0: JS_BINARY_EXPRESSION@204..212 + 0: JS_IDENTIFIER_EXPRESSION@204..205 + 0: JS_REFERENCE_IDENTIFIER@204..205 + 0: IDENT@204..205 "f" [] [] + 1: L_ANGLE@205..206 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@206..212 + 0: JS_REFERENCE_IDENTIFIER@206..212 + 0: IDENT@206..212 "number" [] [] + 1: R_ANGLE@212..213 ">" [] [] + 2: JS_ARRAY_EXPRESSION@213..218 + 0: L_BRACK@213..214 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@214..217 + 0: JS_STRING_LITERAL_EXPRESSION@214..217 + 0: JS_STRING_LITERAL@214..217 "'g'" [] [] + 2: R_BRACK@217..218 "]" [] [] + 1: SEMICOLON@218..234 ";" [] [Whitespace(" "), Comments("// type Error")] + 7: JS_VARIABLE_STATEMENT@234..260 + 0: JS_VARIABLE_DECLARATION@234..259 + 0: (empty) + 1: CONST_KW@234..241 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@241..259 + 0: JS_VARIABLE_DECLARATOR@241..259 + 0: JS_IDENTIFIER_BINDING@241..244 + 0: IDENT@241..244 "b2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@244..259 + 0: EQ@244..246 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@246..259 + 0: JS_IDENTIFIER_EXPRESSION@246..247 + 0: JS_REFERENCE_IDENTIFIER@246..247 + 0: IDENT@246..247 "f" [] [] + 1: QUESTIONDOT@247..249 "?." [] [] + 2: TS_TYPE_ARGUMENTS@249..257 + 0: L_ANGLE@249..250 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@250..256 + 0: TS_NUMBER_TYPE@250..256 + 0: NUMBER_KW@250..256 "number" [] [] + 2: R_ANGLE@256..257 ">" [] [] + 3: JS_CALL_ARGUMENTS@257..259 + 0: L_PAREN@257..258 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@258..258 + 2: R_PAREN@258..259 ")" [] [] + 1: SEMICOLON@259..260 ";" [] [] + 8: JS_VARIABLE_STATEMENT@260..286 + 0: JS_VARIABLE_DECLARATION@260..285 + 0: (empty) + 1: CONST_KW@260..267 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@267..285 + 0: JS_VARIABLE_DECLARATOR@267..285 + 0: JS_IDENTIFIER_BINDING@267..270 + 0: IDENT@267..270 "b3" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@270..285 + 0: EQ@270..272 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@272..285 + 0: TS_INSTANTIATION_EXPRESSION@272..281 + 0: JS_IDENTIFIER_EXPRESSION@272..273 + 0: JS_REFERENCE_IDENTIFIER@272..273 + 0: IDENT@272..273 "f" [] [] + 1: TS_TYPE_ARGUMENTS@273..281 + 0: L_ANGLE@273..274 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@274..280 + 0: TS_NUMBER_TYPE@274..280 + 0: NUMBER_KW@274..280 "number" [] [] + 2: R_ANGLE@280..281 ">" [] [] + 1: QUESTIONDOT@281..283 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@283..285 + 0: L_PAREN@283..284 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@284..284 + 2: R_PAREN@284..285 ")" [] [] + 1: SEMICOLON@285..286 ";" [] [] + 9: JS_VARIABLE_STATEMENT@286..363 + 0: JS_VARIABLE_DECLARATION@286..319 + 0: (empty) + 1: CONST_KW@286..293 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@293..319 + 0: JS_VARIABLE_DECLARATOR@293..319 + 0: JS_IDENTIFIER_BINDING@293..296 + 0: IDENT@293..296 "b4" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@296..319 + 0: EQ@296..298 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@298..319 + 0: TS_INSTANTIATION_EXPRESSION@298..307 + 0: JS_IDENTIFIER_EXPRESSION@298..299 + 0: JS_REFERENCE_IDENTIFIER@298..299 + 0: IDENT@298..299 "f" [] [] + 1: TS_TYPE_ARGUMENTS@299..307 + 0: L_ANGLE@299..300 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@300..306 + 0: TS_NUMBER_TYPE@300..306 + 0: NUMBER_KW@300..306 "number" [] [] + 2: R_ANGLE@306..307 ">" [] [] + 1: QUESTIONDOT@307..309 "?." [] [] + 2: TS_TYPE_ARGUMENTS@309..317 + 0: L_ANGLE@309..310 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@310..316 + 0: TS_NUMBER_TYPE@310..316 + 0: NUMBER_KW@310..316 "number" [] [] + 2: R_ANGLE@316..317 ">" [] [] + 3: JS_CALL_ARGUMENTS@317..319 + 0: L_PAREN@317..318 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@318..318 + 2: R_PAREN@318..319 ")" [] [] + 1: SEMICOLON@319..363 ";" [] [Whitespace(" "), Comments("// Type Error, expect ...")] + 10: JS_VARIABLE_STATEMENT@363..390 + 0: JS_VARIABLE_DECLARATION@363..389 + 0: (empty) + 1: CONST_KW@363..370 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@370..389 + 0: JS_VARIABLE_DECLARATOR@370..389 + 0: JS_IDENTIFIER_BINDING@370..373 + 0: IDENT@370..373 "x1" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@373..389 + 0: EQ@373..375 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@375..389 + 0: JS_IDENTIFIER_EXPRESSION@375..376 + 0: JS_REFERENCE_IDENTIFIER@375..376 + 0: IDENT@375..376 "f" [] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@376..382 + 0: L_ANGLE@376..377 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@377..381 + 0: TS_BOOLEAN_LITERAL_TYPE@377..381 + 0: TRUE_KW@377..381 "true" [] [] + 2: R_ANGLE@381..382 ">" [] [] + 3: JS_CALL_ARGUMENTS@382..389 + 0: L_PAREN@382..384 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@384..388 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@384..388 + 0: TRUE_KW@384..388 "true" [] [] + 2: R_PAREN@388..389 ")" [] [] + 1: SEMICOLON@389..390 ";" [] [] + 11: JS_VARIABLE_STATEMENT@390..409 + 0: JS_VARIABLE_DECLARATION@390..409 + 0: (empty) + 1: CONST_KW@390..397 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@397..409 + 0: JS_VARIABLE_DECLARATOR@397..409 + 0: JS_IDENTIFIER_BINDING@397..400 + 0: IDENT@397..400 "x2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@400..409 + 0: EQ@400..402 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@402..409 + 0: JS_IDENTIFIER_EXPRESSION@402..403 + 0: JS_REFERENCE_IDENTIFIER@402..403 + 0: IDENT@402..403 "f" [] [] + 1: TS_TYPE_ARGUMENTS@403..409 + 0: L_ANGLE@403..404 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@404..408 + 0: TS_BOOLEAN_LITERAL_TYPE@404..408 + 0: TRUE_KW@404..408 "true" [] [] + 2: R_ANGLE@408..409 ">" [] [] + 1: (empty) + 12: JS_EXPRESSION_STATEMENT@409..415 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@409..414 + 0: TRUE_KW@409..414 "true" [Newline("\n")] [] + 1: SEMICOLON@414..415 ";" [] [] + 13: JS_VARIABLE_STATEMENT@415..435 + 0: JS_VARIABLE_DECLARATION@415..434 + 0: (empty) + 1: CONST_KW@415..422 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@422..434 + 0: JS_VARIABLE_DECLARATOR@422..434 + 0: JS_IDENTIFIER_BINDING@422..425 + 0: IDENT@422..425 "x3" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@425..434 + 0: EQ@425..427 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@427..434 + 0: JS_IDENTIFIER_EXPRESSION@427..428 + 0: JS_REFERENCE_IDENTIFIER@427..428 + 0: IDENT@427..428 "f" [] [] + 1: TS_TYPE_ARGUMENTS@428..434 + 0: L_ANGLE@428..429 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@429..433 + 0: TS_BOOLEAN_LITERAL_TYPE@429..433 + 0: TRUE_KW@429..433 "true" [] [] + 2: R_ANGLE@433..434 ">" [] [] + 1: SEMICOLON@434..435 ";" [] [] + 14: JS_EXPRESSION_STATEMENT@435..441 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@435..440 + 0: TRUE_KW@435..440 "true" [Newline("\n")] [] + 1: SEMICOLON@440..441 ";" [] [] + 15: JS_EXPRESSION_STATEMENT@441..452 + 0: TS_INSTANTIATION_EXPRESSION@441..451 + 0: JS_PARENTHESIZED_EXPRESSION@441..448 + 0: L_PAREN@441..443 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@443..447 + 0: JS_IDENTIFIER_EXPRESSION@443..444 + 0: JS_REFERENCE_IDENTIFIER@443..444 + 0: IDENT@443..444 "f" [] [] + 1: TS_TYPE_ARGUMENTS@444..447 + 0: L_ANGLE@444..445 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@445..446 + 0: TS_REFERENCE_TYPE@445..446 + 0: JS_REFERENCE_IDENTIFIER@445..446 + 0: IDENT@445..446 "T" [] [] + 1: (empty) + 2: R_ANGLE@446..447 ">" [] [] + 2: R_PAREN@447..448 ")" [] [] + 1: TS_TYPE_ARGUMENTS@448..451 + 0: L_ANGLE@448..449 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@449..450 + 0: TS_REFERENCE_TYPE@449..450 + 0: JS_REFERENCE_IDENTIFIER@449..450 + 0: IDENT@449..450 "K" [] [] + 1: (empty) + 2: R_ANGLE@450..451 ">" [] [] + 1: SEMICOLON@451..452 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@452..465 + 0: JS_CALL_EXPRESSION@452..464 + 0: JS_PARENTHESIZED_EXPRESSION@452..459 + 0: L_PAREN@452..454 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@454..458 + 0: JS_IDENTIFIER_EXPRESSION@454..455 + 0: JS_REFERENCE_IDENTIFIER@454..455 + 0: IDENT@454..455 "f" [] [] + 1: TS_TYPE_ARGUMENTS@455..458 + 0: L_ANGLE@455..456 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@456..457 + 0: TS_REFERENCE_TYPE@456..457 + 0: JS_REFERENCE_IDENTIFIER@456..457 + 0: IDENT@456..457 "T" [] [] + 1: (empty) + 2: R_ANGLE@457..458 ">" [] [] + 2: R_PAREN@458..459 ")" [] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@459..462 + 0: L_ANGLE@459..460 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@460..461 + 0: TS_REFERENCE_TYPE@460..461 + 0: JS_REFERENCE_IDENTIFIER@460..461 + 0: IDENT@460..461 "K" [] [] + 1: (empty) + 2: R_ANGLE@461..462 ">" [] [] + 3: JS_CALL_ARGUMENTS@462..464 + 0: L_PAREN@462..463 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@463..463 + 2: R_PAREN@463..464 ")" [] [] + 1: SEMICOLON@464..465 ";" [] [] + 17: JS_EXPRESSION_STATEMENT@465..480 + 0: JS_CALL_EXPRESSION@465..479 + 0: TS_INSTANTIATION_EXPRESSION@465..475 + 0: JS_PARENTHESIZED_EXPRESSION@465..472 + 0: L_PAREN@465..467 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@467..471 + 0: JS_IDENTIFIER_EXPRESSION@467..468 + 0: JS_REFERENCE_IDENTIFIER@467..468 + 0: IDENT@467..468 "f" [] [] + 1: TS_TYPE_ARGUMENTS@468..471 + 0: L_ANGLE@468..469 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@469..470 + 0: TS_REFERENCE_TYPE@469..470 + 0: JS_REFERENCE_IDENTIFIER@469..470 + 0: IDENT@469..470 "T" [] [] + 1: (empty) + 2: R_ANGLE@470..471 ">" [] [] + 2: R_PAREN@471..472 ")" [] [] + 1: TS_TYPE_ARGUMENTS@472..475 + 0: L_ANGLE@472..473 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@473..474 + 0: TS_REFERENCE_TYPE@473..474 + 0: JS_REFERENCE_IDENTIFIER@473..474 + 0: IDENT@473..474 "K" [] [] + 1: (empty) + 2: R_ANGLE@474..475 ">" [] [] + 1: QUESTIONDOT@475..477 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@477..479 + 0: L_PAREN@477..478 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@478..478 + 2: R_PAREN@478..479 ")" [] [] + 1: SEMICOLON@479..480 ";" [] [] + 18: JS_EXPRESSION_STATEMENT@480..496 + 0: JS_CALL_EXPRESSION@480..495 + 0: JS_PARENTHESIZED_EXPRESSION@480..490 + 0: L_PAREN@480..482 "(" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@482..489 + 0: JS_STATIC_MEMBER_EXPRESSION@482..486 + 0: JS_IDENTIFIER_EXPRESSION@482..483 + 0: JS_REFERENCE_IDENTIFIER@482..483 + 0: IDENT@482..483 "a" [] [] + 1: QUESTIONDOT@483..485 "?." [] [] + 2: JS_NAME@485..486 + 0: IDENT@485..486 "f" [] [] + 1: TS_TYPE_ARGUMENTS@486..489 + 0: L_ANGLE@486..487 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@487..488 + 0: TS_REFERENCE_TYPE@487..488 + 0: JS_REFERENCE_IDENTIFIER@487..488 + 0: IDENT@487..488 "T" [] [] + 1: (empty) + 2: R_ANGLE@488..489 ">" [] [] + 2: R_PAREN@489..490 ")" [] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@490..493 + 0: L_ANGLE@490..491 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@491..492 + 0: TS_REFERENCE_TYPE@491..492 + 0: JS_REFERENCE_IDENTIFIER@491..492 + 0: IDENT@491..492 "K" [] [] + 1: (empty) + 2: R_ANGLE@492..493 ">" [] [] + 3: JS_CALL_ARGUMENTS@493..495 + 0: L_PAREN@493..494 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@494..494 + 2: R_PAREN@494..495 ")" [] [] + 1: SEMICOLON@495..496 ";" [] [] + 19: JS_EXPRESSION_STATEMENT@496..513 + 0: JS_NEW_EXPRESSION@496..512 + 0: NEW_KW@496..501 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@501..507 + 0: L_PAREN@501..502 "(" [] [] + 1: TS_INSTANTIATION_EXPRESSION@502..506 + 0: JS_IDENTIFIER_EXPRESSION@502..503 + 0: JS_REFERENCE_IDENTIFIER@502..503 + 0: IDENT@502..503 "a" [] [] + 1: TS_TYPE_ARGUMENTS@503..506 + 0: L_ANGLE@503..504 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@504..505 + 0: TS_REFERENCE_TYPE@504..505 + 0: JS_REFERENCE_IDENTIFIER@504..505 + 0: IDENT@504..505 "T" [] [] + 1: (empty) + 2: R_ANGLE@505..506 ">" [] [] + 2: R_PAREN@506..507 ")" [] [] + 2: TS_TYPE_ARGUMENTS@507..510 + 0: L_ANGLE@507..508 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@508..509 + 0: TS_REFERENCE_TYPE@508..509 + 0: JS_REFERENCE_IDENTIFIER@508..509 + 0: IDENT@508..509 "K" [] [] + 1: (empty) + 2: R_ANGLE@509..510 ">" [] [] + 3: JS_CALL_ARGUMENTS@510..512 + 0: L_PAREN@510..511 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@511..511 + 2: R_PAREN@511..512 ")" [] [] + 1: SEMICOLON@512..513 ";" [] [] + 20: JS_EXPRESSION_STATEMENT@513..532 + 0: JS_CALL_EXPRESSION@513..531 + 0: TS_INSTANTIATION_EXPRESSION@513..527 + 0: JS_IDENTIFIER_EXPRESSION@513..515 + 0: JS_REFERENCE_IDENTIFIER@513..515 + 0: IDENT@513..515 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@515..527 + 0: L_ANGLE@515..516 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@516..526 + 0: TS_FUNCTION_TYPE@516..526 + 0: TS_TYPE_PARAMETERS@516..519 + 0: L_ANGLE@516..517 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@517..518 + 0: TS_TYPE_PARAMETER@517..518 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@517..517 + 1: TS_TYPE_PARAMETER_NAME@517..518 + 0: IDENT@517..518 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@518..519 ">" [] [] + 1: JS_PARAMETERS@519..522 + 0: L_PAREN@519..520 "(" [] [] + 1: JS_PARAMETER_LIST@520..520 + 2: R_PAREN@520..522 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@522..525 "=>" [] [Whitespace(" ")] + 3: TS_REFERENCE_TYPE@525..526 + 0: JS_REFERENCE_IDENTIFIER@525..526 + 0: IDENT@525..526 "T" [] [] + 1: (empty) + 2: R_ANGLE@526..527 ">" [] [] + 1: QUESTIONDOT@527..529 "?." [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@529..531 + 0: L_PAREN@529..530 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@530..530 + 2: R_PAREN@530..531 ")" [] [] + 1: SEMICOLON@531..532 ";" [] [] + 21: JS_EXPRESSION_STATEMENT@532..551 + 0: JS_CALL_EXPRESSION@532..550 + 0: JS_IDENTIFIER_EXPRESSION@532..534 + 0: JS_REFERENCE_IDENTIFIER@532..534 + 0: IDENT@532..534 "f" [Newline("\n")] [] + 1: QUESTIONDOT@534..536 "?." [] [] + 2: TS_TYPE_ARGUMENTS@536..548 + 0: L_ANGLE@536..537 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@537..547 + 0: TS_FUNCTION_TYPE@537..547 + 0: TS_TYPE_PARAMETERS@537..540 + 0: L_ANGLE@537..538 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@538..539 + 0: TS_TYPE_PARAMETER@538..539 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@538..538 + 1: TS_TYPE_PARAMETER_NAME@538..539 + 0: IDENT@538..539 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@539..540 ">" [] [] + 1: JS_PARAMETERS@540..543 + 0: L_PAREN@540..541 "(" [] [] + 1: JS_PARAMETER_LIST@541..541 + 2: R_PAREN@541..543 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@543..546 "=>" [] [Whitespace(" ")] + 3: TS_REFERENCE_TYPE@546..547 + 0: JS_REFERENCE_IDENTIFIER@546..547 + 0: IDENT@546..547 "T" [] [] + 1: (empty) + 2: R_ANGLE@547..548 ">" [] [] + 3: JS_CALL_ARGUMENTS@548..550 + 0: L_PAREN@548..549 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@549..549 + 2: R_PAREN@549..550 ")" [] [] + 1: SEMICOLON@550..551 ";" [] [] + 22: JS_EXPRESSION_STATEMENT@551..571 + 0: JS_CONDITIONAL_EXPRESSION@551..570 + 0: TS_INSTANTIATION_EXPRESSION@551..557 + 0: JS_IDENTIFIER_EXPRESSION@551..553 + 0: JS_REFERENCE_IDENTIFIER@551..553 + 0: IDENT@551..553 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@553..557 + 0: L_ANGLE@553..554 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@554..555 + 0: TS_REFERENCE_TYPE@554..555 + 0: JS_REFERENCE_IDENTIFIER@554..555 + 0: IDENT@554..555 "x" [] [] + 1: (empty) + 2: R_ANGLE@555..557 ">" [] [Whitespace(" ")] + 1: QUESTION@557..559 "?" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@559..564 + 0: JS_IDENTIFIER_EXPRESSION@559..560 + 0: JS_REFERENCE_IDENTIFIER@559..560 + 0: IDENT@559..560 "g" [] [] + 1: TS_TYPE_ARGUMENTS@560..564 + 0: L_ANGLE@560..561 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@561..562 + 0: TS_REFERENCE_TYPE@561..562 + 0: JS_REFERENCE_IDENTIFIER@561..562 + 0: IDENT@561..562 "y" [] [] + 1: (empty) + 2: R_ANGLE@562..564 ">" [] [Whitespace(" ")] + 3: COLON@564..566 ":" [] [Whitespace(" ")] + 4: TS_INSTANTIATION_EXPRESSION@566..570 + 0: JS_IDENTIFIER_EXPRESSION@566..567 + 0: JS_REFERENCE_IDENTIFIER@566..567 + 0: IDENT@566..567 "h" [] [] + 1: TS_TYPE_ARGUMENTS@567..570 + 0: L_ANGLE@567..568 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@568..569 + 0: TS_REFERENCE_TYPE@568..569 + 0: JS_REFERENCE_IDENTIFIER@568..569 + 0: IDENT@568..569 "z" [] [] + 1: (empty) + 2: R_ANGLE@569..570 ">" [] [] + 1: SEMICOLON@570..571 ";" [] [] + 23: JS_EXPRESSION_STATEMENT@571..579 + 0: JS_ARRAY_EXPRESSION@571..578 + 0: L_BRACK@571..573 "[" [Newline("\n")] [] + 1: JS_ARRAY_ELEMENT_LIST@573..577 + 0: TS_INSTANTIATION_EXPRESSION@573..577 + 0: JS_IDENTIFIER_EXPRESSION@573..574 + 0: JS_REFERENCE_IDENTIFIER@573..574 + 0: IDENT@573..574 "f" [] [] + 1: TS_TYPE_ARGUMENTS@574..577 + 0: L_ANGLE@574..575 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@575..576 + 0: TS_REFERENCE_TYPE@575..576 + 0: JS_REFERENCE_IDENTIFIER@575..576 + 0: IDENT@575..576 "x" [] [] + 1: (empty) + 2: R_ANGLE@576..577 ">" [] [] + 2: R_BRACK@577..578 "]" [] [] + 1: SEMICOLON@578..579 ";" [] [] + 24: JS_BLOCK_STATEMENT@579..588 + 0: L_CURLY@579..582 "{" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATEMENT_LIST@582..587 + 0: JS_EXPRESSION_STATEMENT@582..587 + 0: TS_INSTANTIATION_EXPRESSION@582..587 + 0: JS_IDENTIFIER_EXPRESSION@582..583 + 0: JS_REFERENCE_IDENTIFIER@582..583 + 0: IDENT@582..583 "f" [] [] + 1: TS_TYPE_ARGUMENTS@583..587 + 0: L_ANGLE@583..584 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@584..585 + 0: TS_REFERENCE_TYPE@584..585 + 0: JS_REFERENCE_IDENTIFIER@584..585 + 0: IDENT@584..585 "x" [] [] + 1: (empty) + 2: R_ANGLE@585..587 ">" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@587..588 "}" [] [] + 4: EOF@588..589 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap new file mode 100644 index 000000000000..55a6d759b164 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap @@ -0,0 +1,2737 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + constructor() { + f super(); + } +} +f``; +f(1); +f ?? 1; +f || 1; +f && 1; +f | 1; +f ^ 1; +f & 1; +f == f; +f != f; +f === f; +f !== f; +f <= f; +f instanceof f; +f in {}; +f as {}; +f satisfies {}; +f * f; +f / f; +f % f; +f ** f; +f < T > +f; +f < T > -f; +f < T > this; +f < T > null; +f < T > true; +f < T > false; +f < T > 1; +f < T > 123n; +f < T > []; +f < T > {}; +f < T > function test() {}; +f < T > class A {}; +f < T > new A(); +f / 1; +f < T > +1; +f < T > -1; +f < T > ~1; +f < T > !1; +f < T > someIdentifier; +f < T > delete a[field]; +f < T > typeof MyClass; +f < T > void a; +f <= 1; +f < T > (await 1); +f < T > import.meta; +f < T > import("123"); +a < b >> c; +f = h >>> 0 < j >>> 0; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [], + }, + }, + operator_token: L_ANGLE@31..32 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..33 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@33..35 ">" [] [Whitespace(" ")], + right: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@35..40 "super" [] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@40..41 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@41..42 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + ], + r_curly_token: R_CURLY@43..46 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@46..48 "}" [Newline("\n")] [], + }, + JsExpressionStatement { + expression: JsTemplateExpression { + tag: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@48..50 "f" [Newline("\n")] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@50..51 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@51..71 "TemplateStringsArray" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@71..72 ">" [] [], + }, + l_tick_token: BACKTICK@72..73 "`" [] [], + elements: JsTemplateElementList [], + r_tick_token: BACKTICK@73..74 "`" [] [], + }, + semicolon_token: SEMICOLON@74..75 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@75..77 "f" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@77..78 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@78..79 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@79..80 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@80..81 "(" [] [], + args: JsCallArgumentList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@81..82 "1" [] [], + }, + ], + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..86 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@86..87 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@87..88 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@88..90 ">" [] [Whitespace(" ")], + }, + }, + operator_token: QUESTION2@90..93 "??" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@93..94 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@94..95 ";" [] [], + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@95..97 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@97..98 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@98..99 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@99..101 ">" [] [Whitespace(" ")], + }, + }, + operator_token: PIPE2@101..104 "||" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@104..105 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@105..106 ";" [] [], + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@106..108 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@108..109 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@109..110 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@110..112 ">" [] [Whitespace(" ")], + }, + }, + operator_token: AMP2@112..115 "&&" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@115..116 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@116..117 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@117..119 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@119..120 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@120..121 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@121..123 ">" [] [Whitespace(" ")], + }, + }, + operator_token: PIPE@123..125 "|" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@125..126 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@126..127 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@127..129 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@129..130 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@130..131 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@131..133 ">" [] [Whitespace(" ")], + }, + }, + operator_token: CARET@133..135 "^" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@135..136 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@136..137 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@137..139 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@139..140 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@140..141 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@141..143 ">" [] [Whitespace(" ")], + }, + }, + operator_token: AMP@143..145 "&" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@145..146 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@146..147 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@147..149 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@149..150 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@150..151 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@151..153 ">" [] [Whitespace(" ")], + }, + }, + operator_token: EQ2@153..156 "==" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@156..157 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@157..158 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@158..159 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@159..160 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@160..161 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@161..163 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@163..164 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@164..165 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@165..167 ">" [] [Whitespace(" ")], + }, + }, + operator_token: NEQ@167..170 "!=" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@170..171 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@171..172 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@172..173 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@173..174 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@174..175 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@175..177 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@177..178 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@178..179 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@179..181 ">" [] [Whitespace(" ")], + }, + }, + operator_token: EQ3@181..185 "===" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@185..186 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@186..187 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@187..188 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@188..189 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@189..190 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@190..192 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@192..193 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@193..194 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@194..196 ">" [] [Whitespace(" ")], + }, + }, + operator_token: NEQ2@196..200 "!==" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@200..201 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@201..202 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@202..203 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@203..204 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@204..205 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@205..207 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@207..208 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@208..209 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@209..211 ">" [] [Whitespace(" ")], + }, + }, + operator_token: LTEQ@211..214 "<=" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@214..215 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@215..216 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@216..217 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@217..218 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@218..219 ";" [] [], + }, + JsExpressionStatement { + expression: JsInstanceofExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@219..221 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@221..222 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@222..223 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@223..225 ">" [] [Whitespace(" ")], + }, + }, + instanceof_token: INSTANCEOF_KW@225..236 "instanceof" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@236..237 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@237..238 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@238..239 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@239..240 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@240..241 ";" [] [], + }, + JsExpressionStatement { + expression: JsInExpression { + property: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@241..243 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@243..244 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@244..245 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@245..247 ">" [] [Whitespace(" ")], + }, + }, + in_token: IN_KW@247..250 "in" [] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@250..251 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@251..252 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@252..253 ";" [] [], + }, + JsExpressionStatement { + expression: TsAsExpression { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@253..255 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@255..256 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@256..257 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@257..259 ">" [] [Whitespace(" ")], + }, + }, + as_token: AS_KW@259..262 "as" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@262..263 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@263..264 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@264..265 ";" [] [], + }, + JsExpressionStatement { + expression: TsSatisfiesExpression { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@265..267 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@267..268 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@268..269 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@269..271 ">" [] [Whitespace(" ")], + }, + }, + satisfies_token: SATISFIES_KW@271..281 "satisfies" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@281..282 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@282..283 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@283..284 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@284..286 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@286..287 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@287..288 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@288..290 ">" [] [Whitespace(" ")], + }, + }, + operator_token: STAR@290..292 "*" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@292..293 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@293..294 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@294..295 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@295..296 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@296..297 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@297..299 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@299..300 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@300..301 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@301..303 ">" [] [Whitespace(" ")], + }, + }, + operator_token: SLASH@303..305 "/" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@305..306 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@306..307 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@307..308 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@308..309 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@309..310 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@310..312 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@312..313 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@313..314 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@314..316 ">" [] [Whitespace(" ")], + }, + }, + operator_token: PERCENT@316..318 "%" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@318..319 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@319..320 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@320..321 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@321..322 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@322..323 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@323..325 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@325..326 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@326..327 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@327..329 ">" [] [Whitespace(" ")], + }, + }, + operator_token: STAR2@329..332 "**" [] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@332..333 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@333..334 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@334..335 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@335..336 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@336..337 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@337..340 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@340..342 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@342..344 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@344..346 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: PLUS@346..347 "+" [] [], + argument: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@347..348 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@348..349 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@349..350 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@350..351 ">" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@351..352 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@352..355 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@355..357 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@357..359 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@359..361 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: MINUS@361..362 "-" [] [], + argument: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@362..363 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@363..364 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@364..365 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@365..366 ">" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@366..367 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@367..370 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@370..372 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@372..374 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@374..376 ">" [] [Whitespace(" ")], + right: JsThisExpression { + this_token: THIS_KW@376..380 "this" [] [], + }, + }, + semicolon_token: SEMICOLON@380..381 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@381..384 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@384..386 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@386..388 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@388..390 ">" [] [Whitespace(" ")], + right: JsNullLiteralExpression { + value_token: NULL_KW@390..394 "null" [] [], + }, + }, + semicolon_token: SEMICOLON@394..395 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@395..398 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@398..400 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@400..402 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@402..404 ">" [] [Whitespace(" ")], + right: JsBooleanLiteralExpression { + value_token: TRUE_KW@404..408 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@408..409 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@409..412 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@412..414 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@414..416 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@416..418 ">" [] [Whitespace(" ")], + right: JsBooleanLiteralExpression { + value_token: FALSE_KW@418..423 "false" [] [], + }, + }, + semicolon_token: SEMICOLON@423..424 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@424..427 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@427..429 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@429..431 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@431..433 ">" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@433..434 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@434..435 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@435..438 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@438..440 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@440..442 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@442..444 ">" [] [Whitespace(" ")], + right: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@444..448 "123n" [] [], + }, + }, + semicolon_token: SEMICOLON@448..449 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@449..452 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@452..454 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@454..456 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@456..458 ">" [] [Whitespace(" ")], + right: JsArrayExpression { + l_brack_token: L_BRACK@458..459 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@459..460 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@460..461 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@461..464 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@464..466 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@466..468 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@468..470 ">" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@470..471 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@471..472 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@472..473 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@476..478 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@478..480 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@480..482 ">" [] [Whitespace(" ")], + right: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@482..491 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@491..495 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@495..496 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@496..498 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@498..499 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@499..500 "}" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@500..501 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@501..504 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@504..506 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@506..508 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@508..510 ">" [] [Whitespace(" ")], + right: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@510..516 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@516..518 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@518..519 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@519..520 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@520..521 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@521..524 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@524..526 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@526..528 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@528..530 ">" [] [Whitespace(" ")], + right: JsNewExpression { + new_token: NEW_KW@530..534 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@534..535 "A" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@535..536 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@536..537 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@537..538 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@538..540 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@540..541 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@541..542 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@542..544 ">" [] [Whitespace(" ")], + }, + }, + operator_token: SLASH@544..546 "/" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@546..547 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@547..548 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@548..551 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@551..553 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@553..555 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@555..557 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: PLUS@557..558 "+" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@558..559 "1" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@559..560 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@563..565 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@565..567 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@567..569 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: MINUS@569..570 "-" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@570..571 "1" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@571..572 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@572..575 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@575..577 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@577..579 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@579..581 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: TILDE@581..582 "~" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@582..583 "1" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@583..584 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@584..587 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@587..589 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@589..591 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@591..593 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: BANG@593..594 "!" [] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@594..595 "1" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@595..596 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@596..599 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@599..601 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@601..603 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@603..605 ">" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@605..619 "someIdentifier" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@619..620 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@620..623 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@623..625 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@625..627 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@627..629 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: DELETE_KW@629..636 "delete" [] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@636..637 "a" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@637..638 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@638..643 "field" [] [], + }, + }, + r_brack_token: R_BRACK@643..644 "]" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@644..645 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@645..648 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@648..650 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@650..652 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@652..654 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: TYPEOF_KW@654..661 "typeof" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@661..668 "MyClass" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@668..669 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@669..672 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@672..674 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@674..676 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@676..678 ">" [] [Whitespace(" ")], + right: JsUnaryExpression { + operator_token: VOID_KW@678..683 "void" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@683..684 "a" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@684..685 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@685..687 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@687..688 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@688..689 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@689..691 ">" [] [Whitespace(" ")], + }, + }, + operator_token: LTEQ@691..694 "<=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@694..695 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@695..696 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@696..699 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@699..701 "<" [] [Whitespace(" ")], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@701..703 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@703..705 ">" [] [Whitespace(" ")], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@705..706 "(" [] [], + args: JsCallArgumentList [ + JsAwaitExpression { + await_token: AWAIT_KW@706..712 "await" [] [Whitespace(" ")], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@712..713 "1" [] [], + }, + }, + ], + r_paren_token: R_PAREN@713..714 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@714..715 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@715..718 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@718..720 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@720..722 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@722..724 ">" [] [Whitespace(" ")], + right: JsImportMetaExpression { + import_token: IMPORT_KW@724..730 "import" [] [], + dot_token: DOT@730..731 "." [] [], + meta_token: META@731..735 "meta" [] [], + }, + }, + semicolon_token: SEMICOLON@735..736 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@736..739 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@739..741 "<" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@741..743 "T" [] [Whitespace(" ")], + }, + }, + }, + operator_token: R_ANGLE@743..745 ">" [] [Whitespace(" ")], + right: JsImportCallExpression { + import_token: IMPORT_KW@745..751 "import" [] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@751..752 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@752..757 "\"123\"" [] [], + }, + ], + r_paren_token: R_PAREN@757..758 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@758..759 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@759..762 "a" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@762..764 "<" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@764..766 "b" [] [Whitespace(" ")], + }, + }, + operator_token: SHR@766..769 ">>" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@769..770 "c" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@770..771 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@771..774 "f" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@774..776 "=" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@776..778 "h" [] [Whitespace(" ")], + }, + }, + operator_token: USHR@778..782 ">>>" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@782..784 "0" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@784..786 "<" [] [Whitespace(" ")], + right: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@786..788 "j" [] [Whitespace(" ")], + }, + }, + operator_token: USHR@788..792 ">>>" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@792..793 "0" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@793..794 ";" [] [], + }, + ], + eof_token: EOF@794..795 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..795 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..794 + 0: JS_CLASS_DECLARATION@0..48 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..46 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..46 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..22 + 0: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@25..46 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..43 + 0: JS_EXPRESSION_STATEMENT@26..43 + 0: JS_BINARY_EXPRESSION@26..42 + 0: JS_BINARY_EXPRESSION@26..33 + 0: JS_IDENTIFIER_EXPRESSION@26..31 + 0: JS_REFERENCE_IDENTIFIER@26..31 + 0: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [] + 1: L_ANGLE@31..32 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@32..33 + 0: JS_REFERENCE_IDENTIFIER@32..33 + 0: IDENT@32..33 "T" [] [] + 1: R_ANGLE@33..35 ">" [] [Whitespace(" ")] + 2: JS_CALL_EXPRESSION@35..42 + 0: JS_SUPER_EXPRESSION@35..40 + 0: SUPER_KW@35..40 "super" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@40..42 + 0: L_PAREN@40..41 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@41..41 + 2: R_PAREN@41..42 ")" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 3: R_CURLY@43..46 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@46..48 "}" [Newline("\n")] [] + 1: JS_EXPRESSION_STATEMENT@48..75 + 0: JS_TEMPLATE_EXPRESSION@48..74 + 0: JS_IDENTIFIER_EXPRESSION@48..50 + 0: JS_REFERENCE_IDENTIFIER@48..50 + 0: IDENT@48..50 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@50..72 + 0: L_ANGLE@50..51 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@51..71 + 0: TS_REFERENCE_TYPE@51..71 + 0: JS_REFERENCE_IDENTIFIER@51..71 + 0: IDENT@51..71 "TemplateStringsArray" [] [] + 1: (empty) + 2: R_ANGLE@71..72 ">" [] [] + 2: BACKTICK@72..73 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@73..73 + 4: BACKTICK@73..74 "`" [] [] + 1: SEMICOLON@74..75 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@75..84 + 0: JS_CALL_EXPRESSION@75..83 + 0: JS_IDENTIFIER_EXPRESSION@75..77 + 0: JS_REFERENCE_IDENTIFIER@75..77 + 0: IDENT@75..77 "f" [Newline("\n")] [] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@77..80 + 0: L_ANGLE@77..78 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@78..79 + 0: TS_REFERENCE_TYPE@78..79 + 0: JS_REFERENCE_IDENTIFIER@78..79 + 0: IDENT@78..79 "T" [] [] + 1: (empty) + 2: R_ANGLE@79..80 ">" [] [] + 3: JS_CALL_ARGUMENTS@80..83 + 0: L_PAREN@80..81 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@81..82 + 0: JS_NUMBER_LITERAL_EXPRESSION@81..82 + 0: JS_NUMBER_LITERAL@81..82 "1" [] [] + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@84..95 + 0: JS_LOGICAL_EXPRESSION@84..94 + 0: TS_INSTANTIATION_EXPRESSION@84..90 + 0: JS_IDENTIFIER_EXPRESSION@84..86 + 0: JS_REFERENCE_IDENTIFIER@84..86 + 0: IDENT@84..86 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@86..90 + 0: L_ANGLE@86..87 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@87..88 + 0: TS_REFERENCE_TYPE@87..88 + 0: JS_REFERENCE_IDENTIFIER@87..88 + 0: IDENT@87..88 "T" [] [] + 1: (empty) + 2: R_ANGLE@88..90 ">" [] [Whitespace(" ")] + 1: QUESTION2@90..93 "??" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@93..94 + 0: JS_NUMBER_LITERAL@93..94 "1" [] [] + 1: SEMICOLON@94..95 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@95..106 + 0: JS_LOGICAL_EXPRESSION@95..105 + 0: TS_INSTANTIATION_EXPRESSION@95..101 + 0: JS_IDENTIFIER_EXPRESSION@95..97 + 0: JS_REFERENCE_IDENTIFIER@95..97 + 0: IDENT@95..97 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@97..101 + 0: L_ANGLE@97..98 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@98..99 + 0: TS_REFERENCE_TYPE@98..99 + 0: JS_REFERENCE_IDENTIFIER@98..99 + 0: IDENT@98..99 "T" [] [] + 1: (empty) + 2: R_ANGLE@99..101 ">" [] [Whitespace(" ")] + 1: PIPE2@101..104 "||" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@104..105 + 0: JS_NUMBER_LITERAL@104..105 "1" [] [] + 1: SEMICOLON@105..106 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@106..117 + 0: JS_LOGICAL_EXPRESSION@106..116 + 0: TS_INSTANTIATION_EXPRESSION@106..112 + 0: JS_IDENTIFIER_EXPRESSION@106..108 + 0: JS_REFERENCE_IDENTIFIER@106..108 + 0: IDENT@106..108 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@108..112 + 0: L_ANGLE@108..109 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@109..110 + 0: TS_REFERENCE_TYPE@109..110 + 0: JS_REFERENCE_IDENTIFIER@109..110 + 0: IDENT@109..110 "T" [] [] + 1: (empty) + 2: R_ANGLE@110..112 ">" [] [Whitespace(" ")] + 1: AMP2@112..115 "&&" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@115..116 + 0: JS_NUMBER_LITERAL@115..116 "1" [] [] + 1: SEMICOLON@116..117 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@117..127 + 0: JS_BINARY_EXPRESSION@117..126 + 0: TS_INSTANTIATION_EXPRESSION@117..123 + 0: JS_IDENTIFIER_EXPRESSION@117..119 + 0: JS_REFERENCE_IDENTIFIER@117..119 + 0: IDENT@117..119 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@119..123 + 0: L_ANGLE@119..120 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@120..121 + 0: TS_REFERENCE_TYPE@120..121 + 0: JS_REFERENCE_IDENTIFIER@120..121 + 0: IDENT@120..121 "T" [] [] + 1: (empty) + 2: R_ANGLE@121..123 ">" [] [Whitespace(" ")] + 1: PIPE@123..125 "|" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@125..126 + 0: JS_NUMBER_LITERAL@125..126 "1" [] [] + 1: SEMICOLON@126..127 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@127..137 + 0: JS_BINARY_EXPRESSION@127..136 + 0: TS_INSTANTIATION_EXPRESSION@127..133 + 0: JS_IDENTIFIER_EXPRESSION@127..129 + 0: JS_REFERENCE_IDENTIFIER@127..129 + 0: IDENT@127..129 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@129..133 + 0: L_ANGLE@129..130 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@130..131 + 0: TS_REFERENCE_TYPE@130..131 + 0: JS_REFERENCE_IDENTIFIER@130..131 + 0: IDENT@130..131 "T" [] [] + 1: (empty) + 2: R_ANGLE@131..133 ">" [] [Whitespace(" ")] + 1: CARET@133..135 "^" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@135..136 + 0: JS_NUMBER_LITERAL@135..136 "1" [] [] + 1: SEMICOLON@136..137 ";" [] [] + 8: JS_EXPRESSION_STATEMENT@137..147 + 0: JS_BINARY_EXPRESSION@137..146 + 0: TS_INSTANTIATION_EXPRESSION@137..143 + 0: JS_IDENTIFIER_EXPRESSION@137..139 + 0: JS_REFERENCE_IDENTIFIER@137..139 + 0: IDENT@137..139 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@139..143 + 0: L_ANGLE@139..140 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@140..141 + 0: TS_REFERENCE_TYPE@140..141 + 0: JS_REFERENCE_IDENTIFIER@140..141 + 0: IDENT@140..141 "T" [] [] + 1: (empty) + 2: R_ANGLE@141..143 ">" [] [Whitespace(" ")] + 1: AMP@143..145 "&" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@145..146 + 0: JS_NUMBER_LITERAL@145..146 "1" [] [] + 1: SEMICOLON@146..147 ";" [] [] + 9: JS_EXPRESSION_STATEMENT@147..161 + 0: JS_BINARY_EXPRESSION@147..160 + 0: TS_INSTANTIATION_EXPRESSION@147..153 + 0: JS_IDENTIFIER_EXPRESSION@147..149 + 0: JS_REFERENCE_IDENTIFIER@147..149 + 0: IDENT@147..149 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@149..153 + 0: L_ANGLE@149..150 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@150..151 + 0: TS_REFERENCE_TYPE@150..151 + 0: JS_REFERENCE_IDENTIFIER@150..151 + 0: IDENT@150..151 "T" [] [] + 1: (empty) + 2: R_ANGLE@151..153 ">" [] [Whitespace(" ")] + 1: EQ2@153..156 "==" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@156..160 + 0: JS_IDENTIFIER_EXPRESSION@156..157 + 0: JS_REFERENCE_IDENTIFIER@156..157 + 0: IDENT@156..157 "f" [] [] + 1: TS_TYPE_ARGUMENTS@157..160 + 0: L_ANGLE@157..158 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@158..159 + 0: TS_REFERENCE_TYPE@158..159 + 0: JS_REFERENCE_IDENTIFIER@158..159 + 0: IDENT@158..159 "T" [] [] + 1: (empty) + 2: R_ANGLE@159..160 ">" [] [] + 1: SEMICOLON@160..161 ";" [] [] + 10: JS_EXPRESSION_STATEMENT@161..175 + 0: JS_BINARY_EXPRESSION@161..174 + 0: TS_INSTANTIATION_EXPRESSION@161..167 + 0: JS_IDENTIFIER_EXPRESSION@161..163 + 0: JS_REFERENCE_IDENTIFIER@161..163 + 0: IDENT@161..163 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@163..167 + 0: L_ANGLE@163..164 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@164..165 + 0: TS_REFERENCE_TYPE@164..165 + 0: JS_REFERENCE_IDENTIFIER@164..165 + 0: IDENT@164..165 "T" [] [] + 1: (empty) + 2: R_ANGLE@165..167 ">" [] [Whitespace(" ")] + 1: NEQ@167..170 "!=" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@170..174 + 0: JS_IDENTIFIER_EXPRESSION@170..171 + 0: JS_REFERENCE_IDENTIFIER@170..171 + 0: IDENT@170..171 "f" [] [] + 1: TS_TYPE_ARGUMENTS@171..174 + 0: L_ANGLE@171..172 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@172..173 + 0: TS_REFERENCE_TYPE@172..173 + 0: JS_REFERENCE_IDENTIFIER@172..173 + 0: IDENT@172..173 "T" [] [] + 1: (empty) + 2: R_ANGLE@173..174 ">" [] [] + 1: SEMICOLON@174..175 ";" [] [] + 11: JS_EXPRESSION_STATEMENT@175..190 + 0: JS_BINARY_EXPRESSION@175..189 + 0: TS_INSTANTIATION_EXPRESSION@175..181 + 0: JS_IDENTIFIER_EXPRESSION@175..177 + 0: JS_REFERENCE_IDENTIFIER@175..177 + 0: IDENT@175..177 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@177..181 + 0: L_ANGLE@177..178 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@178..179 + 0: TS_REFERENCE_TYPE@178..179 + 0: JS_REFERENCE_IDENTIFIER@178..179 + 0: IDENT@178..179 "T" [] [] + 1: (empty) + 2: R_ANGLE@179..181 ">" [] [Whitespace(" ")] + 1: EQ3@181..185 "===" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@185..189 + 0: JS_IDENTIFIER_EXPRESSION@185..186 + 0: JS_REFERENCE_IDENTIFIER@185..186 + 0: IDENT@185..186 "f" [] [] + 1: TS_TYPE_ARGUMENTS@186..189 + 0: L_ANGLE@186..187 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@187..188 + 0: TS_REFERENCE_TYPE@187..188 + 0: JS_REFERENCE_IDENTIFIER@187..188 + 0: IDENT@187..188 "T" [] [] + 1: (empty) + 2: R_ANGLE@188..189 ">" [] [] + 1: SEMICOLON@189..190 ";" [] [] + 12: JS_EXPRESSION_STATEMENT@190..205 + 0: JS_BINARY_EXPRESSION@190..204 + 0: TS_INSTANTIATION_EXPRESSION@190..196 + 0: JS_IDENTIFIER_EXPRESSION@190..192 + 0: JS_REFERENCE_IDENTIFIER@190..192 + 0: IDENT@190..192 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@192..196 + 0: L_ANGLE@192..193 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@193..194 + 0: TS_REFERENCE_TYPE@193..194 + 0: JS_REFERENCE_IDENTIFIER@193..194 + 0: IDENT@193..194 "T" [] [] + 1: (empty) + 2: R_ANGLE@194..196 ">" [] [Whitespace(" ")] + 1: NEQ2@196..200 "!==" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@200..204 + 0: JS_IDENTIFIER_EXPRESSION@200..201 + 0: JS_REFERENCE_IDENTIFIER@200..201 + 0: IDENT@200..201 "f" [] [] + 1: TS_TYPE_ARGUMENTS@201..204 + 0: L_ANGLE@201..202 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@202..203 + 0: TS_REFERENCE_TYPE@202..203 + 0: JS_REFERENCE_IDENTIFIER@202..203 + 0: IDENT@202..203 "T" [] [] + 1: (empty) + 2: R_ANGLE@203..204 ">" [] [] + 1: SEMICOLON@204..205 ";" [] [] + 13: JS_EXPRESSION_STATEMENT@205..219 + 0: JS_BINARY_EXPRESSION@205..218 + 0: TS_INSTANTIATION_EXPRESSION@205..211 + 0: JS_IDENTIFIER_EXPRESSION@205..207 + 0: JS_REFERENCE_IDENTIFIER@205..207 + 0: IDENT@205..207 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@207..211 + 0: L_ANGLE@207..208 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@208..209 + 0: TS_REFERENCE_TYPE@208..209 + 0: JS_REFERENCE_IDENTIFIER@208..209 + 0: IDENT@208..209 "T" [] [] + 1: (empty) + 2: R_ANGLE@209..211 ">" [] [Whitespace(" ")] + 1: LTEQ@211..214 "<=" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@214..218 + 0: JS_IDENTIFIER_EXPRESSION@214..215 + 0: JS_REFERENCE_IDENTIFIER@214..215 + 0: IDENT@214..215 "f" [] [] + 1: TS_TYPE_ARGUMENTS@215..218 + 0: L_ANGLE@215..216 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@216..217 + 0: TS_REFERENCE_TYPE@216..217 + 0: JS_REFERENCE_IDENTIFIER@216..217 + 0: IDENT@216..217 "T" [] [] + 1: (empty) + 2: R_ANGLE@217..218 ">" [] [] + 1: SEMICOLON@218..219 ";" [] [] + 14: JS_EXPRESSION_STATEMENT@219..241 + 0: JS_INSTANCEOF_EXPRESSION@219..240 + 0: TS_INSTANTIATION_EXPRESSION@219..225 + 0: JS_IDENTIFIER_EXPRESSION@219..221 + 0: JS_REFERENCE_IDENTIFIER@219..221 + 0: IDENT@219..221 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@221..225 + 0: L_ANGLE@221..222 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@222..223 + 0: TS_REFERENCE_TYPE@222..223 + 0: JS_REFERENCE_IDENTIFIER@222..223 + 0: IDENT@222..223 "T" [] [] + 1: (empty) + 2: R_ANGLE@223..225 ">" [] [Whitespace(" ")] + 1: INSTANCEOF_KW@225..236 "instanceof" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@236..240 + 0: JS_IDENTIFIER_EXPRESSION@236..237 + 0: JS_REFERENCE_IDENTIFIER@236..237 + 0: IDENT@236..237 "f" [] [] + 1: TS_TYPE_ARGUMENTS@237..240 + 0: L_ANGLE@237..238 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@238..239 + 0: TS_REFERENCE_TYPE@238..239 + 0: JS_REFERENCE_IDENTIFIER@238..239 + 0: IDENT@238..239 "T" [] [] + 1: (empty) + 2: R_ANGLE@239..240 ">" [] [] + 1: SEMICOLON@240..241 ";" [] [] + 15: JS_EXPRESSION_STATEMENT@241..253 + 0: JS_IN_EXPRESSION@241..252 + 0: TS_INSTANTIATION_EXPRESSION@241..247 + 0: JS_IDENTIFIER_EXPRESSION@241..243 + 0: JS_REFERENCE_IDENTIFIER@241..243 + 0: IDENT@241..243 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@243..247 + 0: L_ANGLE@243..244 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@244..245 + 0: TS_REFERENCE_TYPE@244..245 + 0: JS_REFERENCE_IDENTIFIER@244..245 + 0: IDENT@244..245 "T" [] [] + 1: (empty) + 2: R_ANGLE@245..247 ">" [] [Whitespace(" ")] + 1: IN_KW@247..250 "in" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@250..252 + 0: L_CURLY@250..251 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@251..251 + 2: R_CURLY@251..252 "}" [] [] + 1: SEMICOLON@252..253 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@253..265 + 0: TS_AS_EXPRESSION@253..264 + 0: TS_INSTANTIATION_EXPRESSION@253..259 + 0: JS_IDENTIFIER_EXPRESSION@253..255 + 0: JS_REFERENCE_IDENTIFIER@253..255 + 0: IDENT@253..255 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@255..259 + 0: L_ANGLE@255..256 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@256..257 + 0: TS_REFERENCE_TYPE@256..257 + 0: JS_REFERENCE_IDENTIFIER@256..257 + 0: IDENT@256..257 "T" [] [] + 1: (empty) + 2: R_ANGLE@257..259 ">" [] [Whitespace(" ")] + 1: AS_KW@259..262 "as" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@262..264 + 0: L_CURLY@262..263 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@263..263 + 2: R_CURLY@263..264 "}" [] [] + 1: SEMICOLON@264..265 ";" [] [] + 17: JS_EXPRESSION_STATEMENT@265..284 + 0: TS_SATISFIES_EXPRESSION@265..283 + 0: TS_INSTANTIATION_EXPRESSION@265..271 + 0: JS_IDENTIFIER_EXPRESSION@265..267 + 0: JS_REFERENCE_IDENTIFIER@265..267 + 0: IDENT@265..267 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@267..271 + 0: L_ANGLE@267..268 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@268..269 + 0: TS_REFERENCE_TYPE@268..269 + 0: JS_REFERENCE_IDENTIFIER@268..269 + 0: IDENT@268..269 "T" [] [] + 1: (empty) + 2: R_ANGLE@269..271 ">" [] [Whitespace(" ")] + 1: SATISFIES_KW@271..281 "satisfies" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@281..283 + 0: L_CURLY@281..282 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@282..282 + 2: R_CURLY@282..283 "}" [] [] + 1: SEMICOLON@283..284 ";" [] [] + 18: JS_EXPRESSION_STATEMENT@284..297 + 0: JS_BINARY_EXPRESSION@284..296 + 0: TS_INSTANTIATION_EXPRESSION@284..290 + 0: JS_IDENTIFIER_EXPRESSION@284..286 + 0: JS_REFERENCE_IDENTIFIER@284..286 + 0: IDENT@284..286 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@286..290 + 0: L_ANGLE@286..287 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@287..288 + 0: TS_REFERENCE_TYPE@287..288 + 0: JS_REFERENCE_IDENTIFIER@287..288 + 0: IDENT@287..288 "T" [] [] + 1: (empty) + 2: R_ANGLE@288..290 ">" [] [Whitespace(" ")] + 1: STAR@290..292 "*" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@292..296 + 0: JS_IDENTIFIER_EXPRESSION@292..293 + 0: JS_REFERENCE_IDENTIFIER@292..293 + 0: IDENT@292..293 "f" [] [] + 1: TS_TYPE_ARGUMENTS@293..296 + 0: L_ANGLE@293..294 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@294..295 + 0: TS_REFERENCE_TYPE@294..295 + 0: JS_REFERENCE_IDENTIFIER@294..295 + 0: IDENT@294..295 "T" [] [] + 1: (empty) + 2: R_ANGLE@295..296 ">" [] [] + 1: SEMICOLON@296..297 ";" [] [] + 19: JS_EXPRESSION_STATEMENT@297..310 + 0: JS_BINARY_EXPRESSION@297..309 + 0: TS_INSTANTIATION_EXPRESSION@297..303 + 0: JS_IDENTIFIER_EXPRESSION@297..299 + 0: JS_REFERENCE_IDENTIFIER@297..299 + 0: IDENT@297..299 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@299..303 + 0: L_ANGLE@299..300 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@300..301 + 0: TS_REFERENCE_TYPE@300..301 + 0: JS_REFERENCE_IDENTIFIER@300..301 + 0: IDENT@300..301 "T" [] [] + 1: (empty) + 2: R_ANGLE@301..303 ">" [] [Whitespace(" ")] + 1: SLASH@303..305 "/" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@305..309 + 0: JS_IDENTIFIER_EXPRESSION@305..306 + 0: JS_REFERENCE_IDENTIFIER@305..306 + 0: IDENT@305..306 "f" [] [] + 1: TS_TYPE_ARGUMENTS@306..309 + 0: L_ANGLE@306..307 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@307..308 + 0: TS_REFERENCE_TYPE@307..308 + 0: JS_REFERENCE_IDENTIFIER@307..308 + 0: IDENT@307..308 "T" [] [] + 1: (empty) + 2: R_ANGLE@308..309 ">" [] [] + 1: SEMICOLON@309..310 ";" [] [] + 20: JS_EXPRESSION_STATEMENT@310..323 + 0: JS_BINARY_EXPRESSION@310..322 + 0: TS_INSTANTIATION_EXPRESSION@310..316 + 0: JS_IDENTIFIER_EXPRESSION@310..312 + 0: JS_REFERENCE_IDENTIFIER@310..312 + 0: IDENT@310..312 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@312..316 + 0: L_ANGLE@312..313 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@313..314 + 0: TS_REFERENCE_TYPE@313..314 + 0: JS_REFERENCE_IDENTIFIER@313..314 + 0: IDENT@313..314 "T" [] [] + 1: (empty) + 2: R_ANGLE@314..316 ">" [] [Whitespace(" ")] + 1: PERCENT@316..318 "%" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@318..322 + 0: JS_IDENTIFIER_EXPRESSION@318..319 + 0: JS_REFERENCE_IDENTIFIER@318..319 + 0: IDENT@318..319 "f" [] [] + 1: TS_TYPE_ARGUMENTS@319..322 + 0: L_ANGLE@319..320 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@320..321 + 0: TS_REFERENCE_TYPE@320..321 + 0: JS_REFERENCE_IDENTIFIER@320..321 + 0: IDENT@320..321 "T" [] [] + 1: (empty) + 2: R_ANGLE@321..322 ">" [] [] + 1: SEMICOLON@322..323 ";" [] [] + 21: JS_EXPRESSION_STATEMENT@323..337 + 0: JS_BINARY_EXPRESSION@323..336 + 0: TS_INSTANTIATION_EXPRESSION@323..329 + 0: JS_IDENTIFIER_EXPRESSION@323..325 + 0: JS_REFERENCE_IDENTIFIER@323..325 + 0: IDENT@323..325 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@325..329 + 0: L_ANGLE@325..326 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@326..327 + 0: TS_REFERENCE_TYPE@326..327 + 0: JS_REFERENCE_IDENTIFIER@326..327 + 0: IDENT@326..327 "T" [] [] + 1: (empty) + 2: R_ANGLE@327..329 ">" [] [Whitespace(" ")] + 1: STAR2@329..332 "**" [] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@332..336 + 0: JS_IDENTIFIER_EXPRESSION@332..333 + 0: JS_REFERENCE_IDENTIFIER@332..333 + 0: IDENT@332..333 "f" [] [] + 1: TS_TYPE_ARGUMENTS@333..336 + 0: L_ANGLE@333..334 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@334..335 + 0: TS_REFERENCE_TYPE@334..335 + 0: JS_REFERENCE_IDENTIFIER@334..335 + 0: IDENT@334..335 "T" [] [] + 1: (empty) + 2: R_ANGLE@335..336 ">" [] [] + 1: SEMICOLON@336..337 ";" [] [] + 22: JS_EXPRESSION_STATEMENT@337..352 + 0: JS_BINARY_EXPRESSION@337..351 + 0: JS_BINARY_EXPRESSION@337..344 + 0: JS_IDENTIFIER_EXPRESSION@337..340 + 0: JS_REFERENCE_IDENTIFIER@337..340 + 0: IDENT@337..340 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@340..342 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@342..344 + 0: JS_REFERENCE_IDENTIFIER@342..344 + 0: IDENT@342..344 "T" [] [Whitespace(" ")] + 1: R_ANGLE@344..346 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@346..351 + 0: PLUS@346..347 "+" [] [] + 1: TS_INSTANTIATION_EXPRESSION@347..351 + 0: JS_IDENTIFIER_EXPRESSION@347..348 + 0: JS_REFERENCE_IDENTIFIER@347..348 + 0: IDENT@347..348 "f" [] [] + 1: TS_TYPE_ARGUMENTS@348..351 + 0: L_ANGLE@348..349 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@349..350 + 0: TS_REFERENCE_TYPE@349..350 + 0: JS_REFERENCE_IDENTIFIER@349..350 + 0: IDENT@349..350 "T" [] [] + 1: (empty) + 2: R_ANGLE@350..351 ">" [] [] + 1: SEMICOLON@351..352 ";" [] [] + 23: JS_EXPRESSION_STATEMENT@352..367 + 0: JS_BINARY_EXPRESSION@352..366 + 0: JS_BINARY_EXPRESSION@352..359 + 0: JS_IDENTIFIER_EXPRESSION@352..355 + 0: JS_REFERENCE_IDENTIFIER@352..355 + 0: IDENT@352..355 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@355..357 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@357..359 + 0: JS_REFERENCE_IDENTIFIER@357..359 + 0: IDENT@357..359 "T" [] [Whitespace(" ")] + 1: R_ANGLE@359..361 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@361..366 + 0: MINUS@361..362 "-" [] [] + 1: TS_INSTANTIATION_EXPRESSION@362..366 + 0: JS_IDENTIFIER_EXPRESSION@362..363 + 0: JS_REFERENCE_IDENTIFIER@362..363 + 0: IDENT@362..363 "f" [] [] + 1: TS_TYPE_ARGUMENTS@363..366 + 0: L_ANGLE@363..364 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@364..365 + 0: TS_REFERENCE_TYPE@364..365 + 0: JS_REFERENCE_IDENTIFIER@364..365 + 0: IDENT@364..365 "T" [] [] + 1: (empty) + 2: R_ANGLE@365..366 ">" [] [] + 1: SEMICOLON@366..367 ";" [] [] + 24: JS_EXPRESSION_STATEMENT@367..381 + 0: JS_BINARY_EXPRESSION@367..380 + 0: JS_BINARY_EXPRESSION@367..374 + 0: JS_IDENTIFIER_EXPRESSION@367..370 + 0: JS_REFERENCE_IDENTIFIER@367..370 + 0: IDENT@367..370 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@370..372 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@372..374 + 0: JS_REFERENCE_IDENTIFIER@372..374 + 0: IDENT@372..374 "T" [] [Whitespace(" ")] + 1: R_ANGLE@374..376 ">" [] [Whitespace(" ")] + 2: JS_THIS_EXPRESSION@376..380 + 0: THIS_KW@376..380 "this" [] [] + 1: SEMICOLON@380..381 ";" [] [] + 25: JS_EXPRESSION_STATEMENT@381..395 + 0: JS_BINARY_EXPRESSION@381..394 + 0: JS_BINARY_EXPRESSION@381..388 + 0: JS_IDENTIFIER_EXPRESSION@381..384 + 0: JS_REFERENCE_IDENTIFIER@381..384 + 0: IDENT@381..384 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@384..386 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@386..388 + 0: JS_REFERENCE_IDENTIFIER@386..388 + 0: IDENT@386..388 "T" [] [Whitespace(" ")] + 1: R_ANGLE@388..390 ">" [] [Whitespace(" ")] + 2: JS_NULL_LITERAL_EXPRESSION@390..394 + 0: NULL_KW@390..394 "null" [] [] + 1: SEMICOLON@394..395 ";" [] [] + 26: JS_EXPRESSION_STATEMENT@395..409 + 0: JS_BINARY_EXPRESSION@395..408 + 0: JS_BINARY_EXPRESSION@395..402 + 0: JS_IDENTIFIER_EXPRESSION@395..398 + 0: JS_REFERENCE_IDENTIFIER@395..398 + 0: IDENT@395..398 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@398..400 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@400..402 + 0: JS_REFERENCE_IDENTIFIER@400..402 + 0: IDENT@400..402 "T" [] [Whitespace(" ")] + 1: R_ANGLE@402..404 ">" [] [Whitespace(" ")] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@404..408 + 0: TRUE_KW@404..408 "true" [] [] + 1: SEMICOLON@408..409 ";" [] [] + 27: JS_EXPRESSION_STATEMENT@409..424 + 0: JS_BINARY_EXPRESSION@409..423 + 0: JS_BINARY_EXPRESSION@409..416 + 0: JS_IDENTIFIER_EXPRESSION@409..412 + 0: JS_REFERENCE_IDENTIFIER@409..412 + 0: IDENT@409..412 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@412..414 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@414..416 + 0: JS_REFERENCE_IDENTIFIER@414..416 + 0: IDENT@414..416 "T" [] [Whitespace(" ")] + 1: R_ANGLE@416..418 ">" [] [Whitespace(" ")] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@418..423 + 0: FALSE_KW@418..423 "false" [] [] + 1: SEMICOLON@423..424 ";" [] [] + 28: JS_EXPRESSION_STATEMENT@424..435 + 0: JS_BINARY_EXPRESSION@424..434 + 0: JS_BINARY_EXPRESSION@424..431 + 0: JS_IDENTIFIER_EXPRESSION@424..427 + 0: JS_REFERENCE_IDENTIFIER@424..427 + 0: IDENT@424..427 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@427..429 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@429..431 + 0: JS_REFERENCE_IDENTIFIER@429..431 + 0: IDENT@429..431 "T" [] [Whitespace(" ")] + 1: R_ANGLE@431..433 ">" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@433..434 + 0: JS_NUMBER_LITERAL@433..434 "1" [] [] + 1: SEMICOLON@434..435 ";" [] [] + 29: JS_EXPRESSION_STATEMENT@435..449 + 0: JS_BINARY_EXPRESSION@435..448 + 0: JS_BINARY_EXPRESSION@435..442 + 0: JS_IDENTIFIER_EXPRESSION@435..438 + 0: JS_REFERENCE_IDENTIFIER@435..438 + 0: IDENT@435..438 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@438..440 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@440..442 + 0: JS_REFERENCE_IDENTIFIER@440..442 + 0: IDENT@440..442 "T" [] [Whitespace(" ")] + 1: R_ANGLE@442..444 ">" [] [Whitespace(" ")] + 2: JS_BIGINT_LITERAL_EXPRESSION@444..448 + 0: JS_BIGINT_LITERAL@444..448 "123n" [] [] + 1: SEMICOLON@448..449 ";" [] [] + 30: JS_EXPRESSION_STATEMENT@449..461 + 0: JS_BINARY_EXPRESSION@449..460 + 0: JS_BINARY_EXPRESSION@449..456 + 0: JS_IDENTIFIER_EXPRESSION@449..452 + 0: JS_REFERENCE_IDENTIFIER@449..452 + 0: IDENT@449..452 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@452..454 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@454..456 + 0: JS_REFERENCE_IDENTIFIER@454..456 + 0: IDENT@454..456 "T" [] [Whitespace(" ")] + 1: R_ANGLE@456..458 ">" [] [Whitespace(" ")] + 2: JS_ARRAY_EXPRESSION@458..460 + 0: L_BRACK@458..459 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@459..459 + 2: R_BRACK@459..460 "]" [] [] + 1: SEMICOLON@460..461 ";" [] [] + 31: JS_EXPRESSION_STATEMENT@461..473 + 0: JS_BINARY_EXPRESSION@461..472 + 0: JS_BINARY_EXPRESSION@461..468 + 0: JS_IDENTIFIER_EXPRESSION@461..464 + 0: JS_REFERENCE_IDENTIFIER@461..464 + 0: IDENT@461..464 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@464..466 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@466..468 + 0: JS_REFERENCE_IDENTIFIER@466..468 + 0: IDENT@466..468 "T" [] [Whitespace(" ")] + 1: R_ANGLE@468..470 ">" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@470..472 + 0: L_CURLY@470..471 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@471..471 + 2: R_CURLY@471..472 "}" [] [] + 1: SEMICOLON@472..473 ";" [] [] + 32: JS_EXPRESSION_STATEMENT@473..501 + 0: JS_BINARY_EXPRESSION@473..500 + 0: JS_BINARY_EXPRESSION@473..480 + 0: JS_IDENTIFIER_EXPRESSION@473..476 + 0: JS_REFERENCE_IDENTIFIER@473..476 + 0: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@476..478 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@478..480 + 0: JS_REFERENCE_IDENTIFIER@478..480 + 0: IDENT@478..480 "T" [] [Whitespace(" ")] + 1: R_ANGLE@480..482 ">" [] [Whitespace(" ")] + 2: JS_FUNCTION_EXPRESSION@482..500 + 0: (empty) + 1: FUNCTION_KW@482..491 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@491..495 + 0: IDENT@491..495 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@495..498 + 0: L_PAREN@495..496 "(" [] [] + 1: JS_PARAMETER_LIST@496..496 + 2: R_PAREN@496..498 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@498..500 + 0: L_CURLY@498..499 "{" [] [] + 1: JS_DIRECTIVE_LIST@499..499 + 2: JS_STATEMENT_LIST@499..499 + 3: R_CURLY@499..500 "}" [] [] + 1: SEMICOLON@500..501 ";" [] [] + 33: JS_EXPRESSION_STATEMENT@501..521 + 0: JS_BINARY_EXPRESSION@501..520 + 0: JS_BINARY_EXPRESSION@501..508 + 0: JS_IDENTIFIER_EXPRESSION@501..504 + 0: JS_REFERENCE_IDENTIFIER@501..504 + 0: IDENT@501..504 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@504..506 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@506..508 + 0: JS_REFERENCE_IDENTIFIER@506..508 + 0: IDENT@506..508 "T" [] [Whitespace(" ")] + 1: R_ANGLE@508..510 ">" [] [Whitespace(" ")] + 2: JS_CLASS_EXPRESSION@510..520 + 0: JS_DECORATOR_LIST@510..510 + 1: CLASS_KW@510..516 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@516..518 + 0: IDENT@516..518 "A" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@518..519 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@519..519 + 8: R_CURLY@519..520 "}" [] [] + 1: SEMICOLON@520..521 ";" [] [] + 34: JS_EXPRESSION_STATEMENT@521..538 + 0: JS_BINARY_EXPRESSION@521..537 + 0: JS_BINARY_EXPRESSION@521..528 + 0: JS_IDENTIFIER_EXPRESSION@521..524 + 0: JS_REFERENCE_IDENTIFIER@521..524 + 0: IDENT@521..524 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@524..526 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@526..528 + 0: JS_REFERENCE_IDENTIFIER@526..528 + 0: IDENT@526..528 "T" [] [Whitespace(" ")] + 1: R_ANGLE@528..530 ">" [] [Whitespace(" ")] + 2: JS_NEW_EXPRESSION@530..537 + 0: NEW_KW@530..534 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@534..535 + 0: JS_REFERENCE_IDENTIFIER@534..535 + 0: IDENT@534..535 "A" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@535..537 + 0: L_PAREN@535..536 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@536..536 + 2: R_PAREN@536..537 ")" [] [] + 1: SEMICOLON@537..538 ";" [] [] + 35: JS_EXPRESSION_STATEMENT@538..548 + 0: JS_BINARY_EXPRESSION@538..547 + 0: TS_INSTANTIATION_EXPRESSION@538..544 + 0: JS_IDENTIFIER_EXPRESSION@538..540 + 0: JS_REFERENCE_IDENTIFIER@538..540 + 0: IDENT@538..540 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@540..544 + 0: L_ANGLE@540..541 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@541..542 + 0: TS_REFERENCE_TYPE@541..542 + 0: JS_REFERENCE_IDENTIFIER@541..542 + 0: IDENT@541..542 "T" [] [] + 1: (empty) + 2: R_ANGLE@542..544 ">" [] [Whitespace(" ")] + 1: SLASH@544..546 "/" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@546..547 + 0: JS_NUMBER_LITERAL@546..547 "1" [] [] + 1: SEMICOLON@547..548 ";" [] [] + 36: JS_EXPRESSION_STATEMENT@548..560 + 0: JS_BINARY_EXPRESSION@548..559 + 0: JS_BINARY_EXPRESSION@548..555 + 0: JS_IDENTIFIER_EXPRESSION@548..551 + 0: JS_REFERENCE_IDENTIFIER@548..551 + 0: IDENT@548..551 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@551..553 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@553..555 + 0: JS_REFERENCE_IDENTIFIER@553..555 + 0: IDENT@553..555 "T" [] [Whitespace(" ")] + 1: R_ANGLE@555..557 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@557..559 + 0: PLUS@557..558 "+" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@558..559 + 0: JS_NUMBER_LITERAL@558..559 "1" [] [] + 1: SEMICOLON@559..560 ";" [] [] + 37: JS_EXPRESSION_STATEMENT@560..572 + 0: JS_BINARY_EXPRESSION@560..571 + 0: JS_BINARY_EXPRESSION@560..567 + 0: JS_IDENTIFIER_EXPRESSION@560..563 + 0: JS_REFERENCE_IDENTIFIER@560..563 + 0: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@563..565 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@565..567 + 0: JS_REFERENCE_IDENTIFIER@565..567 + 0: IDENT@565..567 "T" [] [Whitespace(" ")] + 1: R_ANGLE@567..569 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@569..571 + 0: MINUS@569..570 "-" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@570..571 + 0: JS_NUMBER_LITERAL@570..571 "1" [] [] + 1: SEMICOLON@571..572 ";" [] [] + 38: JS_EXPRESSION_STATEMENT@572..584 + 0: JS_BINARY_EXPRESSION@572..583 + 0: JS_BINARY_EXPRESSION@572..579 + 0: JS_IDENTIFIER_EXPRESSION@572..575 + 0: JS_REFERENCE_IDENTIFIER@572..575 + 0: IDENT@572..575 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@575..577 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@577..579 + 0: JS_REFERENCE_IDENTIFIER@577..579 + 0: IDENT@577..579 "T" [] [Whitespace(" ")] + 1: R_ANGLE@579..581 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@581..583 + 0: TILDE@581..582 "~" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@582..583 + 0: JS_NUMBER_LITERAL@582..583 "1" [] [] + 1: SEMICOLON@583..584 ";" [] [] + 39: JS_EXPRESSION_STATEMENT@584..596 + 0: JS_BINARY_EXPRESSION@584..595 + 0: JS_BINARY_EXPRESSION@584..591 + 0: JS_IDENTIFIER_EXPRESSION@584..587 + 0: JS_REFERENCE_IDENTIFIER@584..587 + 0: IDENT@584..587 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@587..589 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@589..591 + 0: JS_REFERENCE_IDENTIFIER@589..591 + 0: IDENT@589..591 "T" [] [Whitespace(" ")] + 1: R_ANGLE@591..593 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@593..595 + 0: BANG@593..594 "!" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@594..595 + 0: JS_NUMBER_LITERAL@594..595 "1" [] [] + 1: SEMICOLON@595..596 ";" [] [] + 40: JS_EXPRESSION_STATEMENT@596..620 + 0: JS_BINARY_EXPRESSION@596..619 + 0: JS_BINARY_EXPRESSION@596..603 + 0: JS_IDENTIFIER_EXPRESSION@596..599 + 0: JS_REFERENCE_IDENTIFIER@596..599 + 0: IDENT@596..599 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@599..601 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@601..603 + 0: JS_REFERENCE_IDENTIFIER@601..603 + 0: IDENT@601..603 "T" [] [Whitespace(" ")] + 1: R_ANGLE@603..605 ">" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@605..619 + 0: JS_REFERENCE_IDENTIFIER@605..619 + 0: IDENT@605..619 "someIdentifier" [] [] + 1: SEMICOLON@619..620 ";" [] [] + 41: JS_EXPRESSION_STATEMENT@620..645 + 0: JS_BINARY_EXPRESSION@620..644 + 0: JS_BINARY_EXPRESSION@620..627 + 0: JS_IDENTIFIER_EXPRESSION@620..623 + 0: JS_REFERENCE_IDENTIFIER@620..623 + 0: IDENT@620..623 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@623..625 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@625..627 + 0: JS_REFERENCE_IDENTIFIER@625..627 + 0: IDENT@625..627 "T" [] [Whitespace(" ")] + 1: R_ANGLE@627..629 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@629..644 + 0: DELETE_KW@629..636 "delete" [] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@636..644 + 0: JS_IDENTIFIER_EXPRESSION@636..637 + 0: JS_REFERENCE_IDENTIFIER@636..637 + 0: IDENT@636..637 "a" [] [] + 1: (empty) + 2: L_BRACK@637..638 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@638..643 + 0: JS_REFERENCE_IDENTIFIER@638..643 + 0: IDENT@638..643 "field" [] [] + 4: R_BRACK@643..644 "]" [] [] + 1: SEMICOLON@644..645 ";" [] [] + 42: JS_EXPRESSION_STATEMENT@645..669 + 0: JS_BINARY_EXPRESSION@645..668 + 0: JS_BINARY_EXPRESSION@645..652 + 0: JS_IDENTIFIER_EXPRESSION@645..648 + 0: JS_REFERENCE_IDENTIFIER@645..648 + 0: IDENT@645..648 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@648..650 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@650..652 + 0: JS_REFERENCE_IDENTIFIER@650..652 + 0: IDENT@650..652 "T" [] [Whitespace(" ")] + 1: R_ANGLE@652..654 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@654..668 + 0: TYPEOF_KW@654..661 "typeof" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@661..668 + 0: JS_REFERENCE_IDENTIFIER@661..668 + 0: IDENT@661..668 "MyClass" [] [] + 1: SEMICOLON@668..669 ";" [] [] + 43: JS_EXPRESSION_STATEMENT@669..685 + 0: JS_BINARY_EXPRESSION@669..684 + 0: JS_BINARY_EXPRESSION@669..676 + 0: JS_IDENTIFIER_EXPRESSION@669..672 + 0: JS_REFERENCE_IDENTIFIER@669..672 + 0: IDENT@669..672 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@672..674 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@674..676 + 0: JS_REFERENCE_IDENTIFIER@674..676 + 0: IDENT@674..676 "T" [] [Whitespace(" ")] + 1: R_ANGLE@676..678 ">" [] [Whitespace(" ")] + 2: JS_UNARY_EXPRESSION@678..684 + 0: VOID_KW@678..683 "void" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@683..684 + 0: JS_REFERENCE_IDENTIFIER@683..684 + 0: IDENT@683..684 "a" [] [] + 1: SEMICOLON@684..685 ";" [] [] + 44: JS_EXPRESSION_STATEMENT@685..696 + 0: JS_BINARY_EXPRESSION@685..695 + 0: TS_INSTANTIATION_EXPRESSION@685..691 + 0: JS_IDENTIFIER_EXPRESSION@685..687 + 0: JS_REFERENCE_IDENTIFIER@685..687 + 0: IDENT@685..687 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@687..691 + 0: L_ANGLE@687..688 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@688..689 + 0: TS_REFERENCE_TYPE@688..689 + 0: JS_REFERENCE_IDENTIFIER@688..689 + 0: IDENT@688..689 "T" [] [] + 1: (empty) + 2: R_ANGLE@689..691 ">" [] [Whitespace(" ")] + 1: LTEQ@691..694 "<=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@694..695 + 0: JS_NUMBER_LITERAL@694..695 "1" [] [] + 1: SEMICOLON@695..696 ";" [] [] + 45: JS_EXPRESSION_STATEMENT@696..715 + 0: JS_CALL_EXPRESSION@696..714 + 0: JS_IDENTIFIER_EXPRESSION@696..699 + 0: JS_REFERENCE_IDENTIFIER@696..699 + 0: IDENT@696..699 "f" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@699..705 + 0: L_ANGLE@699..701 "<" [] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENT_LIST@701..703 + 0: TS_REFERENCE_TYPE@701..703 + 0: JS_REFERENCE_IDENTIFIER@701..703 + 0: IDENT@701..703 "T" [] [Whitespace(" ")] + 1: (empty) + 2: R_ANGLE@703..705 ">" [] [Whitespace(" ")] + 3: JS_CALL_ARGUMENTS@705..714 + 0: L_PAREN@705..706 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@706..713 + 0: JS_AWAIT_EXPRESSION@706..713 + 0: AWAIT_KW@706..712 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@712..713 + 0: JS_NUMBER_LITERAL@712..713 "1" [] [] + 2: R_PAREN@713..714 ")" [] [] + 1: SEMICOLON@714..715 ";" [] [] + 46: JS_EXPRESSION_STATEMENT@715..736 + 0: JS_BINARY_EXPRESSION@715..735 + 0: JS_BINARY_EXPRESSION@715..722 + 0: JS_IDENTIFIER_EXPRESSION@715..718 + 0: JS_REFERENCE_IDENTIFIER@715..718 + 0: IDENT@715..718 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@718..720 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@720..722 + 0: JS_REFERENCE_IDENTIFIER@720..722 + 0: IDENT@720..722 "T" [] [Whitespace(" ")] + 1: R_ANGLE@722..724 ">" [] [Whitespace(" ")] + 2: JS_IMPORT_META_EXPRESSION@724..735 + 0: IMPORT_KW@724..730 "import" [] [] + 1: DOT@730..731 "." [] [] + 2: META@731..735 "meta" [] [] + 1: SEMICOLON@735..736 ";" [] [] + 47: JS_EXPRESSION_STATEMENT@736..759 + 0: JS_BINARY_EXPRESSION@736..758 + 0: JS_BINARY_EXPRESSION@736..743 + 0: JS_IDENTIFIER_EXPRESSION@736..739 + 0: JS_REFERENCE_IDENTIFIER@736..739 + 0: IDENT@736..739 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@739..741 "<" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@741..743 + 0: JS_REFERENCE_IDENTIFIER@741..743 + 0: IDENT@741..743 "T" [] [Whitespace(" ")] + 1: R_ANGLE@743..745 ">" [] [Whitespace(" ")] + 2: JS_IMPORT_CALL_EXPRESSION@745..758 + 0: IMPORT_KW@745..751 "import" [] [] + 1: JS_CALL_ARGUMENTS@751..758 + 0: L_PAREN@751..752 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@752..757 + 0: JS_STRING_LITERAL_EXPRESSION@752..757 + 0: JS_STRING_LITERAL@752..757 "\"123\"" [] [] + 2: R_PAREN@757..758 ")" [] [] + 1: SEMICOLON@758..759 ";" [] [] + 48: JS_EXPRESSION_STATEMENT@759..771 + 0: JS_BINARY_EXPRESSION@759..770 + 0: JS_IDENTIFIER_EXPRESSION@759..762 + 0: JS_REFERENCE_IDENTIFIER@759..762 + 0: IDENT@759..762 "a" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@762..764 "<" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@764..770 + 0: JS_IDENTIFIER_EXPRESSION@764..766 + 0: JS_REFERENCE_IDENTIFIER@764..766 + 0: IDENT@764..766 "b" [] [Whitespace(" ")] + 1: SHR@766..769 ">>" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@769..770 + 0: JS_REFERENCE_IDENTIFIER@769..770 + 0: IDENT@769..770 "c" [] [] + 1: SEMICOLON@770..771 ";" [] [] + 49: JS_EXPRESSION_STATEMENT@771..794 + 0: JS_ASSIGNMENT_EXPRESSION@771..793 + 0: JS_IDENTIFIER_ASSIGNMENT@771..774 + 0: IDENT@771..774 "f" [Newline("\n")] [Whitespace(" ")] + 1: EQ@774..776 "=" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@776..793 + 0: JS_BINARY_EXPRESSION@776..784 + 0: JS_IDENTIFIER_EXPRESSION@776..778 + 0: JS_REFERENCE_IDENTIFIER@776..778 + 0: IDENT@776..778 "h" [] [Whitespace(" ")] + 1: USHR@778..782 ">>>" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@782..784 + 0: JS_NUMBER_LITERAL@782..784 "0" [] [Whitespace(" ")] + 1: L_ANGLE@784..786 "<" [] [Whitespace(" ")] + 2: JS_BINARY_EXPRESSION@786..793 + 0: JS_IDENTIFIER_EXPRESSION@786..788 + 0: JS_REFERENCE_IDENTIFIER@786..788 + 0: IDENT@786..788 "j" [] [Whitespace(" ")] + 1: USHR@788..792 ">>>" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@792..793 + 0: JS_NUMBER_LITERAL@792..793 "0" [] [] + 1: SEMICOLON@793..794 ";" [] [] + 4: EOF@794..795 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap new file mode 100644 index 000000000000..e043a2c90b46 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap @@ -0,0 +1,1308 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const x5 = f +let yy = 0; +const x6 = f +interface I {} +let x10 = f +this.bar() +let x11 = f +function bar() {} +let x12 = f +class C {} +let x13 = f +bar() +let x14 = f +void bar() +class C1 { + static specialFoo = f + static bar = 123 +} +class C2 { + public specialFoo = f + public bar = 123 +} +class C3 { + private specialFoo = f + private bar = 123 +} +class C4 { + protected specialFoo = f + protected bar = 123 +} +class C5 { + protected specialFoo = f + #bar = 123 +} +const Bar = Foo +const Baz = 123 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@0..6 "const" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..9 "x5" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@9..11 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@11..12 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@12..13 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@13..17 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@17..18 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@18..23 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@23..26 "yy" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@26..28 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@28..29 "0" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@29..30 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@30..37 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@37..40 "x6" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..43 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@43..44 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@44..48 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@48..49 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@49..60 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@60..62 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@62..63 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@63..64 "}" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@69..73 "x10" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@75..76 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@76..77 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@77..81 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@81..82 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@82..87 "this" [Newline("\n")] [], + }, + operator_token: DOT@87..88 "." [] [], + member: JsName { + value_token: IDENT@88..91 "bar" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@91..92 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@92..93 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@93..98 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@98..102 "x11" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@102..104 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@104..105 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@105..106 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@106..110 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@110..111 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@111..121 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@121..124 "bar" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@124..125 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@125..127 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@127..128 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@128..129 "}" [] [], + }, + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@129..134 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@134..138 "x12" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@138..140 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@140..141 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@141..142 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@142..146 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@146..147 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@147..154 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@154..156 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@156..157 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@157..158 "}" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@158..163 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@163..167 "x13" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@167..169 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@169..170 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@170..171 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@171..175 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@175..176 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@176..180 "bar" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@180..181 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@181..182 ")" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@182..187 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@187..191 "x14" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@191..193 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@193..194 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@194..195 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@195..199 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@199..200 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: VOID_KW@200..206 "void" [Newline("\n")] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@206..209 "bar" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@209..210 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@210..211 ")" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@211..218 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@218..221 "C1" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@221..222 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@222..234 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@234..245 "specialFoo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@245..247 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@247..248 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@248..249 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@249..255 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@255..256 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@256..268 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@268..272 "bar" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@272..274 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@274..277 "123" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@277..279 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@279..286 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@286..289 "C2" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@289..290 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@290..302 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@302..313 "specialFoo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@313..315 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@315..316 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@316..317 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@317..323 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@323..324 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@324..336 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@336..340 "bar" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@340..342 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@342..345 "123" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@345..347 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@347..354 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@354..357 "C3" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@357..358 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@358..371 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@371..382 "specialFoo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@382..384 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@384..385 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@385..386 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@386..392 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@392..393 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@393..406 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@406..410 "bar" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@410..412 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@412..415 "123" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@415..417 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@417..424 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@424..427 "C4" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@427..428 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@428..443 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@443..454 "specialFoo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@454..456 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@456..457 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@457..458 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@458..464 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@464..465 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@465..480 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@480..484 "bar" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@484..486 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@486..489 "123" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@489..491 "}" [Newline("\n")] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@491..498 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@498..501 "C5" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@501..502 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@502..517 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@517..528 "specialFoo" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@528..530 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@530..531 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@531..532 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@532..538 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@538..539 ">" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@539..545 "#" [Newline("\n"), Whitespace(" ")] [], + id_token: IDENT@545..549 "bar" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@549..551 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@551..554 "123" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@554..556 "}" [Newline("\n")] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@556..563 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@563..567 "Bar" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@567..569 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@569..572 "Foo" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@572..573 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@573..579 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@579..580 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@580..587 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@587..591 "Baz" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@591..593 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@593..596 "123" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@596..597 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..597 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..596 + 0: JS_VARIABLE_STATEMENT@0..18 + 0: JS_VARIABLE_DECLARATION@0..18 + 0: (empty) + 1: CONST_KW@0..6 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..18 + 0: JS_VARIABLE_DECLARATOR@6..18 + 0: JS_IDENTIFIER_BINDING@6..9 + 0: IDENT@6..9 "x5" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@9..18 + 0: EQ@9..11 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@11..18 + 0: JS_IDENTIFIER_EXPRESSION@11..12 + 0: JS_REFERENCE_IDENTIFIER@11..12 + 0: IDENT@11..12 "f" [] [] + 1: TS_TYPE_ARGUMENTS@12..18 + 0: L_ANGLE@12..13 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@13..17 + 0: TS_BOOLEAN_LITERAL_TYPE@13..17 + 0: TRUE_KW@13..17 "true" [] [] + 2: R_ANGLE@17..18 ">" [] [] + 1: (empty) + 1: JS_VARIABLE_STATEMENT@18..30 + 0: JS_VARIABLE_DECLARATION@18..29 + 0: (empty) + 1: LET_KW@18..23 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@23..29 + 0: JS_VARIABLE_DECLARATOR@23..29 + 0: JS_IDENTIFIER_BINDING@23..26 + 0: IDENT@23..26 "yy" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@26..29 + 0: EQ@26..28 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@28..29 + 0: JS_NUMBER_LITERAL@28..29 "0" [] [] + 1: SEMICOLON@29..30 ";" [] [] + 2: JS_VARIABLE_STATEMENT@30..49 + 0: JS_VARIABLE_DECLARATION@30..49 + 0: (empty) + 1: CONST_KW@30..37 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@37..49 + 0: JS_VARIABLE_DECLARATOR@37..49 + 0: JS_IDENTIFIER_BINDING@37..40 + 0: IDENT@37..40 "x6" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@40..49 + 0: EQ@40..42 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@42..49 + 0: JS_IDENTIFIER_EXPRESSION@42..43 + 0: JS_REFERENCE_IDENTIFIER@42..43 + 0: IDENT@42..43 "f" [] [] + 1: TS_TYPE_ARGUMENTS@43..49 + 0: L_ANGLE@43..44 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@44..48 + 0: TS_BOOLEAN_LITERAL_TYPE@44..48 + 0: TRUE_KW@44..48 "true" [] [] + 2: R_ANGLE@48..49 ">" [] [] + 1: (empty) + 3: TS_INTERFACE_DECLARATION@49..64 + 0: INTERFACE_KW@49..60 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@60..62 + 0: IDENT@60..62 "I" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@62..63 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@63..63 + 6: R_CURLY@63..64 "}" [] [] + 4: JS_VARIABLE_STATEMENT@64..82 + 0: JS_VARIABLE_DECLARATION@64..82 + 0: (empty) + 1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@69..82 + 0: JS_VARIABLE_DECLARATOR@69..82 + 0: JS_IDENTIFIER_BINDING@69..73 + 0: IDENT@69..73 "x10" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@73..82 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@75..82 + 0: JS_IDENTIFIER_EXPRESSION@75..76 + 0: JS_REFERENCE_IDENTIFIER@75..76 + 0: IDENT@75..76 "f" [] [] + 1: TS_TYPE_ARGUMENTS@76..82 + 0: L_ANGLE@76..77 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@77..81 + 0: TS_BOOLEAN_LITERAL_TYPE@77..81 + 0: TRUE_KW@77..81 "true" [] [] + 2: R_ANGLE@81..82 ">" [] [] + 1: (empty) + 5: JS_EXPRESSION_STATEMENT@82..93 + 0: JS_CALL_EXPRESSION@82..93 + 0: JS_STATIC_MEMBER_EXPRESSION@82..91 + 0: JS_THIS_EXPRESSION@82..87 + 0: THIS_KW@82..87 "this" [Newline("\n")] [] + 1: DOT@87..88 "." [] [] + 2: JS_NAME@88..91 + 0: IDENT@88..91 "bar" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@91..93 + 0: L_PAREN@91..92 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@92..92 + 2: R_PAREN@92..93 ")" [] [] + 1: (empty) + 6: JS_VARIABLE_STATEMENT@93..111 + 0: JS_VARIABLE_DECLARATION@93..111 + 0: (empty) + 1: LET_KW@93..98 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@98..111 + 0: JS_VARIABLE_DECLARATOR@98..111 + 0: JS_IDENTIFIER_BINDING@98..102 + 0: IDENT@98..102 "x11" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@102..111 + 0: EQ@102..104 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@104..111 + 0: JS_IDENTIFIER_EXPRESSION@104..105 + 0: JS_REFERENCE_IDENTIFIER@104..105 + 0: IDENT@104..105 "f" [] [] + 1: TS_TYPE_ARGUMENTS@105..111 + 0: L_ANGLE@105..106 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@106..110 + 0: TS_BOOLEAN_LITERAL_TYPE@106..110 + 0: TRUE_KW@106..110 "true" [] [] + 2: R_ANGLE@110..111 ">" [] [] + 1: (empty) + 7: JS_FUNCTION_DECLARATION@111..129 + 0: (empty) + 1: FUNCTION_KW@111..121 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@121..124 + 0: IDENT@121..124 "bar" [] [] + 4: (empty) + 5: JS_PARAMETERS@124..127 + 0: L_PAREN@124..125 "(" [] [] + 1: JS_PARAMETER_LIST@125..125 + 2: R_PAREN@125..127 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@127..129 + 0: L_CURLY@127..128 "{" [] [] + 1: JS_DIRECTIVE_LIST@128..128 + 2: JS_STATEMENT_LIST@128..128 + 3: R_CURLY@128..129 "}" [] [] + 8: JS_VARIABLE_STATEMENT@129..147 + 0: JS_VARIABLE_DECLARATION@129..147 + 0: (empty) + 1: LET_KW@129..134 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@134..147 + 0: JS_VARIABLE_DECLARATOR@134..147 + 0: JS_IDENTIFIER_BINDING@134..138 + 0: IDENT@134..138 "x12" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@138..147 + 0: EQ@138..140 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@140..147 + 0: JS_IDENTIFIER_EXPRESSION@140..141 + 0: JS_REFERENCE_IDENTIFIER@140..141 + 0: IDENT@140..141 "f" [] [] + 1: TS_TYPE_ARGUMENTS@141..147 + 0: L_ANGLE@141..142 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@142..146 + 0: TS_BOOLEAN_LITERAL_TYPE@142..146 + 0: TRUE_KW@142..146 "true" [] [] + 2: R_ANGLE@146..147 ">" [] [] + 1: (empty) + 9: JS_CLASS_DECLARATION@147..158 + 0: JS_DECORATOR_LIST@147..147 + 1: (empty) + 2: CLASS_KW@147..154 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@154..156 + 0: IDENT@154..156 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@156..157 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@157..157 + 9: R_CURLY@157..158 "}" [] [] + 10: JS_VARIABLE_STATEMENT@158..176 + 0: JS_VARIABLE_DECLARATION@158..176 + 0: (empty) + 1: LET_KW@158..163 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@163..176 + 0: JS_VARIABLE_DECLARATOR@163..176 + 0: JS_IDENTIFIER_BINDING@163..167 + 0: IDENT@163..167 "x13" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@167..176 + 0: EQ@167..169 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@169..176 + 0: JS_IDENTIFIER_EXPRESSION@169..170 + 0: JS_REFERENCE_IDENTIFIER@169..170 + 0: IDENT@169..170 "f" [] [] + 1: TS_TYPE_ARGUMENTS@170..176 + 0: L_ANGLE@170..171 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@171..175 + 0: TS_BOOLEAN_LITERAL_TYPE@171..175 + 0: TRUE_KW@171..175 "true" [] [] + 2: R_ANGLE@175..176 ">" [] [] + 1: (empty) + 11: JS_EXPRESSION_STATEMENT@176..182 + 0: JS_CALL_EXPRESSION@176..182 + 0: JS_IDENTIFIER_EXPRESSION@176..180 + 0: JS_REFERENCE_IDENTIFIER@176..180 + 0: IDENT@176..180 "bar" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@180..182 + 0: L_PAREN@180..181 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@181..181 + 2: R_PAREN@181..182 ")" [] [] + 1: (empty) + 12: JS_VARIABLE_STATEMENT@182..200 + 0: JS_VARIABLE_DECLARATION@182..200 + 0: (empty) + 1: LET_KW@182..187 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@187..200 + 0: JS_VARIABLE_DECLARATOR@187..200 + 0: JS_IDENTIFIER_BINDING@187..191 + 0: IDENT@187..191 "x14" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@191..200 + 0: EQ@191..193 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@193..200 + 0: JS_IDENTIFIER_EXPRESSION@193..194 + 0: JS_REFERENCE_IDENTIFIER@193..194 + 0: IDENT@193..194 "f" [] [] + 1: TS_TYPE_ARGUMENTS@194..200 + 0: L_ANGLE@194..195 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@195..199 + 0: TS_BOOLEAN_LITERAL_TYPE@195..199 + 0: TRUE_KW@195..199 "true" [] [] + 2: R_ANGLE@199..200 ">" [] [] + 1: (empty) + 13: JS_EXPRESSION_STATEMENT@200..211 + 0: JS_UNARY_EXPRESSION@200..211 + 0: VOID_KW@200..206 "void" [Newline("\n")] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@206..211 + 0: JS_IDENTIFIER_EXPRESSION@206..209 + 0: JS_REFERENCE_IDENTIFIER@206..209 + 0: IDENT@206..209 "bar" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@209..211 + 0: L_PAREN@209..210 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@210..210 + 2: R_PAREN@210..211 ")" [] [] + 1: (empty) + 14: JS_CLASS_DECLARATION@211..279 + 0: JS_DECORATOR_LIST@211..211 + 1: (empty) + 2: CLASS_KW@211..218 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@218..221 + 0: IDENT@218..221 "C1" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@221..222 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@222..277 + 0: JS_PROPERTY_CLASS_MEMBER@222..256 + 0: JS_PROPERTY_MODIFIER_LIST@222..234 + 0: JS_STATIC_MODIFIER@222..234 + 0: STATIC_KW@222..234 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@234..245 + 0: IDENT@234..245 "specialFoo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@245..256 + 0: EQ@245..247 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@247..256 + 0: JS_IDENTIFIER_EXPRESSION@247..248 + 0: JS_REFERENCE_IDENTIFIER@247..248 + 0: IDENT@247..248 "f" [] [] + 1: TS_TYPE_ARGUMENTS@248..256 + 0: L_ANGLE@248..249 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@249..255 + 0: TS_STRING_TYPE@249..255 + 0: STRING_KW@249..255 "string" [] [] + 2: R_ANGLE@255..256 ">" [] [] + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@256..277 + 0: JS_PROPERTY_MODIFIER_LIST@256..268 + 0: JS_STATIC_MODIFIER@256..268 + 0: STATIC_KW@256..268 "static" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@268..272 + 0: IDENT@268..272 "bar" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@272..277 + 0: EQ@272..274 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@274..277 + 0: JS_NUMBER_LITERAL@274..277 "123" [] [] + 4: (empty) + 9: R_CURLY@277..279 "}" [Newline("\n")] [] + 15: JS_CLASS_DECLARATION@279..347 + 0: JS_DECORATOR_LIST@279..279 + 1: (empty) + 2: CLASS_KW@279..286 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@286..289 + 0: IDENT@286..289 "C2" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@289..290 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@290..345 + 0: JS_PROPERTY_CLASS_MEMBER@290..324 + 0: JS_PROPERTY_MODIFIER_LIST@290..302 + 0: TS_ACCESSIBILITY_MODIFIER@290..302 + 0: PUBLIC_KW@290..302 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@302..313 + 0: IDENT@302..313 "specialFoo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@313..324 + 0: EQ@313..315 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@315..324 + 0: JS_IDENTIFIER_EXPRESSION@315..316 + 0: JS_REFERENCE_IDENTIFIER@315..316 + 0: IDENT@315..316 "f" [] [] + 1: TS_TYPE_ARGUMENTS@316..324 + 0: L_ANGLE@316..317 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@317..323 + 0: TS_STRING_TYPE@317..323 + 0: STRING_KW@317..323 "string" [] [] + 2: R_ANGLE@323..324 ">" [] [] + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@324..345 + 0: JS_PROPERTY_MODIFIER_LIST@324..336 + 0: TS_ACCESSIBILITY_MODIFIER@324..336 + 0: PUBLIC_KW@324..336 "public" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@336..340 + 0: IDENT@336..340 "bar" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@340..345 + 0: EQ@340..342 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@342..345 + 0: JS_NUMBER_LITERAL@342..345 "123" [] [] + 4: (empty) + 9: R_CURLY@345..347 "}" [Newline("\n")] [] + 16: JS_CLASS_DECLARATION@347..417 + 0: JS_DECORATOR_LIST@347..347 + 1: (empty) + 2: CLASS_KW@347..354 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@354..357 + 0: IDENT@354..357 "C3" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@357..358 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@358..415 + 0: JS_PROPERTY_CLASS_MEMBER@358..393 + 0: JS_PROPERTY_MODIFIER_LIST@358..371 + 0: TS_ACCESSIBILITY_MODIFIER@358..371 + 0: PRIVATE_KW@358..371 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@371..382 + 0: IDENT@371..382 "specialFoo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@382..393 + 0: EQ@382..384 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@384..393 + 0: JS_IDENTIFIER_EXPRESSION@384..385 + 0: JS_REFERENCE_IDENTIFIER@384..385 + 0: IDENT@384..385 "f" [] [] + 1: TS_TYPE_ARGUMENTS@385..393 + 0: L_ANGLE@385..386 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@386..392 + 0: TS_STRING_TYPE@386..392 + 0: STRING_KW@386..392 "string" [] [] + 2: R_ANGLE@392..393 ">" [] [] + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@393..415 + 0: JS_PROPERTY_MODIFIER_LIST@393..406 + 0: TS_ACCESSIBILITY_MODIFIER@393..406 + 0: PRIVATE_KW@393..406 "private" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@406..410 + 0: IDENT@406..410 "bar" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@410..415 + 0: EQ@410..412 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@412..415 + 0: JS_NUMBER_LITERAL@412..415 "123" [] [] + 4: (empty) + 9: R_CURLY@415..417 "}" [Newline("\n")] [] + 17: JS_CLASS_DECLARATION@417..491 + 0: JS_DECORATOR_LIST@417..417 + 1: (empty) + 2: CLASS_KW@417..424 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@424..427 + 0: IDENT@424..427 "C4" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@427..428 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@428..489 + 0: JS_PROPERTY_CLASS_MEMBER@428..465 + 0: JS_PROPERTY_MODIFIER_LIST@428..443 + 0: TS_ACCESSIBILITY_MODIFIER@428..443 + 0: PROTECTED_KW@428..443 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@443..454 + 0: IDENT@443..454 "specialFoo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@454..465 + 0: EQ@454..456 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@456..465 + 0: JS_IDENTIFIER_EXPRESSION@456..457 + 0: JS_REFERENCE_IDENTIFIER@456..457 + 0: IDENT@456..457 "f" [] [] + 1: TS_TYPE_ARGUMENTS@457..465 + 0: L_ANGLE@457..458 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@458..464 + 0: TS_STRING_TYPE@458..464 + 0: STRING_KW@458..464 "string" [] [] + 2: R_ANGLE@464..465 ">" [] [] + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@465..489 + 0: JS_PROPERTY_MODIFIER_LIST@465..480 + 0: TS_ACCESSIBILITY_MODIFIER@465..480 + 0: PROTECTED_KW@465..480 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@480..484 + 0: IDENT@480..484 "bar" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@484..489 + 0: EQ@484..486 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@486..489 + 0: JS_NUMBER_LITERAL@486..489 "123" [] [] + 4: (empty) + 9: R_CURLY@489..491 "}" [Newline("\n")] [] + 18: JS_CLASS_DECLARATION@491..556 + 0: JS_DECORATOR_LIST@491..491 + 1: (empty) + 2: CLASS_KW@491..498 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@498..501 + 0: IDENT@498..501 "C5" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@501..502 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@502..554 + 0: JS_PROPERTY_CLASS_MEMBER@502..539 + 0: JS_PROPERTY_MODIFIER_LIST@502..517 + 0: TS_ACCESSIBILITY_MODIFIER@502..517 + 0: PROTECTED_KW@502..517 "protected" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@517..528 + 0: IDENT@517..528 "specialFoo" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@528..539 + 0: EQ@528..530 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@530..539 + 0: JS_IDENTIFIER_EXPRESSION@530..531 + 0: JS_REFERENCE_IDENTIFIER@530..531 + 0: IDENT@530..531 "f" [] [] + 1: TS_TYPE_ARGUMENTS@531..539 + 0: L_ANGLE@531..532 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@532..538 + 0: TS_STRING_TYPE@532..538 + 0: STRING_KW@532..538 "string" [] [] + 2: R_ANGLE@538..539 ">" [] [] + 4: (empty) + 1: JS_PROPERTY_CLASS_MEMBER@539..554 + 0: JS_PROPERTY_MODIFIER_LIST@539..539 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@539..549 + 0: HASH@539..545 "#" [Newline("\n"), Whitespace(" ")] [] + 1: IDENT@545..549 "bar" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@549..554 + 0: EQ@549..551 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@551..554 + 0: JS_NUMBER_LITERAL@551..554 "123" [] [] + 4: (empty) + 9: R_CURLY@554..556 "}" [Newline("\n")] [] + 19: JS_VARIABLE_STATEMENT@556..580 + 0: JS_VARIABLE_DECLARATION@556..580 + 0: (empty) + 1: CONST_KW@556..563 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@563..580 + 0: JS_VARIABLE_DECLARATOR@563..580 + 0: JS_IDENTIFIER_BINDING@563..567 + 0: IDENT@563..567 "Bar" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@567..580 + 0: EQ@567..569 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@569..580 + 0: JS_IDENTIFIER_EXPRESSION@569..572 + 0: JS_REFERENCE_IDENTIFIER@569..572 + 0: IDENT@569..572 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@572..580 + 0: L_ANGLE@572..573 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@573..579 + 0: TS_STRING_TYPE@573..579 + 0: STRING_KW@573..579 "string" [] [] + 2: R_ANGLE@579..580 ">" [] [] + 1: (empty) + 20: JS_VARIABLE_STATEMENT@580..596 + 0: JS_VARIABLE_DECLARATION@580..596 + 0: (empty) + 1: CONST_KW@580..587 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@587..596 + 0: JS_VARIABLE_DECLARATOR@587..596 + 0: JS_IDENTIFIER_BINDING@587..591 + 0: IDENT@587..591 "Baz" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@591..596 + 0: EQ@591..593 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@593..596 + 0: JS_NUMBER_LITERAL@593..596 "123" [] [] + 1: (empty) + 4: EOF@596..597 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap new file mode 100644 index 000000000000..d97bfe2cf7d0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap @@ -0,0 +1,2751 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + constructor() { + f + super(); + } +} +function *f() { + const f = f + yield; +} +f +?? 1; +f +|| 1; +f +&& 1; +f +| 1; +f +^ 1; +f +& 1; +f +== f; +f +<= f; +f +!= f; +f +=== f; +f +!== f; +f +instanceof f; +f +in {}; +f +* f; +f +/ f; +f +% f; +f +** f; +f ++f; +f +-f; +f +this; +f +null; +f +true; +f +false; +f +1; +f +123n; +f +{}; +f +function test() {}; +f +class A {}; +f +new A(); +f +/ 1; +f ++1; +f +-1; +f +~1; +f +!1; +f +someIdentifier; +f +delete a[field]; +f +typeof MyClass; +f +void a; +f +<= 1; +f +(await 1); +f +import.meta; +f +import("123"); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@25..26 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@31..32 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@32..33 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@33..34 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsSuperExpression { + super_token: SUPER_KW@34..45 "super" [Newline("\n"), Whitespace(" ")] [], + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@45..46 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@46..47 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + ], + r_curly_token: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@51..53 "}" [Newline("\n")] [], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@53..63 "function" [Newline("\n")] [Whitespace(" ")], + star_token: STAR@63..64 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@64..65 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@65..66 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@68..69 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@69..80 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@80..82 "f" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@82..84 "=" [] [Whitespace(" ")], + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@84..85 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@85..86 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@86..87 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@87..88 ">" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@88..98 "yield" [Newline("\n"), Whitespace(" ")] [], + argument: missing (optional), + }, + semicolon_token: SEMICOLON@98..99 ";" [] [], + }, + ], + r_curly_token: R_CURLY@99..101 "}" [Newline("\n")] [], + }, + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@101..103 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@103..104 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@104..105 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@105..106 ">" [] [], + }, + }, + operator_token: QUESTION2@106..110 "??" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@110..111 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@112..114 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@114..115 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@115..116 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@116..117 ">" [] [], + }, + }, + operator_token: PIPE2@117..121 "||" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@121..122 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@122..123 ";" [] [], + }, + JsExpressionStatement { + expression: JsLogicalExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@123..125 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@125..126 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@126..127 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@127..128 ">" [] [], + }, + }, + operator_token: AMP2@128..132 "&&" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@132..133 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@133..134 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@134..136 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@136..137 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@137..138 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@138..139 ">" [] [], + }, + }, + operator_token: PIPE@139..142 "|" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@142..143 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@143..144 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@144..146 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@146..147 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@147..148 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@148..149 ">" [] [], + }, + }, + operator_token: CARET@149..152 "^" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@152..153 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@153..154 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@154..156 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@156..157 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@157..158 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@158..159 ">" [] [], + }, + }, + operator_token: AMP@159..162 "&" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@162..163 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@163..164 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@164..166 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@166..167 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@167..168 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@168..169 ">" [] [], + }, + }, + operator_token: EQ2@169..173 "==" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@173..174 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@174..175 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@175..176 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@176..177 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@177..178 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@178..180 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@180..181 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@181..182 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@182..183 ">" [] [], + }, + }, + operator_token: LTEQ@183..187 "<=" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@187..188 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@188..189 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@189..190 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@190..191 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@191..192 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@192..194 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@194..195 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@195..196 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@196..197 ">" [] [], + }, + }, + operator_token: NEQ@197..201 "!=" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@201..202 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@202..203 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@203..204 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@204..205 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@205..206 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@206..208 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@208..209 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@209..210 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@210..211 ">" [] [], + }, + }, + operator_token: EQ3@211..216 "===" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@216..217 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@217..218 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@218..219 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@219..220 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@220..221 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@221..223 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@223..224 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@224..225 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@225..226 ">" [] [], + }, + }, + operator_token: NEQ2@226..231 "!==" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@231..232 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@232..233 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@233..234 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@234..235 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@235..236 ";" [] [], + }, + JsExpressionStatement { + expression: JsInstanceofExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@236..238 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@238..239 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@239..240 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@240..241 ">" [] [], + }, + }, + instanceof_token: INSTANCEOF_KW@241..253 "instanceof" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@253..254 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@254..255 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@255..256 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@256..257 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@257..258 ";" [] [], + }, + JsExpressionStatement { + expression: JsInExpression { + property: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@258..260 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@260..261 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@261..262 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@262..263 ">" [] [], + }, + }, + in_token: IN_KW@263..267 "in" [Newline("\n")] [Whitespace(" ")], + object: JsObjectExpression { + l_curly_token: L_CURLY@267..268 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@268..269 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@269..270 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@270..272 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@272..273 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@273..274 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@274..275 ">" [] [], + }, + }, + operator_token: STAR@275..278 "*" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@278..279 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@279..280 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@280..281 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@281..282 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@282..283 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@283..285 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@285..286 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@286..287 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@287..288 ">" [] [], + }, + }, + operator_token: SLASH@288..291 "/" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@291..292 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@292..293 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@293..294 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@294..295 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@295..296 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@296..298 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@298..299 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@299..300 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@300..301 ">" [] [], + }, + }, + operator_token: PERCENT@301..304 "%" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@304..305 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@305..306 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@306..307 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@307..308 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@308..309 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@309..311 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@311..312 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@312..313 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@313..314 ">" [] [], + }, + }, + operator_token: STAR2@314..318 "**" [Newline("\n")] [Whitespace(" ")], + right: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@318..319 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@319..320 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@320..321 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@321..322 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@322..323 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@323..326 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@326..327 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@327..328 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@328..329 ">" [] [], + right: JsUnaryExpression { + operator_token: PLUS@329..331 "+" [Newline("\n")] [], + argument: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@331..332 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@332..333 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@333..334 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@334..335 ">" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@335..336 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@336..339 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@339..340 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@340..341 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@341..342 ">" [] [], + right: JsUnaryExpression { + operator_token: MINUS@342..344 "-" [Newline("\n")] [], + argument: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@344..345 "f" [] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@345..346 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@346..347 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@347..348 ">" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@348..349 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@349..352 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@352..353 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@353..354 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@354..355 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsThisExpression { + this_token: THIS_KW@355..360 "this" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@360..361 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@361..364 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@364..365 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@365..366 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@366..367 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNullLiteralExpression { + value_token: NULL_KW@367..372 "null" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@372..373 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@373..376 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@376..377 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@377..378 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@378..379 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@379..384 "true" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@384..385 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@385..388 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@388..389 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@389..390 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@390..391 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBooleanLiteralExpression { + value_token: FALSE_KW@391..397 "false" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@397..398 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@398..401 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@401..402 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@402..403 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@403..404 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@404..406 "1" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@406..407 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@407..410 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@410..411 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@411..412 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@412..413 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBigintLiteralExpression { + value_token: JS_BIGINT_LITERAL@413..418 "123n" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@418..419 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@419..422 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@422..423 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@423..424 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@424..425 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsBlockStatement { + l_curly_token: L_CURLY@425..427 "{" [Newline("\n")] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@427..428 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@428..429 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@429..432 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@432..433 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@433..434 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@434..435 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@435..445 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@445..449 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@449..450 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@450..452 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@452..453 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@453..454 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@454..455 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@455..458 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@458..459 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@459..460 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@460..461 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@461..468 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@468..470 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@470..471 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@471..472 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@472..473 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@476..477 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@477..478 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@478..479 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@479..484 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@484..485 "A" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@485..486 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@486..487 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@487..488 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@488..490 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@490..491 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@491..492 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@492..493 ">" [] [], + }, + }, + operator_token: SLASH@493..496 "/" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@496..497 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@497..498 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@498..501 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@501..502 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@502..503 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@503..504 ">" [] [], + right: JsUnaryExpression { + operator_token: PLUS@504..506 "+" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@506..507 "1" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@507..508 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@508..511 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@511..512 "<" [] [], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@512..513 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@513..514 ">" [] [], + right: JsUnaryExpression { + operator_token: MINUS@514..516 "-" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@516..517 "1" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@517..518 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@518..521 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@521..522 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@522..523 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@523..524 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: TILDE@524..526 "~" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@526..527 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@527..528 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@528..531 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@531..532 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@532..533 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@533..534 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: BANG@534..536 "!" [Newline("\n")] [], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@536..537 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@537..538 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@538..541 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@541..542 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@542..543 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@543..544 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@544..559 "someIdentifier" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@559..560 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@563..564 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@564..565 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@565..566 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@566..574 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@574..575 "a" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@575..576 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@576..581 "field" [] [], + }, + }, + r_brack_token: R_BRACK@581..582 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@582..583 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@583..586 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@586..587 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@587..588 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@588..589 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: TYPEOF_KW@589..597 "typeof" [Newline("\n")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@597..604 "MyClass" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@604..605 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@605..608 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@608..609 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@609..610 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@610..611 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: VOID_KW@611..617 "void" [Newline("\n")] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@617..618 "a" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@618..619 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@619..621 "f" [Newline("\n")] [], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@621..622 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@622..623 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@623..624 ">" [] [], + }, + }, + operator_token: LTEQ@624..628 "<=" [Newline("\n")] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@628..629 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@629..630 ";" [] [], + }, + JsExpressionStatement { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@630..633 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@633..634 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@634..635 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@635..636 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@636..638 "(" [Newline("\n")] [], + args: JsCallArgumentList [ + JsAwaitExpression { + await_token: AWAIT_KW@638..644 "await" [] [Whitespace(" ")], + argument: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@644..645 "1" [] [], + }, + }, + ], + r_paren_token: R_PAREN@645..646 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@646..647 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@647..650 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@650..651 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@651..652 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@652..653 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsImportMetaExpression { + import_token: IMPORT_KW@653..660 "import" [Newline("\n")] [], + dot_token: DOT@660..661 "." [] [], + meta_token: META@661..665 "meta" [] [], + }, + semicolon_token: SEMICOLON@665..666 ";" [] [], + }, + JsExpressionStatement { + expression: TsInstantiationExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@666..669 "f" [Newline("\n")] [Whitespace(" ")], + }, + }, + arguments: TsTypeArguments { + l_angle_token: L_ANGLE@669..670 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@670..671 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@671..672 ">" [] [], + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsImportCallExpression { + import_token: IMPORT_KW@672..679 "import" [Newline("\n")] [], + arguments: JsCallArguments { + l_paren_token: L_PAREN@679..680 "(" [] [], + args: JsCallArgumentList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@680..685 "\"123\"" [] [], + }, + ], + r_paren_token: R_PAREN@685..686 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@686..687 ";" [] [], + }, + ], + eof_token: EOF@687..688 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..688 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..687 + 0: JS_CLASS_DECLARATION@0..53 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..51 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@9..51 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@9..9 + 1: JS_LITERAL_MEMBER_NAME@9..22 + 0: IDENT@9..22 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@25..51 + 0: L_CURLY@25..26 "{" [] [] + 1: JS_DIRECTIVE_LIST@26..26 + 2: JS_STATEMENT_LIST@26..48 + 0: JS_EXPRESSION_STATEMENT@26..34 + 0: TS_INSTANTIATION_EXPRESSION@26..34 + 0: JS_IDENTIFIER_EXPRESSION@26..31 + 0: JS_REFERENCE_IDENTIFIER@26..31 + 0: IDENT@26..31 "f" [Newline("\n"), Whitespace(" ")] [] + 1: TS_TYPE_ARGUMENTS@31..34 + 0: L_ANGLE@31..32 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@32..33 + 0: TS_REFERENCE_TYPE@32..33 + 0: JS_REFERENCE_IDENTIFIER@32..33 + 0: IDENT@32..33 "T" [] [] + 1: (empty) + 2: R_ANGLE@33..34 ">" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@34..48 + 0: JS_CALL_EXPRESSION@34..47 + 0: JS_SUPER_EXPRESSION@34..45 + 0: SUPER_KW@34..45 "super" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@45..47 + 0: L_PAREN@45..46 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@46..46 + 2: R_PAREN@46..47 ")" [] [] + 1: SEMICOLON@47..48 ";" [] [] + 3: R_CURLY@48..51 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@51..53 "}" [Newline("\n")] [] + 1: JS_FUNCTION_DECLARATION@53..101 + 0: (empty) + 1: FUNCTION_KW@53..63 "function" [Newline("\n")] [Whitespace(" ")] + 2: STAR@63..64 "*" [] [] + 3: JS_IDENTIFIER_BINDING@64..65 + 0: IDENT@64..65 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@65..68 + 0: L_PAREN@65..66 "(" [] [] + 1: JS_PARAMETER_LIST@66..66 + 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@68..101 + 0: L_CURLY@68..69 "{" [] [] + 1: JS_DIRECTIVE_LIST@69..69 + 2: JS_STATEMENT_LIST@69..99 + 0: JS_VARIABLE_STATEMENT@69..88 + 0: JS_VARIABLE_DECLARATION@69..88 + 0: (empty) + 1: CONST_KW@69..80 "const" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@80..88 + 0: JS_VARIABLE_DECLARATOR@80..88 + 0: JS_IDENTIFIER_BINDING@80..82 + 0: IDENT@80..82 "f" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@82..88 + 0: EQ@82..84 "=" [] [Whitespace(" ")] + 1: TS_INSTANTIATION_EXPRESSION@84..88 + 0: JS_IDENTIFIER_EXPRESSION@84..85 + 0: JS_REFERENCE_IDENTIFIER@84..85 + 0: IDENT@84..85 "f" [] [] + 1: TS_TYPE_ARGUMENTS@85..88 + 0: L_ANGLE@85..86 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@86..87 + 0: TS_REFERENCE_TYPE@86..87 + 0: JS_REFERENCE_IDENTIFIER@86..87 + 0: IDENT@86..87 "T" [] [] + 1: (empty) + 2: R_ANGLE@87..88 ">" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@88..99 + 0: JS_YIELD_EXPRESSION@88..98 + 0: YIELD_KW@88..98 "yield" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 1: SEMICOLON@98..99 ";" [] [] + 3: R_CURLY@99..101 "}" [Newline("\n")] [] + 2: JS_EXPRESSION_STATEMENT@101..112 + 0: JS_LOGICAL_EXPRESSION@101..111 + 0: TS_INSTANTIATION_EXPRESSION@101..106 + 0: JS_IDENTIFIER_EXPRESSION@101..103 + 0: JS_REFERENCE_IDENTIFIER@101..103 + 0: IDENT@101..103 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@103..106 + 0: L_ANGLE@103..104 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@104..105 + 0: TS_REFERENCE_TYPE@104..105 + 0: JS_REFERENCE_IDENTIFIER@104..105 + 0: IDENT@104..105 "T" [] [] + 1: (empty) + 2: R_ANGLE@105..106 ">" [] [] + 1: QUESTION2@106..110 "??" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@110..111 + 0: JS_NUMBER_LITERAL@110..111 "1" [] [] + 1: SEMICOLON@111..112 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@112..123 + 0: JS_LOGICAL_EXPRESSION@112..122 + 0: TS_INSTANTIATION_EXPRESSION@112..117 + 0: JS_IDENTIFIER_EXPRESSION@112..114 + 0: JS_REFERENCE_IDENTIFIER@112..114 + 0: IDENT@112..114 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@114..117 + 0: L_ANGLE@114..115 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@115..116 + 0: TS_REFERENCE_TYPE@115..116 + 0: JS_REFERENCE_IDENTIFIER@115..116 + 0: IDENT@115..116 "T" [] [] + 1: (empty) + 2: R_ANGLE@116..117 ">" [] [] + 1: PIPE2@117..121 "||" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@121..122 + 0: JS_NUMBER_LITERAL@121..122 "1" [] [] + 1: SEMICOLON@122..123 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@123..134 + 0: JS_LOGICAL_EXPRESSION@123..133 + 0: TS_INSTANTIATION_EXPRESSION@123..128 + 0: JS_IDENTIFIER_EXPRESSION@123..125 + 0: JS_REFERENCE_IDENTIFIER@123..125 + 0: IDENT@123..125 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@125..128 + 0: L_ANGLE@125..126 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@126..127 + 0: TS_REFERENCE_TYPE@126..127 + 0: JS_REFERENCE_IDENTIFIER@126..127 + 0: IDENT@126..127 "T" [] [] + 1: (empty) + 2: R_ANGLE@127..128 ">" [] [] + 1: AMP2@128..132 "&&" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@132..133 + 0: JS_NUMBER_LITERAL@132..133 "1" [] [] + 1: SEMICOLON@133..134 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@134..144 + 0: JS_BINARY_EXPRESSION@134..143 + 0: TS_INSTANTIATION_EXPRESSION@134..139 + 0: JS_IDENTIFIER_EXPRESSION@134..136 + 0: JS_REFERENCE_IDENTIFIER@134..136 + 0: IDENT@134..136 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@136..139 + 0: L_ANGLE@136..137 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@137..138 + 0: TS_REFERENCE_TYPE@137..138 + 0: JS_REFERENCE_IDENTIFIER@137..138 + 0: IDENT@137..138 "T" [] [] + 1: (empty) + 2: R_ANGLE@138..139 ">" [] [] + 1: PIPE@139..142 "|" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@142..143 + 0: JS_NUMBER_LITERAL@142..143 "1" [] [] + 1: SEMICOLON@143..144 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@144..154 + 0: JS_BINARY_EXPRESSION@144..153 + 0: TS_INSTANTIATION_EXPRESSION@144..149 + 0: JS_IDENTIFIER_EXPRESSION@144..146 + 0: JS_REFERENCE_IDENTIFIER@144..146 + 0: IDENT@144..146 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@146..149 + 0: L_ANGLE@146..147 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@147..148 + 0: TS_REFERENCE_TYPE@147..148 + 0: JS_REFERENCE_IDENTIFIER@147..148 + 0: IDENT@147..148 "T" [] [] + 1: (empty) + 2: R_ANGLE@148..149 ">" [] [] + 1: CARET@149..152 "^" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@152..153 + 0: JS_NUMBER_LITERAL@152..153 "1" [] [] + 1: SEMICOLON@153..154 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@154..164 + 0: JS_BINARY_EXPRESSION@154..163 + 0: TS_INSTANTIATION_EXPRESSION@154..159 + 0: JS_IDENTIFIER_EXPRESSION@154..156 + 0: JS_REFERENCE_IDENTIFIER@154..156 + 0: IDENT@154..156 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@156..159 + 0: L_ANGLE@156..157 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@157..158 + 0: TS_REFERENCE_TYPE@157..158 + 0: JS_REFERENCE_IDENTIFIER@157..158 + 0: IDENT@157..158 "T" [] [] + 1: (empty) + 2: R_ANGLE@158..159 ">" [] [] + 1: AMP@159..162 "&" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@162..163 + 0: JS_NUMBER_LITERAL@162..163 "1" [] [] + 1: SEMICOLON@163..164 ";" [] [] + 8: JS_EXPRESSION_STATEMENT@164..178 + 0: JS_BINARY_EXPRESSION@164..177 + 0: TS_INSTANTIATION_EXPRESSION@164..169 + 0: JS_IDENTIFIER_EXPRESSION@164..166 + 0: JS_REFERENCE_IDENTIFIER@164..166 + 0: IDENT@164..166 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@166..169 + 0: L_ANGLE@166..167 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@167..168 + 0: TS_REFERENCE_TYPE@167..168 + 0: JS_REFERENCE_IDENTIFIER@167..168 + 0: IDENT@167..168 "T" [] [] + 1: (empty) + 2: R_ANGLE@168..169 ">" [] [] + 1: EQ2@169..173 "==" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@173..177 + 0: JS_IDENTIFIER_EXPRESSION@173..174 + 0: JS_REFERENCE_IDENTIFIER@173..174 + 0: IDENT@173..174 "f" [] [] + 1: TS_TYPE_ARGUMENTS@174..177 + 0: L_ANGLE@174..175 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@175..176 + 0: TS_REFERENCE_TYPE@175..176 + 0: JS_REFERENCE_IDENTIFIER@175..176 + 0: IDENT@175..176 "T" [] [] + 1: (empty) + 2: R_ANGLE@176..177 ">" [] [] + 1: SEMICOLON@177..178 ";" [] [] + 9: JS_EXPRESSION_STATEMENT@178..192 + 0: JS_BINARY_EXPRESSION@178..191 + 0: TS_INSTANTIATION_EXPRESSION@178..183 + 0: JS_IDENTIFIER_EXPRESSION@178..180 + 0: JS_REFERENCE_IDENTIFIER@178..180 + 0: IDENT@178..180 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@180..183 + 0: L_ANGLE@180..181 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@181..182 + 0: TS_REFERENCE_TYPE@181..182 + 0: JS_REFERENCE_IDENTIFIER@181..182 + 0: IDENT@181..182 "T" [] [] + 1: (empty) + 2: R_ANGLE@182..183 ">" [] [] + 1: LTEQ@183..187 "<=" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@187..191 + 0: JS_IDENTIFIER_EXPRESSION@187..188 + 0: JS_REFERENCE_IDENTIFIER@187..188 + 0: IDENT@187..188 "f" [] [] + 1: TS_TYPE_ARGUMENTS@188..191 + 0: L_ANGLE@188..189 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@189..190 + 0: TS_REFERENCE_TYPE@189..190 + 0: JS_REFERENCE_IDENTIFIER@189..190 + 0: IDENT@189..190 "T" [] [] + 1: (empty) + 2: R_ANGLE@190..191 ">" [] [] + 1: SEMICOLON@191..192 ";" [] [] + 10: JS_EXPRESSION_STATEMENT@192..206 + 0: JS_BINARY_EXPRESSION@192..205 + 0: TS_INSTANTIATION_EXPRESSION@192..197 + 0: JS_IDENTIFIER_EXPRESSION@192..194 + 0: JS_REFERENCE_IDENTIFIER@192..194 + 0: IDENT@192..194 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@194..197 + 0: L_ANGLE@194..195 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@195..196 + 0: TS_REFERENCE_TYPE@195..196 + 0: JS_REFERENCE_IDENTIFIER@195..196 + 0: IDENT@195..196 "T" [] [] + 1: (empty) + 2: R_ANGLE@196..197 ">" [] [] + 1: NEQ@197..201 "!=" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@201..205 + 0: JS_IDENTIFIER_EXPRESSION@201..202 + 0: JS_REFERENCE_IDENTIFIER@201..202 + 0: IDENT@201..202 "f" [] [] + 1: TS_TYPE_ARGUMENTS@202..205 + 0: L_ANGLE@202..203 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@203..204 + 0: TS_REFERENCE_TYPE@203..204 + 0: JS_REFERENCE_IDENTIFIER@203..204 + 0: IDENT@203..204 "T" [] [] + 1: (empty) + 2: R_ANGLE@204..205 ">" [] [] + 1: SEMICOLON@205..206 ";" [] [] + 11: JS_EXPRESSION_STATEMENT@206..221 + 0: JS_BINARY_EXPRESSION@206..220 + 0: TS_INSTANTIATION_EXPRESSION@206..211 + 0: JS_IDENTIFIER_EXPRESSION@206..208 + 0: JS_REFERENCE_IDENTIFIER@206..208 + 0: IDENT@206..208 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@208..211 + 0: L_ANGLE@208..209 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@209..210 + 0: TS_REFERENCE_TYPE@209..210 + 0: JS_REFERENCE_IDENTIFIER@209..210 + 0: IDENT@209..210 "T" [] [] + 1: (empty) + 2: R_ANGLE@210..211 ">" [] [] + 1: EQ3@211..216 "===" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@216..220 + 0: JS_IDENTIFIER_EXPRESSION@216..217 + 0: JS_REFERENCE_IDENTIFIER@216..217 + 0: IDENT@216..217 "f" [] [] + 1: TS_TYPE_ARGUMENTS@217..220 + 0: L_ANGLE@217..218 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@218..219 + 0: TS_REFERENCE_TYPE@218..219 + 0: JS_REFERENCE_IDENTIFIER@218..219 + 0: IDENT@218..219 "T" [] [] + 1: (empty) + 2: R_ANGLE@219..220 ">" [] [] + 1: SEMICOLON@220..221 ";" [] [] + 12: JS_EXPRESSION_STATEMENT@221..236 + 0: JS_BINARY_EXPRESSION@221..235 + 0: TS_INSTANTIATION_EXPRESSION@221..226 + 0: JS_IDENTIFIER_EXPRESSION@221..223 + 0: JS_REFERENCE_IDENTIFIER@221..223 + 0: IDENT@221..223 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@223..226 + 0: L_ANGLE@223..224 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@224..225 + 0: TS_REFERENCE_TYPE@224..225 + 0: JS_REFERENCE_IDENTIFIER@224..225 + 0: IDENT@224..225 "T" [] [] + 1: (empty) + 2: R_ANGLE@225..226 ">" [] [] + 1: NEQ2@226..231 "!==" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@231..235 + 0: JS_IDENTIFIER_EXPRESSION@231..232 + 0: JS_REFERENCE_IDENTIFIER@231..232 + 0: IDENT@231..232 "f" [] [] + 1: TS_TYPE_ARGUMENTS@232..235 + 0: L_ANGLE@232..233 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@233..234 + 0: TS_REFERENCE_TYPE@233..234 + 0: JS_REFERENCE_IDENTIFIER@233..234 + 0: IDENT@233..234 "T" [] [] + 1: (empty) + 2: R_ANGLE@234..235 ">" [] [] + 1: SEMICOLON@235..236 ";" [] [] + 13: JS_EXPRESSION_STATEMENT@236..258 + 0: JS_INSTANCEOF_EXPRESSION@236..257 + 0: TS_INSTANTIATION_EXPRESSION@236..241 + 0: JS_IDENTIFIER_EXPRESSION@236..238 + 0: JS_REFERENCE_IDENTIFIER@236..238 + 0: IDENT@236..238 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@238..241 + 0: L_ANGLE@238..239 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@239..240 + 0: TS_REFERENCE_TYPE@239..240 + 0: JS_REFERENCE_IDENTIFIER@239..240 + 0: IDENT@239..240 "T" [] [] + 1: (empty) + 2: R_ANGLE@240..241 ">" [] [] + 1: INSTANCEOF_KW@241..253 "instanceof" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@253..257 + 0: JS_IDENTIFIER_EXPRESSION@253..254 + 0: JS_REFERENCE_IDENTIFIER@253..254 + 0: IDENT@253..254 "f" [] [] + 1: TS_TYPE_ARGUMENTS@254..257 + 0: L_ANGLE@254..255 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@255..256 + 0: TS_REFERENCE_TYPE@255..256 + 0: JS_REFERENCE_IDENTIFIER@255..256 + 0: IDENT@255..256 "T" [] [] + 1: (empty) + 2: R_ANGLE@256..257 ">" [] [] + 1: SEMICOLON@257..258 ";" [] [] + 14: JS_EXPRESSION_STATEMENT@258..270 + 0: JS_IN_EXPRESSION@258..269 + 0: TS_INSTANTIATION_EXPRESSION@258..263 + 0: JS_IDENTIFIER_EXPRESSION@258..260 + 0: JS_REFERENCE_IDENTIFIER@258..260 + 0: IDENT@258..260 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@260..263 + 0: L_ANGLE@260..261 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@261..262 + 0: TS_REFERENCE_TYPE@261..262 + 0: JS_REFERENCE_IDENTIFIER@261..262 + 0: IDENT@261..262 "T" [] [] + 1: (empty) + 2: R_ANGLE@262..263 ">" [] [] + 1: IN_KW@263..267 "in" [Newline("\n")] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@267..269 + 0: L_CURLY@267..268 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@268..268 + 2: R_CURLY@268..269 "}" [] [] + 1: SEMICOLON@269..270 ";" [] [] + 15: JS_EXPRESSION_STATEMENT@270..283 + 0: JS_BINARY_EXPRESSION@270..282 + 0: TS_INSTANTIATION_EXPRESSION@270..275 + 0: JS_IDENTIFIER_EXPRESSION@270..272 + 0: JS_REFERENCE_IDENTIFIER@270..272 + 0: IDENT@270..272 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@272..275 + 0: L_ANGLE@272..273 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@273..274 + 0: TS_REFERENCE_TYPE@273..274 + 0: JS_REFERENCE_IDENTIFIER@273..274 + 0: IDENT@273..274 "T" [] [] + 1: (empty) + 2: R_ANGLE@274..275 ">" [] [] + 1: STAR@275..278 "*" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@278..282 + 0: JS_IDENTIFIER_EXPRESSION@278..279 + 0: JS_REFERENCE_IDENTIFIER@278..279 + 0: IDENT@278..279 "f" [] [] + 1: TS_TYPE_ARGUMENTS@279..282 + 0: L_ANGLE@279..280 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@280..281 + 0: TS_REFERENCE_TYPE@280..281 + 0: JS_REFERENCE_IDENTIFIER@280..281 + 0: IDENT@280..281 "T" [] [] + 1: (empty) + 2: R_ANGLE@281..282 ">" [] [] + 1: SEMICOLON@282..283 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@283..296 + 0: JS_BINARY_EXPRESSION@283..295 + 0: TS_INSTANTIATION_EXPRESSION@283..288 + 0: JS_IDENTIFIER_EXPRESSION@283..285 + 0: JS_REFERENCE_IDENTIFIER@283..285 + 0: IDENT@283..285 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@285..288 + 0: L_ANGLE@285..286 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@286..287 + 0: TS_REFERENCE_TYPE@286..287 + 0: JS_REFERENCE_IDENTIFIER@286..287 + 0: IDENT@286..287 "T" [] [] + 1: (empty) + 2: R_ANGLE@287..288 ">" [] [] + 1: SLASH@288..291 "/" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@291..295 + 0: JS_IDENTIFIER_EXPRESSION@291..292 + 0: JS_REFERENCE_IDENTIFIER@291..292 + 0: IDENT@291..292 "f" [] [] + 1: TS_TYPE_ARGUMENTS@292..295 + 0: L_ANGLE@292..293 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@293..294 + 0: TS_REFERENCE_TYPE@293..294 + 0: JS_REFERENCE_IDENTIFIER@293..294 + 0: IDENT@293..294 "T" [] [] + 1: (empty) + 2: R_ANGLE@294..295 ">" [] [] + 1: SEMICOLON@295..296 ";" [] [] + 17: JS_EXPRESSION_STATEMENT@296..309 + 0: JS_BINARY_EXPRESSION@296..308 + 0: TS_INSTANTIATION_EXPRESSION@296..301 + 0: JS_IDENTIFIER_EXPRESSION@296..298 + 0: JS_REFERENCE_IDENTIFIER@296..298 + 0: IDENT@296..298 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@298..301 + 0: L_ANGLE@298..299 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@299..300 + 0: TS_REFERENCE_TYPE@299..300 + 0: JS_REFERENCE_IDENTIFIER@299..300 + 0: IDENT@299..300 "T" [] [] + 1: (empty) + 2: R_ANGLE@300..301 ">" [] [] + 1: PERCENT@301..304 "%" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@304..308 + 0: JS_IDENTIFIER_EXPRESSION@304..305 + 0: JS_REFERENCE_IDENTIFIER@304..305 + 0: IDENT@304..305 "f" [] [] + 1: TS_TYPE_ARGUMENTS@305..308 + 0: L_ANGLE@305..306 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@306..307 + 0: TS_REFERENCE_TYPE@306..307 + 0: JS_REFERENCE_IDENTIFIER@306..307 + 0: IDENT@306..307 "T" [] [] + 1: (empty) + 2: R_ANGLE@307..308 ">" [] [] + 1: SEMICOLON@308..309 ";" [] [] + 18: JS_EXPRESSION_STATEMENT@309..323 + 0: JS_BINARY_EXPRESSION@309..322 + 0: TS_INSTANTIATION_EXPRESSION@309..314 + 0: JS_IDENTIFIER_EXPRESSION@309..311 + 0: JS_REFERENCE_IDENTIFIER@309..311 + 0: IDENT@309..311 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@311..314 + 0: L_ANGLE@311..312 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@312..313 + 0: TS_REFERENCE_TYPE@312..313 + 0: JS_REFERENCE_IDENTIFIER@312..313 + 0: IDENT@312..313 "T" [] [] + 1: (empty) + 2: R_ANGLE@313..314 ">" [] [] + 1: STAR2@314..318 "**" [Newline("\n")] [Whitespace(" ")] + 2: TS_INSTANTIATION_EXPRESSION@318..322 + 0: JS_IDENTIFIER_EXPRESSION@318..319 + 0: JS_REFERENCE_IDENTIFIER@318..319 + 0: IDENT@318..319 "f" [] [] + 1: TS_TYPE_ARGUMENTS@319..322 + 0: L_ANGLE@319..320 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@320..321 + 0: TS_REFERENCE_TYPE@320..321 + 0: JS_REFERENCE_IDENTIFIER@320..321 + 0: IDENT@320..321 "T" [] [] + 1: (empty) + 2: R_ANGLE@321..322 ">" [] [] + 1: SEMICOLON@322..323 ";" [] [] + 19: JS_EXPRESSION_STATEMENT@323..336 + 0: JS_BINARY_EXPRESSION@323..335 + 0: JS_BINARY_EXPRESSION@323..328 + 0: JS_IDENTIFIER_EXPRESSION@323..326 + 0: JS_REFERENCE_IDENTIFIER@323..326 + 0: IDENT@323..326 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@326..327 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@327..328 + 0: JS_REFERENCE_IDENTIFIER@327..328 + 0: IDENT@327..328 "T" [] [] + 1: R_ANGLE@328..329 ">" [] [] + 2: JS_UNARY_EXPRESSION@329..335 + 0: PLUS@329..331 "+" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@331..335 + 0: JS_IDENTIFIER_EXPRESSION@331..332 + 0: JS_REFERENCE_IDENTIFIER@331..332 + 0: IDENT@331..332 "f" [] [] + 1: TS_TYPE_ARGUMENTS@332..335 + 0: L_ANGLE@332..333 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@333..334 + 0: TS_REFERENCE_TYPE@333..334 + 0: JS_REFERENCE_IDENTIFIER@333..334 + 0: IDENT@333..334 "T" [] [] + 1: (empty) + 2: R_ANGLE@334..335 ">" [] [] + 1: SEMICOLON@335..336 ";" [] [] + 20: JS_EXPRESSION_STATEMENT@336..349 + 0: JS_BINARY_EXPRESSION@336..348 + 0: JS_BINARY_EXPRESSION@336..341 + 0: JS_IDENTIFIER_EXPRESSION@336..339 + 0: JS_REFERENCE_IDENTIFIER@336..339 + 0: IDENT@336..339 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@339..340 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@340..341 + 0: JS_REFERENCE_IDENTIFIER@340..341 + 0: IDENT@340..341 "T" [] [] + 1: R_ANGLE@341..342 ">" [] [] + 2: JS_UNARY_EXPRESSION@342..348 + 0: MINUS@342..344 "-" [Newline("\n")] [] + 1: TS_INSTANTIATION_EXPRESSION@344..348 + 0: JS_IDENTIFIER_EXPRESSION@344..345 + 0: JS_REFERENCE_IDENTIFIER@344..345 + 0: IDENT@344..345 "f" [] [] + 1: TS_TYPE_ARGUMENTS@345..348 + 0: L_ANGLE@345..346 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@346..347 + 0: TS_REFERENCE_TYPE@346..347 + 0: JS_REFERENCE_IDENTIFIER@346..347 + 0: IDENT@346..347 "T" [] [] + 1: (empty) + 2: R_ANGLE@347..348 ">" [] [] + 1: SEMICOLON@348..349 ";" [] [] + 21: JS_EXPRESSION_STATEMENT@349..355 + 0: TS_INSTANTIATION_EXPRESSION@349..355 + 0: JS_IDENTIFIER_EXPRESSION@349..352 + 0: JS_REFERENCE_IDENTIFIER@349..352 + 0: IDENT@349..352 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@352..355 + 0: L_ANGLE@352..353 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@353..354 + 0: TS_REFERENCE_TYPE@353..354 + 0: JS_REFERENCE_IDENTIFIER@353..354 + 0: IDENT@353..354 "T" [] [] + 1: (empty) + 2: R_ANGLE@354..355 ">" [] [] + 1: (empty) + 22: JS_EXPRESSION_STATEMENT@355..361 + 0: JS_THIS_EXPRESSION@355..360 + 0: THIS_KW@355..360 "this" [Newline("\n")] [] + 1: SEMICOLON@360..361 ";" [] [] + 23: JS_EXPRESSION_STATEMENT@361..367 + 0: TS_INSTANTIATION_EXPRESSION@361..367 + 0: JS_IDENTIFIER_EXPRESSION@361..364 + 0: JS_REFERENCE_IDENTIFIER@361..364 + 0: IDENT@361..364 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@364..367 + 0: L_ANGLE@364..365 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@365..366 + 0: TS_REFERENCE_TYPE@365..366 + 0: JS_REFERENCE_IDENTIFIER@365..366 + 0: IDENT@365..366 "T" [] [] + 1: (empty) + 2: R_ANGLE@366..367 ">" [] [] + 1: (empty) + 24: JS_EXPRESSION_STATEMENT@367..373 + 0: JS_NULL_LITERAL_EXPRESSION@367..372 + 0: NULL_KW@367..372 "null" [Newline("\n")] [] + 1: SEMICOLON@372..373 ";" [] [] + 25: JS_EXPRESSION_STATEMENT@373..379 + 0: TS_INSTANTIATION_EXPRESSION@373..379 + 0: JS_IDENTIFIER_EXPRESSION@373..376 + 0: JS_REFERENCE_IDENTIFIER@373..376 + 0: IDENT@373..376 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@376..379 + 0: L_ANGLE@376..377 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@377..378 + 0: TS_REFERENCE_TYPE@377..378 + 0: JS_REFERENCE_IDENTIFIER@377..378 + 0: IDENT@377..378 "T" [] [] + 1: (empty) + 2: R_ANGLE@378..379 ">" [] [] + 1: (empty) + 26: JS_EXPRESSION_STATEMENT@379..385 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@379..384 + 0: TRUE_KW@379..384 "true" [Newline("\n")] [] + 1: SEMICOLON@384..385 ";" [] [] + 27: JS_EXPRESSION_STATEMENT@385..391 + 0: TS_INSTANTIATION_EXPRESSION@385..391 + 0: JS_IDENTIFIER_EXPRESSION@385..388 + 0: JS_REFERENCE_IDENTIFIER@385..388 + 0: IDENT@385..388 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@388..391 + 0: L_ANGLE@388..389 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@389..390 + 0: TS_REFERENCE_TYPE@389..390 + 0: JS_REFERENCE_IDENTIFIER@389..390 + 0: IDENT@389..390 "T" [] [] + 1: (empty) + 2: R_ANGLE@390..391 ">" [] [] + 1: (empty) + 28: JS_EXPRESSION_STATEMENT@391..398 + 0: JS_BOOLEAN_LITERAL_EXPRESSION@391..397 + 0: FALSE_KW@391..397 "false" [Newline("\n")] [] + 1: SEMICOLON@397..398 ";" [] [] + 29: JS_EXPRESSION_STATEMENT@398..404 + 0: TS_INSTANTIATION_EXPRESSION@398..404 + 0: JS_IDENTIFIER_EXPRESSION@398..401 + 0: JS_REFERENCE_IDENTIFIER@398..401 + 0: IDENT@398..401 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@401..404 + 0: L_ANGLE@401..402 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@402..403 + 0: TS_REFERENCE_TYPE@402..403 + 0: JS_REFERENCE_IDENTIFIER@402..403 + 0: IDENT@402..403 "T" [] [] + 1: (empty) + 2: R_ANGLE@403..404 ">" [] [] + 1: (empty) + 30: JS_EXPRESSION_STATEMENT@404..407 + 0: JS_NUMBER_LITERAL_EXPRESSION@404..406 + 0: JS_NUMBER_LITERAL@404..406 "1" [Newline("\n")] [] + 1: SEMICOLON@406..407 ";" [] [] + 31: JS_EXPRESSION_STATEMENT@407..413 + 0: TS_INSTANTIATION_EXPRESSION@407..413 + 0: JS_IDENTIFIER_EXPRESSION@407..410 + 0: JS_REFERENCE_IDENTIFIER@407..410 + 0: IDENT@407..410 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@410..413 + 0: L_ANGLE@410..411 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@411..412 + 0: TS_REFERENCE_TYPE@411..412 + 0: JS_REFERENCE_IDENTIFIER@411..412 + 0: IDENT@411..412 "T" [] [] + 1: (empty) + 2: R_ANGLE@412..413 ">" [] [] + 1: (empty) + 32: JS_EXPRESSION_STATEMENT@413..419 + 0: JS_BIGINT_LITERAL_EXPRESSION@413..418 + 0: JS_BIGINT_LITERAL@413..418 "123n" [Newline("\n")] [] + 1: SEMICOLON@418..419 ";" [] [] + 33: JS_EXPRESSION_STATEMENT@419..425 + 0: TS_INSTANTIATION_EXPRESSION@419..425 + 0: JS_IDENTIFIER_EXPRESSION@419..422 + 0: JS_REFERENCE_IDENTIFIER@419..422 + 0: IDENT@419..422 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@422..425 + 0: L_ANGLE@422..423 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@423..424 + 0: TS_REFERENCE_TYPE@423..424 + 0: JS_REFERENCE_IDENTIFIER@423..424 + 0: IDENT@423..424 "T" [] [] + 1: (empty) + 2: R_ANGLE@424..425 ">" [] [] + 1: (empty) + 34: JS_BLOCK_STATEMENT@425..428 + 0: L_CURLY@425..427 "{" [Newline("\n")] [] + 1: JS_STATEMENT_LIST@427..427 + 2: R_CURLY@427..428 "}" [] [] + 35: JS_EMPTY_STATEMENT@428..429 + 0: SEMICOLON@428..429 ";" [] [] + 36: JS_EXPRESSION_STATEMENT@429..435 + 0: TS_INSTANTIATION_EXPRESSION@429..435 + 0: JS_IDENTIFIER_EXPRESSION@429..432 + 0: JS_REFERENCE_IDENTIFIER@429..432 + 0: IDENT@429..432 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@432..435 + 0: L_ANGLE@432..433 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@433..434 + 0: TS_REFERENCE_TYPE@433..434 + 0: JS_REFERENCE_IDENTIFIER@433..434 + 0: IDENT@433..434 "T" [] [] + 1: (empty) + 2: R_ANGLE@434..435 ">" [] [] + 1: (empty) + 37: JS_FUNCTION_DECLARATION@435..454 + 0: (empty) + 1: FUNCTION_KW@435..445 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@445..449 + 0: IDENT@445..449 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@449..452 + 0: L_PAREN@449..450 "(" [] [] + 1: JS_PARAMETER_LIST@450..450 + 2: R_PAREN@450..452 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@452..454 + 0: L_CURLY@452..453 "{" [] [] + 1: JS_DIRECTIVE_LIST@453..453 + 2: JS_STATEMENT_LIST@453..453 + 3: R_CURLY@453..454 "}" [] [] + 38: JS_EMPTY_STATEMENT@454..455 + 0: SEMICOLON@454..455 ";" [] [] + 39: JS_EXPRESSION_STATEMENT@455..461 + 0: TS_INSTANTIATION_EXPRESSION@455..461 + 0: JS_IDENTIFIER_EXPRESSION@455..458 + 0: JS_REFERENCE_IDENTIFIER@455..458 + 0: IDENT@455..458 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@458..461 + 0: L_ANGLE@458..459 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@459..460 + 0: TS_REFERENCE_TYPE@459..460 + 0: JS_REFERENCE_IDENTIFIER@459..460 + 0: IDENT@459..460 "T" [] [] + 1: (empty) + 2: R_ANGLE@460..461 ">" [] [] + 1: (empty) + 40: JS_CLASS_DECLARATION@461..472 + 0: JS_DECORATOR_LIST@461..461 + 1: (empty) + 2: CLASS_KW@461..468 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@468..470 + 0: IDENT@468..470 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@470..471 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@471..471 + 9: R_CURLY@471..472 "}" [] [] + 41: JS_EMPTY_STATEMENT@472..473 + 0: SEMICOLON@472..473 ";" [] [] + 42: JS_EXPRESSION_STATEMENT@473..479 + 0: TS_INSTANTIATION_EXPRESSION@473..479 + 0: JS_IDENTIFIER_EXPRESSION@473..476 + 0: JS_REFERENCE_IDENTIFIER@473..476 + 0: IDENT@473..476 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@476..479 + 0: L_ANGLE@476..477 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@477..478 + 0: TS_REFERENCE_TYPE@477..478 + 0: JS_REFERENCE_IDENTIFIER@477..478 + 0: IDENT@477..478 "T" [] [] + 1: (empty) + 2: R_ANGLE@478..479 ">" [] [] + 1: (empty) + 43: JS_EXPRESSION_STATEMENT@479..488 + 0: JS_NEW_EXPRESSION@479..487 + 0: NEW_KW@479..484 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@484..485 + 0: JS_REFERENCE_IDENTIFIER@484..485 + 0: IDENT@484..485 "A" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@485..487 + 0: L_PAREN@485..486 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@486..486 + 2: R_PAREN@486..487 ")" [] [] + 1: SEMICOLON@487..488 ";" [] [] + 44: JS_EXPRESSION_STATEMENT@488..498 + 0: JS_BINARY_EXPRESSION@488..497 + 0: TS_INSTANTIATION_EXPRESSION@488..493 + 0: JS_IDENTIFIER_EXPRESSION@488..490 + 0: JS_REFERENCE_IDENTIFIER@488..490 + 0: IDENT@488..490 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@490..493 + 0: L_ANGLE@490..491 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@491..492 + 0: TS_REFERENCE_TYPE@491..492 + 0: JS_REFERENCE_IDENTIFIER@491..492 + 0: IDENT@491..492 "T" [] [] + 1: (empty) + 2: R_ANGLE@492..493 ">" [] [] + 1: SLASH@493..496 "/" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@496..497 + 0: JS_NUMBER_LITERAL@496..497 "1" [] [] + 1: SEMICOLON@497..498 ";" [] [] + 45: JS_EXPRESSION_STATEMENT@498..508 + 0: JS_BINARY_EXPRESSION@498..507 + 0: JS_BINARY_EXPRESSION@498..503 + 0: JS_IDENTIFIER_EXPRESSION@498..501 + 0: JS_REFERENCE_IDENTIFIER@498..501 + 0: IDENT@498..501 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@501..502 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@502..503 + 0: JS_REFERENCE_IDENTIFIER@502..503 + 0: IDENT@502..503 "T" [] [] + 1: R_ANGLE@503..504 ">" [] [] + 2: JS_UNARY_EXPRESSION@504..507 + 0: PLUS@504..506 "+" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@506..507 + 0: JS_NUMBER_LITERAL@506..507 "1" [] [] + 1: SEMICOLON@507..508 ";" [] [] + 46: JS_EXPRESSION_STATEMENT@508..518 + 0: JS_BINARY_EXPRESSION@508..517 + 0: JS_BINARY_EXPRESSION@508..513 + 0: JS_IDENTIFIER_EXPRESSION@508..511 + 0: JS_REFERENCE_IDENTIFIER@508..511 + 0: IDENT@508..511 "f" [Newline("\n")] [Whitespace(" ")] + 1: L_ANGLE@511..512 "<" [] [] + 2: JS_IDENTIFIER_EXPRESSION@512..513 + 0: JS_REFERENCE_IDENTIFIER@512..513 + 0: IDENT@512..513 "T" [] [] + 1: R_ANGLE@513..514 ">" [] [] + 2: JS_UNARY_EXPRESSION@514..517 + 0: MINUS@514..516 "-" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@516..517 + 0: JS_NUMBER_LITERAL@516..517 "1" [] [] + 1: SEMICOLON@517..518 ";" [] [] + 47: JS_EXPRESSION_STATEMENT@518..524 + 0: TS_INSTANTIATION_EXPRESSION@518..524 + 0: JS_IDENTIFIER_EXPRESSION@518..521 + 0: JS_REFERENCE_IDENTIFIER@518..521 + 0: IDENT@518..521 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@521..524 + 0: L_ANGLE@521..522 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@522..523 + 0: TS_REFERENCE_TYPE@522..523 + 0: JS_REFERENCE_IDENTIFIER@522..523 + 0: IDENT@522..523 "T" [] [] + 1: (empty) + 2: R_ANGLE@523..524 ">" [] [] + 1: (empty) + 48: JS_EXPRESSION_STATEMENT@524..528 + 0: JS_UNARY_EXPRESSION@524..527 + 0: TILDE@524..526 "~" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@526..527 + 0: JS_NUMBER_LITERAL@526..527 "1" [] [] + 1: SEMICOLON@527..528 ";" [] [] + 49: JS_EXPRESSION_STATEMENT@528..534 + 0: TS_INSTANTIATION_EXPRESSION@528..534 + 0: JS_IDENTIFIER_EXPRESSION@528..531 + 0: JS_REFERENCE_IDENTIFIER@528..531 + 0: IDENT@528..531 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@531..534 + 0: L_ANGLE@531..532 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@532..533 + 0: TS_REFERENCE_TYPE@532..533 + 0: JS_REFERENCE_IDENTIFIER@532..533 + 0: IDENT@532..533 "T" [] [] + 1: (empty) + 2: R_ANGLE@533..534 ">" [] [] + 1: (empty) + 50: JS_EXPRESSION_STATEMENT@534..538 + 0: JS_UNARY_EXPRESSION@534..537 + 0: BANG@534..536 "!" [Newline("\n")] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@536..537 + 0: JS_NUMBER_LITERAL@536..537 "1" [] [] + 1: SEMICOLON@537..538 ";" [] [] + 51: JS_EXPRESSION_STATEMENT@538..544 + 0: TS_INSTANTIATION_EXPRESSION@538..544 + 0: JS_IDENTIFIER_EXPRESSION@538..541 + 0: JS_REFERENCE_IDENTIFIER@538..541 + 0: IDENT@538..541 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@541..544 + 0: L_ANGLE@541..542 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@542..543 + 0: TS_REFERENCE_TYPE@542..543 + 0: JS_REFERENCE_IDENTIFIER@542..543 + 0: IDENT@542..543 "T" [] [] + 1: (empty) + 2: R_ANGLE@543..544 ">" [] [] + 1: (empty) + 52: JS_EXPRESSION_STATEMENT@544..560 + 0: JS_IDENTIFIER_EXPRESSION@544..559 + 0: JS_REFERENCE_IDENTIFIER@544..559 + 0: IDENT@544..559 "someIdentifier" [Newline("\n")] [] + 1: SEMICOLON@559..560 ";" [] [] + 53: JS_EXPRESSION_STATEMENT@560..566 + 0: TS_INSTANTIATION_EXPRESSION@560..566 + 0: JS_IDENTIFIER_EXPRESSION@560..563 + 0: JS_REFERENCE_IDENTIFIER@560..563 + 0: IDENT@560..563 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@563..566 + 0: L_ANGLE@563..564 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@564..565 + 0: TS_REFERENCE_TYPE@564..565 + 0: JS_REFERENCE_IDENTIFIER@564..565 + 0: IDENT@564..565 "T" [] [] + 1: (empty) + 2: R_ANGLE@565..566 ">" [] [] + 1: (empty) + 54: JS_EXPRESSION_STATEMENT@566..583 + 0: JS_UNARY_EXPRESSION@566..582 + 0: DELETE_KW@566..574 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@574..582 + 0: JS_IDENTIFIER_EXPRESSION@574..575 + 0: JS_REFERENCE_IDENTIFIER@574..575 + 0: IDENT@574..575 "a" [] [] + 1: (empty) + 2: L_BRACK@575..576 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@576..581 + 0: JS_REFERENCE_IDENTIFIER@576..581 + 0: IDENT@576..581 "field" [] [] + 4: R_BRACK@581..582 "]" [] [] + 1: SEMICOLON@582..583 ";" [] [] + 55: JS_EXPRESSION_STATEMENT@583..589 + 0: TS_INSTANTIATION_EXPRESSION@583..589 + 0: JS_IDENTIFIER_EXPRESSION@583..586 + 0: JS_REFERENCE_IDENTIFIER@583..586 + 0: IDENT@583..586 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@586..589 + 0: L_ANGLE@586..587 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@587..588 + 0: TS_REFERENCE_TYPE@587..588 + 0: JS_REFERENCE_IDENTIFIER@587..588 + 0: IDENT@587..588 "T" [] [] + 1: (empty) + 2: R_ANGLE@588..589 ">" [] [] + 1: (empty) + 56: JS_EXPRESSION_STATEMENT@589..605 + 0: JS_UNARY_EXPRESSION@589..604 + 0: TYPEOF_KW@589..597 "typeof" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@597..604 + 0: JS_REFERENCE_IDENTIFIER@597..604 + 0: IDENT@597..604 "MyClass" [] [] + 1: SEMICOLON@604..605 ";" [] [] + 57: JS_EXPRESSION_STATEMENT@605..611 + 0: TS_INSTANTIATION_EXPRESSION@605..611 + 0: JS_IDENTIFIER_EXPRESSION@605..608 + 0: JS_REFERENCE_IDENTIFIER@605..608 + 0: IDENT@605..608 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@608..611 + 0: L_ANGLE@608..609 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@609..610 + 0: TS_REFERENCE_TYPE@609..610 + 0: JS_REFERENCE_IDENTIFIER@609..610 + 0: IDENT@609..610 "T" [] [] + 1: (empty) + 2: R_ANGLE@610..611 ">" [] [] + 1: (empty) + 58: JS_EXPRESSION_STATEMENT@611..619 + 0: JS_UNARY_EXPRESSION@611..618 + 0: VOID_KW@611..617 "void" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@617..618 + 0: JS_REFERENCE_IDENTIFIER@617..618 + 0: IDENT@617..618 "a" [] [] + 1: SEMICOLON@618..619 ";" [] [] + 59: JS_EXPRESSION_STATEMENT@619..630 + 0: JS_BINARY_EXPRESSION@619..629 + 0: TS_INSTANTIATION_EXPRESSION@619..624 + 0: JS_IDENTIFIER_EXPRESSION@619..621 + 0: JS_REFERENCE_IDENTIFIER@619..621 + 0: IDENT@619..621 "f" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@621..624 + 0: L_ANGLE@621..622 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@622..623 + 0: TS_REFERENCE_TYPE@622..623 + 0: JS_REFERENCE_IDENTIFIER@622..623 + 0: IDENT@622..623 "T" [] [] + 1: (empty) + 2: R_ANGLE@623..624 ">" [] [] + 1: LTEQ@624..628 "<=" [Newline("\n")] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@628..629 + 0: JS_NUMBER_LITERAL@628..629 "1" [] [] + 1: SEMICOLON@629..630 ";" [] [] + 60: JS_EXPRESSION_STATEMENT@630..647 + 0: JS_CALL_EXPRESSION@630..646 + 0: JS_IDENTIFIER_EXPRESSION@630..633 + 0: JS_REFERENCE_IDENTIFIER@630..633 + 0: IDENT@630..633 "f" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_ARGUMENTS@633..636 + 0: L_ANGLE@633..634 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@634..635 + 0: TS_REFERENCE_TYPE@634..635 + 0: JS_REFERENCE_IDENTIFIER@634..635 + 0: IDENT@634..635 "T" [] [] + 1: (empty) + 2: R_ANGLE@635..636 ">" [] [] + 3: JS_CALL_ARGUMENTS@636..646 + 0: L_PAREN@636..638 "(" [Newline("\n")] [] + 1: JS_CALL_ARGUMENT_LIST@638..645 + 0: JS_AWAIT_EXPRESSION@638..645 + 0: AWAIT_KW@638..644 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@644..645 + 0: JS_NUMBER_LITERAL@644..645 "1" [] [] + 2: R_PAREN@645..646 ")" [] [] + 1: SEMICOLON@646..647 ";" [] [] + 61: JS_EXPRESSION_STATEMENT@647..653 + 0: TS_INSTANTIATION_EXPRESSION@647..653 + 0: JS_IDENTIFIER_EXPRESSION@647..650 + 0: JS_REFERENCE_IDENTIFIER@647..650 + 0: IDENT@647..650 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@650..653 + 0: L_ANGLE@650..651 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@651..652 + 0: TS_REFERENCE_TYPE@651..652 + 0: JS_REFERENCE_IDENTIFIER@651..652 + 0: IDENT@651..652 "T" [] [] + 1: (empty) + 2: R_ANGLE@652..653 ">" [] [] + 1: (empty) + 62: JS_EXPRESSION_STATEMENT@653..666 + 0: JS_IMPORT_META_EXPRESSION@653..665 + 0: IMPORT_KW@653..660 "import" [Newline("\n")] [] + 1: DOT@660..661 "." [] [] + 2: META@661..665 "meta" [] [] + 1: SEMICOLON@665..666 ";" [] [] + 63: JS_EXPRESSION_STATEMENT@666..672 + 0: TS_INSTANTIATION_EXPRESSION@666..672 + 0: JS_IDENTIFIER_EXPRESSION@666..669 + 0: JS_REFERENCE_IDENTIFIER@666..669 + 0: IDENT@666..669 "f" [Newline("\n")] [Whitespace(" ")] + 1: TS_TYPE_ARGUMENTS@669..672 + 0: L_ANGLE@669..670 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@670..671 + 0: TS_REFERENCE_TYPE@670..671 + 0: JS_REFERENCE_IDENTIFIER@670..671 + 0: IDENT@670..671 "T" [] [] + 1: (empty) + 2: R_ANGLE@671..672 ">" [] [] + 1: (empty) + 64: JS_EXPRESSION_STATEMENT@672..687 + 0: JS_IMPORT_CALL_EXPRESSION@672..686 + 0: IMPORT_KW@672..679 "import" [Newline("\n")] [] + 1: JS_CALL_ARGUMENTS@679..686 + 0: L_PAREN@679..680 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@680..685 + 0: JS_STRING_LITERAL_EXPRESSION@680..685 + 0: JS_STRING_LITERAL@680..685 "\"123\"" [] [] + 2: R_PAREN@685..686 ")" [] [] + 1: SEMICOLON@686..687 ";" [] [] + 4: EOF@687..688 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts.snap new file mode 100644 index 000000000000..b521d9d2282f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts.snap @@ -0,0 +1,207 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A {} +interface B { prop: string, method(): string, [index: number]: string, new(): B } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@12..13 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@13..14 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@25..27 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@29..33 "prop" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@33..35 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@35..41 "string" [] [], + }, + }, + separator_token: COMMA@41..43 "," [] [Whitespace(" ")], + }, + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@43..49 "method" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@49..50 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@50..51 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@51..53 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@53..59 "string" [] [], + }, + }, + separator_token: COMMA@59..61 "," [] [Whitespace(" ")], + }, + TsIndexSignatureTypeMember { + readonly_token: missing (optional), + l_brack_token: L_BRACK@61..62 "[" [] [], + parameter: TsIndexSignatureParameter { + binding: JsIdentifierBinding { + name_token: IDENT@62..67 "index" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@67..69 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@69..75 "number" [] [], + }, + }, + }, + r_brack_token: R_BRACK@75..76 "]" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@76..78 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@78..84 "string" [] [], + }, + }, + separator_token: COMMA@84..86 "," [] [Whitespace(" ")], + }, + TsConstructSignatureTypeMember { + new_token: NEW_KW@86..89 "new" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@89..90 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@90..91 ")" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@91..93 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@93..95 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@95..96 "}" [] [], + }, + ], + eof_token: EOF@96..97 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..97 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..96 + 0: TS_INTERFACE_DECLARATION@0..14 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@12..13 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@13..13 + 6: R_CURLY@13..14 "}" [] [] + 1: TS_INTERFACE_DECLARATION@14..96 + 0: INTERFACE_KW@14..25 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..27 + 0: IDENT@25..27 "B" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@29..95 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@29..43 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@29..33 + 0: IDENT@29..33 "prop" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@33..41 + 0: COLON@33..35 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@35..41 + 0: STRING_KW@35..41 "string" [] [] + 4: COMMA@41..43 "," [] [Whitespace(" ")] + 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@43..61 + 0: JS_LITERAL_MEMBER_NAME@43..49 + 0: IDENT@43..49 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@49..51 + 0: L_PAREN@49..50 "(" [] [] + 1: JS_PARAMETER_LIST@50..50 + 2: R_PAREN@50..51 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@51..59 + 0: COLON@51..53 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@53..59 + 0: STRING_KW@53..59 "string" [] [] + 5: COMMA@59..61 "," [] [Whitespace(" ")] + 2: TS_INDEX_SIGNATURE_TYPE_MEMBER@61..86 + 0: (empty) + 1: L_BRACK@61..62 "[" [] [] + 2: TS_INDEX_SIGNATURE_PARAMETER@62..75 + 0: JS_IDENTIFIER_BINDING@62..67 + 0: IDENT@62..67 "index" [] [] + 1: TS_TYPE_ANNOTATION@67..75 + 0: COLON@67..69 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@69..75 + 0: NUMBER_KW@69..75 "number" [] [] + 3: R_BRACK@75..76 "]" [] [] + 4: TS_TYPE_ANNOTATION@76..84 + 0: COLON@76..78 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@78..84 + 0: STRING_KW@78..84 "string" [] [] + 5: COMMA@84..86 "," [] [Whitespace(" ")] + 3: TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER@86..95 + 0: NEW_KW@86..89 "new" [] [] + 1: (empty) + 2: JS_PARAMETERS@89..91 + 0: L_PAREN@89..90 "(" [] [] + 1: JS_PARAMETER_LIST@90..90 + 2: R_PAREN@90..91 ")" [] [] + 3: TS_TYPE_ANNOTATION@91..95 + 0: COLON@91..93 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@93..95 + 0: JS_REFERENCE_IDENTIFIER@93..95 + 0: IDENT@93..95 "B" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 6: R_CURLY@95..96 "}" [] [] + 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap new file mode 100644 index 000000000000..a4cee2d75f7a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap @@ -0,0 +1,220 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { prop: Prop } +interface B extends A {} +interface C extends A, B {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..11 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@11..12 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@12..16 "Prop" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@16..18 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@20..24 "prop" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@26..31 "Prop" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@32..43 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@43..45 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: TsExtendsClause { + extends_token: EXTENDS_KW@45..53 "extends" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@53..54 "A" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@54..55 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@55..61 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@61..63 ">" [] [Whitespace(" ")], + }, + }, + ], + }, + l_curly_token: L_CURLY@63..64 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@64..65 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@65..76 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@76..78 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: TsExtendsClause { + extends_token: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")], + types: TsTypeList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@86..87 "A" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@87..88 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@88..94 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@94..95 ">" [] [], + }, + }, + COMMA@95..97 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@97..99 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + l_curly_token: L_CURLY@99..100 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@100..101 "}" [] [], + }, + ], + eof_token: EOF@101..102 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..102 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..101 + 0: TS_INTERFACE_DECLARATION@0..32 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..11 + 0: IDENT@10..11 "A" [] [] + 2: TS_TYPE_PARAMETERS@11..18 + 0: L_ANGLE@11..12 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@12..16 + 0: TS_TYPE_PARAMETER@12..16 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@12..12 + 1: TS_TYPE_PARAMETER_NAME@12..16 + 0: IDENT@12..16 "Prop" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@16..18 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 5: TS_TYPE_MEMBER_LIST@20..31 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@20..31 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@20..24 + 0: IDENT@20..24 "prop" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@24..31 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@26..31 + 0: JS_REFERENCE_IDENTIFIER@26..31 + 0: IDENT@26..31 "Prop" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 6: R_CURLY@31..32 "}" [] [] + 1: TS_INTERFACE_DECLARATION@32..65 + 0: INTERFACE_KW@32..43 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "B" [] [Whitespace(" ")] + 2: (empty) + 3: TS_EXTENDS_CLAUSE@45..63 + 0: EXTENDS_KW@45..53 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@53..63 + 0: TS_REFERENCE_TYPE@53..63 + 0: JS_REFERENCE_IDENTIFIER@53..54 + 0: IDENT@53..54 "A" [] [] + 1: TS_TYPE_ARGUMENTS@54..63 + 0: L_ANGLE@54..55 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@55..61 + 0: TS_STRING_TYPE@55..61 + 0: STRING_KW@55..61 "string" [] [] + 2: R_ANGLE@61..63 ">" [] [Whitespace(" ")] + 4: L_CURLY@63..64 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@64..64 + 6: R_CURLY@64..65 "}" [] [] + 2: TS_INTERFACE_DECLARATION@65..101 + 0: INTERFACE_KW@65..76 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@76..78 + 0: IDENT@76..78 "C" [] [Whitespace(" ")] + 2: (empty) + 3: TS_EXTENDS_CLAUSE@78..99 + 0: EXTENDS_KW@78..86 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_LIST@86..99 + 0: TS_REFERENCE_TYPE@86..95 + 0: JS_REFERENCE_IDENTIFIER@86..87 + 0: IDENT@86..87 "A" [] [] + 1: TS_TYPE_ARGUMENTS@87..95 + 0: L_ANGLE@87..88 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@88..94 + 0: TS_NUMBER_TYPE@88..94 + 0: NUMBER_KW@88..94 "number" [] [] + 2: R_ANGLE@94..95 ">" [] [] + 1: COMMA@95..97 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@97..99 + 0: JS_REFERENCE_IDENTIFIER@97..99 + 0: IDENT@97..99 "B" [] [Whitespace(" ")] + 1: (empty) + 4: L_CURLY@99..100 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@100..100 + 6: R_CURLY@100..101 "}" [] [] + 4: EOF@101..102 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts.snap new file mode 100644 index 000000000000..6e4ddf42fb4d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts.snap @@ -0,0 +1,121 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string & number; +type B = & A & void & null; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsIntersectionType { + leading_separator_token: missing (optional), + types: TsIntersectionTypeElementList [ + TsStringType { + string_token: STRING_KW@9..16 "string" [] [Whitespace(" ")], + }, + AMP@16..18 "&" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@18..24 "number" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@31..33 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + ty: TsIntersectionType { + leading_separator_token: AMP@35..37 "&" [] [Whitespace(" ")], + types: TsIntersectionTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@37..39 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + AMP@39..41 "&" [] [Whitespace(" ")], + TsVoidType { + void_token: VOID_KW@41..46 "void" [] [Whitespace(" ")], + }, + AMP@46..48 "&" [] [Whitespace(" ")], + TsNullLiteralType { + literal_token: NULL_KW@48..52 "null" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@52..53 ";" [] [], + }, + ], + eof_token: EOF@53..54 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..54 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..53 + 0: TS_TYPE_ALIAS_DECLARATION@0..25 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_INTERSECTION_TYPE@9..24 + 0: (empty) + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@9..24 + 0: TS_STRING_TYPE@9..16 + 0: STRING_KW@9..16 "string" [] [Whitespace(" ")] + 1: AMP@16..18 "&" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@18..24 + 0: NUMBER_KW@18..24 "number" [] [] + 5: SEMICOLON@24..25 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@25..53 + 0: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@33..35 "=" [] [Whitespace(" ")] + 4: TS_INTERSECTION_TYPE@35..52 + 0: AMP@35..37 "&" [] [Whitespace(" ")] + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@37..52 + 0: TS_REFERENCE_TYPE@37..39 + 0: JS_REFERENCE_IDENTIFIER@37..39 + 0: IDENT@37..39 "A" [] [Whitespace(" ")] + 1: (empty) + 1: AMP@39..41 "&" [] [Whitespace(" ")] + 2: TS_VOID_TYPE@41..46 + 0: VOID_KW@41..46 "void" [] [Whitespace(" ")] + 3: AMP@46..48 "&" [] [Whitespace(" ")] + 4: TS_NULL_LITERAL_TYPE@48..52 + 0: NULL_KW@48..52 "null" [] [] + 5: SEMICOLON@52..53 ";" [] [] + 4: EOF@53..54 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.js b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.js rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js.snap new file mode 100644 index 000000000000..8bcfad589a6b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js.snap @@ -0,0 +1,161 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +declare = 1; +abstract = 2; +namespace = 3; +type = 4; +module = 5; +global = 6; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@0..8 "declare" [] [Whitespace(" ")], + }, + operator_token: EQ@8..10 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@10..11 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@12..22 "abstract" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@22..24 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@24..25 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@26..37 "namespace" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@37..39 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@39..40 "3" [] [], + }, + }, + semicolon_token: SEMICOLON@40..41 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@41..47 "type" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@47..49 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@49..50 "4" [] [], + }, + }, + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@51..59 "module" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@59..61 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@61..62 "5" [] [], + }, + }, + semicolon_token: SEMICOLON@62..63 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@63..71 "global" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@71..73 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@73..74 "6" [] [], + }, + }, + semicolon_token: SEMICOLON@74..75 ";" [] [], + }, + ], + eof_token: EOF@75..76 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..76 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..75 + 0: JS_EXPRESSION_STATEMENT@0..12 + 0: JS_ASSIGNMENT_EXPRESSION@0..11 + 0: JS_IDENTIFIER_ASSIGNMENT@0..8 + 0: IDENT@0..8 "declare" [] [Whitespace(" ")] + 1: EQ@8..10 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@10..11 + 0: JS_NUMBER_LITERAL@10..11 "1" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@12..26 + 0: JS_ASSIGNMENT_EXPRESSION@12..25 + 0: JS_IDENTIFIER_ASSIGNMENT@12..22 + 0: IDENT@12..22 "abstract" [Newline("\n")] [Whitespace(" ")] + 1: EQ@22..24 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@24..25 + 0: JS_NUMBER_LITERAL@24..25 "2" [] [] + 1: SEMICOLON@25..26 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@26..41 + 0: JS_ASSIGNMENT_EXPRESSION@26..40 + 0: JS_IDENTIFIER_ASSIGNMENT@26..37 + 0: IDENT@26..37 "namespace" [Newline("\n")] [Whitespace(" ")] + 1: EQ@37..39 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@39..40 + 0: JS_NUMBER_LITERAL@39..40 "3" [] [] + 1: SEMICOLON@40..41 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@41..51 + 0: JS_ASSIGNMENT_EXPRESSION@41..50 + 0: JS_IDENTIFIER_ASSIGNMENT@41..47 + 0: IDENT@41..47 "type" [Newline("\n")] [Whitespace(" ")] + 1: EQ@47..49 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@49..50 + 0: JS_NUMBER_LITERAL@49..50 "4" [] [] + 1: SEMICOLON@50..51 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@51..63 + 0: JS_ASSIGNMENT_EXPRESSION@51..62 + 0: JS_IDENTIFIER_ASSIGNMENT@51..59 + 0: IDENT@51..59 "module" [Newline("\n")] [Whitespace(" ")] + 1: EQ@59..61 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@61..62 + 0: JS_NUMBER_LITERAL@61..62 "5" [] [] + 1: SEMICOLON@62..63 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@63..75 + 0: JS_ASSIGNMENT_EXPRESSION@63..74 + 0: JS_IDENTIFIER_ASSIGNMENT@63..71 + 0: IDENT@63..71 "global" [Newline("\n")] [Whitespace(" ")] + 1: EQ@71..73 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@73..74 + 0: JS_NUMBER_LITERAL@73..74 "6" [] [] + 1: SEMICOLON@74..75 ";" [] [] + 4: EOF@75..76 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.js b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.js rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap new file mode 100644 index 000000000000..054079f90114 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap @@ -0,0 +1,141 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +interface = 1; +private = 2; +protected = 3; +public = 4; +implements = 5; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@0..20 "interface" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@20..22 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@22..23 "1" [] [], + }, + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@24..33 "private" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@33..35 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@37..48 "protected" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@48..50 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@50..51 "3" [] [], + }, + }, + semicolon_token: SEMICOLON@51..52 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@52..60 "public" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@60..62 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@62..63 "4" [] [], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@64..76 "implements" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@76..78 "=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@78..79 "5" [] [], + }, + }, + semicolon_token: SEMICOLON@79..80 ";" [] [], + }, + ], + eof_token: EOF@80..81 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..81 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..80 + 0: JS_EXPRESSION_STATEMENT@0..24 + 0: JS_ASSIGNMENT_EXPRESSION@0..23 + 0: JS_IDENTIFIER_ASSIGNMENT@0..20 + 0: IDENT@0..20 "interface" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: EQ@20..22 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@22..23 + 0: JS_NUMBER_LITERAL@22..23 "1" [] [] + 1: SEMICOLON@23..24 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@24..37 + 0: JS_ASSIGNMENT_EXPRESSION@24..36 + 0: JS_IDENTIFIER_ASSIGNMENT@24..33 + 0: IDENT@24..33 "private" [Newline("\n")] [Whitespace(" ")] + 1: EQ@33..35 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "2" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@37..52 + 0: JS_ASSIGNMENT_EXPRESSION@37..51 + 0: JS_IDENTIFIER_ASSIGNMENT@37..48 + 0: IDENT@37..48 "protected" [Newline("\n")] [Whitespace(" ")] + 1: EQ@48..50 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@50..51 + 0: JS_NUMBER_LITERAL@50..51 "3" [] [] + 1: SEMICOLON@51..52 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@52..64 + 0: JS_ASSIGNMENT_EXPRESSION@52..63 + 0: JS_IDENTIFIER_ASSIGNMENT@52..60 + 0: IDENT@52..60 "public" [Newline("\n")] [Whitespace(" ")] + 1: EQ@60..62 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@62..63 + 0: JS_NUMBER_LITERAL@62..63 "4" [] [] + 1: SEMICOLON@63..64 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@64..80 + 0: JS_ASSIGNMENT_EXPRESSION@64..79 + 0: JS_IDENTIFIER_ASSIGNMENT@64..76 + 0: IDENT@64..76 "implements" [Newline("\n")] [Whitespace(" ")] + 1: EQ@76..78 "=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@78..79 + 0: JS_NUMBER_LITERAL@78..79 "5" [] [] + 1: SEMICOLON@79..80 ";" [] [] + 4: EOF@80..81 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_literal_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts.snap new file mode 100644 index 000000000000..8755908adb64 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts.snap @@ -0,0 +1,219 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = 5; +type B = -5; +type C = 5n; +type D = -5n; +type E = "abvcd"; +type F = true; +type G = false; +type H = null; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@9..10 "5" [] [], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@17..19 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@19..21 "=" [] [Whitespace(" ")], + ty: TsNumberLiteralType { + minus_token: MINUS@21..22 "-" [] [], + literal_token: JS_NUMBER_LITERAL@22..23 "5" [] [], + }, + semicolon_token: SEMICOLON@23..24 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@30..32 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@32..34 "=" [] [Whitespace(" ")], + ty: TsBigintLiteralType { + minus_token: missing (optional), + literal_token: JS_BIGINT_LITERAL@34..36 "5n" [] [], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@43..45 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@45..47 "=" [] [Whitespace(" ")], + ty: TsBigintLiteralType { + minus_token: MINUS@47..48 "-" [] [], + literal_token: JS_BIGINT_LITERAL@48..50 "5n" [] [], + }, + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@51..57 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@57..59 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@59..61 "=" [] [Whitespace(" ")], + ty: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@61..68 "\"abvcd\"" [] [], + }, + semicolon_token: SEMICOLON@68..69 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@75..77 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@77..79 "=" [] [Whitespace(" ")], + ty: TsBooleanLiteralType { + literal: TRUE_KW@79..83 "true" [] [], + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@84..90 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@90..92 "G" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@92..94 "=" [] [Whitespace(" ")], + ty: TsBooleanLiteralType { + literal: FALSE_KW@94..99 "false" [] [], + }, + semicolon_token: SEMICOLON@99..100 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@106..108 "H" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@108..110 "=" [] [Whitespace(" ")], + ty: TsNullLiteralType { + literal_token: NULL_KW@110..114 "null" [] [], + }, + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + ], + eof_token: EOF@115..116 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..116 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..115 + 0: TS_TYPE_ALIAS_DECLARATION@0..11 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_NUMBER_LITERAL_TYPE@9..10 + 0: (empty) + 1: JS_NUMBER_LITERAL@9..10 "5" [] [] + 5: SEMICOLON@10..11 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@11..24 + 0: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@17..19 + 0: IDENT@17..19 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@19..21 "=" [] [Whitespace(" ")] + 4: TS_NUMBER_LITERAL_TYPE@21..23 + 0: MINUS@21..22 "-" [] [] + 1: JS_NUMBER_LITERAL@22..23 "5" [] [] + 5: SEMICOLON@23..24 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@24..37 + 0: TYPE_KW@24..30 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@30..32 + 0: IDENT@30..32 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@32..34 "=" [] [Whitespace(" ")] + 4: TS_BIGINT_LITERAL_TYPE@34..36 + 0: (empty) + 1: JS_BIGINT_LITERAL@34..36 "5n" [] [] + 5: SEMICOLON@36..37 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@37..51 + 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@45..47 "=" [] [Whitespace(" ")] + 4: TS_BIGINT_LITERAL_TYPE@47..50 + 0: MINUS@47..48 "-" [] [] + 1: JS_BIGINT_LITERAL@48..50 "5n" [] [] + 5: SEMICOLON@50..51 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@51..69 + 0: TYPE_KW@51..57 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@57..59 + 0: IDENT@57..59 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@59..61 "=" [] [Whitespace(" ")] + 4: TS_STRING_LITERAL_TYPE@61..68 + 0: JS_STRING_LITERAL@61..68 "\"abvcd\"" [] [] + 5: SEMICOLON@68..69 ";" [] [] + 5: TS_TYPE_ALIAS_DECLARATION@69..84 + 0: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@75..77 + 0: IDENT@75..77 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@77..79 "=" [] [Whitespace(" ")] + 4: TS_BOOLEAN_LITERAL_TYPE@79..83 + 0: TRUE_KW@79..83 "true" [] [] + 5: SEMICOLON@83..84 ";" [] [] + 6: TS_TYPE_ALIAS_DECLARATION@84..100 + 0: TYPE_KW@84..90 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@90..92 + 0: IDENT@90..92 "G" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@92..94 "=" [] [Whitespace(" ")] + 4: TS_BOOLEAN_LITERAL_TYPE@94..99 + 0: FALSE_KW@94..99 "false" [] [] + 5: SEMICOLON@99..100 ";" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@100..115 + 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@106..108 + 0: IDENT@106..108 "H" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@108..110 "=" [] [Whitespace(" ")] + 4: TS_NULL_LITERAL_TYPE@110..114 + 0: NULL_KW@110..114 "null" [] [] + 5: SEMICOLON@114..115 ";" [] [] + 4: EOF@115..116 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts.snap new file mode 100644 index 000000000000..b597890d7d8a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts.snap @@ -0,0 +1,628 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { [test in "a" | "b"] } +type OptionsFlags = { + [Property in keyof Type]: boolean; +}; +type CreateMutable = { + -readonly [Property in keyof Type]: Type[Property]; +}; +type Concrete = { + [Property in keyof Type]-?: Type[Property] +}; +type Getters = { + [Property in keyof Type as `get${Capitalize}`]: () => Type[Property] +}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@11..12 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@12..17 "test" [] [Whitespace(" ")], + }, + in_token: IN_KW@17..20 "in" [] [Whitespace(" ")], + keys_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringLiteralType { + literal_token: JS_STRING_LITERAL@20..24 "\"a\"" [] [Whitespace(" ")], + }, + PIPE@24..26 "|" [] [Whitespace(" ")], + TsStringLiteralType { + literal_token: JS_STRING_LITERAL@26..29 "\"b\"" [] [], + }, + ], + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@29..31 "]" [] [Whitespace(" ")], + optional_modifier: missing (optional), + mapped_type: missing (optional), + semicolon_token: missing (optional), + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@38..50 "OptionsFlags" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@50..51 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@51..55 "Type" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@55..57 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@57..59 "=" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@59..60 "{" [] [], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@60..64 "[" [Newline("\n"), Whitespace(" ")] [], + property_name: TsTypeParameterName { + ident_token: IDENT@64..73 "Property" [] [Whitespace(" ")], + }, + in_token: IN_KW@73..76 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@76..82 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@82..86 "Type" [] [], + }, + type_arguments: missing (optional), + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@86..87 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@87..89 ":" [] [Whitespace(" ")], + ty: TsBooleanType { + boolean_token: BOOLEAN_KW@89..96 "boolean" [] [], + }, + }, + semicolon_token: SEMICOLON@96..97 ";" [] [], + r_curly_token: R_CURLY@97..99 "}" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@99..100 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@106..119 "CreateMutable" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@119..120 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@120..124 "Type" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@124..126 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@126..128 "=" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@128..129 "{" [] [], + readonly_modifier: TsMappedTypeReadonlyModifierClause { + operator_token: MINUS@129..132 "-" [Newline("\n"), Whitespace("\t")] [], + readonly_token: READONLY_KW@132..141 "readonly" [] [Whitespace(" ")], + }, + l_brack_token: L_BRACK@141..142 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@142..151 "Property" [] [Whitespace(" ")], + }, + in_token: IN_KW@151..154 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@154..160 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@160..164 "Type" [] [], + }, + type_arguments: missing (optional), + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@164..165 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@165..167 ":" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@167..171 "Type" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@171..172 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@172..180 "Property" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@180..181 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@181..182 ";" [] [], + r_curly_token: R_CURLY@182..184 "}" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@184..185 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@185..191 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@191..199 "Concrete" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@199..200 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@200..204 "Type" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@204..206 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@206..208 "=" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@208..209 "{" [] [], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@209..213 "[" [Newline("\n"), Whitespace(" ")] [], + property_name: TsTypeParameterName { + ident_token: IDENT@213..222 "Property" [] [Whitespace(" ")], + }, + in_token: IN_KW@222..225 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@225..231 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@231..235 "Type" [] [], + }, + type_arguments: missing (optional), + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@235..236 "]" [] [], + optional_modifier: TsMappedTypeOptionalModifierClause { + operator_token: MINUS@236..237 "-" [] [], + question_mark_token: QUESTION@237..238 "?" [] [], + }, + mapped_type: TsTypeAnnotation { + colon_token: COLON@238..240 ":" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@240..244 "Type" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@244..245 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@245..253 "Property" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@253..254 "]" [] [], + }, + }, + semicolon_token: missing (optional), + r_curly_token: R_CURLY@254..256 "}" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@256..257 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@257..263 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@263..270 "Getters" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@270..271 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@271..275 "Type" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@275..277 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@277..279 "=" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@279..280 "{" [] [], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@280..286 "[" [Newline("\n"), Whitespace(" ")] [], + property_name: TsTypeParameterName { + ident_token: IDENT@286..295 "Property" [] [Whitespace(" ")], + }, + in_token: IN_KW@295..298 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@298..304 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@304..309 "Type" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + as_clause: TsMappedTypeAsClause { + as_token: AS_KW@309..312 "as" [] [Whitespace(" ")], + ty: TsTemplateLiteralType { + l_tick_token: BACKTICK@312..313 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@313..316 "get" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@316..318 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@318..328 "Capitalize" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@328..329 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsIntersectionType { + leading_separator_token: missing (optional), + types: TsIntersectionTypeElementList [ + TsStringType { + string_token: STRING_KW@329..336 "string" [] [Whitespace(" ")], + }, + AMP@336..338 "&" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@338..346 "Property" [] [], + }, + type_arguments: missing (optional), + }, + ], + }, + ], + r_angle_token: R_ANGLE@346..347 ">" [] [], + }, + }, + r_curly_token: R_CURLY@347..348 "}" [] [], + }, + ], + r_tick_token: BACKTICK@348..349 "`" [] [], + }, + }, + r_brack_token: R_BRACK@349..350 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@350..352 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@352..353 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@353..355 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@355..358 "=>" [] [Whitespace(" ")], + return_type: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@358..362 "Type" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@362..363 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@363..371 "Property" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@371..372 "]" [] [], + }, + }, + }, + semicolon_token: missing (optional), + r_curly_token: R_CURLY@372..374 "}" [Newline("\n")] [], + }, + semicolon_token: SEMICOLON@374..375 ";" [] [], + }, + ], + eof_token: EOF@375..376 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..376 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..375 + 0: TS_TYPE_ALIAS_DECLARATION@0..32 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_MAPPED_TYPE@9..32 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@11..12 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@12..17 + 0: IDENT@12..17 "test" [] [Whitespace(" ")] + 4: IN_KW@17..20 "in" [] [Whitespace(" ")] + 5: TS_UNION_TYPE@20..29 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@20..29 + 0: TS_STRING_LITERAL_TYPE@20..24 + 0: JS_STRING_LITERAL@20..24 "\"a\"" [] [Whitespace(" ")] + 1: PIPE@24..26 "|" [] [Whitespace(" ")] + 2: TS_STRING_LITERAL_TYPE@26..29 + 0: JS_STRING_LITERAL@26..29 "\"b\"" [] [] + 6: (empty) + 7: R_BRACK@29..31 "]" [] [Whitespace(" ")] + 8: (empty) + 9: (empty) + 10: (empty) + 11: R_CURLY@31..32 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@32..100 + 0: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@38..50 + 0: IDENT@38..50 "OptionsFlags" [] [] + 2: TS_TYPE_PARAMETERS@50..57 + 0: L_ANGLE@50..51 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@51..55 + 0: TS_TYPE_PARAMETER@51..55 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@51..51 + 1: TS_TYPE_PARAMETER_NAME@51..55 + 0: IDENT@51..55 "Type" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@55..57 ">" [] [Whitespace(" ")] + 3: EQ@57..59 "=" [] [Whitespace(" ")] + 4: TS_MAPPED_TYPE@59..99 + 0: L_CURLY@59..60 "{" [] [] + 1: (empty) + 2: L_BRACK@60..64 "[" [Newline("\n"), Whitespace(" ")] [] + 3: TS_TYPE_PARAMETER_NAME@64..73 + 0: IDENT@64..73 "Property" [] [Whitespace(" ")] + 4: IN_KW@73..76 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@76..86 + 0: KEYOF_KW@76..82 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@82..86 + 0: JS_REFERENCE_IDENTIFIER@82..86 + 0: IDENT@82..86 "Type" [] [] + 1: (empty) + 6: (empty) + 7: R_BRACK@86..87 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@87..96 + 0: COLON@87..89 ":" [] [Whitespace(" ")] + 1: TS_BOOLEAN_TYPE@89..96 + 0: BOOLEAN_KW@89..96 "boolean" [] [] + 10: SEMICOLON@96..97 ";" [] [] + 11: R_CURLY@97..99 "}" [Newline("\n")] [] + 5: SEMICOLON@99..100 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@100..185 + 0: TYPE_KW@100..106 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@106..119 + 0: IDENT@106..119 "CreateMutable" [] [] + 2: TS_TYPE_PARAMETERS@119..126 + 0: L_ANGLE@119..120 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@120..124 + 0: TS_TYPE_PARAMETER@120..124 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@120..120 + 1: TS_TYPE_PARAMETER_NAME@120..124 + 0: IDENT@120..124 "Type" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@124..126 ">" [] [Whitespace(" ")] + 3: EQ@126..128 "=" [] [Whitespace(" ")] + 4: TS_MAPPED_TYPE@128..184 + 0: L_CURLY@128..129 "{" [] [] + 1: TS_MAPPED_TYPE_READONLY_MODIFIER_CLAUSE@129..141 + 0: MINUS@129..132 "-" [Newline("\n"), Whitespace("\t")] [] + 1: READONLY_KW@132..141 "readonly" [] [Whitespace(" ")] + 2: L_BRACK@141..142 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@142..151 + 0: IDENT@142..151 "Property" [] [Whitespace(" ")] + 4: IN_KW@151..154 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@154..164 + 0: KEYOF_KW@154..160 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@160..164 + 0: JS_REFERENCE_IDENTIFIER@160..164 + 0: IDENT@160..164 "Type" [] [] + 1: (empty) + 6: (empty) + 7: R_BRACK@164..165 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@165..181 + 0: COLON@165..167 ":" [] [Whitespace(" ")] + 1: TS_INDEXED_ACCESS_TYPE@167..181 + 0: TS_REFERENCE_TYPE@167..171 + 0: JS_REFERENCE_IDENTIFIER@167..171 + 0: IDENT@167..171 "Type" [] [] + 1: (empty) + 1: L_BRACK@171..172 "[" [] [] + 2: TS_REFERENCE_TYPE@172..180 + 0: JS_REFERENCE_IDENTIFIER@172..180 + 0: IDENT@172..180 "Property" [] [] + 1: (empty) + 3: R_BRACK@180..181 "]" [] [] + 10: SEMICOLON@181..182 ";" [] [] + 11: R_CURLY@182..184 "}" [Newline("\n")] [] + 5: SEMICOLON@184..185 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@185..257 + 0: TYPE_KW@185..191 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@191..199 + 0: IDENT@191..199 "Concrete" [] [] + 2: TS_TYPE_PARAMETERS@199..206 + 0: L_ANGLE@199..200 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@200..204 + 0: TS_TYPE_PARAMETER@200..204 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@200..200 + 1: TS_TYPE_PARAMETER_NAME@200..204 + 0: IDENT@200..204 "Type" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@204..206 ">" [] [Whitespace(" ")] + 3: EQ@206..208 "=" [] [Whitespace(" ")] + 4: TS_MAPPED_TYPE@208..256 + 0: L_CURLY@208..209 "{" [] [] + 1: (empty) + 2: L_BRACK@209..213 "[" [Newline("\n"), Whitespace(" ")] [] + 3: TS_TYPE_PARAMETER_NAME@213..222 + 0: IDENT@213..222 "Property" [] [Whitespace(" ")] + 4: IN_KW@222..225 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@225..235 + 0: KEYOF_KW@225..231 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@231..235 + 0: JS_REFERENCE_IDENTIFIER@231..235 + 0: IDENT@231..235 "Type" [] [] + 1: (empty) + 6: (empty) + 7: R_BRACK@235..236 "]" [] [] + 8: TS_MAPPED_TYPE_OPTIONAL_MODIFIER_CLAUSE@236..238 + 0: MINUS@236..237 "-" [] [] + 1: QUESTION@237..238 "?" [] [] + 9: TS_TYPE_ANNOTATION@238..254 + 0: COLON@238..240 ":" [] [Whitespace(" ")] + 1: TS_INDEXED_ACCESS_TYPE@240..254 + 0: TS_REFERENCE_TYPE@240..244 + 0: JS_REFERENCE_IDENTIFIER@240..244 + 0: IDENT@240..244 "Type" [] [] + 1: (empty) + 1: L_BRACK@244..245 "[" [] [] + 2: TS_REFERENCE_TYPE@245..253 + 0: JS_REFERENCE_IDENTIFIER@245..253 + 0: IDENT@245..253 "Property" [] [] + 1: (empty) + 3: R_BRACK@253..254 "]" [] [] + 10: (empty) + 11: R_CURLY@254..256 "}" [Newline("\n")] [] + 5: SEMICOLON@256..257 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@257..375 + 0: TYPE_KW@257..263 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@263..270 + 0: IDENT@263..270 "Getters" [] [] + 2: TS_TYPE_PARAMETERS@270..277 + 0: L_ANGLE@270..271 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@271..275 + 0: TS_TYPE_PARAMETER@271..275 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@271..271 + 1: TS_TYPE_PARAMETER_NAME@271..275 + 0: IDENT@271..275 "Type" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@275..277 ">" [] [Whitespace(" ")] + 3: EQ@277..279 "=" [] [Whitespace(" ")] + 4: TS_MAPPED_TYPE@279..374 + 0: L_CURLY@279..280 "{" [] [] + 1: (empty) + 2: L_BRACK@280..286 "[" [Newline("\n"), Whitespace(" ")] [] + 3: TS_TYPE_PARAMETER_NAME@286..295 + 0: IDENT@286..295 "Property" [] [Whitespace(" ")] + 4: IN_KW@295..298 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@298..309 + 0: KEYOF_KW@298..304 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@304..309 + 0: JS_REFERENCE_IDENTIFIER@304..309 + 0: IDENT@304..309 "Type" [] [Whitespace(" ")] + 1: (empty) + 6: TS_MAPPED_TYPE_AS_CLAUSE@309..349 + 0: AS_KW@309..312 "as" [] [Whitespace(" ")] + 1: TS_TEMPLATE_LITERAL_TYPE@312..349 + 0: BACKTICK@312..313 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@313..348 + 0: TS_TEMPLATE_CHUNK_ELEMENT@313..316 + 0: TEMPLATE_CHUNK@313..316 "get" [] [] + 1: TS_TEMPLATE_ELEMENT@316..348 + 0: DOLLAR_CURLY@316..318 "${" [] [] + 1: TS_REFERENCE_TYPE@318..347 + 0: JS_REFERENCE_IDENTIFIER@318..328 + 0: IDENT@318..328 "Capitalize" [] [] + 1: TS_TYPE_ARGUMENTS@328..347 + 0: L_ANGLE@328..329 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@329..346 + 0: TS_INTERSECTION_TYPE@329..346 + 0: (empty) + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@329..346 + 0: TS_STRING_TYPE@329..336 + 0: STRING_KW@329..336 "string" [] [Whitespace(" ")] + 1: AMP@336..338 "&" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@338..346 + 0: JS_REFERENCE_IDENTIFIER@338..346 + 0: IDENT@338..346 "Property" [] [] + 1: (empty) + 2: R_ANGLE@346..347 ">" [] [] + 2: R_CURLY@347..348 "}" [] [] + 2: BACKTICK@348..349 "`" [] [] + 7: R_BRACK@349..350 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@350..372 + 0: COLON@350..352 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@352..372 + 0: (empty) + 1: JS_PARAMETERS@352..355 + 0: L_PAREN@352..353 "(" [] [] + 1: JS_PARAMETER_LIST@353..353 + 2: R_PAREN@353..355 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@355..358 "=>" [] [Whitespace(" ")] + 3: TS_INDEXED_ACCESS_TYPE@358..372 + 0: TS_REFERENCE_TYPE@358..362 + 0: JS_REFERENCE_IDENTIFIER@358..362 + 0: IDENT@358..362 "Type" [] [] + 1: (empty) + 1: L_BRACK@362..363 "[" [] [] + 2: TS_REFERENCE_TYPE@363..371 + 0: JS_REFERENCE_IDENTIFIER@363..371 + 0: IDENT@363..371 "Property" [] [] + 1: (empty) + 3: R_BRACK@371..372 "]" [] [] + 10: (empty) + 11: R_CURLY@372..374 "}" [Newline("\n")] [] + 5: SEMICOLON@374..375 ";" [] [] + 4: EOF@375..376 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap new file mode 100644 index 000000000000..3a0718d6e08f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap @@ -0,0 +1,466 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + constructor(); + constructor(a: String) // ASI + constructor(a?: String) {} + async method(): Promise; + method(a: String): Promise // ASI + async method(a?: String): Promise { return "test" } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + TsConstructorSignatureClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@29..30 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@30..31 ")" [] [], + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + TsConstructorSignatureClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@32..49 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@49..50 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@50..51 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@51..53 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@53..59 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@59..67 ")" [] [Whitespace(" "), Comments("// ASI")], + }, + semicolon_token: missing (optional), + }, + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@67..84 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@84..85 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@85..86 "a" [] [], + }, + question_mark_token: QUESTION@86..87 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@87..89 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@89..95 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@95..97 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@97..98 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@98..99 "}" [] [], + }, + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: ASYNC_KW@99..111 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@111..117 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@117..118 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@118..119 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@121..128 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@128..129 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@129..135 "String" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@135..136 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@136..137 ";" [] [], + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@137..149 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@149..150 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@150..151 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@151..153 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@153..159 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@159..160 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@160..162 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@162..169 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@169..170 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@170..176 "String" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@176..184 ">" [] [Whitespace(" "), Comments("// ASI")], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: ASYNC_KW@184..196 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@196..202 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@202..203 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@203..204 "a" [] [], + }, + question_mark_token: QUESTION@204..205 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@205..207 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@207..213 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@213..214 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@214..216 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@216..223 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@223..224 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@224..230 "String" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@230..232 ">" [] [Whitespace(" ")], + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@232..234 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@234..241 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@241..248 "\"test\"" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@248..249 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@249..251 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@251..252 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..252 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..251 + 0: JS_CLASS_DECLARATION@0..251 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..249 + 0: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@12..32 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@12..12 + 1: JS_LITERAL_MEMBER_NAME@12..29 + 0: IDENT@12..29 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@29..31 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@30..30 + 2: R_PAREN@30..31 ")" [] [] + 3: SEMICOLON@31..32 ";" [] [] + 1: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@32..67 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@32..32 + 1: JS_LITERAL_MEMBER_NAME@32..49 + 0: IDENT@32..49 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@49..67 + 0: L_PAREN@49..50 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@50..59 + 0: JS_FORMAL_PARAMETER@50..59 + 0: JS_DECORATOR_LIST@50..50 + 1: JS_IDENTIFIER_BINDING@50..51 + 0: IDENT@50..51 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@51..59 + 0: COLON@51..53 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@53..59 + 0: JS_REFERENCE_IDENTIFIER@53..59 + 0: IDENT@53..59 "String" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@59..67 ")" [] [Whitespace(" "), Comments("// ASI")] + 3: (empty) + 2: JS_CONSTRUCTOR_CLASS_MEMBER@67..99 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@67..67 + 1: JS_LITERAL_MEMBER_NAME@67..84 + 0: IDENT@67..84 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@84..97 + 0: L_PAREN@84..85 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@85..95 + 0: JS_FORMAL_PARAMETER@85..95 + 0: JS_DECORATOR_LIST@85..85 + 1: JS_IDENTIFIER_BINDING@85..86 + 0: IDENT@85..86 "a" [] [] + 2: QUESTION@86..87 "?" [] [] + 3: TS_TYPE_ANNOTATION@87..95 + 0: COLON@87..89 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@89..95 + 0: JS_REFERENCE_IDENTIFIER@89..95 + 0: IDENT@89..95 "String" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@95..97 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@97..99 + 0: L_CURLY@97..98 "{" [] [] + 1: JS_DIRECTIVE_LIST@98..98 + 2: JS_STATEMENT_LIST@98..98 + 3: R_CURLY@98..99 "}" [] [] + 3: TS_METHOD_SIGNATURE_CLASS_MEMBER@99..137 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@99..99 + 1: ASYNC_KW@99..111 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@111..117 + 0: IDENT@111..117 "method" [] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@117..119 + 0: L_PAREN@117..118 "(" [] [] + 1: JS_PARAMETER_LIST@118..118 + 2: R_PAREN@118..119 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@119..136 + 0: COLON@119..121 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@121..136 + 0: JS_REFERENCE_IDENTIFIER@121..128 + 0: IDENT@121..128 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@128..136 + 0: L_ANGLE@128..129 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@129..135 + 0: TS_REFERENCE_TYPE@129..135 + 0: JS_REFERENCE_IDENTIFIER@129..135 + 0: IDENT@129..135 "String" [] [] + 1: (empty) + 2: R_ANGLE@135..136 ">" [] [] + 7: SEMICOLON@136..137 ";" [] [] + 4: TS_METHOD_SIGNATURE_CLASS_MEMBER@137..184 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@137..137 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@137..149 + 0: IDENT@137..149 "method" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@149..160 + 0: L_PAREN@149..150 "(" [] [] + 1: JS_PARAMETER_LIST@150..159 + 0: JS_FORMAL_PARAMETER@150..159 + 0: JS_DECORATOR_LIST@150..150 + 1: JS_IDENTIFIER_BINDING@150..151 + 0: IDENT@150..151 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@151..159 + 0: COLON@151..153 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@153..159 + 0: JS_REFERENCE_IDENTIFIER@153..159 + 0: IDENT@153..159 "String" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@159..160 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@160..184 + 0: COLON@160..162 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@162..184 + 0: JS_REFERENCE_IDENTIFIER@162..169 + 0: IDENT@162..169 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@169..184 + 0: L_ANGLE@169..170 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@170..176 + 0: TS_REFERENCE_TYPE@170..176 + 0: JS_REFERENCE_IDENTIFIER@170..176 + 0: IDENT@170..176 "String" [] [] + 1: (empty) + 2: R_ANGLE@176..184 ">" [] [Whitespace(" "), Comments("// ASI")] + 7: (empty) + 5: JS_METHOD_CLASS_MEMBER@184..249 + 0: JS_METHOD_MODIFIER_LIST@184..184 + 1: ASYNC_KW@184..196 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@196..202 + 0: IDENT@196..202 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@202..214 + 0: L_PAREN@202..203 "(" [] [] + 1: JS_PARAMETER_LIST@203..213 + 0: JS_FORMAL_PARAMETER@203..213 + 0: JS_DECORATOR_LIST@203..203 + 1: JS_IDENTIFIER_BINDING@203..204 + 0: IDENT@203..204 "a" [] [] + 2: QUESTION@204..205 "?" [] [] + 3: TS_TYPE_ANNOTATION@205..213 + 0: COLON@205..207 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@207..213 + 0: JS_REFERENCE_IDENTIFIER@207..213 + 0: IDENT@207..213 "String" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@213..214 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@214..232 + 0: COLON@214..216 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@216..232 + 0: JS_REFERENCE_IDENTIFIER@216..223 + 0: IDENT@216..223 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@223..232 + 0: L_ANGLE@223..224 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@224..230 + 0: TS_REFERENCE_TYPE@224..230 + 0: JS_REFERENCE_IDENTIFIER@224..230 + 0: IDENT@224..230 "String" [] [] + 1: (empty) + 2: R_ANGLE@230..232 ">" [] [Whitespace(" ")] + 8: JS_FUNCTION_BODY@232..249 + 0: L_CURLY@232..234 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@234..234 + 2: JS_STATEMENT_LIST@234..248 + 0: JS_RETURN_STATEMENT@234..248 + 0: RETURN_KW@234..241 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@241..248 + 0: JS_STRING_LITERAL@241..248 "\"test\"" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@248..249 "}" [] [] + 9: R_CURLY@249..251 "}" [Newline("\n")] [] + 4: EOF@251..252 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts.snap new file mode 100644 index 000000000000..110de3550190 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts.snap @@ -0,0 +1,246 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + test(a: A, b: B): R {} +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..11 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@11..12 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@12..19 "test" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@19..20 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@20..21 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@21..23 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@23..25 "B" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@25..33 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@33..34 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + COMMA@34..36 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@36..37 "R" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@37..38 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@39..40 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@40..42 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@42..43 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@43..45 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@45..46 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@46..48 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@48..49 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@49..50 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@52..54 "R" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@54..55 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@55..56 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@56..58 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@58..59 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..59 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..58 + 0: JS_CLASS_DECLARATION@0..58 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..11 + 0: IDENT@6..11 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@11..12 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@12..56 + 0: JS_METHOD_CLASS_MEMBER@12..56 + 0: JS_METHOD_MODIFIER_LIST@12..12 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@12..19 + 0: IDENT@12..19 "test" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: TS_TYPE_PARAMETERS@19..38 + 0: L_ANGLE@19..20 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@20..37 + 0: TS_TYPE_PARAMETER@20..21 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@20..20 + 1: TS_TYPE_PARAMETER_NAME@20..21 + 0: IDENT@20..21 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@21..23 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@23..34 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@23..23 + 1: TS_TYPE_PARAMETER_NAME@23..25 + 0: IDENT@23..25 "B" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@25..34 + 0: EXTENDS_KW@25..33 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@33..34 + 0: JS_REFERENCE_IDENTIFIER@33..34 + 0: IDENT@33..34 "A" [] [] + 1: (empty) + 3: (empty) + 3: COMMA@34..36 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@36..37 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@36..36 + 1: TS_TYPE_PARAMETER_NAME@36..37 + 0: IDENT@36..37 "R" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@37..38 ">" [] [] + 6: JS_PARAMETERS@38..50 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..49 + 0: JS_FORMAL_PARAMETER@39..43 + 0: JS_DECORATOR_LIST@39..39 + 1: JS_IDENTIFIER_BINDING@39..40 + 0: IDENT@39..40 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@40..43 + 0: COLON@40..42 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@42..43 + 0: JS_REFERENCE_IDENTIFIER@42..43 + 0: IDENT@42..43 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@43..45 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@45..49 + 0: JS_DECORATOR_LIST@45..45 + 1: JS_IDENTIFIER_BINDING@45..46 + 0: IDENT@45..46 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@46..49 + 0: COLON@46..48 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@48..49 + 0: JS_REFERENCE_IDENTIFIER@48..49 + 0: IDENT@48..49 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@49..50 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@50..54 + 0: COLON@50..52 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@52..54 + 0: JS_REFERENCE_IDENTIFIER@52..54 + 0: IDENT@52..54 "R" [] [Whitespace(" ")] + 1: (empty) + 8: JS_FUNCTION_BODY@54..56 + 0: L_CURLY@54..55 "{" [] [] + 1: JS_DIRECTIVE_LIST@55..55 + 2: JS_STATEMENT_LIST@55..55 + 3: R_CURLY@55..56 "}" [] [] + 9: R_CURLY@56..58 "}" [Newline("\n")] [] + 4: EOF@58..59 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts.snap new file mode 100644 index 000000000000..5c11927f071d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts.snap @@ -0,0 +1,435 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ + x(maybeA: any): maybeA is A { return true }, + y(a: string): string { return "string"; }, + async *id(param: Promise): AsyncIterableIterator { yield await param }, +}) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1..2 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@9..10 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@11..12 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@12..18 "maybeA" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@20..23 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@23..24 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@24..26 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@26..33 "maybeA" [] [Whitespace(" ")], + }, + is_token: IS_KW@33..36 "is" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@36..38 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@40..47 "return" [] [Whitespace(" ")], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@47..52 "true" [] [Whitespace(" ")], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@52..53 "}" [] [], + }, + }, + COMMA@53..54 "," [] [], + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@54..60 "y" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@60..61 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@61..62 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@62..64 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@64..70 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@70..71 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@71..73 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@73..80 "string" [] [Whitespace(" ")], + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@80..82 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@82..89 "return" [] [Whitespace(" ")], + argument: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@89..97 "\"string\"" [] [], + }, + semicolon_token: SEMICOLON@97..99 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@99..100 "}" [] [], + }, + }, + COMMA@100..101 "," [] [], + JsMethodObjectMember { + async_token: ASYNC_KW@101..112 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + star_token: STAR@112..113 "*" [] [], + name: JsLiteralMemberName { + value: IDENT@113..115 "id" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@115..116 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@116..117 "R" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@117..118 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@118..119 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@119..124 "param" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@124..126 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@126..133 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@133..134 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@134..135 "R" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@135..136 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@136..137 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@137..139 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@139..160 "AsyncIterableIterator" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@160..161 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@161..162 "R" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@162..164 ">" [] [Whitespace(" ")], + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@164..166 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@166..172 "yield" [] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: missing (optional), + expression: JsAwaitExpression { + await_token: AWAIT_KW@172..178 "await" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@178..184 "param" [] [Whitespace(" ")], + }, + }, + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@184..185 "}" [] [], + }, + }, + COMMA@185..186 "," [] [], + ], + r_curly_token: R_CURLY@186..188 "}" [Newline("\n")] [], + }, + r_paren_token: R_PAREN@188..189 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@189..190 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..190 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..189 + 0: JS_EXPRESSION_STATEMENT@0..189 + 0: JS_PARENTHESIZED_EXPRESSION@0..189 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_OBJECT_EXPRESSION@1..188 + 0: L_CURLY@1..2 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@2..186 + 0: JS_METHOD_OBJECT_MEMBER@2..53 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@2..8 + 0: IDENT@2..8 "x" [Newline("\n"), Whitespace(" ")] [] + 3: TS_TYPE_PARAMETERS@8..11 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..10 + 0: TS_TYPE_PARAMETER@9..10 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..9 + 1: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@10..11 ">" [] [] + 4: JS_PARAMETERS@11..24 + 0: L_PAREN@11..12 "(" [] [] + 1: JS_PARAMETER_LIST@12..23 + 0: JS_FORMAL_PARAMETER@12..23 + 0: JS_DECORATOR_LIST@12..12 + 1: JS_IDENTIFIER_BINDING@12..18 + 0: IDENT@12..18 "maybeA" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@18..23 + 0: COLON@18..20 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@20..23 + 0: ANY_KW@20..23 "any" [] [] + 4: (empty) + 2: R_PAREN@23..24 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@24..38 + 0: COLON@24..26 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@26..38 + 0: JS_REFERENCE_IDENTIFIER@26..33 + 0: IDENT@26..33 "maybeA" [] [Whitespace(" ")] + 1: IS_KW@33..36 "is" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@36..38 + 0: JS_REFERENCE_IDENTIFIER@36..38 + 0: IDENT@36..38 "A" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@38..53 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..52 + 0: JS_RETURN_STATEMENT@40..52 + 0: RETURN_KW@40..47 "return" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@47..52 + 0: TRUE_KW@47..52 "true" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@52..53 "}" [] [] + 1: COMMA@53..54 "," [] [] + 2: JS_METHOD_OBJECT_MEMBER@54..100 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@54..60 + 0: IDENT@54..60 "y" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: JS_PARAMETERS@60..71 + 0: L_PAREN@60..61 "(" [] [] + 1: JS_PARAMETER_LIST@61..70 + 0: JS_FORMAL_PARAMETER@61..70 + 0: JS_DECORATOR_LIST@61..61 + 1: JS_IDENTIFIER_BINDING@61..62 + 0: IDENT@61..62 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@62..70 + 0: COLON@62..64 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@64..70 + 0: STRING_KW@64..70 "string" [] [] + 4: (empty) + 2: R_PAREN@70..71 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@71..80 + 0: COLON@71..73 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@73..80 + 0: STRING_KW@73..80 "string" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@80..100 + 0: L_CURLY@80..82 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@82..82 + 2: JS_STATEMENT_LIST@82..99 + 0: JS_RETURN_STATEMENT@82..99 + 0: RETURN_KW@82..89 "return" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@89..97 + 0: JS_STRING_LITERAL@89..97 "\"string\"" [] [] + 2: SEMICOLON@97..99 ";" [] [Whitespace(" ")] + 3: R_CURLY@99..100 "}" [] [] + 3: COMMA@100..101 "," [] [] + 4: JS_METHOD_OBJECT_MEMBER@101..185 + 0: ASYNC_KW@101..112 "async" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: STAR@112..113 "*" [] [] + 2: JS_LITERAL_MEMBER_NAME@113..115 + 0: IDENT@113..115 "id" [] [] + 3: TS_TYPE_PARAMETERS@115..118 + 0: L_ANGLE@115..116 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@116..117 + 0: TS_TYPE_PARAMETER@116..117 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@116..116 + 1: TS_TYPE_PARAMETER_NAME@116..117 + 0: IDENT@116..117 "R" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@117..118 ">" [] [] + 4: JS_PARAMETERS@118..137 + 0: L_PAREN@118..119 "(" [] [] + 1: JS_PARAMETER_LIST@119..136 + 0: JS_FORMAL_PARAMETER@119..136 + 0: JS_DECORATOR_LIST@119..119 + 1: JS_IDENTIFIER_BINDING@119..124 + 0: IDENT@119..124 "param" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@124..136 + 0: COLON@124..126 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@126..136 + 0: JS_REFERENCE_IDENTIFIER@126..133 + 0: IDENT@126..133 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@133..136 + 0: L_ANGLE@133..134 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@134..135 + 0: TS_REFERENCE_TYPE@134..135 + 0: JS_REFERENCE_IDENTIFIER@134..135 + 0: IDENT@134..135 "R" [] [] + 1: (empty) + 2: R_ANGLE@135..136 ">" [] [] + 4: (empty) + 2: R_PAREN@136..137 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@137..164 + 0: COLON@137..139 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@139..164 + 0: JS_REFERENCE_IDENTIFIER@139..160 + 0: IDENT@139..160 "AsyncIterableIterator" [] [] + 1: TS_TYPE_ARGUMENTS@160..164 + 0: L_ANGLE@160..161 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@161..162 + 0: TS_REFERENCE_TYPE@161..162 + 0: JS_REFERENCE_IDENTIFIER@161..162 + 0: IDENT@161..162 "R" [] [] + 1: (empty) + 2: R_ANGLE@162..164 ">" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@164..185 + 0: L_CURLY@164..166 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@166..166 + 2: JS_STATEMENT_LIST@166..184 + 0: JS_EXPRESSION_STATEMENT@166..184 + 0: JS_YIELD_EXPRESSION@166..184 + 0: YIELD_KW@166..172 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@172..184 + 0: (empty) + 1: JS_AWAIT_EXPRESSION@172..184 + 0: AWAIT_KW@172..178 "await" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@178..184 + 0: JS_REFERENCE_IDENTIFIER@178..184 + 0: IDENT@178..184 "param" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@184..185 "}" [] [] + 5: COMMA@185..186 "," [] [] + 2: R_CURLY@186..188 "}" [Newline("\n")] [] + 2: R_PAREN@188..189 ")" [] [] + 1: (empty) + 4: EOF@189..190 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts.snap new file mode 100644 index 000000000000..ae7ba56cb477 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts.snap @@ -0,0 +1,206 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a {} +declare module a.b.c.d {} +declare module a.b { function test(): string } +module X {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@8..15 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@15..17 "a" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@17..18 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@28..35 "module" [] [Whitespace(" ")], + name: TsQualifiedModuleName { + left: TsQualifiedModuleName { + left: TsQualifiedModuleName { + left: TsIdentifierBinding { + name_token: IDENT@35..36 "a" [] [], + }, + dot_token: DOT@36..37 "." [] [], + right: JsName { + value_token: IDENT@37..38 "b" [] [], + }, + }, + dot_token: DOT@38..39 "." [] [], + right: JsName { + value_token: IDENT@39..40 "c" [] [], + }, + }, + dot_token: DOT@40..41 "." [] [], + right: JsName { + value_token: IDENT@41..43 "d" [] [Whitespace(" ")], + }, + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@43..44 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@44..45 "}" [] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@45..54 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@54..61 "module" [] [Whitespace(" ")], + name: TsQualifiedModuleName { + left: TsIdentifierBinding { + name_token: IDENT@61..62 "a" [] [], + }, + dot_token: DOT@62..63 "." [] [], + right: JsName { + value_token: IDENT@63..65 "b" [] [Whitespace(" ")], + }, + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@65..67 "{" [] [Whitespace(" ")], + items: JsModuleItemList [ + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@67..76 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@76..80 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@80..81 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@81..82 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@82..84 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@84..91 "string" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@91..92 "}" [] [], + }, + }, + }, + TsModuleDeclaration { + module_or_namespace: MODULE_KW@92..100 "module" [Newline("\n")] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@100..102 "X" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@102..103 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@103..104 "}" [] [], + }, + }, + ], + eof_token: EOF@104..105 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..105 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..104 + 0: TS_DECLARE_STATEMENT@0..19 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..19 + 0: MODULE_KW@8..15 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "a" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_MODULE_ITEM_LIST@18..18 + 2: R_CURLY@18..19 "}" [] [] + 1: TS_DECLARE_STATEMENT@19..45 + 0: DECLARE_KW@19..28 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@28..45 + 0: MODULE_KW@28..35 "module" [] [Whitespace(" ")] + 1: TS_QUALIFIED_MODULE_NAME@35..43 + 0: TS_QUALIFIED_MODULE_NAME@35..40 + 0: TS_QUALIFIED_MODULE_NAME@35..38 + 0: TS_IDENTIFIER_BINDING@35..36 + 0: IDENT@35..36 "a" [] [] + 1: DOT@36..37 "." [] [] + 2: JS_NAME@37..38 + 0: IDENT@37..38 "b" [] [] + 1: DOT@38..39 "." [] [] + 2: JS_NAME@39..40 + 0: IDENT@39..40 "c" [] [] + 1: DOT@40..41 "." [] [] + 2: JS_NAME@41..43 + 0: IDENT@41..43 "d" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@43..45 + 0: L_CURLY@43..44 "{" [] [] + 1: JS_MODULE_ITEM_LIST@44..44 + 2: R_CURLY@44..45 "}" [] [] + 2: TS_DECLARE_STATEMENT@45..92 + 0: DECLARE_KW@45..54 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@54..92 + 0: MODULE_KW@54..61 "module" [] [Whitespace(" ")] + 1: TS_QUALIFIED_MODULE_NAME@61..65 + 0: TS_IDENTIFIER_BINDING@61..62 + 0: IDENT@61..62 "a" [] [] + 1: DOT@62..63 "." [] [] + 2: JS_NAME@63..65 + 0: IDENT@63..65 "b" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@65..92 + 0: L_CURLY@65..67 "{" [] [Whitespace(" ")] + 1: JS_MODULE_ITEM_LIST@67..91 + 0: TS_DECLARE_FUNCTION_DECLARATION@67..91 + 0: (empty) + 1: FUNCTION_KW@67..76 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@76..80 + 0: IDENT@76..80 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@80..82 + 0: L_PAREN@80..81 "(" [] [] + 1: JS_PARAMETER_LIST@81..81 + 2: R_PAREN@81..82 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@82..91 + 0: COLON@82..84 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@84..91 + 0: STRING_KW@84..91 "string" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@91..92 "}" [] [] + 3: TS_MODULE_DECLARATION@92..104 + 0: MODULE_KW@92..100 "module" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@100..102 + 0: IDENT@100..102 "X" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@102..104 + 0: L_CURLY@102..103 "{" [] [] + 1: JS_MODULE_ITEM_LIST@103..103 + 2: R_CURLY@103..104 "}" [] [] + 4: EOF@104..105 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap new file mode 100644 index 000000000000..c570c822b840 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap @@ -0,0 +1,285 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import { type, type as } from "./mod"; +import { type as other } from "./mod" +import { type as as } from "./mod"; +import { type as as as } from "./mod" +import { type "test-abcd" as test } from "./mod"; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsImport { + import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@7..9 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsShorthandNamedImportSpecifier { + type_token: missing (optional), + local_name: JsIdentifierBinding { + name_token: IDENT@9..13 "type" [] [], + }, + }, + COMMA@13..15 "," [] [Whitespace(" ")], + JsShorthandNamedImportSpecifier { + type_token: TYPE_KW@15..20 "type" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@20..23 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@23..25 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@25..30 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@30..37 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@37..38 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@38..46 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@48..53 "type" [] [Whitespace(" ")], + }, + as_token: AS_KW@53..56 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@56..62 "other" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@62..64 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@64..69 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@69..76 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@84..86 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: missing (optional), + name: JsLiteralExportName { + value: IDENT@86..91 "type" [] [Whitespace(" ")], + }, + as_token: AS_KW@91..94 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@94..97 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@97..99 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@99..104 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@104..111 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@111..112 ";" [] [], + }, + JsImport { + import_token: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@120..122 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: TYPE_KW@122..127 "type" [] [Whitespace(" ")], + name: JsLiteralExportName { + value: IDENT@127..130 "as" [] [Whitespace(" ")], + }, + as_token: AS_KW@130..133 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@133..136 "as" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@136..138 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@138..143 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@143..150 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsImport { + import_token: IMPORT_KW@150..158 "import" [Newline("\n")] [Whitespace(" ")], + import_clause: JsImportNamedClause { + type_token: missing (optional), + named_specifiers: JsNamedImportSpecifiers { + l_curly_token: L_CURLY@158..160 "{" [] [Whitespace(" ")], + specifiers: JsNamedImportSpecifierList [ + JsNamedImportSpecifier { + type_token: TYPE_KW@160..165 "type" [] [Whitespace(" ")], + name: JsLiteralExportName { + value: JS_STRING_LITERAL@165..177 "\"test-abcd\"" [] [Whitespace(" ")], + }, + as_token: AS_KW@177..180 "as" [] [Whitespace(" ")], + local_name: JsIdentifierBinding { + name_token: IDENT@180..185 "test" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@185..187 "}" [] [Whitespace(" ")], + }, + from_token: FROM_KW@187..192 "from" [] [Whitespace(" ")], + source: JsModuleSource { + value_token: JS_STRING_LITERAL@192..199 "\"./mod\"" [] [], + }, + assertion: missing (optional), + }, + semicolon_token: SEMICOLON@199..200 ";" [] [], + }, + ], + eof_token: EOF@200..201 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..201 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..200 + 0: JS_IMPORT@0..38 + 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@7..37 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@7..25 + 0: L_CURLY@7..9 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@9..23 + 0: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@9..13 + 0: (empty) + 1: JS_IDENTIFIER_BINDING@9..13 + 0: IDENT@9..13 "type" [] [] + 1: COMMA@13..15 "," [] [Whitespace(" ")] + 2: JS_SHORTHAND_NAMED_IMPORT_SPECIFIER@15..23 + 0: TYPE_KW@15..20 "type" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_BINDING@20..23 + 0: IDENT@20..23 "as" [] [Whitespace(" ")] + 2: R_CURLY@23..25 "}" [] [Whitespace(" ")] + 2: FROM_KW@25..30 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@30..37 + 0: JS_STRING_LITERAL@30..37 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@37..38 ";" [] [] + 1: JS_IMPORT@38..76 + 0: IMPORT_KW@38..46 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@46..76 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@46..64 + 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@48..62 + 0: JS_NAMED_IMPORT_SPECIFIER@48..62 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@48..53 + 0: IDENT@48..53 "type" [] [Whitespace(" ")] + 2: AS_KW@53..56 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@56..62 + 0: IDENT@56..62 "other" [] [Whitespace(" ")] + 2: R_CURLY@62..64 "}" [] [Whitespace(" ")] + 2: FROM_KW@64..69 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@69..76 + 0: JS_STRING_LITERAL@69..76 "\"./mod\"" [] [] + 4: (empty) + 2: (empty) + 2: JS_IMPORT@76..112 + 0: IMPORT_KW@76..84 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@84..111 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@84..99 + 0: L_CURLY@84..86 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@86..97 + 0: JS_NAMED_IMPORT_SPECIFIER@86..97 + 0: (empty) + 1: JS_LITERAL_EXPORT_NAME@86..91 + 0: IDENT@86..91 "type" [] [Whitespace(" ")] + 2: AS_KW@91..94 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@94..97 + 0: IDENT@94..97 "as" [] [Whitespace(" ")] + 2: R_CURLY@97..99 "}" [] [Whitespace(" ")] + 2: FROM_KW@99..104 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@104..111 + 0: JS_STRING_LITERAL@104..111 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@111..112 ";" [] [] + 3: JS_IMPORT@112..150 + 0: IMPORT_KW@112..120 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@120..150 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@120..138 + 0: L_CURLY@120..122 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@122..136 + 0: JS_NAMED_IMPORT_SPECIFIER@122..136 + 0: TYPE_KW@122..127 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@127..130 + 0: IDENT@127..130 "as" [] [Whitespace(" ")] + 2: AS_KW@130..133 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@133..136 + 0: IDENT@133..136 "as" [] [Whitespace(" ")] + 2: R_CURLY@136..138 "}" [] [Whitespace(" ")] + 2: FROM_KW@138..143 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@143..150 + 0: JS_STRING_LITERAL@143..150 "\"./mod\"" [] [] + 4: (empty) + 2: (empty) + 4: JS_IMPORT@150..200 + 0: IMPORT_KW@150..158 "import" [Newline("\n")] [Whitespace(" ")] + 1: JS_IMPORT_NAMED_CLAUSE@158..199 + 0: (empty) + 1: JS_NAMED_IMPORT_SPECIFIERS@158..187 + 0: L_CURLY@158..160 "{" [] [Whitespace(" ")] + 1: JS_NAMED_IMPORT_SPECIFIER_LIST@160..185 + 0: JS_NAMED_IMPORT_SPECIFIER@160..185 + 0: TYPE_KW@160..165 "type" [] [Whitespace(" ")] + 1: JS_LITERAL_EXPORT_NAME@165..177 + 0: JS_STRING_LITERAL@165..177 "\"test-abcd\"" [] [Whitespace(" ")] + 2: AS_KW@177..180 "as" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@180..185 + 0: IDENT@180..185 "test" [] [Whitespace(" ")] + 2: R_CURLY@185..187 "}" [] [Whitespace(" ")] + 2: FROM_KW@187..192 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@192..199 + 0: JS_STRING_LITERAL@192..199 "\"./mod\"" [] [] + 4: (empty) + 2: SEMICOLON@199..200 ";" [] [] + 4: EOF@200..201 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts.snap new file mode 100644 index 000000000000..31ae37e48c6f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts.snap @@ -0,0 +1,206 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare namespace a {} +declare namespace a.b.c.d {} +declare namespace a.b { function test(): string } +namespace X { } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@18..20 "a" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@20..21 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@22..31 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@31..41 "namespace" [] [Whitespace(" ")], + name: TsQualifiedModuleName { + left: TsQualifiedModuleName { + left: TsQualifiedModuleName { + left: TsIdentifierBinding { + name_token: IDENT@41..42 "a" [] [], + }, + dot_token: DOT@42..43 "." [] [], + right: JsName { + value_token: IDENT@43..44 "b" [] [], + }, + }, + dot_token: DOT@44..45 "." [] [], + right: JsName { + value_token: IDENT@45..46 "c" [] [], + }, + }, + dot_token: DOT@46..47 "." [] [], + right: JsName { + value_token: IDENT@47..49 "d" [] [Whitespace(" ")], + }, + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@49..50 "{" [] [], + items: JsModuleItemList [], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@51..60 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@60..70 "namespace" [] [Whitespace(" ")], + name: TsQualifiedModuleName { + left: TsIdentifierBinding { + name_token: IDENT@70..71 "a" [] [], + }, + dot_token: DOT@71..72 "." [] [], + right: JsName { + value_token: IDENT@72..74 "b" [] [Whitespace(" ")], + }, + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@74..76 "{" [] [Whitespace(" ")], + items: JsModuleItemList [ + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@76..85 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@85..89 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@89..90 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@90..91 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@91..93 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@93..100 "string" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@100..101 "}" [] [], + }, + }, + }, + TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@101..112 "namespace" [Newline("\n")] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@112..114 "X" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@114..116 "{" [] [Whitespace(" ")], + items: JsModuleItemList [], + r_curly_token: R_CURLY@116..117 "}" [] [], + }, + }, + ], + eof_token: EOF@117..118 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..118 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..117 + 0: TS_DECLARE_STATEMENT@0..22 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..22 + 0: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@18..20 + 0: IDENT@18..20 "a" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@20..22 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_MODULE_ITEM_LIST@21..21 + 2: R_CURLY@21..22 "}" [] [] + 1: TS_DECLARE_STATEMENT@22..51 + 0: DECLARE_KW@22..31 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@31..51 + 0: NAMESPACE_KW@31..41 "namespace" [] [Whitespace(" ")] + 1: TS_QUALIFIED_MODULE_NAME@41..49 + 0: TS_QUALIFIED_MODULE_NAME@41..46 + 0: TS_QUALIFIED_MODULE_NAME@41..44 + 0: TS_IDENTIFIER_BINDING@41..42 + 0: IDENT@41..42 "a" [] [] + 1: DOT@42..43 "." [] [] + 2: JS_NAME@43..44 + 0: IDENT@43..44 "b" [] [] + 1: DOT@44..45 "." [] [] + 2: JS_NAME@45..46 + 0: IDENT@45..46 "c" [] [] + 1: DOT@46..47 "." [] [] + 2: JS_NAME@47..49 + 0: IDENT@47..49 "d" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@49..51 + 0: L_CURLY@49..50 "{" [] [] + 1: JS_MODULE_ITEM_LIST@50..50 + 2: R_CURLY@50..51 "}" [] [] + 2: TS_DECLARE_STATEMENT@51..101 + 0: DECLARE_KW@51..60 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@60..101 + 0: NAMESPACE_KW@60..70 "namespace" [] [Whitespace(" ")] + 1: TS_QUALIFIED_MODULE_NAME@70..74 + 0: TS_IDENTIFIER_BINDING@70..71 + 0: IDENT@70..71 "a" [] [] + 1: DOT@71..72 "." [] [] + 2: JS_NAME@72..74 + 0: IDENT@72..74 "b" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@74..101 + 0: L_CURLY@74..76 "{" [] [Whitespace(" ")] + 1: JS_MODULE_ITEM_LIST@76..100 + 0: TS_DECLARE_FUNCTION_DECLARATION@76..100 + 0: (empty) + 1: FUNCTION_KW@76..85 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@85..89 + 0: IDENT@85..89 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@89..91 + 0: L_PAREN@89..90 "(" [] [] + 1: JS_PARAMETER_LIST@90..90 + 2: R_PAREN@90..91 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@91..100 + 0: COLON@91..93 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@93..100 + 0: STRING_KW@93..100 "string" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@100..101 "}" [] [] + 3: TS_MODULE_DECLARATION@101..117 + 0: NAMESPACE_KW@101..112 "namespace" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@112..114 + 0: IDENT@112..114 "X" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@114..117 + 0: L_CURLY@114..116 "{" [] [Whitespace(" ")] + 1: JS_MODULE_ITEM_LIST@116..116 + 2: R_CURLY@116..117 "}" [] [] + 4: EOF@117..118 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_new_operator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts.snap new file mode 100644 index 000000000000..93b71f0bf85d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts.snap @@ -0,0 +1,267 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +var c2 = new T; // Ok +var x1 = new SS(); // OK +var x3 = new SS(); // OK +var x4 = new SS; // OK + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..7 "c2" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + expression: JsNewExpression { + new_token: NEW_KW@9..13 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@13..14 "T" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@14..15 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@15..21 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@21..22 ">" [] [], + }, + arguments: missing (optional), + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@22..30 ";" [] [Whitespace(" "), Comments("// Ok")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@30..35 "var" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@35..38 "x1" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + expression: JsNewExpression { + new_token: NEW_KW@40..44 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@44..46 "SS" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@46..47 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsNumberType { + number_token: NUMBER_KW@47..53 "number" [] [], + }, + ], + r_angle_token: R_ANGLE@53..54 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@54..55 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@55..56 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@56..63 ";" [] [Whitespace(" "), Comments("// OK")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@63..68 "var" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@68..71 "x3" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@71..73 "=" [] [Whitespace(" ")], + expression: JsNewExpression { + new_token: NEW_KW@73..77 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@77..79 "SS" [] [], + }, + }, + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@79..80 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@80..81 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@81..96 ";" [] [Whitespace(" "), Comments("// OK")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@96..101 "var" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@101..104 "x4" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@104..106 "=" [] [Whitespace(" ")], + expression: JsNewExpression { + new_token: NEW_KW@106..110 "new" [] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@110..112 "SS" [] [], + }, + }, + type_arguments: missing (optional), + arguments: missing (optional), + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@112..129 ";" [] [Whitespace(" "), Comments("// OK")], + }, + ], + eof_token: EOF@129..130 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..130 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..129 + 0: JS_VARIABLE_STATEMENT@0..30 + 0: JS_VARIABLE_DECLARATION@0..22 + 0: (empty) + 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..22 + 0: JS_VARIABLE_DECLARATOR@4..22 + 0: JS_IDENTIFIER_BINDING@4..7 + 0: IDENT@4..7 "c2" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@7..22 + 0: EQ@7..9 "=" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@9..22 + 0: NEW_KW@9..13 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@13..14 + 0: JS_REFERENCE_IDENTIFIER@13..14 + 0: IDENT@13..14 "T" [] [] + 2: TS_TYPE_ARGUMENTS@14..22 + 0: L_ANGLE@14..15 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@15..21 + 0: TS_STRING_TYPE@15..21 + 0: STRING_KW@15..21 "string" [] [] + 2: R_ANGLE@21..22 ">" [] [] + 3: (empty) + 1: SEMICOLON@22..30 ";" [] [Whitespace(" "), Comments("// Ok")] + 1: JS_VARIABLE_STATEMENT@30..63 + 0: JS_VARIABLE_DECLARATION@30..56 + 0: (empty) + 1: VAR_KW@30..35 "var" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@35..56 + 0: JS_VARIABLE_DECLARATOR@35..56 + 0: JS_IDENTIFIER_BINDING@35..38 + 0: IDENT@35..38 "x1" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@38..56 + 0: EQ@38..40 "=" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@40..56 + 0: NEW_KW@40..44 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@44..46 + 0: JS_REFERENCE_IDENTIFIER@44..46 + 0: IDENT@44..46 "SS" [] [] + 2: TS_TYPE_ARGUMENTS@46..54 + 0: L_ANGLE@46..47 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@47..53 + 0: TS_NUMBER_TYPE@47..53 + 0: NUMBER_KW@47..53 "number" [] [] + 2: R_ANGLE@53..54 ">" [] [] + 3: JS_CALL_ARGUMENTS@54..56 + 0: L_PAREN@54..55 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@55..55 + 2: R_PAREN@55..56 ")" [] [] + 1: SEMICOLON@56..63 ";" [] [Whitespace(" "), Comments("// OK")] + 2: JS_VARIABLE_STATEMENT@63..96 + 0: JS_VARIABLE_DECLARATION@63..81 + 0: (empty) + 1: VAR_KW@63..68 "var" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@68..81 + 0: JS_VARIABLE_DECLARATOR@68..81 + 0: JS_IDENTIFIER_BINDING@68..71 + 0: IDENT@68..71 "x3" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@71..81 + 0: EQ@71..73 "=" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@73..81 + 0: NEW_KW@73..77 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@77..79 + 0: JS_REFERENCE_IDENTIFIER@77..79 + 0: IDENT@77..79 "SS" [] [] + 2: (empty) + 3: JS_CALL_ARGUMENTS@79..81 + 0: L_PAREN@79..80 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@80..80 + 2: R_PAREN@80..81 ")" [] [] + 1: SEMICOLON@81..96 ";" [] [Whitespace(" "), Comments("// OK")] + 3: JS_VARIABLE_STATEMENT@96..129 + 0: JS_VARIABLE_DECLARATION@96..112 + 0: (empty) + 1: VAR_KW@96..101 "var" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@101..112 + 0: JS_VARIABLE_DECLARATOR@101..112 + 0: JS_IDENTIFIER_BINDING@101..104 + 0: IDENT@101..104 "x4" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@104..112 + 0: EQ@104..106 "=" [] [Whitespace(" ")] + 1: JS_NEW_EXPRESSION@106..112 + 0: NEW_KW@106..110 "new" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@110..112 + 0: JS_REFERENCE_IDENTIFIER@110..112 + 0: IDENT@110..112 "SS" [] [] + 2: (empty) + 3: (empty) + 1: SEMICOLON@112..129 ";" [] [Whitespace(" "), Comments("// OK")] + 4: EOF@129..130 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap new file mode 100644 index 000000000000..2b9d8690414a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap @@ -0,0 +1,188 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test {} +new Test(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..10 "Test" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@10..11 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@11..12 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@12..14 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@14..15 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@15..17 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@17..18 "C" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@18..20 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@20..21 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + JsExpressionStatement { + expression: JsNewExpression { + new_token: NEW_KW@22..27 "new" [Newline("\n")] [Whitespace(" ")], + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@27..31 "Test" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@31..32 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@32..33 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@33..35 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@35..36 "B" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@36..38 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@38..39 "C" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@39..40 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@40..41 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@41..42 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + ], + eof_token: EOF@43..44 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..44 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..43 + 0: JS_CLASS_DECLARATION@0..22 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..10 + 0: IDENT@6..10 "Test" [] [] + 4: TS_TYPE_PARAMETERS@10..20 + 0: L_ANGLE@10..11 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@11..18 + 0: TS_TYPE_PARAMETER@11..12 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@11..11 + 1: TS_TYPE_PARAMETER_NAME@11..12 + 0: IDENT@11..12 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@12..14 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@14..15 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@14..14 + 1: TS_TYPE_PARAMETER_NAME@14..15 + 0: IDENT@14..15 "B" [] [] + 2: (empty) + 3: (empty) + 3: COMMA@15..17 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@17..18 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@17..17 + 1: TS_TYPE_PARAMETER_NAME@17..18 + 0: IDENT@17..18 "C" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@18..20 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@20..21 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@21..21 + 9: R_CURLY@21..22 "}" [] [] + 1: JS_EXPRESSION_STATEMENT@22..43 + 0: JS_NEW_EXPRESSION@22..42 + 0: NEW_KW@22..27 "new" [Newline("\n")] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@27..31 + 0: JS_REFERENCE_IDENTIFIER@27..31 + 0: IDENT@27..31 "Test" [] [] + 2: TS_TYPE_ARGUMENTS@31..40 + 0: L_ANGLE@31..32 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@32..39 + 0: TS_REFERENCE_TYPE@32..33 + 0: JS_REFERENCE_IDENTIFIER@32..33 + 0: IDENT@32..33 "A" [] [] + 1: (empty) + 1: COMMA@33..35 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@35..36 + 0: JS_REFERENCE_IDENTIFIER@35..36 + 0: IDENT@35..36 "B" [] [] + 1: (empty) + 3: COMMA@36..38 "," [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@38..39 + 0: JS_REFERENCE_IDENTIFIER@38..39 + 0: IDENT@38..39 "C" [] [] + 1: (empty) + 2: R_ANGLE@39..40 ">" [] [] + 3: JS_CALL_ARGUMENTS@40..42 + 0: L_PAREN@40..41 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@41..41 + 2: R_PAREN@41..42 ")" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 4: EOF@43..44 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap new file mode 100644 index 000000000000..a964ae68e6e6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap @@ -0,0 +1,271 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = { b: {} }; +a!; +function test() {} +test()! + a.b.c!; +a!!!!!!; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@10..11 "b" [] [], + }, + colon_token: COLON@11..13 ":" [] [Whitespace(" ")], + value: JsObjectExpression { + l_curly_token: L_CURLY@13..14 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@14..16 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@16..17 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + JsExpressionStatement { + expression: TsNonNullAssertionExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@18..20 "a" [Newline("\n")] [], + }, + }, + excl_token: BANG@20..21 "!" [] [], + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@22..32 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@32..36 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@37..39 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@39..40 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@40..41 "}" [] [], + }, + }, + JsExpressionStatement { + expression: TsNonNullAssertionExpression { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..46 "test" [Newline("\n")] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@46..47 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@47..48 ")" [] [], + }, + }, + excl_token: BANG@48..49 "!" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: TsNonNullAssertionExpression { + expression: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@49..52 "a" [Newline("\n"), Whitespace("\t")] [], + }, + }, + operator_token: DOT@52..53 "." [] [], + member: JsName { + value_token: IDENT@53..54 "b" [] [], + }, + }, + operator_token: DOT@54..55 "." [] [], + member: JsName { + value_token: IDENT@55..56 "c" [] [], + }, + }, + excl_token: BANG@56..57 "!" [] [], + }, + semicolon_token: SEMICOLON@57..58 ";" [] [], + }, + JsExpressionStatement { + expression: TsNonNullAssertionExpression { + expression: TsNonNullAssertionExpression { + expression: TsNonNullAssertionExpression { + expression: TsNonNullAssertionExpression { + expression: TsNonNullAssertionExpression { + expression: TsNonNullAssertionExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@58..60 "a" [Newline("\n")] [], + }, + }, + excl_token: BANG@60..61 "!" [] [], + }, + excl_token: BANG@61..62 "!" [] [], + }, + excl_token: BANG@62..63 "!" [] [], + }, + excl_token: BANG@63..64 "!" [] [], + }, + excl_token: BANG@64..65 "!" [] [], + }, + excl_token: BANG@65..66 "!" [] [], + }, + semicolon_token: SEMICOLON@66..67 ";" [] [], + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: JS_VARIABLE_STATEMENT@0..18 + 0: JS_VARIABLE_DECLARATION@0..17 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..17 + 0: JS_VARIABLE_DECLARATOR@4..17 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..17 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@8..17 + 0: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@10..16 + 0: JS_PROPERTY_OBJECT_MEMBER@10..16 + 0: JS_LITERAL_MEMBER_NAME@10..11 + 0: IDENT@10..11 "b" [] [] + 1: COLON@11..13 ":" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@13..16 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@14..14 + 2: R_CURLY@14..16 "}" [] [Whitespace(" ")] + 2: R_CURLY@16..17 "}" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@18..22 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@18..21 + 0: JS_IDENTIFIER_EXPRESSION@18..20 + 0: JS_REFERENCE_IDENTIFIER@18..20 + 0: IDENT@18..20 "a" [Newline("\n")] [] + 1: BANG@20..21 "!" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 2: JS_FUNCTION_DECLARATION@22..41 + 0: (empty) + 1: FUNCTION_KW@22..32 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@32..36 + 0: IDENT@32..36 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@36..39 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_PARAMETER_LIST@37..37 + 2: R_PAREN@37..39 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@39..41 + 0: L_CURLY@39..40 "{" [] [] + 1: JS_DIRECTIVE_LIST@40..40 + 2: JS_STATEMENT_LIST@40..40 + 3: R_CURLY@40..41 "}" [] [] + 3: JS_EXPRESSION_STATEMENT@41..49 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@41..49 + 0: JS_CALL_EXPRESSION@41..48 + 0: JS_IDENTIFIER_EXPRESSION@41..46 + 0: JS_REFERENCE_IDENTIFIER@41..46 + 0: IDENT@41..46 "test" [Newline("\n")] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@46..48 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@47..47 + 2: R_PAREN@47..48 ")" [] [] + 1: BANG@48..49 "!" [] [] + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@49..58 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@49..57 + 0: JS_STATIC_MEMBER_EXPRESSION@49..56 + 0: JS_STATIC_MEMBER_EXPRESSION@49..54 + 0: JS_IDENTIFIER_EXPRESSION@49..52 + 0: JS_REFERENCE_IDENTIFIER@49..52 + 0: IDENT@49..52 "a" [Newline("\n"), Whitespace("\t")] [] + 1: DOT@52..53 "." [] [] + 2: JS_NAME@53..54 + 0: IDENT@53..54 "b" [] [] + 1: DOT@54..55 "." [] [] + 2: JS_NAME@55..56 + 0: IDENT@55..56 "c" [] [] + 1: BANG@56..57 "!" [] [] + 1: SEMICOLON@57..58 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@58..67 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..66 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..65 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..64 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..63 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..62 + 0: TS_NON_NULL_ASSERTION_EXPRESSION@58..61 + 0: JS_IDENTIFIER_EXPRESSION@58..60 + 0: JS_REFERENCE_IDENTIFIER@58..60 + 0: IDENT@58..60 "a" [Newline("\n")] [] + 1: BANG@60..61 "!" [] [] + 1: BANG@61..62 "!" [] [] + 1: BANG@62..63 "!" [] [] + 1: BANG@63..64 "!" [] [] + 1: BANG@64..65 "!" [] [] + 1: BANG@65..66 "!" [] [] + 1: SEMICOLON@66..67 ";" [] [] + 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts.snap new file mode 100644 index 000000000000..2da2ce25707d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts.snap @@ -0,0 +1,184 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a; +a! &= 2; +let b = { a: null }; +b.a! &= 5 + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@5..6 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: TsNonNullAssertionAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@6..8 "a" [Newline("\n")] [], + }, + excl_token: BANG@8..10 "!" [] [Whitespace(" ")], + }, + operator_token: AMPEQ@10..13 "&=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..14 "2" [] [], + }, + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@20..22 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@26..27 "a" [] [], + }, + colon_token: COLON@27..29 ":" [] [Whitespace(" ")], + value: JsNullLiteralExpression { + value_token: NULL_KW@29..34 "null" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@34..35 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@35..36 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: TsNonNullAssertionAssignment { + assignment: JsStaticMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@36..38 "b" [Newline("\n")] [], + }, + }, + dot_token: DOT@38..39 "." [] [], + member: JsName { + value_token: IDENT@39..40 "a" [] [], + }, + }, + excl_token: BANG@40..42 "!" [] [Whitespace(" ")], + }, + operator_token: AMPEQ@42..45 "&=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@45..46 "5" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@46..47 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..47 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..46 + 0: JS_VARIABLE_STATEMENT@0..6 + 0: JS_VARIABLE_DECLARATION@0..5 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..5 + 0: JS_VARIABLE_DECLARATOR@4..5 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@5..6 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@6..15 + 0: JS_ASSIGNMENT_EXPRESSION@6..14 + 0: TS_NON_NULL_ASSERTION_ASSIGNMENT@6..10 + 0: JS_IDENTIFIER_ASSIGNMENT@6..8 + 0: IDENT@6..8 "a" [Newline("\n")] [] + 1: BANG@8..10 "!" [] [Whitespace(" ")] + 1: AMPEQ@10..13 "&=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@13..14 + 0: JS_NUMBER_LITERAL@13..14 "2" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 2: JS_VARIABLE_STATEMENT@15..36 + 0: JS_VARIABLE_DECLARATION@15..35 + 0: (empty) + 1: LET_KW@15..20 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@20..35 + 0: JS_VARIABLE_DECLARATOR@20..35 + 0: JS_IDENTIFIER_BINDING@20..22 + 0: IDENT@20..22 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@22..35 + 0: EQ@22..24 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@24..35 + 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@26..34 + 0: JS_PROPERTY_OBJECT_MEMBER@26..34 + 0: JS_LITERAL_MEMBER_NAME@26..27 + 0: IDENT@26..27 "a" [] [] + 1: COLON@27..29 ":" [] [Whitespace(" ")] + 2: JS_NULL_LITERAL_EXPRESSION@29..34 + 0: NULL_KW@29..34 "null" [] [Whitespace(" ")] + 2: R_CURLY@34..35 "}" [] [] + 1: SEMICOLON@35..36 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@36..46 + 0: JS_ASSIGNMENT_EXPRESSION@36..46 + 0: TS_NON_NULL_ASSERTION_ASSIGNMENT@36..42 + 0: JS_STATIC_MEMBER_ASSIGNMENT@36..40 + 0: JS_IDENTIFIER_EXPRESSION@36..38 + 0: JS_REFERENCE_IDENTIFIER@36..38 + 0: IDENT@36..38 "b" [Newline("\n")] [] + 1: DOT@38..39 "." [] [] + 2: JS_NAME@39..40 + 0: IDENT@39..40 "a" [] [] + 1: BANG@40..42 "!" [] [Whitespace(" ")] + 1: AMPEQ@42..45 "&=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@45..46 + 0: JS_NUMBER_LITERAL@45..46 "5" [] [] + 1: (empty) + 4: EOF@46..47 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_object_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_object_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts.snap new file mode 100644 index 000000000000..67a77f6184a6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts.snap @@ -0,0 +1,362 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { a: string, b: number }; +type B = { a: string; b: number }; +type C = { a: string, b: number; c: string }; +type D = { + a: string + b: number +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@11..12 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@12..14 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@14..20 "string" [] [], + }, + }, + separator_token: COMMA@20..22 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@22..23 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@25..32 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@40..42 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@44..46 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@46..47 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@47..49 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@49..55 "string" [] [], + }, + }, + separator_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@57..58 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@58..60 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@60..67 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + semicolon_token: SEMICOLON@68..69 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@75..77 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@77..79 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@79..81 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@81..82 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@82..84 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@84..90 "string" [] [], + }, + }, + separator_token: COMMA@90..92 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@92..93 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@93..95 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@95..101 "number" [] [], + }, + }, + separator_token: SEMICOLON@101..103 ";" [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@103..104 "c" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@104..106 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@106..113 "string" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@113..114 "}" [] [], + }, + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@121..123 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@123..125 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@125..126 "{" [] [], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@126..129 "a" [Newline("\n"), Whitespace("\t")] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@129..131 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@131..137 "string" [] [], + }, + }, + separator_token: missing (optional), + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@137..140 "b" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@140..142 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@142..148 "number" [] [], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@148..150 "}" [Newline("\n")] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@150..151 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..151 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..150 + 0: TS_TYPE_ALIAS_DECLARATION@0..34 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..33 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..32 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@11..22 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@11..12 + 0: IDENT@11..12 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@12..20 + 0: COLON@12..14 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@14..20 + 0: STRING_KW@14..20 "string" [] [] + 4: COMMA@20..22 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@22..32 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@22..23 + 0: IDENT@22..23 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@23..32 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@25..32 + 0: NUMBER_KW@25..32 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@32..33 "}" [] [] + 5: SEMICOLON@33..34 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@34..69 + 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@42..44 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@44..68 + 0: L_CURLY@44..46 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@46..67 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@46..57 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@46..47 + 0: IDENT@46..47 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@47..55 + 0: COLON@47..49 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@49..55 + 0: STRING_KW@49..55 "string" [] [] + 4: SEMICOLON@55..57 ";" [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@57..67 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@57..58 + 0: IDENT@57..58 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@58..67 + 0: COLON@58..60 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@60..67 + 0: NUMBER_KW@60..67 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@67..68 "}" [] [] + 5: SEMICOLON@68..69 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@69..115 + 0: TYPE_KW@69..75 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@75..77 + 0: IDENT@75..77 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@77..79 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@79..114 + 0: L_CURLY@79..81 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@81..113 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@81..92 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@81..82 + 0: IDENT@81..82 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@82..90 + 0: COLON@82..84 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@84..90 + 0: STRING_KW@84..90 "string" [] [] + 4: COMMA@90..92 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@92..103 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@92..93 + 0: IDENT@92..93 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@93..101 + 0: COLON@93..95 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@95..101 + 0: NUMBER_KW@95..101 "number" [] [] + 4: SEMICOLON@101..103 ";" [] [Whitespace(" ")] + 2: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@103..113 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@103..104 + 0: IDENT@103..104 "c" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@104..113 + 0: COLON@104..106 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@106..113 + 0: STRING_KW@106..113 "string" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@113..114 "}" [] [] + 5: SEMICOLON@114..115 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@115..150 + 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@121..123 + 0: IDENT@121..123 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@123..125 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@125..150 + 0: L_CURLY@125..126 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@126..148 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@126..137 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@126..129 + 0: IDENT@126..129 "a" [Newline("\n"), Whitespace("\t")] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@129..137 + 0: COLON@129..131 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@131..137 + 0: STRING_KW@131..137 "string" [] [] + 4: (empty) + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@137..148 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@137..140 + 0: IDENT@137..140 "b" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@140..148 + 0: COLON@140..142 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@142..148 + 0: NUMBER_KW@142..148 "number" [] [] + 4: (empty) + 2: R_CURLY@148..150 "}" [Newline("\n")] [] + 5: (empty) + 4: EOF@150..151 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts.snap new file mode 100644 index 000000000000..432bcc21a041 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts.snap @@ -0,0 +1,163 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +(() => {})?.(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1..2 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@2..3 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@3..5 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@5..6 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@6..7 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@7..8 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@10..13 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@13..14 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@14..15 "}" [] [], + }, + }, + r_paren_token: R_PAREN@15..16 ")" [] [], + }, + optional_chain_token: QUESTIONDOT@16..18 "?." [] [], + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@18..19 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@19..20 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@20..22 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@22..23 "B" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@23..24 ">" [] [], + }, + arguments: JsCallArguments { + l_paren_token: L_PAREN@24..25 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@25..26 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + ], + eof_token: EOF@27..28 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..28 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..27 + 0: JS_EXPRESSION_STATEMENT@0..27 + 0: JS_CALL_EXPRESSION@0..26 + 0: JS_PARENTHESIZED_EXPRESSION@0..16 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@1..15 + 0: (empty) + 1: TS_TYPE_PARAMETERS@1..7 + 0: L_ANGLE@1..2 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@2..6 + 0: TS_TYPE_PARAMETER@2..3 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@2..2 + 1: TS_TYPE_PARAMETER_NAME@2..3 + 0: IDENT@2..3 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@3..5 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@5..6 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@5..5 + 1: TS_TYPE_PARAMETER_NAME@5..6 + 0: IDENT@5..6 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@6..7 ">" [] [] + 2: JS_PARAMETERS@7..10 + 0: L_PAREN@7..8 "(" [] [] + 1: JS_PARAMETER_LIST@8..8 + 2: R_PAREN@8..10 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@10..13 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@13..15 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_DIRECTIVE_LIST@14..14 + 2: JS_STATEMENT_LIST@14..14 + 3: R_CURLY@14..15 "}" [] [] + 2: R_PAREN@15..16 ")" [] [] + 1: QUESTIONDOT@16..18 "?." [] [] + 2: TS_TYPE_ARGUMENTS@18..24 + 0: L_ANGLE@18..19 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@19..23 + 0: TS_REFERENCE_TYPE@19..20 + 0: JS_REFERENCE_IDENTIFIER@19..20 + 0: IDENT@19..20 "A" [] [] + 1: (empty) + 1: COMMA@20..22 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@22..23 + 0: JS_REFERENCE_IDENTIFIER@22..23 + 0: IDENT@22..23 "B" [] [] + 1: (empty) + 2: R_ANGLE@23..24 ">" [] [] + 3: JS_CALL_ARGUMENTS@24..26 + 0: L_PAREN@24..25 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@25..25 + 2: R_PAREN@25..26 ")" [] [] + 1: SEMICOLON@26..27 ";" [] [] + 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap new file mode 100644 index 000000000000..be9c3238a2e8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap @@ -0,0 +1,103 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { test?() {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@10..14 "test" [] [], + }, + question_mark_token: QUESTION@14..15 "?" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@15..16 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@16..18 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@18..19 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@19..21 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@21..22 "}" [] [], + }, + ], + eof_token: EOF@22..23 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..23 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..22 + 0: JS_CLASS_DECLARATION@0..22 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..21 + 0: JS_METHOD_CLASS_MEMBER@10..21 + 0: JS_METHOD_MODIFIER_LIST@10..10 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@10..14 + 0: IDENT@10..14 "test" [] [] + 4: QUESTION@14..15 "?" [] [] + 5: (empty) + 6: JS_PARAMETERS@15..18 + 0: L_PAREN@15..16 "(" [] [] + 1: JS_PARAMETER_LIST@16..16 + 2: R_PAREN@16..18 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@18..21 + 0: L_CURLY@18..19 "{" [] [] + 1: JS_DIRECTIVE_LIST@19..19 + 2: JS_STATEMENT_LIST@19..19 + 3: R_CURLY@19..21 "}" [] [Whitespace(" ")] + 9: R_CURLY@21..22 "}" [] [] + 4: EOF@22..23 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap new file mode 100644 index 000000000000..053b88921546 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap @@ -0,0 +1,248 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare namespace A { + export class Ajv { + errorsText(errors?: string[] | null | undefined, { separator, dataVar }?: ErrorsTextOptions): string; + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@18..20 "A" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@20..21 "{" [] [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@21..31 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + export_clause: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@31..37 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@37..41 "Ajv" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@41..42 "{" [] [], + members: JsClassMemberList [ + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@42..57 "errorsText" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@57..58 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@58..64 "errors" [] [], + }, + question_mark_token: QUESTION@64..65 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@65..67 ":" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsArrayType { + element_type: TsStringType { + string_token: STRING_KW@67..73 "string" [] [], + }, + l_brack_token: L_BRACK@73..74 "[" [] [], + r_brack_token: R_BRACK@74..76 "]" [] [Whitespace(" ")], + }, + PIPE@76..78 "|" [] [Whitespace(" ")], + TsNullLiteralType { + literal_token: NULL_KW@78..83 "null" [] [Whitespace(" ")], + }, + PIPE@83..85 "|" [] [Whitespace(" ")], + TsUndefinedType { + undefined_token: UNDEFINED_KW@85..94 "undefined" [] [], + }, + ], + }, + }, + initializer: missing (optional), + }, + COMMA@94..96 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsObjectBindingPattern { + l_curly_token: L_CURLY@96..98 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@98..107 "separator" [] [], + }, + init: missing (optional), + }, + COMMA@107..109 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@109..117 "dataVar" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@117..118 "}" [] [], + }, + question_mark_token: QUESTION@118..119 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@121..138 "ErrorsTextOptions" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@138..139 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@139..141 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@141..147 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@147..148 ";" [] [], + }, + ], + r_curly_token: R_CURLY@148..152 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@152..154 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@154..155 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..155 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..154 + 0: TS_DECLARE_STATEMENT@0..154 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@8..154 + 0: NAMESPACE_KW@8..18 "namespace" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@18..20 + 0: IDENT@18..20 "A" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@20..154 + 0: L_CURLY@20..21 "{" [] [] + 1: JS_MODULE_ITEM_LIST@21..152 + 0: JS_EXPORT@21..152 + 0: JS_DECORATOR_LIST@21..21 + 1: EXPORT_KW@21..31 "export" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_CLASS_DECLARATION@31..152 + 0: JS_DECORATOR_LIST@31..31 + 1: (empty) + 2: CLASS_KW@31..37 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@37..41 + 0: IDENT@37..41 "Ajv" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@41..42 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@42..148 + 0: TS_METHOD_SIGNATURE_CLASS_MEMBER@42..148 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@42..42 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@42..57 + 0: IDENT@42..57 "errorsText" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@57..139 + 0: L_PAREN@57..58 "(" [] [] + 1: JS_PARAMETER_LIST@58..138 + 0: JS_FORMAL_PARAMETER@58..94 + 0: JS_DECORATOR_LIST@58..58 + 1: JS_IDENTIFIER_BINDING@58..64 + 0: IDENT@58..64 "errors" [] [] + 2: QUESTION@64..65 "?" [] [] + 3: TS_TYPE_ANNOTATION@65..94 + 0: COLON@65..67 ":" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@67..94 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@67..94 + 0: TS_ARRAY_TYPE@67..76 + 0: TS_STRING_TYPE@67..73 + 0: STRING_KW@67..73 "string" [] [] + 1: L_BRACK@73..74 "[" [] [] + 2: R_BRACK@74..76 "]" [] [Whitespace(" ")] + 1: PIPE@76..78 "|" [] [Whitespace(" ")] + 2: TS_NULL_LITERAL_TYPE@78..83 + 0: NULL_KW@78..83 "null" [] [Whitespace(" ")] + 3: PIPE@83..85 "|" [] [Whitespace(" ")] + 4: TS_UNDEFINED_TYPE@85..94 + 0: UNDEFINED_KW@85..94 "undefined" [] [] + 4: (empty) + 1: COMMA@94..96 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@96..138 + 0: JS_DECORATOR_LIST@96..96 + 1: JS_OBJECT_BINDING_PATTERN@96..118 + 0: L_CURLY@96..98 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@98..117 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@98..107 + 0: JS_IDENTIFIER_BINDING@98..107 + 0: IDENT@98..107 "separator" [] [] + 1: (empty) + 1: COMMA@107..109 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@109..117 + 0: JS_IDENTIFIER_BINDING@109..117 + 0: IDENT@109..117 "dataVar" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@117..118 "}" [] [] + 2: QUESTION@118..119 "?" [] [] + 3: TS_TYPE_ANNOTATION@119..138 + 0: COLON@119..121 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@121..138 + 0: JS_REFERENCE_IDENTIFIER@121..138 + 0: IDENT@121..138 "ErrorsTextOptions" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@138..139 ")" [] [] + 6: TS_RETURN_TYPE_ANNOTATION@139..147 + 0: COLON@139..141 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@141..147 + 0: STRING_KW@141..147 "string" [] [] + 7: SEMICOLON@147..148 ";" [] [] + 9: R_CURLY@148..152 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@152..154 "}" [Newline("\n")] [] + 4: EOF@154..155 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts.snap new file mode 100644 index 000000000000..1fa48f9dfe60 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts.snap @@ -0,0 +1,64 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = (string) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@9..10 "(" [] [], + ty: TsStringType { + string_token: STRING_KW@10..16 "string" [] [], + }, + r_paren_token: R_PAREN@16..17 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@17..18 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..18 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..17 + 0: TS_TYPE_ALIAS_DECLARATION@0..17 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_PARENTHESIZED_TYPE@9..17 + 0: L_PAREN@9..10 "(" [] [] + 1: TS_STRING_TYPE@10..16 + 0: STRING_KW@10..16 "string" [] [] + 2: R_PAREN@16..17 ")" [] [] + 5: (empty) + 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts.snap new file mode 100644 index 000000000000..68e3e0dccf59 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts.snap @@ -0,0 +1,277 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = any +type B = number; +type C = object; +type D = boolean; +type E = bigint; +type F = string; +type G = symbol; +type H = void; +type I = undefined; +type J = null; +type K = never + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@9..12 "any" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@12..18 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@18..20 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@20..22 "=" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@22..28 "number" [] [], + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@35..37 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@37..39 "=" [] [Whitespace(" ")], + ty: TsNonPrimitiveType { + object_token: OBJECT_KW@39..45 "object" [] [], + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@46..52 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@52..54 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@54..56 "=" [] [Whitespace(" ")], + ty: TsBooleanType { + boolean_token: BOOLEAN_KW@56..63 "boolean" [] [], + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@70..72 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@72..74 "=" [] [Whitespace(" ")], + ty: TsBigintType { + bigint_token: BIGINT_KW@74..80 "bigint" [] [], + }, + semicolon_token: SEMICOLON@80..81 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@87..89 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@89..91 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@91..97 "string" [] [], + }, + semicolon_token: SEMICOLON@97..98 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@98..104 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@104..106 "G" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@106..108 "=" [] [Whitespace(" ")], + ty: TsSymbolType { + symbol_token: SYMBOL_KW@108..114 "symbol" [] [], + }, + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@121..123 "H" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@123..125 "=" [] [Whitespace(" ")], + ty: TsVoidType { + void_token: VOID_KW@125..129 "void" [] [], + }, + semicolon_token: SEMICOLON@129..130 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@136..138 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@138..140 "=" [] [Whitespace(" ")], + ty: TsUndefinedType { + undefined_token: UNDEFINED_KW@140..149 "undefined" [] [], + }, + semicolon_token: SEMICOLON@149..150 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@150..156 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@156..158 "J" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@158..160 "=" [] [Whitespace(" ")], + ty: TsNullLiteralType { + literal_token: NULL_KW@160..164 "null" [] [], + }, + semicolon_token: SEMICOLON@164..165 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@165..171 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@171..173 "K" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@173..175 "=" [] [Whitespace(" ")], + ty: TsNeverType { + never_token: NEVER_KW@175..180 "never" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@180..181 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..181 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..180 + 0: TS_TYPE_ALIAS_DECLARATION@0..12 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_ANY_TYPE@9..12 + 0: ANY_KW@9..12 "any" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@12..29 + 0: TYPE_KW@12..18 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@18..20 + 0: IDENT@18..20 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@20..22 "=" [] [Whitespace(" ")] + 4: TS_NUMBER_TYPE@22..28 + 0: NUMBER_KW@22..28 "number" [] [] + 5: SEMICOLON@28..29 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@29..46 + 0: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@35..37 + 0: IDENT@35..37 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@37..39 "=" [] [Whitespace(" ")] + 4: TS_NON_PRIMITIVE_TYPE@39..45 + 0: OBJECT_KW@39..45 "object" [] [] + 5: SEMICOLON@45..46 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@46..64 + 0: TYPE_KW@46..52 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@52..54 + 0: IDENT@52..54 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@54..56 "=" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@56..63 + 0: BOOLEAN_KW@56..63 "boolean" [] [] + 5: SEMICOLON@63..64 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@64..81 + 0: TYPE_KW@64..70 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@70..72 + 0: IDENT@70..72 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@72..74 "=" [] [Whitespace(" ")] + 4: TS_BIGINT_TYPE@74..80 + 0: BIGINT_KW@74..80 "bigint" [] [] + 5: SEMICOLON@80..81 ";" [] [] + 5: TS_TYPE_ALIAS_DECLARATION@81..98 + 0: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@87..89 + 0: IDENT@87..89 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@89..91 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@91..97 + 0: STRING_KW@91..97 "string" [] [] + 5: SEMICOLON@97..98 ";" [] [] + 6: TS_TYPE_ALIAS_DECLARATION@98..115 + 0: TYPE_KW@98..104 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@104..106 + 0: IDENT@104..106 "G" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@106..108 "=" [] [Whitespace(" ")] + 4: TS_SYMBOL_TYPE@108..114 + 0: SYMBOL_KW@108..114 "symbol" [] [] + 5: SEMICOLON@114..115 ";" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@115..130 + 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@121..123 + 0: IDENT@121..123 "H" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@123..125 "=" [] [Whitespace(" ")] + 4: TS_VOID_TYPE@125..129 + 0: VOID_KW@125..129 "void" [] [] + 5: SEMICOLON@129..130 ";" [] [] + 8: TS_TYPE_ALIAS_DECLARATION@130..150 + 0: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@136..138 + 0: IDENT@136..138 "I" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@138..140 "=" [] [Whitespace(" ")] + 4: TS_UNDEFINED_TYPE@140..149 + 0: UNDEFINED_KW@140..149 "undefined" [] [] + 5: SEMICOLON@149..150 ";" [] [] + 9: TS_TYPE_ALIAS_DECLARATION@150..165 + 0: TYPE_KW@150..156 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@156..158 + 0: IDENT@156..158 "J" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@158..160 "=" [] [Whitespace(" ")] + 4: TS_NULL_LITERAL_TYPE@160..164 + 0: NULL_KW@160..164 "null" [] [] + 5: SEMICOLON@164..165 ";" [] [] + 10: TS_TYPE_ALIAS_DECLARATION@165..180 + 0: TYPE_KW@165..171 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@171..173 + 0: IDENT@171..173 "K" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@173..175 "=" [] [Whitespace(" ")] + 4: TS_NEVER_TYPE@175..180 + 0: NEVER_KW@175..180 "never" [] [] + 5: (empty) + 4: EOF@180..181 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap new file mode 100644 index 000000000000..431fb28c1784 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap @@ -0,0 +1,121 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class B { set: String; get: Number } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..13 "set" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@15..21 "String" [] [], + }, + type_arguments: missing (optional), + }, + }, + value: missing (optional), + semicolon_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], + }, + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@23..26 "get" [] [], + }, + property_annotation: TsTypeAnnotation { + colon_token: COLON@26..28 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@28..35 "Number" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + value: missing (optional), + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@35..36 "}" [] [], + }, + ], + eof_token: EOF@36..37 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..37 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..36 + 0: JS_CLASS_DECLARATION@0..36 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..35 + 0: JS_PROPERTY_CLASS_MEMBER@10..23 + 0: JS_PROPERTY_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..13 + 0: IDENT@10..13 "set" [] [] + 2: TS_TYPE_ANNOTATION@13..21 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@15..21 + 0: JS_REFERENCE_IDENTIFIER@15..21 + 0: IDENT@15..21 "String" [] [] + 1: (empty) + 3: (empty) + 4: SEMICOLON@21..23 ";" [] [Whitespace(" ")] + 1: JS_PROPERTY_CLASS_MEMBER@23..35 + 0: JS_PROPERTY_MODIFIER_LIST@23..23 + 1: JS_LITERAL_MEMBER_NAME@23..26 + 0: IDENT@23..26 "get" [] [] + 2: TS_TYPE_ANNOTATION@26..35 + 0: COLON@26..28 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@28..35 + 0: JS_REFERENCE_IDENTIFIER@28..35 + 0: IDENT@28..35 "Number" [] [Whitespace(" ")] + 1: (empty) + 3: (empty) + 4: (empty) + 9: R_CURLY@35..36 "}" [] [] + 4: EOF@36..37 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap new file mode 100644 index 000000000000..5942d9af52dc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap @@ -0,0 +1,692 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { a?: string; b?(): number } +type B = { a: string, b(): number } +type C = { m(a: string, b: number, c: string): any } +type D = { readonly: string, readonly a: number } +type E = { m(a: A, b: B): never } +type F = { m(a: A): never } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@11..12 "a" [] [], + }, + optional_token: QUESTION@12..13 "?" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@13..15 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@15..21 "string" [] [], + }, + }, + separator_token: SEMICOLON@21..23 ";" [] [Whitespace(" ")], + }, + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@23..24 "b" [] [], + }, + optional_token: QUESTION@24..25 "?" [] [], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@25..26 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@26..27 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@27..29 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@29..36 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@36..37 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@43..45 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@45..47 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@47..49 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@49..50 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@50..52 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@52..58 "string" [] [], + }, + }, + separator_token: COMMA@58..60 "," [] [Whitespace(" ")], + }, + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@60..61 "b" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@61..62 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@62..63 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@63..65 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@65..72 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@72..73 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@73..79 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@79..81 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@81..83 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@83..85 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@85..86 "m" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@86..87 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@87..88 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@88..90 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@90..96 "string" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@96..98 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@98..99 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@99..101 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@101..107 "number" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@107..109 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@109..110 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@110..112 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@112..118 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@118..119 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@121..125 "any" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@126..132 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@132..134 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@134..136 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@136..138 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@138..146 "readonly" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@146..148 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@148..154 "string" [] [], + }, + }, + separator_token: COMMA@154..156 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: READONLY_KW@156..165 "readonly" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@165..166 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@166..168 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@168..175 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@175..176 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@176..182 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@182..184 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@184..186 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@186..188 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@188..189 "m" [] [], + }, + optional_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@189..190 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@190..191 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@191..193 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@193..194 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@194..195 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@195..196 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@196..197 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@197..199 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@199..200 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + COMMA@200..202 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@202..203 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@203..205 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@205..206 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@206..207 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@207..209 ":" [] [Whitespace(" ")], + ty: TsNeverType { + never_token: NEVER_KW@209..215 "never" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@215..216 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@222..224 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@224..226 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@226..228 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@228..229 "m" [] [], + }, + optional_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@229..230 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@230..236 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@236..237 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@237..238 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@238..239 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@239..240 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@240..242 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@242..243 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@243..244 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@244..246 ":" [] [Whitespace(" ")], + ty: TsNeverType { + never_token: NEVER_KW@246..252 "never" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@252..253 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@253..254 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..254 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..253 + 0: TS_TYPE_ALIAS_DECLARATION@0..37 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..37 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..36 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@11..23 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@11..12 + 0: IDENT@11..12 "a" [] [] + 2: QUESTION@12..13 "?" [] [] + 3: TS_TYPE_ANNOTATION@13..21 + 0: COLON@13..15 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@15..21 + 0: STRING_KW@15..21 "string" [] [] + 4: SEMICOLON@21..23 ";" [] [Whitespace(" ")] + 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@23..36 + 0: JS_LITERAL_MEMBER_NAME@23..24 + 0: IDENT@23..24 "b" [] [] + 1: QUESTION@24..25 "?" [] [] + 2: (empty) + 3: JS_PARAMETERS@25..27 + 0: L_PAREN@25..26 "(" [] [] + 1: JS_PARAMETER_LIST@26..26 + 2: R_PAREN@26..27 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@27..36 + 0: COLON@27..29 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@29..36 + 0: NUMBER_KW@29..36 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@36..37 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@37..73 + 0: TYPE_KW@37..43 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@45..47 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@47..73 + 0: L_CURLY@47..49 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@49..72 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@49..60 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@49..50 + 0: IDENT@49..50 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@50..58 + 0: COLON@50..52 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@52..58 + 0: STRING_KW@52..58 "string" [] [] + 4: COMMA@58..60 "," [] [Whitespace(" ")] + 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@60..72 + 0: JS_LITERAL_MEMBER_NAME@60..61 + 0: IDENT@60..61 "b" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@61..63 + 0: L_PAREN@61..62 "(" [] [] + 1: JS_PARAMETER_LIST@62..62 + 2: R_PAREN@62..63 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@63..72 + 0: COLON@63..65 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@65..72 + 0: NUMBER_KW@65..72 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@72..73 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@73..126 + 0: TYPE_KW@73..79 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@79..81 + 0: IDENT@79..81 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@81..83 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@83..126 + 0: L_CURLY@83..85 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@85..125 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@85..125 + 0: JS_LITERAL_MEMBER_NAME@85..86 + 0: IDENT@85..86 "m" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@86..119 + 0: L_PAREN@86..87 "(" [] [] + 1: JS_PARAMETER_LIST@87..118 + 0: JS_FORMAL_PARAMETER@87..96 + 0: JS_DECORATOR_LIST@87..87 + 1: JS_IDENTIFIER_BINDING@87..88 + 0: IDENT@87..88 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@88..96 + 0: COLON@88..90 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@90..96 + 0: STRING_KW@90..96 "string" [] [] + 4: (empty) + 1: COMMA@96..98 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@98..107 + 0: JS_DECORATOR_LIST@98..98 + 1: JS_IDENTIFIER_BINDING@98..99 + 0: IDENT@98..99 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@99..107 + 0: COLON@99..101 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@101..107 + 0: NUMBER_KW@101..107 "number" [] [] + 4: (empty) + 3: COMMA@107..109 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@109..118 + 0: JS_DECORATOR_LIST@109..109 + 1: JS_IDENTIFIER_BINDING@109..110 + 0: IDENT@109..110 "c" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@110..118 + 0: COLON@110..112 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@112..118 + 0: STRING_KW@112..118 "string" [] [] + 4: (empty) + 2: R_PAREN@118..119 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@119..125 + 0: COLON@119..121 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@121..125 + 0: ANY_KW@121..125 "any" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@125..126 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@126..176 + 0: TYPE_KW@126..132 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@132..134 + 0: IDENT@132..134 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@134..136 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@136..176 + 0: L_CURLY@136..138 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@138..175 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@138..156 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@138..146 + 0: IDENT@138..146 "readonly" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@146..154 + 0: COLON@146..148 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@148..154 + 0: STRING_KW@148..154 "string" [] [] + 4: COMMA@154..156 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@156..175 + 0: READONLY_KW@156..165 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@165..166 + 0: IDENT@165..166 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@166..175 + 0: COLON@166..168 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@168..175 + 0: NUMBER_KW@168..175 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@175..176 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@176..216 + 0: TYPE_KW@176..182 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@182..184 + 0: IDENT@182..184 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@184..186 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@186..216 + 0: L_CURLY@186..188 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@188..215 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@188..215 + 0: JS_LITERAL_MEMBER_NAME@188..189 + 0: IDENT@188..189 "m" [] [] + 1: (empty) + 2: TS_TYPE_PARAMETERS@189..195 + 0: L_ANGLE@189..190 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@190..194 + 0: TS_TYPE_PARAMETER@190..191 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@190..190 + 1: TS_TYPE_PARAMETER_NAME@190..191 + 0: IDENT@190..191 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@191..193 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@193..194 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@193..193 + 1: TS_TYPE_PARAMETER_NAME@193..194 + 0: IDENT@193..194 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@194..195 ">" [] [] + 3: JS_PARAMETERS@195..207 + 0: L_PAREN@195..196 "(" [] [] + 1: JS_PARAMETER_LIST@196..206 + 0: JS_FORMAL_PARAMETER@196..200 + 0: JS_DECORATOR_LIST@196..196 + 1: JS_IDENTIFIER_BINDING@196..197 + 0: IDENT@196..197 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@197..200 + 0: COLON@197..199 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@199..200 + 0: JS_REFERENCE_IDENTIFIER@199..200 + 0: IDENT@199..200 "A" [] [] + 1: (empty) + 4: (empty) + 1: COMMA@200..202 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@202..206 + 0: JS_DECORATOR_LIST@202..202 + 1: JS_IDENTIFIER_BINDING@202..203 + 0: IDENT@202..203 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@203..206 + 0: COLON@203..205 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@205..206 + 0: JS_REFERENCE_IDENTIFIER@205..206 + 0: IDENT@205..206 "B" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@206..207 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@207..215 + 0: COLON@207..209 ":" [] [Whitespace(" ")] + 1: TS_NEVER_TYPE@209..215 + 0: NEVER_KW@209..215 "never" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@215..216 "}" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@216..253 + 0: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@222..224 + 0: IDENT@222..224 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@224..226 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@226..253 + 0: L_CURLY@226..228 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@228..252 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@228..252 + 0: JS_LITERAL_MEMBER_NAME@228..229 + 0: IDENT@228..229 "m" [] [] + 1: (empty) + 2: TS_TYPE_PARAMETERS@229..238 + 0: L_ANGLE@229..230 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@230..237 + 0: TS_TYPE_PARAMETER@230..237 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@230..236 + 0: TS_CONST_MODIFIER@230..236 + 0: CONST_KW@230..236 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@236..237 + 0: IDENT@236..237 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@237..238 ">" [] [] + 3: JS_PARAMETERS@238..244 + 0: L_PAREN@238..239 "(" [] [] + 1: JS_PARAMETER_LIST@239..243 + 0: JS_FORMAL_PARAMETER@239..243 + 0: JS_DECORATOR_LIST@239..239 + 1: JS_IDENTIFIER_BINDING@239..240 + 0: IDENT@239..240 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@240..243 + 0: COLON@240..242 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@242..243 + 0: JS_REFERENCE_IDENTIFIER@242..243 + 0: IDENT@242..243 "A" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@243..244 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@244..252 + 0: COLON@244..246 ":" [] [Whitespace(" ")] + 1: TS_NEVER_TYPE@246..252 + 0: NEVER_KW@246..252 "never" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@252..253 "}" [] [] + 5: (empty) + 4: EOF@253..254 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts.snap new file mode 100644 index 000000000000..38cce395eebe --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts.snap @@ -0,0 +1,550 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { constructor(private x, protected y, public z) {} } +class B { constructor(readonly w, private readonly x, protected readonly y, public readonly z) {} } +class C { constructor(private x: string, readonly y?, z = "default", ...rest) {} } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..10 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@10..21 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@21..22 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@30..31 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + COMMA@31..33 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@33..43 "protected" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@43..44 "y" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + COMMA@44..46 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@46..53 "public" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@53..54 "z" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@54..56 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@56..57 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@57..59 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@59..60 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@60..67 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@67..69 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@69..71 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@71..82 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@82..83 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@83..92 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@92..93 "w" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + COMMA@93..95 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@95..103 "private" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@103..112 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@112..113 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + COMMA@113..115 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PROTECTED_KW@115..125 "protected" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@125..134 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@134..135 "y" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + COMMA@135..137 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PUBLIC_KW@137..144 "public" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@144..153 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@153..154 "z" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + ], + r_paren_token: R_PAREN@154..156 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@156..157 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@157..159 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@159..160 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@167..169 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@169..171 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@171..182 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@182..183 "(" [] [], + parameters: JsConstructorParameterList [ + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@183..191 "private" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@191..192 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@192..194 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@194..200 "string" [] [], + }, + }, + initializer: missing (optional), + }, + }, + COMMA@200..202 "," [] [Whitespace(" ")], + TsPropertyParameter { + decorators: JsDecoratorList [], + modifiers: TsPropertyParameterModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@202..211 "readonly" [] [Whitespace(" ")], + }, + ], + formal_parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@211..212 "y" [] [], + }, + question_mark_token: QUESTION@212..213 "?" [] [], + type_annotation: missing (optional), + initializer: missing (optional), + }, + }, + COMMA@213..215 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@215..217 "z" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@217..219 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@219..228 "\"default\"" [] [], + }, + }, + }, + COMMA@228..230 "," [] [Whitespace(" ")], + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@230..233 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@233..237 "rest" [] [], + }, + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@237..239 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@239..240 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@240..242 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@242..243 "}" [] [], + }, + ], + eof_token: EOF@243..244 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..244 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..243 + 0: JS_CLASS_DECLARATION@0..60 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..10 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@10..59 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@10..59 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@10..10 + 1: JS_LITERAL_MEMBER_NAME@10..21 + 0: IDENT@10..21 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@21..56 + 0: L_PAREN@21..22 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@22..54 + 0: TS_PROPERTY_PARAMETER@22..31 + 0: JS_DECORATOR_LIST@22..22 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@22..30 + 0: TS_ACCESSIBILITY_MODIFIER@22..30 + 0: PRIVATE_KW@22..30 "private" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@30..31 + 0: JS_DECORATOR_LIST@30..30 + 1: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@31..33 "," [] [Whitespace(" ")] + 2: TS_PROPERTY_PARAMETER@33..44 + 0: JS_DECORATOR_LIST@33..33 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@33..43 + 0: TS_ACCESSIBILITY_MODIFIER@33..43 + 0: PROTECTED_KW@33..43 "protected" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@43..44 + 0: JS_DECORATOR_LIST@43..43 + 1: JS_IDENTIFIER_BINDING@43..44 + 0: IDENT@43..44 "y" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@44..46 "," [] [Whitespace(" ")] + 4: TS_PROPERTY_PARAMETER@46..54 + 0: JS_DECORATOR_LIST@46..46 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@46..53 + 0: TS_ACCESSIBILITY_MODIFIER@46..53 + 0: PUBLIC_KW@46..53 "public" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@53..54 + 0: JS_DECORATOR_LIST@53..53 + 1: JS_IDENTIFIER_BINDING@53..54 + 0: IDENT@53..54 "z" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@54..56 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@56..59 + 0: L_CURLY@56..57 "{" [] [] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..57 + 3: R_CURLY@57..59 "}" [] [Whitespace(" ")] + 9: R_CURLY@59..60 "}" [] [] + 1: JS_CLASS_DECLARATION@60..160 + 0: JS_DECORATOR_LIST@60..60 + 1: (empty) + 2: CLASS_KW@60..67 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@67..69 + 0: IDENT@67..69 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@69..71 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@71..159 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@71..159 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@71..71 + 1: JS_LITERAL_MEMBER_NAME@71..82 + 0: IDENT@71..82 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@82..156 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@83..154 + 0: TS_PROPERTY_PARAMETER@83..93 + 0: JS_DECORATOR_LIST@83..83 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@83..92 + 0: TS_READONLY_MODIFIER@83..92 + 0: READONLY_KW@83..92 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@92..93 + 0: JS_DECORATOR_LIST@92..92 + 1: JS_IDENTIFIER_BINDING@92..93 + 0: IDENT@92..93 "w" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@93..95 "," [] [Whitespace(" ")] + 2: TS_PROPERTY_PARAMETER@95..113 + 0: JS_DECORATOR_LIST@95..95 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@95..112 + 0: TS_ACCESSIBILITY_MODIFIER@95..103 + 0: PRIVATE_KW@95..103 "private" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@103..112 + 0: READONLY_KW@103..112 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@112..113 + 0: JS_DECORATOR_LIST@112..112 + 1: JS_IDENTIFIER_BINDING@112..113 + 0: IDENT@112..113 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@113..115 "," [] [Whitespace(" ")] + 4: TS_PROPERTY_PARAMETER@115..135 + 0: JS_DECORATOR_LIST@115..115 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@115..134 + 0: TS_ACCESSIBILITY_MODIFIER@115..125 + 0: PROTECTED_KW@115..125 "protected" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@125..134 + 0: READONLY_KW@125..134 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@134..135 + 0: JS_DECORATOR_LIST@134..134 + 1: JS_IDENTIFIER_BINDING@134..135 + 0: IDENT@134..135 "y" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@135..137 "," [] [Whitespace(" ")] + 6: TS_PROPERTY_PARAMETER@137..154 + 0: JS_DECORATOR_LIST@137..137 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@137..153 + 0: TS_ACCESSIBILITY_MODIFIER@137..144 + 0: PUBLIC_KW@137..144 "public" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@144..153 + 0: READONLY_KW@144..153 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@153..154 + 0: JS_DECORATOR_LIST@153..153 + 1: JS_IDENTIFIER_BINDING@153..154 + 0: IDENT@153..154 "z" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@154..156 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@156..159 + 0: L_CURLY@156..157 "{" [] [] + 1: JS_DIRECTIVE_LIST@157..157 + 2: JS_STATEMENT_LIST@157..157 + 3: R_CURLY@157..159 "}" [] [Whitespace(" ")] + 9: R_CURLY@159..160 "}" [] [] + 2: JS_CLASS_DECLARATION@160..243 + 0: JS_DECORATOR_LIST@160..160 + 1: (empty) + 2: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@167..169 + 0: IDENT@167..169 "C" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@169..171 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@171..242 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@171..242 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@171..171 + 1: JS_LITERAL_MEMBER_NAME@171..182 + 0: IDENT@171..182 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@182..239 + 0: L_PAREN@182..183 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@183..237 + 0: TS_PROPERTY_PARAMETER@183..200 + 0: JS_DECORATOR_LIST@183..183 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@183..191 + 0: TS_ACCESSIBILITY_MODIFIER@183..191 + 0: PRIVATE_KW@183..191 "private" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@191..200 + 0: JS_DECORATOR_LIST@191..191 + 1: JS_IDENTIFIER_BINDING@191..192 + 0: IDENT@191..192 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@192..200 + 0: COLON@192..194 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@194..200 + 0: STRING_KW@194..200 "string" [] [] + 4: (empty) + 1: COMMA@200..202 "," [] [Whitespace(" ")] + 2: TS_PROPERTY_PARAMETER@202..213 + 0: JS_DECORATOR_LIST@202..202 + 1: TS_PROPERTY_PARAMETER_MODIFIER_LIST@202..211 + 0: TS_READONLY_MODIFIER@202..211 + 0: READONLY_KW@202..211 "readonly" [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@211..213 + 0: JS_DECORATOR_LIST@211..211 + 1: JS_IDENTIFIER_BINDING@211..212 + 0: IDENT@211..212 "y" [] [] + 2: QUESTION@212..213 "?" [] [] + 3: (empty) + 4: (empty) + 3: COMMA@213..215 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@215..228 + 0: JS_DECORATOR_LIST@215..215 + 1: JS_IDENTIFIER_BINDING@215..217 + 0: IDENT@215..217 "z" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: JS_INITIALIZER_CLAUSE@217..228 + 0: EQ@217..219 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@219..228 + 0: JS_STRING_LITERAL@219..228 "\"default\"" [] [] + 5: COMMA@228..230 "," [] [Whitespace(" ")] + 6: JS_REST_PARAMETER@230..237 + 0: JS_DECORATOR_LIST@230..230 + 1: DOT3@230..233 "..." [] [] + 2: JS_IDENTIFIER_BINDING@233..237 + 0: IDENT@233..237 "rest" [] [] + 3: (empty) + 2: R_PAREN@237..239 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@239..242 + 0: L_CURLY@239..240 "{" [] [] + 1: JS_DIRECTIVE_LIST@240..240 + 2: JS_STATEMENT_LIST@240..240 + 3: R_CURLY@240..242 "}" [] [Whitespace(" ")] + 9: R_CURLY@242..243 "}" [] [] + 4: EOF@243..244 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap new file mode 100644 index 000000000000..640f06019f89 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap @@ -0,0 +1,433 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { readonly prop = "test"; } +class B { declare readonly prop = "test"; } +declare class A { private readonly prop = "test"; } +class B { declare private readonly prop = "test"; } +declare class A { static readonly prop = "test"; } +class B { declare static readonly prop = "test"; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..16 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsReadonlyModifier { + modifier_token: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@27..32 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@32..34 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@34..40 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@40..42 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@42..43 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@50..52 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@52..54 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@54..62 "declare" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@71..76 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@76..78 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@78..84 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@84..86 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@86..87 "}" [] [], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@87..96 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@96..102 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@102..104 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@104..106 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@106..114 "private" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@114..123 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@123..128 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@128..130 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@130..136 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@136..138 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@138..139 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@146..148 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@148..150 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@150..158 "declare" [] [Whitespace(" ")], + }, + TsAccessibilityModifier { + modifier_token: PRIVATE_KW@158..166 "private" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@166..175 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@175..180 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@180..182 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@182..188 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@188..190 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@190..191 "}" [] [], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@191..200 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@200..206 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@206..208 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@208..210 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + JsStaticModifier { + modifier_token: STATIC_KW@210..217 "static" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@217..226 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@226..231 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@231..233 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@233..239 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@239..241 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@241..242 "}" [] [], + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@242..249 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@249..251 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@251..253 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + TsInitializedPropertySignatureClassMember { + modifiers: TsPropertySignatureModifierList [ + TsDeclareModifier { + modifier_token: DECLARE_KW@253..261 "declare" [] [Whitespace(" ")], + }, + JsStaticModifier { + modifier_token: STATIC_KW@261..268 "static" [] [Whitespace(" ")], + }, + TsReadonlyModifier { + modifier_token: READONLY_KW@268..277 "readonly" [] [Whitespace(" ")], + }, + ], + name: JsLiteralMemberName { + value: IDENT@277..282 "prop" [] [Whitespace(" ")], + }, + question_mark_token: missing (optional), + value: JsInitializerClause { + eq_token: EQ@282..284 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@284..290 "\"test\"" [] [], + }, + }, + semicolon_token: SEMICOLON@290..292 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@292..293 "}" [] [], + }, + ], + eof_token: EOF@293..294 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..294 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..293 + 0: TS_DECLARE_STATEMENT@0..43 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..43 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..16 + 0: IDENT@14..16 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..42 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@18..42 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@18..27 + 0: TS_READONLY_MODIFIER@18..27 + 0: READONLY_KW@18..27 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@27..32 + 0: IDENT@27..32 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@32..40 + 0: EQ@32..34 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@34..40 + 0: JS_STRING_LITERAL@34..40 "\"test\"" [] [] + 4: SEMICOLON@40..42 ";" [] [Whitespace(" ")] + 9: R_CURLY@42..43 "}" [] [] + 1: JS_CLASS_DECLARATION@43..87 + 0: JS_DECORATOR_LIST@43..43 + 1: (empty) + 2: CLASS_KW@43..50 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@50..52 + 0: IDENT@50..52 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@52..54 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@54..86 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@54..86 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@54..71 + 0: TS_DECLARE_MODIFIER@54..62 + 0: DECLARE_KW@54..62 "declare" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@62..71 + 0: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@71..76 + 0: IDENT@71..76 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@76..84 + 0: EQ@76..78 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@78..84 + 0: JS_STRING_LITERAL@78..84 "\"test\"" [] [] + 4: SEMICOLON@84..86 ";" [] [Whitespace(" ")] + 9: R_CURLY@86..87 "}" [] [] + 2: TS_DECLARE_STATEMENT@87..139 + 0: DECLARE_KW@87..96 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@96..139 + 0: JS_DECORATOR_LIST@96..96 + 1: (empty) + 2: CLASS_KW@96..102 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@102..104 + 0: IDENT@102..104 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@104..106 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@106..138 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@106..138 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@106..123 + 0: TS_ACCESSIBILITY_MODIFIER@106..114 + 0: PRIVATE_KW@106..114 "private" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@114..123 + 0: READONLY_KW@114..123 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@123..128 + 0: IDENT@123..128 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@128..136 + 0: EQ@128..130 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@130..136 + 0: JS_STRING_LITERAL@130..136 "\"test\"" [] [] + 4: SEMICOLON@136..138 ";" [] [Whitespace(" ")] + 9: R_CURLY@138..139 "}" [] [] + 3: JS_CLASS_DECLARATION@139..191 + 0: JS_DECORATOR_LIST@139..139 + 1: (empty) + 2: CLASS_KW@139..146 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@146..148 + 0: IDENT@146..148 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@148..150 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@150..190 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@150..190 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@150..175 + 0: TS_DECLARE_MODIFIER@150..158 + 0: DECLARE_KW@150..158 "declare" [] [Whitespace(" ")] + 1: TS_ACCESSIBILITY_MODIFIER@158..166 + 0: PRIVATE_KW@158..166 "private" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@166..175 + 0: READONLY_KW@166..175 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@175..180 + 0: IDENT@175..180 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@180..188 + 0: EQ@180..182 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@182..188 + 0: JS_STRING_LITERAL@182..188 "\"test\"" [] [] + 4: SEMICOLON@188..190 ";" [] [Whitespace(" ")] + 9: R_CURLY@190..191 "}" [] [] + 4: TS_DECLARE_STATEMENT@191..242 + 0: DECLARE_KW@191..200 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@200..242 + 0: JS_DECORATOR_LIST@200..200 + 1: (empty) + 2: CLASS_KW@200..206 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@206..208 + 0: IDENT@206..208 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@208..210 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@210..241 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@210..241 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@210..226 + 0: JS_STATIC_MODIFIER@210..217 + 0: STATIC_KW@210..217 "static" [] [Whitespace(" ")] + 1: TS_READONLY_MODIFIER@217..226 + 0: READONLY_KW@217..226 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@226..231 + 0: IDENT@226..231 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@231..239 + 0: EQ@231..233 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@233..239 + 0: JS_STRING_LITERAL@233..239 "\"test\"" [] [] + 4: SEMICOLON@239..241 ";" [] [Whitespace(" ")] + 9: R_CURLY@241..242 "}" [] [] + 5: JS_CLASS_DECLARATION@242..293 + 0: JS_DECORATOR_LIST@242..242 + 1: (empty) + 2: CLASS_KW@242..249 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@249..251 + 0: IDENT@249..251 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@251..253 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@253..292 + 0: TS_INITIALIZED_PROPERTY_SIGNATURE_CLASS_MEMBER@253..292 + 0: TS_PROPERTY_SIGNATURE_MODIFIER_LIST@253..277 + 0: TS_DECLARE_MODIFIER@253..261 + 0: DECLARE_KW@253..261 "declare" [] [Whitespace(" ")] + 1: JS_STATIC_MODIFIER@261..268 + 0: STATIC_KW@261..268 "static" [] [Whitespace(" ")] + 2: TS_READONLY_MODIFIER@268..277 + 0: READONLY_KW@268..277 "readonly" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@277..282 + 0: IDENT@277..282 "prop" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@282..290 + 0: EQ@282..284 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@284..290 + 0: JS_STRING_LITERAL@284..290 "\"test\"" [] [] + 4: SEMICOLON@290..292 ";" [] [Whitespace(" ")] + 9: R_CURLY@292..293 "}" [] [] + 4: EOF@293..294 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_reference_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts.snap new file mode 100644 index 000000000000..85659a44fae4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts.snap @@ -0,0 +1,200 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = object; +type B = string; +type C = A; +type D = B.a; +type E = D.c.b.a; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsNonPrimitiveType { + object_token: OBJECT_KW@9..15 "object" [] [], + }, + semicolon_token: SEMICOLON@15..16 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@22..24 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@24..26 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@26..32 "string" [] [], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@33..39 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@39..41 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@41..43 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@43..44 "A" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@44..45 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@51..53 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@53..55 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@55..56 "B" [] [], + }, + dot_token: DOT@56..57 "." [] [], + right: JsName { + value_token: IDENT@57..58 "a" [] [], + }, + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@58..59 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@65..67 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@67..69 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: TsQualifiedName { + left: TsQualifiedName { + left: TsQualifiedName { + left: JsReferenceIdentifier { + value_token: IDENT@69..70 "D" [] [], + }, + dot_token: DOT@70..71 "." [] [], + right: JsName { + value_token: IDENT@71..72 "c" [] [], + }, + }, + dot_token: DOT@72..73 "." [] [], + right: JsName { + value_token: IDENT@73..74 "b" [] [], + }, + }, + dot_token: DOT@74..75 "." [] [], + right: JsName { + value_token: IDENT@75..76 "a" [] [], + }, + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@76..77 ";" [] [], + }, + ], + eof_token: EOF@77..78 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..78 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..77 + 0: TS_TYPE_ALIAS_DECLARATION@0..16 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_NON_PRIMITIVE_TYPE@9..15 + 0: OBJECT_KW@9..15 "object" [] [] + 5: SEMICOLON@15..16 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@16..33 + 0: TYPE_KW@16..22 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@22..24 + 0: IDENT@22..24 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@24..26 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@26..32 + 0: STRING_KW@26..32 "string" [] [] + 5: SEMICOLON@32..33 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@33..45 + 0: TYPE_KW@33..39 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@39..41 + 0: IDENT@39..41 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@41..43 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@43..44 + 0: JS_REFERENCE_IDENTIFIER@43..44 + 0: IDENT@43..44 "A" [] [] + 1: (empty) + 5: SEMICOLON@44..45 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@45..59 + 0: TYPE_KW@45..51 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@51..53 + 0: IDENT@51..53 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@53..55 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@55..58 + 0: TS_QUALIFIED_NAME@55..58 + 0: JS_REFERENCE_IDENTIFIER@55..56 + 0: IDENT@55..56 "B" [] [] + 1: DOT@56..57 "." [] [] + 2: JS_NAME@57..58 + 0: IDENT@57..58 "a" [] [] + 1: (empty) + 5: SEMICOLON@58..59 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@59..77 + 0: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@65..67 + 0: IDENT@65..67 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@67..69 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@69..76 + 0: TS_QUALIFIED_NAME@69..76 + 0: TS_QUALIFIED_NAME@69..74 + 0: TS_QUALIFIED_NAME@69..72 + 0: JS_REFERENCE_IDENTIFIER@69..70 + 0: IDENT@69..70 "D" [] [] + 1: DOT@70..71 "." [] [] + 2: JS_NAME@71..72 + 0: IDENT@71..72 "c" [] [] + 1: DOT@72..73 "." [] [] + 2: JS_NAME@73..74 + 0: IDENT@73..74 "b" [] [] + 1: DOT@74..75 "." [] [] + 2: JS_NAME@75..76 + 0: IDENT@75..76 "a" [] [] + 1: (empty) + 5: SEMICOLON@76..77 ";" [] [] + 4: EOF@77..78 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts.snap new file mode 100644 index 000000000000..1d821eda4988 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts.snap @@ -0,0 +1,544 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = (a) => a is string; +type B = { test(a): a is string } +type C = { (a): a is string } +const a = { test(x): x is string { return typeof x === "string" } } +class D { test(x): x is string { return typeof x === "string"; } } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@9..10 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@10..11 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], + return_type: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@16..18 "a" [] [Whitespace(" ")], + }, + is_token: IS_KW@18..21 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@21..27 "string" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@34..36 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@40..44 "test" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@44..45 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@45..46 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@46..47 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@47..49 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@49..51 "a" [] [Whitespace(" ")], + }, + is_token: IS_KW@51..54 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@54..61 "string" [] [Whitespace(" ")], + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@61..62 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@62..68 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@68..70 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@70..72 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@72..74 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsCallSignatureTypeMember { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@74..75 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@75..76 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@76..77 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@77..79 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@79..81 "a" [] [Whitespace(" ")], + }, + is_token: IS_KW@81..84 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@84..91 "string" [] [Whitespace(" ")], + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@91..92 "}" [] [], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@92..99 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@99..101 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@101..103 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@103..105 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@105..109 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@109..110 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@110..111 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@111..112 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@112..114 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@114..116 "x" [] [Whitespace(" ")], + }, + is_token: IS_KW@116..119 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@119..126 "string" [] [Whitespace(" ")], + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@126..128 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@128..135 "return" [] [Whitespace(" ")], + argument: JsBinaryExpression { + left: JsUnaryExpression { + operator_token: TYPEOF_KW@135..142 "typeof" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@142..144 "x" [] [Whitespace(" ")], + }, + }, + }, + operator_token: EQ3@144..148 "===" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@148..157 "\"string\"" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@157..159 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@159..160 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@167..169 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@169..171 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@171..175 "test" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@175..176 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@176..177 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@177..178 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@178..180 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@180..182 "x" [] [Whitespace(" ")], + }, + is_token: IS_KW@182..185 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@185..192 "string" [] [Whitespace(" ")], + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@192..194 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@194..201 "return" [] [Whitespace(" ")], + argument: JsBinaryExpression { + left: JsUnaryExpression { + operator_token: TYPEOF_KW@201..208 "typeof" [] [Whitespace(" ")], + argument: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@208..210 "x" [] [Whitespace(" ")], + }, + }, + }, + operator_token: EQ3@210..214 "===" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@214..222 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@222..224 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@224..226 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@226..227 "}" [] [], + }, + ], + eof_token: EOF@227..228 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..228 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..227 + 0: TS_TYPE_ALIAS_DECLARATION@0..28 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@9..27 + 0: (empty) + 1: JS_PARAMETERS@9..13 + 0: L_PAREN@9..10 "(" [] [] + 1: JS_PARAMETER_LIST@10..11 + 0: JS_FORMAL_PARAMETER@10..11 + 0: JS_DECORATOR_LIST@10..10 + 1: JS_IDENTIFIER_BINDING@10..11 + 0: IDENT@10..11 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] + 3: TS_PREDICATE_RETURN_TYPE@16..27 + 0: JS_REFERENCE_IDENTIFIER@16..18 + 0: IDENT@16..18 "a" [] [Whitespace(" ")] + 1: IS_KW@18..21 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@21..27 + 0: STRING_KW@21..27 "string" [] [] + 5: SEMICOLON@27..28 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@28..62 + 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@36..38 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@38..62 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@40..61 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@40..61 + 0: JS_LITERAL_MEMBER_NAME@40..44 + 0: IDENT@40..44 "test" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@44..47 + 0: L_PAREN@44..45 "(" [] [] + 1: JS_PARAMETER_LIST@45..46 + 0: JS_FORMAL_PARAMETER@45..46 + 0: JS_DECORATOR_LIST@45..45 + 1: JS_IDENTIFIER_BINDING@45..46 + 0: IDENT@45..46 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@46..47 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@47..61 + 0: COLON@47..49 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@49..61 + 0: JS_REFERENCE_IDENTIFIER@49..51 + 0: IDENT@49..51 "a" [] [Whitespace(" ")] + 1: IS_KW@51..54 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@54..61 + 0: STRING_KW@54..61 "string" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@61..62 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@62..92 + 0: TYPE_KW@62..68 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@68..70 + 0: IDENT@68..70 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@70..72 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@72..92 + 0: L_CURLY@72..74 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@74..91 + 0: TS_CALL_SIGNATURE_TYPE_MEMBER@74..91 + 0: (empty) + 1: JS_PARAMETERS@74..77 + 0: L_PAREN@74..75 "(" [] [] + 1: JS_PARAMETER_LIST@75..76 + 0: JS_FORMAL_PARAMETER@75..76 + 0: JS_DECORATOR_LIST@75..75 + 1: JS_IDENTIFIER_BINDING@75..76 + 0: IDENT@75..76 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@76..77 ")" [] [] + 2: TS_RETURN_TYPE_ANNOTATION@77..91 + 0: COLON@77..79 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@79..91 + 0: JS_REFERENCE_IDENTIFIER@79..81 + 0: IDENT@79..81 "a" [] [Whitespace(" ")] + 1: IS_KW@81..84 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@84..91 + 0: STRING_KW@84..91 "string" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@91..92 "}" [] [] + 5: (empty) + 3: JS_VARIABLE_STATEMENT@92..160 + 0: JS_VARIABLE_DECLARATION@92..160 + 0: (empty) + 1: CONST_KW@92..99 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@99..160 + 0: JS_VARIABLE_DECLARATOR@99..160 + 0: JS_IDENTIFIER_BINDING@99..101 + 0: IDENT@99..101 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@101..160 + 0: EQ@101..103 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@103..160 + 0: L_CURLY@103..105 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@105..159 + 0: JS_METHOD_OBJECT_MEMBER@105..159 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@105..109 + 0: IDENT@105..109 "test" [] [] + 3: (empty) + 4: JS_PARAMETERS@109..112 + 0: L_PAREN@109..110 "(" [] [] + 1: JS_PARAMETER_LIST@110..111 + 0: JS_FORMAL_PARAMETER@110..111 + 0: JS_DECORATOR_LIST@110..110 + 1: JS_IDENTIFIER_BINDING@110..111 + 0: IDENT@110..111 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@111..112 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@112..126 + 0: COLON@112..114 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@114..126 + 0: JS_REFERENCE_IDENTIFIER@114..116 + 0: IDENT@114..116 "x" [] [Whitespace(" ")] + 1: IS_KW@116..119 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@119..126 + 0: STRING_KW@119..126 "string" [] [Whitespace(" ")] + 6: JS_FUNCTION_BODY@126..159 + 0: L_CURLY@126..128 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@128..128 + 2: JS_STATEMENT_LIST@128..157 + 0: JS_RETURN_STATEMENT@128..157 + 0: RETURN_KW@128..135 "return" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@135..157 + 0: JS_UNARY_EXPRESSION@135..144 + 0: TYPEOF_KW@135..142 "typeof" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@142..144 + 0: JS_REFERENCE_IDENTIFIER@142..144 + 0: IDENT@142..144 "x" [] [Whitespace(" ")] + 1: EQ3@144..148 "===" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@148..157 + 0: JS_STRING_LITERAL@148..157 "\"string\"" [] [Whitespace(" ")] + 2: (empty) + 3: R_CURLY@157..159 "}" [] [Whitespace(" ")] + 2: R_CURLY@159..160 "}" [] [] + 1: (empty) + 4: JS_CLASS_DECLARATION@160..227 + 0: JS_DECORATOR_LIST@160..160 + 1: (empty) + 2: CLASS_KW@160..167 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@167..169 + 0: IDENT@167..169 "D" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@169..171 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@171..226 + 0: JS_METHOD_CLASS_MEMBER@171..226 + 0: JS_METHOD_MODIFIER_LIST@171..171 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@171..175 + 0: IDENT@171..175 "test" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@175..178 + 0: L_PAREN@175..176 "(" [] [] + 1: JS_PARAMETER_LIST@176..177 + 0: JS_FORMAL_PARAMETER@176..177 + 0: JS_DECORATOR_LIST@176..176 + 1: JS_IDENTIFIER_BINDING@176..177 + 0: IDENT@176..177 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@177..178 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@178..192 + 0: COLON@178..180 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@180..192 + 0: JS_REFERENCE_IDENTIFIER@180..182 + 0: IDENT@180..182 "x" [] [Whitespace(" ")] + 1: IS_KW@182..185 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@185..192 + 0: STRING_KW@185..192 "string" [] [Whitespace(" ")] + 8: JS_FUNCTION_BODY@192..226 + 0: L_CURLY@192..194 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@194..194 + 2: JS_STATEMENT_LIST@194..224 + 0: JS_RETURN_STATEMENT@194..224 + 0: RETURN_KW@194..201 "return" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@201..222 + 0: JS_UNARY_EXPRESSION@201..210 + 0: TYPEOF_KW@201..208 "typeof" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@208..210 + 0: JS_REFERENCE_IDENTIFIER@208..210 + 0: IDENT@208..210 "x" [] [Whitespace(" ")] + 1: EQ3@210..214 "===" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@214..222 + 0: JS_STRING_LITERAL@214..222 "\"string\"" [] [] + 2: SEMICOLON@222..224 ";" [] [Whitespace(" ")] + 3: R_CURLY@224..226 "}" [] [Whitespace(" ")] + 9: R_CURLY@226..227 "}" [] [] + 4: EOF@227..228 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts.snap new file mode 100644 index 000000000000..531090a547df --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts.snap @@ -0,0 +1,254 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface I { + foo(test: string): I + is(): boolean; + bar(test: string): I + asserts(): boolean; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..12 "I" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@12..13 "{" [] [], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@13..18 "foo" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@18..19 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@19..23 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@25..31 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@31..32 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@32..34 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@34..35 "I" [] [], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@35..39 "is" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@39..40 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@40..41 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@41..43 ":" [] [Whitespace(" ")], + ty: TsBooleanType { + boolean_token: BOOLEAN_KW@43..50 "boolean" [] [], + }, + }, + separator_token: SEMICOLON@50..51 ";" [] [], + }, + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@51..56 "bar" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@56..57 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@57..61 "test" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@61..63 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@63..69 "string" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@69..70 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@70..72 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@72..73 "I" [] [], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@73..82 "asserts" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@82..83 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@83..84 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@84..86 ":" [] [Whitespace(" ")], + ty: TsBooleanType { + boolean_token: BOOLEAN_KW@86..93 "boolean" [] [], + }, + }, + separator_token: SEMICOLON@93..94 ";" [] [], + }, + ], + r_curly_token: R_CURLY@94..96 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@96..97 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..97 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..96 + 0: TS_INTERFACE_DECLARATION@0..96 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "I" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@12..13 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@13..94 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@13..35 + 0: JS_LITERAL_MEMBER_NAME@13..18 + 0: IDENT@13..18 "foo" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@18..32 + 0: L_PAREN@18..19 "(" [] [] + 1: JS_PARAMETER_LIST@19..31 + 0: JS_FORMAL_PARAMETER@19..31 + 0: JS_DECORATOR_LIST@19..19 + 1: JS_IDENTIFIER_BINDING@19..23 + 0: IDENT@19..23 "test" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@23..31 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@25..31 + 0: STRING_KW@25..31 "string" [] [] + 4: (empty) + 2: R_PAREN@31..32 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@32..35 + 0: COLON@32..34 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@34..35 + 0: JS_REFERENCE_IDENTIFIER@34..35 + 0: IDENT@34..35 "I" [] [] + 1: (empty) + 5: (empty) + 1: TS_METHOD_SIGNATURE_TYPE_MEMBER@35..51 + 0: JS_LITERAL_MEMBER_NAME@35..39 + 0: IDENT@35..39 "is" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@39..41 + 0: L_PAREN@39..40 "(" [] [] + 1: JS_PARAMETER_LIST@40..40 + 2: R_PAREN@40..41 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@41..50 + 0: COLON@41..43 ":" [] [Whitespace(" ")] + 1: TS_BOOLEAN_TYPE@43..50 + 0: BOOLEAN_KW@43..50 "boolean" [] [] + 5: SEMICOLON@50..51 ";" [] [] + 2: TS_METHOD_SIGNATURE_TYPE_MEMBER@51..73 + 0: JS_LITERAL_MEMBER_NAME@51..56 + 0: IDENT@51..56 "bar" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@56..70 + 0: L_PAREN@56..57 "(" [] [] + 1: JS_PARAMETER_LIST@57..69 + 0: JS_FORMAL_PARAMETER@57..69 + 0: JS_DECORATOR_LIST@57..57 + 1: JS_IDENTIFIER_BINDING@57..61 + 0: IDENT@57..61 "test" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@61..69 + 0: COLON@61..63 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@63..69 + 0: STRING_KW@63..69 "string" [] [] + 4: (empty) + 2: R_PAREN@69..70 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@70..73 + 0: COLON@70..72 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@72..73 + 0: JS_REFERENCE_IDENTIFIER@72..73 + 0: IDENT@72..73 "I" [] [] + 1: (empty) + 5: (empty) + 3: TS_METHOD_SIGNATURE_TYPE_MEMBER@73..94 + 0: JS_LITERAL_MEMBER_NAME@73..82 + 0: IDENT@73..82 "asserts" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@82..84 + 0: L_PAREN@82..83 "(" [] [] + 1: JS_PARAMETER_LIST@83..83 + 2: R_PAREN@83..84 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@84..93 + 0: COLON@84..86 ":" [] [Whitespace(" ")] + 1: TS_BOOLEAN_TYPE@86..93 + 0: BOOLEAN_KW@86..93 "boolean" [] [] + 5: SEMICOLON@93..94 ";" [] [] + 6: R_CURLY@94..96 "}" [Newline("\n")] [] + 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap new file mode 100644 index 000000000000..8bb506daeba4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap @@ -0,0 +1,506 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +type B = { a: A }; +(a satisfies string) = "string"; +((a satisfies any) satisfies string) = null; +({ b: a satisfies string } = { b: "test" }); +([ a satisfies string ] = [ "test" ]); +for (a satisfies string in []) {} +(a satisfies B) = { a: "test" }; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@7..10 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@10..11 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@17..18 "B" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@18..19 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@19..20 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@24..26 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@26..27 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@27..29 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@29..31 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@33..35 "(" [Newline("\n")] [], + assignment: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@35..37 "a" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@37..47 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@47..53 "string" [] [], + }, + }, + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@55..57 "=" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@57..65 "\"string\"" [] [], + }, + }, + semicolon_token: SEMICOLON@65..66 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@66..68 "(" [Newline("\n")] [], + assignment: TsSatisfiesAssignment { + assignment: JsParenthesizedAssignment { + l_paren_token: L_PAREN@68..69 "(" [] [], + assignment: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@69..71 "a" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@71..81 "satisfies" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@81..84 "any" [] [], + }, + }, + r_paren_token: R_PAREN@84..86 ")" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@86..96 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@96..102 "string" [] [], + }, + }, + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@104..106 "=" [] [Whitespace(" ")], + right: JsNullLiteralExpression { + value_token: NULL_KW@106..110 "null" [] [], + }, + }, + semicolon_token: SEMICOLON@110..111 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@111..113 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsObjectAssignmentPattern { + l_curly_token: L_CURLY@113..115 "{" [] [Whitespace(" ")], + properties: JsObjectAssignmentPatternPropertyList [ + JsObjectAssignmentPatternProperty { + member: JsLiteralMemberName { + value: IDENT@115..116 "b" [] [], + }, + colon_token: COLON@116..118 ":" [] [Whitespace(" ")], + pattern: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@118..120 "a" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@120..130 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@130..137 "string" [] [Whitespace(" ")], + }, + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@137..139 "}" [] [Whitespace(" ")], + }, + operator_token: EQ@139..141 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@141..143 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@143..144 "b" [] [], + }, + colon_token: COLON@144..146 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@146..153 "\"test\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@153..154 "}" [] [], + }, + }, + r_paren_token: R_PAREN@154..155 ")" [] [], + }, + semicolon_token: SEMICOLON@155..156 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@156..158 "(" [Newline("\n")] [], + expression: JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@158..160 "[" [] [Whitespace(" ")], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@160..162 "a" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@162..172 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@172..179 "string" [] [Whitespace(" ")], + }, + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@179..181 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@181..183 "=" [] [Whitespace(" ")], + right: JsArrayExpression { + l_brack_token: L_BRACK@183..185 "[" [] [Whitespace(" ")], + elements: JsArrayElementList [ + JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@185..192 "\"test\"" [] [Whitespace(" ")], + }, + ], + r_brack_token: R_BRACK@192..193 "]" [] [], + }, + }, + r_paren_token: R_PAREN@193..194 ")" [] [], + }, + semicolon_token: SEMICOLON@194..195 ";" [] [], + }, + JsForInStatement { + for_token: FOR_KW@195..200 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@200..201 "(" [] [], + initializer: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@201..203 "a" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@203..213 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@213..220 "string" [] [Whitespace(" ")], + }, + }, + in_token: IN_KW@220..223 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@223..224 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@224..225 "]" [] [], + }, + r_paren_token: R_PAREN@225..227 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@227..228 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@228..229 "}" [] [], + }, + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsParenthesizedAssignment { + l_paren_token: L_PAREN@229..231 "(" [Newline("\n")] [], + assignment: TsSatisfiesAssignment { + assignment: JsIdentifierAssignment { + name_token: IDENT@231..233 "a" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@233..243 "satisfies" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@243..244 "B" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@244..245 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@245..251 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@251..252 ">" [] [], + }, + }, + }, + r_paren_token: R_PAREN@252..254 ")" [] [Whitespace(" ")], + }, + operator_token: EQ@254..256 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@256..258 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@258..259 "a" [] [], + }, + colon_token: COLON@259..261 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@261..268 "\"test\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@268..269 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@269..270 ";" [] [], + }, + ], + eof_token: EOF@270..271 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..271 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..270 + 0: JS_VARIABLE_STATEMENT@0..11 + 0: JS_VARIABLE_DECLARATION@0..10 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..10 + 0: JS_VARIABLE_DECLARATOR@4..10 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_TYPE_ANNOTATION@5..10 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@7..10 + 0: ANY_KW@7..10 "any" [] [] + 2: (empty) + 1: SEMICOLON@10..11 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@11..33 + 0: TYPE_KW@11..17 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@17..18 + 0: IDENT@17..18 "B" [] [] + 2: TS_TYPE_PARAMETERS@18..22 + 0: L_ANGLE@18..19 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@19..20 + 0: TS_TYPE_PARAMETER@19..20 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 + 1: TS_TYPE_PARAMETER_NAME@19..20 + 0: IDENT@19..20 "A" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] + 3: EQ@22..24 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@24..32 + 0: L_CURLY@24..26 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@26..31 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@26..31 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@26..27 + 0: IDENT@26..27 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@27..31 + 0: COLON@27..29 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@29..31 + 0: JS_REFERENCE_IDENTIFIER@29..31 + 0: IDENT@29..31 "A" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 2: R_CURLY@31..32 "}" [] [] + 5: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..66 + 0: JS_ASSIGNMENT_EXPRESSION@33..65 + 0: JS_PARENTHESIZED_ASSIGNMENT@33..55 + 0: L_PAREN@33..35 "(" [Newline("\n")] [] + 1: TS_SATISFIES_ASSIGNMENT@35..53 + 0: JS_IDENTIFIER_ASSIGNMENT@35..37 + 0: IDENT@35..37 "a" [] [Whitespace(" ")] + 1: SATISFIES_KW@37..47 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@47..53 + 0: STRING_KW@47..53 "string" [] [] + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 1: EQ@55..57 "=" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@57..65 + 0: JS_STRING_LITERAL@57..65 "\"string\"" [] [] + 1: SEMICOLON@65..66 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@66..111 + 0: JS_ASSIGNMENT_EXPRESSION@66..110 + 0: JS_PARENTHESIZED_ASSIGNMENT@66..104 + 0: L_PAREN@66..68 "(" [Newline("\n")] [] + 1: TS_SATISFIES_ASSIGNMENT@68..102 + 0: JS_PARENTHESIZED_ASSIGNMENT@68..86 + 0: L_PAREN@68..69 "(" [] [] + 1: TS_SATISFIES_ASSIGNMENT@69..84 + 0: JS_IDENTIFIER_ASSIGNMENT@69..71 + 0: IDENT@69..71 "a" [] [Whitespace(" ")] + 1: SATISFIES_KW@71..81 "satisfies" [] [Whitespace(" ")] + 2: TS_ANY_TYPE@81..84 + 0: ANY_KW@81..84 "any" [] [] + 2: R_PAREN@84..86 ")" [] [Whitespace(" ")] + 1: SATISFIES_KW@86..96 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@96..102 + 0: STRING_KW@96..102 "string" [] [] + 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 1: EQ@104..106 "=" [] [Whitespace(" ")] + 2: JS_NULL_LITERAL_EXPRESSION@106..110 + 0: NULL_KW@106..110 "null" [] [] + 1: SEMICOLON@110..111 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@111..156 + 0: JS_PARENTHESIZED_EXPRESSION@111..155 + 0: L_PAREN@111..113 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@113..154 + 0: JS_OBJECT_ASSIGNMENT_PATTERN@113..139 + 0: L_CURLY@113..115 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY_LIST@115..137 + 0: JS_OBJECT_ASSIGNMENT_PATTERN_PROPERTY@115..137 + 0: JS_LITERAL_MEMBER_NAME@115..116 + 0: IDENT@115..116 "b" [] [] + 1: COLON@116..118 ":" [] [Whitespace(" ")] + 2: TS_SATISFIES_ASSIGNMENT@118..137 + 0: JS_IDENTIFIER_ASSIGNMENT@118..120 + 0: IDENT@118..120 "a" [] [Whitespace(" ")] + 1: SATISFIES_KW@120..130 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@130..137 + 0: STRING_KW@130..137 "string" [] [Whitespace(" ")] + 3: (empty) + 2: R_CURLY@137..139 "}" [] [Whitespace(" ")] + 1: EQ@139..141 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@141..154 + 0: L_CURLY@141..143 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@143..153 + 0: JS_PROPERTY_OBJECT_MEMBER@143..153 + 0: JS_LITERAL_MEMBER_NAME@143..144 + 0: IDENT@143..144 "b" [] [] + 1: COLON@144..146 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@146..153 + 0: JS_STRING_LITERAL@146..153 "\"test\"" [] [Whitespace(" ")] + 2: R_CURLY@153..154 "}" [] [] + 2: R_PAREN@154..155 ")" [] [] + 1: SEMICOLON@155..156 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@156..195 + 0: JS_PARENTHESIZED_EXPRESSION@156..194 + 0: L_PAREN@156..158 "(" [Newline("\n")] [] + 1: JS_ASSIGNMENT_EXPRESSION@158..193 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@158..181 + 0: L_BRACK@158..160 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@160..179 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@160..179 + 0: TS_SATISFIES_ASSIGNMENT@160..179 + 0: JS_IDENTIFIER_ASSIGNMENT@160..162 + 0: IDENT@160..162 "a" [] [Whitespace(" ")] + 1: SATISFIES_KW@162..172 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@172..179 + 0: STRING_KW@172..179 "string" [] [Whitespace(" ")] + 1: (empty) + 2: R_BRACK@179..181 "]" [] [Whitespace(" ")] + 1: EQ@181..183 "=" [] [Whitespace(" ")] + 2: JS_ARRAY_EXPRESSION@183..193 + 0: L_BRACK@183..185 "[" [] [Whitespace(" ")] + 1: JS_ARRAY_ELEMENT_LIST@185..192 + 0: JS_STRING_LITERAL_EXPRESSION@185..192 + 0: JS_STRING_LITERAL@185..192 "\"test\"" [] [Whitespace(" ")] + 2: R_BRACK@192..193 "]" [] [] + 2: R_PAREN@193..194 ")" [] [] + 1: SEMICOLON@194..195 ";" [] [] + 6: JS_FOR_IN_STATEMENT@195..229 + 0: FOR_KW@195..200 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@200..201 "(" [] [] + 2: TS_SATISFIES_ASSIGNMENT@201..220 + 0: JS_IDENTIFIER_ASSIGNMENT@201..203 + 0: IDENT@201..203 "a" [] [Whitespace(" ")] + 1: SATISFIES_KW@203..213 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@213..220 + 0: STRING_KW@213..220 "string" [] [Whitespace(" ")] + 3: IN_KW@220..223 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@223..225 + 0: L_BRACK@223..224 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@224..224 + 2: R_BRACK@224..225 "]" [] [] + 5: R_PAREN@225..227 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@227..229 + 0: L_CURLY@227..228 "{" [] [] + 1: JS_STATEMENT_LIST@228..228 + 2: R_CURLY@228..229 "}" [] [] + 7: JS_EXPRESSION_STATEMENT@229..270 + 0: JS_ASSIGNMENT_EXPRESSION@229..269 + 0: JS_PARENTHESIZED_ASSIGNMENT@229..254 + 0: L_PAREN@229..231 "(" [Newline("\n")] [] + 1: TS_SATISFIES_ASSIGNMENT@231..252 + 0: JS_IDENTIFIER_ASSIGNMENT@231..233 + 0: IDENT@231..233 "a" [] [Whitespace(" ")] + 1: SATISFIES_KW@233..243 "satisfies" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@243..252 + 0: JS_REFERENCE_IDENTIFIER@243..244 + 0: IDENT@243..244 "B" [] [] + 1: TS_TYPE_ARGUMENTS@244..252 + 0: L_ANGLE@244..245 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@245..251 + 0: TS_STRING_TYPE@245..251 + 0: STRING_KW@245..251 "string" [] [] + 2: R_ANGLE@251..252 ">" [] [] + 2: R_PAREN@252..254 ")" [] [Whitespace(" ")] + 1: EQ@254..256 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@256..269 + 0: L_CURLY@256..258 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@258..268 + 0: JS_PROPERTY_OBJECT_MEMBER@258..268 + 0: JS_LITERAL_MEMBER_NAME@258..259 + 0: IDENT@258..259 "a" [] [] + 1: COLON@259..261 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@261..268 + 0: JS_STRING_LITERAL@261..268 "\"test\"" [] [Whitespace(" ")] + 2: R_CURLY@268..269 "}" [] [] + 1: SEMICOLON@269..270 ";" [] [] + 4: EOF@270..271 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts.snap new file mode 100644 index 000000000000..939e76bf15de --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts.snap @@ -0,0 +1,427 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + a: string +}; +let x = { a: 'test' } satisfies A; +let y = { a: 'test', b: 'test' } satisfies A; +const z = undefined satisfies 1; +let not_a_satisfies_expression = undefined +satisfies; +let precedence = "hello" satisfies string + 3 satisfies number satisfies number; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@10..12 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + l_curly_token: L_CURLY@12..13 "{" [] [], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@13..18 "a" [Newline("\n"), Whitespace(" ")] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@20..26 "string" [] [], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@26..28 "}" [Newline("\n")] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@34..36 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + expression: TsSatisfiesExpression { + expression: JsObjectExpression { + l_curly_token: L_CURLY@38..40 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@40..41 "a" [] [], + }, + colon_token: COLON@41..43 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@43..50 "'test'" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@50..52 "}" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@52..62 "satisfies" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@62..63 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@69..71 "y" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@71..73 "=" [] [Whitespace(" ")], + expression: TsSatisfiesExpression { + expression: JsObjectExpression { + l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@75..76 "a" [] [], + }, + colon_token: COLON@76..78 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@78..84 "'test'" [] [], + }, + }, + COMMA@84..86 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@86..87 "b" [] [], + }, + colon_token: COLON@87..89 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@89..96 "'test'" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@96..98 "}" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@98..108 "satisfies" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@108..109 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@109..110 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@110..117 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@117..119 "z" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@119..121 "=" [] [Whitespace(" ")], + expression: TsSatisfiesExpression { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@121..131 "undefined" [] [Whitespace(" ")], + }, + }, + satisfies_token: SATISFIES_KW@131..141 "satisfies" [] [Whitespace(" ")], + ty: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@141..142 "1" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@142..143 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@143..148 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@148..175 "not_a_satisfies_expression" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@175..177 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@177..186 "undefined" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@186..196 "satisfies" [Newline("\n")] [], + }, + }, + semicolon_token: SEMICOLON@196..197 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@197..202 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@202..213 "precedence" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@213..215 "=" [] [Whitespace(" ")], + expression: TsSatisfiesExpression { + expression: TsSatisfiesExpression { + expression: JsBinaryExpression { + left: TsSatisfiesExpression { + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@215..223 "\"hello\"" [] [Whitespace(" ")], + }, + satisfies_token: SATISFIES_KW@223..233 "satisfies" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@233..240 "string" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@240..242 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@242..244 "3" [] [Whitespace(" ")], + }, + }, + satisfies_token: SATISFIES_KW@244..254 "satisfies" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@254..261 "number" [] [Whitespace(" ")], + }, + }, + satisfies_token: SATISFIES_KW@261..271 "satisfies" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@271..277 "number" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@277..278 ";" [] [], + }, + ], + eof_token: EOF@278..279 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..279 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..278 + 0: TS_INTERFACE_DECLARATION@0..28 + 0: INTERFACE_KW@0..10 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@10..12 + 0: IDENT@10..12 "A" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: L_CURLY@12..13 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@13..26 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@13..26 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@13..18 + 0: IDENT@13..18 "a" [Newline("\n"), Whitespace(" ")] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@18..26 + 0: COLON@18..20 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@20..26 + 0: STRING_KW@20..26 "string" [] [] + 4: (empty) + 6: R_CURLY@26..28 "}" [Newline("\n")] [] + 1: JS_EMPTY_STATEMENT@28..29 + 0: SEMICOLON@28..29 ";" [] [] + 2: JS_VARIABLE_STATEMENT@29..64 + 0: JS_VARIABLE_DECLARATION@29..63 + 0: (empty) + 1: LET_KW@29..34 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@34..63 + 0: JS_VARIABLE_DECLARATOR@34..63 + 0: JS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@36..63 + 0: EQ@36..38 "=" [] [Whitespace(" ")] + 1: TS_SATISFIES_EXPRESSION@38..63 + 0: JS_OBJECT_EXPRESSION@38..52 + 0: L_CURLY@38..40 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@40..50 + 0: JS_PROPERTY_OBJECT_MEMBER@40..50 + 0: JS_LITERAL_MEMBER_NAME@40..41 + 0: IDENT@40..41 "a" [] [] + 1: COLON@41..43 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@43..50 + 0: JS_STRING_LITERAL@43..50 "'test'" [] [Whitespace(" ")] + 2: R_CURLY@50..52 "}" [] [Whitespace(" ")] + 1: SATISFIES_KW@52..62 "satisfies" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@62..63 + 0: JS_REFERENCE_IDENTIFIER@62..63 + 0: IDENT@62..63 "A" [] [] + 1: (empty) + 1: SEMICOLON@63..64 ";" [] [] + 3: JS_VARIABLE_STATEMENT@64..110 + 0: JS_VARIABLE_DECLARATION@64..109 + 0: (empty) + 1: LET_KW@64..69 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@69..109 + 0: JS_VARIABLE_DECLARATOR@69..109 + 0: JS_IDENTIFIER_BINDING@69..71 + 0: IDENT@69..71 "y" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@71..109 + 0: EQ@71..73 "=" [] [Whitespace(" ")] + 1: TS_SATISFIES_EXPRESSION@73..109 + 0: JS_OBJECT_EXPRESSION@73..98 + 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@75..96 + 0: JS_PROPERTY_OBJECT_MEMBER@75..84 + 0: JS_LITERAL_MEMBER_NAME@75..76 + 0: IDENT@75..76 "a" [] [] + 1: COLON@76..78 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@78..84 + 0: JS_STRING_LITERAL@78..84 "'test'" [] [] + 1: COMMA@84..86 "," [] [Whitespace(" ")] + 2: JS_PROPERTY_OBJECT_MEMBER@86..96 + 0: JS_LITERAL_MEMBER_NAME@86..87 + 0: IDENT@86..87 "b" [] [] + 1: COLON@87..89 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@89..96 + 0: JS_STRING_LITERAL@89..96 "'test'" [] [Whitespace(" ")] + 2: R_CURLY@96..98 "}" [] [Whitespace(" ")] + 1: SATISFIES_KW@98..108 "satisfies" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@108..109 + 0: JS_REFERENCE_IDENTIFIER@108..109 + 0: IDENT@108..109 "A" [] [] + 1: (empty) + 1: SEMICOLON@109..110 ";" [] [] + 4: JS_VARIABLE_STATEMENT@110..143 + 0: JS_VARIABLE_DECLARATION@110..142 + 0: (empty) + 1: CONST_KW@110..117 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@117..142 + 0: JS_VARIABLE_DECLARATOR@117..142 + 0: JS_IDENTIFIER_BINDING@117..119 + 0: IDENT@117..119 "z" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@119..142 + 0: EQ@119..121 "=" [] [Whitespace(" ")] + 1: TS_SATISFIES_EXPRESSION@121..142 + 0: JS_IDENTIFIER_EXPRESSION@121..131 + 0: JS_REFERENCE_IDENTIFIER@121..131 + 0: IDENT@121..131 "undefined" [] [Whitespace(" ")] + 1: SATISFIES_KW@131..141 "satisfies" [] [Whitespace(" ")] + 2: TS_NUMBER_LITERAL_TYPE@141..142 + 0: (empty) + 1: JS_NUMBER_LITERAL@141..142 "1" [] [] + 1: SEMICOLON@142..143 ";" [] [] + 5: JS_VARIABLE_STATEMENT@143..186 + 0: JS_VARIABLE_DECLARATION@143..186 + 0: (empty) + 1: LET_KW@143..148 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@148..186 + 0: JS_VARIABLE_DECLARATOR@148..186 + 0: JS_IDENTIFIER_BINDING@148..175 + 0: IDENT@148..175 "not_a_satisfies_expression" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@175..186 + 0: EQ@175..177 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@177..186 + 0: JS_REFERENCE_IDENTIFIER@177..186 + 0: IDENT@177..186 "undefined" [] [] + 1: (empty) + 6: JS_EXPRESSION_STATEMENT@186..197 + 0: JS_IDENTIFIER_EXPRESSION@186..196 + 0: JS_REFERENCE_IDENTIFIER@186..196 + 0: IDENT@186..196 "satisfies" [Newline("\n")] [] + 1: SEMICOLON@196..197 ";" [] [] + 7: JS_VARIABLE_STATEMENT@197..278 + 0: JS_VARIABLE_DECLARATION@197..277 + 0: (empty) + 1: LET_KW@197..202 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@202..277 + 0: JS_VARIABLE_DECLARATOR@202..277 + 0: JS_IDENTIFIER_BINDING@202..213 + 0: IDENT@202..213 "precedence" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@213..277 + 0: EQ@213..215 "=" [] [Whitespace(" ")] + 1: TS_SATISFIES_EXPRESSION@215..277 + 0: TS_SATISFIES_EXPRESSION@215..261 + 0: JS_BINARY_EXPRESSION@215..244 + 0: TS_SATISFIES_EXPRESSION@215..240 + 0: JS_STRING_LITERAL_EXPRESSION@215..223 + 0: JS_STRING_LITERAL@215..223 "\"hello\"" [] [Whitespace(" ")] + 1: SATISFIES_KW@223..233 "satisfies" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@233..240 + 0: STRING_KW@233..240 "string" [] [Whitespace(" ")] + 1: PLUS@240..242 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@242..244 + 0: JS_NUMBER_LITERAL@242..244 "3" [] [Whitespace(" ")] + 1: SATISFIES_KW@244..254 "satisfies" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@254..261 + 0: NUMBER_KW@254..261 "number" [] [Whitespace(" ")] + 1: SATISFIES_KW@261..271 "satisfies" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@271..277 + 0: NUMBER_KW@271..277 "number" [] [] + 1: SEMICOLON@277..278 ";" [] [] + 4: EOF@278..279 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts.snap new file mode 100644 index 000000000000..2aaf5b43c4b3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts.snap @@ -0,0 +1,540 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { set a(b: number) } +type B = { set a(b) } +// members that look like setters but aren't setters +type C = { set(a) } +type D = { set: number } +type E = { set } +type F = { set(b: number,) } +type G = {set a(b,)} +type H = {set(a, ) } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@11..15 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@15..16 "a" [] [], + }, + l_paren_token: L_PAREN@16..17 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@17..18 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@18..20 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@20..26 "number" [] [], + }, + }, + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@26..28 ")" [] [Whitespace(" ")], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@35..37 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@37..39 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@39..41 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@41..45 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@45..46 "a" [] [], + }, + l_paren_token: L_PAREN@46..47 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@47..48 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@48..50 ")" [] [Whitespace(" ")], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@50..51 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@51..110 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@110..112 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@112..114 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@114..116 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@116..119 "set" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@119..120 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@120..121 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@121..123 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@123..124 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@124..130 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@130..132 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@132..134 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@134..136 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@136..139 "set" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@139..141 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@141..148 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@148..149 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@149..155 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@155..157 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@157..159 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@159..161 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@161..165 "set" [] [Whitespace(" ")], + }, + optional_token: missing (optional), + type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@165..166 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@166..172 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@172..174 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@174..176 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@176..178 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@178..181 "set" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@181..182 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@182..183 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@183..185 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@185..191 "number" [] [], + }, + }, + initializer: missing (optional), + }, + COMMA@191..192 "," [] [], + ], + r_paren_token: R_PAREN@192..194 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@194..195 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@195..201 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@201..203 "G" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@203..205 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@205..206 "{" [] [], + members: TsTypeMemberList [ + TsSetterSignatureTypeMember { + set_token: SET_KW@206..210 "set" [] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@210..211 "a" [] [], + }, + l_paren_token: L_PAREN@211..212 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@212..213 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: COMMA@213..214 "," [] [], + r_paren_token: R_PAREN@214..215 ")" [] [], + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@215..216 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@222..224 "H" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@224..226 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@226..227 "{" [] [], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@227..230 "set" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@230..231 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@231..232 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@232..234 "," [] [Whitespace(" ")], + ], + r_paren_token: R_PAREN@234..236 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@236..237 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@237..238 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..238 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..237 + 0: TS_TYPE_ALIAS_DECLARATION@0..29 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..29 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..28 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@11..28 + 0: SET_KW@11..15 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@15..16 + 0: IDENT@15..16 "a" [] [] + 2: L_PAREN@16..17 "(" [] [] + 3: JS_FORMAL_PARAMETER@17..26 + 0: JS_DECORATOR_LIST@17..17 + 1: JS_IDENTIFIER_BINDING@17..18 + 0: IDENT@17..18 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@18..26 + 0: COLON@18..20 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@20..26 + 0: NUMBER_KW@20..26 "number" [] [] + 4: (empty) + 4: (empty) + 5: R_PAREN@26..28 ")" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@28..29 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@29..51 + 0: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@35..37 + 0: IDENT@35..37 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@37..39 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@39..51 + 0: L_CURLY@39..41 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@41..50 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@41..50 + 0: SET_KW@41..45 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@45..46 + 0: IDENT@45..46 "a" [] [] + 2: L_PAREN@46..47 "(" [] [] + 3: JS_FORMAL_PARAMETER@47..48 + 0: JS_DECORATOR_LIST@47..47 + 1: JS_IDENTIFIER_BINDING@47..48 + 0: IDENT@47..48 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: (empty) + 5: R_PAREN@48..50 ")" [] [Whitespace(" ")] + 6: (empty) + 2: R_CURLY@50..51 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@51..124 + 0: TYPE_KW@51..110 "type" [Newline("\n"), Comments("// members that look ..."), Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@110..112 + 0: IDENT@110..112 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@112..114 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@114..124 + 0: L_CURLY@114..116 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@116..123 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@116..123 + 0: JS_LITERAL_MEMBER_NAME@116..119 + 0: IDENT@116..119 "set" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@119..123 + 0: L_PAREN@119..120 "(" [] [] + 1: JS_PARAMETER_LIST@120..121 + 0: JS_FORMAL_PARAMETER@120..121 + 0: JS_DECORATOR_LIST@120..120 + 1: JS_IDENTIFIER_BINDING@120..121 + 0: IDENT@120..121 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@121..123 ")" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 2: R_CURLY@123..124 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@124..149 + 0: TYPE_KW@124..130 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@130..132 + 0: IDENT@130..132 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@132..134 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@134..149 + 0: L_CURLY@134..136 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@136..148 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@136..148 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@136..139 + 0: IDENT@136..139 "set" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@139..148 + 0: COLON@139..141 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@141..148 + 0: NUMBER_KW@141..148 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@148..149 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@149..166 + 0: TYPE_KW@149..155 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@155..157 + 0: IDENT@155..157 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@157..159 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@159..166 + 0: L_CURLY@159..161 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@161..165 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@161..165 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@161..165 + 0: IDENT@161..165 "set" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_CURLY@165..166 "}" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@166..195 + 0: TYPE_KW@166..172 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@172..174 + 0: IDENT@172..174 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@174..176 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@176..195 + 0: L_CURLY@176..178 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@178..194 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@178..194 + 0: JS_LITERAL_MEMBER_NAME@178..181 + 0: IDENT@178..181 "set" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@181..194 + 0: L_PAREN@181..182 "(" [] [] + 1: JS_PARAMETER_LIST@182..192 + 0: JS_FORMAL_PARAMETER@182..191 + 0: JS_DECORATOR_LIST@182..182 + 1: JS_IDENTIFIER_BINDING@182..183 + 0: IDENT@182..183 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@183..191 + 0: COLON@183..185 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@185..191 + 0: NUMBER_KW@185..191 "number" [] [] + 4: (empty) + 1: COMMA@191..192 "," [] [] + 2: R_PAREN@192..194 ")" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 2: R_CURLY@194..195 "}" [] [] + 5: (empty) + 6: TS_TYPE_ALIAS_DECLARATION@195..216 + 0: TYPE_KW@195..201 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@201..203 + 0: IDENT@201..203 "G" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@203..205 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@205..216 + 0: L_CURLY@205..206 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@206..215 + 0: TS_SETTER_SIGNATURE_TYPE_MEMBER@206..215 + 0: SET_KW@206..210 "set" [] [Whitespace(" ")] + 1: JS_LITERAL_MEMBER_NAME@210..211 + 0: IDENT@210..211 "a" [] [] + 2: L_PAREN@211..212 "(" [] [] + 3: JS_FORMAL_PARAMETER@212..213 + 0: JS_DECORATOR_LIST@212..212 + 1: JS_IDENTIFIER_BINDING@212..213 + 0: IDENT@212..213 "b" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 4: COMMA@213..214 "," [] [] + 5: R_PAREN@214..215 ")" [] [] + 6: (empty) + 2: R_CURLY@215..216 "}" [] [] + 5: (empty) + 7: TS_TYPE_ALIAS_DECLARATION@216..237 + 0: TYPE_KW@216..222 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@222..224 + 0: IDENT@222..224 "H" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@224..226 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@226..237 + 0: L_CURLY@226..227 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@227..236 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@227..236 + 0: JS_LITERAL_MEMBER_NAME@227..230 + 0: IDENT@227..230 "set" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@230..236 + 0: L_PAREN@230..231 "(" [] [] + 1: JS_PARAMETER_LIST@231..234 + 0: JS_FORMAL_PARAMETER@231..232 + 0: JS_DECORATOR_LIST@231..231 + 1: JS_IDENTIFIER_BINDING@231..232 + 0: IDENT@231..232 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@232..234 "," [] [Whitespace(" ")] + 2: R_PAREN@234..236 ")" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 2: R_CURLY@236..237 "}" [] [] + 5: (empty) + 4: EOF@237..238 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap new file mode 100644 index 000000000000..c31c3155a776 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap @@ -0,0 +1,167 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +html`abcd` +html`abcd`._string + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsTemplateExpression { + tag: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@0..4 "html" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@4..5 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@5..6 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@6..8 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@8..9 "B" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@9..10 ">" [] [], + }, + l_tick_token: BACKTICK@10..11 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@11..15 "abcd" [] [], + }, + ], + r_tick_token: BACKTICK@15..16 "`" [] [], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsTemplateExpression { + tag: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..21 "html" [Newline("\n")] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@21..22 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@22..23 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@25..26 "B" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@26..27 ">" [] [], + }, + l_tick_token: BACKTICK@27..28 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@28..32 "abcd" [] [], + }, + ], + r_tick_token: BACKTICK@32..33 "`" [] [], + }, + operator_token: DOT@33..34 "." [] [], + member: JsName { + value_token: IDENT@34..41 "_string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@41..42 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..42 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..41 + 0: JS_EXPRESSION_STATEMENT@0..16 + 0: JS_TEMPLATE_EXPRESSION@0..16 + 0: JS_IDENTIFIER_EXPRESSION@0..4 + 0: JS_REFERENCE_IDENTIFIER@0..4 + 0: IDENT@0..4 "html" [] [] + 1: TS_TYPE_ARGUMENTS@4..10 + 0: L_ANGLE@4..5 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@5..9 + 0: TS_REFERENCE_TYPE@5..6 + 0: JS_REFERENCE_IDENTIFIER@5..6 + 0: IDENT@5..6 "A" [] [] + 1: (empty) + 1: COMMA@6..8 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@8..9 + 0: JS_REFERENCE_IDENTIFIER@8..9 + 0: IDENT@8..9 "B" [] [] + 1: (empty) + 2: R_ANGLE@9..10 ">" [] [] + 2: BACKTICK@10..11 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@11..15 + 0: JS_TEMPLATE_CHUNK_ELEMENT@11..15 + 0: TEMPLATE_CHUNK@11..15 "abcd" [] [] + 4: BACKTICK@15..16 "`" [] [] + 1: (empty) + 1: JS_EXPRESSION_STATEMENT@16..41 + 0: JS_STATIC_MEMBER_EXPRESSION@16..41 + 0: JS_TEMPLATE_EXPRESSION@16..33 + 0: JS_IDENTIFIER_EXPRESSION@16..21 + 0: JS_REFERENCE_IDENTIFIER@16..21 + 0: IDENT@16..21 "html" [Newline("\n")] [] + 1: TS_TYPE_ARGUMENTS@21..27 + 0: L_ANGLE@21..22 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@22..26 + 0: TS_REFERENCE_TYPE@22..23 + 0: JS_REFERENCE_IDENTIFIER@22..23 + 0: IDENT@22..23 "A" [] [] + 1: (empty) + 1: COMMA@23..25 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@25..26 + 0: JS_REFERENCE_IDENTIFIER@25..26 + 0: IDENT@25..26 "B" [] [] + 1: (empty) + 2: R_ANGLE@26..27 ">" [] [] + 2: BACKTICK@27..28 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@28..32 + 0: JS_TEMPLATE_CHUNK_ELEMENT@28..32 + 0: TEMPLATE_CHUNK@28..32 "abcd" [] [] + 4: BACKTICK@32..33 "`" [] [] + 1: DOT@33..34 "." [] [] + 2: JS_NAME@34..41 + 0: IDENT@34..41 "_string" [] [] + 1: (empty) + 4: EOF@41..42 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts.snap new file mode 100644 index 000000000000..517f2e044442 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts.snap @@ -0,0 +1,195 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = `abcd` +type B = `a${A}` +type C = `c${X}` + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsTemplateLiteralType { + l_tick_token: BACKTICK@9..10 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@10..14 "abcd" [] [], + }, + ], + r_tick_token: BACKTICK@14..15 "`" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@21..23 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@23..25 "=" [] [Whitespace(" ")], + ty: TsTemplateLiteralType { + l_tick_token: BACKTICK@25..26 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@26..27 "a" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@27..29 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@29..30 "A" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@30..31 "}" [] [], + }, + ], + r_tick_token: BACKTICK@31..32 "`" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@38..39 "C" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@39..40 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@40..42 "X" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@42..50 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@50..56 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@56..58 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@58..60 "=" [] [Whitespace(" ")], + ty: TsTemplateLiteralType { + l_tick_token: BACKTICK@60..61 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@61..62 "c" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@62..64 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@64..65 "X" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@65..66 "}" [] [], + }, + ], + r_tick_token: BACKTICK@66..67 "`" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..67 + 0: TS_TYPE_ALIAS_DECLARATION@0..15 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@9..15 + 0: BACKTICK@9..10 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@10..14 + 0: TS_TEMPLATE_CHUNK_ELEMENT@10..14 + 0: TEMPLATE_CHUNK@10..14 "abcd" [] [] + 2: BACKTICK@14..15 "`" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@15..32 + 0: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@21..23 + 0: IDENT@21..23 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@23..25 "=" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@25..32 + 0: BACKTICK@25..26 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@26..31 + 0: TS_TEMPLATE_CHUNK_ELEMENT@26..27 + 0: TEMPLATE_CHUNK@26..27 "a" [] [] + 1: TS_TEMPLATE_ELEMENT@27..31 + 0: DOLLAR_CURLY@27..29 "${" [] [] + 1: TS_REFERENCE_TYPE@29..30 + 0: JS_REFERENCE_IDENTIFIER@29..30 + 0: IDENT@29..30 "A" [] [] + 1: (empty) + 2: R_CURLY@30..31 "}" [] [] + 2: BACKTICK@31..32 "`" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@32..67 + 0: TYPE_KW@32..38 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@38..39 + 0: IDENT@38..39 "C" [] [] + 2: TS_TYPE_PARAMETERS@39..58 + 0: L_ANGLE@39..40 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@40..56 + 0: TS_TYPE_PARAMETER@40..56 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@40..40 + 1: TS_TYPE_PARAMETER_NAME@40..42 + 0: IDENT@40..42 "X" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@42..56 + 0: EXTENDS_KW@42..50 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@50..56 + 0: STRING_KW@50..56 "string" [] [] + 3: (empty) + 2: R_ANGLE@56..58 ">" [] [Whitespace(" ")] + 3: EQ@58..60 "=" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@60..67 + 0: BACKTICK@60..61 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@61..66 + 0: TS_TEMPLATE_CHUNK_ELEMENT@61..62 + 0: TEMPLATE_CHUNK@61..62 "c" [] [] + 1: TS_TEMPLATE_ELEMENT@62..66 + 0: DOLLAR_CURLY@62..64 "${" [] [] + 1: TS_REFERENCE_TYPE@64..65 + 0: JS_REFERENCE_IDENTIFIER@64..65 + 0: IDENT@64..65 "X" [] [] + 1: (empty) + 2: R_CURLY@65..66 "}" [] [] + 2: BACKTICK@66..67 "`" [] [] + 5: (empty) + 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts.snap new file mode 100644 index 000000000000..5a119751f2a9 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts.snap @@ -0,0 +1,137 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(this) {} +function b(this: string) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@9..10 "a" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@10..11 "(" [] [], + items: JsParameterList [ + TsThisParameter { + this_token: THIS_KW@11..15 "this" [] [], + type_annotation: missing (optional), + }, + ], + r_paren_token: R_PAREN@15..17 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@17..18 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@19..29 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@29..30 "b" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [ + TsThisParameter { + this_token: THIS_KW@31..35 "this" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@35..37 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@37..43 "string" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@45..46 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@46..47 "}" [] [], + }, + }, + ], + eof_token: EOF@47..48 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..48 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..47 + 0: JS_FUNCTION_DECLARATION@0..19 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@9..10 + 0: IDENT@9..10 "a" [] [] + 4: (empty) + 5: JS_PARAMETERS@10..17 + 0: L_PAREN@10..11 "(" [] [] + 1: JS_PARAMETER_LIST@11..15 + 0: TS_THIS_PARAMETER@11..15 + 0: THIS_KW@11..15 "this" [] [] + 1: (empty) + 2: R_PAREN@15..17 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..18 + 3: R_CURLY@18..19 "}" [] [] + 1: JS_FUNCTION_DECLARATION@19..47 + 0: (empty) + 1: FUNCTION_KW@19..29 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@29..30 + 0: IDENT@29..30 "b" [] [] + 4: (empty) + 5: JS_PARAMETERS@30..45 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..43 + 0: TS_THIS_PARAMETER@31..43 + 0: THIS_KW@31..35 "this" [] [] + 1: TS_TYPE_ANNOTATION@35..43 + 0: COLON@35..37 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@37..43 + 0: STRING_KW@37..43 "string" [] [] + 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@45..47 + 0: L_CURLY@45..46 "{" [] [] + 1: JS_DIRECTIVE_LIST@46..46 + 2: JS_STATEMENT_LIST@46..46 + 3: R_CURLY@46..47 "}" [] [] + 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_this_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts.snap new file mode 100644 index 000000000000..1d5caf24b4d4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts.snap @@ -0,0 +1,218 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method() { + type A = this; + } + predicate(): this is string { + return typeof this === "string" + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..8 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@8..9 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@24..38 "type" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@38..40 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@40..42 "=" [] [Whitespace(" ")], + ty: TsThisType { + this_token: THIS_KW@42..46 "this" [] [], + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + ], + r_curly_token: R_CURLY@47..53 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@53..67 "predicate" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@67..68 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@68..69 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: TsThisType { + this_token: THIS_KW@71..76 "this" [] [Whitespace(" ")], + }, + is_token: IS_KW@76..79 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@79..86 "string" [] [Whitespace(" ")], + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@86..87 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@87..103 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsBinaryExpression { + left: JsUnaryExpression { + operator_token: TYPEOF_KW@103..110 "typeof" [] [Whitespace(" ")], + argument: JsThisExpression { + this_token: THIS_KW@110..115 "this" [] [Whitespace(" ")], + }, + }, + operator_token: EQ3@115..119 "===" [] [Whitespace(" ")], + right: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@119..127 "\"string\"" [] [], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@127..133 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@133..135 "}" [Newline("\n")] [], + }, + ], + eof_token: EOF@135..136 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..136 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..135 + 0: JS_CLASS_DECLARATION@0..135 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@8..9 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@9..133 + 0: JS_METHOD_CLASS_MEMBER@9..53 + 0: JS_METHOD_MODIFIER_LIST@9..9 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@9..20 + 0: IDENT@9..20 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@23..53 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..47 + 0: TS_TYPE_ALIAS_DECLARATION@24..47 + 0: TYPE_KW@24..38 "type" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@38..40 + 0: IDENT@38..40 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@40..42 "=" [] [Whitespace(" ")] + 4: TS_THIS_TYPE@42..46 + 0: THIS_KW@42..46 "this" [] [] + 5: SEMICOLON@46..47 ";" [] [] + 3: R_CURLY@47..53 "}" [Newline("\n"), Whitespace(" ")] [] + 1: JS_METHOD_CLASS_MEMBER@53..133 + 0: JS_METHOD_MODIFIER_LIST@53..53 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@53..67 + 0: IDENT@53..67 "predicate" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@67..69 + 0: L_PAREN@67..68 "(" [] [] + 1: JS_PARAMETER_LIST@68..68 + 2: R_PAREN@68..69 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@69..86 + 0: COLON@69..71 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@71..86 + 0: TS_THIS_TYPE@71..76 + 0: THIS_KW@71..76 "this" [] [Whitespace(" ")] + 1: IS_KW@76..79 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@79..86 + 0: STRING_KW@79..86 "string" [] [Whitespace(" ")] + 8: JS_FUNCTION_BODY@86..133 + 0: L_CURLY@86..87 "{" [] [] + 1: JS_DIRECTIVE_LIST@87..87 + 2: JS_STATEMENT_LIST@87..127 + 0: JS_RETURN_STATEMENT@87..127 + 0: RETURN_KW@87..103 "return" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@103..127 + 0: JS_UNARY_EXPRESSION@103..115 + 0: TYPEOF_KW@103..110 "typeof" [] [Whitespace(" ")] + 1: JS_THIS_EXPRESSION@110..115 + 0: THIS_KW@110..115 "this" [] [Whitespace(" ")] + 1: EQ3@115..119 "===" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@119..127 + 0: JS_STRING_LITERAL@119..127 "\"string\"" [] [] + 2: (empty) + 3: R_CURLY@127..133 "}" [Newline("\n"), Whitespace(" ")] [] + 9: R_CURLY@133..135 "}" [Newline("\n")] [] + 4: EOF@135..136 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts.snap new file mode 100644 index 000000000000..9a80f0619616 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts.snap @@ -0,0 +1,391 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = [string, number, any] +type B = [a: string, b: number, c: any] +type C = [a: string, b: number, ...c: any[]] +type D = [a?: string] +type E = [...string[]] +type F = [string?] + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@9..10 "[" [] [], + elements: TsTupleTypeElementList [ + TsStringType { + string_token: STRING_KW@10..16 "string" [] [], + }, + COMMA@16..18 "," [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@18..24 "number" [] [], + }, + COMMA@24..26 "," [] [Whitespace(" ")], + TsAnyType { + any_token: ANY_KW@26..29 "any" [] [], + }, + ], + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@30..36 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@36..38 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@38..40 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@40..41 "[" [] [], + elements: TsTupleTypeElementList [ + TsNamedTupleTypeElement { + dotdotdot_token: missing (optional), + name: JsName { + value_token: IDENT@41..42 "a" [] [], + }, + question_mark_token: missing (optional), + colon_token: COLON@42..44 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@44..50 "string" [] [], + }, + }, + COMMA@50..52 "," [] [Whitespace(" ")], + TsNamedTupleTypeElement { + dotdotdot_token: missing (optional), + name: JsName { + value_token: IDENT@52..53 "b" [] [], + }, + question_mark_token: missing (optional), + colon_token: COLON@53..55 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@55..61 "number" [] [], + }, + }, + COMMA@61..63 "," [] [Whitespace(" ")], + TsNamedTupleTypeElement { + dotdotdot_token: missing (optional), + name: JsName { + value_token: IDENT@63..64 "c" [] [], + }, + question_mark_token: missing (optional), + colon_token: COLON@64..66 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@66..69 "any" [] [], + }, + }, + ], + r_brack_token: R_BRACK@69..70 "]" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@70..76 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@76..78 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@78..80 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@80..81 "[" [] [], + elements: TsTupleTypeElementList [ + TsNamedTupleTypeElement { + dotdotdot_token: missing (optional), + name: JsName { + value_token: IDENT@81..82 "a" [] [], + }, + question_mark_token: missing (optional), + colon_token: COLON@82..84 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@84..90 "string" [] [], + }, + }, + COMMA@90..92 "," [] [Whitespace(" ")], + TsNamedTupleTypeElement { + dotdotdot_token: missing (optional), + name: JsName { + value_token: IDENT@92..93 "b" [] [], + }, + question_mark_token: missing (optional), + colon_token: COLON@93..95 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@95..101 "number" [] [], + }, + }, + COMMA@101..103 "," [] [Whitespace(" ")], + TsNamedTupleTypeElement { + dotdotdot_token: DOT3@103..106 "..." [] [], + name: JsName { + value_token: IDENT@106..107 "c" [] [], + }, + question_mark_token: missing (optional), + colon_token: COLON@107..109 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@109..112 "any" [] [], + }, + l_brack_token: L_BRACK@112..113 "[" [] [], + r_brack_token: R_BRACK@113..114 "]" [] [], + }, + }, + ], + r_brack_token: R_BRACK@114..115 "]" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@121..123 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@123..125 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@125..126 "[" [] [], + elements: TsTupleTypeElementList [ + TsNamedTupleTypeElement { + dotdotdot_token: missing (optional), + name: JsName { + value_token: IDENT@126..127 "a" [] [], + }, + question_mark_token: QUESTION@127..128 "?" [] [], + colon_token: COLON@128..130 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@130..136 "string" [] [], + }, + }, + ], + r_brack_token: R_BRACK@136..137 "]" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@137..143 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@143..145 "E" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@145..147 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@147..148 "[" [] [], + elements: TsTupleTypeElementList [ + TsRestTupleTypeElement { + dotdotdot_token: DOT3@148..151 "..." [] [], + ty: TsArrayType { + element_type: TsStringType { + string_token: STRING_KW@151..157 "string" [] [], + }, + l_brack_token: L_BRACK@157..158 "[" [] [], + r_brack_token: R_BRACK@158..159 "]" [] [], + }, + }, + ], + r_brack_token: R_BRACK@159..160 "]" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@160..166 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@166..168 "F" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@168..170 "=" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@170..171 "[" [] [], + elements: TsTupleTypeElementList [ + TsOptionalTupleTypeElement { + ty: TsStringType { + string_token: STRING_KW@171..177 "string" [] [], + }, + question_mark_token: QUESTION@177..178 "?" [] [], + }, + ], + r_brack_token: R_BRACK@178..179 "]" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@179..180 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..180 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..179 + 0: TS_TYPE_ALIAS_DECLARATION@0..30 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@9..30 + 0: L_BRACK@9..10 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@10..29 + 0: TS_STRING_TYPE@10..16 + 0: STRING_KW@10..16 "string" [] [] + 1: COMMA@16..18 "," [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@18..24 + 0: NUMBER_KW@18..24 "number" [] [] + 3: COMMA@24..26 "," [] [Whitespace(" ")] + 4: TS_ANY_TYPE@26..29 + 0: ANY_KW@26..29 "any" [] [] + 2: R_BRACK@29..30 "]" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@30..70 + 0: TYPE_KW@30..36 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@36..38 + 0: IDENT@36..38 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@38..40 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@40..70 + 0: L_BRACK@40..41 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@41..69 + 0: TS_NAMED_TUPLE_TYPE_ELEMENT@41..50 + 0: (empty) + 1: JS_NAME@41..42 + 0: IDENT@41..42 "a" [] [] + 2: (empty) + 3: COLON@42..44 ":" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@44..50 + 0: STRING_KW@44..50 "string" [] [] + 1: COMMA@50..52 "," [] [Whitespace(" ")] + 2: TS_NAMED_TUPLE_TYPE_ELEMENT@52..61 + 0: (empty) + 1: JS_NAME@52..53 + 0: IDENT@52..53 "b" [] [] + 2: (empty) + 3: COLON@53..55 ":" [] [Whitespace(" ")] + 4: TS_NUMBER_TYPE@55..61 + 0: NUMBER_KW@55..61 "number" [] [] + 3: COMMA@61..63 "," [] [Whitespace(" ")] + 4: TS_NAMED_TUPLE_TYPE_ELEMENT@63..69 + 0: (empty) + 1: JS_NAME@63..64 + 0: IDENT@63..64 "c" [] [] + 2: (empty) + 3: COLON@64..66 ":" [] [Whitespace(" ")] + 4: TS_ANY_TYPE@66..69 + 0: ANY_KW@66..69 "any" [] [] + 2: R_BRACK@69..70 "]" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@70..115 + 0: TYPE_KW@70..76 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@76..78 + 0: IDENT@76..78 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@78..80 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@80..115 + 0: L_BRACK@80..81 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@81..114 + 0: TS_NAMED_TUPLE_TYPE_ELEMENT@81..90 + 0: (empty) + 1: JS_NAME@81..82 + 0: IDENT@81..82 "a" [] [] + 2: (empty) + 3: COLON@82..84 ":" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@84..90 + 0: STRING_KW@84..90 "string" [] [] + 1: COMMA@90..92 "," [] [Whitespace(" ")] + 2: TS_NAMED_TUPLE_TYPE_ELEMENT@92..101 + 0: (empty) + 1: JS_NAME@92..93 + 0: IDENT@92..93 "b" [] [] + 2: (empty) + 3: COLON@93..95 ":" [] [Whitespace(" ")] + 4: TS_NUMBER_TYPE@95..101 + 0: NUMBER_KW@95..101 "number" [] [] + 3: COMMA@101..103 "," [] [Whitespace(" ")] + 4: TS_NAMED_TUPLE_TYPE_ELEMENT@103..114 + 0: DOT3@103..106 "..." [] [] + 1: JS_NAME@106..107 + 0: IDENT@106..107 "c" [] [] + 2: (empty) + 3: COLON@107..109 ":" [] [Whitespace(" ")] + 4: TS_ARRAY_TYPE@109..114 + 0: TS_ANY_TYPE@109..112 + 0: ANY_KW@109..112 "any" [] [] + 1: L_BRACK@112..113 "[" [] [] + 2: R_BRACK@113..114 "]" [] [] + 2: R_BRACK@114..115 "]" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@115..137 + 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@121..123 + 0: IDENT@121..123 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@123..125 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@125..137 + 0: L_BRACK@125..126 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@126..136 + 0: TS_NAMED_TUPLE_TYPE_ELEMENT@126..136 + 0: (empty) + 1: JS_NAME@126..127 + 0: IDENT@126..127 "a" [] [] + 2: QUESTION@127..128 "?" [] [] + 3: COLON@128..130 ":" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@130..136 + 0: STRING_KW@130..136 "string" [] [] + 2: R_BRACK@136..137 "]" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@137..160 + 0: TYPE_KW@137..143 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@143..145 + 0: IDENT@143..145 "E" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@145..147 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@147..160 + 0: L_BRACK@147..148 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@148..159 + 0: TS_REST_TUPLE_TYPE_ELEMENT@148..159 + 0: DOT3@148..151 "..." [] [] + 1: TS_ARRAY_TYPE@151..159 + 0: TS_STRING_TYPE@151..157 + 0: STRING_KW@151..157 "string" [] [] + 1: L_BRACK@157..158 "[" [] [] + 2: R_BRACK@158..159 "]" [] [] + 2: R_BRACK@159..160 "]" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@160..179 + 0: TYPE_KW@160..166 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@166..168 + 0: IDENT@166..168 "F" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@168..170 "=" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@170..179 + 0: L_BRACK@170..171 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@171..178 + 0: TS_OPTIONAL_TUPLE_TYPE_ELEMENT@171..178 + 0: TS_STRING_TYPE@171..177 + 0: STRING_KW@171..177 "string" [] [] + 1: QUESTION@177..178 "?" [] [] + 2: R_BRACK@178..179 "]" [] [] + 5: (empty) + 4: EOF@179..180 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap new file mode 100644 index 000000000000..748b34f48a74 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap @@ -0,0 +1,192 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = T; +type B = A<(c: C) => undefined>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..6 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@6..7 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@7..8 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@8..10 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@10..12 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@12..13 "T" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@13..14 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@14..20 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@20..22 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@24..25 "A" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@25..26 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@26..27 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@27..28 "C" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@28..29 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@29..30 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@30..31 "c" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@33..34 "C" [] [], + }, + type_arguments: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@36..39 "=>" [] [Whitespace(" ")], + return_type: TsUndefinedType { + undefined_token: UNDEFINED_KW@39..48 "undefined" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@48..49 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@49..50 ";" [] [], + }, + ], + eof_token: EOF@50..51 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..51 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..50 + 0: TS_TYPE_ALIAS_DECLARATION@0..14 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..6 + 0: IDENT@5..6 "A" [] [] + 2: TS_TYPE_PARAMETERS@6..10 + 0: L_ANGLE@6..7 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@7..8 + 0: TS_TYPE_PARAMETER@7..8 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 + 1: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@8..10 ">" [] [Whitespace(" ")] + 3: EQ@10..12 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@12..13 + 0: JS_REFERENCE_IDENTIFIER@12..13 + 0: IDENT@12..13 "T" [] [] + 1: (empty) + 5: SEMICOLON@13..14 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@14..50 + 0: TYPE_KW@14..20 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@20..22 + 0: IDENT@20..22 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@22..24 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@24..49 + 0: JS_REFERENCE_IDENTIFIER@24..25 + 0: IDENT@24..25 "A" [] [] + 1: TS_TYPE_ARGUMENTS@25..49 + 0: L_ANGLE@25..26 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@26..48 + 0: TS_FUNCTION_TYPE@26..48 + 0: TS_TYPE_PARAMETERS@26..29 + 0: L_ANGLE@26..27 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@27..28 + 0: TS_TYPE_PARAMETER@27..28 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@27..27 + 1: TS_TYPE_PARAMETER_NAME@27..28 + 0: IDENT@27..28 "C" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@28..29 ">" [] [] + 1: JS_PARAMETERS@29..36 + 0: L_PAREN@29..30 "(" [] [] + 1: JS_PARAMETER_LIST@30..34 + 0: JS_FORMAL_PARAMETER@30..34 + 0: JS_DECORATOR_LIST@30..30 + 1: JS_IDENTIFIER_BINDING@30..31 + 0: IDENT@30..31 "c" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@31..34 + 0: COLON@31..33 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@33..34 + 0: JS_REFERENCE_IDENTIFIER@33..34 + 0: IDENT@33..34 "C" [] [] + 1: (empty) + 4: (empty) + 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@36..39 "=>" [] [Whitespace(" ")] + 3: TS_UNDEFINED_TYPE@39..48 + 0: UNDEFINED_KW@39..48 "undefined" [] [] + 2: R_ANGLE@48..49 ">" [] [] + 5: SEMICOLON@49..50 ";" [] [] + 4: EOF@50..51 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap new file mode 100644 index 000000000000..06f03fb40458 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +0 < (0 >= 1); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@0..2 "0" [] [Whitespace(" ")], + }, + operator_token: L_ANGLE@2..4 "<" [] [Whitespace(" ")], + right: JsParenthesizedExpression { + l_paren_token: L_PAREN@4..5 "(" [] [], + expression: JsBinaryExpression { + left: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@5..7 "0" [] [Whitespace(" ")], + }, + operator_token: GTEQ@7..10 ">=" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@10..11 "1" [] [], + }, + }, + r_paren_token: R_PAREN@11..12 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@12..13 ";" [] [], + }, + ], + eof_token: EOF@13..14 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..14 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..13 + 0: JS_EXPRESSION_STATEMENT@0..13 + 0: JS_BINARY_EXPRESSION@0..12 + 0: JS_NUMBER_LITERAL_EXPRESSION@0..2 + 0: JS_NUMBER_LITERAL@0..2 "0" [] [Whitespace(" ")] + 1: L_ANGLE@2..4 "<" [] [Whitespace(" ")] + 2: JS_PARENTHESIZED_EXPRESSION@4..12 + 0: L_PAREN@4..5 "(" [] [] + 1: JS_BINARY_EXPRESSION@5..11 + 0: JS_NUMBER_LITERAL_EXPRESSION@5..7 + 0: JS_NUMBER_LITERAL@5..7 "0" [] [Whitespace(" ")] + 1: GTEQ@7..10 ">=" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@10..11 + 0: JS_NUMBER_LITERAL@10..11 "1" [] [] + 2: R_PAREN@11..12 ")" [] [] + 1: SEMICOLON@12..13 ";" [] [] + 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts.snap new file mode 100644 index 000000000000..2ca3bb28aacf --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts.snap @@ -0,0 +1,86 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = b; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@8..9 "<" [] [], + ty: TsNumberType { + number_token: NUMBER_KW@9..15 "number" [] [], + }, + r_angle_token: R_ANGLE@15..16 ">" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "b" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@17..18 ";" [] [], + }, + ], + eof_token: EOF@18..19 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..19 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..18 + 0: JS_VARIABLE_STATEMENT@0..18 + 0: JS_VARIABLE_DECLARATION@0..17 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..17 + 0: JS_VARIABLE_DECLARATOR@4..17 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..17 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: TS_TYPE_ASSERTION_EXPRESSION@8..17 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_NUMBER_TYPE@9..15 + 0: NUMBER_KW@9..15 "number" [] [] + 2: R_ANGLE@15..16 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "b" [] [] + 1: SEMICOLON@17..18 ";" [] [] + 4: EOF@18..19 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap new file mode 100644 index 000000000000..9a44593740a7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap @@ -0,0 +1,236 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let x = "hello"; +let y = x; +var d = ({ name: "foo", message: "bar" }); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@8..9 "<" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@9..14 "const" [] [], + }, + type_arguments: missing (optional), + }, + r_angle_token: R_ANGLE@14..15 ">" [] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@15..22 "\"hello\"" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@22..23 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@28..30 "y" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@30..32 "=" [] [Whitespace(" ")], + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@32..33 "<" [] [], + ty: TsStringType { + string_token: STRING_KW@33..39 "string" [] [], + }, + r_angle_token: R_ANGLE@39..41 ">" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..42 "x" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@42..43 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@43..48 "var" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@48..50 "d" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@50..52 "=" [] [Whitespace(" ")], + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@52..53 "<" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@53..58 "Error" [] [], + }, + type_arguments: missing (optional), + }, + r_angle_token: R_ANGLE@58..59 ">" [] [], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@59..60 "(" [] [], + expression: JsObjectExpression { + l_curly_token: L_CURLY@60..62 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@62..66 "name" [] [], + }, + colon_token: COLON@66..68 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@68..73 "\"foo\"" [] [], + }, + }, + COMMA@73..75 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@75..82 "message" [] [], + }, + colon_token: COLON@82..84 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@84..90 "\"bar\"" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@90..91 "}" [] [], + }, + r_paren_token: R_PAREN@91..92 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@92..93 ";" [] [], + }, + ], + eof_token: EOF@93..94 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..94 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..93 + 0: JS_VARIABLE_STATEMENT@0..23 + 0: JS_VARIABLE_DECLARATION@0..22 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..22 + 0: JS_VARIABLE_DECLARATOR@4..22 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..22 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: TS_TYPE_ASSERTION_EXPRESSION@8..22 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_REFERENCE_TYPE@9..14 + 0: JS_REFERENCE_IDENTIFIER@9..14 + 0: IDENT@9..14 "const" [] [] + 1: (empty) + 2: R_ANGLE@14..15 ">" [] [] + 3: JS_STRING_LITERAL_EXPRESSION@15..22 + 0: JS_STRING_LITERAL@15..22 "\"hello\"" [] [] + 1: SEMICOLON@22..23 ";" [] [] + 1: JS_VARIABLE_STATEMENT@23..43 + 0: JS_VARIABLE_DECLARATION@23..42 + 0: (empty) + 1: LET_KW@23..28 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@28..42 + 0: JS_VARIABLE_DECLARATOR@28..42 + 0: JS_IDENTIFIER_BINDING@28..30 + 0: IDENT@28..30 "y" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@30..42 + 0: EQ@30..32 "=" [] [Whitespace(" ")] + 1: TS_TYPE_ASSERTION_EXPRESSION@32..42 + 0: L_ANGLE@32..33 "<" [] [] + 1: TS_STRING_TYPE@33..39 + 0: STRING_KW@33..39 "string" [] [] + 2: R_ANGLE@39..41 ">" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_EXPRESSION@41..42 + 0: JS_REFERENCE_IDENTIFIER@41..42 + 0: IDENT@41..42 "x" [] [] + 1: SEMICOLON@42..43 ";" [] [] + 2: JS_VARIABLE_STATEMENT@43..93 + 0: JS_VARIABLE_DECLARATION@43..92 + 0: (empty) + 1: VAR_KW@43..48 "var" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@48..92 + 0: JS_VARIABLE_DECLARATOR@48..92 + 0: JS_IDENTIFIER_BINDING@48..50 + 0: IDENT@48..50 "d" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@50..92 + 0: EQ@50..52 "=" [] [Whitespace(" ")] + 1: TS_TYPE_ASSERTION_EXPRESSION@52..92 + 0: L_ANGLE@52..53 "<" [] [] + 1: TS_REFERENCE_TYPE@53..58 + 0: JS_REFERENCE_IDENTIFIER@53..58 + 0: IDENT@53..58 "Error" [] [] + 1: (empty) + 2: R_ANGLE@58..59 ">" [] [] + 3: JS_PARENTHESIZED_EXPRESSION@59..92 + 0: L_PAREN@59..60 "(" [] [] + 1: JS_OBJECT_EXPRESSION@60..91 + 0: L_CURLY@60..62 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@62..90 + 0: JS_PROPERTY_OBJECT_MEMBER@62..73 + 0: JS_LITERAL_MEMBER_NAME@62..66 + 0: IDENT@62..66 "name" [] [] + 1: COLON@66..68 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@68..73 + 0: JS_STRING_LITERAL@68..73 "\"foo\"" [] [] + 1: COMMA@73..75 "," [] [Whitespace(" ")] + 2: JS_PROPERTY_OBJECT_MEMBER@75..90 + 0: JS_LITERAL_MEMBER_NAME@75..82 + 0: IDENT@75..82 "message" [] [] + 1: COLON@82..84 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@84..90 + 0: JS_STRING_LITERAL@84..90 "\"bar\"" [] [Whitespace(" ")] + 2: R_CURLY@90..91 "}" [] [] + 2: R_PAREN@91..92 ")" [] [] + 1: SEMICOLON@92..93 ";" [] [] + 4: EOF@93..94 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap new file mode 100644 index 000000000000..1cff6ea4ca6b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap @@ -0,0 +1,193 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = X; +type B = { a: X } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..6 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@6..7 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@7..9 "X" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@17..23 "number" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@23..25 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@25..27 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@27..28 "X" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@35..36 "B" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@36..37 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@37..39 "X" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsNumberType { + number_token: NUMBER_KW@47..54 "number" [] [Whitespace(" ")], + }, + PIPE@54..56 "|" [] [Whitespace(" ")], + TsStringType { + string_token: STRING_KW@56..62 "string" [] [], + }, + ], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@62..64 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@64..66 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@68..69 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@69..71 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@71..73 "X" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: TS_TYPE_ALIAS_DECLARATION@0..29 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..6 + 0: IDENT@5..6 "A" [] [] + 2: TS_TYPE_PARAMETERS@6..25 + 0: L_ANGLE@6..7 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@7..23 + 0: TS_TYPE_PARAMETER@7..23 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 + 1: TS_TYPE_PARAMETER_NAME@7..9 + 0: IDENT@7..9 "X" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@9..23 + 0: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@17..23 + 0: NUMBER_KW@17..23 "number" [] [] + 3: (empty) + 2: R_ANGLE@23..25 ">" [] [Whitespace(" ")] + 3: EQ@25..27 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@27..28 + 0: JS_REFERENCE_IDENTIFIER@27..28 + 0: IDENT@27..28 "X" [] [] + 1: (empty) + 5: SEMICOLON@28..29 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@29..74 + 0: TYPE_KW@29..35 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@35..36 + 0: IDENT@35..36 "B" [] [] + 2: TS_TYPE_PARAMETERS@36..64 + 0: L_ANGLE@36..37 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@37..62 + 0: TS_TYPE_PARAMETER@37..62 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@37..37 + 1: TS_TYPE_PARAMETER_NAME@37..39 + 0: IDENT@37..39 "X" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@39..62 + 0: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@47..62 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@47..62 + 0: TS_NUMBER_TYPE@47..54 + 0: NUMBER_KW@47..54 "number" [] [Whitespace(" ")] + 1: PIPE@54..56 "|" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@56..62 + 0: STRING_KW@56..62 "string" [] [] + 3: (empty) + 2: R_ANGLE@62..64 ">" [] [Whitespace(" ")] + 3: EQ@64..66 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@66..74 + 0: L_CURLY@66..68 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@68..73 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@68..73 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@68..69 + 0: IDENT@68..69 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@69..73 + 0: COLON@69..71 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@71..73 + 0: JS_REFERENCE_IDENTIFIER@71..73 + 0: IDENT@71..73 "X" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 2: R_CURLY@73..74 "}" [] [] + 5: (empty) + 4: EOF@74..75 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap new file mode 100644 index 000000000000..93df461eb79e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap @@ -0,0 +1,75 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type StringBox = Box; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..15 "StringBox" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@15..17 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@17..20 "Box" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@20..21 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@21..27 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@27..28 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + ], + eof_token: EOF@29..30 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..30 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..29 + 0: TS_TYPE_ALIAS_DECLARATION@0..29 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..15 + 0: IDENT@5..15 "StringBox" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@15..17 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@17..28 + 0: JS_REFERENCE_IDENTIFIER@17..20 + 0: IDENT@17..20 "Box" [] [] + 1: TS_TYPE_ARGUMENTS@20..28 + 0: L_ANGLE@20..21 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@21..27 + 0: TS_STRING_TYPE@21..27 + 0: STRING_KW@21..27 "string" [] [] + 2: R_ANGLE@27..28 ">" [] [] + 5: SEMICOLON@28..29 ";" [] [] + 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_operator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts.snap new file mode 100644 index 000000000000..61d38b343c86 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts.snap @@ -0,0 +1,244 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { x: string, y: number }; +type B = keyof A; +type C = readonly string[]; +const d: unique symbol = Symbol(); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@9..11 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@11..12 "x" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@12..14 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@14..20 "string" [] [], + }, + }, + separator_token: COMMA@20..22 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@22..23 "y" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@23..25 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@25..32 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@32..33 "}" [] [], + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@40..42 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@42..44 "=" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: KEYOF_KW@44..50 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@50..51 "A" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@51..52 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@52..58 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@58..60 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@60..62 "=" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsStringType { + string_token: STRING_KW@71..77 "string" [] [], + }, + l_brack_token: L_BRACK@77..78 "[" [] [], + r_brack_token: R_BRACK@78..79 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@79..80 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@80..87 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@87..88 "d" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@88..90 ":" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: UNIQUE_KW@90..97 "unique" [] [Whitespace(" ")], + ty: TsSymbolType { + symbol_token: SYMBOL_KW@97..104 "symbol" [] [Whitespace(" ")], + }, + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@104..106 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@106..112 "Symbol" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@112..113 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@113..114 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + ], + eof_token: EOF@115..116 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..116 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..115 + 0: TS_TYPE_ALIAS_DECLARATION@0..34 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@9..33 + 0: L_CURLY@9..11 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@11..32 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@11..22 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@11..12 + 0: IDENT@11..12 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@12..20 + 0: COLON@12..14 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@14..20 + 0: STRING_KW@14..20 "string" [] [] + 4: COMMA@20..22 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@22..32 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@22..23 + 0: IDENT@22..23 "y" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@23..32 + 0: COLON@23..25 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@25..32 + 0: NUMBER_KW@25..32 "number" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@32..33 "}" [] [] + 5: SEMICOLON@33..34 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@34..52 + 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@42..44 "=" [] [Whitespace(" ")] + 4: TS_TYPE_OPERATOR_TYPE@44..51 + 0: KEYOF_KW@44..50 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@50..51 + 0: JS_REFERENCE_IDENTIFIER@50..51 + 0: IDENT@50..51 "A" [] [] + 1: (empty) + 5: SEMICOLON@51..52 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@52..80 + 0: TYPE_KW@52..58 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@58..60 + 0: IDENT@58..60 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@60..62 "=" [] [Whitespace(" ")] + 4: TS_TYPE_OPERATOR_TYPE@62..79 + 0: READONLY_KW@62..71 "readonly" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@71..79 + 0: TS_STRING_TYPE@71..77 + 0: STRING_KW@71..77 "string" [] [] + 1: L_BRACK@77..78 "[" [] [] + 2: R_BRACK@78..79 "]" [] [] + 5: SEMICOLON@79..80 ";" [] [] + 3: JS_VARIABLE_STATEMENT@80..115 + 0: JS_VARIABLE_DECLARATION@80..114 + 0: (empty) + 1: CONST_KW@80..87 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@87..114 + 0: JS_VARIABLE_DECLARATOR@87..114 + 0: JS_IDENTIFIER_BINDING@87..88 + 0: IDENT@87..88 "d" [] [] + 1: TS_TYPE_ANNOTATION@88..104 + 0: COLON@88..90 ":" [] [Whitespace(" ")] + 1: TS_TYPE_OPERATOR_TYPE@90..104 + 0: UNIQUE_KW@90..97 "unique" [] [Whitespace(" ")] + 1: TS_SYMBOL_TYPE@97..104 + 0: SYMBOL_KW@97..104 "symbol" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@104..114 + 0: EQ@104..106 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@106..114 + 0: JS_IDENTIFIER_EXPRESSION@106..112 + 0: JS_REFERENCE_IDENTIFIER@106..112 + 0: IDENT@106..112 "Symbol" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@112..114 + 0: L_PAREN@112..113 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@113..113 + 2: R_PAREN@113..114 ")" [] [] + 1: SEMICOLON@114..115 ";" [] [] + 4: EOF@115..116 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts.snap new file mode 100644 index 000000000000..71c18a2bf4f4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts.snap @@ -0,0 +1,311 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { x: X, y: Y, z: Z } +type A<> = {} +interface A<> {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..6 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@6..7 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@7..9 "X" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@17..23 "string" [] [], + }, + }, + default: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@25..27 "Y" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: TsDefaultTypeClause { + eq_token: EQ@27..29 "=" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@29..35 "number" [] [], + }, + }, + }, + COMMA@35..37 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@37..39 "Z" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@47..54 "string" [] [Whitespace(" ")], + }, + PIPE@54..56 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@56..63 "number" [] [Whitespace(" ")], + }, + ], + }, + }, + default: TsDefaultTypeClause { + eq_token: EQ@63..65 "=" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@65..71 "number" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@71..73 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@75..77 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@77..78 "x" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@78..80 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@80..81 "X" [] [], + }, + type_arguments: missing (optional), + }, + }, + separator_token: COMMA@81..83 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@83..84 "y" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@84..86 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@86..87 "Y" [] [], + }, + type_arguments: missing (optional), + }, + }, + separator_token: COMMA@87..89 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@89..90 "z" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@90..92 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@92..94 "Z" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@94..95 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@101..102 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@102..103 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@103..105 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@105..107 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@107..108 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@108..109 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@109..120 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@120..121 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@121..122 "<" [] [], + items: TsTypeParameterList [], + r_angle_token: R_ANGLE@122..124 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@124..125 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@125..126 "}" [] [], + }, + ], + eof_token: EOF@126..127 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..127 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..126 + 0: TS_TYPE_ALIAS_DECLARATION@0..95 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..6 + 0: IDENT@5..6 "A" [] [] + 2: TS_TYPE_PARAMETERS@6..73 + 0: L_ANGLE@6..7 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@7..71 + 0: TS_TYPE_PARAMETER@7..23 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@7..7 + 1: TS_TYPE_PARAMETER_NAME@7..9 + 0: IDENT@7..9 "X" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@9..23 + 0: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@17..23 + 0: STRING_KW@17..23 "string" [] [] + 3: (empty) + 1: COMMA@23..25 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@25..35 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@25..25 + 1: TS_TYPE_PARAMETER_NAME@25..27 + 0: IDENT@25..27 "Y" [] [Whitespace(" ")] + 2: (empty) + 3: TS_DEFAULT_TYPE_CLAUSE@27..35 + 0: EQ@27..29 "=" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@29..35 + 0: NUMBER_KW@29..35 "number" [] [] + 3: COMMA@35..37 "," [] [Whitespace(" ")] + 4: TS_TYPE_PARAMETER@37..71 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@37..37 + 1: TS_TYPE_PARAMETER_NAME@37..39 + 0: IDENT@37..39 "Z" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@39..63 + 0: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")] + 1: TS_UNION_TYPE@47..63 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@47..63 + 0: TS_STRING_TYPE@47..54 + 0: STRING_KW@47..54 "string" [] [Whitespace(" ")] + 1: PIPE@54..56 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@56..63 + 0: NUMBER_KW@56..63 "number" [] [Whitespace(" ")] + 3: TS_DEFAULT_TYPE_CLAUSE@63..71 + 0: EQ@63..65 "=" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@65..71 + 0: NUMBER_KW@65..71 "number" [] [] + 2: R_ANGLE@71..73 ">" [] [Whitespace(" ")] + 3: EQ@73..75 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@75..95 + 0: L_CURLY@75..77 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@77..94 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@77..83 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@77..78 + 0: IDENT@77..78 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@78..81 + 0: COLON@78..80 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@80..81 + 0: JS_REFERENCE_IDENTIFIER@80..81 + 0: IDENT@80..81 "X" [] [] + 1: (empty) + 4: COMMA@81..83 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@83..89 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@83..84 + 0: IDENT@83..84 "y" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@84..87 + 0: COLON@84..86 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@86..87 + 0: JS_REFERENCE_IDENTIFIER@86..87 + 0: IDENT@86..87 "Y" [] [] + 1: (empty) + 4: COMMA@87..89 "," [] [Whitespace(" ")] + 2: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@89..94 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@89..90 + 0: IDENT@89..90 "z" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@90..94 + 0: COLON@90..92 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@92..94 + 0: JS_REFERENCE_IDENTIFIER@92..94 + 0: IDENT@92..94 "Z" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 2: R_CURLY@94..95 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@95..109 + 0: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@101..102 + 0: IDENT@101..102 "A" [] [] + 2: TS_TYPE_PARAMETERS@102..105 + 0: L_ANGLE@102..103 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@103..103 + 2: R_ANGLE@103..105 ">" [] [Whitespace(" ")] + 3: EQ@105..107 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@107..109 + 0: L_CURLY@107..108 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@108..108 + 2: R_CURLY@108..109 "}" [] [] + 5: (empty) + 2: TS_INTERFACE_DECLARATION@109..126 + 0: INTERFACE_KW@109..120 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@120..121 + 0: IDENT@120..121 "A" [] [] + 2: TS_TYPE_PARAMETERS@121..124 + 0: L_ANGLE@121..122 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@122..122 + 2: R_ANGLE@122..124 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@124..125 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@125..125 + 6: R_CURLY@125..126 "}" [] [] + 4: EOF@126..127 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts.snap new file mode 100644 index 000000000000..ab1fddac4a3e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts.snap @@ -0,0 +1,297 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = (a) => a is string; +type B = (a) => asserts a is string; +type C = (a) => asserts a; +type asserts = string; +type D = () => asserts; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@9..10 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@10..11 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")], + return_type: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@16..18 "a" [] [Whitespace(" ")], + }, + is_token: IS_KW@18..21 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@21..27 "string" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@27..28 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@34..36 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@36..38 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@39..40 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@40..42 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")], + return_type: TsAssertsReturnType { + asserts_token: ASSERTS_KW@45..53 "asserts" [] [Whitespace(" ")], + parameter_name: JsReferenceIdentifier { + value_token: IDENT@53..55 "a" [] [Whitespace(" ")], + }, + predicate: TsAssertsCondition { + is_token: IS_KW@55..58 "is" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@58..64 "string" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@64..65 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@71..73 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@75..76 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@76..77 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@77..79 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")], + return_type: TsAssertsReturnType { + asserts_token: ASSERTS_KW@82..90 "asserts" [] [Whitespace(" ")], + parameter_name: JsReferenceIdentifier { + value_token: IDENT@90..91 "a" [] [], + }, + predicate: missing (optional), + }, + }, + semicolon_token: SEMICOLON@91..92 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@92..98 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@98..106 "asserts" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@106..108 "=" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@108..114 "string" [] [], + }, + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@121..123 "D" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@123..125 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@125..126 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@126..128 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@128..131 "=>" [] [Whitespace(" ")], + return_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@131..138 "asserts" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@138..139 ";" [] [], + }, + ], + eof_token: EOF@139..140 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..140 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..139 + 0: TS_TYPE_ALIAS_DECLARATION@0..28 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@9..27 + 0: (empty) + 1: JS_PARAMETERS@9..13 + 0: L_PAREN@9..10 "(" [] [] + 1: JS_PARAMETER_LIST@10..11 + 0: JS_FORMAL_PARAMETER@10..11 + 0: JS_DECORATOR_LIST@10..10 + 1: JS_IDENTIFIER_BINDING@10..11 + 0: IDENT@10..11 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@13..16 "=>" [] [Whitespace(" ")] + 3: TS_PREDICATE_RETURN_TYPE@16..27 + 0: JS_REFERENCE_IDENTIFIER@16..18 + 0: IDENT@16..18 "a" [] [Whitespace(" ")] + 1: IS_KW@18..21 "is" [] [Whitespace(" ")] + 2: TS_STRING_TYPE@21..27 + 0: STRING_KW@21..27 "string" [] [] + 5: SEMICOLON@27..28 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@28..65 + 0: TYPE_KW@28..34 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@34..36 + 0: IDENT@34..36 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@36..38 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@38..64 + 0: (empty) + 1: JS_PARAMETERS@38..42 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..40 + 0: JS_FORMAL_PARAMETER@39..40 + 0: JS_DECORATOR_LIST@39..39 + 1: JS_IDENTIFIER_BINDING@39..40 + 0: IDENT@39..40 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@40..42 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@42..45 "=>" [] [Whitespace(" ")] + 3: TS_ASSERTS_RETURN_TYPE@45..64 + 0: ASSERTS_KW@45..53 "asserts" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@53..55 + 0: IDENT@53..55 "a" [] [Whitespace(" ")] + 2: TS_ASSERTS_CONDITION@55..64 + 0: IS_KW@55..58 "is" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@58..64 + 0: STRING_KW@58..64 "string" [] [] + 5: SEMICOLON@64..65 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@65..92 + 0: TYPE_KW@65..71 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@73..75 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@75..91 + 0: (empty) + 1: JS_PARAMETERS@75..79 + 0: L_PAREN@75..76 "(" [] [] + 1: JS_PARAMETER_LIST@76..77 + 0: JS_FORMAL_PARAMETER@76..77 + 0: JS_DECORATOR_LIST@76..76 + 1: JS_IDENTIFIER_BINDING@76..77 + 0: IDENT@76..77 "a" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@77..79 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@79..82 "=>" [] [Whitespace(" ")] + 3: TS_ASSERTS_RETURN_TYPE@82..91 + 0: ASSERTS_KW@82..90 "asserts" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@90..91 + 0: IDENT@90..91 "a" [] [] + 2: (empty) + 5: SEMICOLON@91..92 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@92..115 + 0: TYPE_KW@92..98 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@98..106 + 0: IDENT@98..106 "asserts" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@106..108 "=" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@108..114 + 0: STRING_KW@108..114 "string" [] [] + 5: SEMICOLON@114..115 ";" [] [] + 4: TS_TYPE_ALIAS_DECLARATION@115..139 + 0: TYPE_KW@115..121 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@121..123 + 0: IDENT@121..123 "D" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@123..125 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@125..138 + 0: (empty) + 1: JS_PARAMETERS@125..128 + 0: L_PAREN@125..126 "(" [] [] + 1: JS_PARAMETER_LIST@126..126 + 2: R_PAREN@126..128 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@128..131 "=>" [] [Whitespace(" ")] + 3: TS_REFERENCE_TYPE@131..138 + 0: JS_REFERENCE_IDENTIFIER@131..138 + 0: IDENT@131..138 "asserts" [] [] + 1: (empty) + 5: SEMICOLON@138..139 ";" [] [] + 4: EOF@139..140 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_variable.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts.snap new file mode 100644 index 000000000000..87114089bf9f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts.snap @@ -0,0 +1,152 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let type; +type = getFlowTypeInConstructor(symbol, getDeclaringConstructor(symbol)!); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..8 "type" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@8..9 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@9..15 "type" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@15..17 "=" [] [Whitespace(" ")], + right: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..41 "getFlowTypeInConstructor" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@41..42 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@42..48 "symbol" [] [], + }, + }, + COMMA@48..50 "," [] [Whitespace(" ")], + TsNonNullAssertionExpression { + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@50..73 "getDeclaringConstructor" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@73..74 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..80 "symbol" [] [], + }, + }, + ], + r_paren_token: R_PAREN@80..81 ")" [] [], + }, + }, + excl_token: BANG@81..82 "!" [] [], + }, + ], + r_paren_token: R_PAREN@82..83 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@83..84 ";" [] [], + }, + ], + eof_token: EOF@84..85 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..85 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..84 + 0: JS_VARIABLE_STATEMENT@0..9 + 0: JS_VARIABLE_DECLARATION@0..8 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..8 + 0: JS_VARIABLE_DECLARATOR@4..8 + 0: JS_IDENTIFIER_BINDING@4..8 + 0: IDENT@4..8 "type" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@8..9 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@9..84 + 0: JS_ASSIGNMENT_EXPRESSION@9..83 + 0: JS_IDENTIFIER_ASSIGNMENT@9..15 + 0: IDENT@9..15 "type" [Newline("\n")] [Whitespace(" ")] + 1: EQ@15..17 "=" [] [Whitespace(" ")] + 2: JS_CALL_EXPRESSION@17..83 + 0: JS_IDENTIFIER_EXPRESSION@17..41 + 0: JS_REFERENCE_IDENTIFIER@17..41 + 0: IDENT@17..41 "getFlowTypeInConstructor" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@41..83 + 0: L_PAREN@41..42 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@42..82 + 0: JS_IDENTIFIER_EXPRESSION@42..48 + 0: JS_REFERENCE_IDENTIFIER@42..48 + 0: IDENT@42..48 "symbol" [] [] + 1: COMMA@48..50 "," [] [Whitespace(" ")] + 2: TS_NON_NULL_ASSERTION_EXPRESSION@50..82 + 0: JS_CALL_EXPRESSION@50..81 + 0: JS_IDENTIFIER_EXPRESSION@50..73 + 0: JS_REFERENCE_IDENTIFIER@50..73 + 0: IDENT@50..73 "getDeclaringConstructor" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@73..81 + 0: L_PAREN@73..74 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@74..80 + 0: JS_IDENTIFIER_EXPRESSION@74..80 + 0: JS_REFERENCE_IDENTIFIER@74..80 + 0: IDENT@74..80 "symbol" [] [] + 2: R_PAREN@80..81 ")" [] [] + 1: BANG@81..82 "!" [] [] + 2: R_PAREN@82..83 ")" [] [] + 1: SEMICOLON@83..84 ";" [] [] + 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap new file mode 100644 index 000000000000..238779614f71 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap @@ -0,0 +1,183 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: string = "test", b!: number; +let a // ASI +!function test() {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..5 "a" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@5..7 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@7..14 "string" [] [Whitespace(" ")], + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@14..16 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@16..22 "\"test\"" [] [], + }, + }, + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@24..25 "b" [] [], + }, + variable_annotation: TsDefiniteVariableAnnotation { + excl_token: BANG@25..26 "!" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@26..28 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@28..34 "number" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@40..48 "a" [] [Whitespace(" "), Comments("// ASI")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: BANG@48..50 "!" [Newline("\n")] [], + argument: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@50..59 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@59..63 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@63..64 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@64..66 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@66..67 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..68 + 0: JS_VARIABLE_STATEMENT@0..35 + 0: JS_VARIABLE_DECLARATION@0..34 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..34 + 0: JS_VARIABLE_DECLARATOR@4..22 + 0: JS_IDENTIFIER_BINDING@4..5 + 0: IDENT@4..5 "a" [] [] + 1: TS_TYPE_ANNOTATION@5..14 + 0: COLON@5..7 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@7..14 + 0: STRING_KW@7..14 "string" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@14..22 + 0: EQ@14..16 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@16..22 + 0: JS_STRING_LITERAL@16..22 "\"test\"" [] [] + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@24..34 + 0: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "b" [] [] + 1: TS_DEFINITE_VARIABLE_ANNOTATION@25..34 + 0: BANG@25..26 "!" [] [] + 1: TS_TYPE_ANNOTATION@26..34 + 0: COLON@26..28 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@28..34 + 0: NUMBER_KW@28..34 "number" [] [] + 2: (empty) + 1: SEMICOLON@34..35 ";" [] [] + 1: JS_VARIABLE_STATEMENT@35..48 + 0: JS_VARIABLE_DECLARATION@35..48 + 0: (empty) + 1: LET_KW@35..40 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@40..48 + 0: JS_VARIABLE_DECLARATOR@40..48 + 0: JS_IDENTIFIER_BINDING@40..48 + 0: IDENT@40..48 "a" [] [Whitespace(" "), Comments("// ASI")] + 1: (empty) + 2: (empty) + 1: (empty) + 2: JS_EXPRESSION_STATEMENT@48..68 + 0: JS_UNARY_EXPRESSION@48..68 + 0: BANG@48..50 "!" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@50..68 + 0: (empty) + 1: FUNCTION_KW@50..59 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@59..63 + 0: IDENT@59..63 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@63..66 + 0: L_PAREN@63..64 "(" [] [] + 1: JS_PARAMETER_LIST@64..64 + 2: R_PAREN@64..66 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@66..68 + 0: L_CURLY@66..67 "{" [] [] + 1: JS_DIRECTIVE_LIST@67..67 + 2: JS_STATEMENT_LIST@67..67 + 3: R_CURLY@67..68 "}" [] [] + 1: (empty) + 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts.snap new file mode 100644 index 000000000000..8239c1c536eb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts.snap @@ -0,0 +1,229 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = "test"; +type B = typeof a; +type T21 = typeof Array; +type A = InstanceType>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@8..14 "\"test\"" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@21..23 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@23..25 "=" [] [Whitespace(" ")], + ty: TsTypeofType { + typeof_token: TYPEOF_KW@25..32 "typeof" [] [Whitespace(" ")], + expression_name: JsReferenceIdentifier { + value_token: IDENT@32..33 "a" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@40..44 "T21" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@44..46 "=" [] [Whitespace(" ")], + ty: TsTypeofType { + typeof_token: TYPEOF_KW@46..53 "typeof" [] [Whitespace(" ")], + expression_name: JsReferenceIdentifier { + value_token: IDENT@53..58 "Array" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@58..59 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsStringType { + string_token: STRING_KW@59..65 "string" [] [], + }, + ], + r_angle_token: R_ANGLE@65..66 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@66..67 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@67..73 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@73..74 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@74..75 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@75..76 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@76..78 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@78..80 "=" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@80..92 "InstanceType" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@92..93 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsTypeofType { + typeof_token: TYPEOF_KW@93..100 "typeof" [] [Whitespace(" ")], + expression_name: JsReferenceIdentifier { + value_token: IDENT@100..105 "Array" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@105..106 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@106..107 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@107..108 ">" [] [], + }, + }, + ], + r_angle_token: R_ANGLE@108..109 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@109..110 ";" [] [], + }, + ], + eof_token: EOF@110..111 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..111 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..110 + 0: JS_VARIABLE_STATEMENT@0..15 + 0: JS_VARIABLE_DECLARATION@0..14 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..14 + 0: JS_VARIABLE_DECLARATOR@4..14 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..14 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@8..14 + 0: JS_STRING_LITERAL@8..14 "\"test\"" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@15..34 + 0: TYPE_KW@15..21 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@21..23 + 0: IDENT@21..23 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@23..25 "=" [] [Whitespace(" ")] + 4: TS_TYPEOF_TYPE@25..33 + 0: TYPEOF_KW@25..32 "typeof" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@32..33 + 0: IDENT@32..33 "a" [] [] + 2: (empty) + 5: SEMICOLON@33..34 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@34..67 + 0: TYPE_KW@34..40 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@40..44 + 0: IDENT@40..44 "T21" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@44..46 "=" [] [Whitespace(" ")] + 4: TS_TYPEOF_TYPE@46..66 + 0: TYPEOF_KW@46..53 "typeof" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@53..58 + 0: IDENT@53..58 "Array" [] [] + 2: TS_TYPE_ARGUMENTS@58..66 + 0: L_ANGLE@58..59 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@59..65 + 0: TS_STRING_TYPE@59..65 + 0: STRING_KW@59..65 "string" [] [] + 2: R_ANGLE@65..66 ">" [] [] + 5: SEMICOLON@66..67 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@67..110 + 0: TYPE_KW@67..73 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@73..74 + 0: IDENT@73..74 "A" [] [] + 2: TS_TYPE_PARAMETERS@74..78 + 0: L_ANGLE@74..75 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@75..76 + 0: TS_TYPE_PARAMETER@75..76 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@75..75 + 1: TS_TYPE_PARAMETER_NAME@75..76 + 0: IDENT@75..76 "U" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@76..78 ">" [] [Whitespace(" ")] + 3: EQ@78..80 "=" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@80..109 + 0: JS_REFERENCE_IDENTIFIER@80..92 + 0: IDENT@80..92 "InstanceType" [] [] + 1: TS_TYPE_ARGUMENTS@92..109 + 0: L_ANGLE@92..93 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@93..108 + 0: TS_TYPEOF_TYPE@93..108 + 0: TYPEOF_KW@93..100 "typeof" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@100..105 + 0: IDENT@100..105 "Array" [] [] + 2: TS_TYPE_ARGUMENTS@105..108 + 0: L_ANGLE@105..106 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@106..107 + 0: TS_REFERENCE_TYPE@106..107 + 0: JS_REFERENCE_IDENTIFIER@106..107 + 0: IDENT@106..107 "U" [] [] + 1: (empty) + 2: R_ANGLE@107..108 ">" [] [] + 2: R_ANGLE@108..109 ">" [] [] + 5: SEMICOLON@109..110 ";" [] [] + 4: EOF@110..111 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx.snap new file mode 100644 index 000000000000..e75465e502d6 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +type X = typeof Array +
a
; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "X" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsTypeofType { + typeof_token: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")], + expression_name: JsReferenceIdentifier { + value_token: IDENT@16..21 "Array" [] [], + }, + type_arguments: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@21..23 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@23..26 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@26..27 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@27..28 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@28..29 "<" [] [], + slash_token: SLASH@29..30 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@30..33 "div" [] [], + }, + r_angle_token: R_ANGLE@33..34 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@34..35 ";" [] [], + }, + ], + eof_token: EOF@35..36 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..36 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..35 + 0: TS_TYPE_ALIAS_DECLARATION@0..21 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "X" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_TYPEOF_TYPE@9..21 + 0: TYPEOF_KW@9..16 "typeof" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@16..21 + 0: IDENT@16..21 "Array" [] [] + 2: (empty) + 5: (empty) + 1: JS_EXPRESSION_STATEMENT@21..35 + 0: JSX_TAG_EXPRESSION@21..34 + 0: JSX_ELEMENT@21..34 + 0: JSX_OPENING_ELEMENT@21..27 + 0: L_ANGLE@21..23 "<" [Newline("\n")] [] + 1: JSX_NAME@23..26 + 0: JSX_IDENT@23..26 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@26..26 + 4: R_ANGLE@26..27 ">" [] [] + 1: JSX_CHILD_LIST@27..28 + 0: JSX_TEXT@27..28 + 0: JSX_TEXT_LITERAL@27..28 "a" [] [] + 2: JSX_CLOSING_ELEMENT@28..34 + 0: L_ANGLE@28..29 "<" [] [] + 1: SLASH@29..30 "/" [] [] + 2: JSX_NAME@30..33 + 0: JSX_IDENT@30..33 "div" [] [] + 3: R_ANGLE@33..34 ">" [] [] + 1: SEMICOLON@34..35 ";" [] [] + 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_union_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_union_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts.snap new file mode 100644 index 000000000000..39c8f3d7847c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts.snap @@ -0,0 +1,188 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string | number; +type B = | A | void | null; +type C = A & C | C; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@9..16 "string" [] [Whitespace(" ")], + }, + PIPE@16..18 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@18..24 "number" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@24..25 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@31..33 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: PIPE@35..37 "|" [] [Whitespace(" ")], + types: TsUnionTypeVariantList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@37..39 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + PIPE@39..41 "|" [] [Whitespace(" ")], + TsVoidType { + void_token: VOID_KW@41..46 "void" [] [Whitespace(" ")], + }, + PIPE@46..48 "|" [] [Whitespace(" ")], + TsNullLiteralType { + literal_token: NULL_KW@48..52 "null" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@52..53 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@53..59 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@59..61 "C" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@61..63 "=" [] [Whitespace(" ")], + ty: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsIntersectionType { + leading_separator_token: missing (optional), + types: TsIntersectionTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@63..65 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + AMP@65..67 "&" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@67..69 "C" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + PIPE@69..71 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@71..72 "C" [] [], + }, + type_arguments: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@72..73 ";" [] [], + }, + ], + eof_token: EOF@73..74 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..74 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..73 + 0: TS_TYPE_ALIAS_DECLARATION@0..25 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_UNION_TYPE@9..24 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@9..24 + 0: TS_STRING_TYPE@9..16 + 0: STRING_KW@9..16 "string" [] [Whitespace(" ")] + 1: PIPE@16..18 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@18..24 + 0: NUMBER_KW@18..24 "number" [] [] + 5: SEMICOLON@24..25 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@25..53 + 0: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@31..33 + 0: IDENT@31..33 "B" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@33..35 "=" [] [Whitespace(" ")] + 4: TS_UNION_TYPE@35..52 + 0: PIPE@35..37 "|" [] [Whitespace(" ")] + 1: TS_UNION_TYPE_VARIANT_LIST@37..52 + 0: TS_REFERENCE_TYPE@37..39 + 0: JS_REFERENCE_IDENTIFIER@37..39 + 0: IDENT@37..39 "A" [] [Whitespace(" ")] + 1: (empty) + 1: PIPE@39..41 "|" [] [Whitespace(" ")] + 2: TS_VOID_TYPE@41..46 + 0: VOID_KW@41..46 "void" [] [Whitespace(" ")] + 3: PIPE@46..48 "|" [] [Whitespace(" ")] + 4: TS_NULL_LITERAL_TYPE@48..52 + 0: NULL_KW@48..52 "null" [] [] + 5: SEMICOLON@52..53 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@53..73 + 0: TYPE_KW@53..59 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@59..61 + 0: IDENT@59..61 "C" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@61..63 "=" [] [Whitespace(" ")] + 4: TS_UNION_TYPE@63..72 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@63..72 + 0: TS_INTERSECTION_TYPE@63..69 + 0: (empty) + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@63..69 + 0: TS_REFERENCE_TYPE@63..65 + 0: JS_REFERENCE_IDENTIFIER@63..65 + 0: IDENT@63..65 "A" [] [Whitespace(" ")] + 1: (empty) + 1: AMP@65..67 "&" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@67..69 + 0: JS_REFERENCE_IDENTIFIER@67..69 + 0: IDENT@67..69 "C" [] [Whitespace(" ")] + 1: (empty) + 1: PIPE@69..71 "|" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@71..72 + 0: JS_REFERENCE_IDENTIFIER@71..72 + 0: IDENT@71..72 "C" [] [] + 1: (empty) + 5: SEMICOLON@72..73 ";" [] [] + 4: EOF@73..74 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap new file mode 100644 index 000000000000..c8a5654d1d46 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap @@ -0,0 +1,159 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +; + />; +>; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@1..12 "NonGeneric" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + slash_token: SLASH@12..13 "/" [] [], + r_angle_token: R_ANGLE@13..14 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxSelfClosingElement { + l_angle_token: L_ANGLE@15..17 "<" [Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@17..24 "Generic" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@24..25 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@25..29 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@29..31 ">" [] [Whitespace(" ")], + }, + attributes: JsxAttributeList [], + slash_token: SLASH@31..32 "/" [] [], + r_angle_token: R_ANGLE@32..33 ">" [] [], + }, + }, + semicolon_token: SEMICOLON@33..34 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@34..36 "<" [Newline("\n")] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@36..43 "Generic" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@43..44 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsBooleanLiteralType { + literal: TRUE_KW@44..48 "true" [] [], + }, + ], + r_angle_token: R_ANGLE@48..49 ">" [] [], + }, + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@49..50 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@50..51 "<" [] [], + slash_token: SLASH@51..52 "/" [] [], + name: JsxReferenceIdentifier { + value_token: JSX_IDENT@52..59 "Generic" [] [], + }, + r_angle_token: R_ANGLE@59..60 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + ], + eof_token: EOF@61..62 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..62 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..61 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JSX_TAG_EXPRESSION@0..14 + 0: JSX_SELF_CLOSING_ELEMENT@0..14 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_REFERENCE_IDENTIFIER@1..12 + 0: JSX_IDENT@1..12 "NonGeneric" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@12..12 + 4: SLASH@12..13 "/" [] [] + 5: R_ANGLE@13..14 ">" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@15..34 + 0: JSX_TAG_EXPRESSION@15..33 + 0: JSX_SELF_CLOSING_ELEMENT@15..33 + 0: L_ANGLE@15..17 "<" [Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@17..24 + 0: JSX_IDENT@17..24 "Generic" [] [] + 2: TS_TYPE_ARGUMENTS@24..31 + 0: L_ANGLE@24..25 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@25..29 + 0: TS_BOOLEAN_LITERAL_TYPE@25..29 + 0: TRUE_KW@25..29 "true" [] [] + 2: R_ANGLE@29..31 ">" [] [Whitespace(" ")] + 3: JSX_ATTRIBUTE_LIST@31..31 + 4: SLASH@31..32 "/" [] [] + 5: R_ANGLE@32..33 ">" [] [] + 1: SEMICOLON@33..34 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@34..61 + 0: JSX_TAG_EXPRESSION@34..60 + 0: JSX_ELEMENT@34..60 + 0: JSX_OPENING_ELEMENT@34..50 + 0: L_ANGLE@34..36 "<" [Newline("\n")] [] + 1: JSX_REFERENCE_IDENTIFIER@36..43 + 0: JSX_IDENT@36..43 "Generic" [] [] + 2: TS_TYPE_ARGUMENTS@43..49 + 0: L_ANGLE@43..44 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@44..48 + 0: TS_BOOLEAN_LITERAL_TYPE@44..48 + 0: TRUE_KW@44..48 "true" [] [] + 2: R_ANGLE@48..49 ">" [] [] + 3: JSX_ATTRIBUTE_LIST@49..49 + 4: R_ANGLE@49..50 ">" [] [] + 1: JSX_CHILD_LIST@50..50 + 2: JSX_CLOSING_ELEMENT@50..60 + 0: L_ANGLE@50..51 "<" [] [] + 1: SLASH@51..52 "/" [] [] + 2: JSX_REFERENCE_IDENTIFIER@52..59 + 0: JSX_IDENT@52..59 "Generic" [] [] + 3: R_ANGLE@59..60 ">" [] [] + 1: SEMICOLON@60..61 ";" [] [] + 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx.snap new file mode 100644 index 000000000000..499308e2c3e0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx.snap @@ -0,0 +1,468 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +// These are valid type arguments +() => {}; +() => {}; +
() => {}; +() => {}; +() => {}; +>() => {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@0..35 "<" [Comments("// These are valid ty ..."), Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@35..36 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@36..37 "," [] [], + ], + r_angle_token: R_ANGLE@37..38 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@38..39 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@39..41 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@44..45 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@45..46 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@47..49 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@49..55 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@55..56 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@56..57 "," [] [], + ], + r_angle_token: R_ANGLE@57..58 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@58..59 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@59..61 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@61..64 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@64..65 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@65..66 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@66..67 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@67..69 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@69..71 "A" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@71..79 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@79..80 "B" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@80..81 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@81..82 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@87..88 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@88..89 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@89..90 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@90..92 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@92..93 "A" [] [], + }, + constraint: missing (optional), + default: TsDefaultTypeClause { + eq_token: EQ@93..94 "=" [] [], + ty: TsStringType { + string_token: STRING_KW@94..100 "string" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@100..101 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@101..102 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@102..104 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@107..108 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@108..109 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@109..110 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@110..112 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@112..113 "A" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@113..115 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@115..116 "B" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@116..117 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@117..118 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@118..120 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@120..123 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@123..124 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@124..125 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@125..126 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@126..128 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@128..130 "A" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@130..138 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@138..139 "B" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@139..140 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@140..141 "C" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@141..142 ">" [] [], + }, + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@142..143 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@143..144 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@144..146 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@146..149 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@149..150 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@150..151 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@151..152 ";" [] [], + }, + ], + eof_token: EOF@152..153 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..153 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..152 + 0: JS_EXPRESSION_STATEMENT@0..47 + 0: JS_ARROW_FUNCTION_EXPRESSION@0..46 + 0: (empty) + 1: TS_TYPE_PARAMETERS@0..38 + 0: L_ANGLE@0..35 "<" [Comments("// These are valid ty ..."), Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@35..37 + 0: TS_TYPE_PARAMETER@35..36 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@35..35 + 1: TS_TYPE_PARAMETER_NAME@35..36 + 0: IDENT@35..36 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@36..37 "," [] [] + 2: R_ANGLE@37..38 ">" [] [] + 2: JS_PARAMETERS@38..41 + 0: L_PAREN@38..39 "(" [] [] + 1: JS_PARAMETER_LIST@39..39 + 2: R_PAREN@39..41 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@41..44 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@44..46 + 0: L_CURLY@44..45 "{" [] [] + 1: JS_DIRECTIVE_LIST@45..45 + 2: JS_STATEMENT_LIST@45..45 + 3: R_CURLY@45..46 "}" [] [] + 1: SEMICOLON@46..47 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@47..67 + 0: JS_ARROW_FUNCTION_EXPRESSION@47..66 + 0: (empty) + 1: TS_TYPE_PARAMETERS@47..58 + 0: L_ANGLE@47..49 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@49..57 + 0: TS_TYPE_PARAMETER@49..56 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@49..55 + 0: TS_CONST_MODIFIER@49..55 + 0: CONST_KW@49..55 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@55..56 + 0: IDENT@55..56 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@56..57 "," [] [] + 2: R_ANGLE@57..58 ">" [] [] + 2: JS_PARAMETERS@58..61 + 0: L_PAREN@58..59 "(" [] [] + 1: JS_PARAMETER_LIST@59..59 + 2: R_PAREN@59..61 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@61..64 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@64..66 + 0: L_CURLY@64..65 "{" [] [] + 1: JS_DIRECTIVE_LIST@65..65 + 2: JS_STATEMENT_LIST@65..65 + 3: R_CURLY@65..66 "}" [] [] + 1: SEMICOLON@66..67 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@67..90 + 0: JS_ARROW_FUNCTION_EXPRESSION@67..89 + 0: (empty) + 1: TS_TYPE_PARAMETERS@67..81 + 0: L_ANGLE@67..69 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@69..80 + 0: TS_TYPE_PARAMETER@69..80 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@69..69 + 1: TS_TYPE_PARAMETER_NAME@69..71 + 0: IDENT@69..71 "A" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@71..80 + 0: EXTENDS_KW@71..79 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@79..80 + 0: JS_REFERENCE_IDENTIFIER@79..80 + 0: IDENT@79..80 "B" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@80..81 ">" [] [] + 2: JS_PARAMETERS@81..84 + 0: L_PAREN@81..82 "(" [] [] + 1: JS_PARAMETER_LIST@82..82 + 2: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@84..87 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@87..89 + 0: L_CURLY@87..88 "{" [] [] + 1: JS_DIRECTIVE_LIST@88..88 + 2: JS_STATEMENT_LIST@88..88 + 3: R_CURLY@88..89 "}" [] [] + 1: SEMICOLON@89..90 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@90..110 + 0: JS_ARROW_FUNCTION_EXPRESSION@90..109 + 0: (empty) + 1: TS_TYPE_PARAMETERS@90..101 + 0: L_ANGLE@90..92 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@92..100 + 0: TS_TYPE_PARAMETER@92..100 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@92..92 + 1: TS_TYPE_PARAMETER_NAME@92..93 + 0: IDENT@92..93 "A" [] [] + 2: (empty) + 3: TS_DEFAULT_TYPE_CLAUSE@93..100 + 0: EQ@93..94 "=" [] [] + 1: TS_STRING_TYPE@94..100 + 0: STRING_KW@94..100 "string" [] [] + 2: R_ANGLE@100..101 ">" [] [] + 2: JS_PARAMETERS@101..104 + 0: L_PAREN@101..102 "(" [] [] + 1: JS_PARAMETER_LIST@102..102 + 2: R_PAREN@102..104 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@104..107 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@107..109 + 0: L_CURLY@107..108 "{" [] [] + 1: JS_DIRECTIVE_LIST@108..108 + 2: JS_STATEMENT_LIST@108..108 + 3: R_CURLY@108..109 "}" [] [] + 1: SEMICOLON@109..110 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@110..126 + 0: JS_ARROW_FUNCTION_EXPRESSION@110..125 + 0: (empty) + 1: TS_TYPE_PARAMETERS@110..117 + 0: L_ANGLE@110..112 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@112..116 + 0: TS_TYPE_PARAMETER@112..113 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@112..112 + 1: TS_TYPE_PARAMETER_NAME@112..113 + 0: IDENT@112..113 "A" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@113..115 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@115..116 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@115..115 + 1: TS_TYPE_PARAMETER_NAME@115..116 + 0: IDENT@115..116 "B" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@116..117 ">" [] [] + 2: JS_PARAMETERS@117..120 + 0: L_PAREN@117..118 "(" [] [] + 1: JS_PARAMETER_LIST@118..118 + 2: R_PAREN@118..120 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@120..123 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@123..125 + 0: L_CURLY@123..124 "{" [] [] + 1: JS_DIRECTIVE_LIST@124..124 + 2: JS_STATEMENT_LIST@124..124 + 3: R_CURLY@124..125 "}" [] [] + 1: SEMICOLON@125..126 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@126..152 + 0: JS_ARROW_FUNCTION_EXPRESSION@126..151 + 0: (empty) + 1: TS_TYPE_PARAMETERS@126..143 + 0: L_ANGLE@126..128 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@128..142 + 0: TS_TYPE_PARAMETER@128..142 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@128..128 + 1: TS_TYPE_PARAMETER_NAME@128..130 + 0: IDENT@128..130 "A" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@130..142 + 0: EXTENDS_KW@130..138 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@138..142 + 0: JS_REFERENCE_IDENTIFIER@138..139 + 0: IDENT@138..139 "B" [] [] + 1: TS_TYPE_ARGUMENTS@139..142 + 0: L_ANGLE@139..140 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@140..141 + 0: TS_REFERENCE_TYPE@140..141 + 0: JS_REFERENCE_IDENTIFIER@140..141 + 0: IDENT@140..141 "C" [] [] + 1: (empty) + 2: R_ANGLE@141..142 ">" [] [] + 3: (empty) + 2: R_ANGLE@142..143 ">" [] [] + 2: JS_PARAMETERS@143..146 + 0: L_PAREN@143..144 "(" [] [] + 1: JS_PARAMETER_LIST@144..144 + 2: R_PAREN@144..146 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@146..149 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@149..151 + 0: L_CURLY@149..150 "{" [] [] + 1: JS_DIRECTIVE_LIST@150..150 + 2: JS_STATEMENT_LIST@150..150 + 3: R_CURLY@150..151 "}" [] [] + 1: SEMICOLON@151..152 ";" [] [] + 4: EOF@152..153 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js.snap new file mode 100644 index 000000000000..9422cc6b5635 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js.snap @@ -0,0 +1,87 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +((0)<5>(6)) + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@0..1 "(" [] [], + expression: JsBinaryExpression { + left: JsBinaryExpression { + left: JsParenthesizedExpression { + l_paren_token: L_PAREN@1..2 "(" [] [], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@2..3 "0" [] [], + }, + r_paren_token: R_PAREN@3..4 ")" [] [], + }, + operator_token: L_ANGLE@4..5 "<" [] [], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@5..6 "5" [] [], + }, + }, + operator_token: R_ANGLE@6..7 ">" [] [], + right: JsParenthesizedExpression { + l_paren_token: L_PAREN@7..8 "(" [] [], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@8..9 "6" [] [], + }, + r_paren_token: R_PAREN@9..10 ")" [] [], + }, + }, + r_paren_token: R_PAREN@10..11 ")" [] [], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@11..12 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..12 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..11 + 0: JS_EXPRESSION_STATEMENT@0..11 + 0: JS_PARENTHESIZED_EXPRESSION@0..11 + 0: L_PAREN@0..1 "(" [] [] + 1: JS_BINARY_EXPRESSION@1..10 + 0: JS_BINARY_EXPRESSION@1..6 + 0: JS_PARENTHESIZED_EXPRESSION@1..4 + 0: L_PAREN@1..2 "(" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@2..3 + 0: JS_NUMBER_LITERAL@2..3 "0" [] [] + 2: R_PAREN@3..4 ")" [] [] + 1: L_ANGLE@4..5 "<" [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@5..6 + 0: JS_NUMBER_LITERAL@5..6 "5" [] [] + 1: R_ANGLE@6..7 ">" [] [] + 2: JS_PARENTHESIZED_EXPRESSION@7..10 + 0: L_PAREN@7..8 "(" [] [] + 1: JS_NUMBER_LITERAL_EXPRESSION@8..9 + 0: JS_NUMBER_LITERAL@8..9 "6" [] [] + 2: R_PAREN@9..10 ")" [] [] + 2: R_PAREN@10..11 ")" [] [] + 1: (empty) + 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.ts b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap new file mode 100644 index 000000000000..3ff86b0a974e --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap @@ -0,0 +1,426 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +for (let i = 0 ; i < 3; ++i) { + verify.completions({ + marker: `${i + 1}`, + exact: [ + { name: "foo", replacementSpan: test.ranges()[i] }, + { name: "bar", replacementSpan: test.ranges()[i] }, + ] + }); +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@5..9 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@9..11 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@11..13 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")], + }, + }, + }, + ], + }, + first_semi_token: SEMICOLON@15..17 ";" [] [Whitespace(" ")], + test: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@17..19 "i" [] [Whitespace(" ")], + }, + }, + operator_token: L_ANGLE@19..21 "<" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@21..22 "3" [] [], + }, + }, + second_semi_token: SEMICOLON@22..24 ";" [] [Whitespace(" ")], + update: JsPreUpdateExpression { + operator_token: PLUS2@24..26 "++" [] [], + operand: JsIdentifierAssignment { + name_token: IDENT@26..27 "i" [] [], + }, + }, + r_paren_token: R_PAREN@27..29 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@29..30 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..41 "verify" [Newline("\n"), Whitespace(" ")] [], + }, + }, + operator_token: DOT@41..42 "." [] [], + member: JsName { + value_token: IDENT@42..53 "completions" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@53..54 "(" [] [], + args: JsCallArgumentList [ + JsObjectExpression { + l_curly_token: L_CURLY@54..55 "{" [] [], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@55..70 "marker" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@70..72 ":" [] [Whitespace(" ")], + value: JsTemplateExpression { + tag: missing (optional), + type_arguments: missing (optional), + l_tick_token: BACKTICK@72..73 "`" [] [], + elements: JsTemplateElementList [ + JsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@73..75 "${" [] [], + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@75..77 "i" [] [Whitespace(" ")], + }, + }, + operator_token: PLUS@77..79 "+" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@79..80 "1" [] [], + }, + }, + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + ], + r_tick_token: BACKTICK@81..82 "`" [] [], + }, + }, + COMMA@82..83 "," [] [], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@83..97 "exact" [Newline("\n"), Whitespace(" ")] [], + }, + colon_token: COLON@97..99 ":" [] [Whitespace(" ")], + value: JsArrayExpression { + l_brack_token: L_BRACK@99..100 "[" [] [], + elements: JsArrayElementList [ + JsObjectExpression { + l_curly_token: L_CURLY@100..115 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@115..119 "name" [] [], + }, + colon_token: COLON@119..121 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@121..126 "\"foo\"" [] [], + }, + }, + COMMA@126..128 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@128..143 "replacementSpan" [] [], + }, + colon_token: COLON@143..145 ":" [] [Whitespace(" ")], + value: JsComputedMemberExpression { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@145..149 "test" [] [], + }, + }, + operator_token: DOT@149..150 "." [] [], + member: JsName { + value_token: IDENT@150..156 "ranges" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@156..157 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@157..158 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@158..159 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@159..160 "i" [] [], + }, + }, + r_brack_token: R_BRACK@160..162 "]" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@162..163 "}" [] [], + }, + COMMA@163..164 "," [] [], + JsObjectExpression { + l_curly_token: L_CURLY@164..179 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@179..183 "name" [] [], + }, + colon_token: COLON@183..185 ":" [] [Whitespace(" ")], + value: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@185..190 "\"bar\"" [] [], + }, + }, + COMMA@190..192 "," [] [Whitespace(" ")], + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@192..207 "replacementSpan" [] [], + }, + colon_token: COLON@207..209 ":" [] [Whitespace(" ")], + value: JsComputedMemberExpression { + object: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@209..213 "test" [] [], + }, + }, + operator_token: DOT@213..214 "." [] [], + member: JsName { + value_token: IDENT@214..220 "ranges" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@220..221 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@221..222 ")" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@222..223 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@223..224 "i" [] [], + }, + }, + r_brack_token: R_BRACK@224..226 "]" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@226..227 "}" [] [], + }, + COMMA@227..228 "," [] [], + ], + r_brack_token: R_BRACK@228..238 "]" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@238..244 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_paren_token: R_PAREN@244..245 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@245..246 ";" [] [], + }, + ], + r_curly_token: R_CURLY@246..248 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@248..249 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..249 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..248 + 0: JS_FOR_STATEMENT@0..248 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: L_PAREN@4..5 "(" [] [] + 2: JS_VARIABLE_DECLARATION@5..15 + 0: (empty) + 1: LET_KW@5..9 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@9..15 + 0: JS_VARIABLE_DECLARATOR@9..15 + 0: JS_IDENTIFIER_BINDING@9..11 + 0: IDENT@9..11 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@11..15 + 0: EQ@11..13 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@13..15 + 0: JS_NUMBER_LITERAL@13..15 "0" [] [Whitespace(" ")] + 3: SEMICOLON@15..17 ";" [] [Whitespace(" ")] + 4: JS_BINARY_EXPRESSION@17..22 + 0: JS_IDENTIFIER_EXPRESSION@17..19 + 0: JS_REFERENCE_IDENTIFIER@17..19 + 0: IDENT@17..19 "i" [] [Whitespace(" ")] + 1: L_ANGLE@19..21 "<" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@21..22 + 0: JS_NUMBER_LITERAL@21..22 "3" [] [] + 5: SEMICOLON@22..24 ";" [] [Whitespace(" ")] + 6: JS_PRE_UPDATE_EXPRESSION@24..27 + 0: PLUS2@24..26 "++" [] [] + 1: JS_IDENTIFIER_ASSIGNMENT@26..27 + 0: IDENT@26..27 "i" [] [] + 7: R_PAREN@27..29 ")" [] [Whitespace(" ")] + 8: JS_BLOCK_STATEMENT@29..248 + 0: L_CURLY@29..30 "{" [] [] + 1: JS_STATEMENT_LIST@30..246 + 0: JS_EXPRESSION_STATEMENT@30..246 + 0: JS_CALL_EXPRESSION@30..245 + 0: JS_STATIC_MEMBER_EXPRESSION@30..53 + 0: JS_IDENTIFIER_EXPRESSION@30..41 + 0: JS_REFERENCE_IDENTIFIER@30..41 + 0: IDENT@30..41 "verify" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@41..42 "." [] [] + 2: JS_NAME@42..53 + 0: IDENT@42..53 "completions" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@53..245 + 0: L_PAREN@53..54 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@54..244 + 0: JS_OBJECT_EXPRESSION@54..244 + 0: L_CURLY@54..55 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@55..238 + 0: JS_PROPERTY_OBJECT_MEMBER@55..82 + 0: JS_LITERAL_MEMBER_NAME@55..70 + 0: IDENT@55..70 "marker" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@70..72 ":" [] [Whitespace(" ")] + 2: JS_TEMPLATE_EXPRESSION@72..82 + 0: (empty) + 1: (empty) + 2: BACKTICK@72..73 "`" [] [] + 3: JS_TEMPLATE_ELEMENT_LIST@73..81 + 0: JS_TEMPLATE_ELEMENT@73..81 + 0: DOLLAR_CURLY@73..75 "${" [] [] + 1: JS_BINARY_EXPRESSION@75..80 + 0: JS_IDENTIFIER_EXPRESSION@75..77 + 0: JS_REFERENCE_IDENTIFIER@75..77 + 0: IDENT@75..77 "i" [] [Whitespace(" ")] + 1: PLUS@77..79 "+" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@79..80 + 0: JS_NUMBER_LITERAL@79..80 "1" [] [] + 2: R_CURLY@80..81 "}" [] [] + 4: BACKTICK@81..82 "`" [] [] + 1: COMMA@82..83 "," [] [] + 2: JS_PROPERTY_OBJECT_MEMBER@83..238 + 0: JS_LITERAL_MEMBER_NAME@83..97 + 0: IDENT@83..97 "exact" [Newline("\n"), Whitespace(" ")] [] + 1: COLON@97..99 ":" [] [Whitespace(" ")] + 2: JS_ARRAY_EXPRESSION@99..238 + 0: L_BRACK@99..100 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@100..228 + 0: JS_OBJECT_EXPRESSION@100..163 + 0: L_CURLY@100..115 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@115..162 + 0: JS_PROPERTY_OBJECT_MEMBER@115..126 + 0: JS_LITERAL_MEMBER_NAME@115..119 + 0: IDENT@115..119 "name" [] [] + 1: COLON@119..121 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@121..126 + 0: JS_STRING_LITERAL@121..126 "\"foo\"" [] [] + 1: COMMA@126..128 "," [] [Whitespace(" ")] + 2: JS_PROPERTY_OBJECT_MEMBER@128..162 + 0: JS_LITERAL_MEMBER_NAME@128..143 + 0: IDENT@128..143 "replacementSpan" [] [] + 1: COLON@143..145 ":" [] [Whitespace(" ")] + 2: JS_COMPUTED_MEMBER_EXPRESSION@145..162 + 0: JS_CALL_EXPRESSION@145..158 + 0: JS_STATIC_MEMBER_EXPRESSION@145..156 + 0: JS_IDENTIFIER_EXPRESSION@145..149 + 0: JS_REFERENCE_IDENTIFIER@145..149 + 0: IDENT@145..149 "test" [] [] + 1: DOT@149..150 "." [] [] + 2: JS_NAME@150..156 + 0: IDENT@150..156 "ranges" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@156..158 + 0: L_PAREN@156..157 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@157..157 + 2: R_PAREN@157..158 ")" [] [] + 1: (empty) + 2: L_BRACK@158..159 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@159..160 + 0: JS_REFERENCE_IDENTIFIER@159..160 + 0: IDENT@159..160 "i" [] [] + 4: R_BRACK@160..162 "]" [] [Whitespace(" ")] + 2: R_CURLY@162..163 "}" [] [] + 1: COMMA@163..164 "," [] [] + 2: JS_OBJECT_EXPRESSION@164..227 + 0: L_CURLY@164..179 "{" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@179..226 + 0: JS_PROPERTY_OBJECT_MEMBER@179..190 + 0: JS_LITERAL_MEMBER_NAME@179..183 + 0: IDENT@179..183 "name" [] [] + 1: COLON@183..185 ":" [] [Whitespace(" ")] + 2: JS_STRING_LITERAL_EXPRESSION@185..190 + 0: JS_STRING_LITERAL@185..190 "\"bar\"" [] [] + 1: COMMA@190..192 "," [] [Whitespace(" ")] + 2: JS_PROPERTY_OBJECT_MEMBER@192..226 + 0: JS_LITERAL_MEMBER_NAME@192..207 + 0: IDENT@192..207 "replacementSpan" [] [] + 1: COLON@207..209 ":" [] [Whitespace(" ")] + 2: JS_COMPUTED_MEMBER_EXPRESSION@209..226 + 0: JS_CALL_EXPRESSION@209..222 + 0: JS_STATIC_MEMBER_EXPRESSION@209..220 + 0: JS_IDENTIFIER_EXPRESSION@209..213 + 0: JS_REFERENCE_IDENTIFIER@209..213 + 0: IDENT@209..213 "test" [] [] + 1: DOT@213..214 "." [] [] + 2: JS_NAME@214..220 + 0: IDENT@214..220 "ranges" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@220..222 + 0: L_PAREN@220..221 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@221..221 + 2: R_PAREN@221..222 ")" [] [] + 1: (empty) + 2: L_BRACK@222..223 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@223..224 + 0: JS_REFERENCE_IDENTIFIER@223..224 + 0: IDENT@223..224 "i" [] [] + 4: R_BRACK@224..226 "]" [] [Whitespace(" ")] + 2: R_CURLY@226..227 "}" [] [] + 3: COMMA@227..228 "," [] [] + 2: R_BRACK@228..238 "]" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@238..244 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_PAREN@244..245 ")" [] [] + 1: SEMICOLON@245..246 ";" [] [] + 2: R_CURLY@246..248 "}" [Newline("\n")] [] + 4: EOF@248..249 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap new file mode 100644 index 000000000000..7a6fb1ba1a3a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap @@ -0,0 +1,86 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = undefined; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..4 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@8..9 "<" [] [], + ty: TsNumberType { + number_token: NUMBER_KW@9..15 "number" [] [], + }, + r_angle_token: R_ANGLE@15..16 ">" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..25 "undefined" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@25..26 ";" [] [], + }, + ], + eof_token: EOF@26..27 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..27 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..26 + 0: JS_VARIABLE_STATEMENT@0..26 + 0: JS_VARIABLE_DECLARATION@0..25 + 0: (empty) + 1: LET_KW@0..4 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..25 + 0: JS_VARIABLE_DECLARATOR@4..25 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..25 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: TS_TYPE_ASSERTION_EXPRESSION@8..25 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_NUMBER_TYPE@9..15 + 0: NUMBER_KW@9..15 "number" [] [] + 2: R_ANGLE@15..16 ">" [] [] + 3: JS_IDENTIFIER_EXPRESSION@16..25 + 0: JS_REFERENCE_IDENTIFIER@16..25 + 0: IDENT@16..25 "undefined" [] [] + 1: SEMICOLON@25..26 ";" [] [] + 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts.snap new file mode 100644 index 000000000000..8de2f9bd1755 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts.snap @@ -0,0 +1,3093 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +class Foo {} +class Foo {} +export default class Foo {} +class Foo {} +interface Foo {} +interface Foo {} +declare class Foo {} +declare class Foo {} +declare interface Foo {} +declare interface Foo {} +function a() {} +function b() {} +function c() {} +declare function d(); +() => {}; +() => {}; +(function () {}); +(function () {}); +(function () {}); +class A {} +class B {} +class C {} +class D {} +class E {} +class F {} +(class {}); +(class {}); +(class {}); +(class {}); +(class {}); +class _ { + method() {} + method() {} + method() {} +} +declare module a { + function test(): T; +} +const obj = { + a(b: any): b is T { return true; } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..8 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@9..12 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@12..13 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@13..15 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@15..17 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@17..18 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@19..25 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@25..28 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@28..29 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@29..32 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@32..34 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@34..36 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@36..37 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@38..44 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@44..47 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@47..48 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@48..52 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@52..53 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@53..55 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@55..57 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@57..58 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@58..59 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@65..68 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@68..69 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@69..72 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@72..75 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@75..77 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@77..79 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@79..80 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@87..90 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@90..91 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@91..95 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@95..98 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@98..100 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@100..102 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@102..103 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@103..104 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@104..110 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@110..113 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@113..114 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@114..117 "in" [] [Whitespace(" ")], + }, + TsOutModifier { + modifier_token: OUT_KW@117..121 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@121..124 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@124..126 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@126..128 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@128..129 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@129..130 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@136..139 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@139..140 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@140..143 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@143..144 "X" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@144..146 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@146..150 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@150..151 "Y" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@151..153 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@153..155 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@155..156 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@156..157 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@163..166 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@166..167 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@167..171 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@171..172 "X" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@172..174 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@174..177 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@177..178 "Y" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@178..180 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@180..182 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@182..183 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@183..184 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@184..190 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@190..193 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@193..194 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@194..198 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@198..199 "X" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@199..201 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@201..205 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@205..207 "Y" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@207..215 "extends" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: KEYOF_KW@215..221 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@221..222 "X" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@222..224 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@224..226 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@226..227 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@227..228 "}" [] [], + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@228..235 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@235..238 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@238..239 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@239..242 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@242..243 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@243..245 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@245..246 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@246..247 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@247..254 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@254..257 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@257..258 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@258..262 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@262..263 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@263..265 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@265..266 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@266..267 "}" [] [], + }, + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@267..275 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@275..283 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@283..289 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@289..292 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@292..293 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@293..296 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@296..297 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@297..299 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@299..300 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@300..301 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@301..308 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@308..311 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@311..312 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@312..316 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@316..317 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@317..319 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@319..320 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@320..321 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@321..332 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@332..335 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@335..336 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@336..339 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@339..340 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@340..342 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@342..343 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@343..344 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@344..355 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@355..358 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@358..359 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@359..363 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@363..364 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@364..366 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@366..367 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@367..368 "}" [] [], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@368..377 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@377..383 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@383..386 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@386..387 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@387..390 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@390..391 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@391..393 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@393..394 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@394..395 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@395..404 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@404..410 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@410..413 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@413..414 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@414..418 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@418..419 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@419..421 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@421..422 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@422..423 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@423..432 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@432..442 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@442..445 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@445..446 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@446..449 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@449..450 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@450..452 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@452..453 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@453..454 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@454..463 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@463..473 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@473..476 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@476..477 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsOutModifier { + modifier_token: OUT_KW@477..481 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@481..482 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@482..484 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@484..485 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@485..486 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@486..496 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@496..497 "a" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@497..498 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@498..504 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@504..505 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@505..506 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@506..507 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@507..509 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@509..510 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@510..511 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@511..521 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@521..522 "b" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@522..523 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@523..529 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@529..531 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@531..539 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@539..540 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@540..541 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@541..542 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@542..544 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@544..545 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@545..546 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@546..556 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@556..557 "c" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@557..558 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@558..559 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@559..561 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@561..567 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@567..568 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@568..569 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@569..570 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@570..572 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@572..573 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@573..574 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@574..583 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@583..592 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@592..593 "d" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@593..594 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@594..600 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@600..601 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@601..602 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@602..603 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@603..604 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: SEMICOLON@604..605 ";" [] [], + }, + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@605..607 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@607..608 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@608..609 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@609..610 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@610..612 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@612..615 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@615..616 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@616..617 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@617..618 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@618..620 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@620..626 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@626..627 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@627..628 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@628..629 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@629..631 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@631..634 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@634..635 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@635..636 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@636..637 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@637..639 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@639..648 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@648..649 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@649..655 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@655..656 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@656..657 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@657..658 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@658..660 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@660..661 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@661..662 "}" [] [], + }, + }, + r_paren_token: R_PAREN@662..663 ")" [] [], + }, + semicolon_token: SEMICOLON@663..664 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@664..666 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@666..675 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@675..676 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@676..682 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@682..684 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@684..692 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@692..693 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@693..694 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@694..695 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@695..697 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@697..698 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@698..699 "}" [] [], + }, + }, + r_paren_token: R_PAREN@699..700 ")" [] [], + }, + semicolon_token: SEMICOLON@700..701 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@701..703 "(" [Newline("\n")] [], + expression: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@703..712 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@712..713 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@713..714 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@714..716 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@716..722 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@722..723 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@723..724 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@724..725 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@725..727 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@727..728 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@728..729 "}" [] [], + }, + }, + r_paren_token: R_PAREN@729..730 ")" [] [], + }, + semicolon_token: SEMICOLON@730..731 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@731..738 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@738..739 "A" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@739..740 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@740..746 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@746..747 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@747..749 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@749..750 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@750..751 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@751..758 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@758..759 "B" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@759..760 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@760..766 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@766..768 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@768..776 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@776..777 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@777..779 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@779..780 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@780..781 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@781..788 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@788..789 "C" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@789..790 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@790..791 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@791..793 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@793..799 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@799..800 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@800..802 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@802..803 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@803..804 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@804..811 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@811..812 "D" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@812..813 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@813..816 "in" [] [Whitespace(" ")], + }, + TsConstModifier { + modifier_token: CONST_KW@816..822 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@822..823 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@823..825 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@825..826 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@826..827 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@827..834 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@834..835 "E" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@835..836 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@836..842 "const" [] [Whitespace(" ")], + }, + TsInModifier { + modifier_token: IN_KW@842..845 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@845..846 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@846..848 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@848..849 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@849..850 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@850..857 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@857..858 "F" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@858..859 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@859..862 "in" [] [Whitespace(" ")], + }, + TsConstModifier { + modifier_token: CONST_KW@862..868 "const" [] [Whitespace(" ")], + }, + TsOutModifier { + modifier_token: OUT_KW@868..872 "out" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@872..873 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@873..875 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@875..876 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@876..877 "}" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@877..879 "(" [Newline("\n")] [], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@879..885 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@885..886 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@886..892 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@892..893 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@893..895 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@895..896 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@896..897 "}" [] [], + }, + r_paren_token: R_PAREN@897..898 ")" [] [], + }, + semicolon_token: SEMICOLON@898..899 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@899..901 "(" [Newline("\n")] [], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@901..907 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@907..908 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@908..914 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@914..916 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@916..924 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@924..925 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@925..927 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@927..928 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@928..929 "}" [] [], + }, + r_paren_token: R_PAREN@929..930 ")" [] [], + }, + semicolon_token: SEMICOLON@930..931 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@931..933 "(" [Newline("\n")] [], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@933..939 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@939..940 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@940..941 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@941..943 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@943..949 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@949..950 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@950..952 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@952..953 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@953..954 "}" [] [], + }, + r_paren_token: R_PAREN@954..955 ")" [] [], + }, + semicolon_token: SEMICOLON@955..956 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@956..958 "(" [Newline("\n")] [], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@958..964 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@964..965 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsInModifier { + modifier_token: IN_KW@965..968 "in" [] [Whitespace(" ")], + }, + TsConstModifier { + modifier_token: CONST_KW@968..974 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@974..975 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@975..977 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@977..978 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@978..979 "}" [] [], + }, + r_paren_token: R_PAREN@979..980 ")" [] [], + }, + semicolon_token: SEMICOLON@980..981 ";" [] [], + }, + JsExpressionStatement { + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@981..983 "(" [Newline("\n")] [], + expression: JsClassExpression { + decorators: JsDecoratorList [], + class_token: CLASS_KW@983..989 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@989..990 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@990..996 "const" [] [Whitespace(" ")], + }, + TsInModifier { + modifier_token: IN_KW@996..999 "in" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@999..1000 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1000..1002 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@1002..1003 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@1003..1004 "}" [] [], + }, + r_paren_token: R_PAREN@1004..1005 ")" [] [], + }, + semicolon_token: SEMICOLON@1005..1006 ";" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@1006..1013 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@1013..1015 "_" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@1015..1016 "{" [] [], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1016..1025 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1025..1026 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@1026..1032 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@1032..1033 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1033..1034 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@1034..1035 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1035..1037 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@1037..1038 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1038..1039 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1039..1048 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1048..1049 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@1049..1055 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@1055..1057 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1057..1065 "extends" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1065..1066 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1066..1067 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@1067..1068 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1068..1070 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@1070..1071 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1071..1072 "}" [] [], + }, + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1072..1081 "method" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1081..1082 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1082..1083 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@1083..1085 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@1085..1091 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@1091..1092 "U" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1092..1093 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@1093..1094 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1094..1096 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@1096..1097 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@1097..1098 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@1098..1100 "}" [Newline("\n")] [], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@1100..1109 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: MODULE_KW@1109..1116 "module" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@1116..1118 "a" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@1118..1119 "{" [] [], + items: JsModuleItemList [ + TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@1119..1131 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@1131..1135 "test" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1135..1136 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@1136..1142 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@1142..1143 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1143..1144 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@1144..1145 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1145..1146 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@1146..1148 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1148..1149 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@1149..1150 ";" [] [], + }, + ], + r_curly_token: R_CURLY@1150..1152 "}" [Newline("\n")] [], + }, + }, + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@1152..1159 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@1159..1163 "obj" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@1163..1165 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@1165..1166 "{" [] [], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1166..1170 "a" [Newline("\n"), Whitespace(" ")] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1170..1171 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [ + TsConstModifier { + modifier_token: CONST_KW@1171..1177 "const" [] [Whitespace(" ")], + }, + ], + name: TsTypeParameterName { + ident_token: IDENT@1177..1178 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1178..1179 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@1179..1180 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1180..1181 "b" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1181..1183 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1183..1186 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1186..1187 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@1187..1189 ":" [] [Whitespace(" ")], + ty: TsPredicateReturnType { + parameter_name: JsReferenceIdentifier { + value_token: IDENT@1189..1191 "b" [] [Whitespace(" ")], + }, + is_token: IS_KW@1191..1194 "is" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1194..1196 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@1196..1198 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsReturnStatement { + return_token: RETURN_KW@1198..1205 "return" [] [Whitespace(" ")], + argument: JsBooleanLiteralExpression { + value_token: TRUE_KW@1205..1209 "true" [] [], + }, + semicolon_token: SEMICOLON@1209..1211 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@1211..1212 "}" [] [], + }, + }, + ], + r_curly_token: R_CURLY@1212..1214 "}" [Newline("\n")] [], + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@1214..1215 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..1215 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..1214 + 0: TS_TYPE_ALIAS_DECLARATION@0..19 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..8 + 0: IDENT@5..8 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@8..15 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..13 + 0: TS_TYPE_PARAMETER@9..13 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@9..12 + 0: TS_IN_MODIFIER@9..12 + 0: IN_KW@9..12 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@12..13 + 0: IDENT@12..13 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@13..15 ">" [] [Whitespace(" ")] + 3: EQ@15..17 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@18..18 + 2: R_CURLY@18..19 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@19..38 + 0: TYPE_KW@19..25 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..28 + 0: IDENT@25..28 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@28..34 + 0: L_ANGLE@28..29 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@29..32 + 0: TS_TYPE_PARAMETER@29..32 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@29..29 + 1: TS_TYPE_PARAMETER_NAME@29..32 + 0: IDENT@29..32 "out" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@32..34 ">" [] [Whitespace(" ")] + 3: EQ@34..36 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@36..38 + 0: L_CURLY@36..37 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@37..37 + 2: R_CURLY@37..38 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@38..59 + 0: TYPE_KW@38..44 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@44..47 + 0: IDENT@44..47 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@47..55 + 0: L_ANGLE@47..48 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@48..53 + 0: TS_TYPE_PARAMETER@48..53 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@48..52 + 0: TS_OUT_MODIFIER@48..52 + 0: OUT_KW@48..52 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@52..53 + 0: IDENT@52..53 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@53..55 ">" [] [Whitespace(" ")] + 3: EQ@55..57 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@57..59 + 0: L_CURLY@57..58 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@58..58 + 2: R_CURLY@58..59 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@59..81 + 0: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@65..68 + 0: IDENT@65..68 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@68..77 + 0: L_ANGLE@68..69 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@69..75 + 0: TS_TYPE_PARAMETER@69..75 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@69..72 + 0: TS_IN_MODIFIER@69..72 + 0: IN_KW@69..72 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@72..75 + 0: IDENT@72..75 "out" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@75..77 ">" [] [Whitespace(" ")] + 3: EQ@77..79 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@79..81 + 0: L_CURLY@79..80 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@80..80 + 2: R_CURLY@80..81 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@81..104 + 0: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@87..90 + 0: IDENT@87..90 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@90..100 + 0: L_ANGLE@90..91 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@91..98 + 0: TS_TYPE_PARAMETER@91..98 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@91..95 + 0: TS_OUT_MODIFIER@91..95 + 0: OUT_KW@91..95 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@95..98 + 0: IDENT@95..98 "out" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@98..100 ">" [] [Whitespace(" ")] + 3: EQ@100..102 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@102..104 + 0: L_CURLY@102..103 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@103..103 + 2: R_CURLY@103..104 "}" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@104..130 + 0: TYPE_KW@104..110 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@110..113 + 0: IDENT@110..113 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@113..126 + 0: L_ANGLE@113..114 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@114..124 + 0: TS_TYPE_PARAMETER@114..124 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@114..121 + 0: TS_IN_MODIFIER@114..117 + 0: IN_KW@114..117 "in" [] [Whitespace(" ")] + 1: TS_OUT_MODIFIER@117..121 + 0: OUT_KW@117..121 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@121..124 + 0: IDENT@121..124 "out" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@124..126 ">" [] [Whitespace(" ")] + 3: EQ@126..128 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@128..130 + 0: L_CURLY@128..129 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@129..129 + 2: R_CURLY@129..130 "}" [] [] + 5: (empty) + 6: TS_TYPE_ALIAS_DECLARATION@130..157 + 0: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@136..139 + 0: IDENT@136..139 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@139..153 + 0: L_ANGLE@139..140 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@140..151 + 0: TS_TYPE_PARAMETER@140..144 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@140..143 + 0: TS_IN_MODIFIER@140..143 + 0: IN_KW@140..143 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@143..144 + 0: IDENT@143..144 "X" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@144..146 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@146..151 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@146..150 + 0: TS_OUT_MODIFIER@146..150 + 0: OUT_KW@146..150 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@150..151 + 0: IDENT@150..151 "Y" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@151..153 ">" [] [Whitespace(" ")] + 3: EQ@153..155 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@155..157 + 0: L_CURLY@155..156 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@156..156 + 2: R_CURLY@156..157 "}" [] [] + 5: (empty) + 7: TS_TYPE_ALIAS_DECLARATION@157..184 + 0: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@163..166 + 0: IDENT@163..166 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@166..180 + 0: L_ANGLE@166..167 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@167..178 + 0: TS_TYPE_PARAMETER@167..172 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@167..171 + 0: TS_OUT_MODIFIER@167..171 + 0: OUT_KW@167..171 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@171..172 + 0: IDENT@171..172 "X" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@172..174 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@174..178 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@174..177 + 0: TS_IN_MODIFIER@174..177 + 0: IN_KW@174..177 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@177..178 + 0: IDENT@177..178 "Y" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@178..180 ">" [] [Whitespace(" ")] + 3: EQ@180..182 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@182..184 + 0: L_CURLY@182..183 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@183..183 + 2: R_CURLY@183..184 "}" [] [] + 5: (empty) + 8: TS_TYPE_ALIAS_DECLARATION@184..228 + 0: TYPE_KW@184..190 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@190..193 + 0: IDENT@190..193 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@193..224 + 0: L_ANGLE@193..194 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@194..222 + 0: TS_TYPE_PARAMETER@194..199 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@194..198 + 0: TS_OUT_MODIFIER@194..198 + 0: OUT_KW@194..198 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@198..199 + 0: IDENT@198..199 "X" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@199..201 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@201..222 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@201..205 + 0: TS_OUT_MODIFIER@201..205 + 0: OUT_KW@201..205 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@205..207 + 0: IDENT@205..207 "Y" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@207..222 + 0: EXTENDS_KW@207..215 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_OPERATOR_TYPE@215..222 + 0: KEYOF_KW@215..221 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@221..222 + 0: JS_REFERENCE_IDENTIFIER@221..222 + 0: IDENT@221..222 "X" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@222..224 ">" [] [Whitespace(" ")] + 3: EQ@224..226 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@226..228 + 0: L_CURLY@226..227 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@227..227 + 2: R_CURLY@227..228 "}" [] [] + 5: (empty) + 9: JS_CLASS_DECLARATION@228..247 + 0: JS_DECORATOR_LIST@228..228 + 1: (empty) + 2: CLASS_KW@228..235 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@235..238 + 0: IDENT@235..238 "Foo" [] [] + 4: TS_TYPE_PARAMETERS@238..245 + 0: L_ANGLE@238..239 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@239..243 + 0: TS_TYPE_PARAMETER@239..243 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@239..242 + 0: TS_IN_MODIFIER@239..242 + 0: IN_KW@239..242 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@242..243 + 0: IDENT@242..243 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@243..245 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@245..246 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@246..246 + 9: R_CURLY@246..247 "}" [] [] + 10: JS_CLASS_DECLARATION@247..267 + 0: JS_DECORATOR_LIST@247..247 + 1: (empty) + 2: CLASS_KW@247..254 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@254..257 + 0: IDENT@254..257 "Foo" [] [] + 4: TS_TYPE_PARAMETERS@257..265 + 0: L_ANGLE@257..258 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@258..263 + 0: TS_TYPE_PARAMETER@258..263 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@258..262 + 0: TS_OUT_MODIFIER@258..262 + 0: OUT_KW@258..262 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@262..263 + 0: IDENT@262..263 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@263..265 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@265..266 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@266..266 + 9: R_CURLY@266..267 "}" [] [] + 11: JS_EXPORT@267..301 + 0: JS_DECORATOR_LIST@267..267 + 1: EXPORT_KW@267..275 "export" [Newline("\n")] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@275..301 + 0: DEFAULT_KW@275..283 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@283..301 + 0: JS_DECORATOR_LIST@283..283 + 1: (empty) + 2: CLASS_KW@283..289 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@289..292 + 0: IDENT@289..292 "Foo" [] [] + 4: TS_TYPE_PARAMETERS@292..299 + 0: L_ANGLE@292..293 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@293..297 + 0: TS_TYPE_PARAMETER@293..297 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@293..296 + 0: TS_IN_MODIFIER@293..296 + 0: IN_KW@293..296 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@296..297 + 0: IDENT@296..297 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@297..299 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@299..300 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@300..300 + 9: R_CURLY@300..301 "}" [] [] + 2: (empty) + 12: JS_CLASS_DECLARATION@301..321 + 0: JS_DECORATOR_LIST@301..301 + 1: (empty) + 2: CLASS_KW@301..308 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@308..311 + 0: IDENT@308..311 "Foo" [] [] + 4: TS_TYPE_PARAMETERS@311..319 + 0: L_ANGLE@311..312 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@312..317 + 0: TS_TYPE_PARAMETER@312..317 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@312..316 + 0: TS_OUT_MODIFIER@312..316 + 0: OUT_KW@312..316 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@316..317 + 0: IDENT@316..317 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@317..319 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@319..320 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@320..320 + 9: R_CURLY@320..321 "}" [] [] + 13: TS_INTERFACE_DECLARATION@321..344 + 0: INTERFACE_KW@321..332 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@332..335 + 0: IDENT@332..335 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@335..342 + 0: L_ANGLE@335..336 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@336..340 + 0: TS_TYPE_PARAMETER@336..340 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@336..339 + 0: TS_IN_MODIFIER@336..339 + 0: IN_KW@336..339 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@339..340 + 0: IDENT@339..340 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@340..342 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@342..343 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@343..343 + 6: R_CURLY@343..344 "}" [] [] + 14: TS_INTERFACE_DECLARATION@344..368 + 0: INTERFACE_KW@344..355 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@355..358 + 0: IDENT@355..358 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@358..366 + 0: L_ANGLE@358..359 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@359..364 + 0: TS_TYPE_PARAMETER@359..364 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@359..363 + 0: TS_OUT_MODIFIER@359..363 + 0: OUT_KW@359..363 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@363..364 + 0: IDENT@363..364 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@364..366 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@366..367 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@367..367 + 6: R_CURLY@367..368 "}" [] [] + 15: TS_DECLARE_STATEMENT@368..395 + 0: DECLARE_KW@368..377 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@377..395 + 0: JS_DECORATOR_LIST@377..377 + 1: (empty) + 2: CLASS_KW@377..383 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@383..386 + 0: IDENT@383..386 "Foo" [] [] + 4: TS_TYPE_PARAMETERS@386..393 + 0: L_ANGLE@386..387 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@387..391 + 0: TS_TYPE_PARAMETER@387..391 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@387..390 + 0: TS_IN_MODIFIER@387..390 + 0: IN_KW@387..390 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@390..391 + 0: IDENT@390..391 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@391..393 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@393..394 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@394..394 + 9: R_CURLY@394..395 "}" [] [] + 16: TS_DECLARE_STATEMENT@395..423 + 0: DECLARE_KW@395..404 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@404..423 + 0: JS_DECORATOR_LIST@404..404 + 1: (empty) + 2: CLASS_KW@404..410 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@410..413 + 0: IDENT@410..413 "Foo" [] [] + 4: TS_TYPE_PARAMETERS@413..421 + 0: L_ANGLE@413..414 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@414..419 + 0: TS_TYPE_PARAMETER@414..419 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@414..418 + 0: TS_OUT_MODIFIER@414..418 + 0: OUT_KW@414..418 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@418..419 + 0: IDENT@418..419 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@419..421 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@421..422 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@422..422 + 9: R_CURLY@422..423 "}" [] [] + 17: TS_DECLARE_STATEMENT@423..454 + 0: DECLARE_KW@423..432 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@432..454 + 0: INTERFACE_KW@432..442 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@442..445 + 0: IDENT@442..445 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@445..452 + 0: L_ANGLE@445..446 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@446..450 + 0: TS_TYPE_PARAMETER@446..450 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@446..449 + 0: TS_IN_MODIFIER@446..449 + 0: IN_KW@446..449 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@449..450 + 0: IDENT@449..450 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@450..452 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@452..453 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@453..453 + 6: R_CURLY@453..454 "}" [] [] + 18: TS_DECLARE_STATEMENT@454..486 + 0: DECLARE_KW@454..463 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@463..486 + 0: INTERFACE_KW@463..473 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@473..476 + 0: IDENT@473..476 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@476..484 + 0: L_ANGLE@476..477 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@477..482 + 0: TS_TYPE_PARAMETER@477..482 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@477..481 + 0: TS_OUT_MODIFIER@477..481 + 0: OUT_KW@477..481 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@481..482 + 0: IDENT@481..482 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@482..484 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@484..485 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@485..485 + 6: R_CURLY@485..486 "}" [] [] + 19: JS_FUNCTION_DECLARATION@486..511 + 0: (empty) + 1: FUNCTION_KW@486..496 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@496..497 + 0: IDENT@496..497 "a" [] [] + 4: TS_TYPE_PARAMETERS@497..506 + 0: L_ANGLE@497..498 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@498..505 + 0: TS_TYPE_PARAMETER@498..505 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@498..504 + 0: TS_CONST_MODIFIER@498..504 + 0: CONST_KW@498..504 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@504..505 + 0: IDENT@504..505 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@505..506 ">" [] [] + 5: JS_PARAMETERS@506..509 + 0: L_PAREN@506..507 "(" [] [] + 1: JS_PARAMETER_LIST@507..507 + 2: R_PAREN@507..509 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@509..511 + 0: L_CURLY@509..510 "{" [] [] + 1: JS_DIRECTIVE_LIST@510..510 + 2: JS_STATEMENT_LIST@510..510 + 3: R_CURLY@510..511 "}" [] [] + 20: JS_FUNCTION_DECLARATION@511..546 + 0: (empty) + 1: FUNCTION_KW@511..521 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@521..522 + 0: IDENT@521..522 "b" [] [] + 4: TS_TYPE_PARAMETERS@522..541 + 0: L_ANGLE@522..523 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@523..540 + 0: TS_TYPE_PARAMETER@523..540 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@523..529 + 0: TS_CONST_MODIFIER@523..529 + 0: CONST_KW@523..529 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@529..531 + 0: IDENT@529..531 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@531..540 + 0: EXTENDS_KW@531..539 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@539..540 + 0: JS_REFERENCE_IDENTIFIER@539..540 + 0: IDENT@539..540 "U" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@540..541 ">" [] [] + 5: JS_PARAMETERS@541..544 + 0: L_PAREN@541..542 "(" [] [] + 1: JS_PARAMETER_LIST@542..542 + 2: R_PAREN@542..544 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@544..546 + 0: L_CURLY@544..545 "{" [] [] + 1: JS_DIRECTIVE_LIST@545..545 + 2: JS_STATEMENT_LIST@545..545 + 3: R_CURLY@545..546 "}" [] [] + 21: JS_FUNCTION_DECLARATION@546..574 + 0: (empty) + 1: FUNCTION_KW@546..556 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@556..557 + 0: IDENT@556..557 "c" [] [] + 4: TS_TYPE_PARAMETERS@557..569 + 0: L_ANGLE@557..558 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@558..568 + 0: TS_TYPE_PARAMETER@558..559 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@558..558 + 1: TS_TYPE_PARAMETER_NAME@558..559 + 0: IDENT@558..559 "T" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@559..561 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@561..568 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@561..567 + 0: TS_CONST_MODIFIER@561..567 + 0: CONST_KW@561..567 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@567..568 + 0: IDENT@567..568 "U" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@568..569 ">" [] [] + 5: JS_PARAMETERS@569..572 + 0: L_PAREN@569..570 "(" [] [] + 1: JS_PARAMETER_LIST@570..570 + 2: R_PAREN@570..572 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@572..574 + 0: L_CURLY@572..573 "{" [] [] + 1: JS_DIRECTIVE_LIST@573..573 + 2: JS_STATEMENT_LIST@573..573 + 3: R_CURLY@573..574 "}" [] [] + 22: TS_DECLARE_STATEMENT@574..605 + 0: DECLARE_KW@574..583 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@583..605 + 0: (empty) + 1: FUNCTION_KW@583..592 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@592..593 + 0: IDENT@592..593 "d" [] [] + 3: TS_TYPE_PARAMETERS@593..602 + 0: L_ANGLE@593..594 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@594..601 + 0: TS_TYPE_PARAMETER@594..601 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@594..600 + 0: TS_CONST_MODIFIER@594..600 + 0: CONST_KW@594..600 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@600..601 + 0: IDENT@600..601 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@601..602 ">" [] [] + 4: JS_PARAMETERS@602..604 + 0: L_PAREN@602..603 "(" [] [] + 1: JS_PARAMETER_LIST@603..603 + 2: R_PAREN@603..604 ")" [] [] + 5: (empty) + 6: SEMICOLON@604..605 ";" [] [] + 23: JS_EXPRESSION_STATEMENT@605..618 + 0: JS_ARROW_FUNCTION_EXPRESSION@605..617 + 0: (empty) + 1: TS_TYPE_PARAMETERS@605..609 + 0: L_ANGLE@605..607 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@607..608 + 0: TS_TYPE_PARAMETER@607..608 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@607..607 + 1: TS_TYPE_PARAMETER_NAME@607..608 + 0: IDENT@607..608 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@608..609 ">" [] [] + 2: JS_PARAMETERS@609..612 + 0: L_PAREN@609..610 "(" [] [] + 1: JS_PARAMETER_LIST@610..610 + 2: R_PAREN@610..612 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@612..615 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@615..617 + 0: L_CURLY@615..616 "{" [] [] + 1: JS_DIRECTIVE_LIST@616..616 + 2: JS_STATEMENT_LIST@616..616 + 3: R_CURLY@616..617 "}" [] [] + 1: SEMICOLON@617..618 ";" [] [] + 24: JS_EXPRESSION_STATEMENT@618..637 + 0: JS_ARROW_FUNCTION_EXPRESSION@618..636 + 0: (empty) + 1: TS_TYPE_PARAMETERS@618..628 + 0: L_ANGLE@618..620 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@620..627 + 0: TS_TYPE_PARAMETER@620..627 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@620..626 + 0: TS_CONST_MODIFIER@620..626 + 0: CONST_KW@620..626 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@626..627 + 0: IDENT@626..627 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@627..628 ">" [] [] + 2: JS_PARAMETERS@628..631 + 0: L_PAREN@628..629 "(" [] [] + 1: JS_PARAMETER_LIST@629..629 + 2: R_PAREN@629..631 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@631..634 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@634..636 + 0: L_CURLY@634..635 "{" [] [] + 1: JS_DIRECTIVE_LIST@635..635 + 2: JS_STATEMENT_LIST@635..635 + 3: R_CURLY@635..636 "}" [] [] + 1: SEMICOLON@636..637 ";" [] [] + 25: JS_EXPRESSION_STATEMENT@637..664 + 0: JS_PARENTHESIZED_EXPRESSION@637..663 + 0: L_PAREN@637..639 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@639..662 + 0: (empty) + 1: FUNCTION_KW@639..648 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETERS@648..657 + 0: L_ANGLE@648..649 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@649..656 + 0: TS_TYPE_PARAMETER@649..656 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@649..655 + 0: TS_CONST_MODIFIER@649..655 + 0: CONST_KW@649..655 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@655..656 + 0: IDENT@655..656 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@656..657 ">" [] [] + 5: JS_PARAMETERS@657..660 + 0: L_PAREN@657..658 "(" [] [] + 1: JS_PARAMETER_LIST@658..658 + 2: R_PAREN@658..660 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@660..662 + 0: L_CURLY@660..661 "{" [] [] + 1: JS_DIRECTIVE_LIST@661..661 + 2: JS_STATEMENT_LIST@661..661 + 3: R_CURLY@661..662 "}" [] [] + 2: R_PAREN@662..663 ")" [] [] + 1: SEMICOLON@663..664 ";" [] [] + 26: JS_EXPRESSION_STATEMENT@664..701 + 0: JS_PARENTHESIZED_EXPRESSION@664..700 + 0: L_PAREN@664..666 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@666..699 + 0: (empty) + 1: FUNCTION_KW@666..675 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETERS@675..694 + 0: L_ANGLE@675..676 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@676..693 + 0: TS_TYPE_PARAMETER@676..693 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@676..682 + 0: TS_CONST_MODIFIER@676..682 + 0: CONST_KW@676..682 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@682..684 + 0: IDENT@682..684 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@684..693 + 0: EXTENDS_KW@684..692 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@692..693 + 0: JS_REFERENCE_IDENTIFIER@692..693 + 0: IDENT@692..693 "U" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@693..694 ">" [] [] + 5: JS_PARAMETERS@694..697 + 0: L_PAREN@694..695 "(" [] [] + 1: JS_PARAMETER_LIST@695..695 + 2: R_PAREN@695..697 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@697..699 + 0: L_CURLY@697..698 "{" [] [] + 1: JS_DIRECTIVE_LIST@698..698 + 2: JS_STATEMENT_LIST@698..698 + 3: R_CURLY@698..699 "}" [] [] + 2: R_PAREN@699..700 ")" [] [] + 1: SEMICOLON@700..701 ";" [] [] + 27: JS_EXPRESSION_STATEMENT@701..731 + 0: JS_PARENTHESIZED_EXPRESSION@701..730 + 0: L_PAREN@701..703 "(" [Newline("\n")] [] + 1: JS_FUNCTION_EXPRESSION@703..729 + 0: (empty) + 1: FUNCTION_KW@703..712 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETERS@712..724 + 0: L_ANGLE@712..713 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@713..723 + 0: TS_TYPE_PARAMETER@713..714 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@713..713 + 1: TS_TYPE_PARAMETER_NAME@713..714 + 0: IDENT@713..714 "T" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@714..716 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@716..723 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@716..722 + 0: TS_CONST_MODIFIER@716..722 + 0: CONST_KW@716..722 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@722..723 + 0: IDENT@722..723 "U" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@723..724 ">" [] [] + 5: JS_PARAMETERS@724..727 + 0: L_PAREN@724..725 "(" [] [] + 1: JS_PARAMETER_LIST@725..725 + 2: R_PAREN@725..727 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@727..729 + 0: L_CURLY@727..728 "{" [] [] + 1: JS_DIRECTIVE_LIST@728..728 + 2: JS_STATEMENT_LIST@728..728 + 3: R_CURLY@728..729 "}" [] [] + 2: R_PAREN@729..730 ")" [] [] + 1: SEMICOLON@730..731 ";" [] [] + 28: JS_CLASS_DECLARATION@731..751 + 0: JS_DECORATOR_LIST@731..731 + 1: (empty) + 2: CLASS_KW@731..738 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@738..739 + 0: IDENT@738..739 "A" [] [] + 4: TS_TYPE_PARAMETERS@739..749 + 0: L_ANGLE@739..740 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@740..747 + 0: TS_TYPE_PARAMETER@740..747 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@740..746 + 0: TS_CONST_MODIFIER@740..746 + 0: CONST_KW@740..746 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@746..747 + 0: IDENT@746..747 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@747..749 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@749..750 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@750..750 + 9: R_CURLY@750..751 "}" [] [] + 29: JS_CLASS_DECLARATION@751..781 + 0: JS_DECORATOR_LIST@751..751 + 1: (empty) + 2: CLASS_KW@751..758 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@758..759 + 0: IDENT@758..759 "B" [] [] + 4: TS_TYPE_PARAMETERS@759..779 + 0: L_ANGLE@759..760 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@760..777 + 0: TS_TYPE_PARAMETER@760..777 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@760..766 + 0: TS_CONST_MODIFIER@760..766 + 0: CONST_KW@760..766 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@766..768 + 0: IDENT@766..768 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@768..777 + 0: EXTENDS_KW@768..776 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@776..777 + 0: JS_REFERENCE_IDENTIFIER@776..777 + 0: IDENT@776..777 "U" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@777..779 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@779..780 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@780..780 + 9: R_CURLY@780..781 "}" [] [] + 30: JS_CLASS_DECLARATION@781..804 + 0: JS_DECORATOR_LIST@781..781 + 1: (empty) + 2: CLASS_KW@781..788 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@788..789 + 0: IDENT@788..789 "C" [] [] + 4: TS_TYPE_PARAMETERS@789..802 + 0: L_ANGLE@789..790 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@790..800 + 0: TS_TYPE_PARAMETER@790..791 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@790..790 + 1: TS_TYPE_PARAMETER_NAME@790..791 + 0: IDENT@790..791 "T" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@791..793 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@793..800 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@793..799 + 0: TS_CONST_MODIFIER@793..799 + 0: CONST_KW@793..799 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@799..800 + 0: IDENT@799..800 "U" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@800..802 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@802..803 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@803..803 + 9: R_CURLY@803..804 "}" [] [] + 31: JS_CLASS_DECLARATION@804..827 + 0: JS_DECORATOR_LIST@804..804 + 1: (empty) + 2: CLASS_KW@804..811 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@811..812 + 0: IDENT@811..812 "D" [] [] + 4: TS_TYPE_PARAMETERS@812..825 + 0: L_ANGLE@812..813 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@813..823 + 0: TS_TYPE_PARAMETER@813..823 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@813..822 + 0: TS_IN_MODIFIER@813..816 + 0: IN_KW@813..816 "in" [] [Whitespace(" ")] + 1: TS_CONST_MODIFIER@816..822 + 0: CONST_KW@816..822 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@822..823 + 0: IDENT@822..823 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@823..825 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@825..826 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@826..826 + 9: R_CURLY@826..827 "}" [] [] + 32: JS_CLASS_DECLARATION@827..850 + 0: JS_DECORATOR_LIST@827..827 + 1: (empty) + 2: CLASS_KW@827..834 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@834..835 + 0: IDENT@834..835 "E" [] [] + 4: TS_TYPE_PARAMETERS@835..848 + 0: L_ANGLE@835..836 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@836..846 + 0: TS_TYPE_PARAMETER@836..846 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@836..845 + 0: TS_CONST_MODIFIER@836..842 + 0: CONST_KW@836..842 "const" [] [Whitespace(" ")] + 1: TS_IN_MODIFIER@842..845 + 0: IN_KW@842..845 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@845..846 + 0: IDENT@845..846 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@846..848 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@848..849 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@849..849 + 9: R_CURLY@849..850 "}" [] [] + 33: JS_CLASS_DECLARATION@850..877 + 0: JS_DECORATOR_LIST@850..850 + 1: (empty) + 2: CLASS_KW@850..857 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@857..858 + 0: IDENT@857..858 "F" [] [] + 4: TS_TYPE_PARAMETERS@858..875 + 0: L_ANGLE@858..859 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@859..873 + 0: TS_TYPE_PARAMETER@859..873 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@859..872 + 0: TS_IN_MODIFIER@859..862 + 0: IN_KW@859..862 "in" [] [Whitespace(" ")] + 1: TS_CONST_MODIFIER@862..868 + 0: CONST_KW@862..868 "const" [] [Whitespace(" ")] + 2: TS_OUT_MODIFIER@868..872 + 0: OUT_KW@868..872 "out" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@872..873 + 0: IDENT@872..873 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@873..875 ">" [] [Whitespace(" ")] + 5: (empty) + 6: (empty) + 7: L_CURLY@875..876 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@876..876 + 9: R_CURLY@876..877 "}" [] [] + 34: JS_EXPRESSION_STATEMENT@877..899 + 0: JS_PARENTHESIZED_EXPRESSION@877..898 + 0: L_PAREN@877..879 "(" [Newline("\n")] [] + 1: JS_CLASS_EXPRESSION@879..897 + 0: JS_DECORATOR_LIST@879..879 + 1: CLASS_KW@879..885 "class" [] [Whitespace(" ")] + 2: (empty) + 3: TS_TYPE_PARAMETERS@885..895 + 0: L_ANGLE@885..886 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@886..893 + 0: TS_TYPE_PARAMETER@886..893 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@886..892 + 0: TS_CONST_MODIFIER@886..892 + 0: CONST_KW@886..892 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@892..893 + 0: IDENT@892..893 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@893..895 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@895..896 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@896..896 + 8: R_CURLY@896..897 "}" [] [] + 2: R_PAREN@897..898 ")" [] [] + 1: SEMICOLON@898..899 ";" [] [] + 35: JS_EXPRESSION_STATEMENT@899..931 + 0: JS_PARENTHESIZED_EXPRESSION@899..930 + 0: L_PAREN@899..901 "(" [Newline("\n")] [] + 1: JS_CLASS_EXPRESSION@901..929 + 0: JS_DECORATOR_LIST@901..901 + 1: CLASS_KW@901..907 "class" [] [Whitespace(" ")] + 2: (empty) + 3: TS_TYPE_PARAMETERS@907..927 + 0: L_ANGLE@907..908 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@908..925 + 0: TS_TYPE_PARAMETER@908..925 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@908..914 + 0: TS_CONST_MODIFIER@908..914 + 0: CONST_KW@908..914 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@914..916 + 0: IDENT@914..916 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@916..925 + 0: EXTENDS_KW@916..924 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@924..925 + 0: JS_REFERENCE_IDENTIFIER@924..925 + 0: IDENT@924..925 "U" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@925..927 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@927..928 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@928..928 + 8: R_CURLY@928..929 "}" [] [] + 2: R_PAREN@929..930 ")" [] [] + 1: SEMICOLON@930..931 ";" [] [] + 36: JS_EXPRESSION_STATEMENT@931..956 + 0: JS_PARENTHESIZED_EXPRESSION@931..955 + 0: L_PAREN@931..933 "(" [Newline("\n")] [] + 1: JS_CLASS_EXPRESSION@933..954 + 0: JS_DECORATOR_LIST@933..933 + 1: CLASS_KW@933..939 "class" [] [Whitespace(" ")] + 2: (empty) + 3: TS_TYPE_PARAMETERS@939..952 + 0: L_ANGLE@939..940 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@940..950 + 0: TS_TYPE_PARAMETER@940..941 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@940..940 + 1: TS_TYPE_PARAMETER_NAME@940..941 + 0: IDENT@940..941 "T" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@941..943 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@943..950 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@943..949 + 0: TS_CONST_MODIFIER@943..949 + 0: CONST_KW@943..949 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@949..950 + 0: IDENT@949..950 "U" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@950..952 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@952..953 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@953..953 + 8: R_CURLY@953..954 "}" [] [] + 2: R_PAREN@954..955 ")" [] [] + 1: SEMICOLON@955..956 ";" [] [] + 37: JS_EXPRESSION_STATEMENT@956..981 + 0: JS_PARENTHESIZED_EXPRESSION@956..980 + 0: L_PAREN@956..958 "(" [Newline("\n")] [] + 1: JS_CLASS_EXPRESSION@958..979 + 0: JS_DECORATOR_LIST@958..958 + 1: CLASS_KW@958..964 "class" [] [Whitespace(" ")] + 2: (empty) + 3: TS_TYPE_PARAMETERS@964..977 + 0: L_ANGLE@964..965 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@965..975 + 0: TS_TYPE_PARAMETER@965..975 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@965..974 + 0: TS_IN_MODIFIER@965..968 + 0: IN_KW@965..968 "in" [] [Whitespace(" ")] + 1: TS_CONST_MODIFIER@968..974 + 0: CONST_KW@968..974 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@974..975 + 0: IDENT@974..975 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@975..977 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@977..978 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@978..978 + 8: R_CURLY@978..979 "}" [] [] + 2: R_PAREN@979..980 ")" [] [] + 1: SEMICOLON@980..981 ";" [] [] + 38: JS_EXPRESSION_STATEMENT@981..1006 + 0: JS_PARENTHESIZED_EXPRESSION@981..1005 + 0: L_PAREN@981..983 "(" [Newline("\n")] [] + 1: JS_CLASS_EXPRESSION@983..1004 + 0: JS_DECORATOR_LIST@983..983 + 1: CLASS_KW@983..989 "class" [] [Whitespace(" ")] + 2: (empty) + 3: TS_TYPE_PARAMETERS@989..1002 + 0: L_ANGLE@989..990 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@990..1000 + 0: TS_TYPE_PARAMETER@990..1000 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@990..999 + 0: TS_CONST_MODIFIER@990..996 + 0: CONST_KW@990..996 "const" [] [Whitespace(" ")] + 1: TS_IN_MODIFIER@996..999 + 0: IN_KW@996..999 "in" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@999..1000 + 0: IDENT@999..1000 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1000..1002 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@1002..1003 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@1003..1003 + 8: R_CURLY@1003..1004 "}" [] [] + 2: R_PAREN@1004..1005 ")" [] [] + 1: SEMICOLON@1005..1006 ";" [] [] + 39: JS_CLASS_DECLARATION@1006..1100 + 0: JS_DECORATOR_LIST@1006..1006 + 1: (empty) + 2: CLASS_KW@1006..1013 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@1013..1015 + 0: IDENT@1013..1015 "_" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@1015..1016 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@1016..1098 + 0: JS_METHOD_CLASS_MEMBER@1016..1039 + 0: JS_METHOD_MODIFIER_LIST@1016..1016 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@1016..1025 + 0: IDENT@1016..1025 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: TS_TYPE_PARAMETERS@1025..1034 + 0: L_ANGLE@1025..1026 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1026..1033 + 0: TS_TYPE_PARAMETER@1026..1033 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1026..1032 + 0: TS_CONST_MODIFIER@1026..1032 + 0: CONST_KW@1026..1032 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1032..1033 + 0: IDENT@1032..1033 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1033..1034 ">" [] [] + 6: JS_PARAMETERS@1034..1037 + 0: L_PAREN@1034..1035 "(" [] [] + 1: JS_PARAMETER_LIST@1035..1035 + 2: R_PAREN@1035..1037 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@1037..1039 + 0: L_CURLY@1037..1038 "{" [] [] + 1: JS_DIRECTIVE_LIST@1038..1038 + 2: JS_STATEMENT_LIST@1038..1038 + 3: R_CURLY@1038..1039 "}" [] [] + 1: JS_METHOD_CLASS_MEMBER@1039..1072 + 0: JS_METHOD_MODIFIER_LIST@1039..1039 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@1039..1048 + 0: IDENT@1039..1048 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: TS_TYPE_PARAMETERS@1048..1067 + 0: L_ANGLE@1048..1049 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1049..1066 + 0: TS_TYPE_PARAMETER@1049..1066 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1049..1055 + 0: TS_CONST_MODIFIER@1049..1055 + 0: CONST_KW@1049..1055 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1055..1057 + 0: IDENT@1055..1057 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1057..1066 + 0: EXTENDS_KW@1057..1065 "extends" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@1065..1066 + 0: JS_REFERENCE_IDENTIFIER@1065..1066 + 0: IDENT@1065..1066 "U" [] [] + 1: (empty) + 3: (empty) + 2: R_ANGLE@1066..1067 ">" [] [] + 6: JS_PARAMETERS@1067..1070 + 0: L_PAREN@1067..1068 "(" [] [] + 1: JS_PARAMETER_LIST@1068..1068 + 2: R_PAREN@1068..1070 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@1070..1072 + 0: L_CURLY@1070..1071 "{" [] [] + 1: JS_DIRECTIVE_LIST@1071..1071 + 2: JS_STATEMENT_LIST@1071..1071 + 3: R_CURLY@1071..1072 "}" [] [] + 2: JS_METHOD_CLASS_MEMBER@1072..1098 + 0: JS_METHOD_MODIFIER_LIST@1072..1072 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@1072..1081 + 0: IDENT@1072..1081 "method" [Newline("\n"), Whitespace(" ")] [] + 4: (empty) + 5: TS_TYPE_PARAMETERS@1081..1093 + 0: L_ANGLE@1081..1082 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1082..1092 + 0: TS_TYPE_PARAMETER@1082..1083 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1082..1082 + 1: TS_TYPE_PARAMETER_NAME@1082..1083 + 0: IDENT@1082..1083 "T" [] [] + 2: (empty) + 3: (empty) + 1: COMMA@1083..1085 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@1085..1092 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1085..1091 + 0: TS_CONST_MODIFIER@1085..1091 + 0: CONST_KW@1085..1091 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1091..1092 + 0: IDENT@1091..1092 "U" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1092..1093 ">" [] [] + 6: JS_PARAMETERS@1093..1096 + 0: L_PAREN@1093..1094 "(" [] [] + 1: JS_PARAMETER_LIST@1094..1094 + 2: R_PAREN@1094..1096 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@1096..1098 + 0: L_CURLY@1096..1097 "{" [] [] + 1: JS_DIRECTIVE_LIST@1097..1097 + 2: JS_STATEMENT_LIST@1097..1097 + 3: R_CURLY@1097..1098 "}" [] [] + 9: R_CURLY@1098..1100 "}" [Newline("\n")] [] + 40: TS_DECLARE_STATEMENT@1100..1152 + 0: DECLARE_KW@1100..1109 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@1109..1152 + 0: MODULE_KW@1109..1116 "module" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1116..1118 + 0: IDENT@1116..1118 "a" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@1118..1152 + 0: L_CURLY@1118..1119 "{" [] [] + 1: JS_MODULE_ITEM_LIST@1119..1150 + 0: TS_DECLARE_FUNCTION_DECLARATION@1119..1150 + 0: (empty) + 1: FUNCTION_KW@1119..1131 "function" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@1131..1135 + 0: IDENT@1131..1135 "test" [] [] + 3: TS_TYPE_PARAMETERS@1135..1144 + 0: L_ANGLE@1135..1136 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1136..1143 + 0: TS_TYPE_PARAMETER@1136..1143 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1136..1142 + 0: TS_CONST_MODIFIER@1136..1142 + 0: CONST_KW@1136..1142 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1142..1143 + 0: IDENT@1142..1143 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1143..1144 ">" [] [] + 4: JS_PARAMETERS@1144..1146 + 0: L_PAREN@1144..1145 "(" [] [] + 1: JS_PARAMETER_LIST@1145..1145 + 2: R_PAREN@1145..1146 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@1146..1149 + 0: COLON@1146..1148 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@1148..1149 + 0: JS_REFERENCE_IDENTIFIER@1148..1149 + 0: IDENT@1148..1149 "T" [] [] + 1: (empty) + 6: SEMICOLON@1149..1150 ";" [] [] + 2: R_CURLY@1150..1152 "}" [Newline("\n")] [] + 41: JS_VARIABLE_STATEMENT@1152..1214 + 0: JS_VARIABLE_DECLARATION@1152..1214 + 0: (empty) + 1: CONST_KW@1152..1159 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@1159..1214 + 0: JS_VARIABLE_DECLARATOR@1159..1214 + 0: JS_IDENTIFIER_BINDING@1159..1163 + 0: IDENT@1159..1163 "obj" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@1163..1214 + 0: EQ@1163..1165 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@1165..1214 + 0: L_CURLY@1165..1166 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@1166..1212 + 0: JS_METHOD_OBJECT_MEMBER@1166..1212 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@1166..1170 + 0: IDENT@1166..1170 "a" [Newline("\n"), Whitespace(" ")] [] + 3: TS_TYPE_PARAMETERS@1170..1179 + 0: L_ANGLE@1170..1171 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1171..1178 + 0: TS_TYPE_PARAMETER@1171..1178 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1171..1177 + 0: TS_CONST_MODIFIER@1171..1177 + 0: CONST_KW@1171..1177 "const" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1177..1178 + 0: IDENT@1177..1178 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1178..1179 ">" [] [] + 4: JS_PARAMETERS@1179..1187 + 0: L_PAREN@1179..1180 "(" [] [] + 1: JS_PARAMETER_LIST@1180..1186 + 0: JS_FORMAL_PARAMETER@1180..1186 + 0: JS_DECORATOR_LIST@1180..1180 + 1: JS_IDENTIFIER_BINDING@1180..1181 + 0: IDENT@1180..1181 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1181..1186 + 0: COLON@1181..1183 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1183..1186 + 0: ANY_KW@1183..1186 "any" [] [] + 4: (empty) + 2: R_PAREN@1186..1187 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@1187..1196 + 0: COLON@1187..1189 ":" [] [Whitespace(" ")] + 1: TS_PREDICATE_RETURN_TYPE@1189..1196 + 0: JS_REFERENCE_IDENTIFIER@1189..1191 + 0: IDENT@1189..1191 "b" [] [Whitespace(" ")] + 1: IS_KW@1191..1194 "is" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1194..1196 + 0: JS_REFERENCE_IDENTIFIER@1194..1196 + 0: IDENT@1194..1196 "T" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@1196..1212 + 0: L_CURLY@1196..1198 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@1198..1198 + 2: JS_STATEMENT_LIST@1198..1211 + 0: JS_RETURN_STATEMENT@1198..1211 + 0: RETURN_KW@1198..1205 "return" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@1205..1209 + 0: TRUE_KW@1205..1209 "true" [] [] + 2: SEMICOLON@1209..1211 ";" [] [Whitespace(" ")] + 3: R_CURLY@1211..1212 "}" [] [] + 2: R_CURLY@1212..1214 "}" [Newline("\n")] [] + 1: (empty) + 4: EOF@1214..1215 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap new file mode 100644 index 000000000000..aa421125c7b5 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap @@ -0,0 +1,580 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +; +; +; +; +; +; +; +; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..4 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@4..5 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@6..7 "<" [] [], + slash_token: SLASH@7..8 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@8..10 "in" [] [], + }, + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@12..14 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@14..18 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@18..19 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@19..20 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@20..21 "<" [] [], + slash_token: SLASH@21..22 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@22..25 "out" [] [], + }, + r_angle_token: R_ANGLE@25..26 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@27..29 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@29..35 "const" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@35..36 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@36..37 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@37..38 "<" [] [], + slash_token: SLASH@38..39 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@39..44 "const" [] [], + }, + r_angle_token: R_ANGLE@44..45 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@45..46 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@46..48 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@48..51 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@51..55 "out" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@55..56 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@56..57 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@57..58 "<" [] [], + slash_token: SLASH@58..59 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@59..61 "in" [] [], + }, + r_angle_token: R_ANGLE@61..62 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@62..63 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@63..65 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@65..69 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@69..72 "in" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@72..73 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@73..74 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@74..75 "<" [] [], + slash_token: SLASH@75..76 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@76..79 "out" [] [], + }, + r_angle_token: R_ANGLE@79..80 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@80..81 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@81..83 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@83..86 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@86..88 "T" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@88..95 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@95..96 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@96..97 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@97..101 "true" [] [], + }, + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@102..103 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@103..104 "<" [] [], + slash_token: SLASH@104..105 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@105..107 "in" [] [], + }, + r_angle_token: R_ANGLE@107..108 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@108..109 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@109..111 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@111..115 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@115..117 "T" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@117..124 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@124..125 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@125..126 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@126..130 "true" [] [], + }, + r_curly_token: R_CURLY@130..131 "}" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@131..132 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@132..133 "<" [] [], + slash_token: SLASH@133..134 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@134..137 "out" [] [], + }, + r_angle_token: R_ANGLE@137..138 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@138..139 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@139..141 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@141..144 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@144..148 "out" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@148..150 "T" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@150..157 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@157..158 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@158..159 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@159..163 "true" [] [], + }, + r_curly_token: R_CURLY@163..164 "}" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@164..165 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@165..166 "<" [] [], + slash_token: SLASH@166..167 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@167..169 "in" [] [], + }, + r_angle_token: R_ANGLE@169..170 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@170..171 ";" [] [], + }, + ], + eof_token: EOF@171..172 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..172 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..171 + 0: JS_EXPRESSION_STATEMENT@0..12 + 0: JSX_TAG_EXPRESSION@0..11 + 0: JSX_ELEMENT@0..11 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..4 + 0: JSX_IDENT@1..4 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@4..5 + 0: JSX_ATTRIBUTE@4..5 + 0: JSX_NAME@4..5 + 0: JSX_IDENT@4..5 "T" [] [] + 1: (empty) + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..6 + 2: JSX_CLOSING_ELEMENT@6..11 + 0: L_ANGLE@6..7 "<" [] [] + 1: SLASH@7..8 "/" [] [] + 2: JSX_NAME@8..10 + 0: JSX_IDENT@8..10 "in" [] [] + 3: R_ANGLE@10..11 ">" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@12..27 + 0: JSX_TAG_EXPRESSION@12..26 + 0: JSX_ELEMENT@12..26 + 0: JSX_OPENING_ELEMENT@12..20 + 0: L_ANGLE@12..14 "<" [Newline("\n")] [] + 1: JSX_NAME@14..18 + 0: JSX_IDENT@14..18 "out" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@18..19 + 0: JSX_ATTRIBUTE@18..19 + 0: JSX_NAME@18..19 + 0: JSX_IDENT@18..19 "T" [] [] + 1: (empty) + 4: R_ANGLE@19..20 ">" [] [] + 1: JSX_CHILD_LIST@20..20 + 2: JSX_CLOSING_ELEMENT@20..26 + 0: L_ANGLE@20..21 "<" [] [] + 1: SLASH@21..22 "/" [] [] + 2: JSX_NAME@22..25 + 0: JSX_IDENT@22..25 "out" [] [] + 3: R_ANGLE@25..26 ">" [] [] + 1: SEMICOLON@26..27 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@27..46 + 0: JSX_TAG_EXPRESSION@27..45 + 0: JSX_ELEMENT@27..45 + 0: JSX_OPENING_ELEMENT@27..37 + 0: L_ANGLE@27..29 "<" [Newline("\n")] [] + 1: JSX_NAME@29..35 + 0: JSX_IDENT@29..35 "const" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@35..36 + 0: JSX_ATTRIBUTE@35..36 + 0: JSX_NAME@35..36 + 0: JSX_IDENT@35..36 "T" [] [] + 1: (empty) + 4: R_ANGLE@36..37 ">" [] [] + 1: JSX_CHILD_LIST@37..37 + 2: JSX_CLOSING_ELEMENT@37..45 + 0: L_ANGLE@37..38 "<" [] [] + 1: SLASH@38..39 "/" [] [] + 2: JSX_NAME@39..44 + 0: JSX_IDENT@39..44 "const" [] [] + 3: R_ANGLE@44..45 ">" [] [] + 1: SEMICOLON@45..46 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@46..63 + 0: JSX_TAG_EXPRESSION@46..62 + 0: JSX_ELEMENT@46..62 + 0: JSX_OPENING_ELEMENT@46..57 + 0: L_ANGLE@46..48 "<" [Newline("\n")] [] + 1: JSX_NAME@48..51 + 0: JSX_IDENT@48..51 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@51..56 + 0: JSX_ATTRIBUTE@51..55 + 0: JSX_NAME@51..55 + 0: JSX_IDENT@51..55 "out" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@55..56 + 0: JSX_NAME@55..56 + 0: JSX_IDENT@55..56 "T" [] [] + 1: (empty) + 4: R_ANGLE@56..57 ">" [] [] + 1: JSX_CHILD_LIST@57..57 + 2: JSX_CLOSING_ELEMENT@57..62 + 0: L_ANGLE@57..58 "<" [] [] + 1: SLASH@58..59 "/" [] [] + 2: JSX_NAME@59..61 + 0: JSX_IDENT@59..61 "in" [] [] + 3: R_ANGLE@61..62 ">" [] [] + 1: SEMICOLON@62..63 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@63..81 + 0: JSX_TAG_EXPRESSION@63..80 + 0: JSX_ELEMENT@63..80 + 0: JSX_OPENING_ELEMENT@63..74 + 0: L_ANGLE@63..65 "<" [Newline("\n")] [] + 1: JSX_NAME@65..69 + 0: JSX_IDENT@65..69 "out" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@69..73 + 0: JSX_ATTRIBUTE@69..72 + 0: JSX_NAME@69..72 + 0: JSX_IDENT@69..72 "in" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@72..73 + 0: JSX_NAME@72..73 + 0: JSX_IDENT@72..73 "T" [] [] + 1: (empty) + 4: R_ANGLE@73..74 ">" [] [] + 1: JSX_CHILD_LIST@74..74 + 2: JSX_CLOSING_ELEMENT@74..80 + 0: L_ANGLE@74..75 "<" [] [] + 1: SLASH@75..76 "/" [] [] + 2: JSX_NAME@76..79 + 0: JSX_IDENT@76..79 "out" [] [] + 3: R_ANGLE@79..80 ">" [] [] + 1: SEMICOLON@80..81 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@81..109 + 0: JSX_TAG_EXPRESSION@81..108 + 0: JSX_ELEMENT@81..108 + 0: JSX_OPENING_ELEMENT@81..103 + 0: L_ANGLE@81..83 "<" [Newline("\n")] [] + 1: JSX_NAME@83..86 + 0: JSX_IDENT@83..86 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@86..102 + 0: JSX_ATTRIBUTE@86..88 + 0: JSX_NAME@86..88 + 0: JSX_IDENT@86..88 "T" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@88..102 + 0: JSX_NAME@88..95 + 0: JSX_IDENT@88..95 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@95..102 + 0: EQ@95..96 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@96..102 + 0: L_CURLY@96..97 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@97..101 + 0: TRUE_KW@97..101 "true" [] [] + 2: R_CURLY@101..102 "}" [] [] + 4: R_ANGLE@102..103 ">" [] [] + 1: JSX_CHILD_LIST@103..103 + 2: JSX_CLOSING_ELEMENT@103..108 + 0: L_ANGLE@103..104 "<" [] [] + 1: SLASH@104..105 "/" [] [] + 2: JSX_NAME@105..107 + 0: JSX_IDENT@105..107 "in" [] [] + 3: R_ANGLE@107..108 ">" [] [] + 1: SEMICOLON@108..109 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@109..139 + 0: JSX_TAG_EXPRESSION@109..138 + 0: JSX_ELEMENT@109..138 + 0: JSX_OPENING_ELEMENT@109..132 + 0: L_ANGLE@109..111 "<" [Newline("\n")] [] + 1: JSX_NAME@111..115 + 0: JSX_IDENT@111..115 "out" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@115..131 + 0: JSX_ATTRIBUTE@115..117 + 0: JSX_NAME@115..117 + 0: JSX_IDENT@115..117 "T" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@117..131 + 0: JSX_NAME@117..124 + 0: JSX_IDENT@117..124 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@124..131 + 0: EQ@124..125 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@125..131 + 0: L_CURLY@125..126 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@126..130 + 0: TRUE_KW@126..130 "true" [] [] + 2: R_CURLY@130..131 "}" [] [] + 4: R_ANGLE@131..132 ">" [] [] + 1: JSX_CHILD_LIST@132..132 + 2: JSX_CLOSING_ELEMENT@132..138 + 0: L_ANGLE@132..133 "<" [] [] + 1: SLASH@133..134 "/" [] [] + 2: JSX_NAME@134..137 + 0: JSX_IDENT@134..137 "out" [] [] + 3: R_ANGLE@137..138 ">" [] [] + 1: SEMICOLON@138..139 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@139..171 + 0: JSX_TAG_EXPRESSION@139..170 + 0: JSX_ELEMENT@139..170 + 0: JSX_OPENING_ELEMENT@139..165 + 0: L_ANGLE@139..141 "<" [Newline("\n")] [] + 1: JSX_NAME@141..144 + 0: JSX_IDENT@141..144 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@144..164 + 0: JSX_ATTRIBUTE@144..148 + 0: JSX_NAME@144..148 + 0: JSX_IDENT@144..148 "out" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@148..150 + 0: JSX_NAME@148..150 + 0: JSX_IDENT@148..150 "T" [] [Whitespace(" ")] + 1: (empty) + 2: JSX_ATTRIBUTE@150..164 + 0: JSX_NAME@150..157 + 0: JSX_IDENT@150..157 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@157..164 + 0: EQ@157..158 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@158..164 + 0: L_CURLY@158..159 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@159..163 + 0: TRUE_KW@159..163 "true" [] [] + 2: R_CURLY@163..164 "}" [] [] + 4: R_ANGLE@164..165 ">" [] [] + 1: JSX_CHILD_LIST@165..165 + 2: JSX_CLOSING_ELEMENT@165..170 + 0: L_ANGLE@165..166 "<" [] [] + 1: SLASH@166..167 "/" [] [] + 2: JSX_NAME@167..169 + 0: JSX_IDENT@167..169 "in" [] [] + 3: R_ANGLE@169..170 ">" [] [] + 1: SEMICOLON@170..171 ";" [] [] + 4: EOF@171..172 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_enum.ts b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/typescript_enum.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts.snap new file mode 100644 index 000000000000..e47bd46effe1 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts.snap @@ -0,0 +1,208 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum A {} +enum B { a, b, c } +const enum C { A = 1, B = A * 2, ["A"] = 3, } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@0..5 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@5..7 "A" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@7..8 "{" [] [], + members: TsEnumMemberList [], + r_curly_token: R_CURLY@8..9 "}" [] [], + }, + TsEnumDeclaration { + const_token: missing (optional), + enum_token: ENUM_KW@9..15 "enum" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@15..17 "B" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@17..19 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@19..20 "a" [] [], + }, + initializer: missing (optional), + }, + COMMA@20..22 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@22..23 "b" [] [], + }, + initializer: missing (optional), + }, + COMMA@23..25 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@25..27 "c" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + ], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + TsEnumDeclaration { + const_token: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")], + enum_token: ENUM_KW@35..40 "enum" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@40..42 "C" [] [Whitespace(" ")], + }, + l_curly_token: L_CURLY@42..44 "{" [] [Whitespace(" ")], + members: TsEnumMemberList [ + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@44..46 "A" [] [Whitespace(" ")], + }, + initializer: JsInitializerClause { + eq_token: EQ@46..48 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@48..49 "1" [] [], + }, + }, + }, + COMMA@49..51 "," [] [Whitespace(" ")], + TsEnumMember { + name: TsLiteralEnumMemberName { + value: IDENT@51..53 "B" [] [Whitespace(" ")], + }, + initializer: JsInitializerClause { + eq_token: EQ@53..55 "=" [] [Whitespace(" ")], + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..57 "A" [] [Whitespace(" ")], + }, + }, + operator_token: STAR@57..59 "*" [] [Whitespace(" ")], + right: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@59..60 "2" [] [], + }, + }, + }, + }, + COMMA@60..62 "," [] [Whitespace(" ")], + TsEnumMember { + name: JsComputedMemberName { + l_brack_token: L_BRACK@62..63 "[" [] [], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@63..66 "\"A\"" [] [], + }, + r_brack_token: R_BRACK@66..68 "]" [] [Whitespace(" ")], + }, + initializer: JsInitializerClause { + eq_token: EQ@68..70 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@70..71 "3" [] [], + }, + }, + }, + COMMA@71..73 "," [] [Whitespace(" ")], + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..74 + 0: TS_ENUM_DECLARATION@0..9 + 0: (empty) + 1: ENUM_KW@0..5 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 3: L_CURLY@7..8 "{" [] [] + 4: TS_ENUM_MEMBER_LIST@8..8 + 5: R_CURLY@8..9 "}" [] [] + 1: TS_ENUM_DECLARATION@9..28 + 0: (empty) + 1: ENUM_KW@9..15 "enum" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@15..17 + 0: IDENT@15..17 "B" [] [Whitespace(" ")] + 3: L_CURLY@17..19 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@19..27 + 0: TS_ENUM_MEMBER@19..20 + 0: TS_LITERAL_ENUM_MEMBER_NAME@19..20 + 0: IDENT@19..20 "a" [] [] + 1: (empty) + 1: COMMA@20..22 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@22..23 + 0: TS_LITERAL_ENUM_MEMBER_NAME@22..23 + 0: IDENT@22..23 "b" [] [] + 1: (empty) + 3: COMMA@23..25 "," [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER@25..27 + 0: TS_LITERAL_ENUM_MEMBER_NAME@25..27 + 0: IDENT@25..27 "c" [] [Whitespace(" ")] + 1: (empty) + 5: R_CURLY@27..28 "}" [] [] + 2: TS_ENUM_DECLARATION@28..74 + 0: CONST_KW@28..35 "const" [Newline("\n")] [Whitespace(" ")] + 1: ENUM_KW@35..40 "enum" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "C" [] [Whitespace(" ")] + 3: L_CURLY@42..44 "{" [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER_LIST@44..73 + 0: TS_ENUM_MEMBER@44..49 + 0: TS_LITERAL_ENUM_MEMBER_NAME@44..46 + 0: IDENT@44..46 "A" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@46..49 + 0: EQ@46..48 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@48..49 + 0: JS_NUMBER_LITERAL@48..49 "1" [] [] + 1: COMMA@49..51 "," [] [Whitespace(" ")] + 2: TS_ENUM_MEMBER@51..60 + 0: TS_LITERAL_ENUM_MEMBER_NAME@51..53 + 0: IDENT@51..53 "B" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@53..60 + 0: EQ@53..55 "=" [] [Whitespace(" ")] + 1: JS_BINARY_EXPRESSION@55..60 + 0: JS_IDENTIFIER_EXPRESSION@55..57 + 0: JS_REFERENCE_IDENTIFIER@55..57 + 0: IDENT@55..57 "A" [] [Whitespace(" ")] + 1: STAR@57..59 "*" [] [Whitespace(" ")] + 2: JS_NUMBER_LITERAL_EXPRESSION@59..60 + 0: JS_NUMBER_LITERAL@59..60 "2" [] [] + 3: COMMA@60..62 "," [] [Whitespace(" ")] + 4: TS_ENUM_MEMBER@62..71 + 0: JS_COMPUTED_MEMBER_NAME@62..68 + 0: L_BRACK@62..63 "[" [] [] + 1: JS_STRING_LITERAL_EXPRESSION@63..66 + 0: JS_STRING_LITERAL@63..66 "\"A\"" [] [] + 2: R_BRACK@66..68 "]" [] [Whitespace(" ")] + 1: JS_INITIALIZER_CLAUSE@68..71 + 0: EQ@68..70 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@70..71 + 0: JS_NUMBER_LITERAL@70..71 "3" [] [] + 5: COMMA@71..73 "," [] [Whitespace(" ")] + 5: R_CURLY@73..74 "}" [] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.ts b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap new file mode 100644 index 000000000000..0202f8f9b603 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default abstract class {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + decorators: JsDecoratorList [], + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + decorators: JsDecoratorList [], + abstract_token: ABSTRACT_KW@15..24 "abstract" [] [Whitespace(" ")], + class_token: CLASS_KW@24..30 "class" [] [Whitespace(" ")], + id: missing (optional), + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@30..31 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@31..32 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + ], + eof_token: EOF@32..33 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..33 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..32 + 0: JS_EXPORT@0..32 + 0: JS_DECORATOR_LIST@0..0 + 1: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 2: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..32 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@15..32 + 0: JS_DECORATOR_LIST@15..15 + 1: ABSTRACT_KW@15..24 "abstract" [] [Whitespace(" ")] + 2: CLASS_KW@24..30 "class" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@30..31 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@31..31 + 9: R_CURLY@31..32 "}" [] [] + 2: (empty) + 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap new file mode 100644 index 000000000000..41c7f605bd68 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap @@ -0,0 +1,361 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class Test { + constructor(); + name(); + get test(): string; + set test(v); +} +declare namespace n { + class Test { + constructor() + name() + get test(): string + set test(v) + } +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsDeclareStatement { + declare_token: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")], + declaration: JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@8..14 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@14..19 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@19..20 "{" [] [], + members: JsClassMemberList [ + TsConstructorSignatureClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@36..37 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@37..38 ")" [] [], + }, + semicolon_token: SEMICOLON@38..39 ";" [] [], + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@39..48 "name" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@48..49 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@49..50 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + TsGetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + get_token: GET_KW@51..60 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@60..64 "test" [] [], + }, + l_paren_token: L_PAREN@64..65 "(" [] [], + r_paren_token: R_PAREN@65..66 ")" [] [], + return_type: TsTypeAnnotation { + colon_token: COLON@66..68 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@68..74 "string" [] [], + }, + }, + semicolon_token: SEMICOLON@74..75 ";" [] [], + }, + TsSetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + set_token: SET_KW@75..84 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@84..88 "test" [] [], + }, + l_paren_token: L_PAREN@88..89 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@89..90 "v" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@90..91 ")" [] [], + semicolon_token: SEMICOLON@91..92 ";" [] [], + }, + ], + r_curly_token: R_CURLY@92..94 "}" [Newline("\n")] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@94..103 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsModuleDeclaration { + module_or_namespace: NAMESPACE_KW@103..113 "namespace" [] [Whitespace(" ")], + name: TsIdentifierBinding { + name_token: IDENT@113..115 "n" [] [Whitespace(" ")], + }, + body: TsModuleBlock { + l_curly_token: L_CURLY@115..116 "{" [] [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@116..128 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@128..133 "Test" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@133..134 "{" [] [], + members: JsClassMemberList [ + TsConstructorSignatureClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@134..155 "constructor" [Newline("\n"), Whitespace(" ")] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@155..156 "(" [] [], + parameters: JsConstructorParameterList [], + r_paren_token: R_PAREN@156..157 ")" [] [], + }, + semicolon_token: missing (optional), + }, + TsMethodSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + async_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@157..171 "name" [Newline("\n"), Whitespace(" ")] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@171..172 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@172..173 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + TsGetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + get_token: GET_KW@173..187 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@187..191 "test" [] [], + }, + l_paren_token: L_PAREN@191..192 "(" [] [], + r_paren_token: R_PAREN@192..193 ")" [] [], + return_type: TsTypeAnnotation { + colon_token: COLON@193..195 ":" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@195..201 "string" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsSetterSignatureClassMember { + modifiers: TsMethodSignatureModifierList [], + set_token: SET_KW@201..215 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + name: JsLiteralMemberName { + value: IDENT@215..219 "test" [] [], + }, + l_paren_token: L_PAREN@219..220 "(" [] [], + parameter: JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@220..221 "v" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + comma_token: missing (optional), + r_paren_token: R_PAREN@221..222 ")" [] [], + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@222..229 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@229..231 "}" [Newline("\n")] [], + }, + }, + }, + ], + eof_token: EOF@231..232 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..232 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..231 + 0: TS_DECLARE_STATEMENT@0..94 + 0: DECLARE_KW@0..8 "declare" [] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@8..94 + 0: JS_DECORATOR_LIST@8..8 + 1: (empty) + 2: CLASS_KW@8..14 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@14..19 + 0: IDENT@14..19 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@19..20 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@20..92 + 0: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@20..39 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..36 + 0: IDENT@20..36 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@36..38 + 0: L_PAREN@36..37 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@37..37 + 2: R_PAREN@37..38 ")" [] [] + 3: SEMICOLON@38..39 ";" [] [] + 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@39..51 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@39..39 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@39..48 + 0: IDENT@39..48 "name" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@48..50 + 0: L_PAREN@48..49 "(" [] [] + 1: JS_PARAMETER_LIST@49..49 + 2: R_PAREN@49..50 ")" [] [] + 6: (empty) + 7: SEMICOLON@50..51 ";" [] [] + 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@51..75 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@51..51 + 1: GET_KW@51..60 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@60..64 + 0: IDENT@60..64 "test" [] [] + 3: L_PAREN@64..65 "(" [] [] + 4: R_PAREN@65..66 ")" [] [] + 5: TS_TYPE_ANNOTATION@66..74 + 0: COLON@66..68 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@68..74 + 0: STRING_KW@68..74 "string" [] [] + 6: SEMICOLON@74..75 ";" [] [] + 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@75..92 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@75..75 + 1: SET_KW@75..84 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@84..88 + 0: IDENT@84..88 "test" [] [] + 3: L_PAREN@88..89 "(" [] [] + 4: JS_FORMAL_PARAMETER@89..90 + 0: JS_DECORATOR_LIST@89..89 + 1: JS_IDENTIFIER_BINDING@89..90 + 0: IDENT@89..90 "v" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@90..91 ")" [] [] + 7: SEMICOLON@91..92 ";" [] [] + 9: R_CURLY@92..94 "}" [Newline("\n")] [] + 1: TS_DECLARE_STATEMENT@94..231 + 0: DECLARE_KW@94..103 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_MODULE_DECLARATION@103..231 + 0: NAMESPACE_KW@103..113 "namespace" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@113..115 + 0: IDENT@113..115 "n" [] [Whitespace(" ")] + 2: TS_MODULE_BLOCK@115..231 + 0: L_CURLY@115..116 "{" [] [] + 1: JS_MODULE_ITEM_LIST@116..229 + 0: JS_CLASS_DECLARATION@116..229 + 0: JS_DECORATOR_LIST@116..116 + 1: (empty) + 2: CLASS_KW@116..128 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@128..133 + 0: IDENT@128..133 "Test" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@133..134 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@134..222 + 0: TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER@134..157 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@134..134 + 1: JS_LITERAL_MEMBER_NAME@134..155 + 0: IDENT@134..155 "constructor" [Newline("\n"), Whitespace(" ")] [] + 2: JS_CONSTRUCTOR_PARAMETERS@155..157 + 0: L_PAREN@155..156 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@156..156 + 2: R_PAREN@156..157 ")" [] [] + 3: (empty) + 1: TS_METHOD_SIGNATURE_CLASS_MEMBER@157..173 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@157..157 + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@157..171 + 0: IDENT@157..171 "name" [Newline("\n"), Whitespace(" ")] [] + 3: (empty) + 4: (empty) + 5: JS_PARAMETERS@171..173 + 0: L_PAREN@171..172 "(" [] [] + 1: JS_PARAMETER_LIST@172..172 + 2: R_PAREN@172..173 ")" [] [] + 6: (empty) + 7: (empty) + 2: TS_GETTER_SIGNATURE_CLASS_MEMBER@173..201 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@173..173 + 1: GET_KW@173..187 "get" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@187..191 + 0: IDENT@187..191 "test" [] [] + 3: L_PAREN@191..192 "(" [] [] + 4: R_PAREN@192..193 ")" [] [] + 5: TS_TYPE_ANNOTATION@193..201 + 0: COLON@193..195 ":" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@195..201 + 0: STRING_KW@195..201 "string" [] [] + 6: (empty) + 3: TS_SETTER_SIGNATURE_CLASS_MEMBER@201..222 + 0: TS_METHOD_SIGNATURE_MODIFIER_LIST@201..201 + 1: SET_KW@201..215 "set" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_LITERAL_MEMBER_NAME@215..219 + 0: IDENT@215..219 "test" [] [] + 3: L_PAREN@219..220 "(" [] [] + 4: JS_FORMAL_PARAMETER@220..221 + 0: JS_DECORATOR_LIST@220..220 + 1: JS_IDENTIFIER_BINDING@220..221 + 0: IDENT@220..221 "v" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: (empty) + 6: R_PAREN@221..222 ")" [] [] + 7: (empty) + 9: R_CURLY@222..229 "}" [Newline("\n"), Whitespace(" ")] [] + 2: R_CURLY@229..231 "}" [Newline("\n")] [] + 4: EOF@231..232 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete.js b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/unary_delete.js rename to crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js.snap new file mode 100644 index 000000000000..d440b6427c1a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js.snap @@ -0,0 +1,1293 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete obj.key; +delete (obj).key; +delete obj.#member.key; +delete (obj.#member).key; +delete func().#member.key; +delete (func().#member).key; +delete obj?.#member.key; +delete (obj?.#member).key; +delete obj?.inner.#member.key; +delete (obj?.inner.#member).key; +delete obj[key]; +delete (obj)[key]; +delete obj.#member[key]; +delete (obj.#member)[key]; +delete func().#member[key]; +delete (func().#member)[key]; +delete obj?.#member[key]; +delete (obj?.#member)[key]; +delete obj?.inner.#member[key]; +delete (obj?.inner.#member)[key]; +delete (obj.#key, obj.key); +delete (#key in obj); +delete (obj.key); +delete (console.log(1)); +delete (() => {}); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@0..7 "delete" [] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@7..10 "obj" [] [], + }, + }, + operator_token: DOT@10..11 "." [] [], + member: JsName { + value_token: IDENT@11..14 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@14..15 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@23..24 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@24..27 "obj" [] [], + }, + }, + r_paren_token: R_PAREN@27..28 ")" [] [], + }, + operator_token: DOT@28..29 "." [] [], + member: JsName { + value_token: IDENT@29..32 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@32..33 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..44 "obj" [] [], + }, + }, + operator_token: DOT@44..45 "." [] [], + member: JsPrivateName { + hash_token: HASH@45..46 "#" [] [], + value_token: IDENT@46..52 "member" [] [], + }, + }, + operator_token: DOT@52..53 "." [] [], + member: JsName { + value_token: IDENT@53..56 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@56..57 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@57..65 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@65..66 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@66..69 "obj" [] [], + }, + }, + operator_token: DOT@69..70 "." [] [], + member: JsPrivateName { + hash_token: HASH@70..71 "#" [] [], + value_token: IDENT@71..77 "member" [] [], + }, + }, + r_paren_token: R_PAREN@77..78 ")" [] [], + }, + operator_token: DOT@78..79 "." [] [], + member: JsName { + value_token: IDENT@79..82 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@82..83 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@83..91 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@91..95 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@95..96 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@96..97 ")" [] [], + }, + }, + operator_token: DOT@97..98 "." [] [], + member: JsPrivateName { + hash_token: HASH@98..99 "#" [] [], + value_token: IDENT@99..105 "member" [] [], + }, + }, + operator_token: DOT@105..106 "." [] [], + member: JsName { + value_token: IDENT@106..109 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@109..110 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@110..118 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@118..119 "(" [] [], + expression: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@119..123 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@123..124 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@124..125 ")" [] [], + }, + }, + operator_token: DOT@125..126 "." [] [], + member: JsPrivateName { + hash_token: HASH@126..127 "#" [] [], + value_token: IDENT@127..133 "member" [] [], + }, + }, + r_paren_token: R_PAREN@133..134 ")" [] [], + }, + operator_token: DOT@134..135 "." [] [], + member: JsName { + value_token: IDENT@135..138 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@138..139 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@139..147 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@147..150 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@150..152 "?." [] [], + member: JsPrivateName { + hash_token: HASH@152..153 "#" [] [], + value_token: IDENT@153..159 "member" [] [], + }, + }, + operator_token: DOT@159..160 "." [] [], + member: JsName { + value_token: IDENT@160..163 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@163..164 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@164..172 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@172..173 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@173..176 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@176..178 "?." [] [], + member: JsPrivateName { + hash_token: HASH@178..179 "#" [] [], + value_token: IDENT@179..185 "member" [] [], + }, + }, + r_paren_token: R_PAREN@185..186 ")" [] [], + }, + operator_token: DOT@186..187 "." [] [], + member: JsName { + value_token: IDENT@187..190 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@190..191 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@191..199 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@199..202 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@202..204 "?." [] [], + member: JsName { + value_token: IDENT@204..209 "inner" [] [], + }, + }, + operator_token: DOT@209..210 "." [] [], + member: JsPrivateName { + hash_token: HASH@210..211 "#" [] [], + value_token: IDENT@211..217 "member" [] [], + }, + }, + operator_token: DOT@217..218 "." [] [], + member: JsName { + value_token: IDENT@218..221 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@221..222 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@222..230 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsStaticMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@230..231 "(" [] [], + expression: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@231..234 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@234..236 "?." [] [], + member: JsName { + value_token: IDENT@236..241 "inner" [] [], + }, + }, + operator_token: DOT@241..242 "." [] [], + member: JsPrivateName { + hash_token: HASH@242..243 "#" [] [], + value_token: IDENT@243..249 "member" [] [], + }, + }, + r_paren_token: R_PAREN@249..250 ")" [] [], + }, + operator_token: DOT@250..251 "." [] [], + member: JsName { + value_token: IDENT@251..254 "key" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@254..255 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@255..263 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@263..266 "obj" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@266..267 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@267..270 "key" [] [], + }, + }, + r_brack_token: R_BRACK@270..271 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@271..272 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@272..280 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@280..281 "(" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@281..284 "obj" [] [], + }, + }, + r_paren_token: R_PAREN@284..285 ")" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@285..286 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@286..289 "key" [] [], + }, + }, + r_brack_token: R_BRACK@289..290 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@290..291 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@291..299 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@299..302 "obj" [] [], + }, + }, + operator_token: DOT@302..303 "." [] [], + member: JsPrivateName { + hash_token: HASH@303..304 "#" [] [], + value_token: IDENT@304..310 "member" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@310..311 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@311..314 "key" [] [], + }, + }, + r_brack_token: R_BRACK@314..315 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@315..316 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@316..324 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@324..325 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@325..328 "obj" [] [], + }, + }, + operator_token: DOT@328..329 "." [] [], + member: JsPrivateName { + hash_token: HASH@329..330 "#" [] [], + value_token: IDENT@330..336 "member" [] [], + }, + }, + r_paren_token: R_PAREN@336..337 ")" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@337..338 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@338..341 "key" [] [], + }, + }, + r_brack_token: R_BRACK@341..342 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@342..343 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@343..351 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@351..355 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@355..356 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@356..357 ")" [] [], + }, + }, + operator_token: DOT@357..358 "." [] [], + member: JsPrivateName { + hash_token: HASH@358..359 "#" [] [], + value_token: IDENT@359..365 "member" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@365..366 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@366..369 "key" [] [], + }, + }, + r_brack_token: R_BRACK@369..370 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@370..371 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@371..379 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@379..380 "(" [] [], + expression: JsStaticMemberExpression { + object: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@380..384 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@384..385 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@385..386 ")" [] [], + }, + }, + operator_token: DOT@386..387 "." [] [], + member: JsPrivateName { + hash_token: HASH@387..388 "#" [] [], + value_token: IDENT@388..394 "member" [] [], + }, + }, + r_paren_token: R_PAREN@394..395 ")" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@395..396 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@396..399 "key" [] [], + }, + }, + r_brack_token: R_BRACK@399..400 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@400..401 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@401..409 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@409..412 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@412..414 "?." [] [], + member: JsPrivateName { + hash_token: HASH@414..415 "#" [] [], + value_token: IDENT@415..421 "member" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@421..422 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@422..425 "key" [] [], + }, + }, + r_brack_token: R_BRACK@425..426 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@426..427 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@427..435 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@435..436 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@436..439 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@439..441 "?." [] [], + member: JsPrivateName { + hash_token: HASH@441..442 "#" [] [], + value_token: IDENT@442..448 "member" [] [], + }, + }, + r_paren_token: R_PAREN@448..449 ")" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@449..450 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@450..453 "key" [] [], + }, + }, + r_brack_token: R_BRACK@453..454 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@454..455 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@455..463 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@463..466 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@466..468 "?." [] [], + member: JsName { + value_token: IDENT@468..473 "inner" [] [], + }, + }, + operator_token: DOT@473..474 "." [] [], + member: JsPrivateName { + hash_token: HASH@474..475 "#" [] [], + value_token: IDENT@475..481 "member" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@481..482 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@482..485 "key" [] [], + }, + }, + r_brack_token: R_BRACK@485..486 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@486..487 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@487..495 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsParenthesizedExpression { + l_paren_token: L_PAREN@495..496 "(" [] [], + expression: JsStaticMemberExpression { + object: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@496..499 "obj" [] [], + }, + }, + operator_token: QUESTIONDOT@499..501 "?." [] [], + member: JsName { + value_token: IDENT@501..506 "inner" [] [], + }, + }, + operator_token: DOT@506..507 "." [] [], + member: JsPrivateName { + hash_token: HASH@507..508 "#" [] [], + value_token: IDENT@508..514 "member" [] [], + }, + }, + r_paren_token: R_PAREN@514..515 ")" [] [], + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@515..516 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@516..519 "key" [] [], + }, + }, + r_brack_token: R_BRACK@519..520 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@520..521 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@521..529 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@529..530 "(" [] [], + expression: JsSequenceExpression { + left: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@530..533 "obj" [] [], + }, + }, + operator_token: DOT@533..534 "." [] [], + member: JsPrivateName { + hash_token: HASH@534..535 "#" [] [], + value_token: IDENT@535..538 "key" [] [], + }, + }, + comma_token: COMMA@538..540 "," [] [Whitespace(" ")], + right: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@540..543 "obj" [] [], + }, + }, + operator_token: DOT@543..544 "." [] [], + member: JsName { + value_token: IDENT@544..547 "key" [] [], + }, + }, + }, + r_paren_token: R_PAREN@547..548 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@548..549 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@549..557 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@557..558 "(" [] [], + expression: JsInExpression { + property: JsPrivateName { + hash_token: HASH@558..559 "#" [] [], + value_token: IDENT@559..563 "key" [] [Whitespace(" ")], + }, + in_token: IN_KW@563..566 "in" [] [Whitespace(" ")], + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@566..569 "obj" [] [], + }, + }, + }, + r_paren_token: R_PAREN@569..570 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@570..571 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@571..579 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@579..580 "(" [] [], + expression: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@580..583 "obj" [] [], + }, + }, + operator_token: DOT@583..584 "." [] [], + member: JsName { + value_token: IDENT@584..587 "key" [] [], + }, + }, + r_paren_token: R_PAREN@587..588 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@588..589 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@589..597 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@597..598 "(" [] [], + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@598..605 "console" [] [], + }, + }, + operator_token: DOT@605..606 "." [] [], + member: JsName { + value_token: IDENT@606..609 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@609..610 "(" [] [], + args: JsCallArgumentList [ + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@610..611 "1" [] [], + }, + ], + r_paren_token: R_PAREN@611..612 ")" [] [], + }, + }, + r_paren_token: R_PAREN@612..613 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@613..614 ";" [] [], + }, + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@614..622 "delete" [Newline("\n")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@622..623 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@623..624 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@624..626 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@626..629 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@629..630 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@630..631 "}" [] [], + }, + }, + r_paren_token: R_PAREN@631..632 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@632..633 ";" [] [], + }, + ], + eof_token: EOF@633..634 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..634 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..633 + 0: JS_EXPRESSION_STATEMENT@0..15 + 0: JS_UNARY_EXPRESSION@0..14 + 0: DELETE_KW@0..7 "delete" [] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@7..14 + 0: JS_IDENTIFIER_EXPRESSION@7..10 + 0: JS_REFERENCE_IDENTIFIER@7..10 + 0: IDENT@7..10 "obj" [] [] + 1: DOT@10..11 "." [] [] + 2: JS_NAME@11..14 + 0: IDENT@11..14 "key" [] [] + 1: SEMICOLON@14..15 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@15..33 + 0: JS_UNARY_EXPRESSION@15..32 + 0: DELETE_KW@15..23 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@23..32 + 0: JS_PARENTHESIZED_EXPRESSION@23..28 + 0: L_PAREN@23..24 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@24..27 + 0: JS_REFERENCE_IDENTIFIER@24..27 + 0: IDENT@24..27 "obj" [] [] + 2: R_PAREN@27..28 ")" [] [] + 1: DOT@28..29 "." [] [] + 2: JS_NAME@29..32 + 0: IDENT@29..32 "key" [] [] + 1: SEMICOLON@32..33 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@33..57 + 0: JS_UNARY_EXPRESSION@33..56 + 0: DELETE_KW@33..41 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@41..56 + 0: JS_STATIC_MEMBER_EXPRESSION@41..52 + 0: JS_IDENTIFIER_EXPRESSION@41..44 + 0: JS_REFERENCE_IDENTIFIER@41..44 + 0: IDENT@41..44 "obj" [] [] + 1: DOT@44..45 "." [] [] + 2: JS_PRIVATE_NAME@45..52 + 0: HASH@45..46 "#" [] [] + 1: IDENT@46..52 "member" [] [] + 1: DOT@52..53 "." [] [] + 2: JS_NAME@53..56 + 0: IDENT@53..56 "key" [] [] + 1: SEMICOLON@56..57 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@57..83 + 0: JS_UNARY_EXPRESSION@57..82 + 0: DELETE_KW@57..65 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@65..82 + 0: JS_PARENTHESIZED_EXPRESSION@65..78 + 0: L_PAREN@65..66 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@66..77 + 0: JS_IDENTIFIER_EXPRESSION@66..69 + 0: JS_REFERENCE_IDENTIFIER@66..69 + 0: IDENT@66..69 "obj" [] [] + 1: DOT@69..70 "." [] [] + 2: JS_PRIVATE_NAME@70..77 + 0: HASH@70..71 "#" [] [] + 1: IDENT@71..77 "member" [] [] + 2: R_PAREN@77..78 ")" [] [] + 1: DOT@78..79 "." [] [] + 2: JS_NAME@79..82 + 0: IDENT@79..82 "key" [] [] + 1: SEMICOLON@82..83 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@83..110 + 0: JS_UNARY_EXPRESSION@83..109 + 0: DELETE_KW@83..91 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@91..109 + 0: JS_STATIC_MEMBER_EXPRESSION@91..105 + 0: JS_CALL_EXPRESSION@91..97 + 0: JS_IDENTIFIER_EXPRESSION@91..95 + 0: JS_REFERENCE_IDENTIFIER@91..95 + 0: IDENT@91..95 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@95..97 + 0: L_PAREN@95..96 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@96..96 + 2: R_PAREN@96..97 ")" [] [] + 1: DOT@97..98 "." [] [] + 2: JS_PRIVATE_NAME@98..105 + 0: HASH@98..99 "#" [] [] + 1: IDENT@99..105 "member" [] [] + 1: DOT@105..106 "." [] [] + 2: JS_NAME@106..109 + 0: IDENT@106..109 "key" [] [] + 1: SEMICOLON@109..110 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@110..139 + 0: JS_UNARY_EXPRESSION@110..138 + 0: DELETE_KW@110..118 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@118..138 + 0: JS_PARENTHESIZED_EXPRESSION@118..134 + 0: L_PAREN@118..119 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@119..133 + 0: JS_CALL_EXPRESSION@119..125 + 0: JS_IDENTIFIER_EXPRESSION@119..123 + 0: JS_REFERENCE_IDENTIFIER@119..123 + 0: IDENT@119..123 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@123..125 + 0: L_PAREN@123..124 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@124..124 + 2: R_PAREN@124..125 ")" [] [] + 1: DOT@125..126 "." [] [] + 2: JS_PRIVATE_NAME@126..133 + 0: HASH@126..127 "#" [] [] + 1: IDENT@127..133 "member" [] [] + 2: R_PAREN@133..134 ")" [] [] + 1: DOT@134..135 "." [] [] + 2: JS_NAME@135..138 + 0: IDENT@135..138 "key" [] [] + 1: SEMICOLON@138..139 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@139..164 + 0: JS_UNARY_EXPRESSION@139..163 + 0: DELETE_KW@139..147 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@147..163 + 0: JS_STATIC_MEMBER_EXPRESSION@147..159 + 0: JS_IDENTIFIER_EXPRESSION@147..150 + 0: JS_REFERENCE_IDENTIFIER@147..150 + 0: IDENT@147..150 "obj" [] [] + 1: QUESTIONDOT@150..152 "?." [] [] + 2: JS_PRIVATE_NAME@152..159 + 0: HASH@152..153 "#" [] [] + 1: IDENT@153..159 "member" [] [] + 1: DOT@159..160 "." [] [] + 2: JS_NAME@160..163 + 0: IDENT@160..163 "key" [] [] + 1: SEMICOLON@163..164 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@164..191 + 0: JS_UNARY_EXPRESSION@164..190 + 0: DELETE_KW@164..172 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@172..190 + 0: JS_PARENTHESIZED_EXPRESSION@172..186 + 0: L_PAREN@172..173 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@173..185 + 0: JS_IDENTIFIER_EXPRESSION@173..176 + 0: JS_REFERENCE_IDENTIFIER@173..176 + 0: IDENT@173..176 "obj" [] [] + 1: QUESTIONDOT@176..178 "?." [] [] + 2: JS_PRIVATE_NAME@178..185 + 0: HASH@178..179 "#" [] [] + 1: IDENT@179..185 "member" [] [] + 2: R_PAREN@185..186 ")" [] [] + 1: DOT@186..187 "." [] [] + 2: JS_NAME@187..190 + 0: IDENT@187..190 "key" [] [] + 1: SEMICOLON@190..191 ";" [] [] + 8: JS_EXPRESSION_STATEMENT@191..222 + 0: JS_UNARY_EXPRESSION@191..221 + 0: DELETE_KW@191..199 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@199..221 + 0: JS_STATIC_MEMBER_EXPRESSION@199..217 + 0: JS_STATIC_MEMBER_EXPRESSION@199..209 + 0: JS_IDENTIFIER_EXPRESSION@199..202 + 0: JS_REFERENCE_IDENTIFIER@199..202 + 0: IDENT@199..202 "obj" [] [] + 1: QUESTIONDOT@202..204 "?." [] [] + 2: JS_NAME@204..209 + 0: IDENT@204..209 "inner" [] [] + 1: DOT@209..210 "." [] [] + 2: JS_PRIVATE_NAME@210..217 + 0: HASH@210..211 "#" [] [] + 1: IDENT@211..217 "member" [] [] + 1: DOT@217..218 "." [] [] + 2: JS_NAME@218..221 + 0: IDENT@218..221 "key" [] [] + 1: SEMICOLON@221..222 ";" [] [] + 9: JS_EXPRESSION_STATEMENT@222..255 + 0: JS_UNARY_EXPRESSION@222..254 + 0: DELETE_KW@222..230 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_STATIC_MEMBER_EXPRESSION@230..254 + 0: JS_PARENTHESIZED_EXPRESSION@230..250 + 0: L_PAREN@230..231 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@231..249 + 0: JS_STATIC_MEMBER_EXPRESSION@231..241 + 0: JS_IDENTIFIER_EXPRESSION@231..234 + 0: JS_REFERENCE_IDENTIFIER@231..234 + 0: IDENT@231..234 "obj" [] [] + 1: QUESTIONDOT@234..236 "?." [] [] + 2: JS_NAME@236..241 + 0: IDENT@236..241 "inner" [] [] + 1: DOT@241..242 "." [] [] + 2: JS_PRIVATE_NAME@242..249 + 0: HASH@242..243 "#" [] [] + 1: IDENT@243..249 "member" [] [] + 2: R_PAREN@249..250 ")" [] [] + 1: DOT@250..251 "." [] [] + 2: JS_NAME@251..254 + 0: IDENT@251..254 "key" [] [] + 1: SEMICOLON@254..255 ";" [] [] + 10: JS_EXPRESSION_STATEMENT@255..272 + 0: JS_UNARY_EXPRESSION@255..271 + 0: DELETE_KW@255..263 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@263..271 + 0: JS_IDENTIFIER_EXPRESSION@263..266 + 0: JS_REFERENCE_IDENTIFIER@263..266 + 0: IDENT@263..266 "obj" [] [] + 1: (empty) + 2: L_BRACK@266..267 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@267..270 + 0: JS_REFERENCE_IDENTIFIER@267..270 + 0: IDENT@267..270 "key" [] [] + 4: R_BRACK@270..271 "]" [] [] + 1: SEMICOLON@271..272 ";" [] [] + 11: JS_EXPRESSION_STATEMENT@272..291 + 0: JS_UNARY_EXPRESSION@272..290 + 0: DELETE_KW@272..280 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@280..290 + 0: JS_PARENTHESIZED_EXPRESSION@280..285 + 0: L_PAREN@280..281 "(" [] [] + 1: JS_IDENTIFIER_EXPRESSION@281..284 + 0: JS_REFERENCE_IDENTIFIER@281..284 + 0: IDENT@281..284 "obj" [] [] + 2: R_PAREN@284..285 ")" [] [] + 1: (empty) + 2: L_BRACK@285..286 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@286..289 + 0: JS_REFERENCE_IDENTIFIER@286..289 + 0: IDENT@286..289 "key" [] [] + 4: R_BRACK@289..290 "]" [] [] + 1: SEMICOLON@290..291 ";" [] [] + 12: JS_EXPRESSION_STATEMENT@291..316 + 0: JS_UNARY_EXPRESSION@291..315 + 0: DELETE_KW@291..299 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@299..315 + 0: JS_STATIC_MEMBER_EXPRESSION@299..310 + 0: JS_IDENTIFIER_EXPRESSION@299..302 + 0: JS_REFERENCE_IDENTIFIER@299..302 + 0: IDENT@299..302 "obj" [] [] + 1: DOT@302..303 "." [] [] + 2: JS_PRIVATE_NAME@303..310 + 0: HASH@303..304 "#" [] [] + 1: IDENT@304..310 "member" [] [] + 1: (empty) + 2: L_BRACK@310..311 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@311..314 + 0: JS_REFERENCE_IDENTIFIER@311..314 + 0: IDENT@311..314 "key" [] [] + 4: R_BRACK@314..315 "]" [] [] + 1: SEMICOLON@315..316 ";" [] [] + 13: JS_EXPRESSION_STATEMENT@316..343 + 0: JS_UNARY_EXPRESSION@316..342 + 0: DELETE_KW@316..324 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@324..342 + 0: JS_PARENTHESIZED_EXPRESSION@324..337 + 0: L_PAREN@324..325 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@325..336 + 0: JS_IDENTIFIER_EXPRESSION@325..328 + 0: JS_REFERENCE_IDENTIFIER@325..328 + 0: IDENT@325..328 "obj" [] [] + 1: DOT@328..329 "." [] [] + 2: JS_PRIVATE_NAME@329..336 + 0: HASH@329..330 "#" [] [] + 1: IDENT@330..336 "member" [] [] + 2: R_PAREN@336..337 ")" [] [] + 1: (empty) + 2: L_BRACK@337..338 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@338..341 + 0: JS_REFERENCE_IDENTIFIER@338..341 + 0: IDENT@338..341 "key" [] [] + 4: R_BRACK@341..342 "]" [] [] + 1: SEMICOLON@342..343 ";" [] [] + 14: JS_EXPRESSION_STATEMENT@343..371 + 0: JS_UNARY_EXPRESSION@343..370 + 0: DELETE_KW@343..351 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@351..370 + 0: JS_STATIC_MEMBER_EXPRESSION@351..365 + 0: JS_CALL_EXPRESSION@351..357 + 0: JS_IDENTIFIER_EXPRESSION@351..355 + 0: JS_REFERENCE_IDENTIFIER@351..355 + 0: IDENT@351..355 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@355..357 + 0: L_PAREN@355..356 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@356..356 + 2: R_PAREN@356..357 ")" [] [] + 1: DOT@357..358 "." [] [] + 2: JS_PRIVATE_NAME@358..365 + 0: HASH@358..359 "#" [] [] + 1: IDENT@359..365 "member" [] [] + 1: (empty) + 2: L_BRACK@365..366 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@366..369 + 0: JS_REFERENCE_IDENTIFIER@366..369 + 0: IDENT@366..369 "key" [] [] + 4: R_BRACK@369..370 "]" [] [] + 1: SEMICOLON@370..371 ";" [] [] + 15: JS_EXPRESSION_STATEMENT@371..401 + 0: JS_UNARY_EXPRESSION@371..400 + 0: DELETE_KW@371..379 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@379..400 + 0: JS_PARENTHESIZED_EXPRESSION@379..395 + 0: L_PAREN@379..380 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@380..394 + 0: JS_CALL_EXPRESSION@380..386 + 0: JS_IDENTIFIER_EXPRESSION@380..384 + 0: JS_REFERENCE_IDENTIFIER@380..384 + 0: IDENT@380..384 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@384..386 + 0: L_PAREN@384..385 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@385..385 + 2: R_PAREN@385..386 ")" [] [] + 1: DOT@386..387 "." [] [] + 2: JS_PRIVATE_NAME@387..394 + 0: HASH@387..388 "#" [] [] + 1: IDENT@388..394 "member" [] [] + 2: R_PAREN@394..395 ")" [] [] + 1: (empty) + 2: L_BRACK@395..396 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@396..399 + 0: JS_REFERENCE_IDENTIFIER@396..399 + 0: IDENT@396..399 "key" [] [] + 4: R_BRACK@399..400 "]" [] [] + 1: SEMICOLON@400..401 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@401..427 + 0: JS_UNARY_EXPRESSION@401..426 + 0: DELETE_KW@401..409 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@409..426 + 0: JS_STATIC_MEMBER_EXPRESSION@409..421 + 0: JS_IDENTIFIER_EXPRESSION@409..412 + 0: JS_REFERENCE_IDENTIFIER@409..412 + 0: IDENT@409..412 "obj" [] [] + 1: QUESTIONDOT@412..414 "?." [] [] + 2: JS_PRIVATE_NAME@414..421 + 0: HASH@414..415 "#" [] [] + 1: IDENT@415..421 "member" [] [] + 1: (empty) + 2: L_BRACK@421..422 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@422..425 + 0: JS_REFERENCE_IDENTIFIER@422..425 + 0: IDENT@422..425 "key" [] [] + 4: R_BRACK@425..426 "]" [] [] + 1: SEMICOLON@426..427 ";" [] [] + 17: JS_EXPRESSION_STATEMENT@427..455 + 0: JS_UNARY_EXPRESSION@427..454 + 0: DELETE_KW@427..435 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@435..454 + 0: JS_PARENTHESIZED_EXPRESSION@435..449 + 0: L_PAREN@435..436 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@436..448 + 0: JS_IDENTIFIER_EXPRESSION@436..439 + 0: JS_REFERENCE_IDENTIFIER@436..439 + 0: IDENT@436..439 "obj" [] [] + 1: QUESTIONDOT@439..441 "?." [] [] + 2: JS_PRIVATE_NAME@441..448 + 0: HASH@441..442 "#" [] [] + 1: IDENT@442..448 "member" [] [] + 2: R_PAREN@448..449 ")" [] [] + 1: (empty) + 2: L_BRACK@449..450 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@450..453 + 0: JS_REFERENCE_IDENTIFIER@450..453 + 0: IDENT@450..453 "key" [] [] + 4: R_BRACK@453..454 "]" [] [] + 1: SEMICOLON@454..455 ";" [] [] + 18: JS_EXPRESSION_STATEMENT@455..487 + 0: JS_UNARY_EXPRESSION@455..486 + 0: DELETE_KW@455..463 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@463..486 + 0: JS_STATIC_MEMBER_EXPRESSION@463..481 + 0: JS_STATIC_MEMBER_EXPRESSION@463..473 + 0: JS_IDENTIFIER_EXPRESSION@463..466 + 0: JS_REFERENCE_IDENTIFIER@463..466 + 0: IDENT@463..466 "obj" [] [] + 1: QUESTIONDOT@466..468 "?." [] [] + 2: JS_NAME@468..473 + 0: IDENT@468..473 "inner" [] [] + 1: DOT@473..474 "." [] [] + 2: JS_PRIVATE_NAME@474..481 + 0: HASH@474..475 "#" [] [] + 1: IDENT@475..481 "member" [] [] + 1: (empty) + 2: L_BRACK@481..482 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@482..485 + 0: JS_REFERENCE_IDENTIFIER@482..485 + 0: IDENT@482..485 "key" [] [] + 4: R_BRACK@485..486 "]" [] [] + 1: SEMICOLON@486..487 ";" [] [] + 19: JS_EXPRESSION_STATEMENT@487..521 + 0: JS_UNARY_EXPRESSION@487..520 + 0: DELETE_KW@487..495 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@495..520 + 0: JS_PARENTHESIZED_EXPRESSION@495..515 + 0: L_PAREN@495..496 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@496..514 + 0: JS_STATIC_MEMBER_EXPRESSION@496..506 + 0: JS_IDENTIFIER_EXPRESSION@496..499 + 0: JS_REFERENCE_IDENTIFIER@496..499 + 0: IDENT@496..499 "obj" [] [] + 1: QUESTIONDOT@499..501 "?." [] [] + 2: JS_NAME@501..506 + 0: IDENT@501..506 "inner" [] [] + 1: DOT@506..507 "." [] [] + 2: JS_PRIVATE_NAME@507..514 + 0: HASH@507..508 "#" [] [] + 1: IDENT@508..514 "member" [] [] + 2: R_PAREN@514..515 ")" [] [] + 1: (empty) + 2: L_BRACK@515..516 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@516..519 + 0: JS_REFERENCE_IDENTIFIER@516..519 + 0: IDENT@516..519 "key" [] [] + 4: R_BRACK@519..520 "]" [] [] + 1: SEMICOLON@520..521 ";" [] [] + 20: JS_EXPRESSION_STATEMENT@521..549 + 0: JS_UNARY_EXPRESSION@521..548 + 0: DELETE_KW@521..529 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@529..548 + 0: L_PAREN@529..530 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@530..547 + 0: JS_STATIC_MEMBER_EXPRESSION@530..538 + 0: JS_IDENTIFIER_EXPRESSION@530..533 + 0: JS_REFERENCE_IDENTIFIER@530..533 + 0: IDENT@530..533 "obj" [] [] + 1: DOT@533..534 "." [] [] + 2: JS_PRIVATE_NAME@534..538 + 0: HASH@534..535 "#" [] [] + 1: IDENT@535..538 "key" [] [] + 1: COMMA@538..540 "," [] [Whitespace(" ")] + 2: JS_STATIC_MEMBER_EXPRESSION@540..547 + 0: JS_IDENTIFIER_EXPRESSION@540..543 + 0: JS_REFERENCE_IDENTIFIER@540..543 + 0: IDENT@540..543 "obj" [] [] + 1: DOT@543..544 "." [] [] + 2: JS_NAME@544..547 + 0: IDENT@544..547 "key" [] [] + 2: R_PAREN@547..548 ")" [] [] + 1: SEMICOLON@548..549 ";" [] [] + 21: JS_EXPRESSION_STATEMENT@549..571 + 0: JS_UNARY_EXPRESSION@549..570 + 0: DELETE_KW@549..557 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@557..570 + 0: L_PAREN@557..558 "(" [] [] + 1: JS_IN_EXPRESSION@558..569 + 0: JS_PRIVATE_NAME@558..563 + 0: HASH@558..559 "#" [] [] + 1: IDENT@559..563 "key" [] [Whitespace(" ")] + 1: IN_KW@563..566 "in" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@566..569 + 0: JS_REFERENCE_IDENTIFIER@566..569 + 0: IDENT@566..569 "obj" [] [] + 2: R_PAREN@569..570 ")" [] [] + 1: SEMICOLON@570..571 ";" [] [] + 22: JS_EXPRESSION_STATEMENT@571..589 + 0: JS_UNARY_EXPRESSION@571..588 + 0: DELETE_KW@571..579 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@579..588 + 0: L_PAREN@579..580 "(" [] [] + 1: JS_STATIC_MEMBER_EXPRESSION@580..587 + 0: JS_IDENTIFIER_EXPRESSION@580..583 + 0: JS_REFERENCE_IDENTIFIER@580..583 + 0: IDENT@580..583 "obj" [] [] + 1: DOT@583..584 "." [] [] + 2: JS_NAME@584..587 + 0: IDENT@584..587 "key" [] [] + 2: R_PAREN@587..588 ")" [] [] + 1: SEMICOLON@588..589 ";" [] [] + 23: JS_EXPRESSION_STATEMENT@589..614 + 0: JS_UNARY_EXPRESSION@589..613 + 0: DELETE_KW@589..597 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@597..613 + 0: L_PAREN@597..598 "(" [] [] + 1: JS_CALL_EXPRESSION@598..612 + 0: JS_STATIC_MEMBER_EXPRESSION@598..609 + 0: JS_IDENTIFIER_EXPRESSION@598..605 + 0: JS_REFERENCE_IDENTIFIER@598..605 + 0: IDENT@598..605 "console" [] [] + 1: DOT@605..606 "." [] [] + 2: JS_NAME@606..609 + 0: IDENT@606..609 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@609..612 + 0: L_PAREN@609..610 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@610..611 + 0: JS_NUMBER_LITERAL_EXPRESSION@610..611 + 0: JS_NUMBER_LITERAL@610..611 "1" [] [] + 2: R_PAREN@611..612 ")" [] [] + 2: R_PAREN@612..613 ")" [] [] + 1: SEMICOLON@613..614 ";" [] [] + 24: JS_EXPRESSION_STATEMENT@614..633 + 0: JS_UNARY_EXPRESSION@614..632 + 0: DELETE_KW@614..622 "delete" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@622..632 + 0: L_PAREN@622..623 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@623..631 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@623..626 + 0: L_PAREN@623..624 "(" [] [] + 1: JS_PARAMETER_LIST@624..624 + 2: R_PAREN@624..626 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@626..629 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@629..631 + 0: L_CURLY@629..630 "{" [] [] + 1: JS_DIRECTIVE_LIST@630..630 + 2: JS_STATEMENT_LIST@630..630 + 3: R_CURLY@630..631 "}" [] [] + 2: R_PAREN@631..632 ")" [] [] + 1: SEMICOLON@632..633 ";" [] [] + 4: EOF@633..634 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.js b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.js rename to crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js.snap new file mode 100644 index 000000000000..05b1663c04a0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js.snap @@ -0,0 +1,950 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class TestClass { #member = true; method() { delete func(this.#member) } } +class TestClass { #member = true; method() { delete [this.#member] } } +class TestClass { #member = true; method() { delete { key: this.#member } } } +class TestClass { #member = true; method() { delete (() => { this.#member; }) } } +class TestClass { #member = true; method() { delete (param => { this.#member; }) } } +class TestClass { #member = true; method() { delete (async () => { this.#member; }) } } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..6 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@6..16 "TestClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@18..19 "#" [] [], + id_token: IDENT@19..26 "member" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@26..28 "=" [] [Whitespace(" ")], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@28..32 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@32..34 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@34..40 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@40..41 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@41..43 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@43..45 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@45..52 "delete" [] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@52..56 "func" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@56..57 "(" [] [], + args: JsCallArgumentList [ + JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@57..61 "this" [] [], + }, + operator_token: DOT@61..62 "." [] [], + member: JsPrivateName { + hash_token: HASH@62..63 "#" [] [], + value_token: IDENT@63..69 "member" [] [], + }, + }, + ], + r_paren_token: R_PAREN@69..71 ")" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@74..81 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@81..91 "TestClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@91..93 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@93..94 "#" [] [], + id_token: IDENT@94..101 "member" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@101..103 "=" [] [Whitespace(" ")], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@103..107 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@107..109 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@109..115 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@115..116 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@116..118 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@118..120 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@120..127 "delete" [] [Whitespace(" ")], + argument: JsArrayExpression { + l_brack_token: L_BRACK@127..128 "[" [] [], + elements: JsArrayElementList [ + JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@128..132 "this" [] [], + }, + operator_token: DOT@132..133 "." [] [], + member: JsPrivateName { + hash_token: HASH@133..134 "#" [] [], + value_token: IDENT@134..140 "member" [] [], + }, + }, + ], + r_brack_token: R_BRACK@140..142 "]" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@142..144 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@144..145 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@152..162 "TestClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@162..164 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@164..165 "#" [] [], + id_token: IDENT@165..172 "member" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@172..174 "=" [] [Whitespace(" ")], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@174..178 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@178..180 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@180..186 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@186..187 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@187..189 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@189..191 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@191..198 "delete" [] [Whitespace(" ")], + argument: JsObjectExpression { + l_curly_token: L_CURLY@198..200 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsPropertyObjectMember { + name: JsLiteralMemberName { + value: IDENT@200..203 "key" [] [], + }, + colon_token: COLON@203..205 ":" [] [Whitespace(" ")], + value: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@205..209 "this" [] [], + }, + operator_token: DOT@209..210 "." [] [], + member: JsPrivateName { + hash_token: HASH@210..211 "#" [] [], + value_token: IDENT@211..218 "member" [] [Whitespace(" ")], + }, + }, + }, + ], + r_curly_token: R_CURLY@218..220 "}" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@220..222 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@222..223 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@223..230 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@230..240 "TestClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@240..242 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@242..243 "#" [] [], + id_token: IDENT@243..250 "member" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@250..252 "=" [] [Whitespace(" ")], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@252..256 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@256..258 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@258..264 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@264..265 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@265..267 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@267..269 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@269..276 "delete" [] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@276..277 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@277..278 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@278..280 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@280..283 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@283..285 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@285..289 "this" [] [], + }, + operator_token: DOT@289..290 "." [] [], + member: JsPrivateName { + hash_token: HASH@290..291 "#" [] [], + value_token: IDENT@291..297 "member" [] [], + }, + }, + semicolon_token: SEMICOLON@297..299 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@299..300 "}" [] [], + }, + }, + r_paren_token: R_PAREN@300..302 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@302..304 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@304..305 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@305..312 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@312..322 "TestClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@322..324 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@324..325 "#" [] [], + id_token: IDENT@325..332 "member" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@332..334 "=" [] [Whitespace(" ")], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@334..338 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@338..340 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@340..346 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@346..347 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@347..349 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@349..351 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@351..358 "delete" [] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@358..359 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: missing (optional), + parameters: JsIdentifierBinding { + name_token: IDENT@359..365 "param" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@365..368 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@368..370 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@370..374 "this" [] [], + }, + operator_token: DOT@374..375 "." [] [], + member: JsPrivateName { + hash_token: HASH@375..376 "#" [] [], + value_token: IDENT@376..382 "member" [] [], + }, + }, + semicolon_token: SEMICOLON@382..384 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@384..385 "}" [] [], + }, + }, + r_paren_token: R_PAREN@385..387 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@387..389 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@389..390 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@390..397 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@397..407 "TestClass" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@407..409 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsPrivateClassMemberName { + hash_token: HASH@409..410 "#" [] [], + id_token: IDENT@410..417 "member" [] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@417..419 "=" [] [Whitespace(" ")], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@419..423 "true" [] [], + }, + }, + semicolon_token: SEMICOLON@423..425 ";" [] [Whitespace(" ")], + }, + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@425..431 "method" [] [], + }, + question_mark_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@431..432 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@432..434 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@434..436 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsUnaryExpression { + operator_token: DELETE_KW@436..443 "delete" [] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@443..444 "(" [] [], + expression: JsArrowFunctionExpression { + async_token: ASYNC_KW@444..450 "async" [] [Whitespace(" ")], + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@450..451 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@451..453 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@453..456 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@456..458 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsStaticMemberExpression { + object: JsThisExpression { + this_token: THIS_KW@458..462 "this" [] [], + }, + operator_token: DOT@462..463 "." [] [], + member: JsPrivateName { + hash_token: HASH@463..464 "#" [] [], + value_token: IDENT@464..470 "member" [] [], + }, + }, + semicolon_token: SEMICOLON@470..472 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@472..473 "}" [] [], + }, + }, + r_paren_token: R_PAREN@473..475 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@475..477 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@477..478 "}" [] [], + }, + ], + eof_token: EOF@478..479 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..479 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..478 + 0: JS_CLASS_DECLARATION@0..74 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..6 "class" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@6..16 + 0: IDENT@6..16 "TestClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@18..73 + 0: JS_PROPERTY_CLASS_MEMBER@18..34 + 0: JS_PROPERTY_MODIFIER_LIST@18..18 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@18..26 + 0: HASH@18..19 "#" [] [] + 1: IDENT@19..26 "member" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@26..32 + 0: EQ@26..28 "=" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@28..32 + 0: TRUE_KW@28..32 "true" [] [] + 4: SEMICOLON@32..34 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@34..73 + 0: JS_METHOD_MODIFIER_LIST@34..34 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@34..40 + 0: IDENT@34..40 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@40..43 + 0: L_PAREN@40..41 "(" [] [] + 1: JS_PARAMETER_LIST@41..41 + 2: R_PAREN@41..43 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@43..73 + 0: L_CURLY@43..45 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@45..45 + 2: JS_STATEMENT_LIST@45..71 + 0: JS_EXPRESSION_STATEMENT@45..71 + 0: JS_UNARY_EXPRESSION@45..71 + 0: DELETE_KW@45..52 "delete" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@52..71 + 0: JS_IDENTIFIER_EXPRESSION@52..56 + 0: JS_REFERENCE_IDENTIFIER@52..56 + 0: IDENT@52..56 "func" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@56..71 + 0: L_PAREN@56..57 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@57..69 + 0: JS_STATIC_MEMBER_EXPRESSION@57..69 + 0: JS_THIS_EXPRESSION@57..61 + 0: THIS_KW@57..61 "this" [] [] + 1: DOT@61..62 "." [] [] + 2: JS_PRIVATE_NAME@62..69 + 0: HASH@62..63 "#" [] [] + 1: IDENT@63..69 "member" [] [] + 2: R_PAREN@69..71 ")" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] + 9: R_CURLY@73..74 "}" [] [] + 1: JS_CLASS_DECLARATION@74..145 + 0: JS_DECORATOR_LIST@74..74 + 1: (empty) + 2: CLASS_KW@74..81 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@81..91 + 0: IDENT@81..91 "TestClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@91..93 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@93..144 + 0: JS_PROPERTY_CLASS_MEMBER@93..109 + 0: JS_PROPERTY_MODIFIER_LIST@93..93 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@93..101 + 0: HASH@93..94 "#" [] [] + 1: IDENT@94..101 "member" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@101..107 + 0: EQ@101..103 "=" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@103..107 + 0: TRUE_KW@103..107 "true" [] [] + 4: SEMICOLON@107..109 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@109..144 + 0: JS_METHOD_MODIFIER_LIST@109..109 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@109..115 + 0: IDENT@109..115 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@115..118 + 0: L_PAREN@115..116 "(" [] [] + 1: JS_PARAMETER_LIST@116..116 + 2: R_PAREN@116..118 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@118..144 + 0: L_CURLY@118..120 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@120..120 + 2: JS_STATEMENT_LIST@120..142 + 0: JS_EXPRESSION_STATEMENT@120..142 + 0: JS_UNARY_EXPRESSION@120..142 + 0: DELETE_KW@120..127 "delete" [] [Whitespace(" ")] + 1: JS_ARRAY_EXPRESSION@127..142 + 0: L_BRACK@127..128 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@128..140 + 0: JS_STATIC_MEMBER_EXPRESSION@128..140 + 0: JS_THIS_EXPRESSION@128..132 + 0: THIS_KW@128..132 "this" [] [] + 1: DOT@132..133 "." [] [] + 2: JS_PRIVATE_NAME@133..140 + 0: HASH@133..134 "#" [] [] + 1: IDENT@134..140 "member" [] [] + 2: R_BRACK@140..142 "]" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@142..144 "}" [] [Whitespace(" ")] + 9: R_CURLY@144..145 "}" [] [] + 2: JS_CLASS_DECLARATION@145..223 + 0: JS_DECORATOR_LIST@145..145 + 1: (empty) + 2: CLASS_KW@145..152 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@152..162 + 0: IDENT@152..162 "TestClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@162..164 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@164..222 + 0: JS_PROPERTY_CLASS_MEMBER@164..180 + 0: JS_PROPERTY_MODIFIER_LIST@164..164 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@164..172 + 0: HASH@164..165 "#" [] [] + 1: IDENT@165..172 "member" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@172..178 + 0: EQ@172..174 "=" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@174..178 + 0: TRUE_KW@174..178 "true" [] [] + 4: SEMICOLON@178..180 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@180..222 + 0: JS_METHOD_MODIFIER_LIST@180..180 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@180..186 + 0: IDENT@180..186 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@186..189 + 0: L_PAREN@186..187 "(" [] [] + 1: JS_PARAMETER_LIST@187..187 + 2: R_PAREN@187..189 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@189..222 + 0: L_CURLY@189..191 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@191..191 + 2: JS_STATEMENT_LIST@191..220 + 0: JS_EXPRESSION_STATEMENT@191..220 + 0: JS_UNARY_EXPRESSION@191..220 + 0: DELETE_KW@191..198 "delete" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@198..220 + 0: L_CURLY@198..200 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@200..218 + 0: JS_PROPERTY_OBJECT_MEMBER@200..218 + 0: JS_LITERAL_MEMBER_NAME@200..203 + 0: IDENT@200..203 "key" [] [] + 1: COLON@203..205 ":" [] [Whitespace(" ")] + 2: JS_STATIC_MEMBER_EXPRESSION@205..218 + 0: JS_THIS_EXPRESSION@205..209 + 0: THIS_KW@205..209 "this" [] [] + 1: DOT@209..210 "." [] [] + 2: JS_PRIVATE_NAME@210..218 + 0: HASH@210..211 "#" [] [] + 1: IDENT@211..218 "member" [] [Whitespace(" ")] + 2: R_CURLY@218..220 "}" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@220..222 "}" [] [Whitespace(" ")] + 9: R_CURLY@222..223 "}" [] [] + 3: JS_CLASS_DECLARATION@223..305 + 0: JS_DECORATOR_LIST@223..223 + 1: (empty) + 2: CLASS_KW@223..230 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@230..240 + 0: IDENT@230..240 "TestClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@240..242 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@242..304 + 0: JS_PROPERTY_CLASS_MEMBER@242..258 + 0: JS_PROPERTY_MODIFIER_LIST@242..242 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@242..250 + 0: HASH@242..243 "#" [] [] + 1: IDENT@243..250 "member" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@250..256 + 0: EQ@250..252 "=" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@252..256 + 0: TRUE_KW@252..256 "true" [] [] + 4: SEMICOLON@256..258 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@258..304 + 0: JS_METHOD_MODIFIER_LIST@258..258 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@258..264 + 0: IDENT@258..264 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@264..267 + 0: L_PAREN@264..265 "(" [] [] + 1: JS_PARAMETER_LIST@265..265 + 2: R_PAREN@265..267 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@267..304 + 0: L_CURLY@267..269 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@269..269 + 2: JS_STATEMENT_LIST@269..302 + 0: JS_EXPRESSION_STATEMENT@269..302 + 0: JS_UNARY_EXPRESSION@269..302 + 0: DELETE_KW@269..276 "delete" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@276..302 + 0: L_PAREN@276..277 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@277..300 + 0: (empty) + 1: (empty) + 2: JS_PARAMETERS@277..280 + 0: L_PAREN@277..278 "(" [] [] + 1: JS_PARAMETER_LIST@278..278 + 2: R_PAREN@278..280 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@280..283 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@283..300 + 0: L_CURLY@283..285 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@285..285 + 2: JS_STATEMENT_LIST@285..299 + 0: JS_EXPRESSION_STATEMENT@285..299 + 0: JS_STATIC_MEMBER_EXPRESSION@285..297 + 0: JS_THIS_EXPRESSION@285..289 + 0: THIS_KW@285..289 "this" [] [] + 1: DOT@289..290 "." [] [] + 2: JS_PRIVATE_NAME@290..297 + 0: HASH@290..291 "#" [] [] + 1: IDENT@291..297 "member" [] [] + 1: SEMICOLON@297..299 ";" [] [Whitespace(" ")] + 3: R_CURLY@299..300 "}" [] [] + 2: R_PAREN@300..302 ")" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@302..304 "}" [] [Whitespace(" ")] + 9: R_CURLY@304..305 "}" [] [] + 4: JS_CLASS_DECLARATION@305..390 + 0: JS_DECORATOR_LIST@305..305 + 1: (empty) + 2: CLASS_KW@305..312 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@312..322 + 0: IDENT@312..322 "TestClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@322..324 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@324..389 + 0: JS_PROPERTY_CLASS_MEMBER@324..340 + 0: JS_PROPERTY_MODIFIER_LIST@324..324 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@324..332 + 0: HASH@324..325 "#" [] [] + 1: IDENT@325..332 "member" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@332..338 + 0: EQ@332..334 "=" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@334..338 + 0: TRUE_KW@334..338 "true" [] [] + 4: SEMICOLON@338..340 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@340..389 + 0: JS_METHOD_MODIFIER_LIST@340..340 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@340..346 + 0: IDENT@340..346 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@346..349 + 0: L_PAREN@346..347 "(" [] [] + 1: JS_PARAMETER_LIST@347..347 + 2: R_PAREN@347..349 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@349..389 + 0: L_CURLY@349..351 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@351..351 + 2: JS_STATEMENT_LIST@351..387 + 0: JS_EXPRESSION_STATEMENT@351..387 + 0: JS_UNARY_EXPRESSION@351..387 + 0: DELETE_KW@351..358 "delete" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@358..387 + 0: L_PAREN@358..359 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@359..385 + 0: (empty) + 1: (empty) + 2: JS_IDENTIFIER_BINDING@359..365 + 0: IDENT@359..365 "param" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@365..368 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@368..385 + 0: L_CURLY@368..370 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@370..370 + 2: JS_STATEMENT_LIST@370..384 + 0: JS_EXPRESSION_STATEMENT@370..384 + 0: JS_STATIC_MEMBER_EXPRESSION@370..382 + 0: JS_THIS_EXPRESSION@370..374 + 0: THIS_KW@370..374 "this" [] [] + 1: DOT@374..375 "." [] [] + 2: JS_PRIVATE_NAME@375..382 + 0: HASH@375..376 "#" [] [] + 1: IDENT@376..382 "member" [] [] + 1: SEMICOLON@382..384 ";" [] [Whitespace(" ")] + 3: R_CURLY@384..385 "}" [] [] + 2: R_PAREN@385..387 ")" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@387..389 "}" [] [Whitespace(" ")] + 9: R_CURLY@389..390 "}" [] [] + 5: JS_CLASS_DECLARATION@390..478 + 0: JS_DECORATOR_LIST@390..390 + 1: (empty) + 2: CLASS_KW@390..397 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@397..407 + 0: IDENT@397..407 "TestClass" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@407..409 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@409..477 + 0: JS_PROPERTY_CLASS_MEMBER@409..425 + 0: JS_PROPERTY_MODIFIER_LIST@409..409 + 1: JS_PRIVATE_CLASS_MEMBER_NAME@409..417 + 0: HASH@409..410 "#" [] [] + 1: IDENT@410..417 "member" [] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@417..423 + 0: EQ@417..419 "=" [] [Whitespace(" ")] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@419..423 + 0: TRUE_KW@419..423 "true" [] [] + 4: SEMICOLON@423..425 ";" [] [Whitespace(" ")] + 1: JS_METHOD_CLASS_MEMBER@425..477 + 0: JS_METHOD_MODIFIER_LIST@425..425 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@425..431 + 0: IDENT@425..431 "method" [] [] + 4: (empty) + 5: (empty) + 6: JS_PARAMETERS@431..434 + 0: L_PAREN@431..432 "(" [] [] + 1: JS_PARAMETER_LIST@432..432 + 2: R_PAREN@432..434 ")" [] [Whitespace(" ")] + 7: (empty) + 8: JS_FUNCTION_BODY@434..477 + 0: L_CURLY@434..436 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@436..436 + 2: JS_STATEMENT_LIST@436..475 + 0: JS_EXPRESSION_STATEMENT@436..475 + 0: JS_UNARY_EXPRESSION@436..475 + 0: DELETE_KW@436..443 "delete" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@443..475 + 0: L_PAREN@443..444 "(" [] [] + 1: JS_ARROW_FUNCTION_EXPRESSION@444..473 + 0: ASYNC_KW@444..450 "async" [] [Whitespace(" ")] + 1: (empty) + 2: JS_PARAMETERS@450..453 + 0: L_PAREN@450..451 "(" [] [] + 1: JS_PARAMETER_LIST@451..451 + 2: R_PAREN@451..453 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@453..456 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@456..473 + 0: L_CURLY@456..458 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@458..458 + 2: JS_STATEMENT_LIST@458..472 + 0: JS_EXPRESSION_STATEMENT@458..472 + 0: JS_STATIC_MEMBER_EXPRESSION@458..470 + 0: JS_THIS_EXPRESSION@458..462 + 0: THIS_KW@458..462 "this" [] [] + 1: DOT@462..463 "." [] [] + 2: JS_PRIVATE_NAME@463..470 + 0: HASH@463..464 "#" [] [] + 1: IDENT@464..470 "member" [] [] + 1: SEMICOLON@470..472 ";" [] [Whitespace(" ")] + 3: R_CURLY@472..473 "}" [] [] + 2: R_PAREN@473..475 ")" [] [Whitespace(" ")] + 1: (empty) + 3: R_CURLY@475..477 "}" [] [Whitespace(" ")] + 9: R_CURLY@477..478 "}" [] [] + 4: EOF@478..479 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js.snap new file mode 100644 index 000000000000..6d0f6ba3cfd7 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js.snap @@ -0,0 +1,635 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +using a = b; +using c = d, e = _; +using [g] = h; +using [j] += k; +await using l = m; +await +using p = q; +await using[r]; +await using ([s] = t); +await (using [u] = v); +using w = {}; +using x = null; +using y = undefined; +using z = (foo, bar); + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@0..6 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@6..8 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@8..10 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@10..11 "b" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@12..19 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@19..21 "c" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@23..24 "d" [] [], + }, + }, + }, + }, + COMMA@24..26 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@26..28 "e" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@30..31 "_" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@32..39 "using" [Newline("\n")] [Whitespace(" ")], + }, + }, + l_brack_token: L_BRACK@39..40 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@40..41 "g" [] [], + }, + }, + r_brack_token: R_BRACK@41..43 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@43..45 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..46 "h" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@46..47 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@47..54 "using" [Newline("\n")] [Whitespace(" ")], + }, + }, + l_brack_token: L_BRACK@54..55 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..56 "j" [] [], + }, + }, + r_brack_token: R_BRACK@56..57 "]" [] [], + }, + operator_token: EQ@57..60 "=" [Newline("\n")] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@60..61 "k" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@61..62 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: AWAIT_KW@62..69 "await" [Newline("\n")] [Whitespace(" ")], + kind: USING_KW@69..75 "using" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@75..77 "l" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@77..79 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@79..80 "m" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@80..81 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: AWAIT_KW@81..87 "await" [Newline("\n")] [], + kind: USING_KW@87..94 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@94..96 "p" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@96..98 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@98..99 "q" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@99..100 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@100..107 "await" [Newline("\n")] [Whitespace(" ")], + argument: JsComputedMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@107..112 "using" [] [], + }, + }, + optional_chain_token: missing (optional), + l_brack_token: L_BRACK@112..113 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@113..114 "r" [] [], + }, + }, + r_brack_token: R_BRACK@114..115 "]" [] [], + }, + }, + semicolon_token: SEMICOLON@115..116 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")], + argument: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@123..129 "using" [] [Whitespace(" ")], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@129..130 "(" [] [], + args: JsCallArgumentList [ + JsAssignmentExpression { + left: JsArrayAssignmentPattern { + l_brack_token: L_BRACK@130..131 "[" [] [], + elements: JsArrayAssignmentPatternElementList [ + JsArrayAssignmentPatternElement { + pattern: JsIdentifierAssignment { + name_token: IDENT@131..132 "s" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@132..134 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@134..136 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@136..137 "t" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@137..138 ")" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@138..139 ";" [] [], + }, + JsExpressionStatement { + expression: JsAwaitExpression { + await_token: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")], + argument: JsParenthesizedExpression { + l_paren_token: L_PAREN@146..147 "(" [] [], + expression: JsAssignmentExpression { + left: JsComputedMemberAssignment { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@147..153 "using" [] [Whitespace(" ")], + }, + }, + l_brack_token: L_BRACK@153..154 "[" [] [], + member: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@154..155 "u" [] [], + }, + }, + r_brack_token: R_BRACK@155..157 "]" [] [Whitespace(" ")], + }, + operator_token: EQ@157..159 "=" [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@159..160 "v" [] [], + }, + }, + }, + r_paren_token: R_PAREN@160..161 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@161..162 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@162..169 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@169..171 "w" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@171..173 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@173..174 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@174..175 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@175..176 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@176..183 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@183..185 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@185..187 "=" [] [Whitespace(" ")], + expression: JsNullLiteralExpression { + value_token: NULL_KW@187..191 "null" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@191..192 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@192..199 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@199..201 "y" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@201..203 "=" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@203..212 "undefined" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@212..213 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: USING_KW@213..220 "using" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@220..222 "z" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@222..224 "=" [] [Whitespace(" ")], + expression: JsParenthesizedExpression { + l_paren_token: L_PAREN@224..225 "(" [] [], + expression: JsSequenceExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@225..228 "foo" [] [], + }, + }, + comma_token: COMMA@228..230 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@230..233 "bar" [] [], + }, + }, + }, + r_paren_token: R_PAREN@233..234 ")" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@234..235 ";" [] [], + }, + ], + eof_token: EOF@235..236 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..236 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..235 + 0: JS_VARIABLE_STATEMENT@0..12 + 0: JS_VARIABLE_DECLARATION@0..11 + 0: (empty) + 1: USING_KW@0..6 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@6..11 + 0: JS_VARIABLE_DECLARATOR@6..11 + 0: JS_IDENTIFIER_BINDING@6..8 + 0: IDENT@6..8 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@8..11 + 0: EQ@8..10 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@10..11 + 0: JS_REFERENCE_IDENTIFIER@10..11 + 0: IDENT@10..11 "b" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_VARIABLE_STATEMENT@12..32 + 0: JS_VARIABLE_DECLARATION@12..31 + 0: (empty) + 1: USING_KW@12..19 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@19..31 + 0: JS_VARIABLE_DECLARATOR@19..24 + 0: JS_IDENTIFIER_BINDING@19..21 + 0: IDENT@19..21 "c" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..24 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@23..24 + 0: JS_REFERENCE_IDENTIFIER@23..24 + 0: IDENT@23..24 "d" [] [] + 1: COMMA@24..26 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@26..31 + 0: JS_IDENTIFIER_BINDING@26..28 + 0: IDENT@26..28 "e" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@28..31 + 0: EQ@28..30 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@30..31 + 0: JS_REFERENCE_IDENTIFIER@30..31 + 0: IDENT@30..31 "_" [] [] + 1: SEMICOLON@31..32 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@32..47 + 0: JS_ASSIGNMENT_EXPRESSION@32..46 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@32..43 + 0: JS_IDENTIFIER_EXPRESSION@32..39 + 0: JS_REFERENCE_IDENTIFIER@32..39 + 0: IDENT@32..39 "using" [Newline("\n")] [Whitespace(" ")] + 1: L_BRACK@39..40 "[" [] [] + 2: JS_IDENTIFIER_EXPRESSION@40..41 + 0: JS_REFERENCE_IDENTIFIER@40..41 + 0: IDENT@40..41 "g" [] [] + 3: R_BRACK@41..43 "]" [] [Whitespace(" ")] + 1: EQ@43..45 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@45..46 + 0: JS_REFERENCE_IDENTIFIER@45..46 + 0: IDENT@45..46 "h" [] [] + 1: SEMICOLON@46..47 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@47..62 + 0: JS_ASSIGNMENT_EXPRESSION@47..61 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@47..57 + 0: JS_IDENTIFIER_EXPRESSION@47..54 + 0: JS_REFERENCE_IDENTIFIER@47..54 + 0: IDENT@47..54 "using" [Newline("\n")] [Whitespace(" ")] + 1: L_BRACK@54..55 "[" [] [] + 2: JS_IDENTIFIER_EXPRESSION@55..56 + 0: JS_REFERENCE_IDENTIFIER@55..56 + 0: IDENT@55..56 "j" [] [] + 3: R_BRACK@56..57 "]" [] [] + 1: EQ@57..60 "=" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@60..61 + 0: JS_REFERENCE_IDENTIFIER@60..61 + 0: IDENT@60..61 "k" [] [] + 1: SEMICOLON@61..62 ";" [] [] + 4: JS_VARIABLE_STATEMENT@62..81 + 0: JS_VARIABLE_DECLARATION@62..80 + 0: AWAIT_KW@62..69 "await" [Newline("\n")] [Whitespace(" ")] + 1: USING_KW@69..75 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@75..80 + 0: JS_VARIABLE_DECLARATOR@75..80 + 0: JS_IDENTIFIER_BINDING@75..77 + 0: IDENT@75..77 "l" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@77..80 + 0: EQ@77..79 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@79..80 + 0: JS_REFERENCE_IDENTIFIER@79..80 + 0: IDENT@79..80 "m" [] [] + 1: SEMICOLON@80..81 ";" [] [] + 5: JS_VARIABLE_STATEMENT@81..100 + 0: JS_VARIABLE_DECLARATION@81..99 + 0: AWAIT_KW@81..87 "await" [Newline("\n")] [] + 1: USING_KW@87..94 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@94..99 + 0: JS_VARIABLE_DECLARATOR@94..99 + 0: JS_IDENTIFIER_BINDING@94..96 + 0: IDENT@94..96 "p" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@96..99 + 0: EQ@96..98 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@98..99 + 0: JS_REFERENCE_IDENTIFIER@98..99 + 0: IDENT@98..99 "q" [] [] + 1: SEMICOLON@99..100 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@100..116 + 0: JS_AWAIT_EXPRESSION@100..115 + 0: AWAIT_KW@100..107 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_COMPUTED_MEMBER_EXPRESSION@107..115 + 0: JS_IDENTIFIER_EXPRESSION@107..112 + 0: JS_REFERENCE_IDENTIFIER@107..112 + 0: IDENT@107..112 "using" [] [] + 1: (empty) + 2: L_BRACK@112..113 "[" [] [] + 3: JS_IDENTIFIER_EXPRESSION@113..114 + 0: JS_REFERENCE_IDENTIFIER@113..114 + 0: IDENT@113..114 "r" [] [] + 4: R_BRACK@114..115 "]" [] [] + 1: SEMICOLON@115..116 ";" [] [] + 7: JS_EXPRESSION_STATEMENT@116..139 + 0: JS_AWAIT_EXPRESSION@116..138 + 0: AWAIT_KW@116..123 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@123..138 + 0: JS_IDENTIFIER_EXPRESSION@123..129 + 0: JS_REFERENCE_IDENTIFIER@123..129 + 0: IDENT@123..129 "using" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@129..138 + 0: L_PAREN@129..130 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@130..137 + 0: JS_ASSIGNMENT_EXPRESSION@130..137 + 0: JS_ARRAY_ASSIGNMENT_PATTERN@130..134 + 0: L_BRACK@130..131 "[" [] [] + 1: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT_LIST@131..132 + 0: JS_ARRAY_ASSIGNMENT_PATTERN_ELEMENT@131..132 + 0: JS_IDENTIFIER_ASSIGNMENT@131..132 + 0: IDENT@131..132 "s" [] [] + 1: (empty) + 2: R_BRACK@132..134 "]" [] [Whitespace(" ")] + 1: EQ@134..136 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@136..137 + 0: JS_REFERENCE_IDENTIFIER@136..137 + 0: IDENT@136..137 "t" [] [] + 2: R_PAREN@137..138 ")" [] [] + 1: SEMICOLON@138..139 ";" [] [] + 8: JS_EXPRESSION_STATEMENT@139..162 + 0: JS_AWAIT_EXPRESSION@139..161 + 0: AWAIT_KW@139..146 "await" [Newline("\n")] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@146..161 + 0: L_PAREN@146..147 "(" [] [] + 1: JS_ASSIGNMENT_EXPRESSION@147..160 + 0: JS_COMPUTED_MEMBER_ASSIGNMENT@147..157 + 0: JS_IDENTIFIER_EXPRESSION@147..153 + 0: JS_REFERENCE_IDENTIFIER@147..153 + 0: IDENT@147..153 "using" [] [Whitespace(" ")] + 1: L_BRACK@153..154 "[" [] [] + 2: JS_IDENTIFIER_EXPRESSION@154..155 + 0: JS_REFERENCE_IDENTIFIER@154..155 + 0: IDENT@154..155 "u" [] [] + 3: R_BRACK@155..157 "]" [] [Whitespace(" ")] + 1: EQ@157..159 "=" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@159..160 + 0: JS_REFERENCE_IDENTIFIER@159..160 + 0: IDENT@159..160 "v" [] [] + 2: R_PAREN@160..161 ")" [] [] + 1: SEMICOLON@161..162 ";" [] [] + 9: JS_VARIABLE_STATEMENT@162..176 + 0: JS_VARIABLE_DECLARATION@162..175 + 0: (empty) + 1: USING_KW@162..169 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@169..175 + 0: JS_VARIABLE_DECLARATOR@169..175 + 0: JS_IDENTIFIER_BINDING@169..171 + 0: IDENT@169..171 "w" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@171..175 + 0: EQ@171..173 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@173..175 + 0: L_CURLY@173..174 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@174..174 + 2: R_CURLY@174..175 "}" [] [] + 1: SEMICOLON@175..176 ";" [] [] + 10: JS_VARIABLE_STATEMENT@176..192 + 0: JS_VARIABLE_DECLARATION@176..191 + 0: (empty) + 1: USING_KW@176..183 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@183..191 + 0: JS_VARIABLE_DECLARATOR@183..191 + 0: JS_IDENTIFIER_BINDING@183..185 + 0: IDENT@183..185 "x" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@185..191 + 0: EQ@185..187 "=" [] [Whitespace(" ")] + 1: JS_NULL_LITERAL_EXPRESSION@187..191 + 0: NULL_KW@187..191 "null" [] [] + 1: SEMICOLON@191..192 ";" [] [] + 11: JS_VARIABLE_STATEMENT@192..213 + 0: JS_VARIABLE_DECLARATION@192..212 + 0: (empty) + 1: USING_KW@192..199 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@199..212 + 0: JS_VARIABLE_DECLARATOR@199..212 + 0: JS_IDENTIFIER_BINDING@199..201 + 0: IDENT@199..201 "y" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@201..212 + 0: EQ@201..203 "=" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@203..212 + 0: JS_REFERENCE_IDENTIFIER@203..212 + 0: IDENT@203..212 "undefined" [] [] + 1: SEMICOLON@212..213 ";" [] [] + 12: JS_VARIABLE_STATEMENT@213..235 + 0: JS_VARIABLE_DECLARATION@213..234 + 0: (empty) + 1: USING_KW@213..220 "using" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@220..234 + 0: JS_VARIABLE_DECLARATOR@220..234 + 0: JS_IDENTIFIER_BINDING@220..222 + 0: IDENT@220..222 "z" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@222..234 + 0: EQ@222..224 "=" [] [Whitespace(" ")] + 1: JS_PARENTHESIZED_EXPRESSION@224..234 + 0: L_PAREN@224..225 "(" [] [] + 1: JS_SEQUENCE_EXPRESSION@225..233 + 0: JS_IDENTIFIER_EXPRESSION@225..228 + 0: JS_REFERENCE_IDENTIFIER@225..228 + 0: IDENT@225..228 "foo" [] [] + 1: COMMA@228..230 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@230..233 + 0: JS_REFERENCE_IDENTIFIER@230..233 + 0: IDENT@230..233 "bar" [] [] + 2: R_PAREN@233..234 ")" [] [] + 1: SEMICOLON@234..235 ";" [] [] + 4: EOF@235..236 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap new file mode 100644 index 000000000000..1cf0aaea8dd8 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap @@ -0,0 +1,255 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (using x of y) {}; +for await (using x of y) {}; +for (await using x of y) {}; +for await (await using x of y) {}; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsForOfStatement { + for_token: FOR_KW@0..4 "for" [] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@4..5 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: USING_KW@5..11 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@11..13 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@13..16 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@16..17 "y" [] [], + }, + }, + r_paren_token: R_PAREN@17..19 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@19..20 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@20..21 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")], + await_token: AWAIT_KW@27..33 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@33..34 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: USING_KW@34..40 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@40..42 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@42..45 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@45..46 "y" [] [], + }, + }, + r_paren_token: R_PAREN@46..48 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@48..49 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@49..50 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@50..51 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@51..56 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@56..57 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: AWAIT_KW@57..63 "await" [] [Whitespace(" ")], + kind_token: USING_KW@63..69 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@69..71 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@71..74 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@74..75 "y" [] [], + }, + }, + r_paren_token: R_PAREN@75..77 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@77..78 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@78..79 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@79..80 ";" [] [], + }, + JsForOfStatement { + for_token: FOR_KW@80..85 "for" [Newline("\n")] [Whitespace(" ")], + await_token: AWAIT_KW@85..91 "await" [] [Whitespace(" ")], + l_paren_token: L_PAREN@91..92 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: AWAIT_KW@92..98 "await" [] [Whitespace(" ")], + kind_token: USING_KW@98..104 "using" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@104..106 "x" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + }, + of_token: OF_KW@106..109 "of" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@109..110 "y" [] [], + }, + }, + r_paren_token: R_PAREN@110..112 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@112..113 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@113..114 "}" [] [], + }, + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@114..115 ";" [] [], + }, + ], + eof_token: EOF@115..116 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..116 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..115 + 0: JS_FOR_OF_STATEMENT@0..21 + 0: FOR_KW@0..4 "for" [] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@4..5 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@5..13 + 0: (empty) + 1: USING_KW@5..11 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@11..13 + 0: JS_IDENTIFIER_BINDING@11..13 + 0: IDENT@11..13 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@13..16 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@16..17 + 0: JS_REFERENCE_IDENTIFIER@16..17 + 0: IDENT@16..17 "y" [] [] + 6: R_PAREN@17..19 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@19..21 + 0: L_CURLY@19..20 "{" [] [] + 1: JS_STATEMENT_LIST@20..20 + 2: R_CURLY@20..21 "}" [] [] + 1: JS_EMPTY_STATEMENT@21..22 + 0: SEMICOLON@21..22 ";" [] [] + 2: JS_FOR_OF_STATEMENT@22..50 + 0: FOR_KW@22..27 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@27..33 "await" [] [Whitespace(" ")] + 2: L_PAREN@33..34 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@34..42 + 0: (empty) + 1: USING_KW@34..40 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@40..42 + 0: JS_IDENTIFIER_BINDING@40..42 + 0: IDENT@40..42 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@42..45 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@45..46 + 0: JS_REFERENCE_IDENTIFIER@45..46 + 0: IDENT@45..46 "y" [] [] + 6: R_PAREN@46..48 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@48..50 + 0: L_CURLY@48..49 "{" [] [] + 1: JS_STATEMENT_LIST@49..49 + 2: R_CURLY@49..50 "}" [] [] + 3: JS_EMPTY_STATEMENT@50..51 + 0: SEMICOLON@50..51 ";" [] [] + 4: JS_FOR_OF_STATEMENT@51..79 + 0: FOR_KW@51..56 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@56..57 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@57..71 + 0: AWAIT_KW@57..63 "await" [] [Whitespace(" ")] + 1: USING_KW@63..69 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@69..71 + 0: JS_IDENTIFIER_BINDING@69..71 + 0: IDENT@69..71 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@71..74 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@74..75 + 0: JS_REFERENCE_IDENTIFIER@74..75 + 0: IDENT@74..75 "y" [] [] + 6: R_PAREN@75..77 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@77..79 + 0: L_CURLY@77..78 "{" [] [] + 1: JS_STATEMENT_LIST@78..78 + 2: R_CURLY@78..79 "}" [] [] + 5: JS_EMPTY_STATEMENT@79..80 + 0: SEMICOLON@79..80 ";" [] [] + 6: JS_FOR_OF_STATEMENT@80..114 + 0: FOR_KW@80..85 "for" [Newline("\n")] [Whitespace(" ")] + 1: AWAIT_KW@85..91 "await" [] [Whitespace(" ")] + 2: L_PAREN@91..92 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@92..106 + 0: AWAIT_KW@92..98 "await" [] [Whitespace(" ")] + 1: USING_KW@98..104 "using" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@104..106 + 0: JS_IDENTIFIER_BINDING@104..106 + 0: IDENT@104..106 "x" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 4: OF_KW@106..109 "of" [] [Whitespace(" ")] + 5: JS_IDENTIFIER_EXPRESSION@109..110 + 0: JS_REFERENCE_IDENTIFIER@109..110 + 0: IDENT@109..110 "y" [] [] + 6: R_PAREN@110..112 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@112..114 + 0: L_CURLY@112..113 "{" [] [] + 1: JS_STATEMENT_LIST@113..113 + 2: R_CURLY@113..114 "}" [] [] + 7: JS_EMPTY_STATEMENT@114..115 + 0: SEMICOLON@114..115 ";" [] [] + 4: EOF@115..116 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/var_decl.js b/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/var_decl.js rename to crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js.snap new file mode 100644 index 000000000000..4c6c78fead70 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js.snap @@ -0,0 +1,487 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +var a = 5; +let { foo, bar } = 5; +let bar2, foo2; +const b = 5; +const { foo5: [bar11], baz6 } = {}; +let foo6 = "lorem", bar7 = "ipsum", third8 = "value", fourth = 6; +var q, w, e, r, t; + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@0..4 "var" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@4..6 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@6..8 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@8..9 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@9..10 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@17..20 "foo" [] [], + }, + init: missing (optional), + }, + COMMA@20..22 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@22..26 "bar" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@26..28 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@28..30 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@30..31 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@31..32 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@32..37 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@37..41 "bar2" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@41..43 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@43..47 "foo2" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@47..48 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@48..55 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@55..57 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@57..59 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@59..60 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@61..68 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsObjectBindingPattern { + l_curly_token: L_CURLY@68..70 "{" [] [Whitespace(" ")], + properties: JsObjectBindingPatternPropertyList [ + JsObjectBindingPatternProperty { + member: JsLiteralMemberName { + value: IDENT@70..74 "foo5" [] [], + }, + colon_token: COLON@74..76 ":" [] [Whitespace(" ")], + pattern: JsArrayBindingPattern { + l_brack_token: L_BRACK@76..77 "[" [] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@77..82 "bar11" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@82..83 "]" [] [], + }, + init: missing (optional), + }, + COMMA@83..85 "," [] [Whitespace(" ")], + JsObjectBindingPatternShorthandProperty { + identifier: JsIdentifierBinding { + name_token: IDENT@85..90 "baz6" [] [Whitespace(" ")], + }, + init: missing (optional), + }, + ], + r_curly_token: R_CURLY@90..92 "}" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@92..94 "=" [] [Whitespace(" ")], + expression: JsObjectExpression { + l_curly_token: L_CURLY@94..95 "{" [] [], + members: JsObjectMemberList [], + r_curly_token: R_CURLY@95..96 "}" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@96..97 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@97..102 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@102..107 "foo6" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@107..109 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@109..116 "\"lorem\"" [] [], + }, + }, + }, + COMMA@116..118 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@118..123 "bar7" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@123..125 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@125..132 "\"ipsum\"" [] [], + }, + }, + }, + COMMA@132..134 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@134..141 "third8" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@141..143 "=" [] [Whitespace(" ")], + expression: JsStringLiteralExpression { + value_token: JS_STRING_LITERAL@143..150 "\"value\"" [] [], + }, + }, + }, + COMMA@150..152 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@152..159 "fourth" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@159..161 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@161..162 "6" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@162..163 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: VAR_KW@163..168 "var" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@168..169 "q" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@169..171 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@171..172 "w" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@172..174 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@174..175 "e" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@175..177 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@177..178 "r" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@178..180 "," [] [Whitespace(" ")], + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@180..181 "t" [] [], + }, + variable_annotation: missing (optional), + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@181..182 ";" [] [], + }, + ], + eof_token: EOF@182..183 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..183 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..182 + 0: JS_VARIABLE_STATEMENT@0..10 + 0: JS_VARIABLE_DECLARATION@0..9 + 0: (empty) + 1: VAR_KW@0..4 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@4..9 + 0: JS_VARIABLE_DECLARATOR@4..9 + 0: JS_IDENTIFIER_BINDING@4..6 + 0: IDENT@4..6 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@6..9 + 0: EQ@6..8 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@8..9 + 0: JS_NUMBER_LITERAL@8..9 "5" [] [] + 1: SEMICOLON@9..10 ";" [] [] + 1: JS_VARIABLE_STATEMENT@10..32 + 0: JS_VARIABLE_DECLARATION@10..31 + 0: (empty) + 1: LET_KW@10..15 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@15..31 + 0: JS_VARIABLE_DECLARATOR@15..31 + 0: JS_OBJECT_BINDING_PATTERN@15..28 + 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@17..26 + 0: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@17..20 + 0: JS_IDENTIFIER_BINDING@17..20 + 0: IDENT@17..20 "foo" [] [] + 1: (empty) + 1: COMMA@20..22 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@22..26 + 0: JS_IDENTIFIER_BINDING@22..26 + 0: IDENT@22..26 "bar" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@26..28 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@28..31 + 0: EQ@28..30 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@30..31 + 0: JS_NUMBER_LITERAL@30..31 "5" [] [] + 1: SEMICOLON@31..32 ";" [] [] + 2: JS_VARIABLE_STATEMENT@32..48 + 0: JS_VARIABLE_DECLARATION@32..47 + 0: (empty) + 1: LET_KW@32..37 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@37..47 + 0: JS_VARIABLE_DECLARATOR@37..41 + 0: JS_IDENTIFIER_BINDING@37..41 + 0: IDENT@37..41 "bar2" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@41..43 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@43..47 + 0: JS_IDENTIFIER_BINDING@43..47 + 0: IDENT@43..47 "foo2" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@47..48 ";" [] [] + 3: JS_VARIABLE_STATEMENT@48..61 + 0: JS_VARIABLE_DECLARATION@48..60 + 0: (empty) + 1: CONST_KW@48..55 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@55..60 + 0: JS_VARIABLE_DECLARATOR@55..60 + 0: JS_IDENTIFIER_BINDING@55..57 + 0: IDENT@55..57 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@57..60 + 0: EQ@57..59 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@59..60 + 0: JS_NUMBER_LITERAL@59..60 "5" [] [] + 1: SEMICOLON@60..61 ";" [] [] + 4: JS_VARIABLE_STATEMENT@61..97 + 0: JS_VARIABLE_DECLARATION@61..96 + 0: (empty) + 1: CONST_KW@61..68 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@68..96 + 0: JS_VARIABLE_DECLARATOR@68..96 + 0: JS_OBJECT_BINDING_PATTERN@68..92 + 0: L_CURLY@68..70 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_BINDING_PATTERN_PROPERTY_LIST@70..90 + 0: JS_OBJECT_BINDING_PATTERN_PROPERTY@70..83 + 0: JS_LITERAL_MEMBER_NAME@70..74 + 0: IDENT@70..74 "foo5" [] [] + 1: COLON@74..76 ":" [] [Whitespace(" ")] + 2: JS_ARRAY_BINDING_PATTERN@76..83 + 0: L_BRACK@76..77 "[" [] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@77..82 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@77..82 + 0: JS_IDENTIFIER_BINDING@77..82 + 0: IDENT@77..82 "bar11" [] [] + 1: (empty) + 2: R_BRACK@82..83 "]" [] [] + 3: (empty) + 1: COMMA@83..85 "," [] [Whitespace(" ")] + 2: JS_OBJECT_BINDING_PATTERN_SHORTHAND_PROPERTY@85..90 + 0: JS_IDENTIFIER_BINDING@85..90 + 0: IDENT@85..90 "baz6" [] [Whitespace(" ")] + 1: (empty) + 2: R_CURLY@90..92 "}" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@92..96 + 0: EQ@92..94 "=" [] [Whitespace(" ")] + 1: JS_OBJECT_EXPRESSION@94..96 + 0: L_CURLY@94..95 "{" [] [] + 1: JS_OBJECT_MEMBER_LIST@95..95 + 2: R_CURLY@95..96 "}" [] [] + 1: SEMICOLON@96..97 ";" [] [] + 5: JS_VARIABLE_STATEMENT@97..163 + 0: JS_VARIABLE_DECLARATION@97..162 + 0: (empty) + 1: LET_KW@97..102 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@102..162 + 0: JS_VARIABLE_DECLARATOR@102..116 + 0: JS_IDENTIFIER_BINDING@102..107 + 0: IDENT@102..107 "foo6" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@107..116 + 0: EQ@107..109 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@109..116 + 0: JS_STRING_LITERAL@109..116 "\"lorem\"" [] [] + 1: COMMA@116..118 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@118..132 + 0: JS_IDENTIFIER_BINDING@118..123 + 0: IDENT@118..123 "bar7" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@123..132 + 0: EQ@123..125 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@125..132 + 0: JS_STRING_LITERAL@125..132 "\"ipsum\"" [] [] + 3: COMMA@132..134 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@134..150 + 0: JS_IDENTIFIER_BINDING@134..141 + 0: IDENT@134..141 "third8" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@141..150 + 0: EQ@141..143 "=" [] [Whitespace(" ")] + 1: JS_STRING_LITERAL_EXPRESSION@143..150 + 0: JS_STRING_LITERAL@143..150 "\"value\"" [] [] + 5: COMMA@150..152 "," [] [Whitespace(" ")] + 6: JS_VARIABLE_DECLARATOR@152..162 + 0: JS_IDENTIFIER_BINDING@152..159 + 0: IDENT@152..159 "fourth" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@159..162 + 0: EQ@159..161 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@161..162 + 0: JS_NUMBER_LITERAL@161..162 "6" [] [] + 1: SEMICOLON@162..163 ";" [] [] + 6: JS_VARIABLE_STATEMENT@163..182 + 0: JS_VARIABLE_DECLARATION@163..181 + 0: (empty) + 1: VAR_KW@163..168 "var" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@168..181 + 0: JS_VARIABLE_DECLARATOR@168..169 + 0: JS_IDENTIFIER_BINDING@168..169 + 0: IDENT@168..169 "q" [] [] + 1: (empty) + 2: (empty) + 1: COMMA@169..171 "," [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@171..172 + 0: JS_IDENTIFIER_BINDING@171..172 + 0: IDENT@171..172 "w" [] [] + 1: (empty) + 2: (empty) + 3: COMMA@172..174 "," [] [Whitespace(" ")] + 4: JS_VARIABLE_DECLARATOR@174..175 + 0: JS_IDENTIFIER_BINDING@174..175 + 0: IDENT@174..175 "e" [] [] + 1: (empty) + 2: (empty) + 5: COMMA@175..177 "," [] [Whitespace(" ")] + 6: JS_VARIABLE_DECLARATOR@177..178 + 0: JS_IDENTIFIER_BINDING@177..178 + 0: IDENT@177..178 "r" [] [] + 1: (empty) + 2: (empty) + 7: COMMA@178..180 "," [] [Whitespace(" ")] + 8: JS_VARIABLE_DECLARATOR@180..181 + 0: JS_IDENTIFIER_BINDING@180..181 + 0: IDENT@180..181 "t" [] [] + 1: (empty) + 2: (empty) + 1: SEMICOLON@181..182 ";" [] [] + 4: EOF@182..183 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/while_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/while_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js.snap new file mode 100644 index 000000000000..69ccbfe25ee4 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js.snap @@ -0,0 +1,83 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while (true) {} +while (5) {} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsWhileStatement { + while_token: WHILE_KW@0..6 "while" [] [Whitespace(" ")], + l_paren_token: L_PAREN@6..7 "(" [] [], + test: JsBooleanLiteralExpression { + value_token: TRUE_KW@7..11 "true" [] [], + }, + r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@13..14 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@14..15 "}" [] [], + }, + }, + JsWhileStatement { + while_token: WHILE_KW@15..22 "while" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@22..23 "(" [] [], + test: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..24 "5" [] [], + }, + r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@26..27 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@27..28 "}" [] [], + }, + }, + ], + eof_token: EOF@28..29 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..29 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..28 + 0: JS_WHILE_STATEMENT@0..15 + 0: WHILE_KW@0..6 "while" [] [Whitespace(" ")] + 1: L_PAREN@6..7 "(" [] [] + 2: JS_BOOLEAN_LITERAL_EXPRESSION@7..11 + 0: TRUE_KW@7..11 "true" [] [] + 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@13..15 + 0: L_CURLY@13..14 "{" [] [] + 1: JS_STATEMENT_LIST@14..14 + 2: R_CURLY@14..15 "}" [] [] + 1: JS_WHILE_STATEMENT@15..28 + 0: WHILE_KW@15..22 "while" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@22..23 "(" [] [] + 2: JS_NUMBER_LITERAL_EXPRESSION@23..24 + 0: JS_NUMBER_LITERAL@23..24 "5" [] [] + 3: R_PAREN@24..26 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@26..28 + 0: L_CURLY@26..27 "{" [] [] + 1: JS_STATEMENT_LIST@27..27 + 2: R_CURLY@27..28 "}" [] [] + 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/with_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/with_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs.snap new file mode 100644 index 000000000000..26cf622d215a --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs.snap @@ -0,0 +1,190 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function f(x, o) { + with (o) { + console.log(x); + } +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..20 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@21..22 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@22..24 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@24..25 "o" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@25..27 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@27..28 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsWithStatement { + with_token: WITH_KW@28..36 "with" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + l_paren_token: L_PAREN@36..37 "(" [] [], + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@37..38 "o" [] [], + }, + }, + r_paren_token: R_PAREN@38..40 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@40..41 "{" [] [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsCallExpression { + callee: JsStaticMemberExpression { + object: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@41..53 "console" [Newline("\n"), Whitespace(" ")] [], + }, + }, + operator_token: DOT@53..54 "." [] [], + member: JsName { + value_token: IDENT@54..57 "log" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@57..58 "(" [] [], + args: JsCallArgumentList [ + JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@58..59 "x" [] [], + }, + }, + ], + r_paren_token: R_PAREN@59..60 ")" [] [], + }, + }, + semicolon_token: SEMICOLON@60..61 ";" [] [], + }, + ], + r_curly_token: R_CURLY@61..65 "}" [Newline("\n"), Whitespace(" ")] [], + }, + }, + ], + r_curly_token: R_CURLY@65..67 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@67..68 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..68 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..67 + 0: JS_FUNCTION_DECLARATION@0..67 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@20..27 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..25 + 0: JS_FORMAL_PARAMETER@21..22 + 0: JS_DECORATOR_LIST@21..21 + 1: JS_IDENTIFIER_BINDING@21..22 + 0: IDENT@21..22 "x" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@22..24 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@24..25 + 0: JS_DECORATOR_LIST@24..24 + 1: JS_IDENTIFIER_BINDING@24..25 + 0: IDENT@24..25 "o" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@25..27 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@27..67 + 0: L_CURLY@27..28 "{" [] [] + 1: JS_DIRECTIVE_LIST@28..28 + 2: JS_STATEMENT_LIST@28..65 + 0: JS_WITH_STATEMENT@28..65 + 0: WITH_KW@28..36 "with" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: L_PAREN@36..37 "(" [] [] + 2: JS_IDENTIFIER_EXPRESSION@37..38 + 0: JS_REFERENCE_IDENTIFIER@37..38 + 0: IDENT@37..38 "o" [] [] + 3: R_PAREN@38..40 ")" [] [Whitespace(" ")] + 4: JS_BLOCK_STATEMENT@40..65 + 0: L_CURLY@40..41 "{" [] [] + 1: JS_STATEMENT_LIST@41..61 + 0: JS_EXPRESSION_STATEMENT@41..61 + 0: JS_CALL_EXPRESSION@41..60 + 0: JS_STATIC_MEMBER_EXPRESSION@41..57 + 0: JS_IDENTIFIER_EXPRESSION@41..53 + 0: JS_REFERENCE_IDENTIFIER@41..53 + 0: IDENT@41..53 "console" [Newline("\n"), Whitespace(" ")] [] + 1: DOT@53..54 "." [] [] + 2: JS_NAME@54..57 + 0: IDENT@54..57 "log" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@57..60 + 0: L_PAREN@57..58 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@58..59 + 0: JS_IDENTIFIER_EXPRESSION@58..59 + 0: JS_REFERENCE_IDENTIFIER@58..59 + 0: IDENT@58..59 "x" [] [] + 2: R_PAREN@59..60 ")" [] [] + 1: SEMICOLON@60..61 ";" [] [] + 2: R_CURLY@61..65 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@65..67 "}" [Newline("\n")] [] + 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/yield_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js.snap new file mode 100644 index 000000000000..41e2951d6fe3 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js.snap @@ -0,0 +1,163 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function *foo() { + yield foo; + yield* foo; + yield; + yield + yield +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], + star_token: STAR@9..10 "*" [] [], + id: JsIdentifierBinding { + name_token: IDENT@10..13 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@16..17 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@17..25 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@25..28 "foo" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@28..29 ";" [] [], + }, + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@29..36 "yield" [Newline("\n"), Whitespace(" ")] [], + argument: JsYieldArgument { + star_token: STAR@36..38 "*" [] [Whitespace(" ")], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@38..41 "foo" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@41..42 ";" [] [], + }, + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@42..49 "yield" [Newline("\n"), Whitespace(" ")] [], + argument: missing (optional), + }, + semicolon_token: SEMICOLON@49..50 ";" [] [], + }, + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@50..57 "yield" [Newline("\n"), Whitespace(" ")] [], + argument: missing (optional), + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@57..64 "yield" [Newline("\n"), Whitespace(" ")] [], + argument: missing (optional), + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@64..66 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@66..67 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..67 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..66 + 0: JS_FUNCTION_DECLARATION@0..66 + 0: (empty) + 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] + 2: STAR@9..10 "*" [] [] + 3: JS_IDENTIFIER_BINDING@10..13 + 0: IDENT@10..13 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@13..16 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..14 + 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@16..66 + 0: L_CURLY@16..17 "{" [] [] + 1: JS_DIRECTIVE_LIST@17..17 + 2: JS_STATEMENT_LIST@17..64 + 0: JS_EXPRESSION_STATEMENT@17..29 + 0: JS_YIELD_EXPRESSION@17..28 + 0: YIELD_KW@17..25 "yield" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@25..28 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@25..28 + 0: JS_REFERENCE_IDENTIFIER@25..28 + 0: IDENT@25..28 "foo" [] [] + 1: SEMICOLON@28..29 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@29..42 + 0: JS_YIELD_EXPRESSION@29..41 + 0: YIELD_KW@29..36 "yield" [Newline("\n"), Whitespace(" ")] [] + 1: JS_YIELD_ARGUMENT@36..41 + 0: STAR@36..38 "*" [] [Whitespace(" ")] + 1: JS_IDENTIFIER_EXPRESSION@38..41 + 0: JS_REFERENCE_IDENTIFIER@38..41 + 0: IDENT@38..41 "foo" [] [] + 1: SEMICOLON@41..42 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@42..50 + 0: JS_YIELD_EXPRESSION@42..49 + 0: YIELD_KW@42..49 "yield" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 1: SEMICOLON@49..50 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@50..57 + 0: JS_YIELD_EXPRESSION@50..57 + 0: YIELD_KW@50..57 "yield" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 1: (empty) + 4: JS_EXPRESSION_STATEMENT@57..64 + 0: JS_YIELD_EXPRESSION@57..64 + 0: YIELD_KW@57..64 "yield" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 1: (empty) + 3: R_CURLY@64..66 "}" [Newline("\n")] [] + 4: EOF@66..67 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.js b/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.js rename to crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js.snap new file mode 100644 index 000000000000..19ea2f7f559d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js.snap @@ -0,0 +1,210 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function* foo() { yield 10; } +function* foo() { yield *bar; } +function* foo() { yield; } + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..8 "function" [] [], + star_token: STAR@8..10 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@10..13 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@13..14 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@14..16 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@16..18 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@18..24 "yield" [] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@24..26 "10" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@28..29 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@29..38 "function" [Newline("\n")] [], + star_token: STAR@38..40 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@40..43 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@43..44 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@44..46 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@46..48 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@48..54 "yield" [] [Whitespace(" ")], + argument: JsYieldArgument { + star_token: STAR@54..55 "*" [] [], + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@55..58 "bar" [] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@58..60 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@61..70 "function" [Newline("\n")] [], + star_token: STAR@70..72 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@72..75 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@75..76 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@76..78 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@78..80 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsYieldExpression { + yield_token: YIELD_KW@80..85 "yield" [] [], + argument: missing (optional), + }, + semicolon_token: SEMICOLON@85..87 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@87..88 "}" [] [], + }, + }, + ], + eof_token: EOF@88..89 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..89 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..88 + 0: JS_FUNCTION_DECLARATION@0..29 + 0: (empty) + 1: FUNCTION_KW@0..8 "function" [] [] + 2: STAR@8..10 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@10..13 + 0: IDENT@10..13 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@13..16 + 0: L_PAREN@13..14 "(" [] [] + 1: JS_PARAMETER_LIST@14..14 + 2: R_PAREN@14..16 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@16..29 + 0: L_CURLY@16..18 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@18..18 + 2: JS_STATEMENT_LIST@18..28 + 0: JS_EXPRESSION_STATEMENT@18..28 + 0: JS_YIELD_EXPRESSION@18..26 + 0: YIELD_KW@18..24 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@24..26 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@24..26 + 0: JS_NUMBER_LITERAL@24..26 "10" [] [] + 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] + 3: R_CURLY@28..29 "}" [] [] + 1: JS_FUNCTION_DECLARATION@29..61 + 0: (empty) + 1: FUNCTION_KW@29..38 "function" [Newline("\n")] [] + 2: STAR@38..40 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@40..43 + 0: IDENT@40..43 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@43..46 + 0: L_PAREN@43..44 "(" [] [] + 1: JS_PARAMETER_LIST@44..44 + 2: R_PAREN@44..46 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@46..61 + 0: L_CURLY@46..48 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@48..48 + 2: JS_STATEMENT_LIST@48..60 + 0: JS_EXPRESSION_STATEMENT@48..60 + 0: JS_YIELD_EXPRESSION@48..58 + 0: YIELD_KW@48..54 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@54..58 + 0: STAR@54..55 "*" [] [] + 1: JS_IDENTIFIER_EXPRESSION@55..58 + 0: JS_REFERENCE_IDENTIFIER@55..58 + 0: IDENT@55..58 "bar" [] [] + 1: SEMICOLON@58..60 ";" [] [Whitespace(" ")] + 3: R_CURLY@60..61 "}" [] [] + 2: JS_FUNCTION_DECLARATION@61..88 + 0: (empty) + 1: FUNCTION_KW@61..70 "function" [Newline("\n")] [] + 2: STAR@70..72 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@72..75 + 0: IDENT@72..75 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@75..78 + 0: L_PAREN@75..76 "(" [] [] + 1: JS_PARAMETER_LIST@76..76 + 2: R_PAREN@76..78 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@78..88 + 0: L_CURLY@78..80 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@80..80 + 2: JS_STATEMENT_LIST@80..87 + 0: JS_EXPRESSION_STATEMENT@80..87 + 0: JS_YIELD_EXPRESSION@80..85 + 0: YIELD_KW@80..85 "yield" [] [] + 1: (empty) + 1: SEMICOLON@85..87 ";" [] [Whitespace(" ")] + 3: R_CURLY@87..88 "}" [] [] + 4: EOF@88..89 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/spec_test.rs b/crates/biome_js_parser/tests/spec_test.rs new file mode 100644 index 000000000000..87772e2e7f4f --- /dev/null +++ b/crates/biome_js_parser/tests/spec_test.rs @@ -0,0 +1,189 @@ +use biome_configuration::PartialConfiguration; +use biome_console::fmt::{Formatter, Termcolor}; +use biome_console::markup; +use biome_deserialize::json::deserialize_from_str; +use biome_diagnostics::display::PrintDiagnostic; +use biome_diagnostics::DiagnosticExt; +use biome_diagnostics::{print_diagnostic_to_string, termcolor}; +use biome_fs::BiomePath; +use biome_js_parser::{parse, JsParserOptions}; +use biome_js_syntax::JsFileSource; +use biome_rowan::SyntaxKind; +use biome_service::settings::Settings; +use biome_test_utils::has_bogus_nodes_or_empty_slots; +use std::fmt::Write; +use std::fs; +use std::path::Path; + +#[derive(Copy, Clone)] +pub enum ExpectedOutcome { + Pass, + Fail, + Undefined, +} + +pub fn run(test_case: &str, _snapshot_name: &str, test_directory: &str, outcome_str: &str) { + let outcome = match outcome_str { + "ok" => ExpectedOutcome::Pass, + "error" => ExpectedOutcome::Fail, + "undefined" => ExpectedOutcome::Undefined, + _ => panic!("Invalid expected outcome {outcome_str}"), + }; + + let test_case_path = Path::new(test_case); + + let file_name = test_case_path + .file_name() + .expect("Expected test to have a file name") + .to_str() + .expect("File name to be valid UTF8"); + + let content = fs::read_to_string(test_case_path) + .expect("Expected test path to be a readable file in UTF8 encoding"); + + let mut options = JsParserOptions::default(); + + let options_path = Path::new(test_case_path).with_extension("options.json"); + + if options_path.exists() { + let mut options_path = BiomePath::new(&options_path); + + let mut settings = Settings::default(); + // SAFETY: we checked its existence already, we assume we have rights to read it + let (test_options, diagnostics) = deserialize_from_str::( + options_path.get_buffer_from_file().as_str(), + ) + .consume(); + + settings + .merge_with_configuration(test_options.unwrap_or_default(), None, None, &[]) + .unwrap(); + + let settings = settings.languages.javascript.parser; + + if settings.parse_class_parameter_decorators { + options = options.with_parse_class_parameter_decorators(); + } + + if settings.grit_metavariables { + options = options.with_metavariables(); + } + + if !diagnostics.is_empty() { + for diagnostic in diagnostics { + println!("{:?}", print_diagnostic_to_string(&diagnostic)); + } + + panic!("Configuration is invalid"); + } + } + + let file_source = JsFileSource::try_from(test_case_path).unwrap_or_default(); + + let extension = file_source.file_extension(); + let parsed = parse(&content, file_source, options); + let formatted_ast = format!("{:#?}", parsed.tree()); + + let mut snapshot = String::new(); + writeln!(snapshot, "\n## Input\n\n```{extension}\n{content}\n```\n\n").unwrap(); + + writeln!( + snapshot, + r#"## AST + +``` +{formatted_ast} +``` + +## CST + +``` +{:#?} +``` +"#, + parsed.syntax() + ) + .unwrap(); + + let diagnostics = parsed.diagnostics(); + if !diagnostics.is_empty() { + let mut diagnostics_buffer = termcolor::Buffer::no_color(); + + let termcolor = &mut Termcolor(&mut diagnostics_buffer); + let mut formatter = Formatter::new(termcolor); + + for diagnostic in diagnostics { + let error = diagnostic + .clone() + .with_file_path(file_name) + .with_file_source_code(&content); + + formatter + .write_markup(markup! { + {PrintDiagnostic::verbose(&error)} + }) + .expect("failed to emit diagnostic"); + } + + let formatted_diagnostics = + std::str::from_utf8(diagnostics_buffer.as_slice()).expect("non utf8 in error buffer"); + + if matches!(outcome, ExpectedOutcome::Pass) { + panic!("Expected no errors to be present in a test case that is expected to pass but the following diagnostics are present:\n{formatted_diagnostics}") + } + + writeln!(snapshot, "## Diagnostics\n\n```").unwrap(); + snapshot.write_str(formatted_diagnostics).unwrap(); + + writeln!(snapshot, "```\n").unwrap(); + } + + match outcome { + ExpectedOutcome::Pass => { + let missing_required = formatted_ast.contains("missing (required)"); + if missing_required + || parsed + .syntax() + .descendants() + .any(|node| node.kind().is_bogus()) + { + panic!("Parsed tree of a 'OK' test case should not contain any missing required children or bogus nodes: \n {formatted_ast:#?} \n\n {formatted_ast}"); + } + + let syntax = parsed.syntax(); + if has_bogus_nodes_or_empty_slots(&syntax) { + panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") + } + } + ExpectedOutcome::Fail => { + if parsed.diagnostics().is_empty() { + panic!("Failing test must have diagnostics"); + } + } + _ => {} + } + + insta::with_settings!({ + prepend_module_to_snapshot => false, + snapshot_path => &test_directory, + }, { + insta::assert_snapshot!(file_name, snapshot); + }); +} + +#[ignore] +#[test] +pub fn quick_test() { + let code = r#" +function name() { + return "string"; +} + "#; + + let root = parse(code, JsFileSource::default(), JsParserOptions::default()); + let syntax = root.syntax(); + dbg!(&syntax, root.diagnostics(), root.has_errors()); + if has_bogus_nodes_or_empty_slots(&syntax) { + panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") + } +} diff --git a/crates/biome_js_parser/tests/spec_tests.rs b/crates/biome_js_parser/tests/spec_tests.rs new file mode 100644 index 000000000000..c2eaca65e123 --- /dev/null +++ b/crates/biome_js_parser/tests/spec_tests.rs @@ -0,0 +1,10 @@ +#![allow(non_snake_case)] + +mod spec_test; + +mod ok { + tests_macros::gen_tests! {"tests/js_test_suite/ok/**/*.{js,cjs,mjs,jsx,ts,tsx,d.ts}", crate::spec_test::run, "ok"} +} +mod err { + tests_macros::gen_tests! {"tests/js_test_suite/error/**/*.{js,cjs,mjs,jsx,ts,tsx,d.ts}", crate::spec_test::run, "error"} +} diff --git a/crates/biome_service/src/file_handlers/javascript.rs b/crates/biome_service/src/file_handlers/javascript.rs index bb8f441f4564..5fb6774ef077 100644 --- a/crates/biome_service/src/file_handlers/javascript.rs +++ b/crates/biome_service/src/file_handlers/javascript.rs @@ -73,6 +73,7 @@ pub struct JsFormatterSettings { #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] pub struct JsParserSettings { pub parse_class_parameter_decorators: bool, + pub grit_metavariables: bool, } #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] diff --git a/crates/biome_service/src/settings.rs b/crates/biome_service/src/settings.rs index 77089af01bcb..43c2ca3144e3 100644 --- a/crates/biome_service/src/settings.rs +++ b/crates/biome_service/src/settings.rs @@ -589,6 +589,7 @@ impl From for LanguageSettings { language_setting.formatter.indent_style = formatter.indent_style.map(Into::into); language_setting.parser.parse_class_parameter_decorators = javascript.parser.unsafe_parameter_decorators_enabled; + language_setting.parser.grit_metavariables = javascript.parser.grit_metavariables; language_setting.globals = Some(javascript.globals.into_index_set()); language_setting.environment = javascript.jsx_runtime.into(); diff --git a/packages/@biomejs/backend-jsonrpc/src/workspace.ts b/packages/@biomejs/backend-jsonrpc/src/workspace.ts index 74c660836887..b8ab54b2a6fc 100644 --- a/packages/@biomejs/backend-jsonrpc/src/workspace.ts +++ b/packages/@biomejs/backend-jsonrpc/src/workspace.ts @@ -548,6 +548,10 @@ export interface PartialJavascriptOrganizeImports {} * Options that changes how the JavaScript parser behaves */ export interface PartialJavascriptParser { + /** + * Enables parsing of Grit metavariables. Defaults to `false`. + */ + gritMetavariables?: boolean; /** * It enables the experimental and unsafe parsing of parameter decorators diff --git a/packages/@biomejs/biome/configuration_schema.json b/packages/@biomejs/biome/configuration_schema.json index d08da603fcb9..f88cbb844c48 100644 --- a/packages/@biomejs/biome/configuration_schema.json +++ b/packages/@biomejs/biome/configuration_schema.json @@ -1672,6 +1672,10 @@ "description": "Options that changes how the JavaScript parser behaves", "type": "object", "properties": { + "gritMetavariables": { + "description": "Enables parsing of Grit metavariables. Defaults to `false`.", + "type": ["boolean", "null"] + }, "unsafeParameterDecoratorsEnabled": { "description": "It enables the experimental and unsafe parsing of parameter decorators\n\nThese decorators belong to an old proposal, and they are subject to change.", "type": ["boolean", "null"] diff --git a/xtask/codegen/README.md b/xtask/codegen/README.md deleted file mode 100644 index 04c84dedf3ec..000000000000 --- a/xtask/codegen/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# codegen - -This crate contains local commands used to auto-generate source code. - -## `cargo codegen grammar` -This command transforms the `*.ungram` files into the `biome_*_syntax` and `biome_*_factory` crates. - -The project uses a fork of [`ungrammar`](https://github.com/rust-analyzer/ungrammar) to define the syntax of the language. - -`ungrammar` uses a DSL to define and parse the grammar of a language. - -Once the library parses the DSL files, some custom logic generates the AST APIs. - -## Create a new language - - -## `cargo codegen test` -This command extracts inline comment tests inside `biome_js_parser` into the directory `biome_js_parser/test_data/`. - -A usual workflow would be: -```bash -# (modify inline comment tests inside the parser) -cargo codegen test -cargo test parser # for checking failed tests -UPDATE_EXPECT=1 cargo test parser # for committing the changes -``` - -## `cargo codegen unicode` -This command downloads unicode data from unicode.org and writes it `crates/biome_js_lexer/src/tables.rs`. -Use this command when unicode support has changed. diff --git a/xtask/codegen/css.ungram b/xtask/codegen/css.ungram index fe3209e5c112..747096d4a782 100644 --- a/xtask/codegen/css.ungram +++ b/xtask/codegen/css.ungram @@ -1517,7 +1517,7 @@ AnyCssDocumentMatcher = CssDocumentCustomMatcher = name: ('url-prefix' | 'domain' | 'media-document' | 'regexp') '(' - value: CssString? + value: AnyCssUrlValue? ')' // https://github.com/css-modules/postcss-modules-values